@gaunt-sloth/core 2.0.0-beta.2 → 2.0.0-beta.4

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.
Files changed (65) hide show
  1. package/dist/config/shell-policy.d.ts +2 -2
  2. package/dist/config/shell-policy.js +3 -3
  3. package/dist/config/tool-descriptions.d.ts +5 -5
  4. package/dist/config/tool-descriptions.js +3 -3
  5. package/dist/core/GthAbstractAgent.d.ts +67 -1
  6. package/dist/core/GthAbstractAgent.js +248 -4
  7. package/dist/core/GthAbstractAgent.js.map +1 -1
  8. package/dist/core/GthAgentRunner.d.ts +91 -10
  9. package/dist/core/GthAgentRunner.js +327 -21
  10. package/dist/core/GthAgentRunner.js.map +1 -1
  11. package/dist/core/GthLangChainAgent.d.ts +3 -2
  12. package/dist/core/GthLangChainAgent.js +25 -5
  13. package/dist/core/GthLangChainAgent.js.map +1 -1
  14. package/dist/core/reasoningBlocks.d.ts +4 -6
  15. package/dist/core/reasoningBlocks.js +4 -6
  16. package/dist/core/reasoningBlocks.js.map +1 -1
  17. package/dist/core/refusal.d.ts +54 -1
  18. package/dist/core/refusal.js +109 -1
  19. package/dist/core/refusal.js.map +1 -1
  20. package/dist/core/shell/ShellCommandFailedError.d.ts +4 -4
  21. package/dist/core/shell/ShellCommandFailedError.js +4 -4
  22. package/dist/core/shell/openWorld.d.ts +4 -3
  23. package/dist/core/shell/openWorld.js +4 -3
  24. package/dist/core/shell/openWorld.js.map +1 -1
  25. package/dist/core/terminationNotice.d.ts +111 -0
  26. package/dist/core/terminationNotice.js +209 -0
  27. package/dist/core/terminationNotice.js.map +1 -0
  28. package/dist/core/terminationReason.d.ts +271 -0
  29. package/dist/core/terminationReason.js +405 -0
  30. package/dist/core/terminationReason.js.map +1 -0
  31. package/dist/core/toolDisplay.d.ts +49 -2
  32. package/dist/core/toolDisplay.js +137 -19
  33. package/dist/core/toolDisplay.js.map +1 -1
  34. package/dist/core/types.d.ts +33 -6
  35. package/dist/core/types.js.map +1 -1
  36. package/dist/providers/geminiSchemaSanitizer.d.ts +2 -2
  37. package/dist/providers/geminiSchemaSanitizer.js +2 -2
  38. package/dist/providers/geminiThinking.d.ts +10 -5
  39. package/dist/providers/geminiThinking.js +10 -5
  40. package/dist/providers/geminiThinking.js.map +1 -1
  41. package/dist/runtime/askStructured.d.ts +22 -0
  42. package/dist/runtime/askStructured.js +53 -0
  43. package/dist/runtime/askStructured.js.map +1 -1
  44. package/dist/runtime/conversation.d.ts +11 -0
  45. package/dist/runtime/conversation.js +13 -1
  46. package/dist/runtime/conversation.js.map +1 -1
  47. package/dist/runtime/singleShot.d.ts +11 -0
  48. package/dist/runtime/singleShot.js +21 -1
  49. package/dist/runtime/singleShot.js.map +1 -1
  50. package/dist/utils/aiignoreUtils.d.ts +6 -0
  51. package/dist/utils/aiignoreUtils.js +69 -1
  52. package/dist/utils/aiignoreUtils.js.map +1 -1
  53. package/dist/utils/debugDump.d.ts +54 -0
  54. package/dist/utils/debugDump.js +32 -0
  55. package/dist/utils/debugDump.js.map +1 -1
  56. package/dist/utils/displayWidth.d.ts +10 -5
  57. package/dist/utils/displayWidth.js +148 -54
  58. package/dist/utils/displayWidth.js.map +1 -1
  59. package/dist/utils/llmUtils.d.ts +1 -1
  60. package/dist/utils/llmUtils.js +1 -1
  61. package/dist/utils/systemPromptNotes.d.ts +3 -3
  62. package/dist/utils/systemPromptNotes.js +3 -3
  63. package/dist/utils/vertexaiUtils.js +100 -1
  64. package/dist/utils/vertexaiUtils.js.map +1 -1
  65. package/package.json +4 -3
@@ -23,10 +23,18 @@
23
23
  * - **Secret redaction reuses the GS2-47 `redactSecrets` lineage** (literal env/config secrets +
24
24
  * provider key patterns) — no new redactor. Applied to the params summary and every
25
25
  * preview/body line, fail-safe (redact MORE on any error, never leak).
26
+ * - **Untrusted text is NEUTRALISED before it can reach a terminal** ([[TUI-C102]]). A tool
27
+ * result is a file's bytes, a fetched page, an MCP server's response or a command's stdout,
28
+ * and a string is not inert on a terminal: SGR colour plus cursor positioning lets it paint
29
+ * something shaped like gsloth's own approval prompt a few rows from the real one. Every
30
+ * rendered line AND the params summary go through {@link neutralizeUntrustedText} — the same
31
+ * neutraliser `core/shell/framing` gives the approval dialog and the attack banner, reused
32
+ * rather than reimplemented so the two paths cannot come to disagree about what is inert.
26
33
  * - **`write_file`/`edit_file` render the change as a diff derived from the tool's ARGS**
27
34
  * (added = `added` style/green, removed = `removed` style/red); monochrome keeps the `+`/`-`
28
35
  * prefixes so the diff still reads without colour (DL-7 graceful degradation).
29
36
  */
37
+ import { neutralizeToOneLine, neutralizeUntrustedText } from '#src/core/shell/framing.js';
30
38
  import { displayWidth, sliceToWidth } from '#src/utils/displayWidth.js';
31
39
  import { collectSecretValues, redactText } from '#src/utils/redactSecrets.js';
32
40
  import { env } from '#src/utils/systemUtils.js';
@@ -146,10 +154,6 @@ export function resetToolDisplaySecretsCacheForTests() {
146
154
  cachedSecrets = null;
147
155
  displayConfig = undefined;
148
156
  }
149
- /** Collapse whitespace runs (incl. newlines) so a value stays a one-line token. */
150
- function inline(value) {
151
- return value.replace(/\s+/g, ' ').trim();
152
- }
153
157
  /**
154
158
  * Truncate to `max` terminal COLUMNS with the {@link ELLIPSIS} marker, reserving the marker's own
155
159
  * width out of the budget. Slicing goes through the shared width primitive: a code-point count
@@ -168,14 +172,22 @@ function truncate(value, max) {
168
172
  return sliceToWidth(value, max - ELLIPSIS_WIDTH) + ELLIPSIS;
169
173
  }
170
174
  /**
171
- * Render one arg value for the summary: strings inline+truncated, the rest JSON-ish.
175
+ * Render one arg value for the summary: strings neutralised onto one line + truncated, the rest
176
+ * JSON-ish.
177
+ *
178
+ * ORDER MATTERS (fix-cycle-1 finding, extended by [[TUI-C102]]): **redaction runs BEFORE any
179
+ * transformation.** Truncating first would bisect a literal secret longer than the value cap so it
180
+ * no longer literal-matches — its head would render in the call summary on both surfaces (a
181
+ * partial leak); whitespace-collapsing first could likewise alter a literal out of matching; and
182
+ * **neutralising first breaks the same match**, since a secret whose literal carries a control
183
+ * character stops matching the moment that character is rewritten to `\x0b`. So: redact the RAW
184
+ * text, then neutralise onto one line, then truncate (`<redacted>` contains no whitespace, no
185
+ * control characters and is shorter than the cap, so the later steps can never damage the marker).
172
186
  *
173
- * ORDER MATTERS (fix-cycle-1 finding): redaction runs BEFORE any transformation. Truncating
174
- * first would bisect a literal secret longer than the value cap so it no longer
175
- * literal-matches its head would render in the call summary on both surfaces (a partial
176
- * leak); whitespace-collapsing first could likewise alter a literal out of matching. So:
177
- * redact the RAW text, then inline, then truncate (`<redacted>` contains no whitespace and is
178
- * shorter than the cap, so the later steps can never damage the marker).
187
+ * {@link neutralizeToOneLine} is the approval dialog's own helper and does the whitespace collapse
188
+ * this used to do locally deliberately reused, because a private collapse was exactly how this
189
+ * path came to look tidy while an ESC walked through it: JavaScript's `\s` covers LF, CR and TAB
190
+ * but not ESC, BEL, the C1 range or the bidi overrides.
179
191
  */
180
192
  function formatParamValue(value, secrets) {
181
193
  let text;
@@ -193,11 +205,27 @@ function formatParamValue(value, secrets) {
193
205
  text = String(value);
194
206
  }
195
207
  }
196
- return truncate(inline(redactText(text, secrets)), TOOL_PARAM_VALUE_MAX_CHARS);
208
+ return truncate(neutralizeToOneLine(redactText(text, secrets)), TOOL_PARAM_VALUE_MAX_CHARS);
197
209
  }
198
- /** Split into lines, dropping a single trailing newline's phantom empty last element. */
210
+ /**
211
+ * Split untrusted text into the lines the body renders, dropping a single trailing newline's
212
+ * phantom empty last element.
213
+ *
214
+ * `\r\n` is ONE break, because that is what a Windows-authored file means by it. A **lone** `\r`
215
+ * is deliberately NOT a break: it is left for {@link neutralizeUntrustedText} to make visible as
216
+ * `\x0d`, since a bare carriage return is the cursor-to-column-0 overwrite trick far more often
217
+ * than it is a line ending, and turning it into a break would hide that it was ever there.
218
+ *
219
+ * That rule is `splitLogicalLines` in `core/shell/framing`, matched deliberately rather than
220
+ * re-decided here. The approval dialog splits the command it frames exactly this way, and this
221
+ * node exists because the tool path and the approval path had come to disagree about what is
222
+ * inert; a splitter that differed would re-open that divergence one layer down. It weakens
223
+ * nothing — the attack is the lone `\r`, which still reaches the neutraliser — while the pair
224
+ * every terminal already draws as one break stops putting a visible `\x0d` on the end of every
225
+ * line of every CRLF-authored file, which is one of the commonest things this product reads.
226
+ */
199
227
  function toLines(text) {
200
- const lines = text.split('\n');
228
+ const lines = text.replace(/\r\n/gu, '\n').split('\n');
201
229
  if (lines.length > 1 && lines[lines.length - 1] === '')
202
230
  lines.pop();
203
231
  return lines;
@@ -359,6 +387,10 @@ const TOOL_DISPLAY_REGISTRY = {
359
387
  },
360
388
  run_lint: { glyph: SHELL_GLYPH, formatBody: formatShellBody, shellShaped: true },
361
389
  run_build: { glyph: SHELL_GLYPH, formatBody: formatShellBody, shellShaped: true },
390
+ // Dormant, deliberately: the `task` tool went with the deepagents runtime (EXT-114), and nothing
391
+ // emits one until GS2-25 lands the lean subagent primitive. Kept rather than swept because an
392
+ // unregistered name falls back to the generic glyph, so an unused row renders nothing and says
393
+ // nothing to anyone until a producer returns.
362
394
  task: { glyph: '🤖', summariseArgs: ['subagent_type', 'description'] },
363
395
  };
364
396
  /** The registry glyph for a tool name (generic `⚙` when unknown). */
@@ -386,7 +418,16 @@ export function summariseToolCall(name, argsText, secrets = getDefaultSecrets())
386
418
  const args = parseToolArgsSafe(argsText);
387
419
  if (args === null) {
388
420
  const hasRawArgs = !!argsText && argsText.trim().length > 0 && argsText.trim() !== '{}';
389
- return hasRawArgs ? `${label}(${ELLIPSIS})` : `${label}()`;
421
+ // [[TUI-C102]] THIS RETURN RUNS THE SAME PASS AS THE ONE AT THE END, and it is the branch
422
+ // taken most often: a partially streamed args buffer does not parse, so every frame between
423
+ // `tool_start` (which supplies the name) and the final `tool_args` delta renders here, and a
424
+ // call whose args never become valid JSON renders here permanently. What it paints is the
425
+ // tool NAME, which is not ours — an MCP server names its own tools, and under prompt
426
+ // injection the model chooses what to stream. Returning it untreated put raw ANSI on the row
427
+ // [[TUI-C99]] turns into the approval row. Redact first, then neutralise, for the reason
428
+ // spelled out at the main return below; the ellipsis and the `(tool)` fallback are module
429
+ // constants and hold nothing either step can act on.
430
+ return neutralizeUntrustedText(redactText(hasRawArgs ? `${label}(${ELLIPSIS})` : `${label}()`, secrets));
390
431
  }
391
432
  const entry = TOOL_DISPLAY_REGISTRY[name];
392
433
  const keys = entry?.summariseArgs !== undefined
@@ -401,7 +442,13 @@ export function summariseToolCall(name, argsText, secrets = getDefaultSecrets())
401
442
  // Redact before the whole-summary cap too, so this truncation can no more bisect a secret
402
443
  // out of literal-matching than the per-value one can.
403
444
  const inner = truncate(redactText(parts.join(', '), secrets), TOOL_SUMMARY_MAX_CHARS);
404
- return redactText(`${label}(${inner})`, secrets);
445
+ // [[TUI-C102]] — the values were neutralised one by one above (each needed it before its own
446
+ // width budget could mean anything); this last pass covers the two strings that never went
447
+ // through {@link formatParamValue}: the tool NAME and the arg KEYS. Neither is ours — an MCP
448
+ // server names its own tools, and an unregistered tool's keys are whatever the model streamed.
449
+ // Idempotent over the values, whose escape alphabet (`\`, `x`, `u`, `{`, `}`, hex) holds nothing
450
+ // for it to rewrite.
451
+ return neutralizeUntrustedText(redactText(`${label}(${inner})`, secrets));
405
452
  }
406
453
  /* ------------------------------------------------------------------------- *
407
454
  * Body + preview *
@@ -409,8 +456,8 @@ export function summariseToolCall(name, argsText, secrets = getDefaultSecrets())
409
456
  /**
410
457
  * The FULL (uncapped) body lines for a call: the registry formatter when one applies, else the
411
458
  * shape-based shell formatter, else the generic fallback (live output lines, then the final
412
- * result — both dim). Every line is secret-redacted. Used by the TUI's EXPANDED panel; cap it
413
- * with {@link capToolDisplayLines} for the collapsed preview.
459
+ * result — both dim). Every line is secret-redacted and then neutralised. Used by the TUI's
460
+ * EXPANDED panel; cap it with {@link capToolDisplayLines} for the collapsed preview.
414
461
  */
415
462
  export function buildToolBodyLines(input, secrets = getDefaultSecrets()) {
416
463
  const args = parseToolArgsSafe(input.argsText);
@@ -430,13 +477,84 @@ export function buildToolBodyLines(input, secrets = getDefaultSecrets()) {
430
477
  lines.push(...styled(toLines(input.result), 'dim'));
431
478
  }
432
479
  }
433
- return lines.map((l) => ({ ...l, text: redactText(l.text, secrets) }));
480
+ // [[TUI-C102]] THE ORDER OF THESE TWO STEPS, AND OF THE CAP THAT FOLLOWS THEM, IS LOAD-BEARING.
481
+ //
482
+ // 1. REDACT the raw text. A secret literal that carries a control character stops matching the
483
+ // moment that character is rewritten to `\x0b`, so neutralising first would leave the secret
484
+ // on the screen — the same argument {@link formatParamValue} makes about truncating first.
485
+ // 2. NEUTRALISE what redaction returns, so nothing downstream ever holds an escape.
486
+ // 3. CAP last ({@link capToolDisplayLines}, via {@link buildToolPreviewLines}). A neutralised
487
+ // line is WIDER than the raw one — `\x1b[2J` is 8 printable columns where the sequence was 0
488
+ // — and the cap measures a line by what it RENDERS as. Because the escapes are already gone
489
+ // when it looks, the width it measures and the text it slices are the same string. Capping
490
+ // first would measure the raw line, discount escapes that the neutralised text no longer
491
+ // has, and hand back a row that over-runs the terminal it is drawn on.
492
+ //
493
+ // INVARIANT this step relies on: **a line arriving here holds no `\n`.** Neutralisation would
494
+ // rewrite one to a literal `\x0a` and silently collapse multi-line output onto a single row.
495
+ // Every producer was checked: the generic fallback, {@link formatShellBody},
496
+ // {@link formatWriteFileBody} and {@link formatEditFileBody} all split through {@link toLines},
497
+ // and {@link TOOL_DISPLAY_REGISTRY} is module-private, so there is no third-party `formatBody`.
498
+ // A new formatter must split its own output rather than return an embedded newline.
499
+ //
500
+ // OUT OF SCOPE, deliberately: `/debug-dump` (GS2-46) stays an UNSANITIZED archive. Neutralising
501
+ // is about what a TERMINAL does with a string; a dump is written to a file, is read with tools
502
+ // that render bytes as bytes, and exists to reproduce a failure — escaping its contents would
503
+ // destroy the evidence it is collected for. It is redacted for secrets, which is the property
504
+ // that actually travels with a file someone may attach to an issue.
505
+ return lines.map((l) => ({
506
+ ...l,
507
+ text: neutralizeUntrustedText(redactText(l.text, secrets)),
508
+ }));
509
+ }
510
+ /**
511
+ * [[TUI-C102]] — the two untrusted strings the EXPANDED tool panel paints OUTSIDE the body: the
512
+ * raw streamed args text and the routed "🔧 Executing …" notice. Neither passes through
513
+ * {@link buildToolBodyLines}, and neither is ours: `argsText` is whatever the model streamed —
514
+ * under prompt injection, attacker-chosen, and for a shell call it is the command itself — and a
515
+ * notice quotes that same command back. Under [[TUI-C99]] this expansion is the route by which a
516
+ * human inspects a call they are being asked to permit, so it gets the treatment the rest of the
517
+ * display path already has.
518
+ *
519
+ * **Both the renderer and the row-count oracle must call this, on the same input.** Neutralised
520
+ * text is WIDER than the raw text it replaces, so a renderer that neutralises beside an estimator
521
+ * that measures the raw string disagree about how many rows the panel occupies — and a row
522
+ * miscount shows as content in the wrong place on screen rather than as an error anywhere. One
523
+ * helper for both sides is what stops them drifting apart again.
524
+ *
525
+ * Same order as everywhere else on this path: **redact the raw text, then neutralise.** A secret
526
+ * literal that carries a control character stops literal-matching the moment that character is
527
+ * rewritten. Redaction is here at all because the collapsed summary above this row already
528
+ * redacts, and an expansion that did not would print, under `/verbose`, the secret the row above
529
+ * it hid.
530
+ *
531
+ * The notice splits through the module's own `toLines`, so a `\r\n` inside a quoted command is one
532
+ * break there too; the args text is a single value and keeps its own newlines as visible `\x0a`,
533
+ * which is what a streamed JSON buffer carrying a real newline actually contains.
534
+ */
535
+ export function buildToolExpansionText(input, secrets = getDefaultSecrets()) {
536
+ const clean = (text) => neutralizeUntrustedText(redactText(text, secrets));
537
+ return {
538
+ args: input.argsText ? clean(input.argsText) : null,
539
+ noticeLines: input.notice ? toLines(input.notice).map(clean) : [],
540
+ };
434
541
  }
435
542
  /**
436
543
  * Apply the canonical render cap: at most `maxLines` lines (each char-capped at
437
544
  * {@link TOOL_PREVIEW_LINE_MAX_CHARS} with `…`), plus a dim `… (+N more lines)` overflow
438
545
  * marker when anything was cut. The marker line is IN ADDITION to the cap so exactly how much
439
546
  * was hidden is always stated (DL-4 transparency).
547
+ *
548
+ * This stays a GENERIC width utility and does not neutralise: it measures a line by what it
549
+ * RENDERS as, so a caller passing genuinely styled text (the renderer's own SGR) gets a cap that
550
+ * counts the columns the user sees rather than the escapes' own bytes.
551
+ *
552
+ * **No production caller passes styled text today.** {@link buildToolPreviewLines} is the only
553
+ * one, and its lines arrive already neutralised from {@link buildToolBodyLines}, so on the tool
554
+ * path there is nothing left to discount. The discount is kept because this is public API — core
555
+ * exports every module — and a width utility that mismeasured styled text would be wrong for any
556
+ * caller that did pass some. It is a property of the utility, not a live requirement of the tool
557
+ * path, and the spec covering it says the same.
440
558
  */
441
559
  export function capToolDisplayLines(lines, maxLines = TOOL_OUTPUT_PREVIEW_LINES) {
442
560
  const capped = lines.slice(0, maxLines).map((l) => ({
@@ -1 +1 @@
1
- {"version":3,"file":"toolDisplay.js","sourceRoot":"","sources":["../../src/core/toolDisplay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAEhD,gGAAgG;AAChG,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAE5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAE/C,kEAAkE;AAClE,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAE7C,yFAAyF;AACzF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAE1C,qEAAqE;AACrE,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,CAAC;AAE5B;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;AA6DrD;;;;;;;;;;;;;;;;;;;GAmB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CAAC,MAAM;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC;IAC9B,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,UAAU,EAAE,CAAC;AACjE,CAAC"}
@@ -2,6 +2,7 @@ import type { GthConfig } from '#src/config.js';
2
2
  import type { DeclaredToolAnnotations } from '#src/core/approvals/annotations.js';
3
3
  import type { ApprovalSubject } from '#src/core/approvals/matcher.js';
4
4
  import type { RaterNegotiationRound, ShellSafetyVerdict } from '#src/core/shell/rater.js';
5
+ import type { GthFinishReasonObservation, GthTerminationReason } from '#src/core/terminationReason.js';
5
6
  import type { BaseMessage } from '@langchain/core/messages';
6
7
  import type { RunnableConfig } from '@langchain/core/runnables';
7
8
  import type { StructuredToolInterface } from '@langchain/core/tools';
@@ -35,6 +36,7 @@ export type { DeclaredToolAnnotations } from '#src/core/approvals/annotations.js
35
36
  export type { ApprovalSubject, McpToolApprovalSubject, ShellApprovalSubject, ToolApprovalSubject, } from '#src/core/approvals/matcher.js';
36
37
  export type { RaterNegotiationRound, RaterOutcome, ShellSafetyVerdict, } from '#src/core/shell/rater.js';
37
38
  export type { AlignmentDecision, AlignmentDecisionKind } from '#src/core/shell/alignment.js';
39
+ export type { GthFinishReasonObservation, GthTerminationCategory, GthTerminationPosture, GthTerminationReason, GthTerminationRemedy, GthTerminationSite, GthTerminationSource, } from '#src/core/terminationReason.js';
38
40
  export type Message = BaseMessage;
39
41
  export type StatusUpdateCallback = (level: StatusLevel, message: string) => void;
40
42
  /**
@@ -95,7 +97,7 @@ export interface GthToolResult {
95
97
  * Typed events emitted by the agent's {@link GthAgentInterface#streamWithEvents} path.
96
98
  * This is the renderer contract shared by every consumer of an agent run — the AG-UI
97
99
  * SSE encoder, the (future) TUI, and any embedder — so it is intentionally agnostic of
98
- * how the underlying graph was built (lean `createAgent` or `createDeepAgent`).
100
+ * how the underlying graph was built.
99
101
  */
100
102
  export type AgentStreamEvent = {
101
103
  type: 'text';
@@ -175,9 +177,9 @@ export type AgentStreamEvent = {
175
177
  };
176
178
  /**
177
179
  * The minimal structural surface of a compiled LangGraph agent that the shared agent
178
- * plumbing in {@link GthAbstractAgent} drives. Both `createAgent` (lean) and
179
- * `createDeepAgent` return graphs that satisfy this, so the base class can stream/invoke
180
- * either without knowing which builder produced it. Inputs are intentionally loose
180
+ * plumbing in {@link GthAbstractAgent} drives. `createAgent` (lean) returns a graph that
181
+ * satisfies this, so the base class can stream/invoke it without knowing which builder
182
+ * produced it. Inputs are intentionally loose
181
183
  * (`any`) so concrete builder return types assign without casts; the base re-applies
182
184
  * precise typing at the point of use via `AIMessage`/`AIMessageChunk` guards.
183
185
  */
@@ -187,8 +189,8 @@ export interface GthCompiledGraph {
187
189
  }>;
188
190
  stream(input: any, config?: any): Promise<IterableReadableStream<any>>;
189
191
  /**
190
- * Read the checkpointed graph state for a thread. Present on LangGraph compiled graphs
191
- * (both `createAgent` and `createDeepAgent`); used to detect a graph suspended on a
192
+ * Read the checkpointed graph state for a thread. Present on LangGraph compiled graphs;
193
+ * used to detect a graph suspended on a
192
194
  * human-in-the-loop `interrupt()` (its pending {@link PendingToolInterrupt} lives in
193
195
  * `state.tasks[].interrupts[].value`). Optional because the structural surface predates it.
194
196
  */
@@ -595,6 +597,31 @@ export interface GthAgentInterface {
595
597
  * the runner records no analytics for that turn. Reading must never throw.
596
598
  */
597
599
  getRunStats?(): GthRunStats;
600
+ /**
601
+ * [[EXT-159]] — forget the previous turn's termination reason so the next turn starts with none.
602
+ * Called by the runner at each turn boundary, alongside {@link resetRunStats}.
603
+ * Optional: an agent that classifies nothing simply omits it.
604
+ */
605
+ resetTerminationReason?(): void;
606
+ /**
607
+ * [[EXT-159]] — why the current turn ended, as classified by the sites inside the agent (the
608
+ * metadata reader, the cancellation and suspend paths, the run-ending middlewares), or `null`
609
+ * when none of them fired.
610
+ *
611
+ * **First-write-wins**, and the agent's answer outranks the runner's: these sites sit inside the
612
+ * runner's own catches, so the innermost classification is the true one and an outer wrapper must
613
+ * not overwrite it. Optional; reading must never throw.
614
+ */
615
+ getTerminationReason?(): GthTerminationReason | null;
616
+ /**
617
+ * [[EXT-159]] — what the provider said about why each finished model message stopped, this turn.
618
+ *
619
+ * The raw `finish_reason` / `stop_reason` / `done_reason` token per observed message, or `null`
620
+ * on an entry whose message carried none — the absence recorded as an absence rather than left to
621
+ * look like an ordinary end. An EMPTY list is a third thing again: no finished model message was
622
+ * observed at all. Optional; reading must never throw.
623
+ */
624
+ getFinishReasonObservations?(): readonly GthFinishReasonObservation[];
598
625
  cleanup?(): Promise<void>;
599
626
  }
600
627
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAuDA;;;;GAIG;AACH,MAAM,CAAN,IAAY,WAQX;AARD,WAAY,WAAW;IACrB,+CAAS,CAAA;IACT,6CAAQ,CAAA;IACR,mDAAW,CAAA;IACX,mDAAW,CAAA;IACX,mDAAW,CAAA;IACX,+CAAS,CAAA;IACT,iDAAU,CAAA;AACZ,CAAC,EARW,WAAW,KAAX,WAAW,QAQtB"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAwEA;;;;GAIG;AACH,MAAM,CAAN,IAAY,WAQX;AARD,WAAY,WAAW;IACrB,+CAAS,CAAA;IACT,6CAAQ,CAAA;IACR,mDAAW,CAAA;IACX,mDAAW,CAAA;IACX,mDAAW,CAAA;IACX,+CAAS,CAAA;IACT,iDAAU,CAAA;AACZ,CAAC,EARW,WAAW,KAAX,WAAW,QAQtB"}
@@ -47,8 +47,8 @@ export declare const GEMINI_SUPPORTED_SCHEMA_KEYWORDS: ReadonlySet<string>;
47
47
  export declare function sanitizeGeminiToolSchema<T = unknown>(schema: T): T;
48
48
  /**
49
49
  * Wire the sanitizer into a ChatGoogle model at the tool-binding boundary. Overrides the instance's
50
- * `bindTools` so every tool passed to it — built-in, custom, or MCP, via `createAgent`/`createDeepAgent`
51
- * which both call `model.bindTools(tools)` — is sanitized before it reaches `@langchain/google`'s
50
+ * `bindTools` so every tool passed to it — built-in, custom, or MCP, via `createAgent`,
51
+ * which calls `model.bindTools(tools)` — is sanitized before it reaches `@langchain/google`'s
52
52
  * Gemini converter. Provider-scoped: only the google-genai/vertexai presets call this, so no other
53
53
  * provider's tools are affected. Returns the same model instance for convenient chaining.
54
54
  */
@@ -326,8 +326,8 @@ function sanitizeToolForGemini(tool) {
326
326
  }
327
327
  /**
328
328
  * Wire the sanitizer into a ChatGoogle model at the tool-binding boundary. Overrides the instance's
329
- * `bindTools` so every tool passed to it — built-in, custom, or MCP, via `createAgent`/`createDeepAgent`
330
- * which both call `model.bindTools(tools)` — is sanitized before it reaches `@langchain/google`'s
329
+ * `bindTools` so every tool passed to it — built-in, custom, or MCP, via `createAgent`,
330
+ * which calls `model.bindTools(tools)` — is sanitized before it reaches `@langchain/google`'s
331
331
  * Gemini converter. Provider-scoped: only the google-genai/vertexai presets call this, so no other
332
332
  * provider's tools are affected. Returns the same model instance for convenient chaining.
333
333
  */
@@ -43,11 +43,16 @@ export declare function applyGeminiThoughtSummaries<T extends BaseChatModel>(mod
43
43
  * summary is withheld. Never express this as a zero/minimal budget — that turns THINKING off, which
44
44
  * is a different and much larger change, and the coercion differs between the 2.5 and 3.x presets.
45
45
  *
46
- * This exists because a consumer outside {@link GthAbstractAgent} routes content blocks by `type`,
47
- * and Gemini's thought summary is typed `text` exactly like an answer block so a third party has
48
- * no way to tell them apart and prints the thinking as the assistant's answer. Not asking for the
49
- * summary is the only thing that reliably stops that; nothing is stripped, so the message kept in
50
- * graph state (and any `thoughtSignature` riding on it) is untouched. Returns the same instance.
46
+ * This exists for any consumer that routes content blocks by `type` without going through gsloth's
47
+ * own reasoning bridge: Gemini's thought summary is typed `text` exactly like an answer block, so
48
+ * such a consumer has no way to tell them apart and prints the thinking as the assistant's answer.
49
+ * Not asking for the summary is the only thing that reliably stops that; nothing is stripped, so the
50
+ * message kept in graph state (and any `thoughtSignature` riding on it) is untouched. Returns the
51
+ * same instance.
52
+ *
53
+ * No production module calls it today (only its spec does). It is kept as published API —
54
+ * `providers/geminiThinking.js` is a public deep-import path — and because a parent reading a child
55
+ * agent's stream needs exactly this; that is the lean subagent primitive (GS2-25).
51
56
  *
52
57
  * It applies to EVERY model family, including the image/tts ones the enable path skips: those are
53
58
  * precisely where `@langchain/google` sets `includeThoughts: true` itself once a budget or level is
@@ -38,11 +38,16 @@ export function applyGeminiThoughtSummaries(model) {
38
38
  * summary is withheld. Never express this as a zero/minimal budget — that turns THINKING off, which
39
39
  * is a different and much larger change, and the coercion differs between the 2.5 and 3.x presets.
40
40
  *
41
- * This exists because a consumer outside {@link GthAbstractAgent} routes content blocks by `type`,
42
- * and Gemini's thought summary is typed `text` exactly like an answer block so a third party has
43
- * no way to tell them apart and prints the thinking as the assistant's answer. Not asking for the
44
- * summary is the only thing that reliably stops that; nothing is stripped, so the message kept in
45
- * graph state (and any `thoughtSignature` riding on it) is untouched. Returns the same instance.
41
+ * This exists for any consumer that routes content blocks by `type` without going through gsloth's
42
+ * own reasoning bridge: Gemini's thought summary is typed `text` exactly like an answer block, so
43
+ * such a consumer has no way to tell them apart and prints the thinking as the assistant's answer.
44
+ * Not asking for the summary is the only thing that reliably stops that; nothing is stripped, so the
45
+ * message kept in graph state (and any `thoughtSignature` riding on it) is untouched. Returns the
46
+ * same instance.
47
+ *
48
+ * No production module calls it today (only its spec does). It is kept as published API —
49
+ * `providers/geminiThinking.js` is a public deep-import path — and because a parent reading a child
50
+ * agent's stream needs exactly this; that is the lean subagent primitive (GS2-25).
46
51
  *
47
52
  * It applies to EVERY model family, including the image/tts ones the enable path skips: those are
48
53
  * precisely where `@langchain/google` sets `includeThoughts: true` itself once a budget or level is
@@ -1 +1 @@
1
- {"version":3,"file":"geminiThinking.js","sourceRoot":"","sources":["../../src/providers/geminiThinking.ts"],"names":[],"mappings":"AAmCA;;;;;;;;;;;GA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6 +65,28 @@ export type StructuredFailureKind = 'timeout' | 'unparseable' | 'call-failed';
65
65
  * carries it, so a different value here reports a genuine timeout as `call-failed`.
66
66
  */
67
67
  export declare function classifyStructuredFailure(error: string, timeoutMs: number): StructuredFailureKind;
68
+ /**
69
+ * Say WHICH of {@link askStructured}'s three failures happened, in one sentence a reader can act on.
70
+ *
71
+ * The two a reader has to tell apart first are a provider that never answered and a provider that
72
+ * refused the request: they want opposite responses — re-run the one, investigate the other — and
73
+ * from the outside they arrive as the same red. Naming the class is what stops a real rejection
74
+ * being shrugged off as flakiness, which is how a guard stops guarding with nobody deciding to
75
+ * remove it.
76
+ *
77
+ * There is no `default` arm and no fallback sentence, deliberately. The module-internal
78
+ * `STRUCTURED_FAILURE_SENTENCES` map, declared above, is typed by the union, so an unhandled kind
79
+ * cannot reach here — the compiler rejects the map instead. A defensive arm would only catch a case
80
+ * the build already refuses, at the price of hiding the compile error that is the real signal.
81
+ * It is named here rather than linked because it is not exported, and a `{@link}` to an
82
+ * undocumented symbol renders as dead text in the API reference.
83
+ *
84
+ * @param error The `error` from a `{ ok: false }` {@link AskStructuredResult}.
85
+ * @param timeoutMs The budget passed to that same {@link askStructured} call — as for
86
+ * {@link classifyStructuredFailure}, a different value here reports a genuine timeout as
87
+ * `call-failed`.
88
+ */
89
+ export declare function describeStructuredFailure(error: string, timeoutMs: number): string;
68
90
  /** Inputs to {@link askStructured}. The caller supplies the model (via config), the two message
69
91
  * texts, and an optional timeout — the Zod schema is a separate positional argument so `<T>` can
70
92
  * be inferred from it. */
@@ -64,6 +64,59 @@ export function classifyStructuredFailure(error, timeoutMs) {
64
64
  return 'unparseable';
65
65
  return 'call-failed';
66
66
  }
67
+ /**
68
+ * The sentence each {@link StructuredFailureKind} is reported as — the wording a reader of a red run
69
+ * actually sees, and the half of {@link describeStructuredFailure} that can be wrong without any
70
+ * mechanism being wrong.
71
+ *
72
+ * It lives here, beside the classifier it is keyed on, for two reasons that are really one. The
73
+ * `Record` is annotated with the union, so the compiler checks the map is **total at its definition
74
+ * site**: adding a kind to {@link StructuredFailureKind} without giving it a sentence is a build
75
+ * error rather than a message that reads `undefined` at the moment someone needs it. And a sentence
76
+ * that sits beside the classifier is reachable by the unit suite, so each one is pinned to the class
77
+ * it names — a map the tests cannot see can have its bodies exchanged, and the failure that results
78
+ * is a stall announcing itself as a rejection, which is the exact confusion these sentences exist to
79
+ * end.
80
+ *
81
+ * Each entry receives the raw `error` and the budget the call was made with, so the sentence can
82
+ * quote both rather than describe them.
83
+ */
84
+ const STRUCTURED_FAILURE_SENTENCES = {
85
+ timeout: (error, timeoutMs) => `STALLED: the provider returned no response within the ${timeoutMs}ms call budget. ` +
86
+ 'Nothing was rejected and nothing was parsed, so this is NOT the schema guard firing — it ' +
87
+ 'is the provider failing to answer. ' +
88
+ `askStructured said: ${error}`,
89
+ unparseable: (error) => "REJECTED BY OUR OWN SCHEMA: the provider answered, and the answer failed this case's " +
90
+ 'schema. This IS the guard firing — the null-vs-absent half. ' +
91
+ `askStructured said: ${error}`,
92
+ 'call-failed': (error) => 'REJECTED BEFORE ANY ANSWER: the call failed outright. A 400 naming `required` IS the ' +
93
+ 'guard firing — the strict-schema half; anything else is auth, transport or configuration. ' +
94
+ `askStructured said: ${error}`,
95
+ };
96
+ /**
97
+ * Say WHICH of {@link askStructured}'s three failures happened, in one sentence a reader can act on.
98
+ *
99
+ * The two a reader has to tell apart first are a provider that never answered and a provider that
100
+ * refused the request: they want opposite responses — re-run the one, investigate the other — and
101
+ * from the outside they arrive as the same red. Naming the class is what stops a real rejection
102
+ * being shrugged off as flakiness, which is how a guard stops guarding with nobody deciding to
103
+ * remove it.
104
+ *
105
+ * There is no `default` arm and no fallback sentence, deliberately. The module-internal
106
+ * `STRUCTURED_FAILURE_SENTENCES` map, declared above, is typed by the union, so an unhandled kind
107
+ * cannot reach here — the compiler rejects the map instead. A defensive arm would only catch a case
108
+ * the build already refuses, at the price of hiding the compile error that is the real signal.
109
+ * It is named here rather than linked because it is not exported, and a `{@link}` to an
110
+ * undocumented symbol renders as dead text in the API reference.
111
+ *
112
+ * @param error The `error` from a `{ ok: false }` {@link AskStructuredResult}.
113
+ * @param timeoutMs The budget passed to that same {@link askStructured} call — as for
114
+ * {@link classifyStructuredFailure}, a different value here reports a genuine timeout as
115
+ * `call-failed`.
116
+ */
117
+ export function describeStructuredFailure(error, timeoutMs) {
118
+ return STRUCTURED_FAILURE_SENTENCES[classifyStructuredFailure(error, timeoutMs)](error, timeoutMs);
119
+ }
67
120
  /**
68
121
  * Ask the configured model for a single schema-validated object — a non-agentic structured-output
69
122
  * call that mirrors their mechanism (see the module doc) and never throws.
@@ -1 +1 @@
1
- {"version":3,"file":"askStructured.js","sourceRoot":"","sources":["../../src/runtime/askStructured.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAIvE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E;;;;GAIG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,MAAM,CAAC;AAExD;;;;;;;;;GASG;AACH,MAAM,UAAU,2BAA2B,CAAC,SAAiB;IAC3D,OAAO,mCAAmC,SAAS,wCAAwC,CAAC;AAC9F,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,oCAAoC,CAAC;AAYtF;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAa,EAAE,SAAiB;IACxE,IAAI,KAAK,KAAK,2BAA2B,CAAC,SAAS,CAAC;QAAE,OAAO,SAAS,CAAC;IACvE,IAAI,KAAK,KAAK,iCAAiC;QAAE,OAAO,aAAa,CAAC;IACtE,OAAO,aAAa,CAAC;AACvB,CAAC;AAmBD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAoB,EACpB,IAA0B;IAE1B,MAAM,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T,IAAI,KAAK;YAAE,YAAY,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;AACH,CAAC"}
@@ -2,6 +2,7 @@ import type { GthConfig } from '#src/config.js';
2
2
  import type { AgentResolvers, GthAgentFactory, GthCommand } from '#src/core/types.js';
3
3
  import type { SingleShotOptions } from '#src/runtime/singleShot.js';
4
4
  import type { GthRunStats } from '#src/core/types.js';
5
+ import type { GthTerminationReason } from '#src/core/terminationReason.js';
5
6
  /**
6
7
  * One turn's result inside a {@link runConversation} run: the per-turn `ok`/`answer` plus that
7
8
  * turn's run stats (GS2-16 {@link GthRunStats} — token usage + invoked tools), captured PER TURN (a
@@ -16,6 +17,16 @@ export interface ConversationTurnResult extends GthRunStats {
16
17
  answer: string;
17
18
  /** Set when `ok` is `false`: why this turn failed. */
18
19
  error?: string;
20
+ /**
21
+ * [[EXT-159]] — why this turn ended, as a value.
22
+ *
23
+ * Per turn, like every other field here, and read before the next turn resets it. It is the
24
+ * structural carrier the console line beside it is rendered FROM, so a consumer — a multi-turn
25
+ * eval asking whether a run stopped because the provider faulted or because the model handed back
26
+ * — reads the classification instead of parsing `error`. `null` means no site classified the
27
+ * ending, which is a site we missed rather than a turn that went well.
28
+ */
29
+ terminationReason: GthTerminationReason | null;
19
30
  }
20
31
  /**
21
32
  * Run a scripted MULTI-TURN conversation and return one {@link ConversationTurnResult} per turn.
@@ -7,6 +7,7 @@ import { ProgressIndicator } from '#src/utils/ProgressIndicator.js';
7
7
  import { recordSessionSafe } from '#src/history/recordSession.js';
8
8
  import { getProjectDir, stdout } from '#src/utils/systemUtils.js';
9
9
  import { ApprovalStopError, approvalStopRows } from '#src/core/shell/approvalStop.js';
10
+ import { displayTermination } from '#src/core/terminationNotice.js';
10
11
  /**
11
12
  * Run a scripted MULTI-TURN conversation and return one {@link ConversationTurnResult} per turn.
12
13
  *
@@ -132,7 +133,18 @@ export async function runConversation(source, _preamble, userMessages, config, r
132
133
  tools: runStats.tools.length > 0 ? runStats.tools : undefined,
133
134
  durationMs: Date.now() - startedAt,
134
135
  });
135
- results.push({ ok, answer, error, ...runStats });
136
+ // [[EXT-159]] — why THIS turn ended, read before the next turn's reset clears it, and said
137
+ // on the same console this surface already reports a failed turn on. A scripted multi-turn
138
+ // run is watched like any other: the turn that stops is the one the person is looking at.
139
+ let terminationReason = null;
140
+ try {
141
+ terminationReason = runner.getTerminationReason();
142
+ }
143
+ catch {
144
+ /* fail-soft: explaining a turn must never be what ends the conversation */
145
+ }
146
+ displayTermination(terminationReason);
147
+ results.push({ ok, answer, error, terminationReason, ...runStats });
136
148
  // A failed turn breaks the conversation's context — stop rather than run later turns on it.
137
149
  if (!ok)
138
150
  break;