teapot-coding-agent 0.37.184 → 0.37.185
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
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, {
|