teapot-coding-agent 0.37.184 → 0.37.186
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 +39 -34
- package/dist/agent/context-claim.js +4 -2
- package/dist/agent/tools.js +26 -2
- package/package.json +1 -1
- package/public/assets/index-BZw5NpRx.js +190 -0
- package/public/assets/index-BZw5NpRx.js.map +1 -0
- package/public/index.html +1 -1
- package/public/assets/index-9dZWleTq.js +0 -190
- package/public/assets/index-9dZWleTq.js.map +0 -1
package/dist/agent/agent.js
CHANGED
|
@@ -3404,17 +3404,46 @@ export class Agent {
|
|
|
3404
3404
|
if (mode === "summarize")
|
|
3405
3405
|
this.consecutiveCompactFailures = 0;
|
|
3406
3406
|
this.compactedAtLen = this.messages.length;
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3407
|
+
/**
|
|
3408
|
+
* memory.md is NOT re-attached here.
|
|
3409
|
+
*
|
|
3410
|
+
* It used to be pasted in almost whole (up to 8,000 characters) after every compaction, which the operator caught:
|
|
3411
|
+
* "なんでmemoryをほぼ全注入してるの?" — and in one session what got pasted was a single HTML comment
|
|
3412
|
+
* (`<!-- migrated from session solidocs-9d8ebb6e -->`), i.e. pure noise in the transcript. The system prompt already
|
|
3413
|
+
* carries a DIGEST of memory.md (headings plus one line each, with "call read_memory(query) to search the rest"),
|
|
3414
|
+
* and that digest survives a compaction because the system prompt is rebuilt on every call. Pasting the file again
|
|
3415
|
+
* added nothing the model could not already see or fetch, and it made the post-compaction prompt differ from run to
|
|
3416
|
+
* run — the prefix cache paid for it.
|
|
3417
|
+
*/
|
|
3418
|
+
const refreshed = this.reloadAgentsMd();
|
|
3419
|
+
if (refreshed) {
|
|
3420
|
+
await this.log.append("system_note", this.currentSession, this.currentBranch, {
|
|
3421
|
+
event: "agents-md-reloaded",
|
|
3422
|
+
bytes: refreshed.length,
|
|
3423
|
+
});
|
|
3417
3424
|
}
|
|
3425
|
+
await this.log.append("compaction", this.currentSession, this.currentBranch, {
|
|
3426
|
+
tokensBefore: before,
|
|
3427
|
+
tokensAfter: after,
|
|
3428
|
+
summarized: summarizedCount,
|
|
3429
|
+
dropped: droppedCount,
|
|
3430
|
+
mode,
|
|
3431
|
+
...(summary ? { summary: String(summary).slice(0, 20_000) } : {}),
|
|
3432
|
+
/**
|
|
3433
|
+
* The usage line the notice carries, recorded HERE because this is the event `restoreFromLog` replays.
|
|
3434
|
+
*
|
|
3435
|
+
* The notice sits at the front of every request, so the restored text must be byte-identical to the live one or
|
|
3436
|
+
* the prefix cache misses for the whole session. Recomputing the line at restore would be a second owner of a
|
|
3437
|
+
* fact about a moment in time; recording it here makes the notice reproducible, and an older log without it gets
|
|
3438
|
+
* exactly the notice it always had.
|
|
3439
|
+
*/
|
|
3440
|
+
contextLine: noticeLine,
|
|
3441
|
+
});
|
|
3442
|
+
/**
|
|
3443
|
+
* The re-context notes are logged AFTER the compaction event, so the timeline reads in the order the conversation
|
|
3444
|
+
* actually has: checkpoint, then the notes. They used to be appended first, which put them ABOVE the "context
|
|
3445
|
+
* compacted" row in the feed — reported as "これ何故かタイムライン的にはcompactより前に表示されてるよ".
|
|
3446
|
+
*/
|
|
3418
3447
|
/**
|
|
3419
3448
|
* The GOAL and the open TODO list, re-attached as facts — not left to the summary.
|
|
3420
3449
|
*
|
|
@@ -3468,30 +3497,6 @@ export class Agent {
|
|
|
3468
3497
|
this.recentReads = this.recentReads.filter((rel) => restoredPaths.has(rel));
|
|
3469
3498
|
}
|
|
3470
3499
|
}
|
|
3471
|
-
const refreshed = this.reloadAgentsMd();
|
|
3472
|
-
if (refreshed) {
|
|
3473
|
-
await this.log.append("system_note", this.currentSession, this.currentBranch, {
|
|
3474
|
-
event: "agents-md-reloaded",
|
|
3475
|
-
bytes: refreshed.length,
|
|
3476
|
-
});
|
|
3477
|
-
}
|
|
3478
|
-
await this.log.append("compaction", this.currentSession, this.currentBranch, {
|
|
3479
|
-
tokensBefore: before,
|
|
3480
|
-
tokensAfter: after,
|
|
3481
|
-
summarized: summarizedCount,
|
|
3482
|
-
dropped: droppedCount,
|
|
3483
|
-
mode,
|
|
3484
|
-
...(summary ? { summary: String(summary).slice(0, 20_000) } : {}),
|
|
3485
|
-
/**
|
|
3486
|
-
* The usage line the notice carries, recorded HERE because this is the event `restoreFromLog` replays.
|
|
3487
|
-
*
|
|
3488
|
-
* The notice sits at the front of every request, so the restored text must be byte-identical to the live one or
|
|
3489
|
-
* the prefix cache misses for the whole session. Recomputing the line at restore would be a second owner of a
|
|
3490
|
-
* fact about a moment in time; recording it here makes the notice reproducible, and an older log without it gets
|
|
3491
|
-
* exactly the notice it always had.
|
|
3492
|
-
*/
|
|
3493
|
-
contextLine: noticeLine,
|
|
3494
|
-
});
|
|
3495
3500
|
if (summary)
|
|
3496
3501
|
this.lastCompactSummary = summary;
|
|
3497
3502
|
await this.log.append("system_note", this.currentSession, this.currentBranch, {
|
|
@@ -122,7 +122,7 @@ export function usageLine(used, budget, window) {
|
|
|
122
122
|
* read as "82% used" at 615k and the denominator was a number the model could not see anywhere else. Reported as
|
|
123
123
|
* "生のサイズじゃなくてcompactボーダーまでにしたのはなぜ? 消費/フルサイズ とcompactまでの残り値にすべきでは?".
|
|
124
124
|
*
|
|
125
|
-
* context 68% used (615k/900k tokens, 135k until compaction)
|
|
125
|
+
* context 68% used (615k/900k tokens, 135k until auto-compaction)
|
|
126
126
|
*
|
|
127
127
|
* When the window is unknown the budget is the only denominator available, and the line says so by omitting the
|
|
128
128
|
* window entirely rather than pretending they are the same thing.
|
|
@@ -136,7 +136,9 @@ export function usageLine(used, budget, window) {
|
|
|
136
136
|
const size = full ? `${fmt(used)}/${fmt(full)} tokens` : `${fmt(used)}/${fmt(budget)} tokens (compaction threshold; full window unknown)`;
|
|
137
137
|
return until === null
|
|
138
138
|
? `context ${pct}% used (${size})`
|
|
139
|
-
|
|
139
|
+
// "until auto-compaction" — the mechanism that acts on this number is automatic; plain "compaction" read as
|
|
140
|
+
// something the model had to trigger itself
|
|
141
|
+
: `context ${pct}% used (${size}, ${fmt(until)} until auto-compaction)`;
|
|
140
142
|
}
|
|
141
143
|
/**
|
|
142
144
|
* …and the OTHER thing that gets reported as "context is exhausted": the model has run out of its own ideas.
|
package/dist/agent/tools.js
CHANGED
|
@@ -1502,10 +1502,34 @@ export const TOOLS = [
|
|
|
1502
1502
|
async run(args, ctx) {
|
|
1503
1503
|
if (args.background === true) {
|
|
1504
1504
|
const id = startBackgroundShell(str(args.command), ctx);
|
|
1505
|
+
/**
|
|
1506
|
+
* The result has to say two things the model kept getting wrong (#231, #235).
|
|
1507
|
+
*
|
|
1508
|
+
* - "you are woken when it exits" was already there, but models still polled or kept busy-working while a long
|
|
1509
|
+
* build ran ("モデルがバックエンドbashを待つために止まるってことを知らない / ポーリングしたり、余計な作業をし続けたり").
|
|
1510
|
+
* So the WAKE is stated as an instruction: stopping the round is how you wait, and you do not need to poll.
|
|
1511
|
+
* - and it lists the other jobs still running, because a model that starts three builds forgets the first two
|
|
1512
|
+
* ("そうじゃないと起動したこと忘れるモデルがある").
|
|
1513
|
+
*/
|
|
1514
|
+
const running = [...bgMapFor(ctx.cwd).values()].filter((j) => !j.exited);
|
|
1515
|
+
const others = running.filter((j) => j.id !== id);
|
|
1516
|
+
const list = running
|
|
1517
|
+
.map((j) => {
|
|
1518
|
+
const secs = Math.round((Date.now() - j.startedAt) / 1000);
|
|
1519
|
+
const when = secs >= 60 ? `${Math.round(secs / 60)}m` : `${secs}s`;
|
|
1520
|
+
const cmd = j.cmd.replace(/\s+/g, " ").slice(0, 90);
|
|
1521
|
+
return ` ${j.id}${j.id === id ? " (just started)" : ""} · ${when} · ${cmd}`;
|
|
1522
|
+
})
|
|
1523
|
+
.join("\n");
|
|
1505
1524
|
return {
|
|
1506
1525
|
ok: true,
|
|
1507
|
-
result: `started in background (job ${id})
|
|
1508
|
-
`
|
|
1526
|
+
result: `started in background (job ${id}). ` +
|
|
1527
|
+
`You are WOKEN when it exits (exit code + output tail), so waiting is not your job: do not poll it, do not ` +
|
|
1528
|
+
`sleep, and do not start another round just to check — end your turn (or do other work) and the harness will ` +
|
|
1529
|
+
`call you when it finishes.\n` +
|
|
1530
|
+
`Output mid-run: bash_output(job_id="${id}"). Stop: bash_output(job_id="${id}", action="kill").\n` +
|
|
1531
|
+
`running background jobs for this workspace (${running.length}):\n${list}` +
|
|
1532
|
+
(others.length ? `\nDo not start a duplicate of a job that is already here.` : ""),
|
|
1509
1533
|
};
|
|
1510
1534
|
}
|
|
1511
1535
|
const explicit = args.timeout_ms !== undefined && args.timeout_ms !== null;
|