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
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
* ────┤ tool ├────────────────────────────► "Working on `weather`…"
|
|
26
26
|
* └──────────┘ (or per-tool override)
|
|
27
27
|
*
|
|
28
|
+
* ┌──────────┐ tool_progress, still no tool.end
|
|
29
|
+
* ────┤ tool ├────────────────────────────► "Looking at your screen…"
|
|
30
|
+
* └──────────┘ (same state, newer line) (or the generic report)
|
|
31
|
+
*
|
|
28
32
|
* ┌──────────┐ pause.request, no resume yet
|
|
29
33
|
* ────┤ paused ├────────────────────────────► "Waiting on you: …"
|
|
30
34
|
* └──────────┘
|
|
@@ -38,9 +42,31 @@
|
|
|
38
42
|
* (e.g. `tool.weather: 'Looking up the weather…'`) which the renderer
|
|
39
43
|
* prefers over the generic `tool` template. Lets each tool have its
|
|
40
44
|
* own first-person status without per-tool plumbing.
|
|
45
|
+
*
|
|
46
|
+
* MID-CALL REPORTS (9.54.0). `ctx.progress(payload)` files
|
|
47
|
+
* `stream.tool_progress` from inside a still-running tool call. Through
|
|
48
|
+
* 9.53.0 that event reached the record and stopped there: nothing
|
|
49
|
+
* projected it onto the surface a person watches, so consumers hand-rolled
|
|
50
|
+
* a side channel for the live middle of a long call. The `tool` state now
|
|
51
|
+
* consumes it — same state, newer line — and the DISPLAY CONTRACT is
|
|
52
|
+
* deliberately narrow, because `payload` is author-defined `unknown`:
|
|
53
|
+
*
|
|
54
|
+
* · a top-level string field named `message` is shown VERBATIM
|
|
55
|
+
* (trimmed; cut at {@link PROGRESS_MESSAGE_LIMIT} characters, and the
|
|
56
|
+
* cut is always stated). `message` is the word MCP's own progress
|
|
57
|
+
* notification uses, so a tool already speaking that protocol needs no
|
|
58
|
+
* second vocabulary.
|
|
59
|
+
* · anything else — no `message`, a non-string one, an empty one — gets
|
|
60
|
+
* the generic line: the tool's name, that it reported, and how many
|
|
61
|
+
* times. NEVER a pretty-printed dump of the author's payload: a status
|
|
62
|
+
* line is prose, and prose that quotes a JSON blob is the field-dump
|
|
63
|
+
* law broken in public.
|
|
64
|
+
*
|
|
65
|
+
* The structured payload rides on to the record untouched either way. One
|
|
66
|
+
* `ctx.progress` call, two honest faces.
|
|
41
67
|
*/
|
|
42
68
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.renderStatusLine = exports.selectStatus = exports.defaultStatusTemplates = void 0;
|
|
69
|
+
exports.renderStatusLine = exports.selectStatus = exports.progressMessageOf = exports.PROGRESS_MESSAGE_LIMIT = exports.defaultStatusTemplates = void 0;
|
|
44
70
|
// ── Defaults ───────────────────────────────────────────────────────
|
|
45
71
|
/**
|
|
46
72
|
* Bundled English defaults. Override in the agent config via
|
|
@@ -52,15 +78,69 @@ exports.defaultStatusTemplates = {
|
|
|
52
78
|
streaming: '{{partial}}',
|
|
53
79
|
tool: 'Working on `{{toolName}}`…',
|
|
54
80
|
paused: 'Waiting on you: {{question}}',
|
|
81
|
+
// Mid-call reports (9.54.0). `tool.progress` mirrors `streaming` — the
|
|
82
|
+
// template is the author's own sentence and nothing else, because a line
|
|
83
|
+
// this library wrapped around it would be this library talking over a tool
|
|
84
|
+
// that already said what it is doing.
|
|
85
|
+
'tool.progress': '{{progressMessage}}',
|
|
86
|
+
// …and when it said nothing sayable, the honest line is the fact that it
|
|
87
|
+
// reported, plus how often. No payload, ever.
|
|
88
|
+
'tool.progress.generic': '`{{toolName}}` reported progress ({{progressCount}} so far)…',
|
|
55
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* How much of a tool author's `message` one status line carries before it is
|
|
92
|
+
* cut. A status line lives in a chat bubble; past ~120 characters it stops
|
|
93
|
+
* being a status and starts being a paragraph.
|
|
94
|
+
*
|
|
95
|
+
* Truncation is always STATED, never silent — the line says how much it cut,
|
|
96
|
+
* the same rule the analyst-view humanizer keeps. A message that legitimately
|
|
97
|
+
* ends in an ellipsis must stay distinguishable from one we shortened.
|
|
98
|
+
*/
|
|
99
|
+
exports.PROGRESS_MESSAGE_LIMIT = 120;
|
|
100
|
+
/**
|
|
101
|
+
* The tool author's `message`, ready to show — or `null` when this report had
|
|
102
|
+
* nothing sayable and the generic line should stand instead.
|
|
103
|
+
*
|
|
104
|
+
* Deliberately strict, and the strictness is the contract:
|
|
105
|
+
*
|
|
106
|
+
* · the payload must be a plain object with a top-level `message` STRING.
|
|
107
|
+
* A bare string payload is not a `message` — `ctx.progress('…')` is a
|
|
108
|
+
* valid report, but it is the author's data, not a sentence they asked us
|
|
109
|
+
* to show a person. Wrapping it (`ctx.progress({ message: '…' })`) is the
|
|
110
|
+
* one-word opt-in, and it keeps a single rule to document.
|
|
111
|
+
* · an empty or whitespace-only `message` is not a sentence. It falls to the
|
|
112
|
+
* generic line rather than blanking the bubble mid-call.
|
|
113
|
+
*
|
|
114
|
+
* Nothing here reads any other field. Guessing at `done`/`total`/`percent`
|
|
115
|
+
* would put words in the tool's mouth: one tool's `total` is hops, the next
|
|
116
|
+
* one's is bytes, and a status line that says "3 of 12" about the wrong unit
|
|
117
|
+
* is worse than one that says nothing.
|
|
118
|
+
*/
|
|
119
|
+
function progressMessageOf(payload) {
|
|
120
|
+
if (payload === null || typeof payload !== 'object' || Array.isArray(payload))
|
|
121
|
+
return null;
|
|
122
|
+
const raw = payload.message;
|
|
123
|
+
if (typeof raw !== 'string')
|
|
124
|
+
return null;
|
|
125
|
+
const text = raw.trim();
|
|
126
|
+
if (text.length === 0)
|
|
127
|
+
return null;
|
|
128
|
+
if (text.length <= exports.PROGRESS_MESSAGE_LIMIT)
|
|
129
|
+
return text;
|
|
130
|
+
const cut = text.length - exports.PROGRESS_MESSAGE_LIMIT;
|
|
131
|
+
return `${text.slice(0, exports.PROGRESS_MESSAGE_LIMIT)}… (+${String(cut)} more)`;
|
|
132
|
+
}
|
|
133
|
+
exports.progressMessageOf = progressMessageOf;
|
|
56
134
|
// ── Selector ───────────────────────────────────────────────────────
|
|
57
135
|
/**
|
|
58
136
|
* Derive the current thinking state from the event log.
|
|
59
137
|
*
|
|
60
138
|
* Single forward walk that tracks "active" state for each domain:
|
|
61
139
|
* • pause — set on pause.request, cleared on pause.resume
|
|
62
|
-
* • tool
|
|
63
|
-
* (matched by `toolCallId`
|
|
140
|
+
* • tool calls — a call joins the in-flight map on tool.start and leaves
|
|
141
|
+
* it on ITS OWN tool.end (matched by `toolCallId`), so two
|
|
142
|
+
* parallel calls cannot close each other. Each in-flight
|
|
143
|
+
* call also carries its own progress tally (9.54.0).
|
|
64
144
|
* • llm — set on llm.start, cleared on llm.end
|
|
65
145
|
*
|
|
66
146
|
* Priority order (highest first):
|
|
@@ -68,20 +148,29 @@ exports.defaultStatusTemplates = {
|
|
|
68
148
|
* 1. ACTIVE PAUSE wins. When the agent is waiting on the human,
|
|
69
149
|
* that's what the chat should show — not the underlying tool
|
|
70
150
|
* that triggered the pause.
|
|
71
|
-
* 2.
|
|
72
|
-
* running. Show "Working on `<toolName>`…"
|
|
151
|
+
* 2. AN IN-FLIGHT TOOL CALL — the LLM said "use a tool" and the tool is
|
|
152
|
+
* running. Show "Working on `<toolName>`…", or, once that call has
|
|
153
|
+
* reported, what it reported.
|
|
73
154
|
* 3. ACTIVE LLM — call in flight. Show streaming tokens if any
|
|
74
155
|
* arrived, otherwise "Thinking…".
|
|
75
156
|
* 4. Otherwise null (bubble hidden).
|
|
76
157
|
*
|
|
158
|
+
* WHICH CALL THE LINE IS ABOUT, when several run in parallel: the one with
|
|
159
|
+
* the most recent `tool_progress`, and only if none of them has reported, the
|
|
160
|
+
* most recently STARTED. A report is the newest evidence of what is actually
|
|
161
|
+
* happening, and a surface that showed a silent call while a reporting one
|
|
162
|
+
* had something to say would be choosing the less informative truth. Two
|
|
163
|
+
* chatty parallel calls therefore alternate on the line, each verbatim, in the
|
|
164
|
+
* order their reports landed — which is what a person watching them wants.
|
|
165
|
+
*
|
|
77
166
|
* Pure projection. Forward walk is O(n); a closing event correctly
|
|
78
167
|
* cancels its matching opener so a completed tool.start/tool.end
|
|
79
168
|
* pair leaves the state quiescent.
|
|
80
169
|
*/
|
|
81
170
|
function selectStatus(events) {
|
|
82
171
|
let activePause = null;
|
|
83
|
-
let activeTool = null;
|
|
84
172
|
let activeLlmStartIdx = -1; // -1 = no active LLM call
|
|
173
|
+
const inFlight = new Map();
|
|
85
174
|
for (let i = 0; i < events.length; i++) {
|
|
86
175
|
const e = events[i];
|
|
87
176
|
switch (e.type) {
|
|
@@ -98,10 +187,39 @@ function selectStatus(events) {
|
|
|
98
187
|
break;
|
|
99
188
|
case 'agentfootprint.stream.tool_start': {
|
|
100
189
|
const p = e.payload;
|
|
101
|
-
|
|
190
|
+
// A call with no id still gets a slot — an emitter simpler than this
|
|
191
|
+
// library's own (a hand-built stream, an older recording) must still
|
|
192
|
+
// move the bubble. The synthetic key just cannot be correlated.
|
|
193
|
+
inFlight.set(p.toolCallId ?? `__anon#${String(i)}`, {
|
|
102
194
|
toolName: p.toolName,
|
|
103
195
|
...(p.toolCallId ? { toolCallId: p.toolCallId } : {}),
|
|
104
|
-
|
|
196
|
+
startSeq: i,
|
|
197
|
+
progressCount: 0,
|
|
198
|
+
lastProgressSeq: -1,
|
|
199
|
+
lastMessage: null,
|
|
200
|
+
});
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
case 'agentfootprint.stream.tool_progress': {
|
|
204
|
+
// 9.54.0 — the live middle of a call. Correlate STRICTLY by id: the
|
|
205
|
+
// framework stamps it, so a real run always has one. Off the wire it
|
|
206
|
+
// may be missing, and then the only safe attribution is a sole
|
|
207
|
+
// in-flight call; with two running, a guess would put one call's words
|
|
208
|
+
// under the other one's name.
|
|
209
|
+
const p = e.payload;
|
|
210
|
+
const key = p.toolCallId !== undefined && inFlight.has(p.toolCallId)
|
|
211
|
+
? p.toolCallId
|
|
212
|
+
: p.toolCallId === undefined && inFlight.size === 1
|
|
213
|
+
? [...inFlight.keys()][0]
|
|
214
|
+
: undefined;
|
|
215
|
+
if (key === undefined)
|
|
216
|
+
break; // a report for a call that already ended
|
|
217
|
+
const call = inFlight.get(key);
|
|
218
|
+
if (call === undefined)
|
|
219
|
+
break;
|
|
220
|
+
call.progressCount += 1;
|
|
221
|
+
call.lastProgressSeq = i;
|
|
222
|
+
call.lastMessage = progressMessageOf(p.payload);
|
|
105
223
|
break;
|
|
106
224
|
}
|
|
107
225
|
case 'agentfootprint.stream.tool_end': {
|
|
@@ -109,9 +227,10 @@ function selectStatus(events) {
|
|
|
109
227
|
// other. If no toolCallId is present (older event), clear
|
|
110
228
|
// unconditionally — backward-compat with simpler emitters.
|
|
111
229
|
const p = e.payload;
|
|
112
|
-
if (
|
|
113
|
-
|
|
114
|
-
|
|
230
|
+
if (p.toolCallId === undefined)
|
|
231
|
+
inFlight.clear();
|
|
232
|
+
else
|
|
233
|
+
inFlight.delete(p.toolCallId);
|
|
115
234
|
break;
|
|
116
235
|
}
|
|
117
236
|
case 'agentfootprint.stream.llm_start':
|
|
@@ -132,13 +251,23 @@ function selectStatus(events) {
|
|
|
132
251
|
},
|
|
133
252
|
};
|
|
134
253
|
}
|
|
135
|
-
|
|
254
|
+
const calls = [...inFlight.values()];
|
|
255
|
+
if (calls.length > 0) {
|
|
256
|
+
const reported = calls.filter((c) => c.lastProgressSeq >= 0);
|
|
257
|
+
const focus = reported.length > 0
|
|
258
|
+
? reported.reduce((a, b) => (b.lastProgressSeq > a.lastProgressSeq ? b : a))
|
|
259
|
+
: calls.reduce((a, b) => (b.startSeq > a.startSeq ? b : a));
|
|
136
260
|
return {
|
|
137
261
|
state: 'tool',
|
|
138
|
-
toolName:
|
|
262
|
+
toolName: focus.toolName,
|
|
139
263
|
vars: {
|
|
140
|
-
toolName:
|
|
141
|
-
...(
|
|
264
|
+
toolName: focus.toolName,
|
|
265
|
+
...(focus.toolCallId ? { toolCallId: focus.toolCallId } : {}),
|
|
266
|
+
// Absent field → absent clause: a call that has not reported carries
|
|
267
|
+
// no progress vars at all, so the renderer resolves exactly the ladder
|
|
268
|
+
// it resolved before this feature existed.
|
|
269
|
+
...(focus.progressCount > 0 ? { progressCount: String(focus.progressCount) } : {}),
|
|
270
|
+
...(focus.lastMessage !== null ? { progressMessage: focus.lastMessage } : {}),
|
|
142
271
|
},
|
|
143
272
|
};
|
|
144
273
|
}
|
|
@@ -162,10 +291,22 @@ exports.selectStatus = selectStatus;
|
|
|
162
291
|
/**
|
|
163
292
|
* Resolve the matched template + substitute vars.
|
|
164
293
|
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
294
|
+
* Each state resolves a LADDER of candidate keys, most specific first, and
|
|
295
|
+
* takes the first one the merged template map defines:
|
|
296
|
+
*
|
|
297
|
+
* | the state | ladder |
|
|
298
|
+
* |------------------------------------|---------------------------------------------------------------------|
|
|
299
|
+
* | tool, reported with a `message` | `tool.<name>.progress` → `tool.progress` → `tool.<name>` → `tool` |
|
|
300
|
+
* | tool, reported without one | `tool.<name>.progress.generic` → `tool.progress.generic` → `tool.<name>` → `tool` |
|
|
301
|
+
* | tool, no report yet | `tool.<name>` → `tool` |
|
|
302
|
+
* | anything else | the state's own name |
|
|
303
|
+
*
|
|
304
|
+
* The ladder falls THROUGH to the plain tool keys on purpose. A consumer who
|
|
305
|
+
* shipped a curated `tool.weather` line and does not want it interrupted
|
|
306
|
+
* deletes `tool.progress.generic` from their map and keeps it; a consumer who
|
|
307
|
+
* ships a partial map that predates 9.54.0 keeps rendering exactly what it
|
|
308
|
+
* rendered before, mid-call reports and all. Nothing here can blank a bubble
|
|
309
|
+
* that used to have a line in it.
|
|
169
310
|
*
|
|
170
311
|
* Missing template keys return null rather than the empty string —
|
|
171
312
|
* keeps the contract honest (consumer can detect "no template" and
|
|
@@ -174,17 +315,30 @@ exports.selectStatus = selectStatus;
|
|
|
174
315
|
function renderStatusLine(state, ctx, templates = exports.defaultStatusTemplates) {
|
|
175
316
|
if (!state)
|
|
176
317
|
return null;
|
|
177
|
-
let
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
if (
|
|
181
|
-
|
|
318
|
+
let template;
|
|
319
|
+
for (const key of templateLadder(state)) {
|
|
320
|
+
template = templates[key];
|
|
321
|
+
if (template !== undefined)
|
|
322
|
+
break;
|
|
182
323
|
}
|
|
183
|
-
const template = templates[key];
|
|
184
324
|
if (template === undefined)
|
|
185
325
|
return null;
|
|
186
326
|
const vars = { appName: ctx.appName, ...state.vars };
|
|
187
327
|
return template.replace(/\{\{(\w+)\}\}/g, (_, name) => vars[name] ?? '');
|
|
188
328
|
}
|
|
189
329
|
exports.renderStatusLine = renderStatusLine;
|
|
330
|
+
/** Candidate template keys for a state, most specific first. */
|
|
331
|
+
function templateLadder(state) {
|
|
332
|
+
if (state.state !== 'tool')
|
|
333
|
+
return [state.state];
|
|
334
|
+
const generic = state.toolName !== undefined ? [`tool.${state.toolName}`, 'tool'] : ['tool'];
|
|
335
|
+
const perTool = (suffix) => state.toolName !== undefined ? [`tool.${state.toolName}.${suffix}`] : [];
|
|
336
|
+
if (state.vars.progressMessage !== undefined) {
|
|
337
|
+
return [...perTool('progress'), 'tool.progress', ...generic];
|
|
338
|
+
}
|
|
339
|
+
if (state.vars.progressCount !== undefined) {
|
|
340
|
+
return [...perTool('progress.generic'), 'tool.progress.generic', ...generic];
|
|
341
|
+
}
|
|
342
|
+
return generic;
|
|
343
|
+
}
|
|
190
344
|
//# sourceMappingURL=statusTemplates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statusTemplates.js","sourceRoot":"","sources":["../../../../src/recorders/observability/status/statusTemplates.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"statusTemplates.js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Q,KAAK,CAAC,QAAQ,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3E,IAAI,KAAK,CAAC,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;QAC7C,OAAO,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,CAAC;IAC/D,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,CAAC,aAAa,KAAK,SAAS,EAAE,CAAC;QAC3C,OAAO,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,EAAE,uBAAuB,EAAE,GAAG,OAAO,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/window.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAc,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAGxF,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/window.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAc,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC3E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AAGxF,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,WAAW,eAAe;IAC9B,uCAAuC;IACvC,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,EAAE,qBAAqB,CAAC;IACtC,4DAA4D;IAC5D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,6DAA6D;IAC7D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAC7C,+EAA+E;IAC/E,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IACrC,2CAA2C;IAC3C,QAAQ,CAAC,UAAU,CAAC,EAAE,kBAAkB,CAAC;IACzC,+CAA+C;IAC/C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CAC7B;AAED,8BAA8B;AAC9B,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,eAAe,GACpB,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CA0KlD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
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 type { LLMMessage } from '../../../adapters/types.js';
|
|
56
|
+
/**
|
|
57
|
+
* Index in `history` of the current request — the message no window strategy
|
|
58
|
+
* may drop — or `-1` when this window holds none.
|
|
59
|
+
*
|
|
60
|
+
* `-1` is a real answer, not a failure: a hand-built window of assistant
|
|
61
|
+
* turns, or one whose only user-role messages are this library's own frames,
|
|
62
|
+
* genuinely has no request to protect. Every caller treats it as "the rule
|
|
63
|
+
* does not apply here", which is how the pre-9.55.0 behaviour is still
|
|
64
|
+
* reachable byte for byte.
|
|
65
|
+
*
|
|
66
|
+
* @param history the window, in order
|
|
67
|
+
* @param said the text the run was started with (`scope.userMessage`),
|
|
68
|
+
* when the caller knows it
|
|
69
|
+
*/
|
|
70
|
+
export declare function currentRequestIndexOf(history: readonly LLMMessage[], said?: string): number;
|
|
71
|
+
//# sourceMappingURL=currentRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currentRequest.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/window/currentRequest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAc7D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAS3F"}
|
|
@@ -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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notice.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/window/notice.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"notice.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/window/notice.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,qBAAqB,CAAC;AAErD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE;IACrC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CACvC,GAAG,UAAU,CAcb;AAED,gEAAgE;AAChE,wBAAgB,YAAY,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAEjE"}
|
|
@@ -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
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drop.d.ts","sourceRoot":"","sources":["../../../../../../src/core/agent/window/strategies/drop.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"drop.d.ts","sourceRoot":"","sources":["../../../../../../src/core/agent/window/strategies/drop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,4DAA4D;AAC5D,MAAM,WAAW,WAAW;IAC1B,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;IAC5C,uDAAuD;IACvD,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACxC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAChB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;QAC/B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;KAChC,CAAC;IACF,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,SAAS,EAAE,SAAS,cAAc,EAAE,CAAC;IAC9C,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,yEAAyE;IACzE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,mBAAmB,EAC1B,eAAe,EAAE,MAAM,EACvB,YAAY,EAAE,MAAM,GACnB,WAAW,CAyFb"}
|
|
@@ -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.
|
|
@@ -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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strategy.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/window/strategy.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"strategy.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/window/strategy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE3D,8EAA8E;AAC9E,MAAM,WAAW,cAAc;IAC7B,gFAAgF;IAChF,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,2EAA2E;AAC3E,MAAM,WAAW,YAAY;IAC3B,8EAA8E;IAC9E,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,EAAE,SAAS,cAAc,EAAE,CAAC;CAC/C;AAED,mDAAmD;AACnD,MAAM,WAAW,mBAAmB;IAClC,yCAAyC;IACzC,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;IACxC,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IAChC;;;;;;;;;OASG;IACH,QAA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S,cAAc,EAAE,CAAC;IAC9C;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACxC;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE;QACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;QAC3B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;QACjC,QAAQ,CAAC,UAAU,EAAE,OAAO,GAAG,WAAW,GAAG,MAAM,CAAC;QACpD,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;KACpC,CAAC;IACF,6DAA6D;IAC7D,QAAQ,CAAC,KAAK,CAAC,EAAE;QACf,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,KAAK,EAAE;YAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;YAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;KACrE,CAAC;IACF,wDAAwD;IACxD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE;QACjB,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC;QAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;KACxB,CAAC;IACF;;;;;;;;;;OAUG;IACH,IAAI,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CAAC;CAC7E"}
|
|
@@ -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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarize.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/window/summarize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACvF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,6EAA6E;AAC7E,eAAO,MAAM,sBAAsB,uBAAuB,CAAC;AAM3D;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,QAYzB,CAAC;AAcb,mEAAmE;AACnE,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,GAAG,MAAM,CAExE;AAoBD
|
|
1
|
+
{"version":3,"file":"summarize.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/window/summarize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACvF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,6EAA6E;AAC7E,eAAO,MAAM,sBAAsB,uBAAuB,CAAC;AAM3D;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,QAYzB,CAAC;AAcb,mEAAmE;AACnE,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,GAAG,MAAM,CAExE;AAoBD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,KAAK,EAAE;IACL,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;CACtC,GACA,UAAU,CAOZ;AAED,+DAA+D;AAC/D,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAEvE;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,WAAW,EACrB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,SAAS,UAAU,EAAE,EAC3B,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,OAAO,CAAC,eAAe,CAAC,CAQ1B"}
|
|
@@ -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. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"turns.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/window/turns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAErE;;;;GAIG;AACH,MAAM,WAAW,IAAI;IACnB,8CAA8C;IAC9C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sCAAsC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,SAAS,UAAU,EAAE,CAAC;CAC1C;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,SAAS,IAAI,EAAE,CAqB5E;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9C,8DAA8D;IAC9D,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IACnC,8EAA8E;IAC9E,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG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;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,GAAG,mBAAmB,GAAG,SAAS,CA0B7F;AAED,oFAAoF;AACpF,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,aAAa,EACrB,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,GAC1C,WAAW,CA8Cb;AAED,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,MAAM,CAIlE"}
|
|
@@ -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 —
|