@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 @@
1
+ {"version":3,"file":"hardline.js","sourceRoot":"","sources":["../../../src/core/shell/hardline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkFG;AACH,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEzF;;;GAGG;AACH,MAAM,aAAa,GAAG,mBAAmB,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,YAAY,GAAsB;IACtC,6FAA6F;IAC7F,sEAAsE;IACtE,iGAAiG;IACjG,yBAAyB;IACzB,mEAAmE;IACnE,6FAA6F;IAC7F,6FAA6F;IAC7F,oBAAoB;IACpB,0FAA0F;IAC1F,gGAAgG;IAChG,kDAAkD;IAClD,4DAA4D;IAC5D,aAAa,aAAa,EAAE;IAC5B,gGAAgG;IAChG,iGAAiG;IACjG,2FAA2F;IAC3F,4DAA4D,aAAa,EAAE;CAC5E,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,OAAO,GACX,SAAS,uBAAuB,aAAa;IAC7C,MAAM;IACN,MAAM,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI;IAChC,MAAM,CAAC;AAET;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,gBAAgB,GAAG,eAAe,uBAAuB,IAAI,CAAC;AAEpE;;;;;;;;;;;;GAYG;AACH,MAAM,YAAY,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,OAAO,IAAI,MAAM,IAAI,KAAK,IAAI,IAAI,gBAAgB,EAAE,CAAC;AAEpG;;;;;;;;kGAQk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CAAqC,EAAE,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC3F,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,KAAoB;IACxE,OAAO,CACL,wBAAwB,OAAO,uCAAuC;QACtE,IAAI,KAAK,CAAC,WAAW,gEAAgE,CACtF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,328 @@
1
+ import type { RaterNegotiationContext, RaterNegotiationRound } from '#src/core/shell/rater.js';
2
+ /**
3
+ * §5.3 — **three CONSECUTIVE rejections end the negotiation** and escalate to the human: the agent
4
+ * and the rater cannot agree, and that is a human's call, not a machine's.
5
+ *
6
+ * Consecutive, not total: a successful intervening tool call — the agent going away to gather
7
+ * information and returning better informed — resets it, because that is progress, not ping-pong.
8
+ */
9
+ export declare const MAX_CONSECUTIVE_REJECTIONS = 3;
10
+ /**
11
+ * [[EXT-29]] — **the reachability bound: total rejections since a human was last involved.** A
12
+ * reset of {@link MAX_CONSECUTIVE_REJECTIONS} does not refill it; only actually reaching a person
13
+ * clears it ({@link ShellNegotiationState.humanReached}).
14
+ *
15
+ * ## Why this exists, and why §5.3 does not answer it
16
+ *
17
+ * §5.3 says *"no total ceiling is added here, and none is needed"*, and tells the next reader not to
18
+ * add one without a fresh decision. **This is that decision (Andrew, EXT-29), and it answers a
19
+ * different question than the one §5.3 asked.**
20
+ *
21
+ * §5.3's argument is about **safety**, and it is sound and untouched: every attempt is rated
22
+ * independently, the rater does not weaken with repetition, and — because a reset also clears the
23
+ * transcript — a gamed reset approves nothing that would not have been approved on the first try.
24
+ * Nothing here contradicts that, and this bound must never be described as a security control.
25
+ *
26
+ * The question §5.3 never asked is **reachability**: does the human terminus fire at all? Under its
27
+ * own reset predicate it does not. An agent that alternates one approved `ls` with one rejection
28
+ * never accumulates three *consecutive* rejections, so *"three rejections escalate to the human"* —
29
+ * §7's promise that the model is never left to silently give up on a legitimate task — is
30
+ * unreachable for that agent, for any number of rejections. The same shape was measured live on the
31
+ * shipped EXT-65 retry budget, where a human's "No" and a deny-list match each refilled the budget.
32
+ *
33
+ * **`recursionLimit` is not the answer either.** It bounds the *run* at 1000 steps; it does not
34
+ * escalate to a *person*. §5.3's *"that is a human's call"* names an event, and a dying run does not
35
+ * produce it: the user gets a step-limit failure rather than the question they were promised.
36
+ *
37
+ * Nine — three times the consecutive cap — so an agent making genuine progress between rejections
38
+ * still gets several full negotiations before a person is asked, while one making none is in front
39
+ * of a human within a bounded number of rounds.
40
+ *
41
+ * **The shape and the number are Andrew's to change** (a progress-only reset predicate is the
42
+ * standing alternative). What is not negotiable is that some bound ends at a person, so this stays
43
+ * ONE constant and ONE predicate — {@link ShellNegotiationState.recordRejection} — and swapping it
44
+ * is local.
45
+ */
46
+ export declare const MAX_REJECTIONS_BEFORE_HUMAN = 9;
47
+ /** What {@link ShellNegotiationState.recordRejection} decides: serve another round, or ask a human. */
48
+ export type NegotiationVerdict = 'reject' | 'escalate';
49
+ /**
50
+ * Where a negotiation stands against its two bounds, as a plain readable projection.
51
+ *
52
+ * The caps travel WITH the counts on purpose: "2 consecutive rejections" says nothing on its own,
53
+ * and a reader of a `/debug-dump` archive has no way to look {@link MAX_CONSECUTIVE_REJECTIONS} up.
54
+ * "2 of 3" is the same fact and is actionable.
55
+ */
56
+ export interface NegotiationCounters {
57
+ /** §5.3's consecutive-rejection count. Cleared by an approved call and by reaching a human. */
58
+ consecutiveRejections: number;
59
+ /** The reachability bound's count: total rejections since a person was last involved. */
60
+ rejectionsSinceHuman: number;
61
+ /** {@link MAX_CONSECUTIVE_REJECTIONS}. */
62
+ maxConsecutive: number;
63
+ /** {@link MAX_REJECTIONS_BEFORE_HUMAN}. */
64
+ maxBeforeHuman: number;
65
+ }
66
+ /**
67
+ * §5.1 — how many of the user's most recent messages the runner keeps for the rater. The prompt
68
+ * builder takes the last 5 of whatever it is handed and truncates each; this is the runner's own
69
+ * retention bound, so an unbounded conversation does not accumulate here.
70
+ *
71
+ * Deliberately larger than the builder's window: the builder drops blank messages *before* taking
72
+ * its five, and it can only drop what it was given, so keeping a little slack is what stops a run of
73
+ * empty turns from spending the budget that carries the mandate.
74
+ */
75
+ export declare const NEGOTIATION_USER_MESSAGE_RETENTION = 10;
76
+ /**
77
+ * The per-session state of §5's negotiation: one instance per {@link
78
+ * import('../GthAgentRunner.js').GthAgentRunner}.
79
+ *
80
+ * Every mutation is one of four events, and naming them is what keeps the two bounds from being
81
+ * confused with each other:
82
+ *
83
+ * | event | transcript | consecutive | since-human |
84
+ * |---|---|---|---|
85
+ * | a rejection ({@link recordRejection}) | append | +1 | +1 |
86
+ * | the gate approved a call ({@link noteProgress}) | **cleared** | 0 | unchanged |
87
+ * | a human was reached ({@link humanReached}) | cleared | 0 | **0** |
88
+ * | the run halted ({@link humanReached}) | cleared | 0 | 0 |
89
+ */
90
+ export declare class ShellNegotiationState {
91
+ /** §5.1's transcript: every round of the CURRENT negotiation, oldest first. */
92
+ private rounds;
93
+ /** §5.3's consecutive-rejection count. Shares the transcript's lifetime, by construction. */
94
+ private consecutive;
95
+ /** The reachability bound's count. Cleared ONLY by {@link humanReached}. */
96
+ private sinceHuman;
97
+ /** §5.1's last user messages, oldest first, capped at {@link NEGOTIATION_USER_MESSAGE_RETENTION}. */
98
+ private userMessages;
99
+ /**
100
+ * §5.1 — the context for the rating about to be made: the justification the agent supplied for
101
+ * *this* command, the user messages, and the rounds so far.
102
+ *
103
+ * Handed over raw. The prompt builder owns every bound and every transform (last 5, truncation,
104
+ * home-folding, one-lining, tag neutralisation), so a caller that pre-processes anything here is
105
+ * doing the work twice and differently.
106
+ *
107
+ * An empty negotiation has no privileged spelling on the builder's side, so this always returns an
108
+ * object and never `undefined`: a cleared transcript IS the round-1 case, with no `if` at the call
109
+ * site — which is exactly what makes §5.6's *"a cleared transcript means a round-1 context"* fall
110
+ * out of the reset rather than out of a second branch that could disagree with it.
111
+ *
112
+ * **Everything except the command is admitted from round 2, never at round 1**, and the transcript
113
+ * is what decides which round this is. §5.1 is unambiguous — *"Round 1 sees the command alone —
114
+ * nothing else"* — and §5.6 spells out the consequence for the round right after a reset: *"the
115
+ * command and nothing else — no transcript, no user messages, because that is what round 1 means"*.
116
+ *
117
+ * Keying them on the transcript rather than on a flag is what makes those two sentences the same
118
+ * fact, and it is why the justification is withheld by the same test rather than passed straight
119
+ * through. §5.1 lists the justification under what *"from round 2 the rater additionally sees"*,
120
+ * and it is the one channel the design allows to LOWER an outcome — so a justification volunteered
121
+ * before any rejection has happened would open that channel on the first attempt, pre-emptively,
122
+ * for the agent or for anything that has injected into the agent's context. Withholding it until
123
+ * round 2 is what the spec's ordering buys, and a round-1 context is byte-identical to a plain
124
+ * rating because of it.
125
+ *
126
+ * The messages and the volunteered justification are NOT destroyed by a reset (they are the
127
+ * conversation and the pending call's own argument, not the exchange), so §5.6's convergence still
128
+ * works: the reply *"just the last two"* is out of view for the round-1 rating after the reset and
129
+ * in view for the round-2 rating that follows it — which is exactly the row the spec's table shows
130
+ * it arriving on. A justification the agent supplies again with its next attempt is admitted then,
131
+ * because by then there is a rejection for it to answer.
132
+ */
133
+ contextFor(justification?: string): RaterNegotiationContext;
134
+ /**
135
+ * Record a rejected round and decide whether another may be served.
136
+ *
137
+ * **The round is appended BEFORE either bound is tested**, so the rating that escalates is itself
138
+ * on the transcript the human sees. §5.6's escalation example turns on this: what matters on the
139
+ * screen is that the agent proposed the same command three times, and the third proposal is the
140
+ * one being escalated. {@link renderNegotiationRows} marks that last round as the pending request
141
+ * rather than as a prior one, which is the half of this the reader needs and cannot derive.
142
+ */
143
+ recordRejection(round: RaterNegotiationRound): NegotiationVerdict;
144
+ /**
145
+ * §5.3 — a tool call the gate let through. Resets the consecutive counter **and clears the
146
+ * transcript with it**; the reachability bound is deliberately untouched.
147
+ *
148
+ * **What it must NOT truncate is the human's record of how hard the agent pushed.** The counter's
149
+ * reset is §5.3's and is sound; the reader at an escalation is asking a different question, and
150
+ * the answer to theirs is {@link NegotiationCounters.rejectionsSinceHuman}, which this leaves
151
+ * standing. {@link renderNegotiationRows} reports that count rather than the surviving rounds, so
152
+ * an argument this erased is still declared even though its rounds are gone; every erased round
153
+ * itself survives whole in [[TUI-C27]]'s archive, which captures per RATING CALL and so is not
154
+ * truncated by anything here.
155
+ *
156
+ * **"Approved" is what the gate can observe, and it is not quite §5.3's "successful".** The
157
+ * decision site sees whether a call was allowed to run, never whether it then exited zero — and
158
+ * the honest alternatives were worse: a tool-result stream carries the *rejected* call's own
159
+ * result too, so counting results would let a rejection reset the counter that exists to bound it.
160
+ * Erring here is permissive on this bound alone, which is precisely what
161
+ * {@link MAX_REJECTIONS_BEFORE_HUMAN} is monotonic for.
162
+ */
163
+ noteProgress(): void;
164
+ /**
165
+ * A human was actually reached — an escalation presented to them, a new user turn, or a run that
166
+ * ended. Clears everything, including the reachability bound: §5.3's *"three rejections end the
167
+ * negotiation"* means the exchange is over, not merely paused.
168
+ */
169
+ humanReached(): void;
170
+ /**
171
+ * §5.1 — record what the user said, oldest first, for the ratings of this and later turns.
172
+ *
173
+ * Blank messages are dropped here as well as by the builder: an empty turn carries nothing a rater
174
+ * can weigh, and keeping it would spend a retention slot that the message carrying the mandate
175
+ * needs.
176
+ *
177
+ * **A message already retained moves to the newest position rather than being stored twice**, and
178
+ * that is not tidiness. The runner cannot tell "this turn's new message" from "the whole
179
+ * conversation replayed", because both arrive as the same argument — `runtime/conversation.ts`
180
+ * replays the accumulated array on every turn, while the TUI and the readline session pass the one
181
+ * new message. Appending blindly would fill §5.1's five-message window with repeats of the same
182
+ * sentence for the replaying caller, starving the rater of the one context it is allowed. Keeping
183
+ * the newest position is also the right answer when a user genuinely repeats themselves: it is one
184
+ * thing they said, and it was said most recently.
185
+ */
186
+ noteUserMessages(messages: readonly string[]): void;
187
+ /**
188
+ * §6 — the rounds to show the human, oldest first. A snapshot: the caller holds it across the
189
+ * {@link humanReached} that immediately follows, and nothing it holds may change underneath it.
190
+ */
191
+ transcript(): readonly RaterNegotiationRound[];
192
+ /**
193
+ * [[TUI-C27]] — where this negotiation stands against both bounds, for the `/debug-dump` archive.
194
+ *
195
+ * **There is a real reader for this now, which is what changed.** `sinceHuman` had no accessor
196
+ * because the only thing that wanted it was a spec, and a getter in production for a spec-only
197
+ * reader is a widened class with nothing behind it (`shellNegotiation.spec.ts` reaches it through
198
+ * a cast for exactly that reason, and still does). The archive is a production reader: *"the call
199
+ * was rejected"* and *"the call was the third consecutive rejection, so the next one goes to a
200
+ * person"* are different facts, and a bug report carrying only the first invites the wrong
201
+ * conclusion about why a session started interrupting.
202
+ *
203
+ * **`rejectionsSinceHuman` is also what the escalation prompt COUNTS**, and that is the one place
204
+ * it faces a person rather than a debugging archive. It is read at the escalation site before
205
+ * {@link humanReached} spends it; reading it after would report zero.
206
+ */
207
+ counters(): NegotiationCounters;
208
+ /** Drop everything, including the user messages — the TUI's `/clear` rotates the thread. */
209
+ clear(): void;
210
+ }
211
+ /**
212
+ * §5.4 — **who is speaking on one row of the transcript**, so a surface can colour the two voices
213
+ * apart. §5.4 requires the rater's turns to be yellow *precisely so the two are never confused*,
214
+ * and a renderer that hands back one joined string cannot express that: both surfaces painted the
215
+ * whole exchange in a single colour, which is the thing the spec forbids.
216
+ *
217
+ * - `chrome` — this renderer's own words (the heading).
218
+ * - `agent` — what the agent proposed, and the justification it gave for it.
219
+ * - `rater` — the rating that answered.
220
+ */
221
+ export type NegotiationVoice = 'chrome' | 'agent' | 'rater';
222
+ /** One terminal row of a rendered negotiation, tagged with whose turn it is. */
223
+ export interface NegotiationRow {
224
+ voice: NegotiationVoice;
225
+ text: string;
226
+ }
227
+ /**
228
+ * Terminal rows one element of a round — the command, the justification, the rater's answer — may
229
+ * occupy on a screen before the rest of it is elided.
230
+ *
231
+ * **MEASURED, and it is the height bound this block needs rather than a cap on rounds.** At 80
232
+ * columns three rounds of paragraph-length argument cost 37 rows, of which one round was 12; the
233
+ * whole prompt was 64 rows against a 20-row budget, so the human saw the command and the verdict
234
+ * and neither the later rounds nor the menu line. A cap on the NUMBER of rounds would have changed
235
+ * none of that — §5.3 already bounds the transcript at
236
+ * {@link MAX_CONSECUTIVE_REJECTIONS} — because the cost is per row, not per round. Bounding each
237
+ * element keeps every round structurally on the screen, which is what §5.6 calls the most important
238
+ * thing on it, and pays for it out of the tail of a paragraph the reader was never going to need in
239
+ * full: the archive keeps every round whole ([[TUI-C27]]'s capture is per rating call).
240
+ *
241
+ * Two rather than one so a wrapped command keeps the continuation that shows how it differs from
242
+ * the round above it — the comparison the block exists to make.
243
+ */
244
+ export declare const NEGOTIATION_MAX_ROWS_PER_ELEMENT = 2;
245
+ /**
246
+ * Rounds a screen shows, newest last. A backstop rather than today's binding constraint: §5.3
247
+ * escalates at {@link MAX_CONSECUTIVE_REJECTIONS}, so a transcript reaching a human is never longer
248
+ * than this — and an unscrollable prompt must not acquire an unbounded section the moment that
249
+ * number is raised. What is dropped is said out loud in the heading, which carries the true count.
250
+ */
251
+ export declare const NEGOTIATION_MAX_ROUNDS_SHOWN = 3;
252
+ /**
253
+ * §6/§5.4 — render a negotiation for the human being asked to rule on it, one terminal row per
254
+ * element, each tagged with the voice speaking it.
255
+ *
256
+ * **The whole exchange is shown, never only the last attempt.** *That the agent proposed
257
+ * `git reset --hard origin/main` three times unchanged, against two rejections that each told it
258
+ * what to fix, is itself the most important thing on the screen, and it is invisible if only the
259
+ * last attempt is shown.* A prompt that shows the final command alone asks the user to rule on a
260
+ * command; this asks them to rule on an argument, which is the decision they actually have.
261
+ *
262
+ * Empty when there are no rounds, so a surface renders no heading over an argument that never
263
+ * happened (`catastrophic`, a declared escalate entry, an unrated rung).
264
+ *
265
+ * **`width` is optional and means "bind the rows to this terminal".** Given one, every row returned
266
+ * fits it under either ambiguous-width policy — measured with the same conservative ruler
267
+ * `core/shell/framing` budgets with, never `.length`, because a row measured as fitting that does
268
+ * not fit is a row the terminal wraps back to column 0. Omitted, rows are returned unwrapped, which
269
+ * is what the §6.2 non-interactive message wants: it is prose in an exception, not a screen.
270
+ *
271
+ * A wrapped row keeps the voice of the row it continues. A continuation painted as chrome would put
272
+ * the rater's words in the agent's colour at exactly the width where a long argument is hardest to
273
+ * read, which is the confusion §5.4 exists to remove.
274
+ *
275
+ * ## The three things this block must not get wrong about its own exchange
276
+ *
277
+ * Every label here sits over data that is already correct, so a label that lies does so silently —
278
+ * and each of these lied toward approving, at the moment a human was deciding whether to overrule
279
+ * a refusal.
280
+ *
281
+ * - **`attempts` is the count, and it is not `rounds.length`.** §5.3 clears the transcript on an
282
+ * approved call, so the rounds handed over are the attempts since the last *approval*, while the
283
+ * fact the reader is weighing is how hard the agent pushed since the last *human* — the caller's
284
+ * `rejectionsSinceHuman`. A measured escalation attempted the same command five times and
285
+ * rendered three. Omit it and this falls back to `rounds.length`, which is the honest reading of
286
+ * a caller that has no better number rather than a claim that none were erased.
287
+ * - **The last round IS the pending rating, not a prior one.** {@link
288
+ * ShellNegotiationState.recordRejection} appends before either bound is tested, deliberately, so
289
+ * that the rating being escalated is on the transcript the human sees. The old heading called
290
+ * them all prior rounds, which both under-reported the argument and put the pending command on
291
+ * the screen twice with nothing saying they were the same call.
292
+ * - **The first round was rated on the command alone.** A cleared transcript IS the round-1 case
293
+ * (see {@link ShellNegotiationState.contextFor}), so §5.1 withheld the justification and the user
294
+ * messages from that rating — while {@link ShellNegotiationState.recordRejection} stores the
295
+ * justification the agent supplied whatever the round. Printed unmarked, the round reads as a
296
+ * rater brushing past a direct answer to its own objection, which is the opposite of what
297
+ * happened and makes the rater look stubborn exactly where the reader is deciding whether to
298
+ * overrule it. The withholding is correct and is not what this marks. The same marker answers
299
+ * *"were the user's own words in view when this was rated?"* — a justification claiming the user
300
+ * asked for a command is exactly what a round-1 rating cannot check, and the user's messages are
301
+ * several rows on a surface with none to spare.
302
+ *
303
+ * **The prompt this feeds does not scroll and nothing else on it can give up rows**, so the height
304
+ * bound is {@link NEGOTIATION_MAX_ROWS_PER_ELEMENT} and every fact above is carried by a row that
305
+ * already exists.
306
+ */
307
+ export declare function renderNegotiationRows(rounds: readonly RaterNegotiationRound[], options?: {
308
+ width?: number;
309
+ /**
310
+ * Rejected attempts since a human was last involved — `rejectionsSinceHuman` from {@link
311
+ * ShellNegotiationState.counters}, read BEFORE the escalation spends it.
312
+ */
313
+ attempts?: number;
314
+ }): NegotiationRow[];
315
+ /**
316
+ * The same transcript as one string, for a consumer with no screen to lay it out on: §6.2's
317
+ * non-interactive escalation message, where the exchange goes into an exception because that
318
+ * message is the only thing anyone sees on that path.
319
+ *
320
+ * Defined as {@link renderNegotiationRows} joined, so the string and the rows can never come to
321
+ * describe one exchange two ways — the whole reason there is one renderer and two surfaces.
322
+ * `null` when there is nothing to show.
323
+ *
324
+ * `attempts` carries the same fact it carries on a screen. It is the one thing a caller must pass
325
+ * for this message to be true, because the count it defaults to is the one an approved call
326
+ * truncated.
327
+ */
328
+ export declare function renderNegotiationTranscript(rounds: readonly RaterNegotiationRound[], attempts?: number): string | null;