agentfootprint 9.53.0 → 9.55.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/CLAUDE.md +3 -1
- package/dist/core/agent/stages/window.js +7 -0
- package/dist/core/agent/stages/window.js.map +1 -1
- package/dist/core/agent/window/currentRequest.js +95 -0
- package/dist/core/agent/window/currentRequest.js.map +1 -0
- package/dist/core/agent/window/notice.js +26 -8
- package/dist/core/agent/window/notice.js.map +1 -1
- package/dist/core/agent/window/strategies/drop.js +26 -10
- package/dist/core/agent/window/strategies/drop.js.map +1 -1
- package/dist/core/agent/window/strategy.js +6 -3
- package/dist/core/agent/window/strategy.js.map +1 -1
- package/dist/core/agent/window/summarize.js +5 -1
- package/dist/core/agent/window/summarize.js.map +1 -1
- package/dist/core/agent/window/turns.js +8 -0
- package/dist/core/agent/window/turns.js.map +1 -1
- package/dist/core/tools.js.map +1 -1
- package/dist/esm/core/agent/stages/window.js +7 -0
- package/dist/esm/core/agent/stages/window.js.map +1 -1
- package/dist/esm/core/agent/window/currentRequest.d.ts +70 -0
- package/dist/esm/core/agent/window/currentRequest.js +91 -0
- package/dist/esm/core/agent/window/currentRequest.js.map +1 -0
- package/dist/esm/core/agent/window/notice.d.ts +21 -6
- package/dist/esm/core/agent/window/notice.js +26 -8
- package/dist/esm/core/agent/window/notice.js.map +1 -1
- package/dist/esm/core/agent/window/strategies/drop.d.ts +8 -6
- package/dist/esm/core/agent/window/strategies/drop.js +26 -10
- package/dist/esm/core/agent/window/strategies/drop.js.map +1 -1
- package/dist/esm/core/agent/window/strategy.d.ts +9 -6
- package/dist/esm/core/agent/window/strategy.js +6 -3
- package/dist/esm/core/agent/window/strategy.js.map +1 -1
- package/dist/esm/core/agent/window/summarize.d.ts +5 -1
- package/dist/esm/core/agent/window/summarize.js +5 -1
- package/dist/esm/core/agent/window/summarize.js.map +1 -1
- package/dist/esm/core/agent/window/turns.d.ts +11 -0
- package/dist/esm/core/agent/window/turns.js +8 -0
- package/dist/esm/core/agent/window/turns.js.map +1 -1
- package/dist/esm/core/agent/window/types.d.ts +12 -0
- package/dist/esm/core/tools.d.ts +31 -1
- package/dist/esm/core/tools.js.map +1 -1
- package/dist/esm/recorders/observability/StatusRecorder.d.ts +7 -1
- package/dist/esm/recorders/observability/StatusRecorder.js +30 -2
- package/dist/esm/recorders/observability/StatusRecorder.js.map +1 -1
- package/dist/esm/recorders/observability/commentary/commentaryTemplates.js +10 -0
- package/dist/esm/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
- package/dist/esm/recorders/observability/status/statusTemplates.d.ts +87 -8
- package/dist/esm/recorders/observability/status/statusTemplates.js +177 -24
- package/dist/esm/recorders/observability/status/statusTemplates.js.map +1 -1
- package/dist/recorders/observability/StatusRecorder.js +30 -2
- package/dist/recorders/observability/StatusRecorder.js.map +1 -1
- package/dist/recorders/observability/commentary/commentaryTemplates.js +10 -0
- package/dist/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
- package/dist/recorders/observability/status/statusTemplates.js +179 -25
- package/dist/recorders/observability/status/statusTemplates.js.map +1 -1
- package/dist/types/core/agent/stages/window.d.ts.map +1 -1
- package/dist/types/core/agent/window/currentRequest.d.ts +71 -0
- package/dist/types/core/agent/window/currentRequest.d.ts.map +1 -0
- package/dist/types/core/agent/window/notice.d.ts +21 -6
- package/dist/types/core/agent/window/notice.d.ts.map +1 -1
- package/dist/types/core/agent/window/strategies/drop.d.ts +8 -6
- package/dist/types/core/agent/window/strategies/drop.d.ts.map +1 -1
- package/dist/types/core/agent/window/strategy.d.ts +9 -6
- package/dist/types/core/agent/window/strategy.d.ts.map +1 -1
- package/dist/types/core/agent/window/summarize.d.ts +5 -1
- package/dist/types/core/agent/window/summarize.d.ts.map +1 -1
- package/dist/types/core/agent/window/turns.d.ts +11 -0
- package/dist/types/core/agent/window/turns.d.ts.map +1 -1
- package/dist/types/core/agent/window/types.d.ts +12 -0
- package/dist/types/core/agent/window/types.d.ts.map +1 -1
- package/dist/types/core/tools.d.ts +31 -1
- package/dist/types/core/tools.d.ts.map +1 -1
- package/dist/types/recorders/observability/StatusRecorder.d.ts +7 -1
- package/dist/types/recorders/observability/StatusRecorder.d.ts.map +1 -1
- package/dist/types/recorders/observability/commentary/commentaryTemplates.d.ts.map +1 -1
- package/dist/types/recorders/observability/status/statusTemplates.d.ts +87 -8
- package/dist/types/recorders/observability/status/statusTemplates.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* window/currentRequest — which message in the window is the thing the run
|
|
3
|
+
* was asked to do.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: One pure function over the window (no scope, no I/O, no clock).
|
|
6
|
+
* Role: core/ layer. Feeds the refusal engine, which is what actually
|
|
7
|
+
* keeps this message in the window (see turns.ts, `'current-request'`).
|
|
8
|
+
* Kept in its own module because "what did the person ask for" is a
|
|
9
|
+
* different question from "where is a turn boundary", and only this
|
|
10
|
+
* one has to know which user-role messages the LIBRARY wrote.
|
|
11
|
+
* Emits: N/A.
|
|
12
|
+
*
|
|
13
|
+
* ## Why this exists
|
|
14
|
+
*
|
|
15
|
+
* Caught in a real recorded run (9.55.0). A ten-iteration tool loop under a
|
|
16
|
+
* small window dropped the window's HEAD at iteration 4 — and the head was
|
|
17
|
+
* the user's own request. The model went on working from tool traffic and a
|
|
18
|
+
* drop notice, with no statement of its objective anywhere in context. It
|
|
19
|
+
* finished that task by momentum; a longer one forgets what it was doing.
|
|
20
|
+
*
|
|
21
|
+
* Every other guard in this family protects the WIRE (do not split a
|
|
22
|
+
* `tool_use` from its `tool_result`) or the near past (`keepRecentTurns`).
|
|
23
|
+
* Nothing protected the one message the whole run is about, because it is the
|
|
24
|
+
* OLDEST message in the window and every strategy here removes the oldest
|
|
25
|
+
* thing first. So it is named, and it refuses.
|
|
26
|
+
*
|
|
27
|
+
* ## Which message, exactly
|
|
28
|
+
*
|
|
29
|
+
* The window is a flat message list. Its `Turn` segmentation is a WIRE
|
|
30
|
+
* boundary (a non-`tool` message plus the `tool` messages answering it), not
|
|
31
|
+
* a conversational one — there is no "turn 3 of this conversation" object in
|
|
32
|
+
* this folder to point at. What the run DOES know is the message it was
|
|
33
|
+
* started with, which the seed stage commits as `scope.userMessage`, and the
|
|
34
|
+
* stage passes it in as `said`.
|
|
35
|
+
*
|
|
36
|
+
* So the answer is, in order:
|
|
37
|
+
*
|
|
38
|
+
* 1. the LAST message the person said whose text is exactly `said` — the
|
|
39
|
+
* message this run is executing, matched by content rather than by
|
|
40
|
+
* position because a restored conversation puts earlier turns in front
|
|
41
|
+
* of it;
|
|
42
|
+
* 2. failing that, the LAST message the person said at all. That is the
|
|
43
|
+
* honest approximation for a window seeded from outside this run, and it
|
|
44
|
+
* is stated rather than hidden: earlier turns of a multi-turn
|
|
45
|
+
* conversation stay droppable exactly as they were.
|
|
46
|
+
*
|
|
47
|
+
* "The person said it" is deliberately narrow. Three kinds of `role: 'user'`
|
|
48
|
+
* message are written by this LIBRARY, not by anybody: a drop notice, a
|
|
49
|
+
* compaction frame, and a message an {@link Injection} delivered (which
|
|
50
|
+
* carries `injectedBy`). None of them may become the anchor — otherwise the
|
|
51
|
+
* window would protect its own bookkeeping and drop the request underneath
|
|
52
|
+
* it, and a tool able to influence an injection could pin its own text in
|
|
53
|
+
* context permanently.
|
|
54
|
+
*/
|
|
55
|
+
import { isDropNotice } from './notice.js';
|
|
56
|
+
import { isCompactedSummary } from './summarize.js';
|
|
57
|
+
/** True when this message is something a PERSON said, not something we wrote. */
|
|
58
|
+
function isSomethingTheySaid(msg) {
|
|
59
|
+
return (msg.role === 'user' &&
|
|
60
|
+
msg.injectedBy === undefined &&
|
|
61
|
+
!isDropNotice(msg) &&
|
|
62
|
+
!isCompactedSummary(msg));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Index in `history` of the current request — the message no window strategy
|
|
66
|
+
* may drop — or `-1` when this window holds none.
|
|
67
|
+
*
|
|
68
|
+
* `-1` is a real answer, not a failure: a hand-built window of assistant
|
|
69
|
+
* turns, or one whose only user-role messages are this library's own frames,
|
|
70
|
+
* genuinely has no request to protect. Every caller treats it as "the rule
|
|
71
|
+
* does not apply here", which is how the pre-9.55.0 behaviour is still
|
|
72
|
+
* reachable byte for byte.
|
|
73
|
+
*
|
|
74
|
+
* @param history the window, in order
|
|
75
|
+
* @param said the text the run was started with (`scope.userMessage`),
|
|
76
|
+
* when the caller knows it
|
|
77
|
+
*/
|
|
78
|
+
export function currentRequestIndexOf(history, said) {
|
|
79
|
+
let latest = -1;
|
|
80
|
+
for (let i = history.length - 1; i >= 0; i--) {
|
|
81
|
+
const msg = history[i];
|
|
82
|
+
if (!isSomethingTheySaid(msg))
|
|
83
|
+
continue;
|
|
84
|
+
if (said !== undefined && msg.content === said)
|
|
85
|
+
return i;
|
|
86
|
+
if (latest === -1)
|
|
87
|
+
latest = i;
|
|
88
|
+
}
|
|
89
|
+
return latest;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=currentRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currentRequest.js","sourceRoot":"","sources":["../../../../../src/core/agent/window/currentRequest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,iFAAiF;AACjF,SAAS,mBAAmB,CAAC,GAAe;IAC1C,OAAO,CACL,GAAG,CAAC,IAAI,KAAK,MAAM;QACnB,GAAG,CAAC,UAAU,KAAK,SAAS;QAC5B,CAAC,YAAY,CAAC,GAAG,CAAC;QAClB,CAAC,kBAAkB,CAAC,GAAG,CAAC,CACzB,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAA8B,EAAE,IAAa;IACjF,IAAI,MAAM,GAAG,CAAC,CAAC,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7C,MAAM,GAAG,GAAG,OAAO,CAAC,CAAC,CAAE,CAAC;QACxB,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC;YAAE,SAAS;QACxC,IAAI,IAAI,KAAK,SAAS,IAAI,GAAG,CAAC,OAAO,KAAK,IAAI;YAAE,OAAO,CAAC,CAAC;QACzD,IAAI,MAAM,KAAK,CAAC,CAAC;YAAE,MAAM,GAAG,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -20,10 +20,14 @@
|
|
|
20
20
|
* below is written by this library, which is why a drop has no prompt-
|
|
21
21
|
* injection surface to speak of.
|
|
22
22
|
*
|
|
23
|
-
* It appears ONLY when the removal reaches the
|
|
24
|
-
* the
|
|
25
|
-
*
|
|
26
|
-
*
|
|
23
|
+
* It appears ONLY when the removal reaches the front of what may leave. That
|
|
24
|
+
* is the window's head in the ordinary case; since 9.55.0 it is the position
|
|
25
|
+
* just after the CURRENT REQUEST when the request was sitting at the head and
|
|
26
|
+
* refused to go (see currentRequest.ts) — the notice is still the first thing
|
|
27
|
+
* after the last un-droppable message, and it says that the request was kept.
|
|
28
|
+
* A removal further in leaves the original opening turn in place, so there is
|
|
29
|
+
* no wire problem to solve — and splicing a lone `user` message between two
|
|
30
|
+
* assistant turns is its own risk. The ledger names that removal either way.
|
|
27
31
|
*
|
|
28
32
|
* It does not accumulate: the notice is an ordinary oldest turn next time
|
|
29
33
|
* round, so the next drop absorbs it and files a fresh one.
|
|
@@ -34,13 +38,24 @@ export declare const DROP_NOTICE_PREFIX = "[dropped history";
|
|
|
34
38
|
/**
|
|
35
39
|
* Build the message that takes the head position after a drop.
|
|
36
40
|
*
|
|
37
|
-
* `role: 'user'` for the same reason the compaction frame is: it
|
|
38
|
-
* of the window, and the head of the window must be a user turn.
|
|
41
|
+
* `role: 'user'` for the same reason the compaction frame is: it takes the
|
|
42
|
+
* head of the window, and the head of the window must be a user turn. (When
|
|
43
|
+
* the CURRENT REQUEST is holding that position it is already a user turn, and
|
|
44
|
+
* the notice follows it — see below.)
|
|
45
|
+
*
|
|
46
|
+
* `currentRequestKept` (9.55.0) is set when the drop stopped short of the
|
|
47
|
+
* window's head because the message the run is executing was sitting there
|
|
48
|
+
* and refused to leave — so the notice takes the position AFTER it rather
|
|
49
|
+
* than the head itself. It says so, because a model reading "3 earlier
|
|
50
|
+
* messages were dropped" and then finding a request above it should be told
|
|
51
|
+
* which of the two facts to trust. Omitted, the notice is byte-identical to
|
|
52
|
+
* the one this library has always written.
|
|
39
53
|
*/
|
|
40
54
|
export declare function buildDropNotice(facts: {
|
|
41
55
|
readonly droppedMessageCount: number;
|
|
42
56
|
readonly iteration: number;
|
|
43
57
|
readonly strategy: string;
|
|
58
|
+
readonly currentRequestKept?: boolean;
|
|
44
59
|
}): LLMMessage;
|
|
45
60
|
/** True when this message is a notice a previous drop wrote. */
|
|
46
61
|
export declare function isDropNotice(msg: LLMMessage | undefined): boolean;
|
|
@@ -20,10 +20,14 @@
|
|
|
20
20
|
* below is written by this library, which is why a drop has no prompt-
|
|
21
21
|
* injection surface to speak of.
|
|
22
22
|
*
|
|
23
|
-
* It appears ONLY when the removal reaches the
|
|
24
|
-
* the
|
|
25
|
-
*
|
|
26
|
-
*
|
|
23
|
+
* It appears ONLY when the removal reaches the front of what may leave. That
|
|
24
|
+
* is the window's head in the ordinary case; since 9.55.0 it is the position
|
|
25
|
+
* just after the CURRENT REQUEST when the request was sitting at the head and
|
|
26
|
+
* refused to go (see currentRequest.ts) — the notice is still the first thing
|
|
27
|
+
* after the last un-droppable message, and it says that the request was kept.
|
|
28
|
+
* A removal further in leaves the original opening turn in place, so there is
|
|
29
|
+
* no wire problem to solve — and splicing a lone `user` message between two
|
|
30
|
+
* assistant turns is its own risk. The ledger names that removal either way.
|
|
27
31
|
*
|
|
28
32
|
* It does not accumulate: the notice is an ordinary oldest turn next time
|
|
29
33
|
* round, so the next drop absorbs it and files a fresh one.
|
|
@@ -33,16 +37,30 @@ export const DROP_NOTICE_PREFIX = '[dropped history';
|
|
|
33
37
|
/**
|
|
34
38
|
* Build the message that takes the head position after a drop.
|
|
35
39
|
*
|
|
36
|
-
* `role: 'user'` for the same reason the compaction frame is: it
|
|
37
|
-
* of the window, and the head of the window must be a user turn.
|
|
40
|
+
* `role: 'user'` for the same reason the compaction frame is: it takes the
|
|
41
|
+
* head of the window, and the head of the window must be a user turn. (When
|
|
42
|
+
* the CURRENT REQUEST is holding that position it is already a user turn, and
|
|
43
|
+
* the notice follows it — see below.)
|
|
44
|
+
*
|
|
45
|
+
* `currentRequestKept` (9.55.0) is set when the drop stopped short of the
|
|
46
|
+
* window's head because the message the run is executing was sitting there
|
|
47
|
+
* and refused to leave — so the notice takes the position AFTER it rather
|
|
48
|
+
* than the head itself. It says so, because a model reading "3 earlier
|
|
49
|
+
* messages were dropped" and then finding a request above it should be told
|
|
50
|
+
* which of the two facts to trust. Omitted, the notice is byte-identical to
|
|
51
|
+
* the one this library has always written.
|
|
38
52
|
*/
|
|
39
53
|
export function buildDropNotice(facts) {
|
|
54
|
+
const kept = facts.currentRequestKept === true
|
|
55
|
+
? `Your current request is kept — it is still in this window, above this line, and no ` +
|
|
56
|
+
`window strategy may drop it. `
|
|
57
|
+
: '';
|
|
40
58
|
return {
|
|
41
59
|
role: 'user',
|
|
42
60
|
content: `${DROP_NOTICE_PREFIX} — ${facts.droppedMessageCount} earlier message(s) were dropped ` +
|
|
43
61
|
`from this window at iteration ${facts.iteration} by the '${facts.strategy}' window ` +
|
|
44
|
-
`strategy. Nothing was summarized: those turns are simply not being re-sent.
|
|
45
|
-
`retained verbatim in this run's commit log.]`,
|
|
62
|
+
`strategy. ${kept}Nothing was summarized: those turns are simply not being re-sent. ` +
|
|
63
|
+
`They are retained verbatim in this run's commit log.]`,
|
|
46
64
|
};
|
|
47
65
|
}
|
|
48
66
|
/** True when this message is a notice a previous drop wrote. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notice.js","sourceRoot":"","sources":["../../../../../src/core/agent/window/notice.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"notice.js","sourceRoot":"","sources":["../../../../../src/core/agent/window/notice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAIH,8EAA8E;AAC9E,MAAM,CAAC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAErD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,eAAe,CAAC,KAK/B;IACC,MAAM,IAAI,GACR,KAAK,CAAC,kBAAkB,KAAK,IAAI;QAC/B,CAAC,CAAC,qFAAqF;YACrF,+BAA+B;QACjC,CAAC,CAAC,EAAE,CAAC;IACT,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,OAAO,EACL,GAAG,kBAAkB,MAAM,KAAK,CAAC,mBAAmB,mCAAmC;YACvF,iCAAiC,KAAK,CAAC,SAAS,YAAY,KAAK,CAAC,QAAQ,WAAW;YACrF,aAAa,IAAI,oEAAoE;YACrF,uDAAuD;KAC1D,CAAC;AACJ,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,YAAY,CAAC,GAA2B;IACtD,OAAO,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;AAChG,CAAC"}
|
|
@@ -11,12 +11,14 @@
|
|
|
11
11
|
* A drop makes no LLM call and writes no summary. What it must still do is
|
|
12
12
|
* keep the request valid and keep the record honest:
|
|
13
13
|
*
|
|
14
|
-
* • the span comes from the shared refusal engine, so
|
|
15
|
-
* call, the paused tool, a pending check-in and the
|
|
16
|
-
* leave, and each refusal is named;
|
|
17
|
-
* • when the span reaches the
|
|
18
|
-
* position — the window must open on a user turn (see
|
|
19
|
-
* message we are forced to author should tell the
|
|
14
|
+
* • the span comes from the shared refusal engine, so the CURRENT REQUEST,
|
|
15
|
+
* an unanswered tool call, the paused tool, a pending check-in and the
|
|
16
|
+
* recent turns never leave, and each refusal is named;
|
|
17
|
+
* • when the span reaches the front of what may leave, an authored notice
|
|
18
|
+
* takes that position — the window must open on a user turn (see
|
|
19
|
+
* notice.ts), and a message we are forced to author should tell the
|
|
20
|
+
* truth. That position is the window's HEAD in the ordinary case, and the
|
|
21
|
+
* slot just after the kept request when the request was the head;
|
|
20
22
|
* • when it does not, nothing is inserted: the original opening turn is
|
|
21
23
|
* still there, so there is no wire problem to solve.
|
|
22
24
|
*/
|
|
@@ -11,12 +11,14 @@
|
|
|
11
11
|
* A drop makes no LLM call and writes no summary. What it must still do is
|
|
12
12
|
* keep the request valid and keep the record honest:
|
|
13
13
|
*
|
|
14
|
-
* • the span comes from the shared refusal engine, so
|
|
15
|
-
* call, the paused tool, a pending check-in and the
|
|
16
|
-
* leave, and each refusal is named;
|
|
17
|
-
* • when the span reaches the
|
|
18
|
-
* position — the window must open on a user turn (see
|
|
19
|
-
* message we are forced to author should tell the
|
|
14
|
+
* • the span comes from the shared refusal engine, so the CURRENT REQUEST,
|
|
15
|
+
* an unanswered tool call, the paused tool, a pending check-in and the
|
|
16
|
+
* recent turns never leave, and each refusal is named;
|
|
17
|
+
* • when the span reaches the front of what may leave, an authored notice
|
|
18
|
+
* takes that position — the window must open on a user turn (see
|
|
19
|
+
* notice.ts), and a message we are forced to author should tell the
|
|
20
|
+
* truth. That position is the window's HEAD in the ordinary case, and the
|
|
21
|
+
* slot just after the kept request when the request was the head;
|
|
20
22
|
* • when it does not, nothing is inserted: the original opening turn is
|
|
21
23
|
* still there, so there is no wire problem to solve.
|
|
22
24
|
*/
|
|
@@ -59,15 +61,26 @@ export function dropOldestSpan(input, keepRecentTurns, strategyName) {
|
|
|
59
61
|
let window;
|
|
60
62
|
let insertedAtMs;
|
|
61
63
|
const droppedAtMs = input.now();
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
// The drop stopped one turn short of the head because the CURRENT REQUEST
|
|
65
|
+
// was sitting there and refused (9.55.0). The wire is fine — the request is
|
|
66
|
+
// a user turn, so the window still opens on one — but the notice is still
|
|
67
|
+
// owed: this removal reaches the front of everything that MAY leave, and a
|
|
68
|
+
// model that reads the request must also be told what went missing under
|
|
69
|
+
// it. Read off the refusal the engine already filed rather than re-derived,
|
|
70
|
+
// so the notice can only move for the reason that actually moved the span.
|
|
71
|
+
const keptRequestAtHead = plan.from === 1 &&
|
|
72
|
+
plan.refusals.some((r) => r.reason === 'current-request' && r.turnIndex === 0);
|
|
73
|
+
if (spanStart === 0 || keptRequestAtHead) {
|
|
74
|
+
// The front of the droppable window is leaving: something must occupy
|
|
75
|
+
// that position, and when it is the window's own head it must be a user
|
|
76
|
+
// turn. Author the notice — and refuse the whole drop if that notice
|
|
65
77
|
// would not be smaller than what it replaces, because dropping two tiny
|
|
66
78
|
// turns to insert a longer notice is pure loss.
|
|
67
79
|
const notice = buildDropNotice({
|
|
68
80
|
droppedMessageCount: span.length,
|
|
69
81
|
iteration,
|
|
70
82
|
strategy: strategyName,
|
|
83
|
+
...(keptRequestAtHead && { currentRequestKept: true }),
|
|
71
84
|
});
|
|
72
85
|
if (notice.content.length >= windowChars(span)) {
|
|
73
86
|
// `'replacement-not-smaller'` since 8.14.0. A drop writes no summary —
|
|
@@ -78,7 +91,10 @@ export function dropOldestSpan(input, keepRecentTurns, strategyName) {
|
|
|
78
91
|
...plan.refusals,
|
|
79
92
|
]);
|
|
80
93
|
}
|
|
81
|
-
|
|
94
|
+
// `head` is empty on the ordinary path, so this is byte-for-byte the
|
|
95
|
+
// `[notice, ...tail]` this function has always produced; when the request
|
|
96
|
+
// was kept it is `[request, notice, ...tail]`.
|
|
97
|
+
window = [...head, notice, ...tail];
|
|
82
98
|
insertedAtMs = droppedAtMs;
|
|
83
99
|
}
|
|
84
100
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drop.js","sourceRoot":"","sources":["../../../../../../src/core/agent/window/strategies/drop.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"drop.js","sourceRoot":"","sources":["../../../../../../src/core/agent/window/strategies/drop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAwBxD;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,KAA0B,EAC1B,eAAuB,EACvB,YAAoB;IAEpB,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IAC5C,MAAM,WAAW,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,CAAC,QAAkC,EAAe,EAAE,CAAC,CAAC;QACpE,QAAQ;QACR,eAAe,EAAE,EAAE;QACnB,mBAAmB,EAAE,CAAC;QACtB,SAAS,EAAE,EAAE;QACb,iBAAiB,EAAE,WAAW;QAC9B,gBAAgB,EAAE,WAAW;QAC7B,WAAW,EAAE,KAAK,CAAC,MAAM;QACzB,UAAU,EAAE,KAAK,CAAC,MAAM;KACzB,CAAC,CAAC;IAEH,2EAA2E;IAC3E,4EAA4E;IAC5E,2EAA2E;IAC3E,sBAAsB;IACtB,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IAChD,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC,CAAC;QAAE,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAEpD,MAA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ound to this
|
|
27
27
|
* iteration's turns and guards. A strategy cannot forget that an
|
|
28
|
-
* unanswered tool call must not leave the window
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* unanswered tool call must not leave the window — or that the CURRENT
|
|
29
|
+
* REQUEST never does (9.55.0) — because it never gets the chance to
|
|
30
|
+
* decide that for itself: it asks, and it is told, with every refusal
|
|
31
|
+
* named. That is safety by construction, not by docs. It is also why a
|
|
32
|
+
* rule added there arrives in every strategy at once, including the ones
|
|
33
|
+
* consumers wrote before the rule existed.
|
|
31
34
|
* 2. **Provenance.** `removalFacts` turns "these indices left" into the
|
|
32
35
|
* stage ids that wrote them and how long each lived. A strategy cannot
|
|
33
36
|
* file a removal it cannot name.
|
|
@@ -98,9 +101,9 @@ export interface WindowStrategyInput {
|
|
|
98
101
|
* THE shared refusal engine, bound to this iteration.
|
|
99
102
|
*
|
|
100
103
|
* Answers: which contiguous span of turns may leave, and every turn that
|
|
101
|
-
* refused, named. Never removes the system envelope, the
|
|
102
|
-
* `keepRecentTurns` turns, an unanswered tool call, the paused
|
|
103
|
-
* pending check-in.
|
|
104
|
+
* refused, named. Never removes the system envelope, the CURRENT REQUEST,
|
|
105
|
+
* the last `keepRecentTurns` turns, an unanswered tool call, the paused
|
|
106
|
+
* tool, or a pending check-in.
|
|
104
107
|
*
|
|
105
108
|
* @param keepRecentTurns how many trailing turns are off-limits
|
|
106
109
|
* @param isExistingSummary optional predicate marking a turn that is a
|
|
@@ -25,9 +25,12 @@
|
|
|
25
25
|
*
|
|
26
26
|
* 1. **The refusal rules.** `planRemoval` arrives already bound to this
|
|
27
27
|
* iteration's turns and guards. A strategy cannot forget that an
|
|
28
|
-
* unanswered tool call must not leave the window
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* unanswered tool call must not leave the window — or that the CURRENT
|
|
29
|
+
* REQUEST never does (9.55.0) — because it never gets the chance to
|
|
30
|
+
* decide that for itself: it asks, and it is told, with every refusal
|
|
31
|
+
* named. That is safety by construction, not by docs. It is also why a
|
|
32
|
+
* rule added there arrives in every strategy at once, including the ones
|
|
33
|
+
* consumers wrote before the rule existed.
|
|
31
34
|
* 2. **Provenance.** `removalFacts` turns "these indices left" into the
|
|
32
35
|
* stage ids that wrote them and how long each lived. A strategy cannot
|
|
33
36
|
* file a removal it cannot name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strategy.js","sourceRoot":"","sources":["../../../../../src/core/agent/window/strategy.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"strategy.js","sourceRoot":"","sources":["../../../../../src/core/agent/window/strategy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG"}
|
|
@@ -39,8 +39,12 @@ export declare function renderTranscript(messages: readonly LLMMessage[]): strin
|
|
|
39
39
|
/**
|
|
40
40
|
* Build the message that replaces the folded span IN THE WINDOW.
|
|
41
41
|
*
|
|
42
|
-
* `role: 'user'` because the
|
|
42
|
+
* `role: 'user'` because the fold can reach the window's head, and the
|
|
43
43
|
* providers that care (Anthropic) require the window to open on a user turn.
|
|
44
|
+
* Since 9.55.0 it usually does NOT reach it — the CURRENT REQUEST sits there
|
|
45
|
+
* and refuses to be folded, so the frame lands immediately after it — but the
|
|
46
|
+
* role is right either way and a fold of a window with no identifiable
|
|
47
|
+
* request still opens on one.
|
|
44
48
|
*
|
|
45
49
|
* The label is written by this function and always comes first. `summary` is
|
|
46
50
|
* appended to it verbatim: the library never edits model output, and it never
|
|
@@ -81,8 +81,12 @@ function retentionSentence(retain) {
|
|
|
81
81
|
/**
|
|
82
82
|
* Build the message that replaces the folded span IN THE WINDOW.
|
|
83
83
|
*
|
|
84
|
-
* `role: 'user'` because the
|
|
84
|
+
* `role: 'user'` because the fold can reach the window's head, and the
|
|
85
85
|
* providers that care (Anthropic) require the window to open on a user turn.
|
|
86
|
+
* Since 9.55.0 it usually does NOT reach it — the CURRENT REQUEST sits there
|
|
87
|
+
* and refuses to be folded, so the frame lands immediately after it — but the
|
|
88
|
+
* role is right either way and a fold of a window with no identifiable
|
|
89
|
+
* request still opens on one.
|
|
86
90
|
*
|
|
87
91
|
* The label is written by this function and always comes first. `summary` is
|
|
88
92
|
* appended to it verbatim: the library never edits model output, and it never
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarize.js","sourceRoot":"","sources":["../../../../../src/core/agent/window/summarize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAKH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAE3D,kFAAkF;AAClF,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAC3C,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AAEhD;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,wFAAwF;IACxF,kCAAkC;IAClC,EAAE;IACF,kCAAkC,eAAe,QAAQ,gBAAgB,sBAAsB;IAC/F,8FAA8F;IAC9F,6FAA6F;IAC7F,EAAE;IACF,4FAA4F;IAC5F,6FAA6F;IAC7F,gGAAgG;IAChG,yEAAyE;CAC1E,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,+EAA+E;AAC/E,SAAS,aAAa,CAAC,GAAe;IACpC,MAAM,KAAK,GAAG,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1F,MAAM,IAAI,GACR,GAAG,CAAC,IAAI,KAAK,MAAM;QACjB,CAAC,CAAC,eAAe,GAAG,CAAC,QAAQ,IAAI,SAAS,GAAG;QAC7C,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,WAAW,IAAI,KAAK,CAAC,MAAM,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AC;IACxC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,OAAO,OAAO,EAAE,EAAE,CAAC;AAC7D,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,kBAAkB,CAAC,GAA2B;IAC5D,OAAO,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,IAAI,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAC;AACpG,CAAC;AAOD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,QAAqB,EACrB,KAAa,EACb,IAA2B,EAC3B,MAA+B;IAE/B,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC;QACvC,YAAY,EAAE,wBAAwB;QACtC,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC7D,KAAK;QACL,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,EAAE,MAAM,EAAE,CAAC;KACxC,CAAC,CAAC;IACH,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -53,6 +53,17 @@ export declare function segmentTurns(history: readonly LLMMessage[]): readonly T
|
|
|
53
53
|
export interface RemovalGuards {
|
|
54
54
|
/** Every `toolCallId` answered anywhere in the window. */
|
|
55
55
|
readonly answeredCallIds: ReadonlySet<string>;
|
|
56
|
+
/**
|
|
57
|
+
* Index in the window of the CURRENT REQUEST — the message this run is
|
|
58
|
+
* executing (9.55.0). The turn holding it refuses with `'current-request'`.
|
|
59
|
+
*
|
|
60
|
+
* Resolved by `currentRequestIndexOf`, which the stage calls with the run's
|
|
61
|
+
* own `scope.userMessage`. Absent (or `-1`) when the window holds no
|
|
62
|
+
* identifiable request, and then this rule simply does not apply — which is
|
|
63
|
+
* how a window that never had one behaves exactly as it did before the rule
|
|
64
|
+
* existed.
|
|
65
|
+
*/
|
|
66
|
+
readonly currentRequestIndex?: number;
|
|
56
67
|
/** The tool call this run is paused on, when it is paused. */
|
|
57
68
|
readonly pausedToolCallId?: string;
|
|
58
69
|
/** True when the pause is a check-in (human consent) rather than askHuman. */
|
|
@@ -67,6 +67,14 @@ export function answeredCallIds(history) {
|
|
|
67
67
|
* reading the trace needs to see.
|
|
68
68
|
*/
|
|
69
69
|
export function refusalFor(turn, guards) {
|
|
70
|
+
// First, because it is the strongest rule in the family: the message the
|
|
71
|
+
// run is executing is the one thing the model cannot work without. A turn
|
|
72
|
+
// holds at most one non-`tool` message, so this never competes with the
|
|
73
|
+
// reasons below for the same turn.
|
|
74
|
+
const request = guards.currentRequestIndex;
|
|
75
|
+
if (request !== undefined && request >= turn.start && request < turn.start + turn.length) {
|
|
76
|
+
return 'current-request';
|
|
77
|
+
}
|
|
70
78
|
for (const msg of turn.messages) {
|
|
71
79
|
if (msg.role === 'system')
|
|
72
80
|
return 'system-envelope';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turns.js","sourceRoot":"","sources":["../../../../../src/core/agent/window/turns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAoBH;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,OAA8B;IACzD,MAAM,KAAK,GAAW,EAAE,CAAC;IACzB,IAAI,OAAO,GAAiB,EAAE,CAAC;IAC/B,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,MAAM,KAAK,GAAG,GAAS,EAAE;QACvB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QACjC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE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I,EAAE,YAAY,EAAE,KAAK,CAAC,IAAI,CAAE,CAAC,KAAK,EAAE;gBACtF,GAAG,QAAQ;aACZ;SACF,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,GAAG,MAAM,EAAE,GAAG,QAAQ,CAAC,EAAE,CAAC;AAC1D,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,WAAW,CAAC,OAA8B;IACxD,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,GAAG,IAAI,OAAO;QAAE,KAAK,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC;IACvD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -37,6 +37,18 @@ import type { LLMMessage, LLMProvider } from '../../../adapters/types.js';
|
|
|
37
37
|
export type WindowRefusalReason =
|
|
38
38
|
/** The turn holds a `role: 'system'` message. The envelope never leaves. */
|
|
39
39
|
'system-envelope'
|
|
40
|
+
/**
|
|
41
|
+
* The turn holds the CURRENT REQUEST — the message this run is executing
|
|
42
|
+
* (9.55.0). It is the task's anchor: everything else in the window is
|
|
43
|
+
* evidence gathered in service of it, and a window that keeps the evidence
|
|
44
|
+
* and drops the request leaves a model working from momentum.
|
|
45
|
+
*
|
|
46
|
+
* It is also the oldest message in a fresh window, which is exactly what
|
|
47
|
+
* every strategy here removes first — so without this reason it went first,
|
|
48
|
+
* every time. Other history drops ahead of it; if nothing else can go,
|
|
49
|
+
* nothing goes, and this reason says why.
|
|
50
|
+
*/
|
|
51
|
+
| 'current-request'
|
|
40
52
|
/**
|
|
41
53
|
* An assistant `tool_use` in this turn has no matching `tool_result` in the
|
|
42
54
|
* window. Removing an unanswered question destroys the answer's referent —
|
package/dist/esm/core/tools.d.ts
CHANGED
|
@@ -261,6 +261,29 @@ export interface ToolExecutionContext {
|
|
|
261
261
|
* class instances, no live handles, no functions). Progress is TELEMETRY: it
|
|
262
262
|
* never enters the tool result, the history, or the model's view.
|
|
263
263
|
*
|
|
264
|
+
* **What a PERSON sees (9.54.0).** One call, two faces. The structured
|
|
265
|
+
* payload rides to the record untouched, exactly as above — and the live
|
|
266
|
+
* status surfaces (`agent.enable.liveStatus(...)`, `attachStatus`) now show
|
|
267
|
+
* the report too, so a long call is no longer silent in the browser. Because
|
|
268
|
+
* `payload` is yours and typed `unknown`, the display contract is narrow and
|
|
269
|
+
* literal:
|
|
270
|
+
*
|
|
271
|
+
* - A top-level **string field named `message`** is shown to the person
|
|
272
|
+
* VERBATIM, trimmed, cut at **120 characters** with the cut stated
|
|
273
|
+
* (`… (+N more)`). `message` is the field MCP's own progress
|
|
274
|
+
* notification uses; nothing else in the payload is read.
|
|
275
|
+
* - **Anything else** — no `message`, a non-string one, an empty one, a
|
|
276
|
+
* bare string payload — shows the generic line instead:
|
|
277
|
+
* `` `<toolName>` reported progress (N so far)… ``. Your payload is
|
|
278
|
+
* never pretty-printed into that sentence. A status line is prose, and
|
|
279
|
+
* a tool's JSON is not a sentence anyone wrote.
|
|
280
|
+
*
|
|
281
|
+
* So `ctx.progress({ done: 3, total: 12 })` keeps its numbers on the record
|
|
282
|
+
* and says "reported progress (3 so far)" on screen; adding
|
|
283
|
+
* `message: 'Hop 3 of 12'` puts your own words there instead — and keeps the
|
|
284
|
+
* numbers. Consumers override the wording by template key
|
|
285
|
+
* (`tool.progress`, `tool.progress.generic`, or per tool).
|
|
286
|
+
*
|
|
264
287
|
* Doors with no event stream to file on — `mcpServe`, the offline
|
|
265
288
|
* `callTraceTool` context — supply the no-op. A tool must not have to know
|
|
266
289
|
* which door it is behind to be safe to call this from.
|
|
@@ -269,7 +292,14 @@ export interface ToolExecutionContext {
|
|
|
269
292
|
* execute: async (args, ctx) => {
|
|
270
293
|
* for (const [i, hop] of hops.entries()) {
|
|
271
294
|
* await walk(hop);
|
|
272
|
-
*
|
|
295
|
+
* // `message` is what the person reads; the rest is what the record
|
|
296
|
+
* // keeps. Drop `message` and the screen still says a report landed.
|
|
297
|
+
* ctx.progress({
|
|
298
|
+
* message: `Hop ${i + 1} of ${hops.length} — ${hop.id}`,
|
|
299
|
+
* done: i + 1,
|
|
300
|
+
* total: hops.length,
|
|
301
|
+
* hop: hop.id,
|
|
302
|
+
* });
|
|
273
303
|
* }
|
|
274
304
|
* return summary;
|
|
275
305
|
* }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/core/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKxC,OAAO,EAAE,eAAe,EAAkB,MAAM,uBAAuB,CAAC;AAGxE,OAAO,EAAE,cAAc,EAAwB,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAqB,MAAM,mBAAmB,CAAC;AAuK1E;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAAgB,EAChB,OAAsC;IAEtC,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO;IAClC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IACvC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;QAC/E,MAAM,IAAI,KAAK,CACb,qBAAqB,QAAQ,uCAAuC,MAAM,CAAC,QAAQ,CAAC,IAAI;YACtF,mFAAmF;YACnF,mFAAmF;YACnF,iFAAiF,CACpF,CAAC;IACJ,CAAC;IACD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,MAAM,GACV,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;YACvB,QAAQ,CAAC,MAAM,GAAG,CAAC;YACnB,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,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AAgB,EAAE,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC7F,2EAA2E;QAC3E,0EAA0E;QAC1E,GAAG,CAAC,OAAO,CAAC,YAAY,KAAK,SAAS,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;QACjF,GAAG,CAAC,OAAO,CAAC,aAAa,KAAK,SAAS,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,aAAa,EAAE,CAAC;QACpF,GAAG,CAAC,OAAO,CAAC,WAAW,KAAK,SAAS,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC;QAC9E,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC;AACJ,CAAC"}
|
|
@@ -28,9 +28,15 @@ export interface StatusOptions {
|
|
|
28
28
|
/**
|
|
29
29
|
* Subset of events the thinking renderer formats. Discriminated on `type`.
|
|
30
30
|
*/
|
|
31
|
-
export type StatusEvent = AgentfootprintEventMap['agentfootprint.agent.turn_start'] | AgentfootprintEventMap['agentfootprint.agent.turn_end'] | AgentfootprintEventMap['agentfootprint.agent.iteration_start'] | AgentfootprintEventMap['agentfootprint.agent.route_decided'] | AgentfootprintEventMap['agentfootprint.stream.tool_start'] | AgentfootprintEventMap['agentfootprint.stream.tool_end'];
|
|
31
|
+
export type StatusEvent = AgentfootprintEventMap['agentfootprint.agent.turn_start'] | AgentfootprintEventMap['agentfootprint.agent.turn_end'] | AgentfootprintEventMap['agentfootprint.agent.iteration_start'] | AgentfootprintEventMap['agentfootprint.agent.route_decided'] | AgentfootprintEventMap['agentfootprint.stream.tool_start'] | AgentfootprintEventMap['agentfootprint.stream.tool_progress'] | AgentfootprintEventMap['agentfootprint.stream.tool_end'];
|
|
32
32
|
/**
|
|
33
33
|
* Attach a thinking-status subscription to the event dispatcher.
|
|
34
34
|
* Returns an Unsubscribe — call to detach.
|
|
35
|
+
*
|
|
36
|
+
* Holds one small piece of state: how many mid-call reports each in-flight
|
|
37
|
+
* tool call has filed (9.54.0), so the generic progress line can say "3 so
|
|
38
|
+
* far" instead of repeating one indistinguishable sentence. The tally is
|
|
39
|
+
* per-`toolCallId` — parallel calls count separately — and is dropped when
|
|
40
|
+
* that call ends, so nothing accumulates across a long-lived run.
|
|
35
41
|
*/
|
|
36
42
|
export declare function attachStatus(dispatcher: EventDispatcher, options: StatusOptions): Unsubscribe;
|