@aexol/spectral 0.8.2 → 0.8.6

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 (588) hide show
  1. package/CHANGELOG.md +82 -55
  2. package/README.md +80 -82
  3. package/dist/agent/agents.d.ts +37 -0
  4. package/dist/agent/agents.d.ts.map +1 -0
  5. package/dist/agent/index.d.ts +29 -0
  6. package/dist/agent/index.d.ts.map +1 -0
  7. package/dist/agent/index.js +11 -11
  8. package/dist/cli.d.ts +17 -0
  9. package/dist/cli.d.ts.map +1 -0
  10. package/dist/cli.js +1 -1
  11. package/dist/commands/bind.d.ts +12 -0
  12. package/dist/commands/bind.d.ts.map +1 -0
  13. package/dist/commands/login-oauth.d.ts +15 -0
  14. package/dist/commands/login-oauth.d.ts.map +1 -0
  15. package/dist/commands/login.d.ts +37 -0
  16. package/dist/commands/login.d.ts.map +1 -0
  17. package/dist/commands/logout.d.ts +8 -0
  18. package/dist/commands/logout.d.ts.map +1 -0
  19. package/dist/commands/serve.d.ts +112 -0
  20. package/dist/commands/serve.d.ts.map +1 -0
  21. package/dist/commands/serve.js +5 -2
  22. package/dist/commands/unbind.d.ts +8 -0
  23. package/dist/commands/unbind.d.ts.map +1 -0
  24. package/dist/config.d.ts +49 -0
  25. package/dist/config.d.ts.map +1 -0
  26. package/dist/config.js +1 -1
  27. package/dist/designer/guidelines.d.ts +23 -0
  28. package/dist/designer/guidelines.d.ts.map +1 -0
  29. package/dist/designer/index.d.ts +26 -0
  30. package/dist/designer/index.d.ts.map +1 -0
  31. package/dist/designer/index.js +9 -9
  32. package/dist/designer/philosophies.d.ts +33 -0
  33. package/dist/designer/philosophies.d.ts.map +1 -0
  34. package/dist/designer/skills.d.ts +27 -0
  35. package/dist/designer/skills.d.ts.map +1 -0
  36. package/dist/designer/systems.d.ts +36 -0
  37. package/dist/designer/systems.d.ts.map +1 -0
  38. package/dist/extensions/aexol-mcp.d.ts +25 -0
  39. package/dist/extensions/aexol-mcp.d.ts.map +1 -0
  40. package/dist/extensions/aexol-mcp.js +12 -12
  41. package/dist/extensions/kanban-bridge.d.ts +24 -0
  42. package/dist/extensions/kanban-bridge.d.ts.map +1 -0
  43. package/dist/extensions/kanban-bridge.js +3 -3
  44. package/dist/extensions/openrouter-attribution.d.ts +12 -0
  45. package/dist/extensions/openrouter-attribution.d.ts.map +1 -0
  46. package/dist/extensions/openrouter-attribution.js +2 -2
  47. package/dist/extensions/spectral-vision-fallback.d.ts +23 -0
  48. package/dist/extensions/spectral-vision-fallback.d.ts.map +1 -0
  49. package/dist/extensions/spectral-vision-fallback.js +32 -23
  50. package/dist/index.d.ts +46 -0
  51. package/dist/index.d.ts.map +1 -0
  52. package/dist/index.js +44 -0
  53. package/dist/mcp/agent-dir.d.ts +3 -0
  54. package/dist/mcp/agent-dir.d.ts.map +1 -0
  55. package/dist/mcp/commands.d.ts +9 -0
  56. package/dist/mcp/commands.d.ts.map +1 -0
  57. package/dist/mcp/commands.js +1 -1
  58. package/dist/mcp/config.d.ts +78 -0
  59. package/dist/mcp/config.d.ts.map +1 -0
  60. package/dist/mcp/config.js +15 -15
  61. package/dist/mcp/consent-manager.d.ts +14 -0
  62. package/dist/mcp/consent-manager.d.ts.map +1 -0
  63. package/dist/mcp/direct-tools.d.ts +11 -0
  64. package/dist/mcp/direct-tools.d.ts.map +1 -0
  65. package/dist/mcp/errors.d.ts +100 -0
  66. package/dist/mcp/errors.d.ts.map +1 -0
  67. package/dist/mcp/glimpse-ui.d.ts +10 -0
  68. package/dist/mcp/glimpse-ui.d.ts.map +1 -0
  69. package/dist/mcp/host-html-template.d.ts +17 -0
  70. package/dist/mcp/host-html-template.d.ts.map +1 -0
  71. package/dist/mcp/host-html-template.js +3 -3
  72. package/dist/mcp/index.d.ts +3 -0
  73. package/dist/mcp/index.d.ts.map +1 -0
  74. package/dist/mcp/index.js +15 -13
  75. package/dist/mcp/init.d.ts +10 -0
  76. package/dist/mcp/init.d.ts.map +1 -0
  77. package/dist/mcp/init.js +4 -4
  78. package/dist/mcp/lifecycle.d.ts +30 -0
  79. package/dist/mcp/lifecycle.d.ts.map +1 -0
  80. package/dist/mcp/logger.d.ts +52 -0
  81. package/dist/mcp/logger.d.ts.map +1 -0
  82. package/dist/mcp/mcp-auth-flow.d.ts +69 -0
  83. package/dist/mcp/mcp-auth-flow.d.ts.map +1 -0
  84. package/dist/mcp/mcp-auth.d.ts +100 -0
  85. package/dist/mcp/mcp-auth.d.ts.map +1 -0
  86. package/dist/mcp/mcp-callback-server.d.ts +40 -0
  87. package/dist/mcp/mcp-callback-server.d.ts.map +1 -0
  88. package/dist/mcp/mcp-oauth-provider.d.ts +101 -0
  89. package/dist/mcp/mcp-oauth-provider.d.ts.map +1 -0
  90. package/dist/mcp/mcp-oauth-provider.js +1 -1
  91. package/dist/mcp/metadata-cache.d.ts +32 -0
  92. package/dist/mcp/metadata-cache.d.ts.map +1 -0
  93. package/dist/mcp/npx-resolver.d.ts +7 -0
  94. package/dist/mcp/npx-resolver.d.ts.map +1 -0
  95. package/dist/mcp/oauth-handler.d.ts +19 -0
  96. package/dist/mcp/oauth-handler.d.ts.map +1 -0
  97. package/dist/mcp/onboarding-state.d.ts +13 -0
  98. package/dist/mcp/onboarding-state.d.ts.map +1 -0
  99. package/dist/mcp/proxy-modes.d.ts +12 -0
  100. package/dist/mcp/proxy-modes.d.ts.map +1 -0
  101. package/dist/mcp/proxy-modes.js +2 -2
  102. package/dist/mcp/resource-tools.d.ts +2 -0
  103. package/dist/mcp/resource-tools.d.ts.map +1 -0
  104. package/dist/mcp/sampling-handler.d.ts +16 -0
  105. package/dist/mcp/sampling-handler.d.ts.map +1 -0
  106. package/dist/mcp/server-manager.d.ts +42 -0
  107. package/dist/mcp/server-manager.d.ts.map +1 -0
  108. package/dist/mcp/server-manager.js +2 -2
  109. package/dist/mcp/state-getter.d.ts +14 -0
  110. package/dist/mcp/state-getter.d.ts.map +1 -0
  111. package/dist/mcp/state-getter.js +21 -0
  112. package/dist/mcp/state.d.ts +41 -0
  113. package/dist/mcp/state.d.ts.map +1 -0
  114. package/dist/mcp/tool-metadata.d.ts +11 -0
  115. package/dist/mcp/tool-metadata.d.ts.map +1 -0
  116. package/dist/mcp/tool-registrar.d.ts +9 -0
  117. package/dist/mcp/tool-registrar.d.ts.map +1 -0
  118. package/dist/mcp/tool-registrar.js +1 -1
  119. package/dist/mcp/types.d.ts +263 -0
  120. package/dist/mcp/types.d.ts.map +1 -0
  121. package/dist/mcp/ui-resource-handler.d.ts +10 -0
  122. package/dist/mcp/ui-resource-handler.d.ts.map +1 -0
  123. package/dist/mcp/ui-server.d.ts +37 -0
  124. package/dist/mcp/ui-server.d.ts.map +1 -0
  125. package/dist/mcp/ui-server.js +1 -1
  126. package/dist/mcp/ui-session.d.ts +27 -0
  127. package/dist/mcp/ui-session.d.ts.map +1 -0
  128. package/dist/mcp/ui-stream-types.d.ts +197 -0
  129. package/dist/mcp/ui-stream-types.d.ts.map +1 -0
  130. package/dist/mcp/ui-stream-types.js +5 -5
  131. package/dist/mcp/utils.d.ts +17 -0
  132. package/dist/mcp/utils.d.ts.map +1 -0
  133. package/dist/mcp/utils.js +10 -10
  134. package/dist/mcp/vitest.config.d.ts +3 -0
  135. package/dist/mcp/vitest.config.d.ts.map +1 -0
  136. package/dist/mcp-client.d.ts +58 -0
  137. package/dist/mcp-client.d.ts.map +1 -0
  138. package/dist/mcp-client.js +3 -2
  139. package/dist/memory/branch.d.ts +124 -0
  140. package/dist/memory/branch.d.ts.map +1 -0
  141. package/dist/memory/commands/status.d.ts +4 -0
  142. package/dist/memory/commands/status.d.ts.map +1 -0
  143. package/dist/memory/commands/status.js +2 -2
  144. package/dist/memory/commands/view.d.ts +4 -0
  145. package/dist/memory/commands/view.d.ts.map +1 -0
  146. package/dist/memory/commands/view.js +2 -2
  147. package/dist/memory/compaction.d.ts +113 -0
  148. package/dist/memory/compaction.d.ts.map +1 -0
  149. package/dist/memory/config.d.ts +27 -0
  150. package/dist/memory/config.d.ts.map +1 -0
  151. package/dist/memory/debug-log.d.ts +12 -0
  152. package/dist/memory/debug-log.d.ts.map +1 -0
  153. package/dist/memory/hooks/compaction-hook.d.ts +4 -0
  154. package/dist/memory/hooks/compaction-hook.d.ts.map +1 -0
  155. package/dist/memory/hooks/compaction-hook.js +5 -5
  156. package/dist/memory/hooks/compaction-trigger.d.ts +4 -0
  157. package/dist/memory/hooks/compaction-trigger.d.ts.map +1 -0
  158. package/dist/memory/hooks/compaction-trigger.js +3 -3
  159. package/dist/memory/hooks/observer-trigger.d.ts +4 -0
  160. package/dist/memory/hooks/observer-trigger.d.ts.map +1 -0
  161. package/dist/memory/hooks/observer-trigger.js +4 -4
  162. package/dist/memory/ids.d.ts +2 -0
  163. package/dist/memory/ids.d.ts.map +1 -0
  164. package/dist/memory/index.d.ts +3 -0
  165. package/dist/memory/index.d.ts.map +1 -0
  166. package/dist/memory/index.js +9 -9
  167. package/dist/memory/model-budget.d.ts +4 -0
  168. package/dist/memory/model-budget.d.ts.map +1 -0
  169. package/dist/memory/observer.d.ts +21 -0
  170. package/dist/memory/observer.d.ts.map +1 -0
  171. package/dist/memory/project-observations-store.d.ts +24 -0
  172. package/dist/memory/project-observations-store.d.ts.map +1 -0
  173. package/dist/memory/prompts.d.ts +11 -0
  174. package/dist/memory/prompts.d.ts.map +1 -0
  175. package/dist/memory/relevance.d.ts +4 -0
  176. package/dist/memory/relevance.d.ts.map +1 -0
  177. package/dist/memory/runtime.d.ts +40 -0
  178. package/dist/memory/runtime.d.ts.map +1 -0
  179. package/dist/memory/serialize.d.ts +26 -0
  180. package/dist/memory/serialize.d.ts.map +1 -0
  181. package/dist/memory/tokens.d.ts +8 -0
  182. package/dist/memory/tokens.d.ts.map +1 -0
  183. package/dist/memory/tools/read-project-observations.d.ts +8 -0
  184. package/dist/memory/tools/read-project-observations.d.ts.map +1 -0
  185. package/dist/memory/tools/read-project-observations.js +2 -2
  186. package/dist/memory/tools/recall-observation.d.ts +63 -0
  187. package/dist/memory/tools/recall-observation.d.ts.map +1 -0
  188. package/dist/memory/tools/recall-observation.js +2 -2
  189. package/dist/memory/tools/write-project-observation.d.ts +9 -0
  190. package/dist/memory/tools/write-project-observation.d.ts.map +1 -0
  191. package/dist/memory/tools/write-project-observation.js +2 -2
  192. package/dist/memory/types.d.ts +65 -0
  193. package/dist/memory/types.d.ts.map +1 -0
  194. package/dist/preflight.d.ts +27 -0
  195. package/dist/preflight.d.ts.map +1 -0
  196. package/dist/preflight.js +4 -2
  197. package/dist/relay/auto-research.d.ts +64 -0
  198. package/dist/relay/auto-research.d.ts.map +1 -0
  199. package/dist/relay/auto-research.js +184 -79
  200. package/dist/relay/client.d.ts +126 -0
  201. package/dist/relay/client.d.ts.map +1 -0
  202. package/dist/relay/dispatcher.d.ts +216 -0
  203. package/dist/relay/dispatcher.d.ts.map +1 -0
  204. package/dist/relay/dispatcher.js +33 -6
  205. package/dist/relay/machine-store.d.ts +68 -0
  206. package/dist/relay/machine-store.d.ts.map +1 -0
  207. package/dist/relay/models-fetch.d.ts +75 -0
  208. package/dist/relay/models-fetch.d.ts.map +1 -0
  209. package/dist/relay/registration.d.ts +81 -0
  210. package/dist/relay/registration.d.ts.map +1 -0
  211. package/dist/sdk/agent-core/agent-loop.d.ts +24 -0
  212. package/dist/sdk/agent-core/agent-loop.d.ts.map +1 -0
  213. package/dist/sdk/agent-core/agent.d.ts +125 -0
  214. package/dist/sdk/agent-core/agent.d.ts.map +1 -0
  215. package/dist/sdk/agent-core/harness/agent-harness.d.ts +92 -0
  216. package/dist/sdk/agent-core/harness/agent-harness.d.ts.map +1 -0
  217. package/dist/sdk/agent-core/harness/compaction/branch-summarization.d.ts +53 -0
  218. package/dist/sdk/agent-core/harness/compaction/branch-summarization.d.ts.map +1 -0
  219. package/dist/sdk/agent-core/harness/compaction/compaction.d.ts +95 -0
  220. package/dist/sdk/agent-core/harness/compaction/compaction.d.ts.map +1 -0
  221. package/dist/sdk/agent-core/harness/compaction/utils.d.ts +25 -0
  222. package/dist/sdk/agent-core/harness/compaction/utils.d.ts.map +1 -0
  223. package/dist/sdk/agent-core/harness/env/nodejs.d.ts +51 -0
  224. package/dist/sdk/agent-core/harness/env/nodejs.d.ts.map +1 -0
  225. package/dist/sdk/agent-core/harness/messages.d.ts +51 -0
  226. package/dist/sdk/agent-core/harness/messages.d.ts.map +1 -0
  227. package/dist/sdk/agent-core/harness/prompt-templates.d.ts +48 -0
  228. package/dist/sdk/agent-core/harness/prompt-templates.d.ts.map +1 -0
  229. package/dist/sdk/agent-core/harness/session/jsonl-repo.d.ts +26 -0
  230. package/dist/sdk/agent-core/harness/session/jsonl-repo.d.ts.map +1 -0
  231. package/dist/sdk/agent-core/harness/session/jsonl-storage.d.ts +33 -0
  232. package/dist/sdk/agent-core/harness/session/jsonl-storage.d.ts.map +1 -0
  233. package/dist/sdk/agent-core/harness/session/memory-repo.d.ts +18 -0
  234. package/dist/sdk/agent-core/harness/session/memory-repo.d.ts.map +1 -0
  235. package/dist/sdk/agent-core/harness/session/memory-storage.d.ts +25 -0
  236. package/dist/sdk/agent-core/harness/session/memory-storage.d.ts.map +1 -0
  237. package/dist/sdk/agent-core/harness/session/repo-utils.d.ts +11 -0
  238. package/dist/sdk/agent-core/harness/session/repo-utils.d.ts.map +1 -0
  239. package/dist/sdk/agent-core/harness/session/session.d.ts +32 -0
  240. package/dist/sdk/agent-core/harness/session/session.d.ts.map +1 -0
  241. package/dist/sdk/agent-core/harness/session/uuid.d.ts +2 -0
  242. package/dist/sdk/agent-core/harness/session/uuid.d.ts.map +1 -0
  243. package/dist/sdk/agent-core/harness/skills.d.ts +44 -0
  244. package/dist/sdk/agent-core/harness/skills.d.ts.map +1 -0
  245. package/dist/sdk/agent-core/harness/system-prompt.d.ts +3 -0
  246. package/dist/sdk/agent-core/harness/system-prompt.d.ts.map +1 -0
  247. package/dist/sdk/agent-core/harness/types.d.ts +601 -0
  248. package/dist/sdk/agent-core/harness/types.d.ts.map +1 -0
  249. package/dist/sdk/agent-core/harness/utils/shell-output.d.ts +14 -0
  250. package/dist/sdk/agent-core/harness/utils/shell-output.d.ts.map +1 -0
  251. package/dist/sdk/agent-core/harness/utils/truncate.d.ts +70 -0
  252. package/dist/sdk/agent-core/harness/utils/truncate.d.ts.map +1 -0
  253. package/dist/sdk/agent-core/index.d.ts +20 -0
  254. package/dist/sdk/agent-core/index.d.ts.map +1 -0
  255. package/dist/sdk/agent-core/node.d.ts +3 -0
  256. package/dist/sdk/agent-core/node.d.ts.map +1 -0
  257. package/dist/sdk/agent-core/proxy.d.ts +69 -0
  258. package/dist/sdk/agent-core/proxy.d.ts.map +1 -0
  259. package/dist/sdk/agent-core/types.d.ts +393 -0
  260. package/dist/sdk/agent-core/types.d.ts.map +1 -0
  261. package/dist/sdk/ai/api-registry.d.ts +20 -0
  262. package/dist/sdk/ai/api-registry.d.ts.map +1 -0
  263. package/dist/sdk/ai/cli.d.ts +3 -0
  264. package/dist/sdk/ai/cli.d.ts.map +1 -0
  265. package/dist/sdk/ai/env-api-keys.d.ts +18 -0
  266. package/dist/sdk/ai/env-api-keys.d.ts.map +1 -0
  267. package/dist/sdk/ai/image-models.d.ts +10 -0
  268. package/dist/sdk/ai/image-models.d.ts.map +1 -0
  269. package/dist/sdk/ai/image-models.generated.d.ts +440 -0
  270. package/dist/sdk/ai/image-models.generated.d.ts.map +1 -0
  271. package/dist/sdk/ai/images-api-registry.d.ts +14 -0
  272. package/dist/sdk/ai/images-api-registry.d.ts.map +1 -0
  273. package/dist/sdk/ai/images.d.ts +4 -0
  274. package/dist/sdk/ai/images.d.ts.map +1 -0
  275. package/dist/sdk/ai/index.d.ts +21 -0
  276. package/dist/sdk/ai/index.d.ts.map +1 -0
  277. package/dist/sdk/ai/models.d.ts +18 -0
  278. package/dist/sdk/ai/models.d.ts.map +1 -0
  279. package/dist/sdk/ai/models.generated.d.ts +17349 -0
  280. package/dist/sdk/ai/models.generated.d.ts.map +1 -0
  281. package/dist/sdk/ai/oauth.d.ts +2 -0
  282. package/dist/sdk/ai/oauth.d.ts.map +1 -0
  283. package/dist/sdk/ai/providers/anthropic.d.ts +54 -0
  284. package/dist/sdk/ai/providers/anthropic.d.ts.map +1 -0
  285. package/dist/sdk/ai/providers/faux.d.ts +56 -0
  286. package/dist/sdk/ai/providers/faux.d.ts.map +1 -0
  287. package/dist/sdk/ai/providers/github-copilot-headers.d.ts +8 -0
  288. package/dist/sdk/ai/providers/github-copilot-headers.d.ts.map +1 -0
  289. package/dist/sdk/ai/providers/openai-completions.d.ts +19 -0
  290. package/dist/sdk/ai/providers/openai-completions.d.ts.map +1 -0
  291. package/dist/sdk/ai/providers/openai-prompt-cache.d.ts +3 -0
  292. package/dist/sdk/ai/providers/openai-prompt-cache.d.ts.map +1 -0
  293. package/dist/sdk/ai/providers/register-builtins.d.ts +15 -0
  294. package/dist/sdk/ai/providers/register-builtins.d.ts.map +1 -0
  295. package/dist/sdk/ai/providers/simple-options.d.ts +8 -0
  296. package/dist/sdk/ai/providers/simple-options.d.ts.map +1 -0
  297. package/dist/sdk/ai/providers/transform-messages.d.ts +8 -0
  298. package/dist/sdk/ai/providers/transform-messages.d.ts.map +1 -0
  299. package/dist/sdk/ai/session-resources.d.ts +4 -0
  300. package/dist/sdk/ai/session-resources.d.ts.map +1 -0
  301. package/dist/sdk/ai/stream.d.ts +8 -0
  302. package/dist/sdk/ai/stream.d.ts.map +1 -0
  303. package/dist/sdk/ai/types.d.ts +488 -0
  304. package/dist/sdk/ai/types.d.ts.map +1 -0
  305. package/dist/sdk/ai/utils/diagnostics.d.ts +19 -0
  306. package/dist/sdk/ai/utils/diagnostics.d.ts.map +1 -0
  307. package/dist/sdk/ai/utils/event-stream.d.ts +21 -0
  308. package/dist/sdk/ai/utils/event-stream.d.ts.map +1 -0
  309. package/dist/sdk/ai/utils/hash.d.ts +3 -0
  310. package/dist/sdk/ai/utils/hash.d.ts.map +1 -0
  311. package/dist/sdk/ai/utils/headers.d.ts +2 -0
  312. package/dist/sdk/ai/utils/headers.d.ts.map +1 -0
  313. package/dist/sdk/ai/utils/json-parse.d.ts +16 -0
  314. package/dist/sdk/ai/utils/json-parse.d.ts.map +1 -0
  315. package/dist/sdk/ai/utils/node-http-proxy.d.ts +10 -0
  316. package/dist/sdk/ai/utils/node-http-proxy.d.ts.map +1 -0
  317. package/dist/sdk/ai/utils/oauth/anthropic.d.ts +25 -0
  318. package/dist/sdk/ai/utils/oauth/anthropic.d.ts.map +1 -0
  319. package/dist/sdk/ai/utils/oauth/device-code.d.ts +19 -0
  320. package/dist/sdk/ai/utils/oauth/device-code.d.ts.map +1 -0
  321. package/dist/sdk/ai/utils/oauth/github-copilot.d.ts +30 -0
  322. package/dist/sdk/ai/utils/oauth/github-copilot.d.ts.map +1 -0
  323. package/dist/sdk/ai/utils/oauth/index.d.ts +58 -0
  324. package/dist/sdk/ai/utils/oauth/index.d.ts.map +1 -0
  325. package/dist/sdk/ai/utils/oauth/oauth-page.d.ts +3 -0
  326. package/dist/sdk/ai/utils/oauth/oauth-page.d.ts.map +1 -0
  327. package/dist/sdk/ai/utils/oauth/openai-codex.d.ts +34 -0
  328. package/dist/sdk/ai/utils/oauth/openai-codex.d.ts.map +1 -0
  329. package/dist/sdk/ai/utils/oauth/openai-codex.js +2 -2
  330. package/dist/sdk/ai/utils/oauth/pkce.d.ts +13 -0
  331. package/dist/sdk/ai/utils/oauth/pkce.d.ts.map +1 -0
  332. package/dist/sdk/ai/utils/oauth/types.d.ts +64 -0
  333. package/dist/sdk/ai/utils/oauth/types.d.ts.map +1 -0
  334. package/dist/sdk/ai/utils/overflow.d.ts +56 -0
  335. package/dist/sdk/ai/utils/overflow.d.ts.map +1 -0
  336. package/dist/sdk/ai/utils/sanitize-unicode.d.ts +22 -0
  337. package/dist/sdk/ai/utils/sanitize-unicode.d.ts.map +1 -0
  338. package/dist/sdk/ai/utils/typebox-helpers.d.ts +17 -0
  339. package/dist/sdk/ai/utils/typebox-helpers.d.ts.map +1 -0
  340. package/dist/sdk/ai/utils/validation.d.ts +18 -0
  341. package/dist/sdk/ai/utils/validation.d.ts.map +1 -0
  342. package/dist/sdk/coding-agent/cli.d.ts +3 -0
  343. package/dist/sdk/coding-agent/cli.d.ts.map +1 -0
  344. package/dist/sdk/coding-agent/config.d.ts +71 -0
  345. package/dist/sdk/coding-agent/config.d.ts.map +1 -0
  346. package/dist/sdk/coding-agent/core/agent-session-runtime.d.ts +117 -0
  347. package/dist/sdk/coding-agent/core/agent-session-runtime.d.ts.map +1 -0
  348. package/dist/sdk/coding-agent/core/agent-session-services.d.ts +86 -0
  349. package/dist/sdk/coding-agent/core/agent-session-services.d.ts.map +1 -0
  350. package/dist/sdk/coding-agent/core/agent-session.d.ts +626 -0
  351. package/dist/sdk/coding-agent/core/agent-session.d.ts.map +1 -0
  352. package/dist/sdk/coding-agent/core/agent-session.js +3 -3
  353. package/dist/sdk/coding-agent/core/auth-guidance.d.ts +5 -0
  354. package/dist/sdk/coding-agent/core/auth-guidance.d.ts.map +1 -0
  355. package/dist/sdk/coding-agent/core/auth-storage.d.ts +145 -0
  356. package/dist/sdk/coding-agent/core/auth-storage.d.ts.map +1 -0
  357. package/dist/sdk/coding-agent/core/auth-storage.js +2 -2
  358. package/dist/sdk/coding-agent/core/bash-executor.d.ts +32 -0
  359. package/dist/sdk/coding-agent/core/bash-executor.d.ts.map +1 -0
  360. package/dist/sdk/coding-agent/core/bash-executor.js +1 -1
  361. package/dist/sdk/coding-agent/core/compaction/branch-summarization.d.ts +88 -0
  362. package/dist/sdk/coding-agent/core/compaction/branch-summarization.d.ts.map +1 -0
  363. package/dist/sdk/coding-agent/core/compaction/branch-summarization.js +1 -1
  364. package/dist/sdk/coding-agent/core/compaction/compaction.d.ts +142 -0
  365. package/dist/sdk/coding-agent/core/compaction/compaction.d.ts.map +1 -0
  366. package/dist/sdk/coding-agent/core/compaction/compaction.js +1 -1
  367. package/dist/sdk/coding-agent/core/compaction/index.d.ts +7 -0
  368. package/dist/sdk/coding-agent/core/compaction/index.d.ts.map +1 -0
  369. package/dist/sdk/coding-agent/core/compaction/utils.d.ts +38 -0
  370. package/dist/sdk/coding-agent/core/compaction/utils.d.ts.map +1 -0
  371. package/dist/sdk/coding-agent/core/defaults.d.ts +3 -0
  372. package/dist/sdk/coding-agent/core/defaults.d.ts.map +1 -0
  373. package/dist/sdk/coding-agent/core/diagnostics.d.ts +15 -0
  374. package/dist/sdk/coding-agent/core/diagnostics.d.ts.map +1 -0
  375. package/dist/sdk/coding-agent/core/event-bus.d.ts +9 -0
  376. package/dist/sdk/coding-agent/core/event-bus.d.ts.map +1 -0
  377. package/dist/sdk/coding-agent/core/exec.d.ts +29 -0
  378. package/dist/sdk/coding-agent/core/exec.d.ts.map +1 -0
  379. package/dist/sdk/coding-agent/core/extensions/index.d.ts +12 -0
  380. package/dist/sdk/coding-agent/core/extensions/index.d.ts.map +1 -0
  381. package/dist/sdk/coding-agent/core/extensions/loader.d.ts +24 -0
  382. package/dist/sdk/coding-agent/core/extensions/loader.d.ts.map +1 -0
  383. package/dist/sdk/coding-agent/core/extensions/loader.js +18 -21
  384. package/dist/sdk/coding-agent/core/extensions/runner.d.ts +161 -0
  385. package/dist/sdk/coding-agent/core/extensions/runner.d.ts.map +1 -0
  386. package/dist/sdk/coding-agent/core/extensions/runner.js +1 -1
  387. package/dist/sdk/coding-agent/core/extensions/types.d.ts +1181 -0
  388. package/dist/sdk/coding-agent/core/extensions/types.d.ts.map +1 -0
  389. package/dist/sdk/coding-agent/core/extensions/wrapper.d.ts +20 -0
  390. package/dist/sdk/coding-agent/core/extensions/wrapper.d.ts.map +1 -0
  391. package/dist/sdk/coding-agent/core/http-dispatcher.d.ts +21 -0
  392. package/dist/sdk/coding-agent/core/http-dispatcher.d.ts.map +1 -0
  393. package/dist/sdk/coding-agent/core/index.d.ts +12 -0
  394. package/dist/sdk/coding-agent/core/index.d.ts.map +1 -0
  395. package/dist/sdk/coding-agent/core/keybindings.d.ts +371 -0
  396. package/dist/sdk/coding-agent/core/keybindings.d.ts.map +1 -0
  397. package/dist/sdk/coding-agent/core/messages.d.ts +77 -0
  398. package/dist/sdk/coding-agent/core/messages.d.ts.map +1 -0
  399. package/dist/sdk/coding-agent/core/model-registry.d.ts +150 -0
  400. package/dist/sdk/coding-agent/core/model-registry.d.ts.map +1 -0
  401. package/dist/sdk/coding-agent/core/model-resolver-utils.d.ts +7 -0
  402. package/dist/sdk/coding-agent/core/model-resolver-utils.d.ts.map +1 -0
  403. package/dist/sdk/coding-agent/core/model-resolver.d.ts +110 -0
  404. package/dist/sdk/coding-agent/core/model-resolver.d.ts.map +1 -0
  405. package/dist/sdk/coding-agent/core/output-guard.d.ts +6 -0
  406. package/dist/sdk/coding-agent/core/output-guard.d.ts.map +1 -0
  407. package/dist/sdk/coding-agent/core/package-manager.d.ts +204 -0
  408. package/dist/sdk/coding-agent/core/package-manager.d.ts.map +1 -0
  409. package/dist/sdk/coding-agent/core/package-manager.js +14 -14
  410. package/dist/sdk/coding-agent/core/prompt-templates.d.ts +52 -0
  411. package/dist/sdk/coding-agent/core/prompt-templates.d.ts.map +1 -0
  412. package/dist/sdk/coding-agent/core/provider-display-names.d.ts +2 -0
  413. package/dist/sdk/coding-agent/core/provider-display-names.d.ts.map +1 -0
  414. package/dist/sdk/coding-agent/core/resolve-config-value.d.ts +23 -0
  415. package/dist/sdk/coding-agent/core/resolve-config-value.d.ts.map +1 -0
  416. package/dist/sdk/coding-agent/core/resource-loader.d.ts +194 -0
  417. package/dist/sdk/coding-agent/core/resource-loader.d.ts.map +1 -0
  418. package/dist/sdk/coding-agent/core/sdk.d.ts +107 -0
  419. package/dist/sdk/coding-agent/core/sdk.d.ts.map +1 -0
  420. package/dist/sdk/coding-agent/core/sdk.js +2 -2
  421. package/dist/sdk/coding-agent/core/session-cwd.d.ts +19 -0
  422. package/dist/sdk/coding-agent/core/session-cwd.d.ts.map +1 -0
  423. package/dist/sdk/coding-agent/core/session-manager.d.ts +333 -0
  424. package/dist/sdk/coding-agent/core/session-manager.d.ts.map +1 -0
  425. package/dist/sdk/coding-agent/core/settings-manager.d.ts +209 -0
  426. package/dist/sdk/coding-agent/core/settings-manager.d.ts.map +1 -0
  427. package/dist/sdk/coding-agent/core/skills.d.ts +60 -0
  428. package/dist/sdk/coding-agent/core/skills.d.ts.map +1 -0
  429. package/dist/sdk/coding-agent/core/slash-commands.d.ts +14 -0
  430. package/dist/sdk/coding-agent/core/slash-commands.d.ts.map +1 -0
  431. package/dist/sdk/coding-agent/core/source-info.d.ts +18 -0
  432. package/dist/sdk/coding-agent/core/source-info.d.ts.map +1 -0
  433. package/dist/sdk/coding-agent/core/system-prompt.d.ts +28 -0
  434. package/dist/sdk/coding-agent/core/system-prompt.d.ts.map +1 -0
  435. package/dist/sdk/coding-agent/core/system-prompt.js +7 -7
  436. package/dist/sdk/coding-agent/core/telemetry.d.ts +3 -0
  437. package/dist/sdk/coding-agent/core/telemetry.d.ts.map +1 -0
  438. package/dist/sdk/coding-agent/core/theme.d.ts +28 -0
  439. package/dist/sdk/coding-agent/core/theme.d.ts.map +1 -0
  440. package/dist/sdk/coding-agent/core/timings.d.ts +8 -0
  441. package/dist/sdk/coding-agent/core/timings.d.ts.map +1 -0
  442. package/dist/sdk/coding-agent/core/tools/bash.d.ts +63 -0
  443. package/dist/sdk/coding-agent/core/tools/bash.d.ts.map +1 -0
  444. package/dist/sdk/coding-agent/core/tools/bash.js +3 -3
  445. package/dist/sdk/coding-agent/core/tools/edit-diff.d.ts +87 -0
  446. package/dist/sdk/coding-agent/core/tools/edit-diff.d.ts.map +1 -0
  447. package/dist/sdk/coding-agent/core/tools/edit.d.ts +39 -0
  448. package/dist/sdk/coding-agent/core/tools/edit.d.ts.map +1 -0
  449. package/dist/sdk/coding-agent/core/tools/file-mutation-queue.d.ts +6 -0
  450. package/dist/sdk/coding-agent/core/tools/file-mutation-queue.d.ts.map +1 -0
  451. package/dist/sdk/coding-agent/core/tools/find.d.ts +35 -0
  452. package/dist/sdk/coding-agent/core/tools/find.d.ts.map +1 -0
  453. package/dist/sdk/coding-agent/core/tools/grep.d.ts +37 -0
  454. package/dist/sdk/coding-agent/core/tools/grep.d.ts.map +1 -0
  455. package/dist/sdk/coding-agent/core/tools/index.d.ts +40 -0
  456. package/dist/sdk/coding-agent/core/tools/index.d.ts.map +1 -0
  457. package/dist/sdk/coding-agent/core/tools/ls.d.ts +37 -0
  458. package/dist/sdk/coding-agent/core/tools/ls.d.ts.map +1 -0
  459. package/dist/sdk/coding-agent/core/tools/output-accumulator.d.ts +52 -0
  460. package/dist/sdk/coding-agent/core/tools/output-accumulator.d.ts.map +1 -0
  461. package/dist/sdk/coding-agent/core/tools/output-accumulator.js +1 -1
  462. package/dist/sdk/coding-agent/core/tools/path-utils.d.ts +8 -0
  463. package/dist/sdk/coding-agent/core/tools/path-utils.d.ts.map +1 -0
  464. package/dist/sdk/coding-agent/core/tools/read.d.ts +35 -0
  465. package/dist/sdk/coding-agent/core/tools/read.d.ts.map +1 -0
  466. package/dist/sdk/coding-agent/core/tools/read.js +18 -10
  467. package/dist/sdk/coding-agent/core/tools/render-diff.d.ts +17 -0
  468. package/dist/sdk/coding-agent/core/tools/render-diff.d.ts.map +1 -0
  469. package/dist/sdk/coding-agent/core/tools/render-utils.d.ts +21 -0
  470. package/dist/sdk/coding-agent/core/tools/render-utils.d.ts.map +1 -0
  471. package/dist/sdk/coding-agent/core/tools/tool-definition-wrapper.d.ts +14 -0
  472. package/dist/sdk/coding-agent/core/tools/tool-definition-wrapper.d.ts.map +1 -0
  473. package/dist/sdk/coding-agent/core/tools/truncate.d.ts +70 -0
  474. package/dist/sdk/coding-agent/core/tools/truncate.d.ts.map +1 -0
  475. package/dist/sdk/coding-agent/core/tools/write.d.ts +26 -0
  476. package/dist/sdk/coding-agent/core/tools/write.d.ts.map +1 -0
  477. package/dist/sdk/coding-agent/index.d.ts +29 -0
  478. package/dist/sdk/coding-agent/index.d.ts.map +1 -0
  479. package/dist/sdk/coding-agent/main.d.ts +2 -0
  480. package/dist/sdk/coding-agent/main.d.ts.map +1 -0
  481. package/dist/sdk/coding-agent/migrations.d.ts +33 -0
  482. package/dist/sdk/coding-agent/migrations.d.ts.map +1 -0
  483. package/dist/sdk/coding-agent/migrations.js +4 -4
  484. package/dist/sdk/coding-agent/modes/index.d.ts +8 -0
  485. package/dist/sdk/coding-agent/modes/index.d.ts.map +1 -0
  486. package/dist/sdk/coding-agent/modes/print-mode.d.ts +28 -0
  487. package/dist/sdk/coding-agent/modes/print-mode.d.ts.map +1 -0
  488. package/dist/sdk/coding-agent/modes/print-mode.js +2 -2
  489. package/dist/sdk/coding-agent/modes/rpc/jsonl.d.ts +17 -0
  490. package/dist/sdk/coding-agent/modes/rpc/jsonl.d.ts.map +1 -0
  491. package/dist/sdk/coding-agent/modes/rpc/rpc-client.d.ts +224 -0
  492. package/dist/sdk/coding-agent/modes/rpc/rpc-client.d.ts.map +1 -0
  493. package/dist/sdk/coding-agent/modes/rpc/rpc-mode.d.ts +20 -0
  494. package/dist/sdk/coding-agent/modes/rpc/rpc-mode.d.ts.map +1 -0
  495. package/dist/sdk/coding-agent/modes/rpc/rpc-types.d.ts +419 -0
  496. package/dist/sdk/coding-agent/modes/rpc/rpc-types.d.ts.map +1 -0
  497. package/dist/sdk/coding-agent/utils/ansi.d.ts +2 -0
  498. package/dist/sdk/coding-agent/utils/ansi.d.ts.map +1 -0
  499. package/dist/sdk/coding-agent/utils/changelog.d.ts +21 -0
  500. package/dist/sdk/coding-agent/utils/changelog.d.ts.map +1 -0
  501. package/dist/sdk/coding-agent/utils/child-process.d.ts +15 -0
  502. package/dist/sdk/coding-agent/utils/child-process.d.ts.map +1 -0
  503. package/dist/sdk/coding-agent/utils/clipboard-image.d.ts +11 -0
  504. package/dist/sdk/coding-agent/utils/clipboard-image.d.ts.map +1 -0
  505. package/dist/sdk/coding-agent/utils/clipboard-image.js +1 -1
  506. package/dist/sdk/coding-agent/utils/clipboard-native.d.ts +8 -0
  507. package/dist/sdk/coding-agent/utils/clipboard-native.d.ts.map +1 -0
  508. package/dist/sdk/coding-agent/utils/clipboard.d.ts +2 -0
  509. package/dist/sdk/coding-agent/utils/clipboard.d.ts.map +1 -0
  510. package/dist/sdk/coding-agent/utils/exif-orientation.d.ts +5 -0
  511. package/dist/sdk/coding-agent/utils/exif-orientation.d.ts.map +1 -0
  512. package/dist/sdk/coding-agent/utils/frontmatter.d.ts +8 -0
  513. package/dist/sdk/coding-agent/utils/frontmatter.d.ts.map +1 -0
  514. package/dist/sdk/coding-agent/utils/fs-watch.d.ts +5 -0
  515. package/dist/sdk/coding-agent/utils/fs-watch.d.ts.map +1 -0
  516. package/dist/sdk/coding-agent/utils/git.d.ts +26 -0
  517. package/dist/sdk/coding-agent/utils/git.d.ts.map +1 -0
  518. package/dist/sdk/coding-agent/utils/html.d.ts +7 -0
  519. package/dist/sdk/coding-agent/utils/html.d.ts.map +1 -0
  520. package/dist/sdk/coding-agent/utils/image-convert.d.ts +9 -0
  521. package/dist/sdk/coding-agent/utils/image-convert.d.ts.map +1 -0
  522. package/dist/sdk/coding-agent/utils/image-resize.d.ts +36 -0
  523. package/dist/sdk/coding-agent/utils/image-resize.d.ts.map +1 -0
  524. package/dist/sdk/coding-agent/utils/mime.d.ts +3 -0
  525. package/dist/sdk/coding-agent/utils/mime.d.ts.map +1 -0
  526. package/dist/sdk/coding-agent/utils/paths.d.ts +31 -0
  527. package/dist/sdk/coding-agent/utils/paths.d.ts.map +1 -0
  528. package/dist/sdk/coding-agent/utils/photon.d.ts +13 -0
  529. package/dist/sdk/coding-agent/utils/photon.d.ts.map +1 -0
  530. package/dist/sdk/coding-agent/utils/shell.d.ts +30 -0
  531. package/dist/sdk/coding-agent/utils/shell.d.ts.map +1 -0
  532. package/dist/sdk/coding-agent/utils/sleep.d.ts +5 -0
  533. package/dist/sdk/coding-agent/utils/sleep.d.ts.map +1 -0
  534. package/dist/sdk/coding-agent/utils/spectral-user-agent.d.ts +2 -0
  535. package/dist/sdk/coding-agent/utils/spectral-user-agent.d.ts.map +1 -0
  536. package/dist/sdk/coding-agent/utils/spectral-user-agent.js +3 -0
  537. package/dist/sdk/coding-agent/utils/syntax-highlight.d.ts +12 -0
  538. package/dist/sdk/coding-agent/utils/syntax-highlight.d.ts.map +1 -0
  539. package/dist/sdk/coding-agent/utils/tools-manager.d.ts +3 -0
  540. package/dist/sdk/coding-agent/utils/tools-manager.d.ts.map +1 -0
  541. package/dist/sdk/coding-agent/utils/version-check.d.ts +15 -0
  542. package/dist/sdk/coding-agent/utils/version-check.d.ts.map +1 -0
  543. package/dist/sdk/coding-agent/utils/version-check.js +7 -7
  544. package/dist/sdk/coding-agent/utils/windows-self-update.d.ts +3 -0
  545. package/dist/sdk/coding-agent/utils/windows-self-update.d.ts.map +1 -0
  546. package/dist/sdk/coding-agent/utils/windows-self-update.js +1 -1
  547. package/dist/server/agent-bridge.d.ts +308 -0
  548. package/dist/server/agent-bridge.d.ts.map +1 -0
  549. package/dist/server/agent-bridge.js +58 -58
  550. package/dist/server/handlers/errors.d.ts +26 -0
  551. package/dist/server/handlers/errors.d.ts.map +1 -0
  552. package/dist/server/handlers/mcp-status.d.ts +21 -0
  553. package/dist/server/handlers/mcp-status.d.ts.map +1 -0
  554. package/dist/server/handlers/mcp-status.js +52 -0
  555. package/dist/server/handlers/paths-autocomplete.d.ts +45 -0
  556. package/dist/server/handlers/paths-autocomplete.d.ts.map +1 -0
  557. package/dist/server/handlers/projects.d.ts +58 -0
  558. package/dist/server/handlers/projects.d.ts.map +1 -0
  559. package/dist/server/handlers/queue.d.ts +27 -0
  560. package/dist/server/handlers/queue.d.ts.map +1 -0
  561. package/dist/server/handlers/sessions.d.ts +50 -0
  562. package/dist/server/handlers/sessions.d.ts.map +1 -0
  563. package/dist/server/handlers/sessions.js +1 -1
  564. package/dist/server/handlers/settings.d.ts +30 -0
  565. package/dist/server/handlers/settings.d.ts.map +1 -0
  566. package/dist/server/handlers/settings.js +123 -0
  567. package/dist/server/paths.d.ts +51 -0
  568. package/dist/server/paths.d.ts.map +1 -0
  569. package/dist/server/paths.js +2 -2
  570. package/dist/server/session-stream.d.ts +379 -0
  571. package/dist/server/session-stream.d.ts.map +1 -0
  572. package/dist/server/session-stream.js +43 -34
  573. package/dist/server/shutdown.d.ts +102 -0
  574. package/dist/server/shutdown.d.ts.map +1 -0
  575. package/dist/server/shutdown.js +3 -3
  576. package/dist/server/storage.d.ts +287 -0
  577. package/dist/server/storage.d.ts.map +1 -0
  578. package/dist/server/storage.js +6 -6
  579. package/dist/server/title-generator.d.ts +25 -0
  580. package/dist/server/title-generator.d.ts.map +1 -0
  581. package/dist/server/wire.d.ts +448 -0
  582. package/dist/server/wire.d.ts.map +1 -0
  583. package/dist/server/wire.js +1 -1
  584. package/dist/studio-binding.d.ts +44 -0
  585. package/dist/studio-binding.d.ts.map +1 -0
  586. package/dist/studio-binding.js +1 -1
  587. package/package.json +11 -1
  588. package/dist/sdk/coding-agent/utils/pi-user-agent.js +0 -3
@@ -1,18 +1,18 @@
1
1
  /**
2
- * Per-connection pi SDK lifecycle.
2
+ * Per-connection spectral SDK lifecycle.
3
3
  *
4
4
  * One `AgentBridge` instance per active WebSocket connection. Wraps:
5
5
  * - `createAgentSession` (in-memory session manager — we own persistence in
6
- * SQLite; pi doesn't need to write its own JSONL files).
7
- * - `subscribe` listener that translates pi `AgentSessionEvent`s into our
6
+ * SQLite; spectral doesn't need to write its own JSONL files).
7
+ * - `subscribe` listener that translates spectral `AgentSessionEvent`s into our
8
8
  * own `ServerEvent` wire format and pushes them through a caller-supplied
9
9
  * sink.
10
10
  * - `prompt(text)` to send user input.
11
11
  * - `dispose()` for clean teardown on WS close.
12
12
  *
13
- * Event mapping (pi → wire):
13
+ * Event mapping (agent → wire):
14
14
  * - `message_start` (assistant) → emit our own `message_start` with a
15
- * fresh UUID `messageId`. Pi's AssistantMessage has no stable id field, so
15
+ * fresh UUID `messageId`. spectral's AssistantMessage has no stable id field, so
16
16
  * we mint one per turn and use it for all subsequent deltas/tool events
17
17
  * until `message_end`.
18
18
  * - `message_update` w/ inner text_delta / thinking_delta → wire `text_delta`
@@ -29,7 +29,7 @@
29
29
  *
30
30
  * Persistence shape:
31
31
  * `events_jsonl` is the newline-delimited JSON of the wire-format
32
- * `ServerEvent`s we emitted for this message — NOT raw pi
32
+ * `ServerEvent`s we emitted for this message — NOT raw spectral
33
33
  * `AgentSessionEvent`s. This guarantees the client's `parseWireEvents`
34
34
  * reducer can rehydrate the turn after a refresh using the exact same
35
35
  * reducer it uses for the live broadcast.
@@ -45,7 +45,7 @@
45
45
  * `createAgentSession` is called, each message is appended to the
46
46
  * in-memory SessionManager so the LLM sees the full conversation
47
47
  * context from the very first prompt. Multi-turn conversations within
48
- * a single pi session also work normally (the same AgentSession
48
+ * a single spectral session also work normally (the same AgentSession
49
49
  * instance is reused across `prompt()` calls).
50
50
  */
51
51
  import { createJiti } from "@mariozechner/jiti";
@@ -64,12 +64,12 @@ import { Runtime } from "../memory/runtime.js";
64
64
  import { OBSERVATIONAL_MEMORY_CONTEXT_CUSTOM_TYPE, OBSERVATIONAL_MEMORY_SNAPSHOT_CUSTOM_TYPE, } from "../memory/types.js";
65
65
  import { fetchAllowedModels as defaultFetchAllowedModels, } from "../relay/models-fetch.js";
66
66
  /**
67
- * Synthetic provider names registered with pi's `ModelRegistry`. They route
67
+ * Synthetic provider names registered with spectral's `ModelRegistry`. They route
68
68
  * 100% of inference traffic through the backend (`${backendUrl}/v1`), which
69
69
  * authenticates with the machine JWT and forwards to the upstream provider
70
70
  * with centrally-managed API keys.
71
71
  *
72
- * Two providers (rather than one) because pi's `ProviderConfigInput.api`
72
+ * Two providers (rather than one) because spectral's `ProviderConfigInput.api`
73
73
  * picks the request shape per registration. Backend supports both, but a
74
74
  * single bag would force all models onto one shape; instead we group by
75
75
  * upstream provider type.
@@ -84,7 +84,7 @@ const SPECTRAL_PROXY_USER_MODEL = "spectral-proxy-user-model";
84
84
  *
85
85
  * Directories are returned in order from the deepest ancestor to `cwd` so
86
86
  * project-local skills override ancestor-level ones when there are name
87
- * collisions (pi's skill loader keeps the first found).
87
+ * collisions (spectral's skill loader keeps the first found).
88
88
  */
89
89
  function collectAncestorSkillDirs(cwd, relativePaths) {
90
90
  const found = [];
@@ -111,8 +111,8 @@ function collectAncestorSkillDirs(cwd, relativePaths) {
111
111
  /**
112
112
  * Concatenate text from an `AssistantMessage.content` array. Returns the
113
113
  * empty string when no text blocks are present (tool-only turns) or when
114
- * the input is missing/non-array (defensive — pi's `message_end` always
115
- * carries an array, but we don't want to crash on a future SDK change).
114
+ * the input is missing/non-array (defensive — spectral's `message_end` always
115
+ * carries an array, but we don't want to crash on a future sdk change).
116
116
  */
117
117
  function extractTextFromContent(content) {
118
118
  if (!Array.isArray(content))
@@ -129,7 +129,7 @@ function extractTextFromContent(content) {
129
129
  return out;
130
130
  }
131
131
  /**
132
- * Resolve the entry point of the pi-mcp-adapter extension.
132
+ * Resolve the entry point of the spectral-mcp-adapter extension.
133
133
  * Uses the bundled copy in dist/mcp/index.js (same directory as this file).
134
134
  * Returns the absolute path, or null if the bundled file is missing.
135
135
  */
@@ -145,8 +145,8 @@ function resolveMcpAdapterEntry() {
145
145
  /**
146
146
  * Token pricing per model (USD per 1M tokens). Matches provider list
147
147
  * prices as of May 2026. Used to compute token cost server-side when
148
- * pi's own cost field is unavailable (synthetic proxy models are
149
- * registered with zero cost to avoid pi-side billing).
148
+ * spectral's own cost field is unavailable (synthetic proxy models are
149
+ * registered with zero cost to avoid agent-side billing).
150
150
  *
151
151
  * Keys are matched as prefix substrings against modelId, so
152
152
  * `"claude-sonnet-4"` covers both `claude-sonnet-4-20250514` and any
@@ -386,7 +386,7 @@ export class AgentBridge {
386
386
  disposed = false;
387
387
  opts;
388
388
  /**
389
- * Pi's model registry. Built lazily in `start()` so we can resolve a
389
+ * spectral's model registry. Built lazily in `start()` so we can resolve a
390
390
  * `modelId` (envelope-supplied or SQLite-persisted) to a concrete `Model`
391
391
  * via `registry.getAll().find(m => m.id === modelId)` before invoking
392
392
  * `session.setModel()`. Phase 3 (Available Models whitelist).
@@ -400,9 +400,9 @@ export class AgentBridge {
400
400
  allowedModels;
401
401
  /**
402
402
  * Last `modelId` we successfully applied via `session.setModel()`, or
403
- * `undefined` if we never applied one (pi falls back to its own settings
403
+ * `undefined` if we never applied one (spectral falls back to its own settings
404
404
  * file in that case, matching pre-Phase-3 behaviour). Tracked so repeated
405
- * envelopes carrying the same modelId don't churn pi's internal state.
405
+ * envelopes carrying the same modelId don't churn spectral's internal state.
406
406
  */
407
407
  lastAppliedModelId;
408
408
  /** Current model's credit rates (from availableBaseModels), used for token_usage. */
@@ -413,38 +413,38 @@ export class AgentBridge {
413
413
  this.opts = opts;
414
414
  }
415
415
  /**
416
- * Create the pi session, wire up subscription, and return.
416
+ * Create the spectral session, wire up subscription, and return.
417
417
  * Throws on creation failure (caller should surface to client).
418
418
  */
419
419
  async start() {
420
420
  if (this.disposed)
421
421
  throw new Error("AgentBridge already disposed");
422
- const extensionFactories = [aexolMcpExtension, kanbanBridgeExtension, async (pi) => { spectralVisionExtension(pi); }, async (pi) => { subagentExt(pi); }, async (pi) => { designerExtension(pi); }, async (pi) => { observationalMemory(pi); }];
423
- // Load pi-mcp-adapter via jiti so tsc never crawls its .ts files in
422
+ const extensionFactories = [aexolMcpExtension, kanbanBridgeExtension, async (ext) => { spectralVisionExtension(ext); }, async (ext) => { subagentExt(ext); }, async (ext) => { designerExtension(ext); }, async (ext) => { observationalMemory(ext); }];
423
+ // Load spectral-mcp-adapter via jiti so tsc never crawls its .ts files in
424
424
  // node_modules. The static `import` was causing tsc to type-check
425
- // pi-mcp-adapter's source and fail the build on its type errors.
426
- // jiti is the same loader pi uses internally for all extensions.
425
+ // spectral-mcp-adapter's source and fail the build on its type errors.
426
+ // jiti is the same loader spectral uses internally for all extensions.
427
427
  const mcpAdapterPath = resolveMcpAdapterEntry();
428
428
  if (mcpAdapterPath) {
429
429
  try {
430
430
  const jiti = createJiti(import.meta.url, { moduleCache: false });
431
431
  const mcpAdapterFactory = await jiti.import(mcpAdapterPath, { default: true });
432
432
  if (typeof mcpAdapterFactory === "function") {
433
- extensionFactories.push(async (pi) => mcpAdapterFactory(pi));
433
+ extensionFactories.push(async (ext) => mcpAdapterFactory(ext));
434
434
  }
435
435
  }
436
436
  catch {
437
- console.info("[AgentBridge] pi-mcp-adapter not found; standard MCP servers disabled.");
437
+ console.info("[AgentBridge] spectral-mcp-adapter not found; standard MCP servers disabled.");
438
438
  }
439
439
  }
440
440
  else {
441
- console.info("[AgentBridge] pi-mcp-adapter not found; standard MCP servers disabled.");
441
+ console.info("[AgentBridge] spectral-mcp-adapter not found; standard MCP servers disabled.");
442
442
  }
443
443
  // ResourceLoader with extensions wired in via factories.
444
- // Each factory's signature `(pi: ExtensionAPI) => Promise<void>` matches
444
+ // Each factory's signature `(ext: ExtensionAPI) => Promise<void>` matches
445
445
  // the ExtensionFactory type exactly, so we can pass them directly.
446
446
  //
447
- // Skill discovery: pi's defaults scan ~/.spectral/agent/skills/ (user),
447
+ // Skill discovery: spectral's defaults scan ~/.spectral/agent/skills/ (user),
448
448
  // .spectral/skills/ (project via CONFIG_DIR_NAME), and .agents/skills/
449
449
  // (ancestor-walked). We additionally walk ancestors for
450
450
  // .opencode/skills and .aexol/skills so OpenCode/Codex/Aexol skills
@@ -581,7 +581,7 @@ export class AgentBridge {
581
581
  // provider credentials and the only allowed inference target. We then
582
582
  // register synthetic providers (`spectral-proxy-anthropic` /
583
583
  // `spectral-proxy-openai`) whose `baseUrl` points at the backend's
584
- // `/v1` proxy and whose `apiKey` is the machine JWT. Pi will then
584
+ // `/v1` proxy and whose `apiKey` is the machine JWT. spectral will then
585
585
  // POST `${baseUrl}/messages` (or `/chat/completions`) with
586
586
  // `Authorization: Bearer <machineJwt>` for every turn — the backend
587
587
  // verifies the JWT, looks up the requested `model` in the BaseModel
@@ -639,7 +639,7 @@ export class AgentBridge {
639
639
  }
640
640
  catch { /* best-effort */ }
641
641
  });
642
- // Emit session_start so extensions can initialize (e.g. pi-mcp-adapter
642
+ // Emit session_start so extensions can initialize (e.g. spectral-mcp-adapter
643
643
  // connects to MCP servers, loads configs from ~/.config/mcp/mcp.json etc.).
644
644
  // bindExtensions also fires resources_discover for dynamic skill/prompt
645
645
  // registration.
@@ -684,7 +684,7 @@ export class AgentBridge {
684
684
  * (OpenAI-compatible API). The backend supports both endpoints natively
685
685
  * (verified in F1).
686
686
  *
687
- * Pi will send `Authorization: Bearer ${apiKey}` (because `authHeader: true`)
687
+ * spectral will send `Authorization: Bearer ${apiKey}` (because `authHeader: true`)
688
688
  * which carries the machine JWT — the only credential the backend trusts.
689
689
  *
690
690
  * The `id` we register is the raw `modelId` (e.g. `claude-3-5-haiku-latest`),
@@ -707,7 +707,7 @@ export class AgentBridge {
707
707
  id: m.modelId,
708
708
  name: m.displayName,
709
709
  api: "anthropic-messages",
710
- // Pin provider/baseUrl explicitly so pi's ModelRegistry doesn't
710
+ // Pin provider/baseUrl explicitly so spectral's ModelRegistry doesn't
711
711
  // auto-derive `provider` from a slash-prefixed id (e.g. treating
712
712
  // `deepseek/deepseek-v4-pro` as provider `"deepseek"`), which would
713
713
  // make `hasConfiguredAuth(model)` look up the wrong provider key
@@ -735,7 +735,7 @@ export class AgentBridge {
735
735
  id: m.modelId,
736
736
  name: m.displayName,
737
737
  api: "openai-completions",
738
- // See anthropic batch above for rationale — without these, pi
738
+ // See anthropic batch above for rationale — without these, spectral
739
739
  // auto-derives `provider` from slash-prefixed ids like
740
740
  // `deepseek/deepseek-v4-pro` or `meta-llama/llama-3.3-70b-instruct`,
741
741
  // breaking auth lookup against our synthetic proxy provider.
@@ -781,7 +781,7 @@ export class AgentBridge {
781
781
  }
782
782
  }
783
783
  /**
784
- * Apply a sticky model selection to the underlying pi session, if it
784
+ * Apply a sticky model selection to the underlying spectral session, if it
785
785
  * differs from what was last applied. No-ops when:
786
786
  * - `modelId` is null/undefined (caller passed nothing to apply)
787
787
  * - the same modelId was already applied to this session
@@ -792,7 +792,7 @@ export class AgentBridge {
792
792
  * Returns true when the requested model is now in effect (either because
793
793
  * we just applied it or because it was already applied). Returns false
794
794
  * on resolution failure so the caller can skip `prompt()` and avoid
795
- * driving pi against the wrong model.
795
+ * driving spectral against the wrong model.
796
796
  *
797
797
  * Phase 3 (Available Models whitelist).
798
798
  */
@@ -809,7 +809,7 @@ export class AgentBridge {
809
809
  return this.allowedModels?.[0]?.modelId;
810
810
  }
811
811
  /**
812
- * Return current session context usage from pi's built-in estimator.
812
+ * Return current session context usage from spectral's built-in estimator.
813
813
  * Used after compaction and session start to push updated context-window
814
814
  * stats to the frontend without waiting for the next assistant turn.
815
815
  */
@@ -850,7 +850,7 @@ export class AgentBridge {
850
850
  }
851
851
  async setModel(modelId) {
852
852
  if (!modelId)
853
- return true; // nothing to apply — pi keeps its current model
853
+ return true; // nothing to apply — spectral keeps its current model
854
854
  if (!this.session)
855
855
  throw new Error("AgentBridge.start() not called");
856
856
  if (this.lastAppliedModelId === modelId)
@@ -858,7 +858,7 @@ export class AgentBridge {
858
858
  if (!this.modelRegistry) {
859
859
  // Defensive: start() always populates this; if it didn't we can't
860
860
  // resolve and must surface to the client rather than silently using
861
- // pi's default.
861
+ // spectral's default.
862
862
  this.opts.emit({
863
863
  type: "error",
864
864
  message: `Cannot apply modelId "${modelId}": model registry unavailable`,
@@ -884,7 +884,7 @@ export class AgentBridge {
884
884
  if (!model) {
885
885
  this.opts.emit({
886
886
  type: "error",
887
- message: `Unknown modelId "${modelId}" — not found in pi model registry${refreshError ? ` after refresh: ${refreshError.message}` : ""}`,
887
+ message: `Unknown modelId "${modelId}" — not found in spectral model registry${refreshError ? ` after refresh: ${refreshError.message}` : ""}`,
888
888
  });
889
889
  return false;
890
890
  }
@@ -914,18 +914,18 @@ export class AgentBridge {
914
914
  }
915
915
  }
916
916
  /**
917
- * Map a frontend reasoning-effort string to pi's ThinkingLevel.
917
+ * Map a frontend reasoning-effort string to spectral's ThinkingLevel.
918
918
  * Frontend sends: xhigh | high | medium | low | minimal | none | undefined
919
- * Pi expects: "high" | "medium" | "low" | "minimal" | "off"
919
+ * spectral expects: "high" | "medium" | "low" | "minimal" | "off"
920
920
  *
921
921
  * Mapping:
922
- * xhigh → high (pi doesn't have xhigh, default to max)
922
+ * xhigh → high (spectral doesn't have xhigh, default to max)
923
923
  * high → high
924
924
  * medium → medium
925
925
  * low → low
926
926
  * minimal → minimal
927
927
  * none → off
928
- * undefined → no-op (pi keeps whatever it has currently)
928
+ * undefined → no-op (spectral keeps whatever it has currently)
929
929
  */
930
930
  mapReasoningEffortToThinkingLevel(effort) {
931
931
  if (effort === undefined)
@@ -946,10 +946,10 @@ export class AgentBridge {
946
946
  }
947
947
  /**
948
948
  * Set the reasoning/thinking effort level for the next prompt.
949
- * Pass `undefined` to leave pi's current level unchanged.
949
+ * Pass `undefined` to leave spectral's current level unchanged.
950
950
  *
951
951
  * The caller (SessionStreamManager) is responsible for persisting the
952
- * value to SQLite; this method only applies it to pi's in-memory session.
952
+ * value to SQLite; this method only applies it to spectral's in-memory session.
953
953
  */
954
954
  setReasoningEffort(effort) {
955
955
  const level = this.mapReasoningEffortToThinkingLevel(effort);
@@ -973,13 +973,13 @@ export class AgentBridge {
973
973
  }
974
974
  }
975
975
  /**
976
- * Forward a user message to pi. Resolves when the full turn ends.
976
+ * Forward a user message to ext. Resolves when the full turn ends.
977
977
  * The caller is responsible for persisting the user message to SQLite
978
- * BEFORE invoking this — we don't do it here because pi's `prompt` may
978
+ * BEFORE invoking this — we don't do it here because spectral's `prompt` may
979
979
  * fail and we still want the user message recorded.
980
980
  *
981
981
  * When `images` is non-empty, each base64-encoded attachment is converted
982
- * to a pi `ImageContent` block and passed as `options.images` to
982
+ * to a spectral `ImageContent` block and passed as `options.images` to
983
983
  * `session.prompt()`. If the current model does not support image inputs,
984
984
  * images are instead converted to text placeholders so the conversation
985
985
  * can continue without errors.
@@ -1012,7 +1012,7 @@ export class AgentBridge {
1012
1012
  }
1013
1013
  }
1014
1014
  /**
1015
- * Manually compact the session context via pi's built-in compaction.
1015
+ * Manually compact the session context via spectral's built-in compaction.
1016
1016
  * Pi generates a summary of older conversation history, preserving the
1017
1017
  * most recent ~20K tokens verbatim. Compaction events are forwarded to
1018
1018
  * the wire through `handleEvent()`.
@@ -1136,8 +1136,8 @@ export class AgentBridge {
1136
1136
  }
1137
1137
  /**
1138
1138
  * Subscriber callback. Public so tests can drive event flow without
1139
- * spinning up a real pi session — production code never calls this
1140
- * directly; pi's `subscribe()` does, via the closure registered in
1139
+ * spinning up a real spectral session — production code never calls this
1140
+ * directly; spectral's `subscribe()` does, via the closure registered in
1141
1141
  * `start()`.
1142
1142
  */
1143
1143
  handleEvent(ev) {
@@ -1152,7 +1152,7 @@ export class AgentBridge {
1152
1152
  // Finalize the previous pending message (if any) before starting a
1153
1153
  // new one. This captures tool events that arrived after the previous
1154
1154
  // `message_end` but before this `message_start`. Deferred persistence
1155
- // is necessary because pi fires tool_execution_* events BETWEEN
1155
+ // is necessary because spectral fires tool_execution_* events BETWEEN
1156
1156
  // messages — after the previous `message_end` nulled the pending in
1157
1157
  // the old code, those tool events were lost from history.
1158
1158
  this.finalizePendingMessage();
@@ -1327,7 +1327,7 @@ export class AgentBridge {
1327
1327
  if (ev.message.role !== "assistant" || !this.pending)
1328
1328
  return;
1329
1329
  const { messageId, text } = this.pending;
1330
- // Prefer the assembled text from pi's final AssistantMessage
1330
+ // Prefer the assembled text from spectral's final AssistantMessage
1331
1331
  // (authoritative — providers like deepseek only populate this and
1332
1332
  // skip per-token `text_delta`s entirely). Fall back to the
1333
1333
  // accumulator for providers that stream deltas without re-asserting
@@ -1338,7 +1338,7 @@ export class AgentBridge {
1338
1338
  const endEvent = { type: "message_end", messageId };
1339
1339
  this.pending.wireEvents.push(endEvent);
1340
1340
  this.opts.emit(endEvent);
1341
- // Emit token usage for this assistant message. pi provides token
1341
+ // Emit token usage for this assistant message. spectral provides token
1342
1342
  // counts via ev.message.usage; credits are computed from the active
1343
1343
  // model's configured credit rates.
1344
1344
  //
@@ -1355,7 +1355,7 @@ export class AgentBridge {
1355
1355
  (usage?.cacheRead ?? 0) +
1356
1356
  (usage?.cacheWrite ?? 0);
1357
1357
  if (usage && totalTokens > 0) {
1358
- // Resolve current context window usage from pi's built-in
1358
+ // Resolve current context window usage from spectral's built-in
1359
1359
  // `getContextUsage()`, which handles post-compaction ambiguity
1360
1360
  // and estimates total tokens from the full session tree.
1361
1361
  const ctxUsage = this.session?.getContextUsage();
@@ -1378,7 +1378,7 @@ export class AgentBridge {
1378
1378
  this.opts.emit(usageEvent);
1379
1379
  }
1380
1380
  // Defer persistence: keep `this.pending` alive so tool events that
1381
- // arrive after `message_end` (pi fires tool_execution_* events
1381
+ // arrive after `message_end` (spectral fires tool_execution_* events
1382
1382
  // BETWEEN messages) are buffered into `pending.wireEvents`. We store
1383
1383
  // the final content and persist later — when the next `message_start`
1384
1384
  // signals a new step, or when `agent_end` closes the turn.
@@ -1415,7 +1415,7 @@ export class AgentBridge {
1415
1415
  return;
1416
1416
  }
1417
1417
  default:
1418
- // Other pi-internal events (turn_start, queue_update,
1418
+ // Other spectral-internal events (turn_start, queue_update,
1419
1419
  // auto_retry_*, tool_execution_update) are intentionally not on
1420
1420
  // the wire surface for MVP and are NOT persisted — the wire format
1421
1421
  // is the source of truth for replay.
@@ -1457,7 +1457,7 @@ function detectNotifSystem(message) {
1457
1457
  /**
1458
1458
  * Create a minimal ExtensionUIContext that forwards `notify()` calls as
1459
1459
  * `agent_notification` wire events. All other UI methods are no-ops —
1460
- * only extensions (not pi's TUI) call into the UI context in headless mode,
1460
+ * only extensions (not spectral's TUI) call into the UI context in headless mode,
1461
1461
  * and extensions that call methods other than `notify()` are expected to
1462
1462
  * guard with `ctx.hasUI` first.
1463
1463
  */
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Typed errors thrown by REST handlers.
3
+ *
4
+ * Each error carries a stable `code` that the relay envelope dispatcher
5
+ * (Batch 3) maps to a wire-level status. Until then, the handlers throw
6
+ * and the relay loop just acks — Batch 3 will catch and translate.
7
+ *
8
+ * Why typed errors instead of returning `{ ok: false, code }` discriminated
9
+ * unions? Two reasons:
10
+ * - The handlers are also called directly from unit tests; `throw` lets
11
+ * tests use `expect(...).rejects.toThrow(NotFoundError)` ergonomically.
12
+ * - The Batch 3 dispatcher needs a single `try/catch` boundary; a sum
13
+ * type per handler would force every handler to return its own variant.
14
+ */
15
+ export type HandlerErrorCode = "BAD_REQUEST" | "NOT_FOUND";
16
+ export declare class HandlerError extends Error {
17
+ readonly code: HandlerErrorCode;
18
+ constructor(code: HandlerErrorCode, message: string);
19
+ }
20
+ export declare class BadRequestError extends HandlerError {
21
+ constructor(message: string);
22
+ }
23
+ export declare class NotFoundError extends HandlerError {
24
+ constructor(message: string);
25
+ }
26
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,WAAW,CAAC;AAE3D,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;gBACpB,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM;CAKpD;AAED,qBAAa,eAAgB,SAAQ,YAAY;gBACnC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,aAAc,SAAQ,YAAY;gBACjC,OAAO,EAAE,MAAM;CAI5B"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Handler for `GET /api/mcp-status`.
3
+ *
4
+ * Returns a snapshot of the locally connected MCP servers managed by
5
+ * `spectral serve`. Pure handler pattern — no framework, no side effects.
6
+ * The caller (the relay dispatcher) injects `McpExtensionState`.
7
+ *
8
+ * This module intentionally imports ONLY `McpExtensionState` (a pure-type
9
+ * import from `state.ts`). It avoids `init.ts` / `config.ts` / etc. so the
10
+ * dispatcher never pulls in heavy transitive deps.
11
+ */
12
+ import type { McpExtensionState } from "../../mcp/state.js";
13
+ export interface McpServerStatus {
14
+ name: string;
15
+ status: "connected" | "disconnected" | "needs-auth" | "failed" | "cached";
16
+ toolCount: number;
17
+ /** Epoch-ms of the most recent connection failure, if the server is in a failed state. */
18
+ failedAt?: number;
19
+ }
20
+ export declare function handleListMcpStatus(state: McpExtensionState): McpServerStatus[];
21
+ //# sourceMappingURL=mcp-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-status.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/mcp-status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAK5D,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,WAAW,GAAG,cAAc,GAAG,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC1E,SAAS,EAAE,MAAM,CAAC;IAClB,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,iBAAiB,GACvB,eAAe,EAAE,CA0BnB"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Handler for `GET /api/mcp-status`.
3
+ *
4
+ * Returns a snapshot of the locally connected MCP servers managed by
5
+ * `spectral serve`. Pure handler pattern — no framework, no side effects.
6
+ * The caller (the relay dispatcher) injects `McpExtensionState`.
7
+ *
8
+ * This module intentionally imports ONLY `McpExtensionState` (a pure-type
9
+ * import from `state.ts`). It avoids `init.ts` / `config.ts` / etc. so the
10
+ * dispatcher never pulls in heavy transitive deps.
11
+ */
12
+ /** Maximum age (ms) of a failure entry before we treat it as stale. */
13
+ const FAILURE_BACKOFF_MS = 60_000;
14
+ export function handleListMcpStatus(state) {
15
+ const result = [];
16
+ for (const name of Object.keys(state.config.mcpServers)) {
17
+ const connection = state.manager.getConnection(name);
18
+ const metadata = state.toolMetadata.get(name);
19
+ const toolCount = metadata?.length ?? 0;
20
+ const failedAgo = getFailureAgeSeconds(state, name);
21
+ let status = "disconnected";
22
+ let failedAt;
23
+ if (connection?.status === "connected") {
24
+ status = "connected";
25
+ }
26
+ else if (connection?.status === "needs-auth") {
27
+ status = "needs-auth";
28
+ }
29
+ else if (failedAgo !== null) {
30
+ status = "failed";
31
+ failedAt = state.failureTracker.get(name) ?? undefined;
32
+ }
33
+ else if (metadata !== undefined) {
34
+ status = "cached";
35
+ }
36
+ result.push({ name, status, toolCount, failedAt });
37
+ }
38
+ return result;
39
+ }
40
+ /**
41
+ * Mirrors `init.ts#getFailureAgeSeconds` without pulling in init.ts's
42
+ * heavy runtime deps (config, consent manager, UI resource handler, etc.).
43
+ */
44
+ function getFailureAgeSeconds(state, serverName) {
45
+ const failedAt = state.failureTracker.get(serverName);
46
+ if (!failedAt)
47
+ return null;
48
+ const ageMs = Date.now() - failedAt;
49
+ if (ageMs > FAILURE_BACKOFF_MS)
50
+ return null;
51
+ return Math.round(ageMs / 1000);
52
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Filesystem autocomplete for project path creation.
3
+ *
4
+ * When a user types a partial path in the New Project form, the browser
5
+ * sends `GET /api/paths/autocomplete?prefix=<partial>`. This handler
6
+ * expands the prefix (tilde → $HOME, relative → absolute), lists the
7
+ * containing directory, and returns up to 10 directory suggestions whose
8
+ * basenames start with the typed partial segment.
9
+ *
10
+ * Two strategies:
11
+ * 1. If the expanded prefix exists on disk as a directory — show its
12
+ * immediate children (trailing separator is implicit). This is the
13
+ * natural behaviour when the user has already typed a real directory
14
+ * and wants to drill deeper.
15
+ * 2. Otherwise — split into parent + basename prefix and do a
16
+ * starts-with match so the user can filter siblings while typing.
17
+ *
18
+ * Dotfiles are excluded — they are rarely intentional project roots.
19
+ * Symlinks to directories ARE included (readdirSync with withFileTypes
20
+ * returns true for both real dirs and symlink dirs).
21
+ *
22
+ * Thread-safety: synchronous, called from the relay-dispatcher hot path.
23
+ * fs ops block the event loop for microseconds on local SSDs; the form
24
+ * is typed by a single human, so this is perfectly fine.
25
+ */
26
+ export interface PathAutocompleteResult {
27
+ suggestions: string[];
28
+ expandedPrefix: string;
29
+ }
30
+ /**
31
+ * List directory suggestions for the given path prefix.
32
+ *
33
+ * Examples (assume $HOME=/Users/alice, dirs are `projects`, `proj-old`,
34
+ * `Documents`, `.config`):
35
+ * prefix="~" → expanded="/Users/alice" (exists as dir)
36
+ * → children of /Users/alice/ ["projects","proj-old","Documents"]
37
+ * prefix="~/pro" → expanded="/Users/alice/pro" (does NOT exist)
38
+ * → starts-with "pro" in /Users/alice/ ["projects","proj-old"]
39
+ * prefix="~/projects/" → expanded="/Users/alice/projects/" (exists as dir)
40
+ * → children of /Users/alice/projects/
41
+ * prefix="~/projects/sr" → expanded="/Users/alice/projects/sr" (does NOT exist)
42
+ * → starts-with "sr" in /Users/alice/projects/
43
+ */
44
+ export declare function handlePathAutocomplete(prefix: string): PathAutocompleteResult;
45
+ //# sourceMappingURL=paths-autocomplete.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths-autocomplete.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/paths-autocomplete.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAMH,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;CACxB;AAgCD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,sBAAsB,CA+B7E"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Pure REST handlers for `/api/projects/*`.
3
+ *
4
+ * Extracted from the deleted Hono `routes.ts` so the relay envelope dispatcher
5
+ * (Batch 3) can call them with a parsed payload instead of a Hono context.
6
+ *
7
+ * Contract:
8
+ * - Inputs are already-parsed JSON objects (or `unknown` shapes the handler
9
+ * validates). The dispatcher upstream parses the relay envelope body.
10
+ * - Outputs are the wire shapes the landing client already expects, so the
11
+ * Batch 3 dispatcher can JSON-stringify them straight into the response
12
+ * envelope without remapping.
13
+ * - Errors are thrown as typed `HandlerError` subclasses; the dispatcher
14
+ * maps `BAD_REQUEST` → 400-equivalent and `NOT_FOUND` → 404-equivalent.
15
+ * - Stream teardown on project delete is the caller's responsibility — the
16
+ * handler returns the cascaded session ids so the dispatcher can hand
17
+ * them to `SessionStreamManager.disposeProjectStreams` BEFORE the SQL
18
+ * cascade has already torn down (in our model the cascade has already
19
+ * happened by the time we return; that's intentional and matches the
20
+ * old route's ordering — the manager is best-effort cleanup).
21
+ */
22
+ import type { SessionStore } from "../storage.js";
23
+ import type { WireProject, WireSessionSummary } from "../wire.js";
24
+ export interface CreateProjectInputRaw {
25
+ name?: unknown;
26
+ path?: unknown;
27
+ }
28
+ export interface UpdateProjectInputRaw {
29
+ name?: unknown;
30
+ path?: unknown;
31
+ }
32
+ export declare function handleListProjects(store: SessionStore): WireProject[];
33
+ export declare function handleCreateProject(store: SessionStore, body: CreateProjectInputRaw): WireProject;
34
+ export declare function handleGetProject(store: SessionStore, id: string): WireProject;
35
+ export declare function handleUpdateProject(store: SessionStore, id: string, body: UpdateProjectInputRaw): WireProject;
36
+ export interface DeleteProjectResult {
37
+ /** Session ids that belonged to the project (cascade-deleted). */
38
+ sessionIds: string[];
39
+ }
40
+ export declare function handleDeleteProject(store: SessionStore, id: string): DeleteProjectResult;
41
+ export interface BindStudioInputRaw {
42
+ studioProjectId?: unknown;
43
+ studioTeamId?: unknown;
44
+ studioProjectName?: unknown;
45
+ }
46
+ export interface BindStudioResult {
47
+ project: WireProject;
48
+ studioProjectId: string;
49
+ studioProjectName: string;
50
+ studioTeamId?: string;
51
+ }
52
+ /**
53
+ * Bind a local project directory to an Aexol Studio project by writing
54
+ * `.aexol/aexol.jsonc` into the project's filesystem path.
55
+ */
56
+ export declare function handleBindStudioProject(store: SessionStore, id: string, body: BindStudioInputRaw): Promise<BindStudioResult>;
57
+ export declare function handleListSessionsByProject(store: SessionStore, id: string): WireSessionSummary[];
58
+ //# sourceMappingURL=projects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/projects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIlE,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,GAAG,WAAW,EAAE,CAErE;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,qBAAqB,GAC1B,WAAW,CAYb;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,MAAM,GAAG,WAAW,CAI7E;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,YAAY,EACnB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,qBAAqB,GAC1B,WAAW,CAwBb;AAED,MAAM,WAAW,mBAAmB;IAClC,kEAAkE;IAClE,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,YAAY,EACnB,EAAE,EAAE,MAAM,GACT,mBAAmB,CAMrB;AAED,MAAM,WAAW,kBAAkB;IACjC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,WAAW,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,KAAK,EAAE,YAAY,EACnB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,gBAAgB,CAAC,CAoC3B;AAED,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,YAAY,EACnB,EAAE,EAAE,MAAM,GACT,kBAAkB,EAAE,CAItB"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Pure REST handlers for `/api/sessions/:sessionId/queue/*`.
3
+ *
4
+ * Same contract as sessions/projects handlers — pure functions that take
5
+ * `store` + `manager` dependencies, throw `BadRequestError`/`NotFoundError`
6
+ * on invalid input, and return typed responses.
7
+ *
8
+ * After mutating the queue, each handler calls `manager.pushQueueState()`
9
+ * to broadcast the updated queue to all subscribers via `queue_changed`.
10
+ */
11
+ import type { SessionStreamManager } from "../session-stream.js";
12
+ import type { SessionStore } from "../storage.js";
13
+ export interface EnqueuePromptInputRaw {
14
+ content?: unknown;
15
+ }
16
+ /** Wire shape for a single queue item returned to the frontend. */
17
+ export interface WireQueueItem {
18
+ id: string;
19
+ content: string;
20
+ position: number;
21
+ createdAt: string;
22
+ }
23
+ export declare function handleEnqueuePrompt(store: SessionStore, manager: SessionStreamManager, sessionId: string, body: EnqueuePromptInputRaw): WireQueueItem;
24
+ export declare function handleGetPromptQueue(store: SessionStore, sessionId: string): WireQueueItem[];
25
+ export declare function handleRemovePrompt(store: SessionStore, manager: SessionStreamManager, sessionId: string, itemId: string): void;
26
+ export declare function handleClearPromptQueue(store: SessionStore, manager: SessionStreamManager, sessionId: string): void;
27
+ //# sourceMappingURL=queue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlD,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,mEAAmE;AACnE,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,oBAAoB,EAC7B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,qBAAqB,GAC1B,aAAa,CAgBf;AAED,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,MAAM,GAChB,aAAa,EAAE,CAUjB;AAED,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,oBAAoB,EAC7B,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,GACb,IAAI,CAMN;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,oBAAoB,EAC7B,SAAS,EAAE,MAAM,GAChB,IAAI,CAMN"}