teapot-coding-agent 0.29.29 → 0.29.30
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 +11 -0
- package/dist/agent/tools.js +52 -2
- package/package.json +1 -1
- package/public/assets/{index-CIno4glv.js → index-BHtAJlui.js} +22 -22
- package/public/assets/index-BHtAJlui.js.map +1 -0
- package/public/assets/{shiki-DM4FXbBS.js → shiki-u3mKzSh6.js} +2 -2
- package/public/assets/{shiki-DM4FXbBS.js.map → shiki-u3mKzSh6.js.map} +1 -1
- package/public/index.html +1 -1
- package/public/assets/index-CIno4glv.js.map +0 -1
package/dist/agent/agent.js
CHANGED
|
@@ -252,6 +252,17 @@ Most session state is not injected into prompts — fetch it with tools instead:
|
|
|
252
252
|
save_skill(name, description, content, files=[{name, content}]) so future
|
|
253
253
|
sessions can load_skill them — helper scripts go through files and are made
|
|
254
254
|
executable automatically.
|
|
255
|
+
- LEAD with the answer or the action: no preamble ("Great question", "Let me…",
|
|
256
|
+
"I'll now…") and no closing pleasantries ("Hope this helps", "let me know if…").
|
|
257
|
+
The operator reads the first line and the last line — make those two carry what
|
|
258
|
+
happened and what is next.
|
|
259
|
+
- For multi-step work, number the steps and keep ONE in progress at a time. When you
|
|
260
|
+
are partway through, say which step finished and which is next; do not re-narrate
|
|
261
|
+
the whole plan, and do not assume the operator remembers the previous turn.
|
|
262
|
+
- Report what now WORKS, concretely, rather than what you changed: "login works with
|
|
263
|
+
magic links — try /login" beats "I made some changes to the auth flow".
|
|
264
|
+
- State errors as cause and fix ("test fails at a.spec.ts:42: expected 200, got 401 —
|
|
265
|
+
missing auth header"), never as alarm ("uh oh", "there seems to be a problem").
|
|
255
266
|
- When you make meaningful progress, call report_progress. Its output is
|
|
256
267
|
shown to the operator directly (rendered as markdown in the progress
|
|
257
268
|
panel) — do NOT also repeat the same content as a chat message; end the
|
package/dist/agent/tools.js
CHANGED
|
@@ -1142,13 +1142,41 @@ export const TOOLS = [
|
|
|
1142
1142
|
let off = num(args.offset, 1);
|
|
1143
1143
|
off = off < 0 ? Math.max(0, lines.length + off) : Math.max(0, off - 1);
|
|
1144
1144
|
const lim = num(args.limit, 2000);
|
|
1145
|
+
// A LINE cap alone does not bound the output: a single 5MB minified line is one
|
|
1146
|
+
// "line", and 2000 lines of 2000 chars is 4MB. The three caps below each kill a
|
|
1147
|
+
// different shape of oversized file (#17 item 3):
|
|
1148
|
+
// lines → a 3000-line source file
|
|
1149
|
+
// bytes → a big log, whatever its line structure
|
|
1150
|
+
// per-line → minified.js / a one-line JSON blob
|
|
1145
1151
|
const pageLines = lines.slice(off, off + lim);
|
|
1146
|
-
|
|
1152
|
+
// PER-LINE cap first: clipping lines before joining means one giant line cannot
|
|
1153
|
+
// blow the byte budget on its own, and the marker names how much was cut.
|
|
1154
|
+
const cappedLines = pageLines.map((l) => l.length > MAX_READ_LINE_CHARS
|
|
1155
|
+
? l.slice(0, MAX_READ_LINE_CHARS) +
|
|
1156
|
+
` …[line clipped: ${l.length - MAX_READ_LINE_CHARS} more chars]`
|
|
1157
|
+
: l);
|
|
1158
|
+
const rendered = idMode === "hash" ? renderHashlines(cappedLines, off + 1) : renderGutter(cappedLines, off + 1);
|
|
1147
1159
|
// the phantom trailing line is dropped for the count too, or a file that
|
|
1148
1160
|
// ends in a newline always reports one line more than it has
|
|
1149
1161
|
const total = lines.length && lines[lines.length - 1] === "" ? lines.length - 1 : lines.length;
|
|
1150
1162
|
const more = off + lim < total ? `\n... (${total - off - lim} more lines)` : "";
|
|
1151
|
-
|
|
1163
|
+
const out = rendered + more;
|
|
1164
|
+
// BYTE cap last, with the remaining line count in the marker so the model knows
|
|
1165
|
+
// how to continue rather than assuming it saw everything.
|
|
1166
|
+
if (out.length > MAX_READ_BYTES) {
|
|
1167
|
+
const head = out.slice(0, MAX_READ_BYTES);
|
|
1168
|
+
const cutAt = head.lastIndexOf("\n");
|
|
1169
|
+
return {
|
|
1170
|
+
ok: true,
|
|
1171
|
+
result: (cutAt > 0 ? head.slice(0, cutAt) : head) +
|
|
1172
|
+
`\n... [output clipped at ${MAX_READ_BYTES} bytes of ${out.length}; ` +
|
|
1173
|
+
// `head` holds N rendered lines separated by N-1 newlines, and rendering
|
|
1174
|
+
// started at 1-indexed line `off + 1`, so the next unread line is
|
|
1175
|
+
// off + 1 + N. Counting newlines alone gives N-1 and would re-read one line.
|
|
1176
|
+
`continue with offset=${off + 1 + countLines(cutAt > 0 ? head.slice(0, cutAt) : head) + 1}]`,
|
|
1177
|
+
};
|
|
1178
|
+
}
|
|
1179
|
+
return { ok: true, result: out };
|
|
1152
1180
|
},
|
|
1153
1181
|
},
|
|
1154
1182
|
{
|
|
@@ -1915,6 +1943,28 @@ export const TOOLS = [
|
|
|
1915
1943
|
/** #16: how many files one read_file call may cover. Each costs context, so an
|
|
1916
1944
|
* unbounded array would just be a way to overflow the window in one shot. */
|
|
1917
1945
|
const MAX_MULTI_READ = 10;
|
|
1946
|
+
/**
|
|
1947
|
+
* The three read caps (#17 item 3). A line cap alone is not a bound: one 5MB minified
|
|
1948
|
+
* line is a single "line", and 2000 lines of 2000 chars is 4MB. Each cap kills a
|
|
1949
|
+
* different shape of oversized file:
|
|
1950
|
+
*
|
|
1951
|
+
* 2000 lines → a 3000-line source file (the `limit` default, unchanged)
|
|
1952
|
+
* 256 KB → a 5MB log, whatever its lines
|
|
1953
|
+
* 2000 chars → minified.js / a one-line JSON blob
|
|
1954
|
+
*
|
|
1955
|
+
* The byte cap is a SHARE of what a tool result can be, not the whole budget: the model
|
|
1956
|
+
* still needs room to reason about what it read.
|
|
1957
|
+
*/
|
|
1958
|
+
const MAX_READ_BYTES = 256 * 1024;
|
|
1959
|
+
const MAX_READ_LINE_CHARS = 2_000;
|
|
1960
|
+
/** how many lines a string contains — used to say where to resume a clipped read */
|
|
1961
|
+
function countLines(s) {
|
|
1962
|
+
let n = 0;
|
|
1963
|
+
for (let i = 0; i < s.length; i++)
|
|
1964
|
+
if (s.charCodeAt(i) === 10)
|
|
1965
|
+
n++;
|
|
1966
|
+
return n;
|
|
1967
|
+
}
|
|
1918
1968
|
/**
|
|
1919
1969
|
* Subsequence match: every character of `needle` appears in `hay`, in order,
|
|
1920
1970
|
* gaps allowed (#16 "fuzzy").
|