@gaunt-sloth/core 2.0.0-alpha.8 → 2.0.0-beta.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.
Files changed (275) hide show
  1. package/.gsloth.review.md +2 -0
  2. package/README.md +71 -20
  3. package/dist/config/colour.d.ts +38 -0
  4. package/dist/config/colour.js +36 -0
  5. package/dist/config/colour.js.map +1 -0
  6. package/dist/config/configDiscovery.d.ts +79 -0
  7. package/dist/config/configDiscovery.js +80 -0
  8. package/dist/config/configDiscovery.js.map +1 -0
  9. package/dist/config/defaults.d.ts +20 -20
  10. package/dist/config/defaults.js +10 -8
  11. package/dist/config/defaults.js.map +1 -1
  12. package/dist/config/filesystem-tools.d.ts +41 -0
  13. package/dist/config/filesystem-tools.js +56 -0
  14. package/dist/config/filesystem-tools.js.map +1 -0
  15. package/dist/config/loader.d.ts +171 -19
  16. package/dist/config/loader.js +1054 -144
  17. package/dist/config/loader.js.map +1 -1
  18. package/dist/config/mouse.d.ts +50 -0
  19. package/dist/config/mouse.js +44 -0
  20. package/dist/config/mouse.js.map +1 -0
  21. package/dist/config/profiles.d.ts +68 -0
  22. package/dist/config/profiles.js +93 -0
  23. package/dist/config/profiles.js.map +1 -0
  24. package/dist/config/providerKeys.d.ts +69 -0
  25. package/dist/config/providerKeys.js +69 -0
  26. package/dist/config/providerKeys.js.map +1 -0
  27. package/dist/config/schema.d.ts +2671 -138
  28. package/dist/config/schema.js +1361 -85
  29. package/dist/config/schema.js.map +1 -1
  30. package/dist/config/shell-policy.d.ts +899 -111
  31. package/dist/config/shell-policy.js +800 -70
  32. package/dist/config/shell-policy.js.map +1 -1
  33. package/dist/config/tool-descriptions.d.ts +211 -0
  34. package/dist/config/tool-descriptions.js +272 -0
  35. package/dist/config/tool-descriptions.js.map +1 -0
  36. package/dist/config/types.d.ts +352 -41
  37. package/dist/config/types.js +1 -0
  38. package/dist/config/types.js.map +1 -1
  39. package/dist/config.d.ts +35 -1
  40. package/dist/config.js +16 -1
  41. package/dist/config.js.map +1 -1
  42. package/dist/constants.d.ts +28 -1
  43. package/dist/constants.js +28 -1
  44. package/dist/constants.js.map +1 -1
  45. package/dist/core/GthAbstractAgent.d.ts +166 -11
  46. package/dist/core/GthAbstractAgent.js +484 -45
  47. package/dist/core/GthAbstractAgent.js.map +1 -1
  48. package/dist/core/GthAgentRunner.d.ts +543 -57
  49. package/dist/core/GthAgentRunner.js +1494 -140
  50. package/dist/core/GthAgentRunner.js.map +1 -1
  51. package/dist/core/GthLangChainAgent.d.ts +117 -2
  52. package/dist/core/GthLangChainAgent.js +602 -29
  53. package/dist/core/GthLangChainAgent.js.map +1 -1
  54. package/dist/core/approvals/annotations.d.ts +122 -0
  55. package/dist/core/approvals/annotations.js +137 -0
  56. package/dist/core/approvals/annotations.js.map +1 -0
  57. package/dist/core/approvals/grants.d.ts +216 -0
  58. package/dist/core/approvals/grants.js +469 -0
  59. package/dist/core/approvals/grants.js.map +1 -0
  60. package/dist/core/approvals/matcher.d.ts +202 -0
  61. package/dist/core/approvals/matcher.js +267 -0
  62. package/dist/core/approvals/matcher.js.map +1 -0
  63. package/dist/core/approvals/mcpSubjects.d.ts +40 -0
  64. package/dist/core/approvals/mcpSubjects.js +99 -0
  65. package/dist/core/approvals/mcpSubjects.js.map +1 -0
  66. package/dist/core/approvals/promptHeader.d.ts +28 -0
  67. package/dist/core/approvals/promptHeader.js +62 -0
  68. package/dist/core/approvals/promptHeader.js.map +1 -0
  69. package/dist/core/approvals/toolAnnotationSources.d.ts +105 -0
  70. package/dist/core/approvals/toolAnnotationSources.js +277 -0
  71. package/dist/core/approvals/toolAnnotationSources.js.map +1 -0
  72. package/dist/core/approvals/toolHost.d.ts +46 -0
  73. package/dist/core/approvals/toolHost.js +108 -0
  74. package/dist/core/approvals/toolHost.js.map +1 -0
  75. package/dist/core/debugCapture.d.ts +74 -0
  76. package/dist/core/debugCapture.js +100 -0
  77. package/dist/core/debugCapture.js.map +1 -0
  78. package/dist/core/gthLeanAgentFactory.d.ts +4 -4
  79. package/dist/core/gthLeanAgentFactory.js +4 -4
  80. package/dist/core/launchBanner.d.ts +127 -0
  81. package/dist/core/launchBanner.js +414 -0
  82. package/dist/core/launchBanner.js.map +1 -0
  83. package/dist/core/modelLabel.d.ts +19 -0
  84. package/dist/core/modelLabel.js +26 -0
  85. package/dist/core/modelLabel.js.map +1 -0
  86. package/dist/core/plainToolIndication.d.ts +15 -0
  87. package/dist/core/plainToolIndication.js +174 -0
  88. package/dist/core/plainToolIndication.js.map +1 -0
  89. package/dist/core/reasoningBlocks.d.ts +65 -0
  90. package/dist/core/reasoningBlocks.js +103 -0
  91. package/dist/core/reasoningBlocks.js.map +1 -0
  92. package/dist/core/refusal.d.ts +53 -0
  93. package/dist/core/refusal.js +133 -0
  94. package/dist/core/refusal.js.map +1 -0
  95. package/dist/core/runHeader.d.ts +38 -0
  96. package/dist/core/runHeader.js +42 -0
  97. package/dist/core/runHeader.js.map +1 -0
  98. package/dist/core/runStats.d.ts +14 -3
  99. package/dist/core/runStats.js +48 -3
  100. package/dist/core/runStats.js.map +1 -1
  101. package/dist/core/shell/ShellCommandFailedError.d.ts +3 -4
  102. package/dist/core/shell/ShellCommandFailedError.js +3 -4
  103. package/dist/core/shell/ShellCommandFailedError.js.map +1 -1
  104. package/dist/core/shell/abstention.d.ts +88 -0
  105. package/dist/core/shell/abstention.js +184 -0
  106. package/dist/core/shell/abstention.js.map +1 -0
  107. package/dist/core/shell/approvalCapture.d.ts +271 -0
  108. package/dist/core/shell/approvalCapture.js +108 -0
  109. package/dist/core/shell/approvalCapture.js.map +1 -0
  110. package/dist/core/shell/approvalStop.d.ts +123 -0
  111. package/dist/core/shell/approvalStop.js +269 -0
  112. package/dist/core/shell/approvalStop.js.map +1 -0
  113. package/dist/core/shell/arity.d.ts +6 -0
  114. package/dist/core/shell/arity.js +20 -6
  115. package/dist/core/shell/arity.js.map +1 -1
  116. package/dist/core/shell/denylist.d.ts +11 -0
  117. package/dist/core/shell/denylist.js +37 -0
  118. package/dist/core/shell/denylist.js.map +1 -0
  119. package/dist/core/shell/escalationSeverity.d.ts +141 -0
  120. package/dist/core/shell/escalationSeverity.js +89 -0
  121. package/dist/core/shell/escalationSeverity.js.map +1 -0
  122. package/dist/core/shell/framing.d.ts +190 -0
  123. package/dist/core/shell/framing.js +633 -0
  124. package/dist/core/shell/framing.js.map +1 -0
  125. package/dist/core/shell/hardline.d.ts +103 -0
  126. package/dist/core/shell/hardline.js +780 -0
  127. package/dist/core/shell/hardline.js.map +1 -0
  128. package/dist/core/shell/negotiation.d.ts +328 -0
  129. package/dist/core/shell/negotiation.js +488 -0
  130. package/dist/core/shell/negotiation.js.map +1 -0
  131. package/dist/core/shell/normalize.d.ts +44 -4
  132. package/dist/core/shell/normalize.js +61 -7
  133. package/dist/core/shell/normalize.js.map +1 -1
  134. package/dist/core/shell/openWorld.d.ts +263 -0
  135. package/dist/core/shell/openWorld.js +1188 -0
  136. package/dist/core/shell/openWorld.js.map +1 -0
  137. package/dist/core/shell/rater.d.ts +873 -0
  138. package/dist/core/shell/rater.js +1454 -0
  139. package/dist/core/shell/rater.js.map +1 -0
  140. package/dist/core/shell/raterModel.d.ts +41 -0
  141. package/dist/core/shell/raterModel.js +51 -0
  142. package/dist/core/shell/raterModel.js.map +1 -0
  143. package/dist/core/shell/raterVocabulary.d.ts +121 -0
  144. package/dist/core/shell/raterVocabulary.js +116 -0
  145. package/dist/core/shell/raterVocabulary.js.map +1 -0
  146. package/dist/core/shell/rejection.d.ts +69 -0
  147. package/dist/core/shell/rejection.js +38 -0
  148. package/dist/core/shell/rejection.js.map +1 -0
  149. package/dist/core/toolCallRepair/grammar.d.ts +41 -0
  150. package/dist/core/toolCallRepair/grammar.js +116 -0
  151. package/dist/core/toolCallRepair/grammar.js.map +1 -0
  152. package/dist/core/toolCallRepair/index.d.ts +2 -0
  153. package/dist/core/toolCallRepair/index.js +7 -0
  154. package/dist/core/toolCallRepair/index.js.map +1 -0
  155. package/dist/core/toolCallRepair/payload.d.ts +36 -0
  156. package/dist/core/toolCallRepair/payload.js +341 -0
  157. package/dist/core/toolCallRepair/payload.js.map +1 -0
  158. package/dist/core/toolCallRepair/promote.d.ts +45 -0
  159. package/dist/core/toolCallRepair/promote.js +90 -0
  160. package/dist/core/toolCallRepair/promote.js.map +1 -0
  161. package/dist/core/toolDisplay.d.ts +123 -0
  162. package/dist/core/toolDisplay.js +451 -0
  163. package/dist/core/toolDisplay.js.map +1 -0
  164. package/dist/core/toolOutputChannel.d.ts +95 -0
  165. package/dist/core/toolOutputChannel.js +165 -0
  166. package/dist/core/toolOutputChannel.js.map +1 -0
  167. package/dist/core/types.d.ts +349 -16
  168. package/dist/core/types.js.map +1 -1
  169. package/dist/history/historyFormat.d.ts +12 -3
  170. package/dist/history/historyFormat.js +50 -8
  171. package/dist/history/historyFormat.js.map +1 -1
  172. package/dist/history/historyStore.d.ts +77 -0
  173. package/dist/history/historyStore.js +173 -6
  174. package/dist/history/historyStore.js.map +1 -1
  175. package/dist/history/recordSession.d.ts +10 -1
  176. package/dist/history/recordSession.js +27 -0
  177. package/dist/history/recordSession.js.map +1 -1
  178. package/dist/providers/anthropic.js +12 -0
  179. package/dist/providers/anthropic.js.map +1 -1
  180. package/dist/providers/configurationPassthrough.d.ts +107 -0
  181. package/dist/providers/configurationPassthrough.js +148 -0
  182. package/dist/providers/configurationPassthrough.js.map +1 -0
  183. package/dist/providers/geminiSchemaSanitizer.d.ts +55 -0
  184. package/dist/providers/geminiSchemaSanitizer.js +347 -0
  185. package/dist/providers/geminiSchemaSanitizer.js.map +1 -0
  186. package/dist/providers/geminiThinking.d.ts +60 -0
  187. package/dist/providers/geminiThinking.js +92 -0
  188. package/dist/providers/geminiThinking.js.map +1 -0
  189. package/dist/providers/google-genai.js +18 -1
  190. package/dist/providers/google-genai.js.map +1 -1
  191. package/dist/providers/groq.js +12 -0
  192. package/dist/providers/groq.js.map +1 -1
  193. package/dist/providers/huggingface.d.ts +25 -0
  194. package/dist/providers/huggingface.js +69 -0
  195. package/dist/providers/huggingface.js.map +1 -0
  196. package/dist/providers/modelCatalog.d.ts +109 -0
  197. package/dist/providers/modelCatalog.js +245 -0
  198. package/dist/providers/modelCatalog.js.map +1 -0
  199. package/dist/providers/modelDiscovery.d.ts +99 -5
  200. package/dist/providers/modelDiscovery.js +191 -35
  201. package/dist/providers/modelDiscovery.js.map +1 -1
  202. package/dist/providers/ollama.d.ts +18 -4
  203. package/dist/providers/ollama.js +67 -37
  204. package/dist/providers/ollama.js.map +1 -1
  205. package/dist/providers/openai.js +34 -0
  206. package/dist/providers/openai.js.map +1 -1
  207. package/dist/providers/openrouter.d.ts +26 -4
  208. package/dist/providers/openrouter.js +83 -26
  209. package/dist/providers/openrouter.js.map +1 -1
  210. package/dist/providers/vertexai.js +19 -1
  211. package/dist/providers/vertexai.js.map +1 -1
  212. package/dist/providers/xai.js +20 -0
  213. package/dist/providers/xai.js.map +1 -1
  214. package/dist/runtime/askStructured.d.ts +105 -0
  215. package/dist/runtime/askStructured.js +120 -0
  216. package/dist/runtime/askStructured.js.map +1 -0
  217. package/dist/runtime/conversation.d.ts +64 -0
  218. package/dist/runtime/conversation.js +171 -0
  219. package/dist/runtime/conversation.js.map +1 -0
  220. package/dist/runtime/singleShot.d.ts +37 -6
  221. package/dist/runtime/singleShot.js +113 -67
  222. package/dist/runtime/singleShot.js.map +1 -1
  223. package/dist/runtime/structuredOutput.d.ts +104 -0
  224. package/dist/runtime/structuredOutput.js +393 -0
  225. package/dist/runtime/structuredOutput.js.map +1 -0
  226. package/dist/utils/ProgressIndicator.d.ts +21 -0
  227. package/dist/utils/ProgressIndicator.js +30 -3
  228. package/dist/utils/ProgressIndicator.js.map +1 -1
  229. package/dist/utils/aiignoreUtils.js.map +1 -1
  230. package/dist/utils/binaryOutputUtils.js.map +1 -1
  231. package/dist/utils/consoleUtils.d.ts +95 -0
  232. package/dist/utils/consoleUtils.js +112 -2
  233. package/dist/utils/consoleUtils.js.map +1 -1
  234. package/dist/utils/crashHandler.d.ts +87 -0
  235. package/dist/utils/crashHandler.js +128 -0
  236. package/dist/utils/crashHandler.js.map +1 -0
  237. package/dist/utils/debugDump.d.ts +134 -0
  238. package/dist/utils/debugDump.js +381 -0
  239. package/dist/utils/debugDump.js.map +1 -0
  240. package/dist/utils/debugUtils.d.ts +13 -4
  241. package/dist/utils/debugUtils.js +36 -13
  242. package/dist/utils/debugUtils.js.map +1 -1
  243. package/dist/utils/displayWidth.d.ts +53 -0
  244. package/dist/utils/displayWidth.js +195 -0
  245. package/dist/utils/displayWidth.js.map +1 -0
  246. package/dist/utils/fileUtils.js.map +1 -1
  247. package/dist/utils/globalConfigUtils.d.ts +14 -2
  248. package/dist/utils/globalConfigUtils.js +22 -4
  249. package/dist/utils/globalConfigUtils.js.map +1 -1
  250. package/dist/utils/llmUtils.d.ts +39 -8
  251. package/dist/utils/llmUtils.js +76 -8
  252. package/dist/utils/llmUtils.js.map +1 -1
  253. package/dist/utils/redactSecrets.d.ts +63 -0
  254. package/dist/utils/redactSecrets.js +286 -0
  255. package/dist/utils/redactSecrets.js.map +1 -0
  256. package/dist/utils/systemPromptNotes.d.ts +222 -0
  257. package/dist/utils/systemPromptNotes.js +338 -0
  258. package/dist/utils/systemPromptNotes.js.map +1 -0
  259. package/dist/utils/systemUtils.d.ts +18 -1
  260. package/dist/utils/systemUtils.js +38 -3
  261. package/dist/utils/systemUtils.js.map +1 -1
  262. package/dist/utils/toolMatching.d.ts +30 -0
  263. package/dist/utils/toolMatching.js +44 -0
  264. package/dist/utils/toolMatching.js.map +1 -0
  265. package/dist/utils/untrustedText.d.ts +86 -0
  266. package/dist/utils/untrustedText.js +101 -0
  267. package/dist/utils/untrustedText.js.map +1 -0
  268. package/package.json +21 -7
  269. package/schema/gsloth-config.schema.json +1921 -326
  270. package/dist/core/shell/allowlist.d.ts +0 -75
  271. package/dist/core/shell/allowlist.js +0 -187
  272. package/dist/core/shell/allowlist.js.map +0 -1
  273. package/dist/core/shell/judge.d.ts +0 -161
  274. package/dist/core/shell/judge.js +0 -261
  275. package/dist/core/shell/judge.js.map +0 -1
@@ -0,0 +1,271 @@
1
+ /**
2
+ * @module core/shell/approvalCapture
3
+ *
4
+ * [[TUI-C27]] — **what the approvals gate DID, recorded while it was doing it**, for the
5
+ * `/debug-dump` archive.
6
+ *
7
+ * ## The two gaps this exists to close
8
+ *
9
+ * 1. **An approval used to leave no trace at all.** A rejection is legible in a dump only as a
10
+ * byproduct of the negotiation — the protocol has to hand the reason back to the agent, so it
11
+ * lands in the transcript. An approval relays nothing to anyone: the tool simply runs. So the
12
+ * archive was at its most detailed about the decisions that STOPPED something and silent about
13
+ * the one decision that let something happen, which is exactly backwards for an incident review.
14
+ * Everything here is written on both branches.
15
+ * 2. **Every field anyone had was a rater OUTPUT; its INPUT was never recorded.** Rung, outcome,
16
+ * reason, which preflight, whether the floor fired — all of them describe what the rater
17
+ * *answered*, and none records what it was *shown*. The question that actually failed in the
18
+ * field — *"were the user's messages in view on round 2?"* — needs the input of an approving
19
+ * round, the one combination the dump had neither half of.
20
+ *
21
+ * ## The one rule that shapes the whole module: CAPTURE, NEVER RE-RENDER
22
+ *
23
+ * {@link RaterCallCapture.prompt} holds the exact `{system, user}` strings handed to the model, taken
24
+ * inside `rateShellCommand` at the send site — not rebuilt afterwards from the state that produced
25
+ * them. A dump that can disagree with what actually happened is worse than no dump: it invites a
26
+ * confident wrong conclusion from the only evidence there is, which is the failure mode this node
27
+ * was filed over. The same rule is why {@link RaterCallCapture.rawResponse} keeps the model's answer
28
+ * *before* it is mapped to an outcome — a malformed or surprising answer stays visible rather than
29
+ * being smoothed into a verdict.
30
+ *
31
+ * ## The records are pushed EARLY and mutated in place, deliberately
32
+ *
33
+ * {@link ApprovalCaptureLog.begin} appends the record the moment a gated call arrives, and the gate
34
+ * fills fields in as they are decided. The alternative — assemble the whole record, push it at the
35
+ * end — loses exactly the events worth keeping: an `attack` verdict throws `AttackHaltError` out of
36
+ * the decision, so a run that halted would carry no record of the rating that halted it. Pushing
37
+ * first makes survival a property of the structure rather than of someone remembering to write the
38
+ * record before each `throw`.
39
+ *
40
+ * ## Redaction
41
+ *
42
+ * Nothing is redacted here. The archive writer routes this artifact through the SAME
43
+ * [[GS2-47]]/[[GS2-54]] pass as `transcript.json` and `model-messages.json`
44
+ * (`renderStructured` → `redactText`, over the literal secret values `collectSecretValues`
45
+ * harvested from env + config). Redacting twice, in two places, is how two policies come to exist.
46
+ */
47
+ import type { ApprovalRung } from '#src/config.js';
48
+ import type { ToolApprovalScope } from '#src/core/types.js';
49
+ import type { AbstentionDefect } from '#src/core/shell/abstention.js';
50
+ import type { NegotiationCounters } from '#src/core/shell/negotiation.js';
51
+ import type { FailClosedCause, PreflightFloorKind, RaterNegotiationContext, RaterNegotiationRound, ShellSafetyVerdict } from '#src/core/shell/rater.js';
52
+ /**
53
+ * How many gated decisions one session keeps. A ring buffer for the same reason the debug-log one
54
+ * is: each record carries a full rating prompt (a few KB), and a long `auto` session makes a lot of
55
+ * them. The newest are the ones a bug report is about, so the oldest are evicted.
56
+ */
57
+ export declare const APPROVAL_CAPTURE_MAX = 50;
58
+ /**
59
+ * **Which layer of the gate decided this call.** The diagnostic value of the whole record is
60
+ * precisely here: a bug report that says "escalated" does not distinguish a rater verdict from a
61
+ * floor match from a timeout from a deny-list hit, and those need four different answers.
62
+ *
63
+ * The names follow the numbered steps of `GthAgentRunner.decideToolApprovalInner`:
64
+ *
65
+ * - `not-gated` — the rung in force does not gate this tool at all.
66
+ * - `deny-list` — a declared `approvals.deny` entry, or an *always reject* the human chose earlier.
67
+ * - `bypass` — the gate is off for the session.
68
+ * - `hardline-floor` — §8's deterministic floor matched, before any rating or prompt.
69
+ * - `escalate-entry` — a declared `approvals.escalate` entry; a human answers, with no rating call.
70
+ * - `allow-list` — an allow entry settled it with no rating (`rate: false`, or an unrated rung).
71
+ * - `allow-tripwire` — an allow entry that kept the rater involved (§3.2's `rate: true`).
72
+ * - `rater` — the ordinary rating path.
73
+ * - `tool-open-world-floor` — §4.7.3's floor on a non-shell call whose effective `openWorldHint`
74
+ * is true. No rater sees it while §4.3's scope boundary stands.
75
+ * - `unrated-rung` — nothing but the rung itself: `manual` and `write` consult no model, so a call
76
+ * no rule claimed goes to the human on the rung's say-so. It is its own value rather than an
77
+ * absent one, because "the rung requires a person" is an answer and a blank field reads as the
78
+ * recorder having failed.
79
+ */
80
+ export type ApprovalDecidingStage = 'not-gated' | 'deny-list' | 'bypass' | 'hardline-floor' | 'escalate-entry' | 'allow-list' | 'allow-tripwire' | 'rater' | 'tool-open-world-floor' | 'unrated-rung';
81
+ /**
82
+ * What became of the call, as the agent experienced it. `error` is its own value rather than an
83
+ * absence: a decision that threw something other than a halt is a fact about the gate, and a record
84
+ * left with no action at all would read as one that never finished being written.
85
+ */
86
+ export type ApprovalCaptureAction = 'approve' | 'reject' | 'escalate' | 'halt' | 'error';
87
+ /** How an escalation ended once it reached (or failed to reach) a person. */
88
+ export type ApprovalHumanAnswer = 'approve' | 'reject' | 'no-human';
89
+ /**
90
+ * §5.1's negotiation context **as it was handed to the prompt builder**, plus the one distinction a
91
+ * reader of the archive keeps needing and could never make.
92
+ *
93
+ * **`userMessagesPopulated` is the field the node exists for.** Round 1 is context-free *by design*
94
+ * (§5.1: *"round 1 sees the command alone"*), so an empty window is not a bug — and a reader with no
95
+ * access to the source cannot know that. {@link userMessagesNote} states which case this is in
96
+ * words, so the answer to *"were the user's messages in view on round N?"* is one field and one
97
+ * sentence rather than a source-reading exercise across three files.
98
+ */
99
+ export interface RaterNegotiationCapture {
100
+ /** 1-based index of this rating within the current negotiation. */
101
+ round: number;
102
+ /** Whether this rating was a round-1 (context-free) rating. */
103
+ roundOne: boolean;
104
+ /** Whether a §5.1 context was supplied at all (it is not, at a rung that does not negotiate). */
105
+ contextSupplied: boolean;
106
+ /** The justification admitted into THIS rating. Withheld at round 1 by `contextFor`, by design. */
107
+ justification?: string;
108
+ /** `<negotiation_so_far>` as handed over: the completed rounds, oldest first. */
109
+ priorRounds: RaterNegotiationRound[];
110
+ /** `<user_messages>` as handed over, oldest first, before the builder's last-5 + truncation. */
111
+ userMessages: string[];
112
+ /** Whether that window carried anything. THE distinction this facility turns on. */
113
+ userMessagesPopulated: boolean;
114
+ /** Why the window looks the way it does, in words, for a reader who has never seen the spec. */
115
+ userMessagesNote: string;
116
+ }
117
+ /**
118
+ * One rating call: what the rater was SHOWN and what it ANSWERED, captured at the send site.
119
+ *
120
+ * Every field is filled by `rateShellCommand` itself. `prompt` is set before the call and the rest
121
+ * as the answer arrives, so a rater that never answers still leaves a record of what it was asked.
122
+ */
123
+ export interface RaterCallCapture {
124
+ /** ISO timestamp of the moment the call was sent. */
125
+ at: string;
126
+ /** Wall-clock ms the call took, once it has returned (or timed out). */
127
+ durationMs?: number;
128
+ /** The rater model's own label — an id and a provider type, never the instance. */
129
+ model?: string;
130
+ /** `approvals.rater` — the identity profile the rater model came from, when one is configured. */
131
+ profile?: string;
132
+ /** The budget this call was raced against ([[EXT-66]]). */
133
+ timeoutMs: number;
134
+ /** §5.2 — whether a rejection would be handed back to the AGENT rather than to a person. */
135
+ negotiable: boolean;
136
+ /** **The exact strings sent.** Captured, never re-rendered. */
137
+ prompt: {
138
+ system: string;
139
+ user: string;
140
+ };
141
+ /** What the negotiation looked like at the moment of this call. */
142
+ negotiation: RaterNegotiationCapture;
143
+ /** The model's answer BEFORE it is parsed or mapped, so a malformed one stays visible. */
144
+ rawResponse?: unknown;
145
+ /** The verdict this call resolved to, including a fail-closed one. */
146
+ verdict?: ShellSafetyVerdict;
147
+ /** Set when the verdict is the gate failing closed rather than the model judging ([[EXT-66]]). */
148
+ failClosed?: FailClosedCause;
149
+ }
150
+ /** A declared entry or runtime grant that decided the call, rendered as the user would read it. */
151
+ export interface ApprovalRuleMatchCapture {
152
+ action: 'allow' | 'deny' | 'escalate';
153
+ /** The entry in the words the menu and the notices use (`describeApprovalEntry`). */
154
+ entry: string;
155
+ /** §3.2 — whether an allow entry kept the rater involved as a tripwire. */
156
+ rate?: boolean;
157
+ }
158
+ /**
159
+ * §8's deterministic floor, when it matched.
160
+ *
161
+ * **This block NAMES THE MATCHED PATTERN, and that is a decision taken rather than an oversight.**
162
+ * §8.1 says the floor is never advertised, and [[CFG-31]] binds user-facing rung copy to that rule.
163
+ * The resolution taken for [[TUI-C27]] is that §8.1 governs **rung descriptions and promotional
164
+ * copy** — text that invites a user to feel safe — and not a diagnostic archive a user opens about
165
+ * their own session. "A floor matched" without saying which one leaves nobody able to act on it;
166
+ * the refusal the *user* sees ({@link import('./hardline.js').buildHardlineRefusal}) is unchanged
167
+ * and still names only the description.
168
+ */
169
+ export interface HardlineFloorCapture {
170
+ /** The human-readable description, as the refusal message carries it. */
171
+ description: string;
172
+ /** The matched pattern's source, or the stable token of the non-pattern arm. */
173
+ pattern: string;
174
+ }
175
+ /** A deterministic preflight finding, and whether it actually rewrote the rater's outcome. */
176
+ export interface PreflightFloorCapture {
177
+ kind: PreflightFloorKind;
178
+ reason: string;
179
+ /**
180
+ * Whether the floor changed the outcome. A preflight only ever RAISES, and only `safe` sits below
181
+ * the floor — so a finding on a `destructive` verdict is the floor AGREEING with the rater, not
182
+ * overriding it, and reporting those two the same way would misattribute the decision.
183
+ */
184
+ rewroteRating: boolean;
185
+ }
186
+ /** One gated tool call, from arrival to outcome. */
187
+ export interface ApprovalDecisionCapture {
188
+ /** ISO timestamp of the moment the call arrived at the gate. */
189
+ at: string;
190
+ /** The tool that was called. */
191
+ tool: string;
192
+ /** The command, for a `run_shell_command` call whose argument was a readable string. */
193
+ command?: string;
194
+ /** The rung in force for THIS decision (`/approvals <rung>` moves it mid-session). */
195
+ rung: ApprovalRung;
196
+ /** The stage that decided. `undefined` only if the decision threw before reaching one. */
197
+ stage?: ApprovalDecidingStage;
198
+ /** What became of the call. Always set by the time the decision returns or throws. */
199
+ action?: ApprovalCaptureAction;
200
+ /** The scope an approval was granted at, when one was. */
201
+ scope?: ToolApprovalScope;
202
+ /** Whether a person was actually asked, and what they said. */
203
+ humanAnswer?: ApprovalHumanAnswer;
204
+ /** §8's floor, when it matched. */
205
+ hardline?: HardlineFloorCapture;
206
+ /** The declared entry or runtime grant that decided the call, when one did. */
207
+ ruleMatch?: ApprovalRuleMatchCapture;
208
+ /** The deterministic preflight finding on this command, when there was one. */
209
+ preflight?: PreflightFloorCapture;
210
+ /**
211
+ * [[EXT-81]] — whether the gate's own parser could not statically resolve the command, so the
212
+ * rating carried a neutral note about the shape it saw.
213
+ *
214
+ * **This is what remains of "was the call an ABSTAIN".** `abstain` was an ACTION of its own until
215
+ * [[EXT-81]] retired it: a parser reporting that it could not read a string has detected nothing,
216
+ * so it no longer earns an action, and the command is now rated like any other. The observable
217
+ * that survived is this shape report, and the budget position that used to accompany it is
218
+ * {@link budget}.
219
+ */
220
+ parserUnresolved?: AbstentionDefect;
221
+ /** Where this call sat in §5.3's consecutive bound and the reachability bound, on arrival. */
222
+ budget: NegotiationCounters;
223
+ /** The rating, when one was made. Absent for every stage that decided without a model. */
224
+ rating?: RaterCallCapture;
225
+ /** The error that ended the decision, when one did. */
226
+ error?: string;
227
+ }
228
+ /**
229
+ * The per-session log of gated decisions.
230
+ *
231
+ * **Instance-scoped, on the runner, and never a module singleton** — the same reason
232
+ * `ShellNegotiationState` and the grant stores are: a concurrent ACP / AG-UI session must not
233
+ * inherit another session's approvals history, and a dump taken in one must not describe the other.
234
+ */
235
+ export declare class ApprovalCaptureLog {
236
+ private records;
237
+ /**
238
+ * Open a record for a gated call and return it LIVE, already in the buffer.
239
+ *
240
+ * The caller mutates the returned object as the decision is made. See the module docblock for why
241
+ * the push happens here rather than at the end: a halt throws out of the decision, and a record
242
+ * assembled at the end would be lost on exactly the calls most worth keeping.
243
+ */
244
+ begin(record: ApprovalDecisionCapture): ApprovalDecisionCapture;
245
+ /**
246
+ * The records so far, oldest first. A copy of the ARRAY: the records themselves are handed over
247
+ * live, because a decision still in flight is one the archive should show as it stands rather
248
+ * than not at all.
249
+ */
250
+ snapshot(): ApprovalDecisionCapture[];
251
+ /** Drop everything — the TUI's `/clear` rotates the thread. */
252
+ clear(): void;
253
+ }
254
+ /**
255
+ * A short, KEY-FREE label for the rater model: its id and its provider type, and nothing else.
256
+ *
257
+ * Deliberately not a param dump. A live `BaseChatModel` carries an `apiKey` and a client instance,
258
+ * and this string goes into an archive people attach to bug reports — so it reads a fixed handful of
259
+ * scalar fields through guards, exactly as `debugDump`'s own live-model descriptor does, rather than
260
+ * serialising anything of the instance.
261
+ */
262
+ export declare function raterModelLabel(model: unknown): string | undefined;
263
+ /**
264
+ * Describe the §5.1 context a rating is about to be made with — **as it was handed to the prompt
265
+ * builder**, so the record and the prompt cannot come to describe two different ratings.
266
+ *
267
+ * The note is the legibility half of the acceptance: an empty user-messages window means one thing
268
+ * at round 1 (by design) and something else entirely at round 3, and a reader of the archive has no
269
+ * way to tell them apart from a `[]`.
270
+ */
271
+ export declare function describeRaterNegotiation(negotiation: RaterNegotiationContext | undefined): RaterNegotiationCapture;
@@ -0,0 +1,108 @@
1
+ /**
2
+ * How many gated decisions one session keeps. A ring buffer for the same reason the debug-log one
3
+ * is: each record carries a full rating prompt (a few KB), and a long `auto` session makes a lot of
4
+ * them. The newest are the ones a bug report is about, so the oldest are evicted.
5
+ */
6
+ export const APPROVAL_CAPTURE_MAX = 50;
7
+ /**
8
+ * The per-session log of gated decisions.
9
+ *
10
+ * **Instance-scoped, on the runner, and never a module singleton** — the same reason
11
+ * `ShellNegotiationState` and the grant stores are: a concurrent ACP / AG-UI session must not
12
+ * inherit another session's approvals history, and a dump taken in one must not describe the other.
13
+ */
14
+ export class ApprovalCaptureLog {
15
+ records = [];
16
+ /**
17
+ * Open a record for a gated call and return it LIVE, already in the buffer.
18
+ *
19
+ * The caller mutates the returned object as the decision is made. See the module docblock for why
20
+ * the push happens here rather than at the end: a halt throws out of the decision, and a record
21
+ * assembled at the end would be lost on exactly the calls most worth keeping.
22
+ */
23
+ begin(record) {
24
+ this.records.push(record);
25
+ if (this.records.length > APPROVAL_CAPTURE_MAX)
26
+ this.records.shift();
27
+ return record;
28
+ }
29
+ /**
30
+ * The records so far, oldest first. A copy of the ARRAY: the records themselves are handed over
31
+ * live, because a decision still in flight is one the archive should show as it stands rather
32
+ * than not at all.
33
+ */
34
+ snapshot() {
35
+ return [...this.records];
36
+ }
37
+ /** Drop everything — the TUI's `/clear` rotates the thread. */
38
+ clear() {
39
+ this.records = [];
40
+ }
41
+ }
42
+ /**
43
+ * A short, KEY-FREE label for the rater model: its id and its provider type, and nothing else.
44
+ *
45
+ * Deliberately not a param dump. A live `BaseChatModel` carries an `apiKey` and a client instance,
46
+ * and this string goes into an archive people attach to bug reports — so it reads a fixed handful of
47
+ * scalar fields through guards, exactly as `debugDump`'s own live-model descriptor does, rather than
48
+ * serialising anything of the instance.
49
+ */
50
+ export function raterModelLabel(model) {
51
+ if (!model || typeof model !== 'object')
52
+ return undefined;
53
+ const m = model;
54
+ let type;
55
+ try {
56
+ type = typeof m._llmType === 'function' ? m._llmType() : undefined;
57
+ }
58
+ catch {
59
+ type = undefined;
60
+ }
61
+ const id = [m.model, m.modelName, m.modelId].find((value) => typeof value === 'string');
62
+ if (id && type)
63
+ return `${type}/${id}`;
64
+ return id ?? type;
65
+ }
66
+ /**
67
+ * Describe the §5.1 context a rating is about to be made with — **as it was handed to the prompt
68
+ * builder**, so the record and the prompt cannot come to describe two different ratings.
69
+ *
70
+ * The note is the legibility half of the acceptance: an empty user-messages window means one thing
71
+ * at round 1 (by design) and something else entirely at round 3, and a reader of the archive has no
72
+ * way to tell them apart from a `[]`.
73
+ */
74
+ export function describeRaterNegotiation(negotiation) {
75
+ const priorRounds = [...(negotiation?.priorRounds ?? [])];
76
+ const userMessages = [...(negotiation?.userMessages ?? [])];
77
+ const roundOne = priorRounds.length === 0;
78
+ const populated = userMessages.length > 0;
79
+ return {
80
+ round: priorRounds.length + 1,
81
+ roundOne,
82
+ contextSupplied: negotiation !== undefined,
83
+ ...(negotiation?.justification !== undefined
84
+ ? { justification: negotiation.justification }
85
+ : {}),
86
+ priorRounds,
87
+ userMessages,
88
+ userMessagesPopulated: populated,
89
+ userMessagesNote: userMessagesNote(negotiation !== undefined, roundOne, populated),
90
+ };
91
+ }
92
+ /** The sentence {@link describeRaterNegotiation} puts on the window, for a reader with no spec. */
93
+ function userMessagesNote(contextSupplied, roundOne, populated) {
94
+ if (!contextSupplied) {
95
+ return ('No negotiation context was supplied for this rating (the rung does not negotiate, or this ' +
96
+ 'was the allow-list tripwire), so the rater saw the command alone. An empty window here is ' +
97
+ 'not a defect.');
98
+ }
99
+ if (roundOne) {
100
+ return ('Round 1: spec §5.1 admits no justification, no transcript and no user messages, so the ' +
101
+ 'rater saw the command alone. An empty window here is BY DESIGN, not a defect.');
102
+ }
103
+ return populated
104
+ ? "Round 2 or later: the user's own recent messages WERE in the rater's view for this rating."
105
+ : 'Round 2 or later, and the window is still empty — the conversation had no non-blank user ' +
106
+ 'message to admit. This one IS worth looking at.';
107
+ }
108
+ //# sourceMappingURL=approvalCapture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approvalCapture.js","sourceRoot":"","sources":["../../../src/core/shell/approvalCapture.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * One piece of a stop message, tagged with who wrote it.
3
+ *
4
+ * - `own` — this module's own sentence. Nothing outside it can influence the text, so a surface
5
+ * may paint it as it is and let the terminal wrap it.
6
+ * - `command` — the command the agent proposed. Framed with the site extraction, because its
7
+ * composition boundaries and substitutions are the decision-relevant positions in it.
8
+ * - `value` — one untrusted single value (the rater's outcome or reason, the matched
9
+ * `approvals.escalate` entry). Framed as prose; there are no sites to point at.
10
+ * - `block` — an untrusted block whose LINE STRUCTURE is a renderer's, not the model's: the §5
11
+ * negotiation transcript, whose rows `core/shell/negotiation` builds and whose leaves it has
12
+ * already collapsed to one line each. Its breaks survive into the message where a `value`'s
13
+ * would be escaped, because they are the thing that makes it readable at all.
14
+ *
15
+ * **A `block` is still neutralised line by line here, and that is deliberate defence in depth.**
16
+ * Its one production producer (`renderNegotiationTranscript`) has already cleaned every leaf, so
17
+ * on today's paths this arm changes nothing — but these constructors are public, and a caller
18
+ * handing one a raw multi-line string must not be the thing that decides whether a cursor can
19
+ * move. `approvalStop.spec.ts` builds exactly that string so the arm is falsifiable rather than
20
+ * merely reassuring.
21
+ *
22
+ * **The §5.4 VOICE distinction is deliberately not carried here**, and the trade is worth stating
23
+ * because `negotiation.ts` documents voice preservation as a rule: `renderNegotiationRows` tags
24
+ * each row `chrome`/`agent`/`rater` so a surface can colour the rater's turns apart from the
25
+ * agent's. A stop renders the transcript as one undifferentiated untrusted block instead. Framing
26
+ * a mixed-trust block wholly as untrusted is the safe direction (nothing in it is promoted to the
27
+ * gate's own voice), the row prefixes still name the speaker in text, and an `Error` carries no
28
+ * colour to any of the non-terminal consumers anyway. Colouring by voice here would mean
29
+ * re-deriving the tags from a string that no longer has them.
30
+ */
31
+ export type ApprovalStopPart = {
32
+ kind: 'own';
33
+ text: string;
34
+ } | {
35
+ kind: 'command';
36
+ label: string;
37
+ text: string;
38
+ } | {
39
+ kind: 'value';
40
+ label: string;
41
+ text: string;
42
+ } | {
43
+ kind: 'block';
44
+ text: string;
45
+ };
46
+ /**
47
+ * The stop as terminal rows, for a surface that paints lines rather than components.
48
+ *
49
+ * Every row is painted **verbatim, one row per line, and never re-wrapped** — that is the
50
+ * condition `core/shell/framing` states its column-0 guarantee over, and a caller that joins these
51
+ * and hands them to something that wraps has undone the whole point.
52
+ *
53
+ * `columns` is what the surface reports (`stdout.columns`), not a frame width: it is resolved
54
+ * through {@link frameWidthFor} here so the plain surfaces, the Ink TUI and the approval dialog
55
+ * cannot come to disagree about how much of a command a human was shown. When it is below core's
56
+ * floor the frame is wider than the terminal and the guarantee lapses — {@link narrowTerminalNotice}
57
+ * leads the block in that case, so it lapses out loud.
58
+ */
59
+ export declare function approvalStopRows(parts: readonly ApprovalStopPart[], options?: {
60
+ columns?: number;
61
+ }): string[];
62
+ /**
63
+ * Base class for the two run-ending approvals outcomes, so a caller that wants to present them as
64
+ * an ending rather than a crash can catch both with one `instanceof`.
65
+ *
66
+ * A surface that can frame should render {@link parts} (see {@link approvalStopRows}); one that
67
+ * cannot shows {@link message}, which is already neutralised and is already the whole explanation.
68
+ */
69
+ export declare abstract class ApprovalStopError extends Error {
70
+ /** The command that ended the run, exactly as the agent proposed it. */
71
+ readonly command: string;
72
+ /** The message's pieces, tagged with who wrote each — see {@link ApprovalStopPart}. */
73
+ readonly parts: readonly ApprovalStopPart[];
74
+ protected constructor(parts: readonly ApprovalStopPart[], command: string);
75
+ }
76
+ /**
77
+ * §4.2 — an `attack` outcome: the command's own **structure** evidenced compromise (§4.1.1 —
78
+ * credential targeting, privilege escalation, persistence, deception, obfuscation). Ends the agent
79
+ * loop; the model is told nothing and offered nothing.
80
+ *
81
+ * **This is what reaches a surface that cannot ask.** An interactive surface is offered [[TUI-C68]]
82
+ * §6.1's red banner first — `GthAgentRunner.setAttackHaltCallback`, where typing `run anyway` runs
83
+ * this one command and everything else stops the run — and this error is thrown when no banner is
84
+ * wired, or when the banner is answered with anything but that phrase. A non-interactive session
85
+ * wires nothing and so gets this message directly (§6.2).
86
+ *
87
+ * The recovery this message names is deliberately the **allow-list**, not `bypass`. §4.2 makes
88
+ * `approvals.allow` the supported way to run such a command unattended (it is consulted before the
89
+ * rater, so it never reaches a halt at all); `bypass` also works and is far blunter — it turns off
90
+ * the rater, the escalation and the halt together, for every command, for the whole run. It is a
91
+ * last resort, not the answer, and the wording says so in that order.
92
+ */
93
+ export declare class AttackHaltError extends ApprovalStopError {
94
+ /** The rater's explanation of what the command's structure showed. */
95
+ readonly reason: string;
96
+ constructor(command: string, reason: string);
97
+ }
98
+ /**
99
+ * §6.2 — an escalation with nobody to ask (CI, one-shot runs, servers). Fails the build loudly,
100
+ * with everything a person needs in order to see why.
101
+ */
102
+ export declare class NonInteractiveEscalationError extends ApprovalStopError {
103
+ /** The rater's outcome, when a rating existed (the unrated rungs have none). */
104
+ readonly outcome: string | undefined;
105
+ /** The rater's explanation, when a rating existed. */
106
+ readonly reason: string | undefined;
107
+ /**
108
+ * EXT-71 §3.2 — the declared `approvals.escalate` entry that sent this call to a human, when one
109
+ * did. It changes the recovery the message names: pointing someone at `approvals.allow` when they
110
+ * themselves wrote an escalate entry sends them to a list that cannot win, since a match on
111
+ * `escalate` outranks a match on `allow`.
112
+ */
113
+ readonly escalatedBy: string | undefined;
114
+ /**
115
+ * [[EXT-29]] §6 — the §5 negotiation that preceded this escalation, rendered, when there was one.
116
+ *
117
+ * §6.2's message is the ONLY thing a person sees on this path — there is no prompt to attach a
118
+ * transcript to — so an unattended run that ended after three rejections would otherwise report
119
+ * the last command and give no hint that the agent had already been told twice what to fix.
120
+ */
121
+ readonly negotiation: string | undefined;
122
+ constructor(command: string, outcome?: string, reason?: string, escalatedBy?: string, negotiation?: string);
123
+ }