Files
deepseek-harness/packages/self-modification/tool-cordis/src/present.ts
T

53 lines
1.7 KiB
TypeScript
Raw Normal View History

/**
* UI render intents for the three cordis tools — all `generic` cards, decided
* up front as part of the tool design. Presenters are pure functions of the
* call arguments (they run on replay too): no I/O, no session state, no clock.
* No `presentResult` overrides exist — the tools' text results are their
* correct completed rendering.
*
* @module @deepseek-ai/dsh-tool-cordis/present
*/
import type { GenericCallView } from '@deepseek-ai/dsh-tools'
/**
* The `cordis_inspect` call card: a read, titled with the requested section.
* @param args - the validated call arguments.
* @returns the generic call card.
*/
2026-07-19 14:39:49 +08:00
export function presentInspectCall(args: { what?: string; name?: string }): GenericCallView {
const target = args.name === undefined ? args.what : `${args.what}: ${args.name}`
return {
card: 'generic',
kind: 'read',
2026-07-19 14:39:49 +08:00
title: target === undefined ? 'Inspect cordis runtime' : `Inspect cordis runtime: ${target}`,
}
}
/**
2026-07-27 21:20:06 +08:00
* The `cordis_mount` call card: an execute carrying the temporary-plugin code as raw input.
* @param args - the validated call arguments.
* @returns the generic call card.
*/
2026-07-27 21:20:06 +08:00
export function presentMountCall(args: { code: string }): GenericCallView {
return {
card: 'generic',
kind: 'execute',
2026-07-27 21:20:06 +08:00
title: 'Mount temporary Cordis Plugin',
rawInput: { code: args.code },
}
}
/**
2026-07-27 21:20:06 +08:00
* The `cordis_unmount` call card: a delete, titled with the temporary-plugin id.
* @param args - the validated call arguments.
* @returns the generic call card.
*/
2026-07-27 21:20:06 +08:00
export function presentUnmountCall(args: { id: string }): GenericCallView {
return {
card: 'generic',
kind: 'delete',
2026-07-27 21:20:06 +08:00
title: `Unmount temporary Cordis Plugin ${args.id}`,
}
}