teapot-coding-agent 0.29.38 → 0.29.39
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/dist/agent/agent.js +374 -580
- package/dist/agent/meta-tools.js +318 -0
- package/package.json +1 -1
- package/public/assets/{index-Boe0nCqo.js → index-L1Gp6OWN.js} +4 -4
- package/public/assets/{index-Boe0nCqo.js.map → index-L1Gp6OWN.js.map} +1 -1
- package/public/assets/{shiki-KUNLXMJt.js → shiki-aJ4p4mMX.js} +2 -2
- package/public/assets/{shiki-KUNLXMJt.js.map → shiki-aJ4p4mMX.js.map} +1 -1
- package/public/index.html +1 -1
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The META tools: the ones the AGENT LOOP handles itself instead of dispatching to
|
|
3
|
+
* `executeTool` (finish, the goal/todo/memory/feedback tools, ask_user…).
|
|
4
|
+
*
|
|
5
|
+
* ## Why this is a table and not two lists
|
|
6
|
+
*
|
|
7
|
+
* A meta tool used to be declared in TWO hand-maintained places: a 389-line block of
|
|
8
|
+
* `if (call.function.name === "…")` in `runTurnsUntilIdle`, and its spec among the
|
|
9
|
+
* literals in `allToolSpecs`. Nothing connected them, so the failure modes were silent:
|
|
10
|
+
*
|
|
11
|
+
* - a spec with no branch → the model calls a tool that falls through to
|
|
12
|
+
* `executeTool`, which answers "unknown tool" even though the prompt advertised it;
|
|
13
|
+
* - a branch with no spec → dead code, and the model never learns the tool exists.
|
|
14
|
+
*
|
|
15
|
+
* Named in one place, both mistakes become a missing key rather than a runtime surprise.
|
|
16
|
+
* `META_TOOL_NAMES` is derived from this table, so `allToolSpecs()` cannot advertise a
|
|
17
|
+
* meta tool the loop does not handle (see `test/meta-tools.test.ts`).
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Every meta tool, in the order the model sees them.
|
|
21
|
+
*
|
|
22
|
+
* Adding one: add the entry here AND the matching branch in `runTurnsUntilIdle`. The test
|
|
23
|
+
* asserts the two agree, so a half-done addition fails rather than shipping.
|
|
24
|
+
*/
|
|
25
|
+
export const META_TOOLS = [
|
|
26
|
+
{
|
|
27
|
+
name: "finish",
|
|
28
|
+
spec: {
|
|
29
|
+
type: "function",
|
|
30
|
+
function: {
|
|
31
|
+
name: "finish",
|
|
32
|
+
description: "End the current round. Call with goalComplete=true only when the current goal (shown in your prompt) is fully achieved.",
|
|
33
|
+
parameters: {
|
|
34
|
+
type: "object",
|
|
35
|
+
properties: {
|
|
36
|
+
goalComplete: { type: "boolean" },
|
|
37
|
+
summary: { type: "string" },
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: "report_progress",
|
|
45
|
+
spec: {
|
|
46
|
+
type: "function",
|
|
47
|
+
function: {
|
|
48
|
+
name: "report_progress",
|
|
49
|
+
description: "Report current progress to humans: doing, goalStatus, recent attempts, problems, next step.",
|
|
50
|
+
parameters: {
|
|
51
|
+
type: "object",
|
|
52
|
+
properties: {
|
|
53
|
+
doing: { type: "string" },
|
|
54
|
+
goalStatus: { type: "string" },
|
|
55
|
+
recent: { type: "string" },
|
|
56
|
+
problems: { type: "string" },
|
|
57
|
+
next: { type: "string" },
|
|
58
|
+
},
|
|
59
|
+
required: ["doing", "goalStatus", "recent"],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "set_goal",
|
|
66
|
+
spec: {
|
|
67
|
+
type: "function",
|
|
68
|
+
function: {
|
|
69
|
+
name: "set_goal",
|
|
70
|
+
description: "Replace the harness-managed goal text. Use when the objective itself changes — not for routine updates. " +
|
|
71
|
+
"Optionally attach a verification contract (plain-text completion requirements); finish(goalComplete=true) " +
|
|
72
|
+
"is then audited against it by an independent reviewer before the goal counts as done.",
|
|
73
|
+
parameters: {
|
|
74
|
+
type: "object",
|
|
75
|
+
properties: {
|
|
76
|
+
text: { type: "string" },
|
|
77
|
+
verify: {
|
|
78
|
+
type: "string",
|
|
79
|
+
description: "completion requirements that must verifiably hold, e.g. 'npm test passes with zero failures; " +
|
|
80
|
+
"the new endpoint appears in README'. Omit for no audit.",
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
required: ["text"],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: "ask_user",
|
|
90
|
+
spec: {
|
|
91
|
+
type: "function",
|
|
92
|
+
function: {
|
|
93
|
+
name: "ask_user",
|
|
94
|
+
description: "Pause and ask the operator a question — plan confirmation, ambiguous requirements, " +
|
|
95
|
+
"a decision only they can make. The loop parks until they reply; their message arrives " +
|
|
96
|
+
"as your next user turn. Use sparingly: do your homework first, then ask once, concretely.",
|
|
97
|
+
parameters: {
|
|
98
|
+
type: "object",
|
|
99
|
+
properties: {
|
|
100
|
+
question: { type: "string", description: "what you need decided — include the context and trade-offs" },
|
|
101
|
+
options: {
|
|
102
|
+
type: "array",
|
|
103
|
+
items: { type: "string" },
|
|
104
|
+
description: "optional short answer choices the operator can tap",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
required: ["question"],
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "get_goal",
|
|
114
|
+
spec: {
|
|
115
|
+
type: "function",
|
|
116
|
+
function: {
|
|
117
|
+
name: "get_goal",
|
|
118
|
+
description: "Fetch the current goal and its status. Cheap — call at session start, after a compaction notice, or when unsure.",
|
|
119
|
+
parameters: { type: "object", properties: {} },
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: "record_decision",
|
|
125
|
+
spec: {
|
|
126
|
+
type: "function",
|
|
127
|
+
function: {
|
|
128
|
+
name: "record_decision",
|
|
129
|
+
description: "Log a significant choice you made AND why — alternatives considered, trade-offs. Compaction forgets reasoning; this file doesn't.",
|
|
130
|
+
parameters: {
|
|
131
|
+
type: "object",
|
|
132
|
+
properties: {
|
|
133
|
+
decision: { type: "string", description: "what was decided, in one sentence" },
|
|
134
|
+
rationale: { type: "string", description: "why — the reasoning and trade-offs" },
|
|
135
|
+
alternatives: {
|
|
136
|
+
type: "array",
|
|
137
|
+
items: { type: "string" },
|
|
138
|
+
description: "options considered but rejected",
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
required: ["decision", "rationale"],
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "get_decisions",
|
|
148
|
+
spec: {
|
|
149
|
+
type: "function",
|
|
150
|
+
function: {
|
|
151
|
+
name: "get_decisions",
|
|
152
|
+
description: "Read previously logged decisions and their rationale (decisions.md).",
|
|
153
|
+
parameters: { type: "object", properties: {} },
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: "get_feedback",
|
|
159
|
+
spec: {
|
|
160
|
+
type: "function",
|
|
161
|
+
function: {
|
|
162
|
+
name: "get_feedback",
|
|
163
|
+
description: "Read the operator's feedback rules (corrections they've given you, with repetition counts). Check after being corrected.",
|
|
164
|
+
parameters: { type: "object", properties: {} },
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: "add_feedback",
|
|
170
|
+
spec: {
|
|
171
|
+
type: "function",
|
|
172
|
+
function: {
|
|
173
|
+
name: "add_feedback",
|
|
174
|
+
description: "Record a correction as a durable rule (or raise an existing rule's count). Call whenever the operator corrects your behavior so the same mistake isn't repeated.",
|
|
175
|
+
parameters: {
|
|
176
|
+
type: "object",
|
|
177
|
+
properties: { rule: { type: "string", description: "the rule in one imperative sentence" } },
|
|
178
|
+
required: ["rule"],
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: "get_todo",
|
|
185
|
+
spec: {
|
|
186
|
+
type: "function",
|
|
187
|
+
function: {
|
|
188
|
+
name: "get_todo",
|
|
189
|
+
description: "Fetch the operator-maintained task list (todo.md). Check it when picking up work or when unsure what to do next.",
|
|
190
|
+
parameters: { type: "object", properties: {} },
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "set_todo",
|
|
196
|
+
spec: {
|
|
197
|
+
type: "function",
|
|
198
|
+
function: {
|
|
199
|
+
name: "set_todo",
|
|
200
|
+
description: "Update the operator-visible task list (todo.md). PREFERRED: pass updates to change specific " +
|
|
201
|
+
"items — cheap, surgical, no risk of mangling other sections or the operator's own notes. " +
|
|
202
|
+
"Each entry names an item by its exact text and says what to do: done (default), reopen, " +
|
|
203
|
+
"add, or remove. Only pass content to rewrite the whole list when restructuring it. " +
|
|
204
|
+
"Call this promptly on every item you complete.",
|
|
205
|
+
parameters: {
|
|
206
|
+
type: "object",
|
|
207
|
+
properties: {
|
|
208
|
+
updates: {
|
|
209
|
+
type: "array",
|
|
210
|
+
description: "surgical item changes — match existing items by their exact text in todo.md",
|
|
211
|
+
items: {
|
|
212
|
+
type: "object",
|
|
213
|
+
properties: {
|
|
214
|
+
item: { type: "string", description: "item text (without the \"- [ ]\" marker)" },
|
|
215
|
+
action: {
|
|
216
|
+
type: "string",
|
|
217
|
+
enum: ["done", "reopen", "add", "remove"],
|
|
218
|
+
description: "done = check off (default), reopen = uncheck, add = append a new item " +
|
|
219
|
+
"(works even when nothing matches), remove = delete the line",
|
|
220
|
+
},
|
|
221
|
+
done: { type: "boolean", description: "shorthand for action done/reopen (default true)" },
|
|
222
|
+
},
|
|
223
|
+
required: ["item"],
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
content: {
|
|
227
|
+
type: "string",
|
|
228
|
+
description: "full replacement markdown — only for restructures; prefer updates",
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: "read_memory",
|
|
237
|
+
spec: {
|
|
238
|
+
type: "function",
|
|
239
|
+
function: {
|
|
240
|
+
name: "read_memory",
|
|
241
|
+
description: "Read your durable notes (memory.md). Pass `query` to search for the lines that mention something — cheaper than reading the whole file, and the right call when you only need to check one fact.",
|
|
242
|
+
parameters: {
|
|
243
|
+
type: "object",
|
|
244
|
+
properties: {
|
|
245
|
+
query: {
|
|
246
|
+
type: "string",
|
|
247
|
+
description: "case-insensitive substring; omit it to get the whole file",
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
name: "forget_memory",
|
|
256
|
+
spec: {
|
|
257
|
+
type: "function",
|
|
258
|
+
function: {
|
|
259
|
+
name: "forget_memory",
|
|
260
|
+
description: "Delete the lines of memory.md that match a substring. Use it to remove a note that became wrong, or to consolidate duplicates. Returns what was removed, so a mistake is visible and re-addable.",
|
|
261
|
+
parameters: {
|
|
262
|
+
type: "object",
|
|
263
|
+
properties: {
|
|
264
|
+
query: { type: "string", description: "case-insensitive substring of the line(s) to delete" },
|
|
265
|
+
},
|
|
266
|
+
required: ["query"],
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
name: "set_memory",
|
|
273
|
+
spec: {
|
|
274
|
+
type: "function",
|
|
275
|
+
function: {
|
|
276
|
+
name: "set_memory",
|
|
277
|
+
description: "REPLACE your durable notes (memory.md) entirely — anything you do not include is lost. Prefer add_memory unless you are rewriting the whole file. Keep notes terse: decisions, gotchas, where you left off.",
|
|
278
|
+
parameters: {
|
|
279
|
+
type: "object",
|
|
280
|
+
properties: { content: { type: "string" } },
|
|
281
|
+
required: ["content"],
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
name: "add_memory",
|
|
288
|
+
spec: {
|
|
289
|
+
type: "function",
|
|
290
|
+
function: {
|
|
291
|
+
name: "add_memory",
|
|
292
|
+
description: "Append one note to memory.md without touching what is already there. Use this to remember a decision, a gotcha, or where you left off — it cannot lose earlier notes (#48).",
|
|
293
|
+
parameters: {
|
|
294
|
+
type: "object",
|
|
295
|
+
properties: { text: { type: "string", description: "the note to append, one or two lines" } },
|
|
296
|
+
required: ["text"],
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
name: "list_skills",
|
|
303
|
+
spec: {
|
|
304
|
+
type: "function",
|
|
305
|
+
function: {
|
|
306
|
+
name: "list_skills",
|
|
307
|
+
description: "List available skills (name + description). Call before load_skill or to avoid duplicating an existing skill.",
|
|
308
|
+
parameters: { type: "object", properties: {} },
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
];
|
|
313
|
+
/** the names the tool loop must handle itself, in wire order */
|
|
314
|
+
export const META_TOOL_NAMES = META_TOOLS.map((t) => t.name);
|
|
315
|
+
/** just the specs, for splicing into the full tool list */
|
|
316
|
+
export function metaToolSpecs() {
|
|
317
|
+
return META_TOOLS.map((t) => t.spec);
|
|
318
|
+
}
|