@duetso/agent 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +189 -0
- package/README.md +315 -0
- package/dist/package.json +84 -0
- package/dist/src/cli.d.ts +23 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +754 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/core/serializer.d.ts +3 -0
- package/dist/src/core/serializer.d.ts.map +1 -0
- package/dist/src/core/serializer.js +22 -0
- package/dist/src/core/serializer.js.map +1 -0
- package/dist/src/core/structured-output.d.ts +13 -0
- package/dist/src/core/structured-output.d.ts.map +1 -0
- package/dist/src/core/structured-output.js +41 -0
- package/dist/src/core/structured-output.js.map +1 -0
- package/dist/src/guardrails/firewall.d.ts +7 -0
- package/dist/src/guardrails/firewall.d.ts.map +1 -0
- package/dist/src/guardrails/firewall.js +31 -0
- package/dist/src/guardrails/firewall.js.map +1 -0
- package/dist/src/guardrails/pattern.d.ts +13 -0
- package/dist/src/guardrails/pattern.d.ts.map +1 -0
- package/dist/src/guardrails/pattern.js +70 -0
- package/dist/src/guardrails/pattern.js.map +1 -0
- package/dist/src/guardrails/semantic.d.ts +14 -0
- package/dist/src/guardrails/semantic.d.ts.map +1 -0
- package/dist/src/guardrails/semantic.js +47 -0
- package/dist/src/guardrails/semantic.js.map +1 -0
- package/dist/src/index.d.ts +20 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +20 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/compact-json.d.ts +11 -0
- package/dist/src/lib/compact-json.d.ts.map +1 -0
- package/dist/src/lib/compact-json.js +36 -0
- package/dist/src/lib/compact-json.js.map +1 -0
- package/dist/src/lib/xml.d.ts +3 -0
- package/dist/src/lib/xml.d.ts.map +1 -0
- package/dist/src/lib/xml.js +9 -0
- package/dist/src/lib/xml.js.map +1 -0
- package/dist/src/memory/observation-groups.d.ts +15 -0
- package/dist/src/memory/observation-groups.d.ts.map +1 -0
- package/dist/src/memory/observation-groups.js +159 -0
- package/dist/src/memory/observation-groups.js.map +1 -0
- package/dist/src/memory/observational-prompts.d.ts +27 -0
- package/dist/src/memory/observational-prompts.d.ts.map +1 -0
- package/dist/src/memory/observational-prompts.js +237 -0
- package/dist/src/memory/observational-prompts.js.map +1 -0
- package/dist/src/memory/observational.d.ts +63 -0
- package/dist/src/memory/observational.d.ts.map +1 -0
- package/dist/src/memory/observational.js +605 -0
- package/dist/src/memory/observational.js.map +1 -0
- package/dist/src/memory/storage.d.ts +3 -0
- package/dist/src/memory/storage.d.ts.map +1 -0
- package/dist/src/memory/storage.js +127 -0
- package/dist/src/memory/storage.js.map +1 -0
- package/dist/src/memory/store.d.ts +13 -0
- package/dist/src/memory/store.d.ts.map +1 -0
- package/dist/src/memory/store.js +106 -0
- package/dist/src/memory/store.js.map +1 -0
- package/dist/src/model-resolution/duet-gateway.d.ts +35 -0
- package/dist/src/model-resolution/duet-gateway.d.ts.map +1 -0
- package/dist/src/model-resolution/duet-gateway.js +56 -0
- package/dist/src/model-resolution/duet-gateway.js.map +1 -0
- package/dist/src/model-resolution/index.d.ts +31 -0
- package/dist/src/model-resolution/index.d.ts.map +1 -0
- package/dist/src/model-resolution/index.js +129 -0
- package/dist/src/model-resolution/index.js.map +1 -0
- package/dist/src/session/session-manager.d.ts +45 -0
- package/dist/src/session/session-manager.d.ts.map +1 -0
- package/dist/src/session/session-manager.js +94 -0
- package/dist/src/session/session-manager.js.map +1 -0
- package/dist/src/session/session.d.ts +113 -0
- package/dist/src/session/session.d.ts.map +1 -0
- package/dist/src/session/session.js +308 -0
- package/dist/src/session/session.js.map +1 -0
- package/dist/src/tui/app.d.ts +60 -0
- package/dist/src/tui/app.d.ts.map +1 -0
- package/dist/src/tui/app.js +742 -0
- package/dist/src/tui/app.js.map +1 -0
- package/dist/src/turn-runner/agent-events.d.ts +5 -0
- package/dist/src/turn-runner/agent-events.d.ts.map +1 -0
- package/dist/src/turn-runner/agent-events.js +59 -0
- package/dist/src/turn-runner/agent-events.js.map +1 -0
- package/dist/src/turn-runner/prompts.d.ts +13 -0
- package/dist/src/turn-runner/prompts.d.ts.map +1 -0
- package/dist/src/turn-runner/prompts.js +79 -0
- package/dist/src/turn-runner/prompts.js.map +1 -0
- package/dist/src/turn-runner/shell-state-handle.d.ts +32 -0
- package/dist/src/turn-runner/shell-state-handle.d.ts.map +1 -0
- package/dist/src/turn-runner/shell-state-handle.js +168 -0
- package/dist/src/turn-runner/shell-state-handle.js.map +1 -0
- package/dist/src/turn-runner/skill-context.d.ts +26 -0
- package/dist/src/turn-runner/skill-context.d.ts.map +1 -0
- package/dist/src/turn-runner/skill-context.js +110 -0
- package/dist/src/turn-runner/skill-context.js.map +1 -0
- package/dist/src/turn-runner/skills.d.ts +35 -0
- package/dist/src/turn-runner/skills.d.ts.map +1 -0
- package/dist/src/turn-runner/skills.js +130 -0
- package/dist/src/turn-runner/skills.js.map +1 -0
- package/dist/src/turn-runner/state-machine-controller.d.ts +90 -0
- package/dist/src/turn-runner/state-machine-controller.d.ts.map +1 -0
- package/dist/src/turn-runner/state-machine-controller.js +289 -0
- package/dist/src/turn-runner/state-machine-controller.js.map +1 -0
- package/dist/src/turn-runner/state-machine-session.d.ts +27 -0
- package/dist/src/turn-runner/state-machine-session.d.ts.map +1 -0
- package/dist/src/turn-runner/state-machine-session.js +189 -0
- package/dist/src/turn-runner/state-machine-session.js.map +1 -0
- package/dist/src/turn-runner/tools.d.ts +193 -0
- package/dist/src/turn-runner/tools.d.ts.map +1 -0
- package/dist/src/turn-runner/tools.js +509 -0
- package/dist/src/turn-runner/tools.js.map +1 -0
- package/dist/src/turn-runner/turn-runner.d.ts +160 -0
- package/dist/src/turn-runner/turn-runner.d.ts.map +1 -0
- package/dist/src/turn-runner/turn-runner.js +907 -0
- package/dist/src/turn-runner/turn-runner.js.map +1 -0
- package/dist/src/turn-runner/turn-state.d.ts +6 -0
- package/dist/src/turn-runner/turn-state.d.ts.map +1 -0
- package/dist/src/turn-runner/turn-state.js +32 -0
- package/dist/src/turn-runner/turn-state.js.map +1 -0
- package/dist/src/turn-runner/usage-accounting.d.ts +7 -0
- package/dist/src/turn-runner/usage-accounting.d.ts.map +1 -0
- package/dist/src/turn-runner/usage-accounting.js +49 -0
- package/dist/src/turn-runner/usage-accounting.js.map +1 -0
- package/dist/src/types/agent.d.ts +15 -0
- package/dist/src/types/agent.d.ts.map +1 -0
- package/dist/src/types/agent.js +2 -0
- package/dist/src/types/agent.js.map +1 -0
- package/dist/src/types/config.d.ts +37 -0
- package/dist/src/types/config.d.ts.map +1 -0
- package/dist/src/types/config.js +2 -0
- package/dist/src/types/config.js.map +1 -0
- package/dist/src/types/guardrails.d.ts +34 -0
- package/dist/src/types/guardrails.d.ts.map +1 -0
- package/dist/src/types/guardrails.js +2 -0
- package/dist/src/types/guardrails.js.map +1 -0
- package/dist/src/types/memory.d.ts +151 -0
- package/dist/src/types/memory.d.ts.map +1 -0
- package/dist/src/types/memory.js +2 -0
- package/dist/src/types/memory.js.map +1 -0
- package/dist/src/types/protocol.d.ts +426 -0
- package/dist/src/types/protocol.d.ts.map +1 -0
- package/dist/src/types/protocol.js +2 -0
- package/dist/src/types/protocol.js.map +1 -0
- package/dist/src/types/state-machine.d.ts +344 -0
- package/dist/src/types/state-machine.d.ts.map +1 -0
- package/dist/src/types/state-machine.js +2 -0
- package/dist/src/types/state-machine.js.map +1 -0
- package/package.json +84 -0
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
import { createCodingTools } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { Ajv } from "ajv";
|
|
3
|
+
import dedent from "dedent";
|
|
4
|
+
import { Type } from "typebox";
|
|
5
|
+
import { Value } from "typebox/value";
|
|
6
|
+
import { INTERRUPTED_STATE_MACHINE_STATE } from "../types/state-machine.js";
|
|
7
|
+
import { readSkillInstructions } from "./skills.js";
|
|
8
|
+
const jsonSchemaValidator = new Ajv({ strictSchema: false });
|
|
9
|
+
const questionOptionSchema = Type.Object({
|
|
10
|
+
label: Type.String({ description: "Answer text shown to the user." }),
|
|
11
|
+
description: Type.Optional(Type.String({ description: "Optional context explaining this choice." })),
|
|
12
|
+
});
|
|
13
|
+
const questionSchema = Type.Object({
|
|
14
|
+
question: Type.String({ description: "Question to ask the user." }),
|
|
15
|
+
header: Type.Optional(Type.String({ description: "Optional section heading for this question." })),
|
|
16
|
+
options: Type.Array(questionOptionSchema, {
|
|
17
|
+
description: "Answer options the user can choose from.",
|
|
18
|
+
}),
|
|
19
|
+
multiSelect: Type.Optional(Type.Boolean({ description: "Whether the user may select more than one option." })),
|
|
20
|
+
});
|
|
21
|
+
const askUserQuestionSchema = Type.Object({
|
|
22
|
+
questions: Type.Array(questionSchema, {
|
|
23
|
+
description: "Structured multiple-choice questions that must be answered before continuing.",
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
const readSkillSchema = Type.Object({
|
|
27
|
+
name: Type.String({
|
|
28
|
+
description: "Skill name from the available skills metadata in the system prompt. Returns the full SKILL.md instructions (with shell expansions resolved).",
|
|
29
|
+
}),
|
|
30
|
+
});
|
|
31
|
+
const todoStatusSchema = Type.Union([
|
|
32
|
+
Type.Literal("pending"),
|
|
33
|
+
Type.Literal("in_progress"),
|
|
34
|
+
Type.Literal("completed"),
|
|
35
|
+
Type.Literal("failed"),
|
|
36
|
+
], {
|
|
37
|
+
description: "pending = not started; in_progress = actively being worked on (keep at most one); completed = done; failed = could not finish, leave a note in content if useful.",
|
|
38
|
+
});
|
|
39
|
+
const todoItemSchema = Type.Object({
|
|
40
|
+
id: Type.String({
|
|
41
|
+
description: "Stable unique identifier used to edit this todo in later calls. Pick something short and memorable so you can reuse it with merge=true to flip status.",
|
|
42
|
+
}),
|
|
43
|
+
content: Type.String({
|
|
44
|
+
description: "Imperative description of the task, such as 'Run tests' or 'Update README model section'. One sentence; no narration.",
|
|
45
|
+
}),
|
|
46
|
+
status: todoStatusSchema,
|
|
47
|
+
});
|
|
48
|
+
const todoWriteSchema = Type.Object({
|
|
49
|
+
merge: Type.Boolean({
|
|
50
|
+
description: "false = replace the entire list (use this when you first plan the work). true = upsert by id (use this to flip a single todo's status without re-sending the rest).",
|
|
51
|
+
}),
|
|
52
|
+
todos: Type.Array(todoItemSchema, {
|
|
53
|
+
description: "Todo items to write. With merge=false, pass the full desired list. With merge=true, pass only the items being added or updated.",
|
|
54
|
+
}),
|
|
55
|
+
});
|
|
56
|
+
const agentOverrideSchema = Type.Partial(Type.Object({
|
|
57
|
+
prompt: Type.String({ description: "Replacement user prompt for this agent state." }),
|
|
58
|
+
systemPrompt: Type.String({
|
|
59
|
+
description: "Replacement system prompt appended for this sub-agent only.",
|
|
60
|
+
}),
|
|
61
|
+
allowedSkills: Type.Array(Type.String(), {
|
|
62
|
+
description: "Skill names to inject into this sub-agent. Omit to inject all available skills.",
|
|
63
|
+
}),
|
|
64
|
+
inputSchema: Type.Record(Type.String(), Type.Any(), {
|
|
65
|
+
description: 'Replacement valid JSON Schema object for transition input accepted by this state, such as { "type": "object", "properties": { "email": { "type": "string" }, "followUpCount": { "type": "integer" } }, "required": ["email"] }. Fields omitted from required are optional.',
|
|
66
|
+
}),
|
|
67
|
+
}));
|
|
68
|
+
const scriptOverrideSchema = Type.Partial(Type.Object({
|
|
69
|
+
command: Type.String({ description: "Replacement shell command for this script state." }),
|
|
70
|
+
cwd: Type.String({ description: "Replacement working directory for the command." }),
|
|
71
|
+
timeoutMs: Type.Number({ description: "Replacement command timeout in milliseconds." }),
|
|
72
|
+
successCodes: Type.Array(Type.Number(), {
|
|
73
|
+
description: "Replacement exit codes treated as successful completion.",
|
|
74
|
+
}),
|
|
75
|
+
inputSchema: Type.Record(Type.String(), Type.Any(), {
|
|
76
|
+
description: 'Replacement valid JSON Schema object for transition input accepted by this state, such as { "type": "object", "properties": { "email": { "type": "string" }, "followUpCount": { "type": "integer" } }, "required": ["email"] }. Fields omitted from required are optional.',
|
|
77
|
+
}),
|
|
78
|
+
}));
|
|
79
|
+
const pollOverrideSchema = Type.Partial(Type.Object({
|
|
80
|
+
intervalMs: Type.Number({
|
|
81
|
+
description: "Replacement recurring delay between poll wake attempts.",
|
|
82
|
+
}),
|
|
83
|
+
timeoutMs: Type.Number({ description: "Replacement maximum poll-state runtime." }),
|
|
84
|
+
command: Type.String({
|
|
85
|
+
description: "Replacement shell command for one poll attempt.",
|
|
86
|
+
}),
|
|
87
|
+
cwd: Type.String({ description: "Replacement working directory for the poll command." }),
|
|
88
|
+
successCodes: Type.Array(Type.Number(), {
|
|
89
|
+
description: "Replacement exit codes that mean this poll attempt found a result.",
|
|
90
|
+
}),
|
|
91
|
+
inputSchema: Type.Record(Type.String(), Type.Any(), {
|
|
92
|
+
description: 'Replacement valid JSON Schema object for transition input accepted by this state, such as { "type": "object", "properties": { "messageId": { "type": "string" } }, "required": ["messageId"] }. Fields omitted from required are optional.',
|
|
93
|
+
}),
|
|
94
|
+
}));
|
|
95
|
+
const timerOverrideSchema = Type.Partial(Type.Object({
|
|
96
|
+
wakeAt: Type.Number({
|
|
97
|
+
description: "Replacement absolute Unix epoch millisecond time for this timer state.",
|
|
98
|
+
}),
|
|
99
|
+
inputSchema: Type.Record(Type.String(), Type.Any(), {
|
|
100
|
+
description: 'Replacement valid JSON Schema object for transition input accepted by this state, such as { "type": "object", "properties": { "scheduledAt": { "type": "number" } }, "required": ["scheduledAt"] }. Fields omitted from required are optional.',
|
|
101
|
+
}),
|
|
102
|
+
}));
|
|
103
|
+
const stateOverrideSchema = Type.Union([
|
|
104
|
+
Type.Object({ kind: Type.Literal("agent"), state: agentOverrideSchema }),
|
|
105
|
+
Type.Object({ kind: Type.Literal("script"), state: scriptOverrideSchema }),
|
|
106
|
+
Type.Object({ kind: Type.Literal("poll"), state: pollOverrideSchema }),
|
|
107
|
+
Type.Object({ kind: Type.Literal("timer"), state: timerOverrideSchema }),
|
|
108
|
+
]);
|
|
109
|
+
const baseStateSchema = {
|
|
110
|
+
name: Type.String({ description: "State name used by select_state_machine_state." }),
|
|
111
|
+
when: Type.Optional(Type.String({ description: "Guidance for when the parent runner should select this state." })),
|
|
112
|
+
inputSchema: Type.Optional(Type.Record(Type.String(), Type.Any(), {
|
|
113
|
+
description: 'Valid JSON Schema object for the input the parent must pass when selecting this state, such as { "type": "object", "properties": { "email": { "type": "string" }, "followUpCount": { "type": "integer" } }, "required": ["email"] }. Fields omitted from required are optional. Template strings read values from this object.',
|
|
114
|
+
})),
|
|
115
|
+
};
|
|
116
|
+
const agentStateSchema = Type.Object({
|
|
117
|
+
...baseStateSchema,
|
|
118
|
+
kind: Type.Literal("agent", { description: "Run a sub-agent for this state." }),
|
|
119
|
+
prompt: Type.String({
|
|
120
|
+
description: "User prompt sent to the sub-agent. May use templates like {{ input.email }}.",
|
|
121
|
+
}),
|
|
122
|
+
systemPrompt: Type.Optional(Type.String({ description: "Optional system prompt appended for this sub-agent only." })),
|
|
123
|
+
allowedSkills: Type.Optional(Type.Array(Type.String(), {
|
|
124
|
+
description: "Skill names to inject into this sub-agent. Omit to inject all available skills.",
|
|
125
|
+
})),
|
|
126
|
+
});
|
|
127
|
+
const scriptStateSchema = Type.Object({
|
|
128
|
+
...baseStateSchema,
|
|
129
|
+
kind: Type.Literal("script", { description: "Run a shell command for this state." }),
|
|
130
|
+
command: Type.String({
|
|
131
|
+
description: "Shell command to execute. May use templates like {{ input.email }}.",
|
|
132
|
+
}),
|
|
133
|
+
cwd: Type.Optional(Type.String({ description: "Working directory for the command." })),
|
|
134
|
+
timeoutMs: Type.Optional(Type.Number({ description: "Command timeout in milliseconds." })),
|
|
135
|
+
successCodes: Type.Optional(Type.Array(Type.Number(), {
|
|
136
|
+
description: "Exit codes treated as successful completion. Defaults to [0].",
|
|
137
|
+
})),
|
|
138
|
+
});
|
|
139
|
+
const pollStateSchema = Type.Object({
|
|
140
|
+
...baseStateSchema,
|
|
141
|
+
kind: Type.Literal("poll", { description: "Perform one external wait/check attempt." }),
|
|
142
|
+
intervalMs: Type.Number({
|
|
143
|
+
description: "Recurring delay before the next scheduled poll attempt.",
|
|
144
|
+
}),
|
|
145
|
+
timeoutMs: Type.Optional(Type.Number({ description: "Maximum time this state may remain polling." })),
|
|
146
|
+
command: Type.String({
|
|
147
|
+
description: "Shell command for one poll attempt. Return non-empty JSON only when polling found a result.",
|
|
148
|
+
}),
|
|
149
|
+
cwd: Type.Optional(Type.String({ description: "Working directory for the poll command." })),
|
|
150
|
+
successCodes: Type.Optional(Type.Array(Type.Number(), {
|
|
151
|
+
description: "Exit codes that mean this poll attempt found a result.",
|
|
152
|
+
})),
|
|
153
|
+
});
|
|
154
|
+
const timerStateSchema = Type.Object({
|
|
155
|
+
...baseStateSchema,
|
|
156
|
+
kind: Type.Literal("timer", {
|
|
157
|
+
description: "Sleep until one absolute Unix epoch millisecond time, then resume with elapsedMs and timestamp output.",
|
|
158
|
+
}),
|
|
159
|
+
wakeAt: Type.Number({
|
|
160
|
+
description: "Absolute Unix epoch millisecond time when this timer state should complete.",
|
|
161
|
+
}),
|
|
162
|
+
});
|
|
163
|
+
const terminalStateSchema = Type.Object({
|
|
164
|
+
...baseStateSchema,
|
|
165
|
+
kind: Type.Literal("terminal", { description: "Finalize the state-machine session." }),
|
|
166
|
+
status: Type.Union([
|
|
167
|
+
Type.Literal("completed", { description: "The state machine completed successfully." }),
|
|
168
|
+
Type.Literal("failed", { description: "The state machine failed." }),
|
|
169
|
+
Type.Literal("cancelled", { description: "The state machine was cancelled." }),
|
|
170
|
+
]),
|
|
171
|
+
reason: Type.Optional(Type.String({ description: "Optional final explanation for the user." })),
|
|
172
|
+
});
|
|
173
|
+
const stateMachineStateSchema = Type.Union([
|
|
174
|
+
agentStateSchema,
|
|
175
|
+
scriptStateSchema,
|
|
176
|
+
pollStateSchema,
|
|
177
|
+
timerStateSchema,
|
|
178
|
+
terminalStateSchema,
|
|
179
|
+
]);
|
|
180
|
+
const stateMachineDefinitionSchema = Type.Object({
|
|
181
|
+
name: Type.String({ description: "Human-readable state-machine name." }),
|
|
182
|
+
prompt: Type.String({
|
|
183
|
+
description: "Routing guidance explaining when this state-machine definition applies.",
|
|
184
|
+
}),
|
|
185
|
+
states: Type.Array(stateMachineStateSchema, {
|
|
186
|
+
description: "Available states the parent runner may select.",
|
|
187
|
+
}),
|
|
188
|
+
}, {
|
|
189
|
+
description: "State-machine definition. Use inputSchema plus {{ input.foo }} templates for state prompts and commands that need transition input.",
|
|
190
|
+
});
|
|
191
|
+
const createDefinitionSchema = Type.Object({
|
|
192
|
+
definition: stateMachineDefinitionSchema,
|
|
193
|
+
firstState: Type.Optional(Type.String({ description: "Optional state name to run first after creating the definition." })),
|
|
194
|
+
});
|
|
195
|
+
const selectStateSchema = Type.Object({
|
|
196
|
+
decision: Type.Object({
|
|
197
|
+
kind: Type.Union([Type.Literal("run_state"), Type.Literal("terminal"), Type.Literal("fail")]),
|
|
198
|
+
state: Type.Optional(Type.String({ description: "State name to run or finalize." })),
|
|
199
|
+
reason: Type.Optional(Type.String({ description: "Reason for a terminal or failure decision." })),
|
|
200
|
+
override: Type.Optional(stateOverrideSchema),
|
|
201
|
+
input: Type.Optional(Type.Record(Type.String(), Type.Any(), {
|
|
202
|
+
description: "Input object for the selected state. Required when the state inputSchema requires fields; templates read values as {{ input.field }}.",
|
|
203
|
+
})),
|
|
204
|
+
}, {
|
|
205
|
+
description: "State transition decision. Use input when selecting states with inputSchema or {{ input.foo }} templates.",
|
|
206
|
+
}),
|
|
207
|
+
});
|
|
208
|
+
export function isTurnRunnerControlResult(value) {
|
|
209
|
+
if (!value || typeof value !== "object" || !("type" in value))
|
|
210
|
+
return false;
|
|
211
|
+
const type = value.type;
|
|
212
|
+
return (type === "none" ||
|
|
213
|
+
type === "ask_user_question" ||
|
|
214
|
+
type === "create_state_machine_definition" ||
|
|
215
|
+
type === "select_state_machine_state");
|
|
216
|
+
}
|
|
217
|
+
export function createDefaultTurnRunnerTools(cwd, todoStorage, skills = []) {
|
|
218
|
+
return [
|
|
219
|
+
...createCodingTools(cwd),
|
|
220
|
+
createTodoWriteTool(todoStorage),
|
|
221
|
+
createAskUserQuestionTool(),
|
|
222
|
+
createReadSkillTool(skills),
|
|
223
|
+
];
|
|
224
|
+
}
|
|
225
|
+
export function createTurnRunnerTools(input) {
|
|
226
|
+
const tools = [...createDefaultTurnRunnerTools(input.cwd, input.todoStorage, input.skills)];
|
|
227
|
+
if (input.mode === "agent") {
|
|
228
|
+
return tools;
|
|
229
|
+
}
|
|
230
|
+
if (input.mode === "auto") {
|
|
231
|
+
tools.push(createStateMachineDefinitionTool());
|
|
232
|
+
}
|
|
233
|
+
const getDefinition = typeof input.mode === "object"
|
|
234
|
+
? () => input.mode
|
|
235
|
+
: input.getDefinition;
|
|
236
|
+
tools.push(createSelectStateTool(getDefinition));
|
|
237
|
+
tools.push(createCurrentStateMachineStateTool(input.getStateMachine, input.getActiveStateOutput));
|
|
238
|
+
return tools;
|
|
239
|
+
}
|
|
240
|
+
export function applyStateOverride(state, override) {
|
|
241
|
+
if (!override || override.kind !== state.kind) {
|
|
242
|
+
return state;
|
|
243
|
+
}
|
|
244
|
+
return { ...state, ...override.state };
|
|
245
|
+
}
|
|
246
|
+
function createAskUserQuestionTool() {
|
|
247
|
+
return {
|
|
248
|
+
name: "ask_user_question",
|
|
249
|
+
label: "Ask user question",
|
|
250
|
+
description: "Ask the user one or more structured multiple-choice questions. Use this when progress requires user input before continuing.",
|
|
251
|
+
parameters: askUserQuestionSchema,
|
|
252
|
+
async execute(_toolCallId, params) {
|
|
253
|
+
const result = {
|
|
254
|
+
type: "ask_user_question",
|
|
255
|
+
questions: params.questions,
|
|
256
|
+
};
|
|
257
|
+
return {
|
|
258
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
259
|
+
details: result,
|
|
260
|
+
terminate: true,
|
|
261
|
+
};
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
function createReadSkillTool(skills) {
|
|
266
|
+
return {
|
|
267
|
+
name: "read_skill",
|
|
268
|
+
label: "Read skill",
|
|
269
|
+
description: dedent `
|
|
270
|
+
Load the full SKILL.md instructions for one of the available skills listed in the system prompt.
|
|
271
|
+
|
|
272
|
+
The system prompt only lists skill names and one-line descriptions to keep the context small. When a skill's description matches the task at hand, call this tool with its name to fetch the full instructions, then follow them.
|
|
273
|
+
|
|
274
|
+
The response also includes the SKILL.md path so you can read sibling reference files (e.g. \`<dirname(path)>/reference/<file>\`) referenced by the instructions.
|
|
275
|
+
`,
|
|
276
|
+
parameters: readSkillSchema,
|
|
277
|
+
async execute(_toolCallId, params) {
|
|
278
|
+
const skill = skills.find((candidate) => candidate.name === params.name);
|
|
279
|
+
if (!skill) {
|
|
280
|
+
const available = skills.map((candidate) => candidate.name).join(", ") || "(none)";
|
|
281
|
+
throw new Error(`Unknown skill: ${params.name}. Available skills: ${available}`);
|
|
282
|
+
}
|
|
283
|
+
const instructions = readSkillInstructions(skill);
|
|
284
|
+
const header = dedent `
|
|
285
|
+
Skill: ${skill.name}
|
|
286
|
+
Path: ${skill.filePath}
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
`;
|
|
290
|
+
return {
|
|
291
|
+
content: [{ type: "text", text: `${header}\n\n${instructions}` }],
|
|
292
|
+
details: { type: "read_skill", name: skill.name, filePath: skill.filePath },
|
|
293
|
+
};
|
|
294
|
+
},
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
export function createTodoWriteTool(storage) {
|
|
298
|
+
return {
|
|
299
|
+
name: "todo_write",
|
|
300
|
+
label: "Write todos",
|
|
301
|
+
description: dedent `
|
|
302
|
+
Track multi-step work as a structured, visible todo list. The list is shown to the user in real time — it is your shared scratchpad of "what we agreed to do" and "where we are."
|
|
303
|
+
|
|
304
|
+
Reach for this tool whenever any of these are true:
|
|
305
|
+
- The user's message contains more than one independent task ("do X, also Y, and don't forget Z").
|
|
306
|
+
- The work needs three or more non-trivial steps to finish (research, edit, test, commit, etc.).
|
|
307
|
+
- You are about to spend several tool calls on something — write the plan first so the user can see and correct it.
|
|
308
|
+
- You are resuming or interrupting work and want to make state explicit.
|
|
309
|
+
|
|
310
|
+
How to use it well:
|
|
311
|
+
- Lay out the full plan up front with merge=false. Mark exactly one item in_progress at a time.
|
|
312
|
+
- As you finish each item, call again with merge=true and just that item flipped to completed; advance the next one to in_progress in the same call.
|
|
313
|
+
- If the plan changes (user redirects, you discover new work), update the list immediately so it stays honest.
|
|
314
|
+
- Skip the tool only for genuinely single-step requests — a one-shot answer or a single file edit doesn't need a list.
|
|
315
|
+
|
|
316
|
+
Treat "the user gave me a list of asks" as an automatic cue to call this tool before doing anything else.
|
|
317
|
+
`,
|
|
318
|
+
parameters: todoWriteSchema,
|
|
319
|
+
async execute(_toolCallId, params) {
|
|
320
|
+
const todos = params.merge
|
|
321
|
+
? mergeTodos(storage.getTodos(), params.todos)
|
|
322
|
+
: normalizeTodos(params.todos);
|
|
323
|
+
storage.setTodos(todos);
|
|
324
|
+
return {
|
|
325
|
+
content: [{ type: "text", text: formatTodoWriteResult(todos) }],
|
|
326
|
+
details: todos,
|
|
327
|
+
};
|
|
328
|
+
},
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
function mergeTodos(existing, incoming) {
|
|
332
|
+
const merged = existing.map((todo) => ({ ...todo }));
|
|
333
|
+
const indexes = new Map(merged.map((todo, index) => [todo.id, index]));
|
|
334
|
+
for (const todo of normalizeTodos(incoming)) {
|
|
335
|
+
const index = indexes.get(todo.id);
|
|
336
|
+
if (index === undefined) {
|
|
337
|
+
indexes.set(todo.id, merged.length);
|
|
338
|
+
merged.push(todo);
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
merged[index] = todo;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return merged;
|
|
345
|
+
}
|
|
346
|
+
function normalizeTodos(todos) {
|
|
347
|
+
return todos.map((todo) => ({ ...todo }));
|
|
348
|
+
}
|
|
349
|
+
function formatTodoWriteResult(todos) {
|
|
350
|
+
if (todos.length === 0)
|
|
351
|
+
return "Current task list is empty.";
|
|
352
|
+
const lines = todos.map((todo) => `- [${todo.status}] ${todo.id}: ${todo.content}`);
|
|
353
|
+
return ["Current task list:", ...lines].join("\n");
|
|
354
|
+
}
|
|
355
|
+
function createStateMachineDefinitionTool() {
|
|
356
|
+
return {
|
|
357
|
+
name: "create_state_machine_definition",
|
|
358
|
+
label: "Create state machine definition",
|
|
359
|
+
description: dedent `
|
|
360
|
+
Create a state-machine definition for durable business-process work. State prompts and script commands may use template strings such as {{ input.email }}; define inputSchema on those states and pass matching input when selecting them. Agent states may set allowedSkills to restrict which skills are injected into that sub-agent.
|
|
361
|
+
|
|
362
|
+
Poll states always run script attempts on a recurring intervalMs and fail the state machine when timeoutMs is exceeded. Timer states are separate: set kind "timer" with wakeAt as an absolute Unix epoch millisecond timestamp, and the state completes at that time so the parent can choose the next state.
|
|
363
|
+
|
|
364
|
+
Use this only when no state machine is active or the previous state machine has reached a terminal state; otherwise use select_state_machine_state.
|
|
365
|
+
`,
|
|
366
|
+
parameters: createDefinitionSchema,
|
|
367
|
+
async execute(_toolCallId, params) {
|
|
368
|
+
assertValidDefinitionInputSchemas(params.definition);
|
|
369
|
+
const result = {
|
|
370
|
+
type: "create_state_machine_definition",
|
|
371
|
+
definition: params.definition,
|
|
372
|
+
firstState: params.firstState,
|
|
373
|
+
};
|
|
374
|
+
return {
|
|
375
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
376
|
+
details: result,
|
|
377
|
+
terminate: true,
|
|
378
|
+
};
|
|
379
|
+
},
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
function createSelectStateTool(getDefinition) {
|
|
383
|
+
return {
|
|
384
|
+
name: "select_state_machine_state",
|
|
385
|
+
label: "Select state machine state",
|
|
386
|
+
description: "Select the next state-machine state, terminal state, or failure outcome. When the selected state has inputSchema or template strings like {{ input.email }}, pass the matching input object here. Poll overrides must keep intervalMs set; timer overrides may replace wakeAt.",
|
|
387
|
+
parameters: selectStateSchema,
|
|
388
|
+
async execute(_toolCallId, params) {
|
|
389
|
+
const decision = normalizeRunnerDecision(params.decision);
|
|
390
|
+
const definition = getDefinition?.();
|
|
391
|
+
assertValidSelectedState(decision, definition);
|
|
392
|
+
const result = { type: "select_state_machine_state", decision };
|
|
393
|
+
return {
|
|
394
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
395
|
+
details: result,
|
|
396
|
+
terminate: true,
|
|
397
|
+
};
|
|
398
|
+
},
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
function createCurrentStateMachineStateTool(getStateMachine, getActiveStateOutput) {
|
|
402
|
+
return {
|
|
403
|
+
name: "get_current_state_machine_state",
|
|
404
|
+
label: "Get current state-machine state",
|
|
405
|
+
description: "Inspect current state-machine progress, including background work that ran after selecting a state. Use this after resume, interruption, or uncertainty before selecting the next state, and before answering user questions about state-machine progress, poll/wake status, what has already happened, or why the session is waiting.",
|
|
406
|
+
parameters: Type.Object({}),
|
|
407
|
+
async execute() {
|
|
408
|
+
const stateMachine = getStateMachine?.();
|
|
409
|
+
const activeOutput = getActiveStateOutput?.();
|
|
410
|
+
const result = {
|
|
411
|
+
currentState: stateMachine?.currentState,
|
|
412
|
+
currentInput: stateMachine?.currentInput,
|
|
413
|
+
terminal: stateMachine?.terminal,
|
|
414
|
+
progress: stateMachine?.progress,
|
|
415
|
+
historyCount: stateMachine?.history.length ?? 0,
|
|
416
|
+
history: stateMachine?.history.slice(-10) ?? [],
|
|
417
|
+
};
|
|
418
|
+
if (activeOutput) {
|
|
419
|
+
result.activeOutput = activeOutput;
|
|
420
|
+
}
|
|
421
|
+
return {
|
|
422
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
423
|
+
details: result,
|
|
424
|
+
};
|
|
425
|
+
},
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
function assertValidSelectedState(decision, definition) {
|
|
429
|
+
if (decision.kind === "fail" || !definition) {
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
const validStates = definition.states.map((state) => state.name);
|
|
433
|
+
const selectedState = definition.states.find((state) => state.name === decision.state);
|
|
434
|
+
if (!selectedState) {
|
|
435
|
+
throw new Error(`Unknown state: ${decision.state}. Valid states: ${validStates.join(", ")}`);
|
|
436
|
+
}
|
|
437
|
+
if (decision.kind !== "run_state")
|
|
438
|
+
return;
|
|
439
|
+
const effectiveState = applyStateOverride(selectedState, decision.override);
|
|
440
|
+
assertValidStateInputSchema(effectiveState);
|
|
441
|
+
assertValidStateSchedule(effectiveState);
|
|
442
|
+
assertValidStateInput(effectiveState, decision.input);
|
|
443
|
+
}
|
|
444
|
+
function normalizeRunnerDecision(decision) {
|
|
445
|
+
if (decision.kind === "fail") {
|
|
446
|
+
return {
|
|
447
|
+
kind: "fail",
|
|
448
|
+
reason: decision.reason ?? "No available state can make progress.",
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
if (decision.kind === "terminal") {
|
|
452
|
+
return {
|
|
453
|
+
kind: "terminal",
|
|
454
|
+
state: decision.state ?? "",
|
|
455
|
+
reason: decision.reason,
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
return {
|
|
459
|
+
kind: "run_state",
|
|
460
|
+
state: decision.state ?? "",
|
|
461
|
+
reason: decision.reason,
|
|
462
|
+
override: decision.override,
|
|
463
|
+
input: decision.input,
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
function assertValidStateInput(state, input) {
|
|
467
|
+
if (!state.inputSchema)
|
|
468
|
+
return;
|
|
469
|
+
const candidate = input ?? {};
|
|
470
|
+
if (Value.Check(state.inputSchema, candidate))
|
|
471
|
+
return;
|
|
472
|
+
const errors = [...Value.Errors(state.inputSchema, candidate)];
|
|
473
|
+
const first = errors[0];
|
|
474
|
+
const path = first?.path ?? "/";
|
|
475
|
+
const message = first?.message ?? "does not match schema";
|
|
476
|
+
throw new Error(`Invalid input for state "${state.name}" at ${path}: ${message}`);
|
|
477
|
+
}
|
|
478
|
+
function assertValidDefinitionInputSchemas(definition) {
|
|
479
|
+
for (const state of definition.states) {
|
|
480
|
+
if (state.name === INTERRUPTED_STATE_MACHINE_STATE) {
|
|
481
|
+
throw new Error(`State name "${INTERRUPTED_STATE_MACHINE_STATE}" is reserved.`);
|
|
482
|
+
}
|
|
483
|
+
assertValidStateInputSchema(state);
|
|
484
|
+
assertValidStateSchedule(state);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
function assertValidStateInputSchema(state) {
|
|
488
|
+
if (!state.inputSchema)
|
|
489
|
+
return;
|
|
490
|
+
if (jsonSchemaValidator.validateSchema(state.inputSchema))
|
|
491
|
+
return;
|
|
492
|
+
const message = jsonSchemaValidator.errorsText(jsonSchemaValidator.errors, {
|
|
493
|
+
dataVar: `inputSchema for state "${state.name}"`,
|
|
494
|
+
});
|
|
495
|
+
throw new Error(`Invalid inputSchema for state "${state.name}": ${message}`);
|
|
496
|
+
}
|
|
497
|
+
function assertValidStateSchedule(state) {
|
|
498
|
+
if (state.kind === "poll" &&
|
|
499
|
+
(typeof state.intervalMs !== "number" ||
|
|
500
|
+
!Number.isFinite(state.intervalMs) ||
|
|
501
|
+
state.intervalMs <= 0)) {
|
|
502
|
+
throw new Error(`Invalid poll schedule for state "${state.name}": intervalMs must be positive.`);
|
|
503
|
+
}
|
|
504
|
+
if (state.kind === "timer" &&
|
|
505
|
+
(typeof state.wakeAt !== "number" || !Number.isFinite(state.wakeAt))) {
|
|
506
|
+
throw new Error(`Invalid timer schedule for state "${state.name}": wakeAt must be finite.`);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/turn-runner/tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAc,MAAM,iCAAiC,CAAC;AAChF,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AA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