@gaunt-sloth/core 2.0.0-beta.5 → 2.0.0-beta.6
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/config/schema.d.ts +4 -0
- package/dist/config/schema.js +64 -2
- package/dist/config/schema.js.map +1 -1
- package/dist/config/tokenBudget.d.ts +88 -0
- package/dist/config/tokenBudget.js +155 -0
- package/dist/config/tokenBudget.js.map +1 -0
- package/dist/config/types.d.ts +33 -4
- package/dist/config/types.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.js +5 -0
- package/dist/config.js.map +1 -1
- package/dist/core/GthAbstractAgent.d.ts +24 -0
- package/dist/core/GthAbstractAgent.js +37 -1
- package/dist/core/GthAbstractAgent.js.map +1 -1
- package/dist/core/GthAgentRunner.d.ts +216 -1
- package/dist/core/GthAgentRunner.js +424 -3
- package/dist/core/GthAgentRunner.js.map +1 -1
- package/dist/core/GthLangChainAgent.d.ts +196 -0
- package/dist/core/GthLangChainAgent.js +392 -2
- package/dist/core/GthLangChainAgent.js.map +1 -1
- package/dist/core/approvals/conversationGrants.d.ts +60 -0
- package/dist/core/approvals/conversationGrants.js +77 -0
- package/dist/core/approvals/conversationGrants.js.map +1 -0
- package/dist/core/approvals/grants.d.ts +16 -0
- package/dist/core/approvals/grants.js +20 -5
- package/dist/core/approvals/grants.js.map +1 -1
- package/dist/core/compaction.d.ts +181 -0
- package/dist/core/compaction.js +293 -0
- package/dist/core/compaction.js.map +1 -0
- package/dist/core/compactionThreshold.d.ts +158 -0
- package/dist/core/compactionThreshold.js +183 -0
- package/dist/core/compactionThreshold.js.map +1 -0
- package/dist/core/contextWindow.d.ts +146 -0
- package/dist/core/contextWindow.js +256 -0
- package/dist/core/contextWindow.js.map +1 -0
- package/dist/core/exitOutputChannel.d.ts +51 -0
- package/dist/core/exitOutputChannel.js +65 -0
- package/dist/core/exitOutputChannel.js.map +1 -0
- package/dist/core/refusal.d.ts +17 -2
- package/dist/core/refusal.js +80 -14
- package/dist/core/refusal.js.map +1 -1
- package/dist/core/runStats.d.ts +1 -1
- package/dist/core/terminationNotice.d.ts +8 -0
- package/dist/core/terminationNotice.js +10 -4
- package/dist/core/terminationNotice.js.map +1 -1
- package/dist/core/terminationReason.d.ts +28 -0
- package/dist/core/terminationReason.js +27 -0
- package/dist/core/terminationReason.js.map +1 -1
- package/dist/core/types.d.ts +35 -1
- package/dist/core/types.js.map +1 -1
- package/dist/history/checkpointRetention.d.ts +279 -0
- package/dist/history/checkpointRetention.js +567 -0
- package/dist/history/checkpointRetention.js.map +1 -0
- package/dist/history/checkpointSaver.d.ts +93 -0
- package/dist/history/checkpointSaver.js +464 -0
- package/dist/history/checkpointSaver.js.map +1 -0
- package/dist/history/historyEnabled.d.ts +27 -0
- package/dist/history/historyEnabled.js +23 -0
- package/dist/history/historyEnabled.js.map +1 -0
- package/dist/history/historyFormat.d.ts +27 -0
- package/dist/history/historyFormat.js +125 -2
- package/dist/history/historyFormat.js.map +1 -1
- package/dist/history/historyStore.d.ts +61 -0
- package/dist/history/historyStore.js +180 -7
- package/dist/history/historyStore.js.map +1 -1
- package/dist/history/recordSession.d.ts +84 -22
- package/dist/history/recordSession.js +187 -12
- package/dist/history/recordSession.js.map +1 -1
- package/dist/history/sessionCheckpointer.d.ts +48 -0
- package/dist/history/sessionCheckpointer.js +200 -0
- package/dist/history/sessionCheckpointer.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/providers/modelCatalog.d.ts +14 -0
- package/dist/providers/modelCatalog.js +4 -0
- package/dist/providers/modelCatalog.js.map +1 -1
- package/dist/providers/modelDiscovery.d.ts +3 -1
- package/dist/providers/modelDiscovery.js +22 -8
- package/dist/providers/modelDiscovery.js.map +1 -1
- package/dist/providers/ollama.js +3 -19
- package/dist/providers/ollama.js.map +1 -1
- package/dist/runtime/conversation.js +7 -1
- package/dist/runtime/conversation.js.map +1 -1
- package/dist/runtime/singleShot.js +6 -1
- package/dist/runtime/singleShot.js.map +1 -1
- package/dist/utils/consoleUtils.d.ts +77 -0
- package/dist/utils/consoleUtils.js +81 -0
- package/dist/utils/consoleUtils.js.map +1 -1
- package/package.json +2 -2
- package/schema/gsloth-config.schema.json +33 -14
|
@@ -3,6 +3,7 @@ import { StatusLevel } from '#src/core/types.js';
|
|
|
3
3
|
import { GthAbstractAgent } from '#src/core/GthAbstractAgent.js';
|
|
4
4
|
import { debugLog, debugLogObject } from '#src/utils/debugUtils.js';
|
|
5
5
|
import { buildSystemMessages, formatToolCalls, readModePrompt } from '#src/utils/llmUtils.js';
|
|
6
|
+
import { modelProviderLabel } from '#src/core/modelLabel.js';
|
|
6
7
|
import { getCurrentWorkDir } from '#src/utils/systemUtils.js';
|
|
7
8
|
import { isToolAllowed } from '#src/utils/toolMatching.js';
|
|
8
9
|
import { appendOsShellNote, appendCwdNote, appendCommitCoAuthorNote, appendModelContextNote, appendMcpServerInstructionsNote, resolveModelIdentity, } from '#src/utils/systemPromptNotes.js';
|
|
@@ -10,7 +11,11 @@ import { isShellCommandFailedError } from '#src/core/shell/ShellCommandFailedErr
|
|
|
10
11
|
import { extractDebugRequestExtras } from '#src/core/debugCapture.js';
|
|
11
12
|
import { promoteTextEmittedToolCallMessage } from '#src/core/toolCallRepair/index.js';
|
|
12
13
|
import { terminationReason } from '#src/core/terminationReason.js';
|
|
13
|
-
import {
|
|
14
|
+
import { compactMessages, conversationSize, createModelSummarizer, } from '#src/core/compaction.js';
|
|
15
|
+
import { resolveContextWindow } from '#src/core/contextWindow.js';
|
|
16
|
+
import { AutocompactController, resolveAutocompactConfig } from '#src/core/compactionThreshold.js';
|
|
17
|
+
import { AIMessage, RemoveMessage, ToolMessage } from '@langchain/core/messages';
|
|
18
|
+
import { REMOVE_ALL_MESSAGES } from '@langchain/langgraph';
|
|
14
19
|
import { createAgent, createMiddleware, humanInTheLoopMiddleware, } from 'langchain';
|
|
15
20
|
/**
|
|
16
21
|
* GS2-36 — default cap for the tool-error retry budget: how many status:'error' tool results may
|
|
@@ -295,6 +300,327 @@ export function createToolLoopGuardMiddleware(options = {}, onWarn, onHalt) {
|
|
|
295
300
|
},
|
|
296
301
|
});
|
|
297
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* EXT-160 — how many characters of prompt one token is assumed to carry.
|
|
305
|
+
*
|
|
306
|
+
* 3.5 rather than the usual English rule of thumb of 4, because the prompt this guard measures is
|
|
307
|
+
* not English: it is a system prompt full of tool schemas, JSON tool arguments and file paths, which
|
|
308
|
+
* tokenise far worse than prose. Erring low makes the estimate HIGH, which is the safe direction —
|
|
309
|
+
* an early compaction costs one summary call, a late one costs a silently truncated conversation.
|
|
310
|
+
*/
|
|
311
|
+
export const ESTIMATE_CHARS_PER_TOKEN = 3.5;
|
|
312
|
+
/**
|
|
313
|
+
* EXT-160 — the multiplier applied to the whole estimate, on top of the pessimistic ratio above.
|
|
314
|
+
*
|
|
315
|
+
* The estimate is anchored on a real token count and extrapolates only the delta, so 10% covers the
|
|
316
|
+
* part that is genuinely guessed: the tokens of messages added since the anchor, plus whatever the
|
|
317
|
+
* provider adds per message that no character count can see (role headers, tool-call framing).
|
|
318
|
+
*/
|
|
319
|
+
export const ESTIMATE_SAFETY_MARGIN = 1.1;
|
|
320
|
+
/**
|
|
321
|
+
* EXT-160 — tokens reserved for the model's own answer when nothing else says.
|
|
322
|
+
*
|
|
323
|
+
* On ollama `num_ctx` covers the prompt **and** the generation from one budget, so a prompt that
|
|
324
|
+
* "fits" with nothing left over does not fail — it produces a truncated answer, which is the second
|
|
325
|
+
* failure of the spike's three wearing the first's clothes. Reserving the room is what keeps a
|
|
326
|
+
* guard that is about input overflow from shipping output truncation instead.
|
|
327
|
+
*/
|
|
328
|
+
export const DEFAULT_OUTPUT_RESERVE_TOKENS = 2048;
|
|
329
|
+
/**
|
|
330
|
+
* EXT-160 — the most any ONE non-text content block may add to the estimate, in tokens.
|
|
331
|
+
*
|
|
332
|
+
* **This is an approximation and does not model any provider's image tokenisation.** It cannot: the
|
|
333
|
+
* real number depends on the provider, the model, and how the image is tiled, and none of that is
|
|
334
|
+
* knowable from the block. What it does instead is bound the damage in both directions.
|
|
335
|
+
*
|
|
336
|
+
* The bound is needed because a block's ENCODED LENGTH is not a proxy for its size at all. A 100 KB
|
|
337
|
+
* inline image is roughly 136 500 base64 characters, which at the ratio above is about 43 000
|
|
338
|
+
* tokens, while providers charge on the order of a thousand for it — an over-count near 33×, larger
|
|
339
|
+
* than any window this project wires. Charging that would fold the conversation on every single
|
|
340
|
+
* turn, which is the same thrashing the reserve clamp exists to prevent, arriving from the other
|
|
341
|
+
* side.
|
|
342
|
+
*
|
|
343
|
+
* 1600 sits at the top of the range providers charge for a large image, so it **errs high** — the
|
|
344
|
+
* same direction as every other approximation here, and the direction the node prefers, because an
|
|
345
|
+
* early compaction costs one summary call while a late one costs a silently truncated conversation.
|
|
346
|
+
* It errs high by a bounded factor rather than an unbounded one, which is the whole point.
|
|
347
|
+
*
|
|
348
|
+
* It is a CAP, not a flat charge: a block shorter than this is counted at its real length, so a
|
|
349
|
+
* small structured tool result stays accurate instead of being inflated to an image's cost.
|
|
350
|
+
*/
|
|
351
|
+
export const NON_TEXT_BLOCK_TOKEN_ALLOWANCE = 1600;
|
|
352
|
+
/**
|
|
353
|
+
* EXT-160 — {@link NON_TEXT_BLOCK_TOKEN_ALLOWANCE} in the characters the estimator actually sums,
|
|
354
|
+
* so the cap survives the division by {@link ESTIMATE_CHARS_PER_TOKEN} that follows.
|
|
355
|
+
*/
|
|
356
|
+
export const NON_TEXT_BLOCK_CHARACTER_ALLOWANCE = Math.round(NON_TEXT_BLOCK_TOKEN_ALLOWANCE * ESTIMATE_CHARS_PER_TOKEN);
|
|
357
|
+
/**
|
|
358
|
+
* EXT-160 — a residual this small is a block's structural keys, not its payload.
|
|
359
|
+
*
|
|
360
|
+
* After a block's `text` is removed (already counted elsewhere) an ordinary text block leaves only
|
|
361
|
+
* its discriminator — `{"type":"text"}` is fifteen characters. Charging that would add noise
|
|
362
|
+
* proportional to the NUMBER of blocks rather than to what they carry, and the system prompt alone
|
|
363
|
+
* is an array of them. Anything above this floor is treated as payload and counted.
|
|
364
|
+
*
|
|
365
|
+
* This is the one approximation here that errs LOW, and only ever by this many characters per
|
|
366
|
+
* block, because a residual under the floor cannot be a payload worth compacting for.
|
|
367
|
+
*/
|
|
368
|
+
export const BLOCK_STRUCTURE_FLOOR_CHARACTERS = 64;
|
|
369
|
+
/**
|
|
370
|
+
* EXT-160 — the largest fraction of the window the **default** reserve is allowed to claim.
|
|
371
|
+
*
|
|
372
|
+
* A fixed reserve is meaningless against a window near its own size: measured live on a
|
|
373
|
+
* deliberately small `num_ctx` of 2048, the flat 2048-token reserve made `estimate + reserve >
|
|
374
|
+
* window` true for every call whatever the conversation held, so the guard folded on every turn and
|
|
375
|
+
* spent a summary call each time. The clamp keeps the reserve proportionate — a quarter of the
|
|
376
|
+
* window is still real headroom for an answer, and it can never be the whole budget.
|
|
377
|
+
*
|
|
378
|
+
* This applies to the number nobody chose. A reserve the user configured is clamped by
|
|
379
|
+
* {@link MAX_EXPLICIT_RESERVE_FRACTION_OF_WINDOW} instead, and the reason is below.
|
|
380
|
+
*/
|
|
381
|
+
export const MAX_RESERVE_FRACTION_OF_WINDOW = 0.25;
|
|
382
|
+
/**
|
|
383
|
+
* EXT-160 — the largest fraction of the window a **configured** reserve is allowed to claim.
|
|
384
|
+
*
|
|
385
|
+
* A user who sets `llm.numPredict` has named an answer budget, which the default has not, so
|
|
386
|
+
* clamping it to a quarter of the window silently gives them less than they asked for and then
|
|
387
|
+
* truncates the answer — the exact failure the reserve exists to prevent, reintroduced by the fix
|
|
388
|
+
* for a different one. Measured: at `numCtx: 16384` with `numPredict: 8192`, a quarter-clamp holds
|
|
389
|
+
* back 4096, the guard sees 16140 against 16384 and passes the turn, and the answer is then short
|
|
390
|
+
* by 3852 tokens.
|
|
391
|
+
*
|
|
392
|
+
* **A configured number can still be reduced, and this is where.** Above half the window it is cut
|
|
393
|
+
* to half, because a reserve larger than that leaves less room for the conversation than for the
|
|
394
|
+
* answer, and at that point no conversation fits and the guard would fold on every turn — the
|
|
395
|
+
* thrashing the default clamp exists to stop. So: honoured up to half the window, reduced beyond
|
|
396
|
+
* it.
|
|
397
|
+
*/
|
|
398
|
+
export const MAX_EXPLICIT_RESERVE_FRACTION_OF_WINDOW = 0.5;
|
|
399
|
+
/**
|
|
400
|
+
* EXT-160 — the answer reserve actually applied to a given window: the requested number, clamped to
|
|
401
|
+
* a fraction of the window that depends on **who chose it** (a quarter for the default, half for a
|
|
402
|
+
* number the user configured — see the two constants above).
|
|
403
|
+
*
|
|
404
|
+
* EXT-161 pulled it out of the hook because the preventive threshold's default is defined as
|
|
405
|
+
* `window − this`, and {@link AutocompactController} has to be able to compute the same number the
|
|
406
|
+
* guard would. Two copies of this arithmetic is exactly how `/status` would come to advertise a
|
|
407
|
+
* threshold the guard does not enforce.
|
|
408
|
+
*/
|
|
409
|
+
export function effectiveOutputReserve(window, reserve, reserveWasConfigured) {
|
|
410
|
+
const fraction = reserveWasConfigured
|
|
411
|
+
? MAX_EXPLICIT_RESERVE_FRACTION_OF_WINDOW
|
|
412
|
+
: MAX_RESERVE_FRACTION_OF_WINDOW;
|
|
413
|
+
return Math.min(reserve, Math.floor(window * fraction));
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* EXT-161 — the prompt size at which a conversation is folded when the user named no threshold:
|
|
417
|
+
* the window, less the room held back for the answer.
|
|
418
|
+
*
|
|
419
|
+
* This is EXT-160's original trigger condition rearranged, not a new one — `estimate + reserve >
|
|
420
|
+
* window` and `estimate > window − reserve` are the same inequality — so the default path behaves
|
|
421
|
+
* exactly as it did before a threshold could be configured.
|
|
422
|
+
*/
|
|
423
|
+
export function defaultCompactionThreshold(window, reserve, reserveWasConfigured) {
|
|
424
|
+
return window - effectiveOutputReserve(window, reserve, reserveWasConfigured);
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* EXT-160 — **an estimate, and it says so in its name.**
|
|
428
|
+
*
|
|
429
|
+
* Ollama exposes no tokenizer over its API, so there is no way to count the prompt exactly before
|
|
430
|
+
* sending it. Rather than guess from characters alone, this anchors on the last REAL number the
|
|
431
|
+
* provider gave us: `usage_metadata.input_tokens` on the most recent `AIMessage` (ChatOllama maps
|
|
432
|
+
* ollama's `prompt_eval_count` into it), which is exactly the token count of everything that
|
|
433
|
+
* preceded that message — system prompt included. Only what has arrived SINCE the anchor is
|
|
434
|
+
* extrapolated from characters, so the guessed fraction shrinks as the conversation grows, which is
|
|
435
|
+
* precisely when the number starts to matter.
|
|
436
|
+
*
|
|
437
|
+
* With no anchor (the first call of a session) everything is extrapolated, and the system prompt's
|
|
438
|
+
* characters are added because nothing has measured them yet. With an anchor they are already
|
|
439
|
+
* inside the anchor's count and adding them again would double-count the single largest block.
|
|
440
|
+
*/
|
|
441
|
+
/**
|
|
442
|
+
* EXT-160 — the characters `conversationSize` cannot see, added back.
|
|
443
|
+
*
|
|
444
|
+
* `conversationSize` reads message content through `compaction.ts`'s `contentText`, which keeps a
|
|
445
|
+
* string block and a block with a string `text` field and returns `''` for everything else. That is
|
|
446
|
+
* right for compaction, whose before/after comparison only has to agree with itself, but it is
|
|
447
|
+
* wrong for a token estimate: an image block or a structured MCP tool result would contribute zero
|
|
448
|
+
* characters, so the guard would under-count precisely the payload most likely to fill the window.
|
|
449
|
+
*
|
|
450
|
+
* That is the UNSAFE direction, and it is the only approximation the estimator errs that way — every
|
|
451
|
+
* other one deliberately reads high.
|
|
452
|
+
*
|
|
453
|
+
* **What is counted is the block MINUS its `text`, capped.** Both halves matter:
|
|
454
|
+
*
|
|
455
|
+
* - Removing `text` is what stops a block from being counted twice, since `contentText` already
|
|
456
|
+
* returned it. It also closes the gap the mirror-the-skip-conditions version left: a block
|
|
457
|
+
* carrying BOTH a `text` field and a payload used to be skipped whole, so `contentText` counted
|
|
458
|
+
* its text and its payload was free. That is the under-count this function exists to fix,
|
|
459
|
+
* surviving inside the fix.
|
|
460
|
+
* - Capping at {@link NON_TEXT_BLOCK_CHARACTER_ALLOWANCE} is what stops the opposite failure: an
|
|
461
|
+
* encoded payload's LENGTH is not its cost, and charging it in full over-counts an inline image by
|
|
462
|
+
* enough to fold the conversation on every turn. That constant carries the reasoning.
|
|
463
|
+
*
|
|
464
|
+
* A residual at or below {@link BLOCK_STRUCTURE_FLOOR_CHARACTERS} is a type discriminator rather
|
|
465
|
+
* than a payload and is not charged.
|
|
466
|
+
*/
|
|
467
|
+
function nonTextBlockCharacters(messages) {
|
|
468
|
+
let total = 0;
|
|
469
|
+
for (const message of messages) {
|
|
470
|
+
const content = message.content;
|
|
471
|
+
if (!Array.isArray(content))
|
|
472
|
+
continue;
|
|
473
|
+
for (const block of content) {
|
|
474
|
+
// A bare string block is content `contentText` already returned in full.
|
|
475
|
+
if (typeof block === 'string')
|
|
476
|
+
continue;
|
|
477
|
+
if (!block || typeof block !== 'object')
|
|
478
|
+
continue;
|
|
479
|
+
let payload;
|
|
480
|
+
try {
|
|
481
|
+
const { text: _countedByContentText, ...rest } = block;
|
|
482
|
+
payload = JSON.stringify(typeof block.text === 'string' ? rest : block);
|
|
483
|
+
}
|
|
484
|
+
catch {
|
|
485
|
+
/* a block that cannot be serialised is left uncounted rather than crashing the estimate */
|
|
486
|
+
continue;
|
|
487
|
+
}
|
|
488
|
+
const length = payload?.length ?? 0;
|
|
489
|
+
if (length <= BLOCK_STRUCTURE_FLOOR_CHARACTERS)
|
|
490
|
+
continue;
|
|
491
|
+
total += Math.min(length, NON_TEXT_BLOCK_CHARACTER_ALLOWANCE);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
return total;
|
|
495
|
+
}
|
|
496
|
+
export function estimatePromptTokens(messages, systemPromptCharacters = 0) {
|
|
497
|
+
let anchorIndex = -1;
|
|
498
|
+
let anchorTokens = 0;
|
|
499
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
500
|
+
const message = messages[i];
|
|
501
|
+
if (!AIMessage.isInstance(message))
|
|
502
|
+
continue;
|
|
503
|
+
const input = message.usage_metadata?.input_tokens;
|
|
504
|
+
if (typeof input === 'number' && Number.isFinite(input) && input > 0) {
|
|
505
|
+
anchorIndex = i;
|
|
506
|
+
anchorTokens = input;
|
|
507
|
+
break;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
// From the anchor message onward: the anchor's own tokens covered everything BEFORE it, so the
|
|
511
|
+
// anchor message itself is part of the next prompt and is counted in the delta.
|
|
512
|
+
const counted = anchorIndex === -1 ? messages : messages.slice(anchorIndex);
|
|
513
|
+
const deltaCharacters = conversationSize(counted).characters +
|
|
514
|
+
nonTextBlockCharacters(counted) +
|
|
515
|
+
(anchorIndex === -1 ? systemPromptCharacters : 0);
|
|
516
|
+
const estimate = anchorTokens + deltaCharacters / ESTIMATE_CHARS_PER_TOKEN;
|
|
517
|
+
return Math.ceil(estimate * ESTIMATE_SAFETY_MARGIN);
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* EXT-160 — **the pre-call context guard: compact BEFORE the request, never after the damage.**
|
|
521
|
+
*
|
|
522
|
+
* Why a `beforeModel` middleware and not the runner's turn funnel: every model call inside a tool
|
|
523
|
+
* loop grows the context, and the runner only ever sees the turn boundary — so a turn that fits
|
|
524
|
+
* when it starts and overflows on its fourth tool round is invisible there. A `beforeModel` hook
|
|
525
|
+
* sees `state.messages` on every call, which is the only place this can be caught.
|
|
526
|
+
*
|
|
527
|
+
* **Pre-call means pre-call, and that is the whole point.** Ollama does not raise on overflow: the
|
|
528
|
+
* daemon silently drops the oldest tokens to fit `num_ctx` and answers happily from what is left,
|
|
529
|
+
* so there is no error, no stop reason, and nothing on the wire that differs from a healthy turn.
|
|
530
|
+
* By the time a response exists the evidence is gone — a check that ran after it could only ever
|
|
531
|
+
* confirm damage already done, and the damage is not a missing answer but a plausible one built on
|
|
532
|
+
* a conversation whose head was quietly discarded.
|
|
533
|
+
*
|
|
534
|
+
* **The loop hazard, and the bail that closes it.** The factory runs once per session, so like its
|
|
535
|
+
* two siblings above this hook holds NO state and recomputes everything from `state.messages`. That
|
|
536
|
+
* means a compaction which folds nothing would leave the state identical, the estimate identical,
|
|
537
|
+
* and this hook firing again on the next entry — forever. So `changed: false` **lets the call
|
|
538
|
+
* proceed**: a conversation already at its irreducible minimum is sent as it is and allowed to fail
|
|
539
|
+
* honestly (reactively compacted or reported), which is strictly better than a hang.
|
|
540
|
+
*
|
|
541
|
+
* The `compact` closure must call the model DIRECTLY, never through the graph, or the summariser's
|
|
542
|
+
* own call re-enters this hook.
|
|
543
|
+
*/
|
|
544
|
+
export function createContextGuardMiddleware(options) {
|
|
545
|
+
// Whether the caller named a reserve, kept separately from its value: the two are clamped
|
|
546
|
+
// differently, and `reserve === DEFAULT_OUTPUT_RESERVE_TOKENS` cannot tell "chose the default"
|
|
547
|
+
// from "said nothing".
|
|
548
|
+
const reserveWasConfigured = typeof options.reserve === 'number';
|
|
549
|
+
const reserve = options.reserve ?? DEFAULT_OUTPUT_RESERVE_TOKENS;
|
|
550
|
+
const systemPromptCharacters = options.systemPromptCharacters ?? (() => 0);
|
|
551
|
+
const estimateTokens = options.estimateTokens ?? estimatePromptTokens;
|
|
552
|
+
return createMiddleware({
|
|
553
|
+
name: 'GthContextGuard',
|
|
554
|
+
beforeModel: {
|
|
555
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
556
|
+
hook: async (state) => {
|
|
557
|
+
const messages = Array.isArray(state?.messages) ? state.messages : [];
|
|
558
|
+
if (messages.length === 0)
|
|
559
|
+
return undefined;
|
|
560
|
+
let window = null;
|
|
561
|
+
try {
|
|
562
|
+
window = await options.windowSource();
|
|
563
|
+
}
|
|
564
|
+
catch {
|
|
565
|
+
/* a source that failed knows nothing, which is already the no-trigger answer */
|
|
566
|
+
}
|
|
567
|
+
const hasWindow = window !== null && Number.isFinite(window) && window > 0;
|
|
568
|
+
// **ONE trigger point, however it was decided.** EXT-161 lets the session or the config
|
|
569
|
+
// name it; absent both, it is the window less the answer reserve — EXT-160's original
|
|
570
|
+
// condition rearranged, not a second notion of "full". A guard that compared the estimate
|
|
571
|
+
// against a configured threshold AND against the window would hold two ideas of full that
|
|
572
|
+
// could disagree, which is the silently-wrong-threshold failure this feature exists to end.
|
|
573
|
+
let threshold = null;
|
|
574
|
+
if (options.thresholdSource) {
|
|
575
|
+
try {
|
|
576
|
+
threshold = await options.thresholdSource();
|
|
577
|
+
}
|
|
578
|
+
catch {
|
|
579
|
+
// A threshold that could not be resolved is not a threshold of zero; fall through to
|
|
580
|
+
// "nothing fires" and let the reactive seam catch an overflow if one comes.
|
|
581
|
+
threshold = null;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
else if (hasWindow) {
|
|
585
|
+
threshold = defaultCompactionThreshold(window, reserve, reserveWasConfigured);
|
|
586
|
+
}
|
|
587
|
+
// The 4097 case: an unknown window yields no guard, never a guess. It reaches here as a
|
|
588
|
+
// null threshold, because nothing downstream of an unknown window can name a number.
|
|
589
|
+
if (threshold === null || !Number.isFinite(threshold) || threshold <= 0)
|
|
590
|
+
return undefined;
|
|
591
|
+
const estimate = estimateTokens(messages, systemPromptCharacters());
|
|
592
|
+
if (estimate <= threshold)
|
|
593
|
+
return undefined;
|
|
594
|
+
debugLog(`Context guard: estimated ${estimate} prompt tokens exceeds the ${threshold}-token ` +
|
|
595
|
+
`compaction threshold${hasWindow ? ` of a ${window}-token window` : ''}; compacting ` +
|
|
596
|
+
`before the call.`);
|
|
597
|
+
let result;
|
|
598
|
+
try {
|
|
599
|
+
result = await options.compact(messages);
|
|
600
|
+
}
|
|
601
|
+
catch (error) {
|
|
602
|
+
// A compaction that could not get a summary leaves the conversation alone and says so.
|
|
603
|
+
// Proceeding is right: the request may still succeed, and on a provider that throws, the
|
|
604
|
+
// reactive seam gets its turn.
|
|
605
|
+
debugLog(`Context guard: compaction failed, sending the request as it is: ${error instanceof Error ? error.message : String(error)}`);
|
|
606
|
+
return undefined;
|
|
607
|
+
}
|
|
608
|
+
if (!result.changed)
|
|
609
|
+
return undefined;
|
|
610
|
+
// EXT-161 — a feature nobody opted into must be able to say what it did, so the notice
|
|
611
|
+
// names the estimate, the threshold that was crossed and the window it came from.
|
|
612
|
+
options.onCompact?.(`Context is nearly full (about ${estimate} tokens, past the ${threshold}-token ` +
|
|
613
|
+
`compaction threshold${hasWindow ? ` for this model's ${window}-token window` : ''}), ` +
|
|
614
|
+
`so ${result.removedCount} earlier messages were folded into a summary before this ` +
|
|
615
|
+
`call. ${result.keptCount} kept verbatim.`);
|
|
616
|
+
// The same write shape GS2-23 uses: discard everything, keep what follows.
|
|
617
|
+
return {
|
|
618
|
+
messages: [new RemoveMessage({ id: REMOVE_ALL_MESSAGES }), ...result.messages],
|
|
619
|
+
};
|
|
620
|
+
},
|
|
621
|
+
},
|
|
622
|
+
});
|
|
623
|
+
}
|
|
298
624
|
/**
|
|
299
625
|
* Lean agent: builds a standard `createAgent` (ReAct) graph. All run/stream/event
|
|
300
626
|
* plumbing lives in {@link GthAbstractAgent}; this class only knows how to construct
|
|
@@ -321,8 +647,12 @@ export class GthLangChainAgent extends GthAbstractAgent {
|
|
|
321
647
|
// `debug` rung's preamble, and `none` silences both.
|
|
322
648
|
this.compactHeaderStatus();
|
|
323
649
|
this.headerStatus(`Workdir: ${getCurrentWorkDir()}`);
|
|
650
|
+
// CFG-38 — the `debug` rung's own `Model:` line, beside the `compact` rung's run header, which
|
|
651
|
+
// has carried the provider since GS2-95. The label is the shared `model (provider)` spelling,
|
|
652
|
+
// and the guard on `modelDisplayName` is unchanged, so a run with no model prints no line at
|
|
653
|
+
// all rather than a bare provider under a `Model:` label.
|
|
324
654
|
if (this.config.modelDisplayName) {
|
|
325
|
-
this.headerStatus(`Model: ${this.config.modelDisplayName}`);
|
|
655
|
+
this.headerStatus(`Model: ${modelProviderLabel(this.config.modelDisplayName, this.config.modelProviderType)}`);
|
|
326
656
|
}
|
|
327
657
|
// An empty allowedTools allow-list disables every tool. Skip resolution entirely so we
|
|
328
658
|
// don't contact MCP servers (and trigger OAuth) just to discard the result.
|
|
@@ -578,6 +908,57 @@ export class GthLangChainAgent extends GthAbstractAgent {
|
|
|
578
908
|
// [[EXT-159]] — HALT ends the run, so it owes a reason; WARN does not end anything and sets
|
|
579
909
|
// none.
|
|
580
910
|
(reason) => this.noteTermination(reason));
|
|
911
|
+
// EXT-160: the PRE-CALL context guard. Installed UNCONDITIONALLY, and inert on every provider
|
|
912
|
+
// no window source is wired for — `resolveContextWindowSource` answers `null` there, and a null
|
|
913
|
+
// window never triggers. Wiring it that way rather than behind an `if (provider === 'ollama')`
|
|
914
|
+
// is what makes "unknown window ⇒ no compaction" the production default for nine of ten
|
|
915
|
+
// providers instead of a path only a test ever walks, and leaves [[EXT-161]] a pure addition in
|
|
916
|
+
// one file.
|
|
917
|
+
//
|
|
918
|
+
// The summariser is bound DIRECTLY to the session model — `createModelSummarizer` calls
|
|
919
|
+
// `model.invoke`, not the graph — because a summary routed through the graph would re-enter
|
|
920
|
+
// this same `beforeModel` hook. The system prompt is read through a closure because the
|
|
921
|
+
// middleware array below is assembled before the prompt is composed further down.
|
|
922
|
+
let systemPromptCharacters = 0;
|
|
923
|
+
const sessionModel = this.config.llm;
|
|
924
|
+
// The output headroom the user actually configured, when they configured one: on ollama
|
|
925
|
+
// `num_predict` caps the generation, so it is the true answer budget and a better number than
|
|
926
|
+
// any default. Absent, the default stands.
|
|
927
|
+
//
|
|
928
|
+
// Both are clamped to a fraction of the window — that is what stops a small `num_ctx` reserving
|
|
929
|
+
// its whole budget — but not to the SAME fraction, and the difference is deliberate: a number
|
|
930
|
+
// the user set is honoured up to half the window, the default only to a quarter. So a
|
|
931
|
+
// configured `numPredict` can still be reduced, and above half the window it is.
|
|
932
|
+
const configuredNumPredict = sessionModel?.numPredict;
|
|
933
|
+
const reserveWasConfigured = typeof configuredNumPredict === 'number' && configuredNumPredict > 0;
|
|
934
|
+
const guardReserve = reserveWasConfigured
|
|
935
|
+
? configuredNumPredict
|
|
936
|
+
: DEFAULT_OUTPUT_RESERVE_TOKENS;
|
|
937
|
+
// EXT-161 — ONE window resolution for the whole session, read two ways: the guard takes the
|
|
938
|
+
// bare number before every model call, `/status` takes the same number with its provenance.
|
|
939
|
+
// Built from the CONFIGURED provider namespace rather than the model class's `_llmType()`,
|
|
940
|
+
// which reports `openai` for huggingface and `google` for both Gemini providers and would
|
|
941
|
+
// therefore read the wrong models.dev slice or none at all.
|
|
942
|
+
const resolvedWindow = resolveContextWindow(sessionModel, {
|
|
943
|
+
providerId: this.config.modelProviderType,
|
|
944
|
+
modelId: sessionModel?.model ?? this.config.modelDisplayName,
|
|
945
|
+
});
|
|
946
|
+
// The `autocompact` key, defaulted at the READ SITE (on by default — ruled), so an absent key
|
|
947
|
+
// stays absent in the effective-config snapshot.
|
|
948
|
+
this.autocompact = new AutocompactController({
|
|
949
|
+
config: resolveAutocompactConfig(this.config?.autocompact),
|
|
950
|
+
window: resolvedWindow,
|
|
951
|
+
defaultThreshold: (window) => defaultCompactionThreshold(window, guardReserve, reserveWasConfigured),
|
|
952
|
+
});
|
|
953
|
+
const autocompact = this.autocompact;
|
|
954
|
+
const contextGuard = createContextGuardMiddleware({
|
|
955
|
+
windowSource: resolvedWindow.source,
|
|
956
|
+
thresholdSource: () => autocompact.threshold(),
|
|
957
|
+
compact: (messages) => compactMessages({ messages, summarize: createModelSummarizer(sessionModel) }),
|
|
958
|
+
systemPromptCharacters: () => systemPromptCharacters,
|
|
959
|
+
...(reserveWasConfigured ? { reserve: configuredNumPredict } : {}),
|
|
960
|
+
onCompact: (message) => statusUpdate(StatusLevel.INFO, message),
|
|
961
|
+
});
|
|
581
962
|
// EXT-52: gate the opt-in run_shell_command tool behind the per-command approval interrupt —
|
|
582
963
|
// langchain's `humanInTheLoopMiddleware`. Without it,
|
|
583
964
|
// no interrupt ever fires, so the runner's whole approval stack
|
|
@@ -671,6 +1052,11 @@ export class GthLangChainAgent extends GthAbstractAgent {
|
|
|
671
1052
|
mcpToolErrorSoftening,
|
|
672
1053
|
toolErrorBudget,
|
|
673
1054
|
toolLoopGuard,
|
|
1055
|
+
// EXT-160: after the two guards and before user middleware. `beforeModel` hooks run forward
|
|
1056
|
+
// with `jumpTo` short-circuiting, so a run the error budget or the loop guard is about to end
|
|
1057
|
+
// never first pays for a summary call; and outboard of user middleware means it cannot be
|
|
1058
|
+
// bypassed, like its two siblings.
|
|
1059
|
+
contextGuard,
|
|
674
1060
|
...approvalMiddleware,
|
|
675
1061
|
...configuredMiddleware,
|
|
676
1062
|
toolCallStatusMiddleware,
|
|
@@ -734,6 +1120,10 @@ export class GthLangChainAgent extends GthAbstractAgent {
|
|
|
734
1120
|
? []
|
|
735
1121
|
: (this.resolvers?.getMcpServerInstructions?.() ?? []);
|
|
736
1122
|
const systemPrompt = appendMcpServerInstructionsNote(modelContextPrompt, mcpInstructions);
|
|
1123
|
+
// EXT-160: the guard above reads this through its closure. `createAgent` applies the system
|
|
1124
|
+
// prompt on every call without ever putting it in `state.messages`, so without this the guard
|
|
1125
|
+
// would under-count each request by its largest single block.
|
|
1126
|
+
systemPromptCharacters = systemPrompt?.length ?? 0;
|
|
737
1127
|
// Create agent with configured middleware. Only pass systemPrompt when non-empty so we never
|
|
738
1128
|
// hand createAgent an empty system message.
|
|
739
1129
|
this.agent = createAgent({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GthLangChainAgent.js","sourceRoot":"","sources":["../../src/core/GthLangChainAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,uBAAuB,EACvB,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAmC,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,0BAA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,UAAU,CACvB;YACH,CAAC,CAAC,gBAAgB,CAAC;QAEvB,gGAAgG;QAChG,8FAA8F;QAC9F,6FAA6F;QAC7F,0FAA0F;QAC1F,6FAA6F;QAC7F,gGAAgG;QAChG,0FAA0F;QAC1F,0BAA0B;QAC1B,MAAM,kBAAkB,GAAG,sBAAsB,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;QAElF,4FAA4F;QAC5F,0FAA0F;QAC1F,8FAA8F;QAC9F,+FAA+F;QAC/F,qFAAqF;QACrF,0FAA0F;QAC1F,sFAAsF;QACtF,mDAAmD;QACnD,MAAM,eAAe,GAAG,aAAa;YACnC,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,wBAAwB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QACzD,MAAM,YAAY,GAAG,+BAA+B,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC;QAC1F,4FAA4F;QAC5F,8FAA8F;QAC9F,8DAA8D;QAC9D,sBAAsB,GAAG,YAAY,EAAE,MAAM,IAAI,CAAC,CAAC;QAEnD,6FAA6F;QAC7F,4CAA4C;QAC5C,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC;YACvB,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG;YACtB,KAAK;YACL,UAAU;YACV,YAAY;YACZ,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1C,CAAC,CAAC;QACH,QAAQ,CAAC,kCAAkC,CAAC,CAAC;IAC/C,CAAC;CACF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
* GS2-20 — **a conversation keeps its approval grants, so a resumed one gets them back.**
|
|
4
|
+
*
|
|
5
|
+
* The ruling this implements: from the agent's side a resume must look as though no interruption
|
|
6
|
+
* happened, and that covers what the session may already do without asking, not only what it can
|
|
7
|
+
* remember. So the grants a person made at the escalation menu — *approve for the session*, *deny
|
|
8
|
+
* always* whose project write did not land — are written against the conversation in the history
|
|
9
|
+
* store and loaded again when the conversation is resumed.
|
|
10
|
+
*
|
|
11
|
+
* **State the widening plainly, because a widening nobody notices is the failure mode:** a grant's
|
|
12
|
+
* lifetime is the CONVERSATION, not the process. Under `history.enabled: false` nothing is stored,
|
|
13
|
+
* so a grant then lives exactly as long as the process — which is also how long the conversation
|
|
14
|
+
* can live, since it cannot be resumed.
|
|
15
|
+
*
|
|
16
|
+
* **Only session-scoped grants travel this way.** An `always` grant is already in the project's
|
|
17
|
+
* allow-list / deny-list file and comes back from there on every run; storing it here too would
|
|
18
|
+
* make one decision two records that could disagree. The declared config lists are never grants and
|
|
19
|
+
* are never here.
|
|
20
|
+
*
|
|
21
|
+
* The document is one JSON object per conversation, in the same grant shape the project files use
|
|
22
|
+
* and read by the same {@link readGrant}, so a malformed entry is skipped the same way in both.
|
|
23
|
+
*/
|
|
24
|
+
import type { HistoryConfigView } from '#src/history/historyEnabled.js';
|
|
25
|
+
import { type ApprovalGrant } from '#src/core/approvals/grants.js';
|
|
26
|
+
/** The session-scoped grants of one conversation: what it may run unasked, and what it refuses. */
|
|
27
|
+
export interface ConversationGrants {
|
|
28
|
+
/** Escalation-menu approvals — `[s]ession`, and an `[a]lways` whose file write did not land. */
|
|
29
|
+
allow: ApprovalGrant[];
|
|
30
|
+
/** Escalation-menu refusals — a `[d]eny always` whose file write did not land. */
|
|
31
|
+
deny: ApprovalGrant[];
|
|
32
|
+
}
|
|
33
|
+
/** A document with nothing in it, which is also what an absent or unreadable one reads as. */
|
|
34
|
+
export declare const NO_CONVERSATION_GRANTS: Readonly<ConversationGrants>;
|
|
35
|
+
/**
|
|
36
|
+
* Serialise the grants for storage. `null` when there is nothing to store, so a conversation that
|
|
37
|
+
* never granted anything keeps a NULL column rather than an empty document.
|
|
38
|
+
*/
|
|
39
|
+
export declare function encodeConversationGrants(grants: ConversationGrants): string | null;
|
|
40
|
+
/**
|
|
41
|
+
* Parse a stored document. Anything that is not a readable v1 document — corrupt JSON, another
|
|
42
|
+
* shape, a future version — reads as no grants: a resume that cannot read them costs a re-prompt,
|
|
43
|
+
* never a grant the person did not make. A malformed entry inside a readable document is skipped
|
|
44
|
+
* on its own ({@link readGrant}), and every stored scope is forced back to `session`: that is the
|
|
45
|
+
* only scope this document holds, and a file that claimed otherwise would be describing the project
|
|
46
|
+
* store, which is not consulted here.
|
|
47
|
+
*/
|
|
48
|
+
export declare function decodeConversationGrants(json: string | null): ConversationGrants;
|
|
49
|
+
/**
|
|
50
|
+
* Load the grants a conversation had, for a resume to restore. Empty when history is off, the
|
|
51
|
+
* store cannot be opened, the conversation has none, or the document cannot be read. Never throws.
|
|
52
|
+
*/
|
|
53
|
+
export declare function loadConversationGrantsSafe(config: HistoryConfigView, conversationId: number): ConversationGrants;
|
|
54
|
+
/**
|
|
55
|
+
* Store the grants a conversation has now. Called by the session on every change to the runner's
|
|
56
|
+
* session-scoped grants, so the row is always the current set. A `conversationId` of `undefined`
|
|
57
|
+
* (history off, or the row could not be opened) is a no-op — there is nowhere to write, and that is
|
|
58
|
+
* the case where a grant correctly ends with the process. Never throws.
|
|
59
|
+
*/
|
|
60
|
+
export declare function saveConversationGrantsSafe(config: HistoryConfigView, conversationId: number | undefined, grants: ConversationGrants): void;
|