UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

23 lines (22 loc) • 1.07 kB
import { Type } from "typebox"; export const TASK_STOP_TOOL_NAME = "TaskStop"; export const TASK_STOP_CONTRACT = { contractId: "core.task_stop@1", implementationRevision: "1" }; export const TASK_STOP_MISSING_ID_MESSAGE = "Missing required parameter: task_id"; export const TASK_STOP_PARAMS = Type.Object({ task_id: Type.Optional(Type.String({ description: "The ID of the background task to stop" })), shell_id: Type.Optional(Type.String({ description: "Deprecated: use task_id instead" })), }); export function resolveTaskIdArg(...values) { for (const value of values) { if (typeof value === "string" && value.trim() !== "") return value.trim(); } return undefined; } export const TASK_STOP_DESCRIPTION = [ "- Stops a running background task by its ID", "- Takes a task_id parameter identifying the task to stop", "- To stop a background agent spawned with a name, pass that name as task_id", "- Returns a success or failure status", "- Use this tool when you need to terminate a long-running task", ].join("\n");