feat(background): add background registry and status tool with tests
This commit is contained in:
35
src/background-schema.ts
Normal file
35
src/background-schema.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { StringEnum } from "@mariozechner/pi-ai";
|
||||
import { Type, type Static } from "@sinclair/typebox";
|
||||
|
||||
export function createBackgroundAgentSchema(availableModels: readonly string[]) {
|
||||
return Type.Object(
|
||||
{
|
||||
preset: Type.String({ description: "Subagent preset name to use for this task" }),
|
||||
task: Type.String({ description: "Task to delegate to the child agent" }),
|
||||
model: Type.Optional(
|
||||
StringEnum(availableModels, {
|
||||
description: "Optional child model override. Must be one of the currently available models.",
|
||||
}),
|
||||
),
|
||||
cwd: Type.Optional(Type.String({ description: "Optional working directory override" })),
|
||||
},
|
||||
{ description: "Parameters for launching a background_agent run" },
|
||||
);
|
||||
}
|
||||
|
||||
export const BackgroundAgentSchema = createBackgroundAgentSchema([]);
|
||||
|
||||
export function createBackgroundAgentStatusSchema() {
|
||||
return Type.Object(
|
||||
{
|
||||
runId: Type.Optional(Type.String({ description: "Optional runId to query a single run" })),
|
||||
includeCompleted: Type.Optional(Type.Boolean({ description: "Include completed/finished runs in listing" })),
|
||||
},
|
||||
{ description: "Parameters for background_agent_status tool" },
|
||||
);
|
||||
}
|
||||
|
||||
export const BackgroundAgentStatusSchema = createBackgroundAgentStatusSchema();
|
||||
|
||||
export type BackgroundAgentParams = Static<typeof BackgroundAgentSchema>;
|
||||
export type BackgroundAgentStatusParams = Static<typeof BackgroundAgentStatusSchema>;
|
||||
Reference in New Issue
Block a user