@vascend/talos 0.1.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 (620) hide show
  1. package/README.md +202 -0
  2. package/dist/backend/asset-events.d.ts +31 -0
  3. package/dist/backend/asset-events.js +149 -0
  4. package/dist/backend/assets.d.ts +31 -0
  5. package/dist/backend/assets.js +210 -0
  6. package/dist/backend/auth.d.ts +18 -0
  7. package/dist/backend/auth.js +59 -0
  8. package/dist/backend/config.d.ts +14 -0
  9. package/dist/backend/config.js +41 -0
  10. package/dist/backend/conversations.d.ts +21 -0
  11. package/dist/backend/conversations.js +141 -0
  12. package/dist/backend/crypto.d.ts +9 -0
  13. package/dist/backend/crypto.js +68 -0
  14. package/dist/backend/engine.d.ts +13 -0
  15. package/dist/backend/engine.js +78 -0
  16. package/dist/backend/http.d.ts +25 -0
  17. package/dist/backend/http.js +112 -0
  18. package/dist/backend/index.d.ts +1 -0
  19. package/dist/backend/index.js +24 -0
  20. package/dist/backend/routes.d.ts +14 -0
  21. package/dist/backend/routes.js +169 -0
  22. package/dist/backend/sdk.d.ts +12 -0
  23. package/dist/backend/sdk.js +11 -0
  24. package/dist/backend/server.d.ts +12 -0
  25. package/dist/backend/server.js +91 -0
  26. package/dist/backend/temp-image-store.d.ts +46 -0
  27. package/dist/backend/temp-image-store.js +197 -0
  28. package/dist/backend/types.d.ts +103 -0
  29. package/dist/backend/types.js +29 -0
  30. package/dist/backend/users.d.ts +13 -0
  31. package/dist/backend/users.js +76 -0
  32. package/dist/backend/ws-handler.d.ts +14 -0
  33. package/dist/backend/ws-handler.js +72 -0
  34. package/dist/backend/ws.d.ts +19 -0
  35. package/dist/backend/ws.js +146 -0
  36. package/dist/core/agent.d.ts +56 -0
  37. package/dist/core/agent.js +1783 -0
  38. package/dist/core/background.d.ts +45 -0
  39. package/dist/core/background.js +140 -0
  40. package/dist/core/bootstrap.d.ts +45 -0
  41. package/dist/core/bootstrap.js +294 -0
  42. package/dist/core/cli-args.d.ts +41 -0
  43. package/dist/core/cli-args.js +282 -0
  44. package/dist/core/collapsible-output.d.ts +38 -0
  45. package/dist/core/collapsible-output.js +143 -0
  46. package/dist/core/compaction-checkpoint.d.ts +9 -0
  47. package/dist/core/compaction-checkpoint.js +58 -0
  48. package/dist/core/compaction.d.ts +42 -0
  49. package/dist/core/compaction.js +270 -0
  50. package/dist/core/config.d.ts +49 -0
  51. package/dist/core/config.js +417 -0
  52. package/dist/core/context-ledger.d.ts +99 -0
  53. package/dist/core/context-ledger.js +222 -0
  54. package/dist/core/context-policy.d.ts +17 -0
  55. package/dist/core/context-policy.js +81 -0
  56. package/dist/core/continuation-review.d.ts +23 -0
  57. package/dist/core/continuation-review.js +64 -0
  58. package/dist/core/crash-report.d.ts +3 -0
  59. package/dist/core/crash-report.js +27 -0
  60. package/dist/core/credentials.d.ts +11 -0
  61. package/dist/core/credentials.js +183 -0
  62. package/dist/core/doctor.d.ts +24 -0
  63. package/dist/core/doctor.js +125 -0
  64. package/dist/core/effort.d.ts +5 -0
  65. package/dist/core/effort.js +42 -0
  66. package/dist/core/env-paths.d.ts +3 -0
  67. package/dist/core/env-paths.js +38 -0
  68. package/dist/core/execution-guidance.d.ts +9 -0
  69. package/dist/core/execution-guidance.js +73 -0
  70. package/dist/core/execution-target.d.ts +41 -0
  71. package/dist/core/execution-target.js +69 -0
  72. package/dist/core/file-coordination.d.ts +66 -0
  73. package/dist/core/file-coordination.js +176 -0
  74. package/dist/core/file-lease-store.d.ts +14 -0
  75. package/dist/core/file-lease-store.js +89 -0
  76. package/dist/core/image-limits.d.ts +26 -0
  77. package/dist/core/image-limits.js +205 -0
  78. package/dist/core/interruptible-completion.d.ts +3 -0
  79. package/dist/core/interruptible-completion.js +42 -0
  80. package/dist/core/kingdoms-mode-state.d.ts +24 -0
  81. package/dist/core/kingdoms-mode-state.js +139 -0
  82. package/dist/core/licenza.d.ts +38 -0
  83. package/dist/core/licenza.js +125 -0
  84. package/dist/core/model-limits.d.ts +2 -0
  85. package/dist/core/model-limits.js +36 -0
  86. package/dist/core/output-lifecycle.d.ts +44 -0
  87. package/dist/core/output-lifecycle.js +190 -0
  88. package/dist/core/package-update.d.ts +15 -0
  89. package/dist/core/package-update.js +121 -0
  90. package/dist/core/permission-queue.d.ts +2 -0
  91. package/dist/core/permission-queue.js +20 -0
  92. package/dist/core/prompt-attachment.d.ts +21 -0
  93. package/dist/core/prompt-attachment.js +123 -0
  94. package/dist/core/request-plan.d.ts +16 -0
  95. package/dist/core/request-plan.js +36 -0
  96. package/dist/core/run-timing.d.ts +17 -0
  97. package/dist/core/run-timing.js +123 -0
  98. package/dist/core/self-update.d.ts +17 -0
  99. package/dist/core/self-update.js +54 -0
  100. package/dist/core/session-refs.d.ts +27 -0
  101. package/dist/core/session-refs.js +126 -0
  102. package/dist/core/session-storage.d.ts +4 -0
  103. package/dist/core/session-storage.js +48 -0
  104. package/dist/core/session-title.d.ts +1 -0
  105. package/dist/core/session-title.js +21 -0
  106. package/dist/core/session-usage.d.ts +17 -0
  107. package/dist/core/session-usage.js +74 -0
  108. package/dist/core/session.d.ts +58 -0
  109. package/dist/core/session.js +296 -0
  110. package/dist/core/settings.d.ts +17 -0
  111. package/dist/core/settings.js +107 -0
  112. package/dist/core/storage-retention.d.ts +21 -0
  113. package/dist/core/storage-retention.js +227 -0
  114. package/dist/core/text-sanitize.d.ts +1 -0
  115. package/dist/core/text-sanitize.js +35 -0
  116. package/dist/core/tool-artifacts.d.ts +6 -0
  117. package/dist/core/tool-artifacts.js +51 -0
  118. package/dist/core/tool-compress.d.ts +8 -0
  119. package/dist/core/tool-compress.js +111 -0
  120. package/dist/core/tool-executor.d.ts +16 -0
  121. package/dist/core/tool-executor.js +97 -0
  122. package/dist/core/tool-result-index.d.ts +52 -0
  123. package/dist/core/tool-result-index.js +327 -0
  124. package/dist/core/tool-result-store.d.ts +38 -0
  125. package/dist/core/tool-result-store.js +190 -0
  126. package/dist/core/tool-scheduler.d.ts +16 -0
  127. package/dist/core/tool-scheduler.js +35 -0
  128. package/dist/core/trust.d.ts +21 -0
  129. package/dist/core/trust.js +95 -0
  130. package/dist/core/types.d.ts +402 -0
  131. package/dist/core/types.js +1 -0
  132. package/dist/core/update-check.d.ts +26 -0
  133. package/dist/core/update-check.js +89 -0
  134. package/dist/core/update-process.d.ts +10 -0
  135. package/dist/core/update-process.js +31 -0
  136. package/dist/core/user-inbox.d.ts +23 -0
  137. package/dist/core/user-inbox.js +56 -0
  138. package/dist/core/user-input.d.ts +10 -0
  139. package/dist/core/user-input.js +35 -0
  140. package/dist/core/version.d.ts +1 -0
  141. package/dist/core/version.js +10 -0
  142. package/dist/core/vibe-modes.d.ts +38 -0
  143. package/dist/core/vibe-modes.js +383 -0
  144. package/dist/core/workspace-roots.d.ts +13 -0
  145. package/dist/core/workspace-roots.js +91 -0
  146. package/dist/core/workspace-sessions.d.ts +51 -0
  147. package/dist/core/workspace-sessions.js +243 -0
  148. package/dist/cowork/client.d.ts +29 -0
  149. package/dist/cowork/client.js +49 -0
  150. package/dist/cowork/engine-bridge.d.ts +22 -0
  151. package/dist/cowork/engine-bridge.js +98 -0
  152. package/dist/cowork/index.d.ts +11 -0
  153. package/dist/cowork/index.js +16 -0
  154. package/dist/cowork/ipc.d.ts +97 -0
  155. package/dist/cowork/ipc.js +96 -0
  156. package/dist/cowork/manager.d.ts +66 -0
  157. package/dist/cowork/manager.js +325 -0
  158. package/dist/cowork/store.d.ts +23 -0
  159. package/dist/cowork/store.js +182 -0
  160. package/dist/cowork/sync.d.ts +20 -0
  161. package/dist/cowork/sync.js +164 -0
  162. package/dist/cowork/types.d.ts +78 -0
  163. package/dist/cowork/types.js +21 -0
  164. package/dist/extensions/ext-tools.d.ts +3 -0
  165. package/dist/extensions/ext-tools.js +73 -0
  166. package/dist/extensions/loader.d.ts +91 -0
  167. package/dist/extensions/loader.js +474 -0
  168. package/dist/extensions/settings.d.ts +20 -0
  169. package/dist/extensions/settings.js +86 -0
  170. package/dist/extensions/types.d.ts +219 -0
  171. package/dist/extensions/types.js +1 -0
  172. package/dist/horizon/async-queue.d.ts +9 -0
  173. package/dist/horizon/async-queue.js +46 -0
  174. package/dist/horizon/engine.d.ts +85 -0
  175. package/dist/horizon/engine.js +603 -0
  176. package/dist/horizon/index.d.ts +4 -0
  177. package/dist/horizon/index.js +2 -0
  178. package/dist/horizon/main-team.d.ts +163 -0
  179. package/dist/horizon/main-team.js +774 -0
  180. package/dist/horizon/types.d.ts +233 -0
  181. package/dist/horizon/types.js +1 -0
  182. package/dist/index.d.ts +2 -0
  183. package/dist/index.js +233 -0
  184. package/dist/mcp/protocol.d.ts +81 -0
  185. package/dist/mcp/protocol.js +122 -0
  186. package/dist/package.json +1 -0
  187. package/dist/packages/packages.d.ts +12 -0
  188. package/dist/packages/packages.js +323 -0
  189. package/dist/prompts/templates.d.ts +13 -0
  190. package/dist/prompts/templates.js +139 -0
  191. package/dist/providers/anthropic-oauth.d.ts +13 -0
  192. package/dist/providers/anthropic-oauth.js +124 -0
  193. package/dist/providers/anthropic.d.ts +27 -0
  194. package/dist/providers/anthropic.js +526 -0
  195. package/dist/providers/catalog.d.ts +15 -0
  196. package/dist/providers/catalog.js +166 -0
  197. package/dist/providers/effort.d.ts +12 -0
  198. package/dist/providers/effort.js +102 -0
  199. package/dist/providers/model-catalog.d.ts +43 -0
  200. package/dist/providers/model-catalog.js +70 -0
  201. package/dist/providers/model-effort.d.ts +5 -0
  202. package/dist/providers/model-effort.js +43 -0
  203. package/dist/providers/model-registry.d.ts +39 -0
  204. package/dist/providers/model-registry.js +142 -0
  205. package/dist/providers/models-dev.d.ts +9 -0
  206. package/dist/providers/models-dev.js +97 -0
  207. package/dist/providers/oauth-callback-server.d.ts +28 -0
  208. package/dist/providers/oauth-callback-server.js +184 -0
  209. package/dist/providers/oauth-orchestrator.d.ts +58 -0
  210. package/dist/providers/oauth-orchestrator.js +159 -0
  211. package/dist/providers/oauth-store.d.ts +12 -0
  212. package/dist/providers/oauth-store.js +139 -0
  213. package/dist/providers/open-browser.d.ts +20 -0
  214. package/dist/providers/open-browser.js +92 -0
  215. package/dist/providers/openai-compat.d.ts +14 -0
  216. package/dist/providers/openai-compat.js +523 -0
  217. package/dist/providers/openai-oauth.d.ts +15 -0
  218. package/dist/providers/openai-oauth.js +382 -0
  219. package/dist/providers/openrouter-auth.d.ts +73 -0
  220. package/dist/providers/openrouter-auth.js +321 -0
  221. package/dist/providers/openrouter-manual-fallback.d.ts +25 -0
  222. package/dist/providers/openrouter-manual-fallback.js +161 -0
  223. package/dist/providers/openrouter.d.ts +15 -0
  224. package/dist/providers/openrouter.js +107 -0
  225. package/dist/providers/plan-limits.d.ts +6 -0
  226. package/dist/providers/plan-limits.js +175 -0
  227. package/dist/providers/provider-reset.d.ts +4 -0
  228. package/dist/providers/provider-reset.js +83 -0
  229. package/dist/providers/quota-limits.d.ts +4 -0
  230. package/dist/providers/quota-limits.js +33 -0
  231. package/dist/providers/registry.d.ts +33 -0
  232. package/dist/providers/registry.js +213 -0
  233. package/dist/providers/retry.d.ts +37 -0
  234. package/dist/providers/retry.js +347 -0
  235. package/dist/rpc/server.d.ts +23 -0
  236. package/dist/rpc/server.js +222 -0
  237. package/dist/sdk.d.ts +67 -0
  238. package/dist/sdk.js +64 -0
  239. package/dist/skills/skills.d.ts +17 -0
  240. package/dist/skills/skills.js +155 -0
  241. package/dist/text-sanitize.js +28 -0
  242. package/dist/tools/ask-user.d.ts +2 -0
  243. package/dist/tools/ask-user.js +60 -0
  244. package/dist/tools/builtin.d.ts +48 -0
  245. package/dist/tools/builtin.js +2494 -0
  246. package/dist/tools/capabilities.d.ts +5 -0
  247. package/dist/tools/capabilities.js +55 -0
  248. package/dist/tools/computer-capture.d.ts +2 -0
  249. package/dist/tools/computer-capture.js +91 -0
  250. package/dist/tools/computer-posix.d.ts +5 -0
  251. package/dist/tools/computer-posix.js +136 -0
  252. package/dist/tools/computer-use.d.ts +14 -0
  253. package/dist/tools/computer-use.js +108 -0
  254. package/dist/tools/discovery.d.ts +12 -0
  255. package/dist/tools/discovery.js +205 -0
  256. package/dist/tools/execute.d.ts +2 -0
  257. package/dist/tools/execute.js +73 -0
  258. package/dist/tools/normalize-input.d.ts +17 -0
  259. package/dist/tools/normalize-input.js +174 -0
  260. package/dist/tools/output-artifact.d.ts +3 -0
  261. package/dist/tools/output-artifact.js +80 -0
  262. package/dist/tools/pagination.d.ts +15 -0
  263. package/dist/tools/pagination.js +93 -0
  264. package/dist/tools/plan-status.d.ts +2 -0
  265. package/dist/tools/plan-status.js +109 -0
  266. package/dist/tools/program-input.d.ts +3 -0
  267. package/dist/tools/program-input.js +19 -0
  268. package/dist/tools/program.d.ts +3 -0
  269. package/dist/tools/program.js +567 -0
  270. package/dist/tools/protocol-catalog.d.ts +12 -0
  271. package/dist/tools/protocol-catalog.js +46 -0
  272. package/dist/tools/ramification-tools.d.ts +12 -0
  273. package/dist/tools/ramification-tools.js +528 -0
  274. package/dist/tools/regex-compat.d.ts +9 -0
  275. package/dist/tools/regex-compat.js +96 -0
  276. package/dist/tools/registry.d.ts +51 -0
  277. package/dist/tools/registry.js +185 -0
  278. package/dist/tools/resolve.d.ts +2 -0
  279. package/dist/tools/resolve.js +107 -0
  280. package/dist/tools/shell-env.d.ts +2 -0
  281. package/dist/tools/shell-env.js +7 -0
  282. package/dist/tools/team-input.d.ts +3 -0
  283. package/dist/tools/team-input.js +129 -0
  284. package/dist/tools/team-tools.d.ts +7 -0
  285. package/dist/tools/team-tools.js +348 -0
  286. package/dist/tools/workspace-sessions.d.ts +2 -0
  287. package/dist/tools/workspace-sessions.js +35 -0
  288. package/dist/tui/account-entry.d.ts +1 -0
  289. package/dist/tui/account-entry.js +93 -0
  290. package/dist/tui/attachment-highlight.d.ts +1 -0
  291. package/dist/tui/attachment-highlight.js +24 -0
  292. package/dist/tui/attachment-refs.d.ts +2 -0
  293. package/dist/tui/attachment-refs.js +3 -0
  294. package/dist/tui/bottom-input.d.ts +219 -0
  295. package/dist/tui/bottom-input.js +1958 -0
  296. package/dist/tui/branding.d.ts +107 -0
  297. package/dist/tui/branding.js +750 -0
  298. package/dist/tui/clipboard-image.d.ts +10 -0
  299. package/dist/tui/clipboard-image.js +163 -0
  300. package/dist/tui/clipboard-text.d.ts +9 -0
  301. package/dist/tui/clipboard-text.js +51 -0
  302. package/dist/tui/clipboard-windows.d.ts +8 -0
  303. package/dist/tui/clipboard-windows.js +84 -0
  304. package/dist/tui/collapsible-command.d.ts +15 -0
  305. package/dist/tui/collapsible-command.js +48 -0
  306. package/dist/tui/command-feedback.d.ts +10 -0
  307. package/dist/tui/command-feedback.js +46 -0
  308. package/dist/tui/command-output-registry.d.ts +28 -0
  309. package/dist/tui/command-output-registry.js +103 -0
  310. package/dist/tui/command-transcript.d.ts +12 -0
  311. package/dist/tui/command-transcript.js +90 -0
  312. package/dist/tui/commands.d.ts +20 -0
  313. package/dist/tui/commands.js +131 -0
  314. package/dist/tui/context-bar.d.ts +4 -0
  315. package/dist/tui/context-bar.js +74 -0
  316. package/dist/tui/context-meter.d.ts +25 -0
  317. package/dist/tui/context-meter.js +81 -0
  318. package/dist/tui/cost-binding.d.ts +8 -0
  319. package/dist/tui/cost-binding.js +43 -0
  320. package/dist/tui/cost-tracker.d.ts +49 -0
  321. package/dist/tui/cost-tracker.js +122 -0
  322. package/dist/tui/diff.d.ts +9 -0
  323. package/dist/tui/diff.js +119 -0
  324. package/dist/tui/i18n-catalog.d.ts +5 -0
  325. package/dist/tui/i18n-catalog.js +184 -0
  326. package/dist/tui/i18n.d.ts +6 -0
  327. package/dist/tui/i18n.js +10 -0
  328. package/dist/tui/image-attachments.d.ts +46 -0
  329. package/dist/tui/image-attachments.js +167 -0
  330. package/dist/tui/images.d.ts +12 -0
  331. package/dist/tui/images.js +87 -0
  332. package/dist/tui/intro.d.ts +13 -0
  333. package/dist/tui/intro.js +109 -0
  334. package/dist/tui/language-preference.d.ts +6 -0
  335. package/dist/tui/language-preference.js +24 -0
  336. package/dist/tui/live-output.d.ts +2 -0
  337. package/dist/tui/live-output.js +18 -0
  338. package/dist/tui/locales.d.ts +19 -0
  339. package/dist/tui/locales.js +22 -0
  340. package/dist/tui/login-menu.d.ts +17 -0
  341. package/dist/tui/login-menu.js +58 -0
  342. package/dist/tui/logo.d.ts +8 -0
  343. package/dist/tui/logo.js +305 -0
  344. package/dist/tui/markdown-inline.d.ts +3 -0
  345. package/dist/tui/markdown-inline.js +99 -0
  346. package/dist/tui/markdown-table.d.ts +4 -0
  347. package/dist/tui/markdown-table.js +63 -0
  348. package/dist/tui/markdown.d.ts +11 -0
  349. package/dist/tui/markdown.js +257 -0
  350. package/dist/tui/mcp-transcript.d.ts +7 -0
  351. package/dist/tui/mcp-transcript.js +40 -0
  352. package/dist/tui/model-details.d.ts +2 -0
  353. package/dist/tui/model-details.js +21 -0
  354. package/dist/tui/model-selection.d.ts +7 -0
  355. package/dist/tui/model-selection.js +41 -0
  356. package/dist/tui/native-scrollback.d.ts +27 -0
  357. package/dist/tui/native-scrollback.js +134 -0
  358. package/dist/tui/onboarding.d.ts +72 -0
  359. package/dist/tui/onboarding.js +207 -0
  360. package/dist/tui/paste-collapse.d.ts +39 -0
  361. package/dist/tui/paste-collapse.js +117 -0
  362. package/dist/tui/perm-mode.d.ts +8 -0
  363. package/dist/tui/perm-mode.js +41 -0
  364. package/dist/tui/prompt-queue-store.d.ts +26 -0
  365. package/dist/tui/prompt-queue-store.js +87 -0
  366. package/dist/tui/prompt-queue.d.ts +47 -0
  367. package/dist/tui/prompt-queue.js +187 -0
  368. package/dist/tui/provider-menu.d.ts +33 -0
  369. package/dist/tui/provider-menu.js +175 -0
  370. package/dist/tui/question.d.ts +24 -0
  371. package/dist/tui/question.js +32 -0
  372. package/dist/tui/queue-screen.d.ts +25 -0
  373. package/dist/tui/queue-screen.js +152 -0
  374. package/dist/tui/queue-team.d.ts +3 -0
  375. package/dist/tui/queue-team.js +28 -0
  376. package/dist/tui/queued-questions.d.ts +20 -0
  377. package/dist/tui/queued-questions.js +163 -0
  378. package/dist/tui/quick-help.d.ts +1 -0
  379. package/dist/tui/quick-help.js +53 -0
  380. package/dist/tui/repl.d.ts +78 -0
  381. package/dist/tui/repl.js +4130 -0
  382. package/dist/tui/restore-queued-input.d.ts +3 -0
  383. package/dist/tui/restore-queued-input.js +20 -0
  384. package/dist/tui/review-detail.d.ts +6 -0
  385. package/dist/tui/review-detail.js +56 -0
  386. package/dist/tui/review-files.d.ts +3 -0
  387. package/dist/tui/review-files.js +22 -0
  388. package/dist/tui/review-render.d.ts +22 -0
  389. package/dist/tui/review-render.js +98 -0
  390. package/dist/tui/review-screen.d.ts +38 -0
  391. package/dist/tui/review-screen.js +358 -0
  392. package/dist/tui/review-store.d.ts +60 -0
  393. package/dist/tui/review-store.js +270 -0
  394. package/dist/tui/review-team.d.ts +2 -0
  395. package/dist/tui/review-team.js +27 -0
  396. package/dist/tui/selector-mouse.d.ts +26 -0
  397. package/dist/tui/selector-mouse.js +65 -0
  398. package/dist/tui/selector.d.ts +51 -0
  399. package/dist/tui/selector.js +299 -0
  400. package/dist/tui/session-replay.d.ts +10 -0
  401. package/dist/tui/session-replay.js +78 -0
  402. package/dist/tui/session-usage.d.ts +22 -0
  403. package/dist/tui/session-usage.js +55 -0
  404. package/dist/tui/skill-transcript.d.ts +5 -0
  405. package/dist/tui/skill-transcript.js +31 -0
  406. package/dist/tui/startup.d.ts +5 -0
  407. package/dist/tui/startup.js +61 -0
  408. package/dist/tui/status-line-loader.d.ts +8 -0
  409. package/dist/tui/status-line-loader.js +33 -0
  410. package/dist/tui/status-line.d.ts +38 -0
  411. package/dist/tui/status-line.js +213 -0
  412. package/dist/tui/system-language.d.ts +8 -0
  413. package/dist/tui/system-language.js +41 -0
  414. package/dist/tui/task-labels.d.ts +2 -0
  415. package/dist/tui/task-labels.js +7 -0
  416. package/dist/tui/term-bg.d.ts +4 -0
  417. package/dist/tui/term-bg.js +67 -0
  418. package/dist/tui/terminal-screen.d.ts +12 -0
  419. package/dist/tui/terminal-screen.js +1 -0
  420. package/dist/tui/terminal-text.d.ts +7 -0
  421. package/dist/tui/terminal-text.js +123 -0
  422. package/dist/tui/theme.d.ts +25 -0
  423. package/dist/tui/theme.js +383 -0
  424. package/dist/tui/tool-style.d.ts +7 -0
  425. package/dist/tui/tool-style.js +119 -0
  426. package/dist/tui/update-prompt.d.ts +14 -0
  427. package/dist/tui/update-prompt.js +104 -0
  428. package/dist/tui/usage-footer.d.ts +9 -0
  429. package/dist/tui/usage-footer.js +123 -0
  430. package/dist/tui/vascend-login.d.ts +68 -0
  431. package/dist/tui/vascend-login.js +355 -0
  432. package/dist/tui/web-login.d.ts +28 -0
  433. package/dist/tui/web-login.js +115 -0
  434. package/dist/vascend/activity-status.d.ts +12 -0
  435. package/dist/vascend/activity-status.js +68 -0
  436. package/dist/vascend/architecture-map.d.ts +73 -0
  437. package/dist/vascend/architecture-map.js +424 -0
  438. package/dist/vascend/attention-layout.d.ts +19 -0
  439. package/dist/vascend/attention-layout.js +141 -0
  440. package/dist/vascend/budget-allocator.d.ts +31 -0
  441. package/dist/vascend/budget-allocator.js +79 -0
  442. package/dist/vascend/candidate-collector.d.ts +20 -0
  443. package/dist/vascend/candidate-collector.js +220 -0
  444. package/dist/vascend/code-events.d.ts +24 -0
  445. package/dist/vascend/code-events.js +304 -0
  446. package/dist/vascend/code-graph-memory.d.ts +38 -0
  447. package/dist/vascend/code-graph-memory.js +334 -0
  448. package/dist/vascend/code-graph-runtime.d.ts +19 -0
  449. package/dist/vascend/code-graph-runtime.js +190 -0
  450. package/dist/vascend/code-graph-types.d.ts +58 -0
  451. package/dist/vascend/code-graph-types.js +50 -0
  452. package/dist/vascend/code-parser.d.ts +4 -0
  453. package/dist/vascend/code-parser.js +257 -0
  454. package/dist/vascend/competitor-knowledge.d.ts +53 -0
  455. package/dist/vascend/competitor-knowledge.js +262 -0
  456. package/dist/vascend/completeness.d.ts +16 -0
  457. package/dist/vascend/completeness.js +90 -0
  458. package/dist/vascend/context-autotuner.d.ts +45 -0
  459. package/dist/vascend/context-autotuner.js +231 -0
  460. package/dist/vascend/context-candidate.d.ts +45 -0
  461. package/dist/vascend/context-candidate.js +150 -0
  462. package/dist/vascend/context-capsule.d.ts +51 -0
  463. package/dist/vascend/context-capsule.js +133 -0
  464. package/dist/vascend/context-fabric.d.ts +108 -0
  465. package/dist/vascend/context-fabric.js +480 -0
  466. package/dist/vascend/context-feedback-loop.d.ts +56 -0
  467. package/dist/vascend/context-feedback-loop.js +204 -0
  468. package/dist/vascend/context-learning-identity.d.ts +4 -0
  469. package/dist/vascend/context-learning-identity.js +8 -0
  470. package/dist/vascend/context-links.d.ts +14 -0
  471. package/dist/vascend/context-links.js +83 -0
  472. package/dist/vascend/context-lint.d.ts +22 -0
  473. package/dist/vascend/context-lint.js +91 -0
  474. package/dist/vascend/context-market-selection.d.ts +17 -0
  475. package/dist/vascend/context-market-selection.js +50 -0
  476. package/dist/vascend/context-metrics.d.ts +25 -0
  477. package/dist/vascend/context-metrics.js +57 -0
  478. package/dist/vascend/context-pack-render.d.ts +16 -0
  479. package/dist/vascend/context-pack-render.js +52 -0
  480. package/dist/vascend/context-pareto.d.ts +33 -0
  481. package/dist/vascend/context-pareto.js +165 -0
  482. package/dist/vascend/context-pattern-explorer.d.ts +41 -0
  483. package/dist/vascend/context-pattern-explorer.js +276 -0
  484. package/dist/vascend/context-regret.d.ts +32 -0
  485. package/dist/vascend/context-regret.js +93 -0
  486. package/dist/vascend/context-retriever.d.ts +22 -0
  487. package/dist/vascend/context-retriever.js +243 -0
  488. package/dist/vascend/context-scope-index.d.ts +5 -0
  489. package/dist/vascend/context-scope-index.js +96 -0
  490. package/dist/vascend/context-scorer.d.ts +35 -0
  491. package/dist/vascend/context-scorer.js +162 -0
  492. package/dist/vascend/context-search-index.d.ts +12 -0
  493. package/dist/vascend/context-search-index.js +25 -0
  494. package/dist/vascend/context-snapshot.d.ts +22 -0
  495. package/dist/vascend/context-snapshot.js +135 -0
  496. package/dist/vascend/context-window-compiler.d.ts +42 -0
  497. package/dist/vascend/context-window-compiler.js +237 -0
  498. package/dist/vascend/contract-memory.d.ts +61 -0
  499. package/dist/vascend/contract-memory.js +435 -0
  500. package/dist/vascend/council.d.ts +58 -0
  501. package/dist/vascend/council.js +337 -0
  502. package/dist/vascend/decision-promotion.d.ts +48 -0
  503. package/dist/vascend/decision-promotion.js +410 -0
  504. package/dist/vascend/delta-context.d.ts +12 -0
  505. package/dist/vascend/delta-context.js +36 -0
  506. package/dist/vascend/dev-context-compiler.d.ts +27 -0
  507. package/dist/vascend/dev-context-compiler.js +133 -0
  508. package/dist/vascend/dev-context-layout.d.ts +30 -0
  509. package/dist/vascend/dev-context-layout.js +262 -0
  510. package/dist/vascend/evidence-slots.d.ts +14 -0
  511. package/dist/vascend/evidence-slots.js +55 -0
  512. package/dist/vascend/expansion-levels.d.ts +15 -0
  513. package/dist/vascend/expansion-levels.js +178 -0
  514. package/dist/vascend/file-lock.d.ts +7 -0
  515. package/dist/vascend/file-lock.js +95 -0
  516. package/dist/vascend/granular-kingdom.d.ts +25 -0
  517. package/dist/vascend/granular-kingdom.js +259 -0
  518. package/dist/vascend/granular-launcher.d.ts +48 -0
  519. package/dist/vascend/granular-launcher.js +202 -0
  520. package/dist/vascend/kingdom-bus.d.ts +25 -0
  521. package/dist/vascend/kingdom-bus.js +54 -0
  522. package/dist/vascend/kingdom-channel.d.ts +22 -0
  523. package/dist/vascend/kingdom-channel.js +180 -0
  524. package/dist/vascend/kingdom-kpi.d.ts +48 -0
  525. package/dist/vascend/kingdom-kpi.js +172 -0
  526. package/dist/vascend/kingdom-live.d.ts +28 -0
  527. package/dist/vascend/kingdom-live.js +61 -0
  528. package/dist/vascend/kingdom-run.d.ts +18 -0
  529. package/dist/vascend/kingdom-run.js +506 -0
  530. package/dist/vascend/kingdom-scribe.d.ts +20 -0
  531. package/dist/vascend/kingdom-scribe.js +52 -0
  532. package/dist/vascend/kingdom.d.ts +79 -0
  533. package/dist/vascend/kingdom.js +870 -0
  534. package/dist/vascend/lexical-index.d.ts +10 -0
  535. package/dist/vascend/lexical-index.js +99 -0
  536. package/dist/vascend/lexical-search.d.ts +29 -0
  537. package/dist/vascend/lexical-search.js +262 -0
  538. package/dist/vascend/long-term-context.d.ts +51 -0
  539. package/dist/vascend/long-term-context.js +194 -0
  540. package/dist/vascend/mandate.d.ts +33 -0
  541. package/dist/vascend/mandate.js +107 -0
  542. package/dist/vascend/memory-packet.d.ts +13 -0
  543. package/dist/vascend/memory-packet.js +155 -0
  544. package/dist/vascend/memory-status.d.ts +22 -0
  545. package/dist/vascend/memory-status.js +73 -0
  546. package/dist/vascend/memory-store.d.ts +62 -0
  547. package/dist/vascend/memory-store.js +273 -0
  548. package/dist/vascend/objective-revision.d.ts +69 -0
  549. package/dist/vascend/objective-revision.js +319 -0
  550. package/dist/vascend/patch-plan-store.d.ts +33 -0
  551. package/dist/vascend/patch-plan-store.js +240 -0
  552. package/dist/vascend/patch-plan.d.ts +97 -0
  553. package/dist/vascend/patch-plan.js +345 -0
  554. package/dist/vascend/plan-progress.d.ts +11 -0
  555. package/dist/vascend/plan-progress.js +68 -0
  556. package/dist/vascend/plan-store.d.ts +64 -0
  557. package/dist/vascend/plan-store.js +460 -0
  558. package/dist/vascend/proof-chains.d.ts +19 -0
  559. package/dist/vascend/proof-chains.js +120 -0
  560. package/dist/vascend/ramification-store.d.ts +25 -0
  561. package/dist/vascend/ramification-store.js +94 -0
  562. package/dist/vascend/ramification.d.ts +193 -0
  563. package/dist/vascend/ramification.js +583 -0
  564. package/dist/vascend/recall-planner.d.ts +17 -0
  565. package/dist/vascend/recall-planner.js +109 -0
  566. package/dist/vascend/requirements.d.ts +31 -0
  567. package/dist/vascend/requirements.js +151 -0
  568. package/dist/vascend/reviewer.d.ts +9 -0
  569. package/dist/vascend/reviewer.js +93 -0
  570. package/dist/vascend/room-graph.d.ts +29 -0
  571. package/dist/vascend/room-graph.js +242 -0
  572. package/dist/vascend/room-memory.d.ts +57 -0
  573. package/dist/vascend/room-memory.js +631 -0
  574. package/dist/vascend/runtime.d.ts +84 -0
  575. package/dist/vascend/runtime.js +286 -0
  576. package/dist/vascend/self-improve.d.ts +104 -0
  577. package/dist/vascend/self-improve.js +396 -0
  578. package/dist/vascend/session-search.d.ts +52 -0
  579. package/dist/vascend/session-search.js +349 -0
  580. package/dist/vascend/supersession-graph.d.ts +14 -0
  581. package/dist/vascend/supersession-graph.js +70 -0
  582. package/dist/vascend/team-areas.d.ts +9 -0
  583. package/dist/vascend/team-areas.js +28 -0
  584. package/dist/vascend/team-handoff.d.ts +24 -0
  585. package/dist/vascend/team-handoff.js +37 -0
  586. package/dist/vascend/team-scheduler.d.ts +13 -0
  587. package/dist/vascend/team-scheduler.js +74 -0
  588. package/dist/vascend/team-session.d.ts +42 -0
  589. package/dist/vascend/team-session.js +142 -0
  590. package/dist/vascend/test-failure-memory.d.ts +76 -0
  591. package/dist/vascend/test-failure-memory.js +354 -0
  592. package/dist/vascend/token-market.d.ts +42 -0
  593. package/dist/vascend/token-market.js +144 -0
  594. package/dist/vascend/tuner-baseline-store.d.ts +52 -0
  595. package/dist/vascend/tuner-baseline-store.js +446 -0
  596. package/dist/vascend/user-profile.d.ts +44 -0
  597. package/dist/vascend/user-profile.js +131 -0
  598. package/dist/vascend/vision.d.ts +94 -0
  599. package/dist/vascend/vision.js +375 -0
  600. package/dist/vascend/work-agent.d.ts +12 -0
  601. package/dist/vascend/work-agent.js +83 -0
  602. package/dist/vascend/work-queue.d.ts +62 -0
  603. package/dist/vascend/work-queue.js +255 -0
  604. package/dist/vascend/work-runner.d.ts +64 -0
  605. package/dist/vascend/work-runner.js +137 -0
  606. package/dist/vascend/worktree.d.ts +38 -0
  607. package/dist/vascend/worktree.js +206 -0
  608. package/dist/vendor/computer-use/README.md +7 -0
  609. package/dist/vendor/computer-use/computer-desktop.js +211 -0
  610. package/dist/vendor/computer-use/computer-observe.js +315 -0
  611. package/dist/vendor/computer-use/computer-scripts.js +1230 -0
  612. package/dist/vendor/computer-use/computer-tools.js +2136 -0
  613. package/dist/vendor/computer-use/package.json +1 -0
  614. package/dist/vendor/computer-use/rac/atomic-input.js +91 -0
  615. package/dist/vendor/computer-use/rac/grammatica.js +101 -0
  616. package/dist/vendor/computer-use/rac/parser.js +185 -0
  617. package/dist/vendor/computer-use/rac/protocol.js +136 -0
  618. package/install.ps1 +30 -0
  619. package/install.sh +50 -0
  620. package/package.json +56 -0
@@ -0,0 +1,417 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { isAbsolute, join, relative, resolve } from "node:path";
3
+ import { DEFAULT_COMPACTION } from "./compaction.js";
4
+ import { VASCEND_SYSTEM_BLOCK } from "../vascend/runtime.js";
5
+ import { parseVibeMode } from "./vibe-modes.js";
6
+ import { defaultSessionDir, talosConfigDir } from "./env-paths.js";
7
+ import { EXECUTION_GUIDANCE } from "./execution-guidance.js";
8
+ // System prompt deliberatamente minimale: la personalita' e le regole
9
+ // di progetto arrivano da SYSTEM.md / AGENTS.md, non dal harness.
10
+ export const BASE_SYSTEM = `# Vascend Talos
11
+
12
+ INDICE
13
+ 1 = agente
14
+ 2 = workspace
15
+ 3 = strumento
16
+ 4 = azione
17
+
18
+ DEFINIZIONI
19
+ @agente[ruolo]: coding_agent in terminale, conciso, diretto
20
+ @workspace[fonte]: ispeziona coi tool invece di indovinare
21
+ @strumento[uso]: read/edit/bash per agire sul workspace, non descrivere
22
+ @strumento[terminale]: per ricerca e ispezione del codice preferisci bash con rg e rg --files, git diff/status e comandi nativi della shell selezionata. Limita path e output a cio' che serve. Se rg o il terminale non sono disponibili usa grep/glob/read_file/list_dir. Per modifiche puntuali usa edit_file/write_file e rispetta il coordinamento dei file
23
+ @strumento[write_grande]: per file lunghi (oltre ~150 righe) scrivi in PIU' chiamate write_file: la prima crea il file, le successive con append=true accodano il resto. Un singolo write enorme puo' essere troncato dal limite di output e fallire
24
+ @strumento[ricerca]: prima di costruire qualcosa di non banale, RICERCA con web_fetch (documentazione, riferimenti, esempi) invece di indovinare le API
25
+ @strumento[domanda]: se un requisito e' davvero ambiguo e cambia il risultato, usa ask_user PRIMA di procedere; per i dettagli minori assumi il default ragionevole e dichiaralo, non fermarti di continuo
26
+ @strumento[risposta_mancante]: ask_user required=true mantiene esplicita l'informazione necessaria non ricevuta; prosegui solo col lavoro indipendente. required=false serve per preferenze facoltative e reversibili. Silenzio e annullamento non sono consenso
27
+ @strumento[e2e]: per un obiettivo grande (es. ricostruire una piattaforma) pianifica con vascend_plan in piu' gruppi/attivita, ricerca, costruisci una BOZZA COMPLETA end-to-end; annota le decisioni con vascend_note
28
+ @strumento[collaboratori]: chiama team_engage soltanto quando l'utente chiede esplicitamente piu' agenti, sub-agent o lavoro parallelo; una domanda informativa, un controllo del workspace o un task semplice restano sempre sul singolo agente principale
29
+ @strumento[ripresa]: vascend_status legge task, dipendenze, note e prove persistite; riprendi il piano esistente dopo resume/compattazione. vascend_addtasks estende, vascend_note conserva decisioni. replace=true ridefinisce esplicitamente un piano, perdendo i suoi progressi
30
+ @strumento[verifica]: definisci passi con un risultato osservabile e una verifica pertinente; running prima del lavoro, completed solo dopo verifica. Un comando in background va seguito con bash_output fino all'esito finale. Le prove salvate sono evidenze da controllare, non certificazioni
31
+ @azione[proporzione]: mantieni piano, strumenti e verifiche proporzionati al compito; le richieste semplici o a singolo passo non richiedono piano ne' collaboratori
32
+ @azione[distruttiva]: spiega prima cosa stai per fare
33
+ @azione[fine]: a compito finito fermati, niente riepiloghi superflui
34
+
35
+ OUTPUT: agente di coding che agisce coi tool, conciso, con risposte Markdown leggibili.
36
+
37
+ ${EXECUTION_GUIDANCE}`;
38
+ // Horizon e' un host grafico: stato, progress e tool call sono gia' presentati
39
+ // dalla UI. Il system prompt del core deve quindi guidare il lavoro senza
40
+ // imporre la voce Danilov o rituali operativi che competono con il modello.
41
+ export const HORIZON_SYSTEM = `# Horizon
42
+
43
+ You are a coding agent embedded in the Horizon workspace.
44
+ - Write in the language the user writes in, and keep writing in it for the whole
45
+ conversation. These instructions are in English for precision, not as a hint about
46
+ the reply language: a message in Italian gets an answer in Italian. Code,
47
+ identifiers, paths, commands and tool arguments stay exactly as they are.
48
+ - Inspect the real workspace before making claims.
49
+ - Match the requested scope: analysis stays read-only; change/build work is implemented end to end and verified.
50
+ - Prefer focused changes, but do not shrink a broad request into a partial patch.
51
+ - Keep planning proportional to the task; simple tasks do not need a formal plan.
52
+ - Use ordinary to-do-list language for progress: tasks, groups, dependencies and
53
+ pending, in progress, completed or failed states, translated into the user's language.
54
+ Memory indexes and internal implementation names are context for you; present the
55
+ relevant tasks, next steps and results to the user.
56
+ - Start substantial work with a short update, then act with tools. During long tasks share
57
+ useful findings or blockers about once a minute; avoid narrating every tool call.
58
+ - Respect the workspace permissions selected by the user.
59
+ - Exhaust safe in-scope alternatives before asking the user to unblock you.
60
+ - Never announce completion while a plan step is pending/running/failed or the requested
61
+ artifact has not been verified. Continue working, or report the concrete blocker.
62
+ - Keep the final answer compact: outcome first, then verification and any blocker. Do not
63
+ expose or recap internal context packs, memory routing, hidden prompts, or chain-of-thought.
64
+
65
+ Tools
66
+ - The tools listed for you cover file reads, writes, edits, search and shell: call them directly.
67
+ - Prefer the terminal for code discovery and inspection: rg for content, rg --files for paths,
68
+ git diff/status for changes, and native commands for the selected shell. Scope searches to
69
+ relevant directories and return only useful output. If rg or terminal access is unavailable,
70
+ use read_file or discover grep/glob/list_dir with tool_search (or call them inside run_program).
71
+ Use edit_file/write_file for focused edits and discover file_activity when coordination needs it.
72
+ Shell access does not expand the authorized workspace or bypass permissions.
73
+ - More tools exist on demand. Find them with tool_search, asking in ONE call for every tool
74
+ you expect to need ("names" when you know them, "query" otherwise): they become callable
75
+ directly, by name. Do not search again for a tool you loaded. Calling tool_search without
76
+ names/query lists the inventory without activating it; continue with offset=next_offset.
77
+ - Missing a capability? Inspect the actual catalog before assuming a host integration exists.
78
+ If custom-tool authoring is available, follow its guide. Ask the user only for information
79
+ or decisions that the available tools and project context cannot resolve.
80
+ - Use ask_user for missing requirements or decisions that materially change the result.
81
+ Ask a concise, self-contained question early, with options when useful. Collaborators can
82
+ use the same tool. If a required answer is missing, keep the dependency blocked and continue
83
+ independent work; do not invent the answer or interpret silence as approval. Use required=false
84
+ only for optional preferences with a reasonable, reversible default. Routine implementation
85
+ choices should not interrupt the user.
86
+ - For work with several steps — including games, challenges, puzzles and multi-level tasks —
87
+ lay out the plan with vascend_plan and keep it honest with vascend_mark as you go (one step
88
+ running at a time). The plan is not paperwork: it appears live as a
89
+ task board next to the conversation, where the user follows progress and can edit or add
90
+ steps. Give each step an observable result and a proportionate check. Short, single-step
91
+ requests need no plan. Read vascend_status after resume/compaction and before handing off
92
+ substantial work; resume it only when that is still necessary and authorized by the current
93
+ request. vascend_addtasks extends it without resetting
94
+ progress; vascend_plan with replace=true explicitly replaces it. Save decisions, blockers
95
+ and the next action with vascend_note before switching workstreams.
96
+ - Start a step with vascend_mark status=running. Complete it only after the relevant checks,
97
+ recording paths, commands and observed outcomes. Evidence in the plan is a record to inspect,
98
+ not an automatic correctness certificate. Reopening a step clears old completion evidence.
99
+ Respect after dependencies; use pending to pause a step and failed to record a concrete blocker.
100
+ - A plan is not a collaborator. When the user asks for multiple agents, subagents or parallel
101
+ experts, actually call team_engage: create one collaborator per independent workstream and
102
+ assign its complete task. If vascend_plan already created several task groups, pass their slugs
103
+ through the group field so those collaborators own and update the same T01/T02 tasks. Do not
104
+ merely draw multiple workstreams and then execute all of them in the orchestrator.
105
+ - Issue independent reads together. For related tool sequences use run_program and print only
106
+ the results needed for the next decision; keep dependent edits and approvals sequential.
107
+ - When bash returns a background id, use bash_output until the process exits. Partial output
108
+ or a started process does not mean the check passed. Leave persistent development servers
109
+ running when they are needed and report their status separately from verification results.
110
+ - Act on what is already in context: do not re-read a file or repeat a search whose result
111
+ you still have.
112
+ - If a tool reports a missing or malformed argument, fix the argument shape it names — do not
113
+ retry the same call unchanged.
114
+
115
+ ${EXECUTION_GUIDANCE}`;
116
+ // File di contesto a livello progetto, in ordine di priorita'.
117
+ const DEFAULT_CONTEXT_FILES = ["SYSTEM.md", "AGENTS.md", ".talos/SYSTEM.md"];
118
+ const DEFAULT_UI = {
119
+ banner: "vascend-terminal",
120
+ logoLines: [],
121
+ title: "Vascend Talos",
122
+ subtitle: "harness customizzabile per agenti da terminale",
123
+ prompt: "› ",
124
+ accentColor: "cyan",
125
+ mutedColor: "dim",
126
+ showMeta: true,
127
+ theme: "",
128
+ };
129
+ function isRecord(value) {
130
+ return typeof value === "object" && value !== null && !Array.isArray(value);
131
+ }
132
+ function text(value) {
133
+ return typeof value === "string" && value.length > 0 ? value : undefined;
134
+ }
135
+ function positiveInt(value) {
136
+ const n = typeof value === "number" ? value : typeof value === "string" ? Number(value) : NaN;
137
+ return Number.isInteger(n) && n > 0 ? n : undefined;
138
+ }
139
+ function bool(value) {
140
+ if (typeof value === "boolean")
141
+ return value;
142
+ if (typeof value !== "string")
143
+ return undefined;
144
+ if (/^(1|true|yes|on)$/i.test(value))
145
+ return true;
146
+ if (/^(0|false|no|off)$/i.test(value))
147
+ return false;
148
+ return undefined;
149
+ }
150
+ function textArray(value) {
151
+ if (Array.isArray(value)) {
152
+ const lines = value.filter((item) => typeof item === "string");
153
+ return lines.length ? lines : undefined;
154
+ }
155
+ if (typeof value === "string" && value.trim()) {
156
+ return value.split(/\r?\n|\|/).filter((line) => line.length > 0);
157
+ }
158
+ return undefined;
159
+ }
160
+ function csv(value) {
161
+ if (Array.isArray(value))
162
+ return textArray(value);
163
+ if (typeof value !== "string" || !value.trim())
164
+ return undefined;
165
+ return value.split(",").map((item) => item.trim()).filter(Boolean);
166
+ }
167
+ function color(value) {
168
+ const v = text(value);
169
+ return v && ["blue", "cyan", "dim", "gray", "green", "magenta", "red", "white", "yellow"].includes(v)
170
+ ? v
171
+ : undefined;
172
+ }
173
+ function banner(value) {
174
+ const v = text(value);
175
+ return v && ["vascend-terminal", "minimal", "custom", "none"].includes(v) ? v : undefined;
176
+ }
177
+ function effort(value) {
178
+ const v = typeof value === "string" ? value.trim().toLowerCase() : undefined;
179
+ return v && ["", "none", "minimal", "low", "medium", "high", "xhigh", "max"].includes(v) ? v : undefined;
180
+ }
181
+ function permMode(value) {
182
+ const v = typeof value === "string" ? value.trim() : undefined;
183
+ // Migrate the removed mode without changing its permission policy.
184
+ if (v === "autoDanilov")
185
+ return "auto";
186
+ return v && ["normal", "acceptEdits", "auto"].includes(v) ? v : undefined;
187
+ }
188
+ function resolveFrom(cwd, path) {
189
+ return isAbsolute(path) ? path : resolve(cwd, path);
190
+ }
191
+ function inside(base, target) {
192
+ const rel = relative(base, target);
193
+ return rel === "" || (!rel.startsWith("..") && !isAbsolute(rel));
194
+ }
195
+ function loadProjectContext(cwd, contextFiles) {
196
+ const blocks = [];
197
+ for (const name of contextFiles) {
198
+ const p = resolveFrom(cwd, name);
199
+ if (!inside(cwd, p))
200
+ continue;
201
+ if (existsSync(p)) {
202
+ blocks.push(`# Da ${name}\n\n${readFileSync(p, "utf8").trim()}`);
203
+ }
204
+ }
205
+ return blocks.join("\n\n");
206
+ }
207
+ function parseUi(raw) {
208
+ if (!isRecord(raw))
209
+ return undefined;
210
+ return {
211
+ banner: banner(raw["banner"]),
212
+ logoLines: textArray(raw["logoLines"]),
213
+ title: text(raw["title"]),
214
+ subtitle: text(raw["subtitle"]),
215
+ prompt: text(raw["prompt"]),
216
+ accentColor: color(raw["accentColor"]),
217
+ mutedColor: color(raw["mutedColor"]),
218
+ showMeta: bool(raw["showMeta"]),
219
+ theme: text(raw["theme"]),
220
+ };
221
+ }
222
+ function parseCompaction(raw) {
223
+ if (!isRecord(raw))
224
+ return undefined;
225
+ return {
226
+ enabled: bool(raw["enabled"]),
227
+ reserveTokens: positiveInt(raw["reserveTokens"]),
228
+ keepRecentTokens: positiveInt(raw["keepRecentTokens"]),
229
+ perRoom: bool(raw["perRoom"]),
230
+ roomFanout: positiveInt(raw["roomFanout"]),
231
+ };
232
+ }
233
+ function parseConfigFile(path) {
234
+ let raw;
235
+ try {
236
+ raw = JSON.parse(readFileSync(path, "utf8"));
237
+ }
238
+ catch (err) {
239
+ // Un config corrotto (es. scrittura troncata da disco pieno) non deve
240
+ // impedire l'avvio: lo si ignora con un avviso e si usano i default.
241
+ process.stderr.write(`[avviso] config ignorata (JSON non valido): ${path} — ${err.message}\n`);
242
+ return {};
243
+ }
244
+ if (!isRecord(raw))
245
+ return {};
246
+ return {
247
+ model: text(raw["model"]),
248
+ maxTokens: positiveInt(raw["maxTokens"]),
249
+ sessionDir: text(raw["sessionDir"]),
250
+ contextFiles: csv(raw["contextFiles"]),
251
+ systemAppend: text(raw["systemAppend"]),
252
+ ui: parseUi(raw["ui"]),
253
+ compaction: parseCompaction(raw["compaction"]),
254
+ contextWindow: positiveInt(raw["contextWindow"]),
255
+ effort: effort(raw["effort"]),
256
+ fast: bool(raw["fast"]),
257
+ permMode: permMode(raw["permMode"]),
258
+ statusLine: Array.isArray(raw["statusLine"]) ? raw["statusLine"].map(String) : undefined,
259
+ vibeMode: parseVibeMode(raw["vibeMode"]),
260
+ };
261
+ }
262
+ function envPatch(env) {
263
+ return {
264
+ model: text(env["TALOS_MODEL"]),
265
+ maxTokens: positiveInt(env["TALOS_MAX_TOKENS"]),
266
+ sessionDir: text(env["TALOS_SESSION_DIR"]),
267
+ contextFiles: csv(env["TALOS_CONTEXT_FILES"]),
268
+ systemAppend: text(env["TALOS_SYSTEM_APPEND"]),
269
+ ui: {
270
+ banner: banner(env["TALOS_BANNER"]),
271
+ logoLines: textArray(env["TALOS_LOGO_LINES"]),
272
+ title: text(env["TALOS_TITLE"]),
273
+ subtitle: text(env["TALOS_SUBTITLE"]),
274
+ prompt: text(env["TALOS_PROMPT"]),
275
+ accentColor: color(env["TALOS_ACCENT_COLOR"]),
276
+ mutedColor: color(env["TALOS_MUTED_COLOR"]),
277
+ showMeta: bool(env["TALOS_SHOW_META"]),
278
+ theme: text(env["TALOS_THEME"]),
279
+ },
280
+ compaction: {
281
+ enabled: bool(env["TALOS_COMPACTION"]),
282
+ reserveTokens: positiveInt(env["TALOS_RESERVE_TOKENS"]),
283
+ keepRecentTokens: positiveInt(env["TALOS_KEEP_RECENT_TOKENS"]),
284
+ perRoom: bool(env["TALOS_ROOM_MEMORY"]),
285
+ roomFanout: positiveInt(env["TALOS_ROOM_FANOUT"]),
286
+ },
287
+ // TALOS_CONTEXT_WINDOW numerico ha precedenza; TALOS_CONTEXT_1M=1 e' la
288
+ // scorciatoia per la finestra 1M (Opus/Sonnet con beta context-1m).
289
+ contextWindow: positiveInt(env["TALOS_CONTEXT_WINDOW"]) ?? (bool(env["TALOS_CONTEXT_1M"]) ? 1_000_000 : undefined),
290
+ effort: effort(env["TALOS_EFFORT"]),
291
+ fast: bool(env["TALOS_FAST"]),
292
+ permMode: permMode(env["TALOS_PERM_MODE"]),
293
+ vibeMode: parseVibeMode(env["TALOS_VIBE_MODE"]),
294
+ };
295
+ }
296
+ function mergeCompaction(base, patch) {
297
+ if (!patch)
298
+ return base;
299
+ return {
300
+ enabled: patch.enabled ?? base.enabled,
301
+ reserveTokens: patch.reserveTokens ?? base.reserveTokens,
302
+ keepRecentTokens: patch.keepRecentTokens ?? base.keepRecentTokens,
303
+ perRoom: patch.perRoom ?? base.perRoom,
304
+ roomFanout: patch.roomFanout ?? base.roomFanout,
305
+ };
306
+ }
307
+ function mergeUi(base, patch) {
308
+ if (!patch)
309
+ return base;
310
+ return {
311
+ banner: patch.banner ?? base.banner,
312
+ logoLines: patch.logoLines ?? base.logoLines,
313
+ title: patch.title ?? base.title,
314
+ subtitle: patch.subtitle ?? base.subtitle,
315
+ prompt: patch.prompt ?? base.prompt,
316
+ accentColor: patch.accentColor ?? base.accentColor,
317
+ mutedColor: patch.mutedColor ?? base.mutedColor,
318
+ showMeta: patch.showMeta ?? base.showMeta,
319
+ theme: patch.theme ?? base.theme,
320
+ };
321
+ }
322
+ function mergeConfig(base, patch) {
323
+ const systemAppend = patch.systemAppend
324
+ ? [base.systemAppend, patch.systemAppend].filter(Boolean).join("\n\n")
325
+ : base.systemAppend;
326
+ return {
327
+ ...base,
328
+ model: patch.model ?? base.model,
329
+ maxTokens: patch.maxTokens ?? base.maxTokens,
330
+ sessionDir: patch.sessionDir ?? base.sessionDir,
331
+ contextFiles: patch.contextFiles ?? base.contextFiles,
332
+ systemAppend,
333
+ ui: mergeUi(base.ui, patch.ui),
334
+ compaction: mergeCompaction(base.compaction, patch.compaction),
335
+ contextWindow: patch.contextWindow ?? base.contextWindow,
336
+ effort: patch.effort ?? base.effort,
337
+ fast: patch.fast ?? base.fast,
338
+ permMode: patch.permMode ?? base.permMode,
339
+ statusLine: patch.statusLine ?? base.statusLine,
340
+ vibeMode: patch.vibeMode ?? base.vibeMode,
341
+ };
342
+ }
343
+ function configFiles(cwd, env) {
344
+ const discovered = [
345
+ env["TALOS_NO_GLOBAL_CONFIG"] === "1" ? undefined : join(talosConfigDir(env), "config.json"),
346
+ join(cwd, "talos.config.json"),
347
+ join(cwd, ".talos", "config.json"),
348
+ ].filter((path) => typeof path === "string" && existsSync(path));
349
+ const explicit = text(env["TALOS_CONFIG"]);
350
+ if (!explicit)
351
+ return discovered;
352
+ const explicitPath = resolveFrom(cwd, explicit);
353
+ if (!existsSync(explicitPath))
354
+ throw new Error(`config Talos non trovata: ${explicitPath}`);
355
+ return [...discovered, explicitPath];
356
+ }
357
+ function applyConfigFiles(cwd, env, initial) {
358
+ return configFiles(cwd, env).reduce((acc, file) => {
359
+ const patch = parseConfigFile(file);
360
+ const next = mergeConfig(acc, patch);
361
+ return { ...next, loadedConfigFiles: [...next.loadedConfigFiles, file] };
362
+ }, initial);
363
+ }
364
+ export function buildConfig(opts) {
365
+ const cwd = resolve(opts.cwd ?? process.cwd());
366
+ const base = {
367
+ model: "anthropic/claude-sonnet-4-6",
368
+ // 0 = AUTO: il provider usa il massimo di output del modello (niente tetto
369
+ // fisso che troncherebbe i file lunghi). Override con maxTokens nel config.
370
+ maxTokens: 0,
371
+ sessionDir: defaultSessionDir(cwd, opts.env),
372
+ contextFiles: DEFAULT_CONTEXT_FILES,
373
+ systemAppend: "",
374
+ loadedConfigFiles: [],
375
+ ui: DEFAULT_UI,
376
+ compaction: DEFAULT_COMPACTION,
377
+ contextWindow: 0,
378
+ effort: "",
379
+ fast: false,
380
+ permMode: "normal",
381
+ vibeMode: "auto",
382
+ };
383
+ const withFiles = applyConfigFiles(cwd, opts.env, base);
384
+ const withEnv = mergeConfig(withFiles, envPatch(opts.env));
385
+ const finalConfig = mergeConfig(withEnv, { model: opts.model });
386
+ const projectCtx = loadProjectContext(cwd, finalConfig.contextFiles);
387
+ const hostProfile = opts.env["TALOS_HOST_PROFILE"]?.trim().toLowerCase() ?? "";
388
+ const horizonHost = hostProfile === "horizon";
389
+ // Talos e' il CLI di Horizon: la chat del terminale usa la STESSA guida della
390
+ // chat di Horizon (voce naturale, piano via vascend_plan/board, tool file).
391
+ // Il system nativo in notazione Danilov resta raggiungibile con
392
+ // TALOS_HOST_PROFILE=danilov per i flussi che parlano in notazione.
393
+ // Legacy host profiles now use the standard conversational interface.
394
+ const system = [
395
+ HORIZON_SYSTEM,
396
+ projectCtx ? `---\n\n${projectCtx}` : "",
397
+ finalConfig.systemAppend ? `---\n\n# Da configurazione Talos\n\n${finalConfig.systemAppend}` : "",
398
+ ].filter(Boolean).join("\n\n");
399
+ return {
400
+ cwd,
401
+ model: finalConfig.model,
402
+ maxTokens: finalConfig.maxTokens,
403
+ system,
404
+ autoDelegatePlans: horizonHost,
405
+ sessionDir: resolveFrom(cwd, finalConfig.sessionDir),
406
+ contextFiles: finalConfig.contextFiles,
407
+ loadedConfigFiles: finalConfig.loadedConfigFiles,
408
+ ui: finalConfig.ui,
409
+ compaction: finalConfig.compaction,
410
+ contextWindow: finalConfig.contextWindow,
411
+ effort: finalConfig.effort,
412
+ fast: finalConfig.fast,
413
+ permMode: finalConfig.permMode,
414
+ statusLine: finalConfig.statusLine,
415
+ vibeMode: finalConfig.vibeMode,
416
+ };
417
+ }
@@ -0,0 +1,99 @@
1
+ import type { Message, ToolDef } from "./types.js";
2
+ export interface ContextBlockInput {
3
+ readonly key: string;
4
+ readonly label: string;
5
+ readonly text?: string;
6
+ readonly tokens?: number;
7
+ readonly cacheable?: boolean;
8
+ readonly detail?: string;
9
+ }
10
+ export interface ContextSlice {
11
+ readonly key: string;
12
+ readonly label: string;
13
+ readonly tokens: number;
14
+ readonly share: number;
15
+ readonly cacheable: boolean;
16
+ readonly detail?: string;
17
+ }
18
+ export interface ContextHeavyItem {
19
+ readonly kind: "tool_result" | "tool_call" | "text" | "image";
20
+ readonly label: string;
21
+ readonly tokens: number;
22
+ readonly role: string;
23
+ }
24
+ export interface ContextHistoryStats {
25
+ readonly messages: number;
26
+ readonly textTokens: number;
27
+ readonly toolCallTokens: number;
28
+ readonly toolResultTokens: number;
29
+ readonly toolResults: number;
30
+ readonly images: number;
31
+ readonly imageTokens: number;
32
+ }
33
+ export interface ContextPackStats {
34
+ readonly tokens: number;
35
+ readonly selected: number;
36
+ readonly dropped: number;
37
+ readonly utility?: number;
38
+ readonly staleRate?: number;
39
+ }
40
+ export interface ContextLedger {
41
+ readonly admission?: {
42
+ readonly estimatedInputTokens: number;
43
+ readonly calibration: number;
44
+ readonly outputTokens: number;
45
+ readonly fits: boolean;
46
+ };
47
+ readonly at: number;
48
+ readonly model: string;
49
+ readonly turn: number;
50
+ readonly window: number;
51
+ readonly reserve: number;
52
+ readonly compactAt: number;
53
+ readonly tokens: number;
54
+ readonly fraction: number;
55
+ readonly pressure: number;
56
+ readonly cacheable: number;
57
+ readonly volatile: number;
58
+ readonly slices: readonly ContextSlice[];
59
+ readonly history: ContextHistoryStats;
60
+ readonly tools: {
61
+ readonly total: number;
62
+ readonly tokens: number;
63
+ };
64
+ readonly compaction: {
65
+ readonly at: number;
66
+ readonly tokensBefore: number;
67
+ readonly summaryTokens: number;
68
+ } | null;
69
+ readonly heaviest: readonly ContextHeavyItem[];
70
+ readonly pack: ContextPackStats | null;
71
+ readonly demoted: {
72
+ readonly count: number;
73
+ readonly freedTokens: number;
74
+ } | null;
75
+ }
76
+ export interface ContextLedgerInput {
77
+ readonly model: string;
78
+ readonly turn?: number;
79
+ readonly contextWindow?: number;
80
+ readonly reserveTokens?: number;
81
+ readonly workingContextTokens?: number;
82
+ readonly system: string;
83
+ readonly systemBlocks?: readonly ContextBlockInput[];
84
+ readonly turnBlocks?: readonly ContextBlockInput[];
85
+ readonly tools?: readonly ToolDef[];
86
+ readonly messages?: readonly Message[];
87
+ readonly compaction?: {
88
+ readonly ts: number;
89
+ readonly tokensBefore: number;
90
+ readonly summary: string;
91
+ } | null;
92
+ readonly pack?: ContextPackStats | null;
93
+ readonly demoted?: {
94
+ readonly count: number;
95
+ readonly freedTokens: number;
96
+ } | null;
97
+ readonly now?: number;
98
+ }
99
+ export declare function buildContextLedger(input: ContextLedgerInput): ContextLedger;