fix(tool-pwsh): present background calls on the generic card like the bash tool
This commit is contained in:
@@ -18,7 +18,7 @@ import { isAbsolute, resolve as resolvePath } from 'node:path'
|
|||||||
import type { Context } from 'cordis'
|
import type { Context } from 'cordis'
|
||||||
import z from 'schemastery'
|
import z from 'schemastery'
|
||||||
import { defineTool, TOOL_ABORTED } from '@deepseek-ai/dsh-tools'
|
import { defineTool, TOOL_ABORTED } from '@deepseek-ai/dsh-tools'
|
||||||
import type { TerminalCallView, ToolResult, ToolResultView } from '@deepseek-ai/dsh-tools'
|
import type { GenericCallView, TerminalCallView, ToolResult, ToolResultView } from '@deepseek-ai/dsh-tools'
|
||||||
import { HarnessError } from '@deepseek-ai/dsh-llm'
|
import { HarnessError } from '@deepseek-ai/dsh-llm'
|
||||||
import type { Agent } from '@deepseek-ai/dsh-agent'
|
import type { Agent } from '@deepseek-ai/dsh-agent'
|
||||||
import type {} from '@deepseek-ai/dsh-system-prompt'
|
import type {} from '@deepseek-ai/dsh-system-prompt'
|
||||||
@@ -276,12 +276,25 @@ export function apply(ctx: Context, config: Config = {}): void {
|
|||||||
return canonicalPwshResult(result)
|
return canonicalPwshResult(result)
|
||||||
},
|
},
|
||||||
/* jscpd:ignore-end */
|
/* jscpd:ignore-end */
|
||||||
presentCall: (args: PwshToolArgs): TerminalCallView => ({
|
presentCall: (args: PwshToolArgs): TerminalCallView | GenericCallView => {
|
||||||
card: 'terminal',
|
// Background acknowledgements carry no terminal exit status; the generic
|
||||||
title: args.command,
|
// card mirrors the bash tool's background presentation.
|
||||||
description: args.description,
|
if (args.run_in_background === true) {
|
||||||
...args.workdir !== undefined ? { cwd: args.workdir } : {},
|
return {
|
||||||
}),
|
card: 'generic',
|
||||||
|
title: args.command,
|
||||||
|
kind: 'execute',
|
||||||
|
rawInput: args.command,
|
||||||
|
content: [{ type: 'text', text: args.description }],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
card: 'terminal',
|
||||||
|
title: args.command,
|
||||||
|
description: args.description,
|
||||||
|
...args.workdir !== undefined ? { cwd: args.workdir } : {},
|
||||||
|
}
|
||||||
|
},
|
||||||
presentResult: (_args: unknown, result: ToolResult): ToolResultView | undefined => {
|
presentResult: (_args: unknown, result: ToolResult): ToolResultView | undefined => {
|
||||||
const block = result.content.length === 1 ? result.content[0] : undefined
|
const block = result.content.length === 1 ? result.content[0] : undefined
|
||||||
if (block === undefined || block.type !== 'text') return undefined
|
if (block === undefined || block.type !== 'text') return undefined
|
||||||
|
|||||||
Reference in New Issue
Block a user