mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
3.2 KiB
3.2 KiB
ctx.commands
CommandService — provided by @deepseek-ai/dsh-commands.
Human-command registry. Plain-context definitions are global; definitions registered through a command-injected child of an agent context shadow globals for that agent.
ctx.commands.register(definition)
/**
* Register a global or calling-agent-scoped command.
* @param definition - discovery metadata and direct UI handler.
* @returns the exact effect disposer that unregisters this definition.
*/
register(definition: CommandDefinition): () => void
Register a global or calling-agent-scoped command.
definition— discovery metadata and direct UI handler.
Returns the exact effect disposer that unregisters this definition.
ctx.commands.list(agent)
/**
* List the effective immutable command descriptors for one agent.
* @param agent - exact receiving agent and scoped-layer key.
* @returns name-sorted descriptors after scoped shadowing.
*/
list(agent: Agent): readonly CommandDescriptor[]
List the effective immutable command descriptors for one agent.
agent— exact receiving agent and scoped-layer key.
Returns name-sorted descriptors after scoped shadowing.
ctx.commands.find(agent, name)
/**
* Resolve one effective command definition.
* @param agent - exact receiving agent and scoped-layer key.
* @param name - command name without a slash.
* @returns the scoped shadow or global definition.
*/
find(agent: Agent, name: string): CommandDefinition | undefined
Resolve one effective command definition.
agent— exact receiving agent and scoped-layer key.name— command name without a slash.
Returns the scoped shadow or global definition.
ctx.commands.execute(agent, line, signal)
/**
* Parse and execute a known command without sending it to the model.
* @param agent - exact receiving agent.
* @param line - complete slash-command line.
* @param signal - cancellation signal owned by the UI request.
* @returns a detached result, or `undefined` when syntax or name does not resolve.
*/
async execute( agent: Agent, line: string, signal: AbortSignal, ): Promise<CommandResult | undefined>
Parse and execute a known command without sending it to the model.
agent— exact receiving agent.line— complete slash-command line.signal— cancellation signal owned by the UI request.
Returns a detached result, or undefined when syntax or name does not resolve.