agentfootprint 7.16.0 → 7.17.0
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/conventions.js +8 -6
- package/dist/conventions.js.map +1 -1
- package/dist/core/Agent.js +31 -26
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/agent/AgentBuilder.js +93 -43
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/core/agent/buildAgentChart.js +8 -8
- package/dist/core/agent/buildAgentChart.js.map +1 -1
- package/dist/core/agent/buildDynamicAgentChart.js +6 -6
- package/dist/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/core/agent/stages/window.js +141 -0
- package/dist/core/agent/stages/window.js.map +1 -0
- package/dist/core/agent/window/errors.js.map +1 -0
- package/dist/core/agent/window/index.js +36 -0
- package/dist/core/agent/window/index.js.map +1 -0
- package/dist/core/agent/window/notice.js +57 -0
- package/dist/core/agent/window/notice.js.map +1 -0
- package/dist/core/agent/window/options.js +93 -0
- package/dist/core/agent/window/options.js.map +1 -0
- package/dist/core/agent/window/removal.js +45 -0
- package/dist/core/agent/window/removal.js.map +1 -0
- package/dist/core/agent/window/strategies/drop.js +106 -0
- package/dist/core/agent/window/strategies/drop.js.map +1 -0
- package/dist/core/agent/window/strategies/slidingWindow.js +87 -0
- package/dist/core/agent/window/strategies/slidingWindow.js.map +1 -0
- package/dist/core/agent/window/strategies/summarizeOldest.js +178 -0
- package/dist/core/agent/window/strategies/summarizeOldest.js.map +1 -0
- package/dist/core/agent/window/strategies/tokenBudget.js +95 -0
- package/dist/core/agent/window/strategies/tokenBudget.js.map +1 -0
- package/dist/core/agent/window/strategy.js +42 -0
- package/dist/core/agent/window/strategy.js.map +1 -0
- package/dist/core/agent/window/summarize.js.map +1 -0
- package/dist/core/agent/{compaction → window}/turns.js +50 -28
- package/dist/core/agent/window/turns.js.map +1 -0
- package/dist/core/agent/window/types.js +23 -0
- package/dist/core/agent/window/types.js.map +1 -0
- package/dist/esm/conventions.d.ts +8 -6
- package/dist/esm/conventions.js +8 -6
- package/dist/esm/conventions.js.map +1 -1
- package/dist/esm/core/Agent.d.ts +6 -6
- package/dist/esm/core/Agent.js +31 -26
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.d.ts +60 -4
- package/dist/esm/core/agent/AgentBuilder.js +93 -43
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/agent/buildAgentChart.d.ts +14 -7
- package/dist/esm/core/agent/buildAgentChart.js +8 -8
- package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
- package/dist/esm/core/agent/buildDynamicAgentChart.js +6 -6
- package/dist/esm/core/agent/buildDynamicAgentChart.js.map +1 -1
- package/dist/esm/core/agent/stages/window.d.ts +63 -0
- package/dist/esm/core/agent/stages/window.js +137 -0
- package/dist/esm/core/agent/stages/window.js.map +1 -0
- package/dist/esm/core/agent/types.d.ts +15 -8
- package/dist/esm/core/agent/window/errors.js.map +1 -0
- package/dist/esm/core/agent/window/index.d.ts +27 -0
- package/dist/esm/core/agent/window/index.js +25 -0
- package/dist/esm/core/agent/window/index.js.map +1 -0
- package/dist/esm/core/agent/window/notice.d.ts +46 -0
- package/dist/esm/core/agent/window/notice.js +52 -0
- package/dist/esm/core/agent/window/notice.js.map +1 -0
- package/dist/esm/core/agent/window/options.d.ts +33 -0
- package/dist/esm/core/agent/window/options.js +87 -0
- package/dist/esm/core/agent/window/options.js.map +1 -0
- package/dist/esm/core/agent/window/removal.d.ts +22 -0
- package/dist/esm/core/agent/window/removal.js +40 -0
- package/dist/esm/core/agent/window/removal.js.map +1 -0
- package/dist/esm/core/agent/window/strategies/drop.d.ts +54 -0
- package/dist/esm/core/agent/window/strategies/drop.js +102 -0
- package/dist/esm/core/agent/window/strategies/drop.js.map +1 -0
- package/dist/esm/core/agent/window/strategies/slidingWindow.d.ts +48 -0
- package/dist/esm/core/agent/window/strategies/slidingWindow.js +83 -0
- package/dist/esm/core/agent/window/strategies/slidingWindow.js.map +1 -0
- package/dist/esm/core/agent/window/strategies/summarizeOldest.d.ts +42 -0
- package/dist/esm/core/agent/window/strategies/summarizeOldest.js +174 -0
- package/dist/esm/core/agent/window/strategies/summarizeOldest.js.map +1 -0
- package/dist/esm/core/agent/window/strategies/tokenBudget.d.ts +47 -0
- package/dist/esm/core/agent/window/strategies/tokenBudget.js +91 -0
- package/dist/esm/core/agent/window/strategies/tokenBudget.js.map +1 -0
- package/dist/esm/core/agent/window/strategy.d.ts +181 -0
- package/dist/esm/core/agent/window/strategy.js +41 -0
- package/dist/esm/core/agent/window/strategy.js.map +1 -0
- package/dist/esm/core/agent/window/summarize.js.map +1 -0
- package/dist/esm/core/agent/window/turns.d.ts +108 -0
- package/dist/esm/core/agent/{compaction → window}/turns.js +48 -26
- package/dist/esm/core/agent/window/turns.js.map +1 -0
- package/dist/esm/core/agent/window/types.d.ts +263 -0
- package/dist/esm/core/agent/window/types.js +22 -0
- package/dist/esm/core/agent/window/types.js.map +1 -0
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +10 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/recorders/core/CompactionMeter.d.ts +25 -19
- package/dist/esm/recorders/core/CompactionMeter.js +27 -19
- package/dist/esm/recorders/core/CompactionMeter.js.map +1 -1
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/dist/recorders/core/CompactionMeter.js +27 -19
- package/dist/recorders/core/CompactionMeter.js.map +1 -1
- package/dist/types/conventions.d.ts +8 -6
- package/dist/types/conventions.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts +6 -6
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts +60 -4
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentChart.d.ts +14 -7
- package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/stages/window.d.ts +64 -0
- package/dist/types/core/agent/stages/window.d.ts.map +1 -0
- package/dist/types/core/agent/types.d.ts +15 -8
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/core/agent/window/errors.d.ts.map +1 -0
- package/dist/types/core/agent/window/index.d.ts +28 -0
- package/dist/types/core/agent/window/index.d.ts.map +1 -0
- package/dist/types/core/agent/window/notice.d.ts +47 -0
- package/dist/types/core/agent/window/notice.d.ts.map +1 -0
- package/dist/types/core/agent/window/options.d.ts +34 -0
- package/dist/types/core/agent/window/options.d.ts.map +1 -0
- package/dist/types/core/agent/window/removal.d.ts +23 -0
- package/dist/types/core/agent/window/removal.d.ts.map +1 -0
- package/dist/types/core/agent/window/strategies/drop.d.ts +55 -0
- package/dist/types/core/agent/window/strategies/drop.d.ts.map +1 -0
- package/dist/types/core/agent/window/strategies/slidingWindow.d.ts +49 -0
- package/dist/types/core/agent/window/strategies/slidingWindow.d.ts.map +1 -0
- package/dist/types/core/agent/window/strategies/summarizeOldest.d.ts +43 -0
- package/dist/types/core/agent/window/strategies/summarizeOldest.d.ts.map +1 -0
- package/dist/types/core/agent/window/strategies/tokenBudget.d.ts +48 -0
- package/dist/types/core/agent/window/strategies/tokenBudget.d.ts.map +1 -0
- package/dist/types/core/agent/window/strategy.d.ts +182 -0
- package/dist/types/core/agent/window/strategy.d.ts.map +1 -0
- package/dist/types/core/agent/window/summarize.d.ts.map +1 -0
- package/dist/types/core/agent/window/turns.d.ts +109 -0
- package/dist/types/core/agent/window/turns.d.ts.map +1 -0
- package/dist/types/core/agent/window/types.d.ts +264 -0
- package/dist/types/core/agent/window/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/recorders/core/CompactionMeter.d.ts +25 -19
- package/dist/types/recorders/core/CompactionMeter.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/core/agent/compaction/errors.js.map +0 -1
- package/dist/core/agent/compaction/index.js +0 -24
- package/dist/core/agent/compaction/index.js.map +0 -1
- package/dist/core/agent/compaction/strategy.js +0 -152
- package/dist/core/agent/compaction/strategy.js.map +0 -1
- package/dist/core/agent/compaction/summarize.js.map +0 -1
- package/dist/core/agent/compaction/turns.js.map +0 -1
- package/dist/core/agent/compaction/types.js +0 -21
- package/dist/core/agent/compaction/types.js.map +0 -1
- package/dist/core/agent/stages/compact.js +0 -130
- package/dist/core/agent/stages/compact.js.map +0 -1
- package/dist/esm/core/agent/compaction/errors.js.map +0 -1
- package/dist/esm/core/agent/compaction/index.d.ts +0 -18
- package/dist/esm/core/agent/compaction/index.js +0 -18
- package/dist/esm/core/agent/compaction/index.js.map +0 -1
- package/dist/esm/core/agent/compaction/strategy.d.ts +0 -103
- package/dist/esm/core/agent/compaction/strategy.js +0 -148
- package/dist/esm/core/agent/compaction/strategy.js.map +0 -1
- package/dist/esm/core/agent/compaction/summarize.js.map +0 -1
- package/dist/esm/core/agent/compaction/turns.d.ts +0 -85
- package/dist/esm/core/agent/compaction/turns.js.map +0 -1
- package/dist/esm/core/agent/compaction/types.d.ts +0 -148
- package/dist/esm/core/agent/compaction/types.js +0 -20
- package/dist/esm/core/agent/compaction/types.js.map +0 -1
- package/dist/esm/core/agent/stages/compact.d.ts +0 -59
- package/dist/esm/core/agent/stages/compact.js +0 -126
- package/dist/esm/core/agent/stages/compact.js.map +0 -1
- package/dist/types/core/agent/compaction/errors.d.ts.map +0 -1
- package/dist/types/core/agent/compaction/index.d.ts +0 -19
- package/dist/types/core/agent/compaction/index.d.ts.map +0 -1
- package/dist/types/core/agent/compaction/strategy.d.ts +0 -104
- package/dist/types/core/agent/compaction/strategy.d.ts.map +0 -1
- package/dist/types/core/agent/compaction/summarize.d.ts.map +0 -1
- package/dist/types/core/agent/compaction/turns.d.ts +0 -86
- package/dist/types/core/agent/compaction/turns.d.ts.map +0 -1
- package/dist/types/core/agent/compaction/types.d.ts +0 -149
- package/dist/types/core/agent/compaction/types.d.ts.map +0 -1
- package/dist/types/core/agent/stages/compact.d.ts +0 -60
- package/dist/types/core/agent/stages/compact.d.ts.map +0 -1
- /package/dist/core/agent/{compaction → window}/errors.js +0 -0
- /package/dist/core/agent/{compaction → window}/summarize.js +0 -0
- /package/dist/esm/core/agent/{compaction → window}/errors.d.ts +0 -0
- /package/dist/esm/core/agent/{compaction → window}/errors.js +0 -0
- /package/dist/esm/core/agent/{compaction → window}/summarize.d.ts +0 -0
- /package/dist/esm/core/agent/{compaction → window}/summarize.js +0 -0
- /package/dist/types/core/agent/{compaction → window}/errors.d.ts +0 -0
- /package/dist/types/core/agent/{compaction → window}/summarize.d.ts +0 -0
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* compactionMeter — the instrument
|
|
2
|
+
* compactionMeter — the instrument a window strategy is allowed to read.
|
|
3
3
|
*
|
|
4
4
|
* Pattern: CombinedRecorder (Convention 1 — single purpose: measurement),
|
|
5
|
-
* with a handle the
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* Role: recorders/core layer. Attached ONLY when
|
|
10
|
-
* configured, and always INLINE — a
|
|
11
|
-
* one beat behind the loop it is
|
|
5
|
+
* with a handle the window stage reads MID-run. That mid-run read is
|
|
6
|
+
* deliberate and has precedent: the causal-evidence recorder is
|
|
7
|
+
* attached inline for the same reason (the memory write stage
|
|
8
|
+
* consumes its accumulators before the run ends).
|
|
9
|
+
* Role: recorders/core layer. Attached ONLY when a window strategy is
|
|
10
|
+
* configured (`.window()` / `.compaction()`), and always INLINE — a
|
|
11
|
+
* window decision cannot ride one beat behind the loop it is
|
|
12
|
+
* deciding for.
|
|
12
13
|
* Emits: nothing. It only measures.
|
|
13
14
|
*
|
|
14
15
|
* It answers two questions a stage function cannot answer for itself:
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
* `runtimeStageId` on every write to `history`. A stage function has no
|
|
20
21
|
* access to its own runtimeStageId (footprintjs exposes no such scope
|
|
21
22
|
* method), so the recorder channel is the ONLY honest source for the
|
|
22
|
-
* `
|
|
23
|
+
* `removedStageIds` a strategy has to name.
|
|
23
24
|
*/
|
|
24
25
|
import type { EmitEvent, WriteEvent } from 'footprintjs';
|
|
25
26
|
/** What the provider reported for the most recent completed LLM call. */
|
|
@@ -42,16 +43,21 @@ export interface CompactionMeterHandle {
|
|
|
42
43
|
/** Origins aligned index-for-index with the current window. */
|
|
43
44
|
origins(): readonly MessageOrigin[];
|
|
44
45
|
/**
|
|
45
|
-
* Tell the meter a
|
|
46
|
-
* the
|
|
47
|
-
* the leading messages the
|
|
48
|
-
* `tail` is the messages kept after the
|
|
46
|
+
* Tell the meter a window strategy is about to change the window, so it can
|
|
47
|
+
* re-align origins to the new one — `[...head, (inserted)?, ...tail]`:
|
|
48
|
+
* `head` is the leading messages the strategy stepped over (turns that
|
|
49
|
+
* refused to leave), `tail` is the messages kept after the removed span.
|
|
49
50
|
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
51
|
+
* `insertedAtMs` is the birth of the ONE message the strategy put in the
|
|
52
|
+
* span's place (compaction's summary, a drop's authored notice). Omit it
|
|
53
|
+
* when the strategy removed messages and inserted nothing.
|
|
54
|
+
*
|
|
55
|
+
* Called by the stage that performs the change, BEFORE it writes — the
|
|
56
|
+
* shape change is the one thing the meter cannot infer, because the
|
|
57
|
+
* TypedScope set trap JSON-round-trips every write and destroys object
|
|
58
|
+
* identity.
|
|
53
59
|
*/
|
|
54
|
-
|
|
60
|
+
rebaseForWindowChange(headCount: number, keptTailCount: number, insertedAtMs?: number): void;
|
|
55
61
|
clear(): void;
|
|
56
62
|
onWrite(event: WriteEvent): void;
|
|
57
63
|
onEmit(event: EmitEvent): void;
|
|
@@ -72,7 +78,7 @@ export interface CompactionMeterOptions {
|
|
|
72
78
|
* append to it (tool-calls). Growth fills the new tail with the writing
|
|
73
79
|
* stage's id; a wholesale replacement re-stamps everything with the writer
|
|
74
80
|
* that produced it — which is exactly true, since that writer is where those
|
|
75
|
-
* messages entered THIS run. Shrink only ever comes from a
|
|
76
|
-
* announces
|
|
81
|
+
* messages entered THIS run. Shrink only ever comes from a window strategy,
|
|
82
|
+
* and the stage announces it through `rebaseForWindowChange`.
|
|
77
83
|
*/
|
|
78
84
|
export declare function compactionMeter(options?: CompactionMeterOptions): CompactionMeterHandle;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* compactionMeter — the instrument
|
|
2
|
+
* compactionMeter — the instrument a window strategy is allowed to read.
|
|
3
3
|
*
|
|
4
4
|
* Pattern: CombinedRecorder (Convention 1 — single purpose: measurement),
|
|
5
|
-
* with a handle the
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* Role: recorders/core layer. Attached ONLY when
|
|
10
|
-
* configured, and always INLINE — a
|
|
11
|
-
* one beat behind the loop it is
|
|
5
|
+
* with a handle the window stage reads MID-run. That mid-run read is
|
|
6
|
+
* deliberate and has precedent: the causal-evidence recorder is
|
|
7
|
+
* attached inline for the same reason (the memory write stage
|
|
8
|
+
* consumes its accumulators before the run ends).
|
|
9
|
+
* Role: recorders/core layer. Attached ONLY when a window strategy is
|
|
10
|
+
* configured (`.window()` / `.compaction()`), and always INLINE — a
|
|
11
|
+
* window decision cannot ride one beat behind the loop it is
|
|
12
|
+
* deciding for.
|
|
12
13
|
* Emits: nothing. It only measures.
|
|
13
14
|
*
|
|
14
15
|
* It answers two questions a stage function cannot answer for itself:
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
* `runtimeStageId` on every write to `history`. A stage function has no
|
|
20
21
|
* access to its own runtimeStageId (footprintjs exposes no such scope
|
|
21
22
|
* method), so the recorder channel is the ONLY honest source for the
|
|
22
|
-
* `
|
|
23
|
+
* `removedStageIds` a strategy has to name.
|
|
23
24
|
*/
|
|
24
25
|
/**
|
|
25
26
|
* Build the meter.
|
|
@@ -29,8 +30,8 @@
|
|
|
29
30
|
* append to it (tool-calls). Growth fills the new tail with the writing
|
|
30
31
|
* stage's id; a wholesale replacement re-stamps everything with the writer
|
|
31
32
|
* that produced it — which is exactly true, since that writer is where those
|
|
32
|
-
* messages entered THIS run. Shrink only ever comes from a
|
|
33
|
-
* announces
|
|
33
|
+
* messages entered THIS run. Shrink only ever comes from a window strategy,
|
|
34
|
+
* and the stage announces it through `rebaseForWindowChange`.
|
|
34
35
|
*/
|
|
35
36
|
export function compactionMeter(options = {}) {
|
|
36
37
|
const id = options.id ?? 'compaction-meter';
|
|
@@ -38,14 +39,18 @@ export function compactionMeter(options = {}) {
|
|
|
38
39
|
const now = options.now ?? (() => Date.now());
|
|
39
40
|
let origins = [];
|
|
40
41
|
let last;
|
|
41
|
-
/** Set by `
|
|
42
|
+
/** Set by `rebaseForWindowChange`; consumed by the very next write to `key`. */
|
|
42
43
|
let pendingRebase;
|
|
43
44
|
return {
|
|
44
45
|
id,
|
|
45
46
|
lastCall: () => last,
|
|
46
47
|
origins: () => origins,
|
|
47
|
-
|
|
48
|
-
pendingRebase = {
|
|
48
|
+
rebaseForWindowChange(headCount, keptTailCount, insertedAtMs) {
|
|
49
|
+
pendingRebase = {
|
|
50
|
+
head: headCount,
|
|
51
|
+
tail: keptTailCount,
|
|
52
|
+
...(insertedAtMs !== undefined && { bornAtMs: insertedAtMs }),
|
|
53
|
+
};
|
|
49
54
|
},
|
|
50
55
|
clear() {
|
|
51
56
|
origins = [];
|
|
@@ -59,13 +64,16 @@ export function compactionMeter(options = {}) {
|
|
|
59
64
|
const stageId = event.runtimeStageId;
|
|
60
65
|
const atMs = now();
|
|
61
66
|
if (pendingRebase !== undefined) {
|
|
62
|
-
// The
|
|
63
|
-
// and the kept tail carry their original provenance forward,
|
|
64
|
-
// the point — a message the
|
|
65
|
-
// looking like the
|
|
67
|
+
// The window stage's own write. Anything it INSERTED is born here;
|
|
68
|
+
// the head and the kept tail carry their original provenance forward,
|
|
69
|
+
// which is the point — a message the strategy did NOT write must
|
|
70
|
+
// never end up looking like the strategy wrote it.
|
|
66
71
|
const head = origins.slice(0, pendingRebase.head);
|
|
67
72
|
const tail = pendingRebase.tail > 0 ? origins.slice(origins.length - pendingRebase.tail) : [];
|
|
68
|
-
|
|
73
|
+
const inserted = pendingRebase.bornAtMs === undefined
|
|
74
|
+
? []
|
|
75
|
+
: [{ stageId, bornAtMs: pendingRebase.bornAtMs }];
|
|
76
|
+
origins = [...head, ...inserted, ...tail];
|
|
69
77
|
pendingRebase = undefined;
|
|
70
78
|
// Trust the write's own length over our bookkeeping if they disagree.
|
|
71
79
|
if (origins.length !== length)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompactionMeter.js","sourceRoot":"","sources":["../../../../src/recorders/core/CompactionMeter.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"CompactionMeter.js","sourceRoot":"","sources":["../../../../src/recorders/core/CompactionMeter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAwDH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,UAAkC,EAAE;IAClE,MAAM,EAAE,GAAG,OAAO,CAAC,EAAE,IAAI,kBAAkB,CAAC;IAC5C,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,SAAS,CAAC;IACrC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAE9C,IAAI,OAAO,GAAoB,EAAE,CAAC;IAClC,IAAI,IAA6B,CAAC;IAClC,gFAAgF;IAChF,IAAI,aAA4E,CAAC;IAEjF,OAAO;QACL,EAAE;QAEF,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI;QACpB,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO;QAEtB,qBAAqB,CAAC,SAAiB,EAAE,aAAqB,EAAE,YAAqB;YACnF,aAAa,GAAG;gBACd,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,aAAa;gBACnB,GAAG,CAAC,YAAY,KA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OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -21,8 +21,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
21
21
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.
|
|
25
|
-
exports.indexDocuments = exports.defineRAG = exports.providerFromEnv = exports.Graph = exports.graph = exports.Workflow = exports.workflow = exports.LoopBuilder = exports.Loop = exports.ConditionalBuilder = exports.Conditional = exports.ParallelBuilder = void 0;
|
|
24
|
+
exports.warnIfInvalidToolName = exports.assertValidToolName = exports.defineTool = exports.flowchartAsTool = exports.RunCheckpointError = exports.applyOutputSchema = exports.OutputSchemaError = exports.tokenBudget = exports.summarizeOldest = exports.slidingWindow = exports.isDropNotice = exports.isCompactedSummary = exports.DROP_NOTICE_PREFIX = exports.COMPACTED_FRAME_PREFIX = exports.CompactionUnmeasurableError = exports.AgentBuilder = exports.Agent = exports.buildAgentMessageApiChart = exports.LLMCallBuilder = exports.LLMCall = exports.selectCommentaryKey = exports.renderCommentary = exports.extractCommentaryVars = exports.extractAgentName = exports.defaultCommentaryTemplates = exports.CheckInRecorder = exports.minimalEvidenceAssembler = exports.standardEvidenceAssembler = exports.lexicalDriverScorer = exports.isCheckInDecision = exports.checkInDeclined = exports.checkInApproved = exports.isCheckInPause = exports.isPaused = exports.isPauseRequest = exports.askHuman = exports.pauseHere = exports.makeRunId = exports.RunnerBase = exports.BASELINE_SOURCES = exports.ENGINEERED_SOURCES = exports.isBaselineSource = exports.isEngineeredSource = exports.contextEngineering = exports.COMPOSITION_KEYS = exports.milestoneFor = exports.stageRole = exports.isInjectionKey = exports.injectionKeyForSlot = exports.INJECTION_KEYS = void 0;
|
|
25
|
+
exports.indexDocuments = exports.defineRAG = exports.providerFromEnv = exports.Graph = exports.graph = exports.Workflow = exports.workflow = exports.LoopBuilder = exports.Loop = exports.ConditionalBuilder = exports.Conditional = exports.ParallelBuilder = exports.Parallel = exports.SequenceBuilder = exports.Sequence = exports.formatToolContractCheckup = exports.toolContractCheckup = void 0;
|
|
26
26
|
// Side-effect imports — auto-register v2.6+ cache strategies in the
|
|
27
27
|
// strategy registry. Without these, only the wildcard NoOp is
|
|
28
28
|
// registered and `Agent.create({ provider: browserAnthropic({...}) })`
|
|
@@ -134,14 +134,24 @@ Object.defineProperty(exports, "buildAgentMessageApiChart", { enumerable: true,
|
|
|
134
134
|
var Agent_js_1 = require("./core/Agent.js");
|
|
135
135
|
Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return Agent_js_1.Agent; } });
|
|
136
136
|
Object.defineProperty(exports, "AgentBuilder", { enumerable: true, get: function () { return Agent_js_1.AgentBuilder; } });
|
|
137
|
-
// `.compaction()` — keep the live window inside
|
|
138
|
-
// losing the record.
|
|
139
|
-
// turn byte-identical, and
|
|
140
|
-
//
|
|
141
|
-
|
|
137
|
+
// `.window(strategy)` / `.compaction()` — keep the live context window inside
|
|
138
|
+
// its budget without ever losing the record. A strategy edits the WINDOW; the
|
|
139
|
+
// LEDGER keeps every removed turn byte-identical, and every strategy files its
|
|
140
|
+
// own recorded step naming the runtimeStageIds whose messages left.
|
|
141
|
+
//
|
|
142
|
+
// Three ship, over one turn segmentation and one refusal engine:
|
|
143
|
+
// summarizeOldest fold the oldest span into a summary (what `.compaction()` is)
|
|
144
|
+
// slidingWindow keep the last N turns, drop older ones
|
|
145
|
+
// tokenBudget counted-token trigger, drop instead of summarize
|
|
146
|
+
var index_js_1 = require("./core/agent/window/index.js");
|
|
142
147
|
Object.defineProperty(exports, "CompactionUnmeasurableError", { enumerable: true, get: function () { return index_js_1.CompactionUnmeasurableError; } });
|
|
143
148
|
Object.defineProperty(exports, "COMPACTED_FRAME_PREFIX", { enumerable: true, get: function () { return index_js_1.COMPACTED_FRAME_PREFIX; } });
|
|
149
|
+
Object.defineProperty(exports, "DROP_NOTICE_PREFIX", { enumerable: true, get: function () { return index_js_1.DROP_NOTICE_PREFIX; } });
|
|
144
150
|
Object.defineProperty(exports, "isCompactedSummary", { enumerable: true, get: function () { return index_js_1.isCompactedSummary; } });
|
|
151
|
+
Object.defineProperty(exports, "isDropNotice", { enumerable: true, get: function () { return index_js_1.isDropNotice; } });
|
|
152
|
+
Object.defineProperty(exports, "slidingWindow", { enumerable: true, get: function () { return index_js_1.slidingWindow; } });
|
|
153
|
+
Object.defineProperty(exports, "summarizeOldest", { enumerable: true, get: function () { return index_js_1.summarizeOldest; } });
|
|
154
|
+
Object.defineProperty(exports, "tokenBudget", { enumerable: true, get: function () { return index_js_1.tokenBudget; } });
|
|
145
155
|
var outputSchema_js_1 = require("./core/outputSchema.js");
|
|
146
156
|
Object.defineProperty(exports, "OutputSchemaError", { enumerable: true, get: function () { return outputSchema_js_1.OutputSchemaError; } });
|
|
147
157
|
Object.defineProperty(exports, "applyOutputSchema", { enumerable: true, get: function () { return outputSchema_js_1.applyOutputSchema; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;AAEH,oEAAoE;AACpE,8DAA8D;AAC9D,uEAAuE;AACvE,kEAAkE;AAClE,sEAAsE;AACtE,sDAAsD;AACtD,wDAAsD;AACtD,qDAAmD;AACnD,sDAAoD;AAsCpD,6BAA6B;AAC7B,sDAAoC;AAEpC,yEAAyE;AACzE,uDAAuD;AACvD,mDAkB0B;AAjBxB,gHAAA,cAAc,OAAA;AACd,qHAAA,mBAAmB,OAAA;AACnB,gHAAA,cAAc,OAAA;AAEd,yEAAyE;AACzE,wEAAwE;AACxE,yEAAyE;AACzE,gBAAgB;AAChB,2GAAA,SAAS,OAAA;AAET,2EAA2E;AAC3E,6EAA6E;AAC7E,6EAA6E;AAC7E,6DAA6D;AAC7D,8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R,uGAAA,QAAQ,OAAA;AAIV,iDAQ8B;AAP5B,iGAAA,KAAK,OAAA;AACL,iGAAA,KAAK,OAAA;AAQP,2BAA2B;AAC3B,8EAA8E;AAC9E,wEAAwE;AACxE,mEAAmE;AACnE,qEAAqE;AACrE,EAAE;AACF,kEAAkE;AAClE,qEAAqE;AACrE,wEAAwE;AACxE,gEAAgE;AAChE,gEAAgE;AAChE,6CAA6C;AAC7C,EAAE;AACF,2FAA2F;AAC3F,wFAAwF;AAExF,sEAK0C;AAJxC,oHAAA,eAAe,OAAA;AAMjB,+DAA+D;AAE/D,oEAAoE;AACpE,gEAAgE;AAEhE,qEAAqE;AACrE,0DAA0D;AAC1D,sDAAoC;AAEpC,uEAAuE;AACvE,uEAAuE;AACvE,oEAAoE;AACpE,sEAAsE;AACtE,8CAA8C;AAE9C,wEAAwE;AACxE,sEAAsE;AACtE,sEAAsE;AACtE,+CAM4B;AAL1B,qGAAA,SAAS,OAAA;AAET,0GAAA,cAAc,OAAA;AAKhB,qEAAqE;AACrE,wEAAwE;AACxE,uEAAuE;AACvE,oEAAoE;AACpE,8DAA8D;AAC9D,wEAAwE;AACxE,gDAAgD;AAChD,wEAAwE;AACxE,gEAAgE;AAEhE,wEAAwE;AACxE,wEAAwE;AACxE,uDAAuD;AAEvD,mEAAmE;AACnE,oEAAoE;AACpE,sDAAsD"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* compactionMeter — the instrument
|
|
3
|
+
* compactionMeter — the instrument a window strategy is allowed to read.
|
|
4
4
|
*
|
|
5
5
|
* Pattern: CombinedRecorder (Convention 1 — single purpose: measurement),
|
|
6
|
-
* with a handle the
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* Role: recorders/core layer. Attached ONLY when
|
|
11
|
-
* configured, and always INLINE — a
|
|
12
|
-
* one beat behind the loop it is
|
|
6
|
+
* with a handle the window stage reads MID-run. That mid-run read is
|
|
7
|
+
* deliberate and has precedent: the causal-evidence recorder is
|
|
8
|
+
* attached inline for the same reason (the memory write stage
|
|
9
|
+
* consumes its accumulators before the run ends).
|
|
10
|
+
* Role: recorders/core layer. Attached ONLY when a window strategy is
|
|
11
|
+
* configured (`.window()` / `.compaction()`), and always INLINE — a
|
|
12
|
+
* window decision cannot ride one beat behind the loop it is
|
|
13
|
+
* deciding for.
|
|
13
14
|
* Emits: nothing. It only measures.
|
|
14
15
|
*
|
|
15
16
|
* It answers two questions a stage function cannot answer for itself:
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
* `runtimeStageId` on every write to `history`. A stage function has no
|
|
21
22
|
* access to its own runtimeStageId (footprintjs exposes no such scope
|
|
22
23
|
* method), so the recorder channel is the ONLY honest source for the
|
|
23
|
-
* `
|
|
24
|
+
* `removedStageIds` a strategy has to name.
|
|
24
25
|
*/
|
|
25
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
27
|
exports.compactionMeter = void 0;
|
|
@@ -32,8 +33,8 @@ exports.compactionMeter = void 0;
|
|
|
32
33
|
* append to it (tool-calls). Growth fills the new tail with the writing
|
|
33
34
|
* stage's id; a wholesale replacement re-stamps everything with the writer
|
|
34
35
|
* that produced it — which is exactly true, since that writer is where those
|
|
35
|
-
* messages entered THIS run. Shrink only ever comes from a
|
|
36
|
-
* announces
|
|
36
|
+
* messages entered THIS run. Shrink only ever comes from a window strategy,
|
|
37
|
+
* and the stage announces it through `rebaseForWindowChange`.
|
|
37
38
|
*/
|
|
38
39
|
function compactionMeter(options = {}) {
|
|
39
40
|
const id = options.id ?? 'compaction-meter';
|
|
@@ -41,14 +42,18 @@ function compactionMeter(options = {}) {
|
|
|
41
42
|
const now = options.now ?? (() => Date.now());
|
|
42
43
|
let origins = [];
|
|
43
44
|
let last;
|
|
44
|
-
/** Set by `
|
|
45
|
+
/** Set by `rebaseForWindowChange`; consumed by the very next write to `key`. */
|
|
45
46
|
let pendingRebase;
|
|
46
47
|
return {
|
|
47
48
|
id,
|
|
48
49
|
lastCall: () => last,
|
|
49
50
|
origins: () => origins,
|
|
50
|
-
|
|
51
|
-
pendingRebase = {
|
|
51
|
+
rebaseForWindowChange(headCount, keptTailCount, insertedAtMs) {
|
|
52
|
+
pendingRebase = {
|
|
53
|
+
head: headCount,
|
|
54
|
+
tail: keptTailCount,
|
|
55
|
+
...(insertedAtMs !== undefined && { bornAtMs: insertedAtMs }),
|
|
56
|
+
};
|
|
52
57
|
},
|
|
53
58
|
clear() {
|
|
54
59
|
origins = [];
|
|
@@ -62,13 +67,16 @@ function compactionMeter(options = {}) {
|
|
|
62
67
|
const stageId = event.runtimeStageId;
|
|
63
68
|
const atMs = now();
|
|
64
69
|
if (pendingRebase !== undefined) {
|
|
65
|
-
// The
|
|
66
|
-
// and the kept tail carry their original provenance forward,
|
|
67
|
-
// the point — a message the
|
|
68
|
-
// looking like the
|
|
70
|
+
// The window stage's own write. Anything it INSERTED is born here;
|
|
71
|
+
// the head and the kept tail carry their original provenance forward,
|
|
72
|
+
// which is the point — a message the strategy did NOT write must
|
|
73
|
+
// never end up looking like the strategy wrote it.
|
|
69
74
|
const head = origins.slice(0, pendingRebase.head);
|
|
70
75
|
const tail = pendingRebase.tail > 0 ? origins.slice(origins.length - pendingRebase.tail) : [];
|
|
71
|
-
|
|
76
|
+
const inserted = pendingRebase.bornAtMs === undefined
|
|
77
|
+
? []
|
|
78
|
+
: [{ stageId, bornAtMs: pendingRebase.bornAtMs }];
|
|
79
|
+
origins = [...head, ...inserted, ...tail];
|
|
72
80
|
pendingRebase = undefined;
|
|
73
81
|
// Trust the write's own length over our bookkeeping if they disagree.
|
|
74
82
|
if (origins.length !== length)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompactionMeter.js","sourceRoot":"","sources":["../../../src/recorders/core/CompactionMeter.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"CompactionMeter.js","sourceRoot":"","sources":["../../../src/recorders/core/C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,CAAC,IAAI,KAAK,+BAA+B;gBAAE,OAAO;YAC3D,MAAM,OAAO,GAAG,KAAK,CAAC,OAAsE,CAAC;YAC7F,MAAM,KAAK,GAAG,OAAO,EAAE,KAAK,CAAC;YAC7B,IAAI,OAAO,KAAK,EAAE,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,EAAE,MAAM,KAAK,QAAQ;gBAAE,OAAO;YAClF,IAAI,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,CAAC;QAC5F,CAAC;KACF,CAAC;AACJ,CAAC;AAxED,0CAwEC;AAED,SAAS,SAAS,CAChB,OAAiC,EACjC,MAAc,EACd,OAAe,EACf,IAAY;IAEZ,MAAM,IAAI,GAAoB,EAAE,CAAC;IACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE;QAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;IACtF,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -88,12 +88,14 @@ export declare const STAGE_IDS: {
|
|
|
88
88
|
readonly FORMAT_MERGE: "format-merge";
|
|
89
89
|
readonly MERGE_LLM: "merge-llm";
|
|
90
90
|
readonly EXTRACT_MERGE: "extract-merge";
|
|
91
|
-
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* unchanged.
|
|
91
|
+
/** Window-strategy stage (7.16 as compaction; any strategy since 7.17).
|
|
92
|
+
* Mounted ONLY when `.window()` / `.compaction()` is configured, and when
|
|
93
|
+
* it is, it BECOMES the ReAct loop target — so it runs once per iteration
|
|
94
|
+
* boundary and everything downstream in the turn (injection triggers, all
|
|
95
|
+
* 3 slots, the wire) sees one window. Without a strategy the stage does
|
|
96
|
+
* not exist and the loop target is unchanged. The id stays `compact` for
|
|
97
|
+
* every strategy: it is the protocol name every lens and matcher already
|
|
98
|
+
* binds to, and which strategy ran is on the record. */
|
|
97
99
|
readonly COMPACT: "compact";
|
|
98
100
|
/** Updates the rolling skill-history window before CacheGate
|
|
99
101
|
* evaluates skill-churn (v2.6). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conventions.d.ts","sourceRoot":"","sources":["../../src/conventions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,gEAAgE;AAChE,eAAO,MAAM,WAAW;IACtB;0EACsE;;IAEtE;;qDAEiD;;IAEjD,+DAA+D;;IAE/D,6BAA6B;;IAE7B,0BAA0B;;IAE1B,2CAA2C;;IAE3C,uDAAuD;;IAEvD,kCAAkC;;IAElC;;;;oCAIgC;;IAEhC;;;;;;gCAM4B;;IAE5B;;;wDAGoD;;IAEpD;;;;;iCAK6B;;CAErB,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAEvE,6DAA6D;AAC7D,eAAO,MAAM,SAAS;;IAEpB;;oFAEgF;;IAEhF;;;;;0EAKsE;;IAEtE;;;yDAGqD;;;IAGrD;;;8DAG0D;;;;;;IAM1D
|
|
1
|
+
{"version":3,"file":"conventions.d.ts","sourceRoot":"","sources":["../../src/conventions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,gEAAgE;AAChE,eAAO,MAAM,WAAW;IACtB;0EACsE;;IAEtE;;qDAEiD;;IAEjD,+DAA+D;;IAE/D,6BAA6B;;IAE7B,0BAA0B;;IAE1B,2CAA2C;;IAE3C,uDAAuD;;IAEvD,kCAAkC;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AAE,MAAM,GAAG,SAAS,CAY/C;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,MAAM,GAAG,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;AAEzF;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,+EAA+E;IAC/E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAiCzD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc;;;;CAIjB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAEhF,6CAA6C;AAC7C,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,eAAe,GAAG,UAAU,GAAG,OAAO,GAAG,YAAY,CAS9F;AAED,gEAAgE;AAChE,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,YAAY,CAE/D"}
|
|
@@ -17,7 +17,7 @@ import { type CombinedNarrativeEntry, type FlowchartCheckpoint, type ObserverDra
|
|
|
17
17
|
import type { CachePolicy, CacheStrategy } from '../cache/types.js';
|
|
18
18
|
import type { ReliabilityConfig } from '../reliability/types.js';
|
|
19
19
|
import { type RunnerPauseOutcome } from './pause.js';
|
|
20
|
-
import type {
|
|
20
|
+
import type { WindowStrategy } from './agent/window/strategy.js';
|
|
21
21
|
import { type CheckInBuilderOptions } from './checkin.js';
|
|
22
22
|
import type { MemoryDefinition } from '../memory/define.types.js';
|
|
23
23
|
import type { Injection, InjectionContext } from '../lib/injection-engine/types.js';
|
|
@@ -115,11 +115,11 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
115
115
|
* that never called it — and the chart is then built exactly as before,
|
|
116
116
|
* with no scope writes and no scope reads added. */
|
|
117
117
|
private readonly runConfigFn?;
|
|
118
|
-
/**
|
|
118
|
+
/** The agent's one window strategy. Undefined = no window stage, loop
|
|
119
119
|
* target unchanged, run byte-identical to an agent without it. */
|
|
120
|
-
private readonly
|
|
121
|
-
/** The instrument the
|
|
122
|
-
*
|
|
120
|
+
private readonly windowStrategy?;
|
|
121
|
+
/** The instrument the window stage reads mid-run (adapter-reported usage +
|
|
122
|
+
* per-message provenance). Only ever created alongside a strategy. */
|
|
123
123
|
private readonly compactionMeterHandle?;
|
|
124
124
|
/** Snapshot read-tracking policy (#18/#14) — forwarded to the internal
|
|
125
125
|
* executor. Agent default is `'summary'` (cheap markers), NOT
|
|
@@ -235,7 +235,7 @@ export declare class Agent extends RunnerBase<AgentInput, AgentOutput> {
|
|
|
235
235
|
readonly appName: string;
|
|
236
236
|
readonly commentaryTemplates: Readonly<Record<string, string>>;
|
|
237
237
|
readonly thinkingTemplates: Readonly<Record<string, string>>;
|
|
238
|
-
}, injections?: readonly Injection[], memories?: readonly MemoryDefinition[], outputSchemaParser?: OutputSchemaParser<unknown>, toolProvider?: ToolProvider, systemPromptCachePolicy?: CachePolicy, cachingDisabled?: boolean, cacheStrategy?: CacheStrategy, outputFallbackCfg?: ResolvedOutputFallback<unknown>, reliabilityConfig?: ReliabilityConfig, thinkingHandlerValue?: ThinkingHandler | null, thinkingBudgetValue?: number, skillGraphNextSkill?: (ctx: InjectionContext) => string | undefined, skillGraphReachable?: (currentSkillId?: string) => readonly string[], skillGraphScoreEntries?: (ctx: InjectionContext, signal?: AbortSignal) => Promise<EntryScoring>, checkInOptions?: CheckInBuilderOptions, runConfigFn?: RunConfigFn,
|
|
238
|
+
}, injections?: readonly Injection[], memories?: readonly MemoryDefinition[], outputSchemaParser?: OutputSchemaParser<unknown>, toolProvider?: ToolProvider, systemPromptCachePolicy?: CachePolicy, cachingDisabled?: boolean, cacheStrategy?: CacheStrategy, outputFallbackCfg?: ResolvedOutputFallback<unknown>, reliabilityConfig?: ReliabilityConfig, thinkingHandlerValue?: ThinkingHandler | null, thinkingBudgetValue?: number, skillGraphNextSkill?: (ctx: InjectionContext) => string | undefined, skillGraphReachable?: (currentSkillId?: string) => readonly string[], skillGraphScoreEntries?: (ctx: InjectionContext, signal?: AbortSignal) => Promise<EntryScoring>, checkInOptions?: CheckInBuilderOptions, runConfigFn?: RunConfigFn, windowStrategy?: WindowStrategy);
|
|
239
239
|
static create(opts: AgentOptions): AgentBuilder;
|
|
240
240
|
/**
|
|
241
241
|
* Cache policy for the base system prompt. Read by the CacheDecision
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../../../src/core/Agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,KAAK,sBAAsB,EAI3B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EAExB,KAAK,UAAU,EACf,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAOjE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AA6BrD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../../../src/core/Agent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,KAAK,sBAAsB,EAI3B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EAExB,KAAK,UAAU,EACf,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAOjE,OAAO,EAAE,KA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;;;;;;;;;;;;;;;;;OA2CG;IACG,aAAa,CACjB,UAAU,EAAE,kBAAkB,GAAG,OAAO,EACxC,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,WAAW,GAAG,kBAAkB,CAAC;IAQ5C;;;;;;OAMG;IACH,OAAO,CAAC,wBAAwB;IAyB1B,MAAM,CACV,UAAU,EAAE,mBAAmB,EAC/B,KAAK,CAAC,EAAE,OAAO,EACf,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,WAAW,GAAG,kBAAkB,CAAC;IAc5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;IACH,UAAU,IAAI,kBAAkB,GAAG,SAAS;IAmB5C,OAAO,CAAC,cAAc;IAkItB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,cAAc,CAAC,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAK3E,OAAO,CAAC,cAAc;IA8FtB,OAAO,CAAC,UAAU;CAkOnB"}
|
|
@@ -20,7 +20,8 @@ import type { ToolProvider } from '../../tool-providers/types.js';
|
|
|
20
20
|
import { type SelfExplainOptions } from '../../lib/trace-toolpack/selfExplain.js';
|
|
21
21
|
import { Agent } from '../Agent.js';
|
|
22
22
|
import type { AgentOptions, RunConfigFn } from './types.js';
|
|
23
|
-
import type { CompactionOptions } from './
|
|
23
|
+
import type { CompactionOptions } from './window/types.js';
|
|
24
|
+
import type { WindowStrategy } from './window/strategy.js';
|
|
24
25
|
/**
|
|
25
26
|
* Fluent builder. `tool()` accepts any Tool<TArgs, TResult> and registers
|
|
26
27
|
* it by its schema.name. Duplicate names throw at build time.
|
|
@@ -125,9 +126,10 @@ export declare class AgentBuilder {
|
|
|
125
126
|
/** Per-run config resolver set via `.configure()`. Undefined = the agent
|
|
126
127
|
* runs on its build-time model + system prompt, unchanged. */
|
|
127
128
|
private runConfigFn?;
|
|
128
|
-
/**
|
|
129
|
-
* the ReAct loop target is unchanged,
|
|
130
|
-
|
|
129
|
+
/** The agent's one window strategy, from `.window()` or `.compaction()`.
|
|
130
|
+
* Undefined = no window stage exists, the ReAct loop target is unchanged,
|
|
131
|
+
* and the run is byte-identical to an agent that never heard of them. */
|
|
132
|
+
private windowStrategyValue?;
|
|
131
133
|
constructor(opts: AgentOptions);
|
|
132
134
|
/**
|
|
133
135
|
* Set the base system prompt.
|
|
@@ -234,10 +236,58 @@ export declare class AgentBuilder {
|
|
|
234
236
|
* .build();
|
|
235
237
|
*/
|
|
236
238
|
configure(fn: RunConfigFn): this;
|
|
239
|
+
/**
|
|
240
|
+
* Choose how the live context window is kept inside its budget.
|
|
241
|
+
*
|
|
242
|
+
* This is the general door; the strategy decides everything about WHEN it
|
|
243
|
+
* acts and WHAT leaves. Three ship, and they share one turn segmentation
|
|
244
|
+
* and one refusal engine, so a refusal reason means the same thing under
|
|
245
|
+
* all of them:
|
|
246
|
+
*
|
|
247
|
+
* `summarizeOldest({ thresholdTokens, summarizer, ... })`
|
|
248
|
+
* fold the oldest span into one summary message. `.compaction()` is
|
|
249
|
+
* this, spelled shorter.
|
|
250
|
+
* `slidingWindow({ keepRecentTurns })`
|
|
251
|
+
* keep the last N turns and drop older ones. No summarizer, no LLM
|
|
252
|
+
* call, no usage requirement — it runs on any provider.
|
|
253
|
+
* `tokenBudget({ thresholdTokens })`
|
|
254
|
+
* the counted-token trigger, dropping instead of summarizing.
|
|
255
|
+
*
|
|
256
|
+
* Never removed by any of them: the system envelope, the recent turns, and
|
|
257
|
+
* any turn holding something unresolved — an unanswered tool call, a paused
|
|
258
|
+
* tool, a pending check-in. Those refuse BY NAME in the record and the
|
|
259
|
+
* strategy takes the next oldest instead. Removing an unanswered question
|
|
260
|
+
* would destroy the referent of the answer that has not arrived yet, and
|
|
261
|
+
* splitting a `tool_use` from its `tool_result` produces a request the
|
|
262
|
+
* vendor rejects.
|
|
263
|
+
*
|
|
264
|
+
* **Whatever leaves the window stays in the ledger.** footprintjs's commit
|
|
265
|
+
* log is append-only, so the turns were committed before the strategy ran
|
|
266
|
+
* and remain byte-identical; every strategy files its own recorded step
|
|
267
|
+
* naming the `runtimeStageId`s whose messages left, and emits one
|
|
268
|
+
* `context.evicted` per message. Removing is not forgetting.
|
|
269
|
+
*
|
|
270
|
+
* Exactly one strategy per agent. Omit this (and `.compaction()`) and
|
|
271
|
+
* nothing changes: no stage, no extra committed key, the same request bytes.
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* ```ts
|
|
275
|
+
* import { Agent, slidingWindow } from 'agentfootprint';
|
|
276
|
+
*
|
|
277
|
+
* const agent = Agent.create({ provider, model })
|
|
278
|
+
* .window(slidingWindow({ keepRecentTurns: 12 }))
|
|
279
|
+
* .build();
|
|
280
|
+
* ```
|
|
281
|
+
*/
|
|
282
|
+
window(strategy: WindowStrategy): this;
|
|
237
283
|
/**
|
|
238
284
|
* Keep the live context window inside a token budget — without ever losing
|
|
239
285
|
* the record.
|
|
240
286
|
*
|
|
287
|
+
* Sugar for `.window(summarizeOldest(options))`, and byte-for-byte the same
|
|
288
|
+
* agent. It keeps its own name because compaction is what the market calls
|
|
289
|
+
* this and it is the strategy most people want first.
|
|
290
|
+
*
|
|
241
291
|
* At each ReAct iteration boundary, compaction compares the LAST call's
|
|
242
292
|
* **adapter-reported** input tokens against `thresholdTokens`. Over budget,
|
|
243
293
|
* it folds the oldest foldable span of the conversation into one summary
|
|
@@ -273,6 +323,12 @@ export declare class AgentBuilder {
|
|
|
273
323
|
* ```
|
|
274
324
|
*/
|
|
275
325
|
compaction(options: CompactionOptions): this;
|
|
326
|
+
/**
|
|
327
|
+
* One window strategy per agent, whichever door set it — a second would
|
|
328
|
+
* silently override the first, and a window policy that quietly changed is
|
|
329
|
+
* a policy you cannot audit.
|
|
330
|
+
*/
|
|
331
|
+
private assertNoWindowStrategy;
|
|
276
332
|
/**
|
|
277
333
|
* Override the ReAct iteration cap set via `Agent.create({
|
|
278
334
|
* maxIterations })`. Convenience for builder-style code that prefers
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/AgentBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,qBAAqB,EAE3B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAiB,MAAM,sBAAsB,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAE7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EAAE,IAAI,EAAqB,MAAM,aAAa,CAAC;AAC3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGlE,OAAO,EAIL,KAAK,kBAAkB,EACxB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"AgentBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/agent/AgentBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,E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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmDG;IACH,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;IAU5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,GAAG,IAAI;IAUtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,QAAQ,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAiBxC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,OAAO,CAAC,IAAI,GAAE,qBAA0B,GAAG,IAAI;IAQ/C,WAAW,CAAC,IAAI,GAAE,kBAAuB,GAAG,IAAI;IAmBhD,KAAK,IAAI,KAAK;CAoFf"}
|
|
@@ -73,18 +73,25 @@ export interface AgentChartDeps {
|
|
|
73
73
|
* skill graph was built with a relevance scorer. */
|
|
74
74
|
readonly pickEntryStage?: (scope: never) => Promise<void>;
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
77
|
-
* consumer configured
|
|
78
|
-
* loop target, mounted immediately before the current one.
|
|
76
|
+
* The window-strategy stage (`.window()` / `.compaction()`). Present ONLY
|
|
77
|
+
* when the consumer configured a strategy — and when present it BECOMES the
|
|
78
|
+
* ReAct loop target, mounted immediately before the current one.
|
|
79
79
|
*
|
|
80
80
|
* It has to be the loop target rather than merely sit in the loop body:
|
|
81
81
|
* the loop is branch-sourced (`tool-calls → { loopTo }`), so anything ahead
|
|
82
82
|
* of the target runs once and is never seen again. Being the target also
|
|
83
|
-
* puts the
|
|
84
|
-
* point — the triggers, the three slots and the wire then all see
|
|
85
|
-
* window, and no component gets a different past than the model
|
|
83
|
+
* puts the window change BEFORE the injection engine and the slots, which
|
|
84
|
+
* is the point — the triggers, the three slots and the wire then all see
|
|
85
|
+
* the same window, and no component gets a different past than the model
|
|
86
|
+
* does.
|
|
87
|
+
*
|
|
88
|
+
* `strategyName` rides along so the chart itself says which policy is
|
|
89
|
+
* mounted; a reader of the graph should not have to guess.
|
|
86
90
|
*/
|
|
87
|
-
readonly
|
|
91
|
+
readonly windowStage?: {
|
|
92
|
+
readonly strategyName: string;
|
|
93
|
+
readonly run: (scope: never) => Promise<void>;
|
|
94
|
+
};
|
|
88
95
|
readonly systemPromptSubflow: FlowChart;
|
|
89
96
|
readonly messagesSubflow: FlowChart;
|
|
90
97
|
readonly toolsSubflow: FlowChart;
|