talos-code 0.0.1 → 0.2.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 (407) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/LICENSE +661 -0
  3. package/README.md +116 -3
  4. package/THIRD_PARTY_NOTICES.md +40 -0
  5. package/dist/archive/zip.js +73 -0
  6. package/dist/args.js +100 -0
  7. package/dist/automations/history-store.js +34 -0
  8. package/dist/automations/policy-store.js +43 -0
  9. package/dist/automations/runner.js +107 -0
  10. package/dist/automations/schedule.js +85 -0
  11. package/dist/automations/windows-task.js +53 -0
  12. package/dist/commands/advanced-cli.js +233 -0
  13. package/dist/commands/checkpoint-cli.js +45 -0
  14. package/dist/commands/config-cli.js +107 -0
  15. package/dist/commands/context.js +17 -0
  16. package/dist/commands/extensions-cli.js +207 -0
  17. package/dist/commands/project-cli.js +74 -0
  18. package/dist/commands/project-commands.js +143 -0
  19. package/dist/commands/provider-cli.js +244 -0
  20. package/dist/commands/services-cli.js +248 -0
  21. package/dist/commands/session-cli.js +171 -0
  22. package/dist/commands/system-cli.js +405 -0
  23. package/dist/config/commands.js +60 -0
  24. package/dist/config/load.js +382 -0
  25. package/dist/config/migrations.js +48 -0
  26. package/dist/config/types.js +11 -0
  27. package/dist/diagnostics/development-log.js +154 -0
  28. package/dist/diagnostics/doctor.js +104 -0
  29. package/dist/diagnostics/redact.js +80 -0
  30. package/dist/diagnostics/zip.js +52 -0
  31. package/dist/errors.js +156 -0
  32. package/dist/events/bridge.js +130 -0
  33. package/dist/extensions/installer.js +178 -0
  34. package/dist/extensions/package-schema.js +24 -0
  35. package/dist/headless/result.js +84 -0
  36. package/dist/headless/run.js +230 -0
  37. package/dist/i18n/en/approval.js +46 -0
  38. package/dist/i18n/en/common.js +9 -0
  39. package/dist/i18n/en/credentials.js +92 -0
  40. package/dist/i18n/en/errors.js +267 -0
  41. package/dist/i18n/en/firstrun.js +101 -0
  42. package/dist/i18n/en/providers.js +37 -0
  43. package/dist/i18n/en/screen.js +774 -0
  44. package/dist/i18n/en/tools.js +127 -0
  45. package/dist/i18n/en.js +14 -0
  46. package/dist/i18n/error-view.js +307 -0
  47. package/dist/i18n/index.js +19 -0
  48. package/dist/i18n/kernel-map.js +139 -0
  49. package/dist/io.js +45 -0
  50. package/dist/main.js +331 -0
  51. package/dist/paths.js +41 -0
  52. package/dist/protocol/v2/codec.js +9 -0
  53. package/dist/protocol/v2/events.js +555 -0
  54. package/dist/protocol/v2/index.js +4 -0
  55. package/dist/protocol/v2/replay.js +28 -0
  56. package/dist/protocol/v2/types.js +1 -0
  57. package/dist/provider/control-plane.js +135 -0
  58. package/dist/provider/environment-keys.js +275 -0
  59. package/dist/provider/health.js +110 -0
  60. package/dist/provider/missing-key.js +48 -0
  61. package/dist/provider/model-catalog.js +168 -0
  62. package/dist/provider/openrouter-login.js +172 -0
  63. package/dist/provider/provider-text.js +13 -0
  64. package/dist/provider/store.js +95 -0
  65. package/dist/provider/system-keyring.js +214 -0
  66. package/dist/runtime/active-run.js +63 -0
  67. package/dist/runtime/agent-tree.js +74 -0
  68. package/dist/runtime/attachments.js +84 -0
  69. package/dist/runtime/brokered-executor.js +395 -0
  70. package/dist/runtime/context-archive.js +69 -0
  71. package/dist/runtime/context-status.js +76 -0
  72. package/dist/runtime/create-runtime.js +111 -0
  73. package/dist/runtime/model-profile.js +361 -0
  74. package/dist/runtime/output-store.js +137 -0
  75. package/dist/runtime/provider-attempts.js +185 -0
  76. package/dist/runtime/replay-buffer.js +153 -0
  77. package/dist/runtime/repo.js +95 -0
  78. package/dist/runtime/session-facade.js +135 -0
  79. package/dist/runtime/session-summary.js +125 -0
  80. package/dist/runtime/supervisor.js +265 -0
  81. package/dist/runtime/talos-composition.js +1011 -0
  82. package/dist/runtime/types.js +5 -0
  83. package/dist/runtime/usage-snapshot.js +82 -0
  84. package/dist/security/auto-classifier.js +38 -0
  85. package/dist/security/credential-free-environment.js +54 -0
  86. package/dist/security/evaluate.js +243 -0
  87. package/dist/security/execution-backends.js +236 -0
  88. package/dist/security/execution-broker.js +102 -0
  89. package/dist/security/forge-scan.js +74 -0
  90. package/dist/security/from-approval.js +39 -0
  91. package/dist/security/mxc-execution-backend.js +281 -0
  92. package/dist/security/permission-engine.js +138 -0
  93. package/dist/security/permission-explanation.js +54 -0
  94. package/dist/security/persist.js +179 -0
  95. package/dist/security/plugin-guard.js +230 -0
  96. package/dist/security/process-tree-evidence-store.js +74 -0
  97. package/dist/security/process-tree-probe.js +554 -0
  98. package/dist/security/project-resource-inventory.js +186 -0
  99. package/dist/security/project-trust-gate.js +38 -0
  100. package/dist/security/project-trust.js +367 -0
  101. package/dist/security/rule-parser.js +201 -0
  102. package/dist/security/shell-segmentation.js +68 -0
  103. package/dist/security/trust-authority.js +324 -0
  104. package/dist/security/types.js +1 -0
  105. package/dist/security/workspace-identity.js +102 -0
  106. package/dist/services/automation-facade.js +59 -0
  107. package/dist/services/forge-facade.js +77 -0
  108. package/dist/services/hook-facade.js +240 -0
  109. package/dist/services/index.js +16 -0
  110. package/dist/services/library-facade.js +174 -0
  111. package/dist/services/mcp-facade.js +348 -0
  112. package/dist/services/memory-facade.js +126 -0
  113. package/dist/services/notes-facade.js +157 -0
  114. package/dist/services/plugin-facade.js +308 -0
  115. package/dist/services/research-facade.js +110 -0
  116. package/dist/services/task-board-facade.js +236 -0
  117. package/dist/services/workflow-catalog.js +246 -0
  118. package/dist/sessions/export-format.js +98 -0
  119. package/dist/sessions/metadata-store.js +160 -0
  120. package/dist/sessions/share.js +122 -0
  121. package/dist/sessions/transfer.js +16 -0
  122. package/dist/subcommands.js +62 -0
  123. package/dist/tui/agent-roster.js +36 -0
  124. package/dist/tui/agent-view.js +51 -0
  125. package/dist/tui/app.js +4098 -0
  126. package/dist/tui/approval.js +36 -0
  127. package/dist/tui/boot/boot-sequence.js +76 -0
  128. package/dist/tui/boot/cinematic.js +243 -0
  129. package/dist/tui/boot/desktop-logo.js +82 -0
  130. package/dist/tui/boot.js +3 -0
  131. package/dist/tui/busy-input.js +58 -0
  132. package/dist/tui/catalog-service.js +560 -0
  133. package/dist/tui/components/assistant-stream.js +1 -0
  134. package/dist/tui/components/command-menu.js +68 -0
  135. package/dist/tui/components/composer.js +219 -0
  136. package/dist/tui/components/diff.js +35 -0
  137. package/dist/tui/components/footer.js +48 -0
  138. package/dist/tui/components/header.js +6 -0
  139. package/dist/tui/components/markdown.js +305 -0
  140. package/dist/tui/components/status-indicator.js +38 -0
  141. package/dist/tui/components/terminal-shell.js +214 -0
  142. package/dist/tui/components/thinking-row.js +19 -0
  143. package/dist/tui/components/tool-row.js +97 -0
  144. package/dist/tui/components/transcript-virtualizer.js +165 -0
  145. package/dist/tui/components/transcript.js +43 -0
  146. package/dist/tui/descendant-approvals.js +104 -0
  147. package/dist/tui/diff-model.js +77 -0
  148. package/dist/tui/editor-history.js +21 -0
  149. package/dist/tui/editor.js +210 -0
  150. package/dist/tui/event-adapter.js +436 -0
  151. package/dist/tui/exit-output.js +58 -0
  152. package/dist/tui/external-editor.js +53 -0
  153. package/dist/tui/file-completion.js +89 -0
  154. package/dist/tui/focus-manager.js +5 -0
  155. package/dist/tui/highlight.js +30 -0
  156. package/dist/tui/input-router.js +18 -0
  157. package/dist/tui/interrupt.js +99 -0
  158. package/dist/tui/keybindings.js +194 -0
  159. package/dist/tui/keymap-resolver.js +91 -0
  160. package/dist/tui/launch-state.js +148 -0
  161. package/dist/tui/line-diff.js +57 -0
  162. package/dist/tui/live-activity.js +56 -0
  163. package/dist/tui/metrics.js +123 -0
  164. package/dist/tui/onboarding.js +36 -0
  165. package/dist/tui/overlays/agent-tree.js +43 -0
  166. package/dist/tui/overlays/approval-dialog.js +642 -0
  167. package/dist/tui/overlays/automation-center.js +51 -0
  168. package/dist/tui/overlays/checkpoint-picker.js +47 -0
  169. package/dist/tui/overlays/context-inspector.js +36 -0
  170. package/dist/tui/overlays/effort-line.js +110 -0
  171. package/dist/tui/overlays/forge-center.js +46 -0
  172. package/dist/tui/overlays/help-dialog.js +16 -0
  173. package/dist/tui/overlays/history-picker.js +37 -0
  174. package/dist/tui/overlays/hook-center.js +70 -0
  175. package/dist/tui/overlays/library-center.js +55 -0
  176. package/dist/tui/overlays/mcp-center.js +60 -0
  177. package/dist/tui/overlays/memory-center.js +63 -0
  178. package/dist/tui/overlays/model-picker.js +77 -0
  179. package/dist/tui/overlays/notes-center.js +53 -0
  180. package/dist/tui/overlays/overlay-host.js +8 -0
  181. package/dist/tui/overlays/plugin-center.js +76 -0
  182. package/dist/tui/overlays/provider-picker.js +171 -0
  183. package/dist/tui/overlays/queue-editor.js +32 -0
  184. package/dist/tui/overlays/research-center.js +59 -0
  185. package/dist/tui/overlays/scroll-window.js +234 -0
  186. package/dist/tui/overlays/session-picker.js +115 -0
  187. package/dist/tui/overlays/tasks-center.js +83 -0
  188. package/dist/tui/overlays/theme-picker.js +21 -0
  189. package/dist/tui/overlays/transcript-search.js +58 -0
  190. package/dist/tui/overlays/trust-center.js +29 -0
  191. package/dist/tui/overlays/workflow-center.js +46 -0
  192. package/dist/tui/project-file-index.js +214 -0
  193. package/dist/tui/project-references.js +85 -0
  194. package/dist/tui/project-trust-prompt.js +289 -0
  195. package/dist/tui/prompt-history-store.js +116 -0
  196. package/dist/tui/queue-store.js +110 -0
  197. package/dist/tui/regions/budget.js +59 -0
  198. package/dist/tui/regions/views.js +96 -0
  199. package/dist/tui/render-coordinator.js +148 -0
  200. package/dist/tui/render-scheduler.js +4 -0
  201. package/dist/tui/run.js +69 -0
  202. package/dist/tui/selection-list.js +29 -0
  203. package/dist/tui/session-controller.js +791 -0
  204. package/dist/tui/session-export.js +54 -0
  205. package/dist/tui/setup-wizard.js +46 -0
  206. package/dist/tui/shell-input.js +35 -0
  207. package/dist/tui/shell-layout.js +48 -0
  208. package/dist/tui/shell-model.js +98 -0
  209. package/dist/tui/slash-commands.js +82 -0
  210. package/dist/tui/state.js +151 -0
  211. package/dist/tui/status-bar.js +125 -0
  212. package/dist/tui/status-view.js +40 -0
  213. package/dist/tui/terminal-capabilities.js +9 -0
  214. package/dist/tui/terminal-session.js +11 -0
  215. package/dist/tui/text-width.js +66 -0
  216. package/dist/tui/theme-catalog.js +27 -0
  217. package/dist/tui/theme-store.js +23 -0
  218. package/dist/tui/theme.js +23 -0
  219. package/dist/tui/tool-display.js +135 -0
  220. package/dist/tui/tool-facts.js +1 -0
  221. package/dist/tui/tools/bash-renderer.js +32 -0
  222. package/dist/tui/tools/change.js +61 -0
  223. package/dist/tui/tools/edit-renderer.js +17 -0
  224. package/dist/tui/tools/generic-renderer.js +13 -0
  225. package/dist/tui/tools/list-renderer.js +14 -0
  226. package/dist/tui/tools/read-renderer.js +13 -0
  227. package/dist/tui/tools/registry.js +20 -0
  228. package/dist/tui/tools/row-format.js +187 -0
  229. package/dist/tui/tools/search-renderer.js +38 -0
  230. package/dist/tui/tools/shared.js +97 -0
  231. package/dist/tui/tools/write-renderer.js +15 -0
  232. package/dist/tui/transcript-model.js +441 -0
  233. package/dist/tui/ui-preferences.js +79 -0
  234. package/dist/tui/usage-view.js +77 -0
  235. package/dist/tui/vim-mode.js +99 -0
  236. package/dist/update/check.js +15 -0
  237. package/dist/update/npm.js +51 -0
  238. package/dist/update/run.js +129 -0
  239. package/dist/version.js +2 -0
  240. package/dist/workspace/checkpoint-store.js +210 -0
  241. package/dist/workspace/checkpoint.js +413 -0
  242. package/dist/workspace/restore.js +232 -0
  243. package/package.json +64 -5
  244. package/vendor/context-engine/package.json +11 -0
  245. package/vendor/context-engine/src/compaction-planner.mjs +57 -0
  246. package/vendor/context-engine/src/contracts.mjs +48 -0
  247. package/vendor/context-engine/src/engine.mjs +445 -0
  248. package/vendor/context-engine/src/node/context-export.mjs +164 -0
  249. package/vendor/context-engine/src/node/legacy-import.mjs +92 -0
  250. package/vendor/context-engine/src/node/migrations/001-context.sql +126 -0
  251. package/vendor/context-engine/src/node/sqlite-store.mjs +85 -0
  252. package/vendor/context-engine/src/node/sqlite-worker.mjs +559 -0
  253. package/vendor/context-engine/src/profiles.mjs +10 -0
  254. package/vendor/context-engine/src/retrieval.mjs +104 -0
  255. package/vendor/context-engine/src/summary.mjs +97 -0
  256. package/vendor/context-engine/src/usage.mjs +34 -0
  257. package/vendor/harness-ui/package.json +38 -0
  258. package/vendor/harness-ui/src/acp-agent.mjs +350 -0
  259. package/vendor/harness-ui/src/agent-service.mjs +2188 -0
  260. package/vendor/harness-ui/src/agui-events.mjs +452 -0
  261. package/vendor/harness-ui/src/ambiente-solo-server.mjs +121 -0
  262. package/vendor/harness-ui/src/artifact-store.mjs +39 -0
  263. package/vendor/harness-ui/src/assistenza.mjs +123 -0
  264. package/vendor/harness-ui/src/automation-scheduler.mjs +69 -0
  265. package/vendor/harness-ui/src/automation-store.mjs +145 -0
  266. package/vendor/harness-ui/src/browser-annota.mjs +639 -0
  267. package/vendor/harness-ui/src/browser-frame.mjs +211 -0
  268. package/vendor/harness-ui/src/browser-proxy-universale.mjs +519 -0
  269. package/vendor/harness-ui/src/browser-proxy.mjs +87 -0
  270. package/vendor/harness-ui/src/browser-sessione-viva.mjs +329 -0
  271. package/vendor/harness-ui/src/browser-stream.mjs +445 -0
  272. package/vendor/harness-ui/src/browser-vivo.mjs +694 -0
  273. package/vendor/harness-ui/src/chat-image-attachments.mjs +72 -0
  274. package/vendor/harness-ui/src/config.mjs +697 -0
  275. package/vendor/harness-ui/src/contesto-del-progetto.mjs +385 -0
  276. package/vendor/harness-ui/src/context-asset-adapter.mjs +72 -0
  277. package/vendor/harness-ui/src/context-desktop-service.mjs +253 -0
  278. package/vendor/harness-ui/src/context-embedding-runtime.mjs +252 -0
  279. package/vendor/harness-ui/src/context-inference-scheduler.mjs +81 -0
  280. package/vendor/harness-ui/src/context-native-compaction.mjs +75 -0
  281. package/vendor/harness-ui/src/context-provider-adapter.mjs +141 -0
  282. package/vendor/harness-ui/src/context-runtime.mjs +118 -0
  283. package/vendor/harness-ui/src/context-token-counters.mjs +184 -0
  284. package/vendor/harness-ui/src/context-tool-catalog.mjs +86 -0
  285. package/vendor/harness-ui/src/context-tool-output.mjs +72 -0
  286. package/vendor/harness-ui/src/costo-elenco.mjs +252 -0
  287. package/vendor/harness-ui/src/custom-task.mjs +171 -0
  288. package/vendor/harness-ui/src/doctor.mjs +142 -0
  289. package/vendor/harness-ui/src/document-filename.mjs +97 -0
  290. package/vendor/harness-ui/src/document-generator.mjs +493 -0
  291. package/vendor/harness-ui/src/document-report.mjs +331 -0
  292. package/vendor/harness-ui/src/duckduckgo-search.mjs +155 -0
  293. package/vendor/harness-ui/src/elenco-profondo.mjs +337 -0
  294. package/vendor/harness-ui/src/favicon-proxy.mjs +113 -0
  295. package/vendor/harness-ui/src/forge-contract.mjs +221 -0
  296. package/vendor/harness-ui/src/frequent-dirs.mjs +134 -0
  297. package/vendor/harness-ui/src/generated-image-store.mjs +147 -0
  298. package/vendor/harness-ui/src/generation-idle.mjs +332 -0
  299. package/vendor/harness-ui/src/gguf-header.mjs +207 -0
  300. package/vendor/harness-ui/src/git-service.mjs +626 -0
  301. package/vendor/harness-ui/src/gitignore-elenco.mjs +604 -0
  302. package/vendor/harness-ui/src/harness-receipt-keypair.mjs +207 -0
  303. package/vendor/harness-ui/src/hf-direct-transfer.mjs +170 -0
  304. package/vendor/harness-ui/src/hf-hub-client.mjs +106 -0
  305. package/vendor/harness-ui/src/hf-image-proxy.mjs +105 -0
  306. package/vendor/harness-ui/src/hf-model-transfer.mjs +245 -0
  307. package/vendor/harness-ui/src/hook-registry.mjs +186 -0
  308. package/vendor/harness-ui/src/http-app.mjs +6259 -0
  309. package/vendor/harness-ui/src/http-lifecycle.mjs +132 -0
  310. package/vendor/harness-ui/src/id-archivio.mjs +27 -0
  311. package/vendor/harness-ui/src/image-generator.mjs +143 -0
  312. package/vendor/harness-ui/src/istruzioni-di-progetto.mjs +234 -0
  313. package/vendor/harness-ui/src/kernel/dist/kernelPerIlBanco.js +518 -0
  314. package/vendor/harness-ui/src/kernel/talosHarness.mjs +10437 -0
  315. package/vendor/harness-ui/src/library-policy-store.mjs +175 -0
  316. package/vendor/harness-ui/src/library-store.mjs +652 -0
  317. package/vendor/harness-ui/src/llama-server-supervisor.mjs +629 -0
  318. package/vendor/harness-ui/src/local-model-store.mjs +339 -0
  319. package/vendor/harness-ui/src/local-runtime-contract.mjs +66 -0
  320. package/vendor/harness-ui/src/local-runtime-events.mjs +44 -0
  321. package/vendor/harness-ui/src/local-runtime-llama-server.mjs +244 -0
  322. package/vendor/harness-ui/src/local-runtime-probe.mjs +401 -0
  323. package/vendor/harness-ui/src/machine-capacity.mjs +66 -0
  324. package/vendor/harness-ui/src/mappa-cartelle.mjs +491 -0
  325. package/vendor/harness-ui/src/mcp-client.mjs +98 -0
  326. package/vendor/harness-ui/src/mcp-registry.mjs +157 -0
  327. package/vendor/harness-ui/src/mcp-session.mjs +177 -0
  328. package/vendor/harness-ui/src/memory-store.mjs +227 -0
  329. package/vendor/harness-ui/src/model-catalog-models-dev.mjs +276 -0
  330. package/vendor/harness-ui/src/model-catalog.mjs +129 -0
  331. package/vendor/harness-ui/src/model-destination.mjs +189 -0
  332. package/vendor/harness-ui/src/modifica-ancorata.mjs +177 -0
  333. package/vendor/harness-ui/src/native-provider-adapter.mjs +205 -0
  334. package/vendor/harness-ui/src/notes-store.mjs +250 -0
  335. package/vendor/harness-ui/src/openai-compatible-runtime.mjs +428 -0
  336. package/vendor/harness-ui/src/openrouter-oauth.mjs +339 -0
  337. package/vendor/harness-ui/src/path-policy.mjs +442 -0
  338. package/vendor/harness-ui/src/plugin-registry.mjs +780 -0
  339. package/vendor/harness-ui/src/plugin-session.mjs +180 -0
  340. package/vendor/harness-ui/src/process-policy.mjs +345 -0
  341. package/vendor/harness-ui/src/prompt-enhancer-provider.mjs +94 -0
  342. package/vendor/harness-ui/src/provider-auth-cloud.mjs +95 -0
  343. package/vendor/harness-ui/src/provider-credential-store.mjs +541 -0
  344. package/vendor/harness-ui/src/provider-probe.mjs +582 -0
  345. package/vendor/harness-ui/src/provider-registry.mjs +1633 -0
  346. package/vendor/harness-ui/src/pty-terminal.mjs +312 -0
  347. package/vendor/harness-ui/src/public-problem.mjs +109 -0
  348. package/vendor/harness-ui/src/research/card.mjs +235 -0
  349. package/vendor/harness-ui/src/research/citations.mjs +142 -0
  350. package/vendor/harness-ui/src/research/collector.mjs +275 -0
  351. package/vendor/harness-ui/src/research/deposito-a-pezzi.mjs +139 -0
  352. package/vendor/harness-ui/src/research/dossier.mjs +114 -0
  353. package/vendor/harness-ui/src/research/esportazioni.mjs +560 -0
  354. package/vendor/harness-ui/src/research/fetch-cache.mjs +465 -0
  355. package/vendor/harness-ui/src/research/fidelity.mjs +122 -0
  356. package/vendor/harness-ui/src/research/independence.mjs +159 -0
  357. package/vendor/harness-ui/src/research/ledger.mjs +166 -0
  358. package/vendor/harness-ui/src/research/markdown-server.mjs +565 -0
  359. package/vendor/harness-ui/src/research/narration.mjs +181 -0
  360. package/vendor/harness-ui/src/research/open-cards.mjs +131 -0
  361. package/vendor/harness-ui/src/research/opposing.mjs +305 -0
  362. package/vendor/harness-ui/src/research/outline.mjs +111 -0
  363. package/vendor/harness-ui/src/research/page-budget.mjs +209 -0
  364. package/vendor/harness-ui/src/research/pdf.mjs +291 -0
  365. package/vendor/harness-ui/src/research/plan.mjs +301 -0
  366. package/vendor/harness-ui/src/research/raccolta-viva.mjs +452 -0
  367. package/vendor/harness-ui/src/research/recheck-document.mjs +69 -0
  368. package/vendor/harness-ui/src/research/recheck-history.mjs +192 -0
  369. package/vendor/harness-ui/src/research/recheck.mjs +194 -0
  370. package/vendor/harness-ui/src/research/report.mjs +203 -0
  371. package/vendor/harness-ui/src/research/run.mjs +527 -0
  372. package/vendor/harness-ui/src/research/synthesis.mjs +318 -0
  373. package/vendor/harness-ui/src/research/verification.mjs +572 -0
  374. package/vendor/harness-ui/src/research-orchestrator.mjs +2679 -0
  375. package/vendor/harness-ui/src/research-store.mjs +1133 -0
  376. package/vendor/harness-ui/src/runtime-build-manifest.mjs +26 -0
  377. package/vendor/harness-ui/src/runtime-contract.mjs +59 -0
  378. package/vendor/harness-ui/src/runtime-owner-adapter.mjs +1348 -0
  379. package/vendor/harness-ui/src/runtime-owner-contract.mjs +32 -0
  380. package/vendor/harness-ui/src/scheda-di-lavoro.mjs +249 -0
  381. package/vendor/harness-ui/src/search-source-store.mjs +172 -0
  382. package/vendor/harness-ui/src/session-registry.mjs +6095 -0
  383. package/vendor/harness-ui/src/session-store.mjs +220 -0
  384. package/vendor/harness-ui/src/sessione-pronta.mjs +73 -0
  385. package/vendor/harness-ui/src/setup-stato.mjs +31 -0
  386. package/vendor/harness-ui/src/sezioni-istruzioni.mjs +204 -0
  387. package/vendor/harness-ui/src/skill-registry.mjs +120 -0
  388. package/vendor/harness-ui/src/sse-replay-coalescente.mjs +0 -0
  389. package/vendor/harness-ui/src/static-files.mjs +96 -0
  390. package/vendor/harness-ui/src/stream-partition.mjs +123 -0
  391. package/vendor/harness-ui/src/subagent-orchestrator.mjs +453 -0
  392. package/vendor/harness-ui/src/task-catalog.mjs +65 -0
  393. package/vendor/harness-ui/src/tasks-store.mjs +220 -0
  394. package/vendor/harness-ui/src/terminal-registry.mjs +312 -0
  395. package/vendor/harness-ui/src/terminal-ws.mjs +170 -0
  396. package/vendor/harness-ui/src/tool-forge-store.mjs +299 -0
  397. package/vendor/harness-ui/src/tool-schema-normalize.mjs +100 -0
  398. package/vendor/harness-ui/src/usage-cache.mjs +315 -0
  399. package/vendor/harness-ui/src/workspace-browser.mjs +213 -0
  400. package/vendor/harness-ui/src/workspace-context.mjs +124 -0
  401. package/vendor/harness-ui/src/workspace-disk.mjs +62 -0
  402. package/vendor/harness-ui/src/workspace-files.mjs +589 -0
  403. package/vendor/harness-ui/src/workspace-info.mjs +189 -0
  404. package/vendor/harness-ui/src/workspace-launch-store.mjs +150 -0
  405. package/vendor/harness-ui/src/workspace-tree.mjs +67 -0
  406. package/vendor/harness-ui/src/workspace-watcher.mjs +161 -0
  407. package/vendor/manifest.json +170 -0
@@ -0,0 +1,127 @@
1
+ /*
2
+ * R2 lane T: tool labels and argument labels shown on screen (gate E3, Q-R2-3). Ids are keyed by the KERNEL name
3
+ * (`tool.<kernel>.label`), because the kernel name is the key the table is zipped on; the values are the only words the
4
+ * screen shows. The model keeps the kernel names and argument keys (gate E2): nothing here is sent to it.
5
+ */
6
+ export const tools = {
7
+ 'tool.unknown.label': 'Tool',
8
+ 'tool.mcp.label': '{tool} ({server} MCP)',
9
+ 'tool.plugin.label': '{tool} ({plugin} plugin)',
10
+ 'tool.forge.label': '{tool} (forged tool)',
11
+ 'tool.unknown.verb': 'Running {tool}',
12
+ 'tool.elenca.label': 'List folder', 'tool.elenca.verb': 'Listing',
13
+ 'tool.cerca.label': 'Search files', 'tool.cerca.verb': 'Searching',
14
+ 'tool.leggi.label': 'Read file', 'tool.leggi.verb': 'Reading',
15
+ 'tool.scrivi.label': 'Write file', 'tool.scrivi.verb': 'Writing',
16
+ 'tool.prova.label': 'Run tests', 'tool.prova.verb': 'Running tests',
17
+ 'tool.shell.label': 'Shell', 'tool.shell.verb': 'Running',
18
+ 'tool.naviga.label': 'Fetch web page', 'tool.naviga.verb': 'Fetching',
19
+ 'tool.web_search.label': 'Web search', 'tool.web_search.verb': 'Searching the web',
20
+ 'tool.artifact_create.label': 'Create artifact', 'tool.artifact_create.verb': 'Creating artifact',
21
+ 'tool.document_create.label': 'Create document', 'tool.document_create.verb': 'Creating document',
22
+ 'tool.time_now.label': 'Current time', 'tool.time_now.verb': 'Checking the time',
23
+ 'tool.delega_sottotask.label': 'Delegate subtask', 'tool.delega_sottotask.verb': 'Delegating',
24
+ 'tool.generate_image.label': 'Generate image', 'tool.generate_image.verb': 'Generating image',
25
+ 'tool.library_list.label': 'List library', 'tool.library_list.verb': 'Listing library',
26
+ 'tool.library_search.label': 'Search library', 'tool.library_search.verb': 'Searching library',
27
+ 'tool.library_read.label': 'Read library file', 'tool.library_read.verb': 'Reading library file',
28
+ 'tool.library_file_origin.label': 'Library file origin', 'tool.library_file_origin.verb': 'Checking file origin',
29
+ 'tool.library_rename.label': 'Rename library file', 'tool.library_rename.verb': 'Renaming library file',
30
+ 'tool.library_delete.label': 'Delete library file', 'tool.library_delete.verb': 'Deleting library file',
31
+ 'tool.library_export.label': 'Export library file', 'tool.library_export.verb': 'Exporting library file',
32
+ 'tool.library_context_policy_update.label': 'Update library policy', 'tool.library_context_policy_update.verb': 'Updating library policy',
33
+ 'tool.notes_list.label': 'List notes', 'tool.notes_list.verb': 'Listing notes',
34
+ 'tool.notes_create.label': 'Create note', 'tool.notes_create.verb': 'Creating note',
35
+ 'tool.notes_update.label': 'Update note', 'tool.notes_update.verb': 'Updating note',
36
+ 'tool.notes_delete.label': 'Delete note', 'tool.notes_delete.verb': 'Deleting note',
37
+ 'tool.tasks_list.label': 'List tasks', 'tool.tasks_list.verb': 'Listing tasks',
38
+ 'tool.tasks_create.label': 'Create task', 'tool.tasks_create.verb': 'Creating task',
39
+ 'tool.tasks_complete.label': 'Set task status', 'tool.tasks_complete.verb': 'Setting task status',
40
+ 'tool.tasks_update.label': 'Update task', 'tool.tasks_update.verb': 'Updating task',
41
+ 'tool.tasks_delete.label': 'Delete task', 'tool.tasks_delete.verb': 'Deleting task',
42
+ 'tool.memory_search.label': 'Search memory', 'tool.memory_search.verb': 'Searching memory',
43
+ 'tool.memory_write.label': 'Save memory', 'tool.memory_write.verb': 'Saving memory',
44
+ 'tool.memory_update.label': 'Update memory', 'tool.memory_update.verb': 'Updating memory',
45
+ 'tool.memory_delete.label': 'Delete memory', 'tool.memory_delete.verb': 'Deleting memory',
46
+ 'tool.research_list.label': 'List research', 'tool.research_list.verb': 'Listing research',
47
+ 'tool.research_start.label': 'Start research', 'tool.research_start.verb': 'Starting research',
48
+ 'tool.research_read.label': 'Read research', 'tool.research_read.verb': 'Reading research',
49
+ 'tool.research_rename.label': 'Rename research', 'tool.research_rename.verb': 'Renaming research',
50
+ 'tool.research_pause.label': 'Pause research', 'tool.research_pause.verb': 'Pausing research',
51
+ 'tool.research_resume.label': 'Resume research', 'tool.research_resume.verb': 'Resuming research',
52
+ 'tool.research_cancel.label': 'Cancel research', 'tool.research_cancel.verb': 'Cancelling research',
53
+ 'tool.research_delete.label': 'Delete research', 'tool.research_delete.verb': 'Deleting research',
54
+ 'tool.research_deposit.label': 'Submit research report', 'tool.research_deposit.verb': 'Submitting research report',
55
+ 'tool.tool_create.label': 'Create tool', 'tool.tool_create.verb': 'Creating tool',
56
+ 'tool.file_edit.label': 'Edit file', 'tool.file_edit.verb': 'Editing',
57
+ 'tool.carica_skill.label': 'Load skill', 'tool.carica_skill.verb': 'Loading skill',
58
+ /* The 11 Italian argument keys of gate §1.3, and the English keys whose code spelling is not a word. Any other key
59
+ is shown humanised (snake_case and camelCase → words). */
60
+ 'tool.arg.percorso': 'path', 'tool.arg.contenuto': 'content', 'tool.arg.comando': 'command', 'tool.arg.descrizione': 'description',
61
+ 'tool.arg.testo': 'text', 'tool.arg.nome': 'name', 'tool.arg.titolo': 'title', 'tool.arg.cartella': 'folder', 'tool.arg.parte': 'part',
62
+ 'tool.arg.affermazioni': 'claims', 'tool.arg.fonti': 'sources',
63
+ 'tool.arg.old_string': 'old text', 'tool.arg.new_string': 'new text', 'tool.arg.replace_all': 'replace all',
64
+ 'tool.arg.maxResults': 'max results', 'tool.arg.html': 'HTML', 'tool.arg.url': 'URL', 'tool.arg.id': 'ID', 'tool.arg.ids': 'IDs',
65
+ 'tool.arg.file_ids': 'file IDs', 'tool.arg.receipt_id': 'receipt ID', 'tool.arg.input_schema': 'input fields',
66
+ /* Summaries of values: a value is data and is shown as it is, except that a structure is counted, never printed. */
67
+ 'tool.value.fields.one': '{count} field', 'tool.value.fields.other': '{count} fields',
68
+ 'tool.value.bytes': '{bytes} bytes · {lines} lines',
69
+ 'tool.value.empty': '(empty)',
70
+ 'tool.detail.raw': 'tool id {name}',
71
+ 'tool.read.lines': 'lines {from}–{to}', 'tool.read.from': 'from line {from}',
72
+ 'tool.write.append': '{bytes} bytes · {lines} lines · appended',
73
+ 'tool.search.results.one': '{count} result', 'tool.search.results.other': '{count} results',
74
+ /* R3 (owner Q-R3-1/2/3/4/10, gate E2/E6): the words of the ONE tool row `<Label> <target> · <isolation> · <why it ran> ·
75
+ <result> · <duration>`. A state other than done replaces the result and the duration with its word; the enum value
76
+ (`queued`, `streaming`, `cancelled`…) is never printed. */
77
+ 'tool.state.running': 'running', 'tool.state.runningFor': 'running {duration}',
78
+ 'tool.state.waiting': 'waiting for you',
79
+ 'tool.state.done': 'done',
80
+ 'tool.state.failed': 'failed',
81
+ 'tool.state.denied': 'denied',
82
+ 'tool.state.interrupted': 'interrupted', 'tool.state.interruptedAfter': 'interrupted after {duration}',
83
+ 'tool.state.unknown': 'result unknown',
84
+ /* Why it ran (Q-R3-3), from the decision kinds of tool-facts.ts. */
85
+ 'tool.why.typed': 'typed by you', 'tool.why.once': 'you allowed once', 'tool.why.session': 'you allowed for this session',
86
+ 'tool.why.always': 'always allowed', 'tool.why.rule': 'allow: {rule}', 'tool.why.auto': 'auto', 'tool.why.accept-edits': 'accept edits',
87
+ 'tool.why.full-access': 'Full access',
88
+ /* Isolation (E6): the CLI's own annotation words (screen.exec.isolation.*), without the backend; the glyph alone is what
89
+ a narrow row keeps (never dropped, Q-R3-1). */
90
+ 'tool.isolation.sandbox': '⛉ sandbox', 'tool.isolation.sandbox.glyph': '⛉',
91
+ 'tool.isolation.host': '⛶ host · not isolated', 'tool.isolation.host.glyph': '⛶',
92
+ /* A command the person typed at `!` is labelled by what they typed (gate §2.3). */
93
+ 'tool.person.label': '!',
94
+ 'tool.exit': 'exit {code}',
95
+ 'tool.duration.seconds': '{seconds} s', 'tool.duration.minutes': '{minutes} min {seconds} s',
96
+ 'tool.result.lines.one': '{count} line', 'tool.result.lines.other': '{count} lines',
97
+ 'tool.result.entries.one': '{count} entry', 'tool.result.entries.other': '{count} entries',
98
+ 'tool.result.newFile': 'new file', 'tool.result.appended': 'appended',
99
+ 'tool.result.changes': '+{added} −{removed}',
100
+ /* Output of a command (Q-R3-10): the last lines are shown, the ones above them are counted. */
101
+ 'tool.output.more.one': '+{count} line', 'tool.output.more.other': '+{count} lines',
102
+ 'tool.diff.more.one': '… {count} more diff line', 'tool.diff.more.other': '… {count} more diff lines',
103
+ 'tool.diff.tooLarge': 'This change is too large to compare line by line ({before} lines before, {after} lines after).',
104
+ 'tool.transcript.truncated': '…[truncated in TUI]',
105
+ /* After a turn that did not end normally (Q-R3-8/9): one neutral line; the Run rows are gone. */
106
+ 'tool.turn.interrupted': 'Interrupted', 'tool.turn.interruptedWhile': 'Interrupted · {while}',
107
+ 'tool.turn.closed': 'Interrupted · TALOS was closed before this run finished',
108
+ /* R5a S6/S7 (Q-R5-10, Q-R5-11; gate E6): every cut says how much was kept and how to reopen the rest. */
109
+ 'tool.output.saved': 'kept {kept} of {total} characters · full output: {path}',
110
+ 'tool.read.cutLines': '{shown} of {total} lines',
111
+ 'tool.read.cutAt': 'cut at {limit} characters',
112
+ /* R5a S10 (Q-R5-17; gate finding 15): why a tool did not run names what decided; "you did not approve it" only when the
113
+ person was asked and said no. */
114
+ 'tool.denied.person': 'Not run: you did not approve it.',
115
+ 'tool.denied.rule': 'Not run: denied by rule {rule}.',
116
+ 'tool.denied.ruleScoped': 'Not run: denied by rule {rule} ({scope}).',
117
+ 'tool.denied.policy': 'Not run: denied by policy: {reason}.',
118
+ 'tool.denied.policyNoReason': 'Not run: denied by policy.',
119
+ 'tool.denied.mode': 'Not run: denied by the permission mode: {reason}.',
120
+ 'tool.denied.modeNoReason': 'Not run: denied by the permission mode.',
121
+ /* The approval dialog (Q-R2-3): the title uses the on-screen label; rule text keeps its `Bash(…)` grammar. When the
122
+ payload names no kernel tool, the label is the permission tool's own, from this closed set. */
123
+ 'tool.approval.title': 'Permission: {label}',
124
+ 'tool.permission.Read': 'Read file', 'tool.permission.Write': 'Write file', 'tool.permission.Edit': 'Edit file',
125
+ 'tool.permission.Bash': 'Shell', 'tool.permission.WebFetch': 'Web access', 'tool.permission.Mcp': 'MCP tool',
126
+ 'tool.permission.Hook': 'Hook', 'tool.permission.Plugin': 'Plugin tool', 'tool.permission.TalosService': 'TALOS service',
127
+ };
@@ -0,0 +1,14 @@
1
+ /*
2
+ * R2: the English dictionary, split by area so that parallel lanes each own one file (ledger R2 lane plan). Ids must be
3
+ * unique across areas: `i18n.test.ts` fails on a duplicate. Add ids to the area that owns the words, never here.
4
+ */
5
+ import { approval } from "./en/approval.js";
6
+ import { common } from "./en/common.js";
7
+ import { credentials } from "./en/credentials.js";
8
+ import { errors } from "./en/errors.js";
9
+ import { firstrun } from "./en/firstrun.js";
10
+ import { providers } from "./en/providers.js";
11
+ import { screen } from "./en/screen.js";
12
+ import { tools } from "./en/tools.js";
13
+ export const AREAS = { approval, common, credentials, errors, firstrun, providers, screen, tools };
14
+ export const en = { ...approval, ...common, ...credentials, ...errors, ...firstrun, ...providers, ...screen, ...tools };
@@ -0,0 +1,307 @@
1
+ /*
2
+ * R2 CONTRACT (owner: lane E). Every error the screen shows goes through `describeError`: what happened · what to do ·
3
+ * where to look, the code once and secondary (Q-R2-4, gate E6). Lanes other than E only CALL these functions.
4
+ *
5
+ * - Mapping is by CODE (gate E4): `envelope.code`; `PROVIDER_REQUEST_ERROR` × kernel `classe` × HTTP `stato`; the RunError
6
+ * outcome codes; the credential-store codes. The only text comparisons are the pinned kernel constants of kernel-map.ts.
7
+ * - `detail` is English only and is what the third line shows; `raw` is the original text, in whatever language the kernel
8
+ * wrote it, for the expanded view and the log only (Q-R2-2). An unmapped code gets its family's sentence (E5).
9
+ * - `describeError` never throws: it runs on failure paths, where a second failure would hide the first.
10
+ */
11
+ import { codeForError } from "../errors.js";
12
+ import { missingKeyText } from "../provider/missing-key.js";
13
+ import { en, t } from "./index.js";
14
+ import { DISPLAY_CODES, KERNEL_CLASSES, KERNEL_NOTICES, KERNEL_PROVIDER_MESSAGES, KERNEL_REFUSAL_REASONS, KERNEL_RUN_TEXT, REFUSAL_VIA, RUN_OUTCOMES, TRANSPORT_CODES, looksItalian } from "./kernel-map.js";
15
+ import { RETRY_AFTER_MAX_MS } from "../runtime/provider-attempts.js";
16
+ function field(value, key) { try {
17
+ return value && typeof value === 'object' ? value[key] : undefined;
18
+ }
19
+ catch {
20
+ return undefined;
21
+ } }
22
+ function text(value) { return typeof value === 'string' && value.trim().length > 0 ? value : null; }
23
+ function finite(value) { const n = typeof value === 'string' && /^\d+$/u.test(value) ? Number(value) : value; return typeof n === 'number' && Number.isFinite(n) ? n : null; }
24
+ function facts(error) {
25
+ const envelope = field(error, 'envelope');
26
+ const source = error;
27
+ let code = '';
28
+ try {
29
+ code = text(field(envelope, 'code')) ?? codeForError(error);
30
+ }
31
+ catch {
32
+ code = 'INTERNAL_ERROR';
33
+ }
34
+ /* A v2 error (owner 2026-09-24) carries the English headline in `message` and the original, redacted text in `raw`:
35
+ the kernel's own words are what identify its provider class, so `raw` wins whenever it is there. */
36
+ const raw = typeof error === 'string' ? error : text(field(source, 'raw')) ?? text(field(source, 'message')) ?? text(field(field(envelope, 'cause'), 'message'));
37
+ return {
38
+ code: code || 'INTERNAL_ERROR', raw,
39
+ hint: text(field(envelope, 'hint')) ?? text(field(source, 'hint')),
40
+ classe: text(field(source, 'classe')),
41
+ stato: finite(field(source, 'stato')) ?? finite(field(source, 'status')),
42
+ provider: text(field(source, 'provider')),
43
+ retryAfterMs: finite(field(source, 'retryAfterMs')),
44
+ };
45
+ }
46
+ /** The code once: a message that repeats its own code as a `CODE:` prefix loses it (s02 D-06 printed it twice). */
47
+ function withoutCodePrefix(raw, code) { return raw.startsWith(code) ? raw.slice(code.length).replace(/^\s*:\s*/u, '').trim() : raw.trim(); }
48
+ function englishDetail(raw, code, what) {
49
+ if (!raw)
50
+ return null;
51
+ const rest = withoutCodePrefix(raw, code);
52
+ return rest && rest !== code && rest !== what && !looksItalian(rest) ? rest : null;
53
+ }
54
+ /* The words' family. Not the exit-code taxonomy (`exitCodeForEnvelope`), whose `/KEY/` also catches CONFIG_UNKNOWN_KEY:
55
+ the order here puts configuration before keys, so a bad setting is never worded as a rejected API key. */
56
+ const FAMILIES = [
57
+ [/^(?:INTERRUPTED|CANCELLED|ABORT_ERR)$/u, 'interrupted'],
58
+ [/CONFIG|USAGE|ERR_PARSE_ARGS|STDIN|QUERY|UNKNOWN_OPTION|SECRET_FIELD/u, 'usage'],
59
+ [/PERMISSION|APPROVAL|DENIED|SANDBOX|PATH_NOT_ALLOWED|PLAN_MODE|TRUST/u, 'permission'],
60
+ [/PROVIDER_KEY|API_KEY|AUTH|CREDENTIAL|KEYRING|PROVIDER_STORE/u, 'key'],
61
+ [/PROVIDER|MODEL|OPENROUTER|OLLAMA|GEMINI|ANTHROPIC|OPENAI|CATALOG/u, 'provider'],
62
+ [/MCP|HOOK|PLUGIN|EXTENSION|TOOL|FORGE|ACP_/u, 'extension'],
63
+ [/TIMEOUT/u, 'timeout'],
64
+ [/SESSION|RESEARCH_NOT_FOUND|AUTOMATION_NOT_FOUND/u, 'session'],
65
+ [/UPDATE/u, 'update'],
66
+ [/REQUIRED|INVALID|UNKNOWN|TALOS_RUNTIME_NOT_FOUND/u, 'usage'],
67
+ ];
68
+ function family(code) { for (const [pattern, name] of FAMILIES)
69
+ if (pattern.test(code))
70
+ return name; return 'internal'; }
71
+ const FAMILY_WHERE = {
72
+ internal: 'error.generic.where', permission: 'error.family.permission.where', key: 'error.family.key.where', provider: 'error.where.providerList',
73
+ extension: 'error.where.doctor', timeout: 'error.where.doctor', session: 'error.family.session.where', update: 'error.where.doctor', usage: 'error.family.usage.where', interrupted: null,
74
+ };
75
+ function providerWhere(provider) { return provider ? t('error.where.providerTest', { id: provider }) : t('error.where.providerList'); }
76
+ function providerClass(f) {
77
+ if (TRANSPORT_CODES[f.code])
78
+ return TRANSPORT_CODES[f.code];
79
+ if (f.code !== 'PROVIDER_REQUEST_ERROR' && !f.code.startsWith('PROVIDER_HTTP'))
80
+ return null;
81
+ if (f.stato === 429)
82
+ return 'rate-limited';
83
+ if (f.stato !== null && f.stato >= 500)
84
+ return 'server-error';
85
+ if (f.classe && KERNEL_CLASSES[f.classe])
86
+ return KERNEL_CLASSES[f.classe];
87
+ if (f.raw && KERNEL_PROVIDER_MESSAGES[f.raw.trim()])
88
+ return KERNEL_PROVIDER_MESSAGES[f.raw.trim()];
89
+ return 'not-accepted';
90
+ }
91
+ function describeProvider(cls, f) {
92
+ const id = f.provider ?? '<id>';
93
+ if (cls === 'credential' || cls === 'not-accepted') {
94
+ // The status, when the error still carries it, splits the kernel's lumped classes (E7: 403 is never "the key is wrong").
95
+ if (f.stato === 401)
96
+ return { what: t('error.provider.unauthorized.what'), todo: t('error.provider.unauthorized.todo', { id }) };
97
+ if (f.stato === 403)
98
+ return { what: t('error.provider.forbidden.what'), todo: t('error.provider.forbidden.todo') };
99
+ if (f.stato === 404)
100
+ return { what: t('error.provider.notFound.what'), todo: t('error.provider.notFound.todo') };
101
+ }
102
+ switch (cls) {
103
+ case 'rate-limited': {
104
+ // A wait is given only when it is known (E7); a keyless provider's Retry-After never reaches the CLI (E15).
105
+ const seconds = f.retryAfterMs !== null && f.retryAfterMs > 0 ? Math.ceil(f.retryAfterMs / 1000) : null;
106
+ /* R5a lane R (Q-R5-6): a requested wait above the 60 s TALOS takes by itself ended the retries at once (the kernel
107
+ amendment), so "TALOS retried" would be false. */
108
+ const what = seconds !== null && f.retryAfterMs > RETRY_AFTER_MAX_MS ? t('error.provider.rateLimited.whatLongWait', { seconds }) : t('error.provider.rateLimited.what');
109
+ return { what, todo: seconds ? t('error.provider.rateLimited.todoKnown', { seconds }) : t('error.provider.rateLimited.todo') };
110
+ }
111
+ case 'credential': return { what: t('error.provider.credential.what'), todo: t('error.provider.credential.todo') };
112
+ case 'credit': return { what: t('error.provider.credit.what'), todo: t('error.provider.credit.todo') };
113
+ case 'network': return { what: t('error.provider.network.what'), todo: t('error.provider.network.todo') };
114
+ case 'timeout': return { what: t('error.provider.timeout.what'), todo: t('error.provider.timeout.todo') };
115
+ case 'server-error': return { what: t('error.provider.serverError.what'), todo: t('error.provider.serverError.todo') };
116
+ case 'stream-cut': return { what: t('error.provider.streamCut.what'), todo: t('error.provider.streamCut.todo') };
117
+ case 'context': return { what: t('error.provider.context.what'), todo: t('error.provider.context.todo') };
118
+ default: return { what: t('error.provider.notAccepted.what'), todo: t('error.provider.notAccepted.todo') };
119
+ }
120
+ }
121
+ function stopPhrase(point) {
122
+ if (!point)
123
+ return null;
124
+ if (point.kind === 'answering')
125
+ return t('error.run.while.answering');
126
+ if (point.kind === 'approval')
127
+ return t('error.run.while.approval', { tool: point.tool });
128
+ return t('error.run.while.tool', { tool: point.tool });
129
+ }
130
+ function describeOutcome(code, f, options) {
131
+ const outcome = RUN_OUTCOMES[code];
132
+ if (outcome === 'stopped') {
133
+ if (f.raw?.trim() === KERNEL_RUN_TEXT.stoppedWithoutAnswer)
134
+ return { what: t('error.run.noAnswer.what'), todo: t('error.run.noAnswer.todo'), where: null };
135
+ const phrase = stopPhrase(options.stopPoint);
136
+ return { what: phrase ? t('error.run.interruptedWhile.what', { while: phrase }) : t('error.run.interrupted.what'), todo: null, where: null };
137
+ }
138
+ if (outcome === 'turns-exhausted')
139
+ return { what: t('error.run.turnsExhausted.what'), todo: t('error.run.turnsExhausted.todo'), where: null };
140
+ if (outcome === 'repetition')
141
+ return { what: t('error.run.repetition.what'), todo: t('error.run.repetition.todo'), where: null };
142
+ return { what: t('error.run.premiseDenied.what'), todo: t('error.run.premiseDenied.todo'), where: null };
143
+ }
144
+ /** Codes with their own words: `error.code.<CODE>.what` / `.todo`, and where to look. */
145
+ const CODE_WHERE = {
146
+ PROJECT_TRUST_REQUIRED: 'error.code.PROJECT_TRUST.where', PROJECT_TRUST_INVALIDATED: 'error.code.PROJECT_TRUST.where',
147
+ CREDENTIAL_STORE_INVALID: 'error.where.doctor', CREDENTIAL_STORE_REAL_IN_TEST: 'error.where.doctor', CONFIG_INVALID_CREDENTIAL_STORE: 'error.code.config.where', CONFIG_INVALID_CREDENTIALS: 'error.code.config.where',
148
+ SANDBOX_REQUIRED_UNAVAILABLE: 'error.where.doctor', MXC_BACKEND_UNAVAILABLE: 'error.where.doctor', PROVIDER_STORE_UNAVAILABLE: 'error.where.doctor',
149
+ RULE_COMMAND_UNSUPPORTED: 'error.family.permission.where', RULE_COMPOUND_COMMAND: 'error.family.permission.where', RULE_UNREADABLE: 'error.family.permission.where',
150
+ RULE_MATCHES_NOTHING: 'error.family.permission.where', RULE_STORE_INVALID: 'error.code.config.where', KEYMAP_INVALID: 'error.code.config.where',
151
+ FORGE_PACKAGE_SCHEMA_INVALID: 'error.generic.where', PROVIDER_KEY_REQUIRED: 'error.where.providerList', PROVIDER_KEY_INVALID: 'error.where.providerList',
152
+ PROVIDER_KEY_NOT_FOUND: 'error.where.providerList', PROVIDER_POOL_FULL: 'error.where.providerList', PROVIDER_RUNTIME_INVALID: 'error.where.providerList',
153
+ PROVIDER_RUNTIME_UNAVAILABLE: 'error.where.doctor', PROVIDER_KEY_MISSING: 'error.where.providerList', MODEL_IMAGE_NOT_SUPPORTED: 'error.where.providerList',
154
+ LOCAL_RUNTIME_NOT_READY: 'error.where.doctor', PATH_NOT_ALLOWED: 'error.family.permission.where', PLAN_MODE_READ_ONLY: 'error.family.permission.where',
155
+ SESSION_NOT_FOUND: 'error.family.session.where', EXECUTION_BACKEND_UNAVAILABLE: 'error.where.doctor', RUN_TIMEOUT: 'error.generic.where', RUNTIME_NOT_AVAILABLE: 'error.where.providerList', NOT_FOUND: 'error.family.session.where',
156
+ TALOS_RUNTIME_NOT_FOUND: 'error.where.doctor', PERMISSION_RULE_INVALID: 'error.family.permission.where', CLI_USAGE_ERROR: 'error.family.usage.where', PROVIDER_FALLBACK_BUSY: 'error.generic.where',
157
+ /* R5a lane R: the R5 configuration keys. */
158
+ CONFIG_INVALID_MODELS: 'error.code.config.where', CONFIG_INVALID_MODEL_WINDOW: 'error.code.config.where', CONFIG_INVALID_BUSY_INPUT: 'error.code.config.where',
159
+ CONFIG_INVALID_REASONING_DISPLAY: 'error.code.config.where',
160
+ /* R5b (R5a open 4): the Context Engine's failures point at /context. */
161
+ CTX_CONTEXT_OVERFLOW: 'error.where.context', CTX_TRUNCATED_SUMMARY: 'error.where.context', CTX_SUMMARY_RESPONSE_INVALID: 'error.where.context', CTX_SEGMENT_TOO_LARGE: 'error.where.context',
162
+ CTX_INVALID_SUMMARY: 'error.where.context', CTX_EMPTY_SUMMARY: 'error.where.context', CTX_NO_REDUCTION: 'error.where.context', CTX_NOTHING_TO_COMPACT: 'error.where.context',
163
+ CTX_CONTEXT_TOO_SMALL: 'error.where.context', CTX_COMPACTION_FAILED: 'error.where.context', CTX_JOB_INTERRUPTED: 'error.where.context', CTX_HISTORY_DIVERGED: 'error.where.context',
164
+ };
165
+ function familyTodo(fam) { return fam === 'interrupted' ? null : `error.family.${fam}.todo`; }
166
+ const RULE_CODES = new Set(['RULE_COMMAND_UNSUPPORTED', 'RULE_COMPOUND_COMMAND', 'RULE_UNREADABLE', 'RULE_MATCHES_NOTHING']);
167
+ function mapped(id) { return Object.hasOwn(en, id) ? id : null; }
168
+ export function hasEnglishFor(code) {
169
+ if (DISPLAY_CODES[code] && !(code in RUN_OUTCOMES))
170
+ return hasEnglishFor(DISPLAY_CODES[code]);
171
+ return Boolean(mapped(`error.code.${code}.what`)) || code in RUN_OUTCOMES || Boolean(TRANSPORT_CODES[code]) || code === 'PROVIDER_REQUEST_ERROR';
172
+ }
173
+ /** The code the screen prints for a kernel code (an Italian-spelled one gets its English name, D-05). */
174
+ export function displayCode(code) { return DISPLAY_CODES[code] ?? code; }
175
+ function describe(error, options) {
176
+ const f = facts(error);
177
+ const code = f.code;
178
+ const base = (parts) => {
179
+ const view = { ...parts, code, detail: englishDetail(f.raw, code, parts.what), raw: f.raw };
180
+ // The envelope's hint is the thrower's own advice for THIS failure: more specific than any table, so it wins when it is
181
+ // English (a kernel hint in Italian stays off the screen, Q-R2-2).
182
+ if (f.hint && !looksItalian(f.hint))
183
+ view.todo = f.hint;
184
+ return view;
185
+ };
186
+ if (code in RUN_OUTCOMES) {
187
+ const view = base(describeOutcome(code, f, options));
188
+ const noAnswer = code === 'fermato' && f.raw?.trim() === KERNEL_RUN_TEXT.stoppedWithoutAnswer;
189
+ // The person's own stop is not an error: no code and no "Details" line (the kernel code stays in the JSON envelope).
190
+ if (code === 'fermato' && !noAnswer)
191
+ return { ...view, code: null, detail: null };
192
+ return { ...view, code: noAnswer ? 'NO_ANSWER' : DISPLAY_CODES[code] ?? null, detail: null };
193
+ }
194
+ // A lowercase kernel code (`internal-error`) is shown as its English code; the facts travel, the envelope does not.
195
+ if (DISPLAY_CODES[code])
196
+ return describe({ message: f.raw ?? undefined, code: DISPLAY_CODES[code], hint: f.hint ?? undefined, provider: f.provider ?? undefined }, options);
197
+ if (code === 'PROVIDER_KEY_MISSING' && f.provider)
198
+ return { ...base({ what: missingKeyText(f.provider), todo: null, where: t('error.where.providerList') }), detail: null };
199
+ const cls = providerClass(f);
200
+ if (cls) {
201
+ const parts = describeProvider(cls, f);
202
+ return { ...base({ ...parts, where: providerWhere(f.provider) }), detail: f.stato ? `HTTP ${f.stato}` : null };
203
+ }
204
+ const own = mapped(`error.code.${code}.what`);
205
+ if (own) {
206
+ const todoId = mapped(`error.code.${code}.todo`) ?? (RULE_CODES.has(code) ? 'error.code.RULE.todo' : null) ?? familyTodo(family(code));
207
+ const where = CODE_WHERE[code] ? t(CODE_WHERE[code]) : family(code) === 'provider' ? providerWhere(f.provider) : t('error.generic.where');
208
+ return base({ what: t(own), todo: todoId ? t(todoId) : null, where });
209
+ }
210
+ const fam = family(code);
211
+ if (fam === 'interrupted')
212
+ return base({ what: t('error.family.interrupted.what'), todo: null, where: null });
213
+ const whereId = fam === 'provider' ? null : FAMILY_WHERE[fam];
214
+ return base({ what: t(`error.family.${fam}.what`), todo: t(`error.family.${fam}.todo`), where: whereId ? t(whereId) : providerWhere(f.provider) });
215
+ }
216
+ export function describeError(error, options = {}) {
217
+ try {
218
+ return describe(error, options);
219
+ }
220
+ catch {
221
+ return { what: t('error.generic.what'), todo: t('error.family.internal.todo'), where: t('error.generic.where'), code: 'INTERNAL_ERROR', detail: null, raw: null };
222
+ }
223
+ }
224
+ /** The three screen lines for a view (headline · what to do · dim "Details: … (CODE) · where"), without colour codes.
225
+ * `raw` is never printed here (Q-R2-2). */
226
+ export function errorViewLines(view) {
227
+ const details = [view.detail, view.code ? `(${view.code})` : null, view.where].filter(Boolean).join(' · ');
228
+ return [view.what, ...(view.todo ? [view.todo] : []), ...(details ? [`${t('common.details')}: ${details}`] : [])];
229
+ }
230
+ /** A kernel notice sent as a whole chat message, in English; `null` when the text is not one of the kernel's templates. */
231
+ export function describeKernelNotice(text) {
232
+ for (const notice of KERNEL_NOTICES) {
233
+ const m = notice.pattern.exec(text);
234
+ if (m)
235
+ return t(notice.id, { ...m.groups });
236
+ }
237
+ return null;
238
+ }
239
+ /*
240
+ * R3 Q-R3-8 (R3-INT). The kernel ends a tool result it stopped with one of these sentences, as a whole paragraph
241
+ * (talosHarness.mjs:4040, 4806-4808, 4947; `annullaAnnunciate` :684). The model reads them unchanged (R2 E2); the screen
242
+ * shows the English of the EXACT sentence, compared as a whole line, so a command's own output is never rewritten.
243
+ * Pinned against the kernel source by test/tui/r3-sp-tool-stop-markers.test.ts.
244
+ */
245
+ export const KERNEL_TOOL_STOP = Object.freeze({
246
+ commandWhileRunning: '⛔ Fermato su richiesta: il comando e stato interrotto mentre girava.',
247
+ testWhileRunning: '⛔ Fermato su richiesta: la prova e stata interrotta mentre girava.',
248
+ notRun: '⛔ Fermato su richiesta: non riesco a eseguirlo, la sessione e stata interrotta prima. Questo attrezzo non e stato eseguito.',
249
+ timedOut: /^⛔ Fermato allo scadere dei (?<seconds>\d+) secondi: non ha finito da solo\.$/u,
250
+ });
251
+ /** A tool result's display text with the kernel's stop sentences in English; `stopped` = the person stopped it. */
252
+ export function describeKernelToolText(text) {
253
+ if (!text.includes('⛔ Fermato'))
254
+ return { text, stopped: false };
255
+ let stopped = false;
256
+ const lines = text.split('\n').map(line => {
257
+ if (line === KERNEL_TOOL_STOP.commandWhileRunning || line === KERNEL_TOOL_STOP.testWhileRunning) {
258
+ stopped = true;
259
+ return t('error.toolStop.whileRunning');
260
+ }
261
+ if (line === KERNEL_TOOL_STOP.notRun) {
262
+ stopped = true;
263
+ return t('error.toolStop.notRun');
264
+ }
265
+ const timeout = KERNEL_TOOL_STOP.timedOut.exec(line);
266
+ return timeout ? t('error.toolStop.timedOut', { seconds: timeout.groups.seconds }) : line;
267
+ });
268
+ return { text: lines.join('\n'), stopped };
269
+ }
270
+ /**
271
+ * A refused tool, worded from the receipt's permission `via` (the kernel's `motivo` is Italian; it stays in the receipt).
272
+ * R5a lane R (S10, gate finding 15): with the tool's `denial` fact, the words name who decided — the person only when the
273
+ * person was asked and said no; a rule by its text, the policy or the mode by their reason — instead of the via, which says
274
+ * "you did not approve it" for every "asked" via, even when the engine answered alone.
275
+ */
276
+ export function describeRefusal(receipt, denial) {
277
+ if (denial)
278
+ return describeDenial(denial);
279
+ const key = receipt.via ? REFUSAL_VIA[receipt.via] : undefined;
280
+ return t(key ? `error.refused.${key}` : 'error.refused.generic');
281
+ }
282
+ /** The one sentence of a denial fact (`ToolDenial`, tui/tool-facts.ts). */
283
+ export function describeDenial(denial) {
284
+ if (denial.by === 'person')
285
+ return t('error.denial.person');
286
+ if (denial.by === 'rule')
287
+ return denial.rule ? (denial.scope ? t('error.denial.ruleScoped', { rule: denial.rule, scope: denial.scope }) : t('error.denial.rule', { rule: denial.rule })) : t('error.denial.ruleUnnamed');
288
+ return denial.reason ? t('error.denial.because', { reason: denial.reason }) : t('error.refused.generic');
289
+ }
290
+ /**
291
+ * R5a lane R (S10): the kernel's refusal sentence (a receipt's `motivo`) in English, matched whole against the kernel's
292
+ * constants (kernel-map.ts `KERNEL_REFUSAL_REASONS`); `null` when it is not one of them. `toolLabel` names a kernel tool id in
293
+ * the screen's words. Display only: the receipt and the model keep the kernel's text.
294
+ */
295
+ export function describeKernelRefusalReason(text, { toolLabel = (id) => id } = {}) {
296
+ const value = String(text ?? '').trim();
297
+ for (const row of KERNEL_REFUSAL_REASONS) {
298
+ const match = row.pattern.exec(value);
299
+ if (!match)
300
+ continue;
301
+ const groups = match.groups ?? {};
302
+ /* The kernel writes `(nessun percorso)` when the action named no path (talosHarness.mjs, research branch). */
303
+ const path = groups.path === undefined ? undefined : !groups.path || groups.path === '(nessun percorso)' ? t('error.refusalReason.noPath') : groups.path;
304
+ return t(row.id, { ...(groups.tool ? { tool: toolLabel(groups.tool) } : {}), ...(path !== undefined ? { path } : {}) });
305
+ }
306
+ return null;
307
+ }
@@ -0,0 +1,19 @@
1
+ /*
2
+ * R2 (Q-R2-1, gate E1/E9): the ONE place the screen's words come from. `en` is a flat, typed object keyed by dotted ids;
3
+ * values are data strings with `{name}` placeholders; plurals are `<id>.one` / `<id>.other` chosen by Intl.PluralRules.
4
+ * A later locale is `{...en,...overrides}` and needs no code change (Hermes desktop / OpenCode pattern). What the MODEL
5
+ * receives (kernel tool names, argument keys, contract markers) never comes from here (gate E2).
6
+ */
7
+ import { en } from "./en.js";
8
+ const pluralRules = new Intl.PluralRules('en');
9
+ function fill(template, params = {}) {
10
+ return template.replace(/\{(\w+)\}/gu, (whole, name) => Object.hasOwn(params, name) ? String(params[name]) : whole);
11
+ }
12
+ /** The English text for `id`, with `{name}` placeholders filled from `params` (a missing param stays visible as `{name}`). */
13
+ export function t(id, params) { return fill(en[id], params); }
14
+ /** The plural form of `base` for `count` (`{count}` is available to the template). */
15
+ export function tn(base, count, params = {}) {
16
+ const form = pluralRules.select(count) === 'one' ? 'one' : 'other';
17
+ return fill(en[`${base}.${form}`], { count, ...params });
18
+ }
19
+ export { en };