actoviq-agent-sdk 0.4.6 → 0.4.7

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 (637) hide show
  1. package/CHANGELOG.md +203 -0
  2. package/README-zh.md +54 -19
  3. package/README.md +53 -19
  4. package/SECURITY.md +26 -0
  5. package/assets/actoviq-icon.ico +0 -0
  6. package/bin/actoviq-gui.js +28 -3
  7. package/dist/src/buddy/actoviqBuddy.d.ts.map +1 -1
  8. package/dist/src/buddy/actoviqBuddy.js +3 -4
  9. package/dist/src/buddy/actoviqBuddy.js.map +1 -1
  10. package/dist/src/cli/actoviq-react.js +495 -60
  11. package/dist/src/cli/actoviq-react.js.map +1 -1
  12. package/dist/src/compat/diagnostics.d.ts +18 -0
  13. package/dist/src/compat/diagnostics.d.ts.map +1 -0
  14. package/dist/src/compat/diagnostics.js +47 -0
  15. package/dist/src/compat/diagnostics.js.map +1 -0
  16. package/dist/src/compat/index.d.ts +8 -0
  17. package/dist/src/compat/index.d.ts.map +1 -0
  18. package/dist/src/compat/index.js +6 -0
  19. package/dist/src/compat/index.js.map +1 -0
  20. package/dist/src/config/actoviqHome.d.ts +32 -0
  21. package/dist/src/config/actoviqHome.d.ts.map +1 -0
  22. package/dist/src/config/actoviqHome.js +228 -0
  23. package/dist/src/config/actoviqHome.js.map +1 -0
  24. package/dist/src/config/actoviqSettingsStore.d.ts.map +1 -1
  25. package/dist/src/config/actoviqSettingsStore.js +6 -6
  26. package/dist/src/config/actoviqSettingsStore.js.map +1 -1
  27. package/dist/src/config/agentProfiles.d.ts +77 -0
  28. package/dist/src/config/agentProfiles.d.ts.map +1 -0
  29. package/dist/src/config/agentProfiles.js +319 -0
  30. package/dist/src/config/agentProfiles.js.map +1 -0
  31. package/dist/src/config/loadDefaultActoviqSettings.d.ts.map +1 -1
  32. package/dist/src/config/loadDefaultActoviqSettings.js +2 -3
  33. package/dist/src/config/loadDefaultActoviqSettings.js.map +1 -1
  34. package/dist/src/config/projectSessionDirectory.d.ts.map +1 -1
  35. package/dist/src/config/projectSessionDirectory.js +3 -2
  36. package/dist/src/config/projectSessionDirectory.js.map +1 -1
  37. package/dist/src/config/resolveRuntimeConfig.d.ts.map +1 -1
  38. package/dist/src/config/resolveRuntimeConfig.js +13 -2
  39. package/dist/src/config/resolveRuntimeConfig.js.map +1 -1
  40. package/dist/src/core/agent-spec.d.ts +74 -0
  41. package/dist/src/core/agent-spec.d.ts.map +1 -0
  42. package/dist/src/core/agent-spec.js +2 -0
  43. package/dist/src/core/agent-spec.js.map +1 -0
  44. package/dist/src/core/errors.d.ts +42 -0
  45. package/dist/src/core/errors.d.ts.map +1 -0
  46. package/dist/src/core/errors.js +53 -0
  47. package/dist/src/core/errors.js.map +1 -0
  48. package/dist/src/core/index.d.ts +11 -0
  49. package/dist/src/core/index.d.ts.map +1 -0
  50. package/dist/src/core/index.js +4 -0
  51. package/dist/src/core/index.js.map +1 -0
  52. package/dist/src/core/items.d.ts +161 -0
  53. package/dist/src/core/items.d.ts.map +1 -0
  54. package/dist/src/core/items.js +2 -0
  55. package/dist/src/core/items.js.map +1 -0
  56. package/dist/src/core/json.d.ts +20 -0
  57. package/dist/src/core/json.d.ts.map +1 -0
  58. package/dist/src/core/json.js +80 -0
  59. package/dist/src/core/json.js.map +1 -0
  60. package/dist/src/core/model-ref.d.ts +6 -0
  61. package/dist/src/core/model-ref.d.ts.map +1 -0
  62. package/dist/src/core/model-ref.js +2 -0
  63. package/dist/src/core/model-ref.js.map +1 -0
  64. package/dist/src/core/run.d.ts +35 -0
  65. package/dist/src/core/run.d.ts.map +1 -0
  66. package/dist/src/core/run.js +2 -0
  67. package/dist/src/core/run.js.map +1 -0
  68. package/dist/src/core/usage.d.ts +32 -0
  69. package/dist/src/core/usage.d.ts.map +1 -0
  70. package/dist/src/core/usage.js +111 -0
  71. package/dist/src/core/usage.js.map +1 -0
  72. package/dist/src/errors.d.ts +19 -0
  73. package/dist/src/errors.d.ts.map +1 -1
  74. package/dist/src/errors.js +27 -0
  75. package/dist/src/errors.js.map +1 -1
  76. package/dist/src/events/index.d.ts +4 -0
  77. package/dist/src/events/index.d.ts.map +1 -0
  78. package/dist/src/events/index.js +4 -0
  79. package/dist/src/events/index.js.map +1 -0
  80. package/dist/src/events/openTelemetry.d.ts +51 -0
  81. package/dist/src/events/openTelemetry.d.ts.map +1 -0
  82. package/dist/src/events/openTelemetry.js +116 -0
  83. package/dist/src/events/openTelemetry.js.map +1 -0
  84. package/dist/src/events/processors.d.ts +14 -0
  85. package/dist/src/events/processors.d.ts.map +1 -0
  86. package/dist/src/events/processors.js +60 -0
  87. package/dist/src/events/processors.js.map +1 -0
  88. package/dist/src/events/runEvents.d.ts +66 -0
  89. package/dist/src/events/runEvents.d.ts.map +1 -0
  90. package/dist/src/events/runEvents.js +143 -0
  91. package/dist/src/events/runEvents.js.map +1 -0
  92. package/dist/src/gui/actoviqGui.d.ts +15 -0
  93. package/dist/src/gui/actoviqGui.d.ts.map +1 -1
  94. package/dist/src/gui/actoviqGui.js +18034 -1919
  95. package/dist/src/gui/actoviqGui.js.map +1 -1
  96. package/dist/src/gui/contextRailStore.d.ts +47 -0
  97. package/dist/src/gui/contextRailStore.d.ts.map +1 -0
  98. package/dist/src/gui/contextRailStore.js +163 -0
  99. package/dist/src/gui/contextRailStore.js.map +1 -0
  100. package/dist/src/gui/electronMain.js +32 -16
  101. package/dist/src/gui/electronMain.js.map +1 -1
  102. package/dist/src/gui/guiAssets.d.ts +6 -0
  103. package/dist/src/gui/guiAssets.d.ts.map +1 -0
  104. package/dist/src/gui/guiAssets.js +48 -0
  105. package/dist/src/gui/guiAssets.js.map +1 -0
  106. package/dist/src/gui/guiSyntaxHighlight.d.ts +11 -0
  107. package/dist/src/gui/guiSyntaxHighlight.d.ts.map +1 -0
  108. package/dist/src/gui/guiSyntaxHighlight.js +348 -0
  109. package/dist/src/gui/guiSyntaxHighlight.js.map +1 -0
  110. package/dist/src/gui/projectMeta.d.ts +15 -0
  111. package/dist/src/gui/projectMeta.d.ts.map +1 -0
  112. package/dist/src/gui/projectMeta.js +61 -0
  113. package/dist/src/gui/projectMeta.js.map +1 -0
  114. package/dist/src/gui/projectWorkbench.d.ts +73 -0
  115. package/dist/src/gui/projectWorkbench.d.ts.map +1 -0
  116. package/dist/src/gui/projectWorkbench.js +307 -0
  117. package/dist/src/gui/projectWorkbench.js.map +1 -0
  118. package/dist/src/gui/terminalManager.d.ts +33 -0
  119. package/dist/src/gui/terminalManager.d.ts.map +1 -0
  120. package/dist/src/gui/terminalManager.js +206 -0
  121. package/dist/src/gui/terminalManager.js.map +1 -0
  122. package/dist/src/gui/transcript/clientBundle.d.ts +6 -0
  123. package/dist/src/gui/transcript/clientBundle.d.ts.map +1 -0
  124. package/dist/src/gui/transcript/clientBundle.js +978 -0
  125. package/dist/src/gui/transcript/clientBundle.js.map +1 -0
  126. package/dist/src/gui/transcript/index.d.ts +9 -0
  127. package/dist/src/gui/transcript/index.d.ts.map +1 -0
  128. package/dist/src/gui/transcript/index.js +6 -0
  129. package/dist/src/gui/transcript/index.js.map +1 -0
  130. package/dist/src/gui/transcript/parts.d.ts +81 -0
  131. package/dist/src/gui/transcript/parts.d.ts.map +1 -0
  132. package/dist/src/gui/transcript/parts.js +476 -0
  133. package/dist/src/gui/transcript/parts.js.map +1 -0
  134. package/dist/src/gui/transcript/registry.d.ts +8 -0
  135. package/dist/src/gui/transcript/registry.d.ts.map +1 -0
  136. package/dist/src/gui/transcript/registry.js +32 -0
  137. package/dist/src/gui/transcript/registry.js.map +1 -0
  138. package/dist/src/gui/transcript/scroll.d.ts +9 -0
  139. package/dist/src/gui/transcript/scroll.d.ts.map +1 -0
  140. package/dist/src/gui/transcript/scroll.js +13 -0
  141. package/dist/src/gui/transcript/scroll.js.map +1 -0
  142. package/dist/src/gui/transcript/styles.d.ts +3 -0
  143. package/dist/src/gui/transcript/styles.d.ts.map +1 -0
  144. package/dist/src/gui/transcript/styles.js +172 -0
  145. package/dist/src/gui/transcript/styles.js.map +1 -0
  146. package/dist/src/gui/workspaceNote.d.ts +4 -0
  147. package/dist/src/gui/workspaceNote.d.ts.map +1 -0
  148. package/dist/src/gui/workspaceNote.js +21 -0
  149. package/dist/src/gui/workspaceNote.js.map +1 -0
  150. package/dist/src/gui/workspaceRegistry.d.ts +11 -0
  151. package/dist/src/gui/workspaceRegistry.d.ts.map +1 -0
  152. package/dist/src/gui/workspaceRegistry.js +114 -0
  153. package/dist/src/gui/workspaceRegistry.js.map +1 -0
  154. package/dist/src/hooks/userHooks.d.ts +29 -8
  155. package/dist/src/hooks/userHooks.d.ts.map +1 -1
  156. package/dist/src/hooks/userHooks.js +106 -34
  157. package/dist/src/hooks/userHooks.js.map +1 -1
  158. package/dist/src/index.d.ts +24 -6
  159. package/dist/src/index.d.ts.map +1 -1
  160. package/dist/src/index.js +18 -6
  161. package/dist/src/index.js.map +1 -1
  162. package/dist/src/issues/durableIssueCoordinator.d.ts +57 -0
  163. package/dist/src/issues/durableIssueCoordinator.d.ts.map +1 -0
  164. package/dist/src/issues/durableIssueCoordinator.js +128 -0
  165. package/dist/src/issues/durableIssueCoordinator.js.map +1 -0
  166. package/dist/src/issues/issueExecution.d.ts +34 -0
  167. package/dist/src/issues/issueExecution.d.ts.map +1 -0
  168. package/dist/src/issues/issueExecution.js +190 -0
  169. package/dist/src/issues/issueExecution.js.map +1 -0
  170. package/dist/src/issues/issueStore.d.ts +95 -0
  171. package/dist/src/issues/issueStore.d.ts.map +1 -0
  172. package/dist/src/issues/issueStore.js +373 -0
  173. package/dist/src/issues/issueStore.js.map +1 -0
  174. package/dist/src/manager/projectManager.d.ts +103 -0
  175. package/dist/src/manager/projectManager.d.ts.map +1 -0
  176. package/dist/src/manager/projectManager.js +547 -0
  177. package/dist/src/manager/projectManager.js.map +1 -0
  178. package/dist/src/mcp/connectionManager.d.ts +22 -2
  179. package/dist/src/mcp/connectionManager.d.ts.map +1 -1
  180. package/dist/src/mcp/connectionManager.js +153 -41
  181. package/dist/src/mcp/connectionManager.js.map +1 -1
  182. package/dist/src/mcp/mcpServerConfig.d.ts.map +1 -1
  183. package/dist/src/mcp/mcpServerConfig.js +7 -7
  184. package/dist/src/mcp/mcpServerConfig.js.map +1 -1
  185. package/dist/src/memory/actoviqMemory.js +6 -6
  186. package/dist/src/memory/actoviqMemory.js.map +1 -1
  187. package/dist/src/memory/sessionHistory.js +2 -2
  188. package/dist/src/memory/sessionHistory.js.map +1 -1
  189. package/dist/src/node/index.d.ts +5 -0
  190. package/dist/src/node/index.d.ts.map +1 -0
  191. package/dist/src/node/index.js +5 -0
  192. package/dist/src/node/index.js.map +1 -0
  193. package/dist/src/node/sqliteCheckpointAdapter.d.ts +20 -0
  194. package/dist/src/node/sqliteCheckpointAdapter.d.ts.map +1 -0
  195. package/dist/src/node/sqliteCheckpointAdapter.js +163 -0
  196. package/dist/src/node/sqliteCheckpointAdapter.js.map +1 -0
  197. package/dist/src/node/sqliteDurableChildStore.d.ts +21 -0
  198. package/dist/src/node/sqliteDurableChildStore.d.ts.map +1 -0
  199. package/dist/src/node/sqliteDurableChildStore.js +124 -0
  200. package/dist/src/node/sqliteDurableChildStore.js.map +1 -0
  201. package/dist/src/node/sqliteSessionAdapter.d.ts +28 -0
  202. package/dist/src/node/sqliteSessionAdapter.d.ts.map +1 -0
  203. package/dist/src/node/sqliteSessionAdapter.js +99 -0
  204. package/dist/src/node/sqliteSessionAdapter.js.map +1 -0
  205. package/dist/src/orchestration/agentTool.d.ts +50 -0
  206. package/dist/src/orchestration/agentTool.d.ts.map +1 -0
  207. package/dist/src/orchestration/agentTool.js +132 -0
  208. package/dist/src/orchestration/agentTool.js.map +1 -0
  209. package/dist/src/orchestration/background.d.ts +102 -0
  210. package/dist/src/orchestration/background.d.ts.map +1 -0
  211. package/dist/src/orchestration/background.js +310 -0
  212. package/dist/src/orchestration/background.js.map +1 -0
  213. package/dist/src/orchestration/childRunner.d.ts +12 -0
  214. package/dist/src/orchestration/childRunner.d.ts.map +1 -0
  215. package/dist/src/orchestration/childRunner.js +179 -0
  216. package/dist/src/orchestration/childRunner.js.map +1 -0
  217. package/dist/src/orchestration/contracts.d.ts +169 -0
  218. package/dist/src/orchestration/contracts.d.ts.map +1 -0
  219. package/dist/src/orchestration/contracts.js +11 -0
  220. package/dist/src/orchestration/contracts.js.map +1 -0
  221. package/dist/src/orchestration/handoff.d.ts +32 -0
  222. package/dist/src/orchestration/handoff.d.ts.map +1 -0
  223. package/dist/src/orchestration/handoff.js +60 -0
  224. package/dist/src/orchestration/handoff.js.map +1 -0
  225. package/dist/src/orchestration/index.d.ts +9 -0
  226. package/dist/src/orchestration/index.d.ts.map +1 -0
  227. package/dist/src/orchestration/index.js +9 -0
  228. package/dist/src/orchestration/index.js.map +1 -0
  229. package/dist/src/orchestration/presets.d.ts +51 -0
  230. package/dist/src/orchestration/presets.d.ts.map +1 -0
  231. package/dist/src/orchestration/presets.js +78 -0
  232. package/dist/src/orchestration/presets.js.map +1 -0
  233. package/dist/src/orchestration/scope.d.ts +69 -0
  234. package/dist/src/orchestration/scope.d.ts.map +1 -0
  235. package/dist/src/orchestration/scope.js +371 -0
  236. package/dist/src/orchestration/scope.js.map +1 -0
  237. package/dist/src/orchestration/workflowGraph.d.ts +73 -0
  238. package/dist/src/orchestration/workflowGraph.d.ts.map +1 -0
  239. package/dist/src/orchestration/workflowGraph.js +255 -0
  240. package/dist/src/orchestration/workflowGraph.js.map +1 -0
  241. package/dist/src/parity/actoviqCleanBridgeCompatSdk.d.ts.map +1 -1
  242. package/dist/src/parity/actoviqCleanBridgeCompatSdk.js +101 -48
  243. package/dist/src/parity/actoviqCleanBridgeCompatSdk.js.map +1 -1
  244. package/dist/src/parity/bridgeConfigs.d.ts +2 -2
  245. package/dist/src/parity/bridgeConfigs.d.ts.map +1 -1
  246. package/dist/src/parity/bridgeConfigs.js +78 -39
  247. package/dist/src/parity/bridgeConfigs.js.map +1 -1
  248. package/dist/src/parity/bridgeProviders.d.ts +9 -6
  249. package/dist/src/parity/bridgeProviders.d.ts.map +1 -1
  250. package/dist/src/parity/bridgeProviders.js +140 -26
  251. package/dist/src/parity/bridgeProviders.js.map +1 -1
  252. package/dist/src/parity/portableSessions.js +2 -2
  253. package/dist/src/parity/portableSessions.js.map +1 -1
  254. package/dist/src/profiles/index.d.ts +15 -0
  255. package/dist/src/profiles/index.d.ts.map +1 -0
  256. package/dist/src/profiles/index.js +618 -0
  257. package/dist/src/profiles/index.js.map +1 -0
  258. package/dist/src/profiles/types.d.ts +102 -0
  259. package/dist/src/profiles/types.d.ts.map +1 -0
  260. package/dist/src/profiles/types.js +9 -0
  261. package/dist/src/profiles/types.js.map +1 -0
  262. package/dist/src/provider/client.d.ts +1 -1
  263. package/dist/src/provider/client.d.ts.map +1 -1
  264. package/dist/src/provider/openai-model-api.js +1 -1
  265. package/dist/src/provider/openai-model-api.js.map +1 -1
  266. package/dist/src/providers-v2/adapter-base.d.ts +35 -0
  267. package/dist/src/providers-v2/adapter-base.d.ts.map +1 -0
  268. package/dist/src/providers-v2/adapter-base.js +115 -0
  269. package/dist/src/providers-v2/adapter-base.js.map +1 -0
  270. package/dist/src/providers-v2/anthropic.d.ts +15 -0
  271. package/dist/src/providers-v2/anthropic.d.ts.map +1 -0
  272. package/dist/src/providers-v2/anthropic.js +414 -0
  273. package/dist/src/providers-v2/anthropic.js.map +1 -0
  274. package/dist/src/providers-v2/capabilities.d.ts +33 -0
  275. package/dist/src/providers-v2/capabilities.d.ts.map +1 -0
  276. package/dist/src/providers-v2/capabilities.js +218 -0
  277. package/dist/src/providers-v2/capabilities.js.map +1 -0
  278. package/dist/src/providers-v2/index.d.ts +12 -0
  279. package/dist/src/providers-v2/index.d.ts.map +1 -0
  280. package/dist/src/providers-v2/index.js +8 -0
  281. package/dist/src/providers-v2/index.js.map +1 -0
  282. package/dist/src/providers-v2/legacy.d.ts +26 -0
  283. package/dist/src/providers-v2/legacy.d.ts.map +1 -0
  284. package/dist/src/providers-v2/legacy.js +543 -0
  285. package/dist/src/providers-v2/legacy.js.map +1 -0
  286. package/dist/src/providers-v2/mapping.d.ts +34 -0
  287. package/dist/src/providers-v2/mapping.d.ts.map +1 -0
  288. package/dist/src/providers-v2/mapping.js +194 -0
  289. package/dist/src/providers-v2/mapping.js.map +1 -0
  290. package/dist/src/providers-v2/openai-chat.d.ts +16 -0
  291. package/dist/src/providers-v2/openai-chat.d.ts.map +1 -0
  292. package/dist/src/providers-v2/openai-chat.js +318 -0
  293. package/dist/src/providers-v2/openai-chat.js.map +1 -0
  294. package/dist/src/providers-v2/openai-responses.d.ts +15 -0
  295. package/dist/src/providers-v2/openai-responses.d.ts.map +1 -0
  296. package/dist/src/providers-v2/openai-responses.js +356 -0
  297. package/dist/src/providers-v2/openai-responses.js.map +1 -0
  298. package/dist/src/providers-v2/registry.d.ts +39 -0
  299. package/dist/src/providers-v2/registry.d.ts.map +1 -0
  300. package/dist/src/providers-v2/registry.js +101 -0
  301. package/dist/src/providers-v2/registry.js.map +1 -0
  302. package/dist/src/providers-v2/stream.d.ts +14 -0
  303. package/dist/src/providers-v2/stream.d.ts.map +1 -0
  304. package/dist/src/providers-v2/stream.js +115 -0
  305. package/dist/src/providers-v2/stream.js.map +1 -0
  306. package/dist/src/providers-v2/transport.d.ts +36 -0
  307. package/dist/src/providers-v2/transport.d.ts.map +1 -0
  308. package/dist/src/providers-v2/transport.js +337 -0
  309. package/dist/src/providers-v2/transport.js.map +1 -0
  310. package/dist/src/providers-v2/types.d.ts +162 -0
  311. package/dist/src/providers-v2/types.d.ts.map +1 -0
  312. package/dist/src/providers-v2/types.js +8 -0
  313. package/dist/src/providers-v2/types.js.map +1 -0
  314. package/dist/src/router/modelRouter.d.ts.map +1 -1
  315. package/dist/src/router/modelRouter.js +2 -3
  316. package/dist/src/router/modelRouter.js.map +1 -1
  317. package/dist/src/runtime/actoviqAgents.d.ts +5 -0
  318. package/dist/src/runtime/actoviqAgents.d.ts.map +1 -1
  319. package/dist/src/runtime/actoviqAgents.js +22 -4
  320. package/dist/src/runtime/actoviqAgents.js.map +1 -1
  321. package/dist/src/runtime/actoviqBackgroundTasks.d.ts +2 -1
  322. package/dist/src/runtime/actoviqBackgroundTasks.d.ts.map +1 -1
  323. package/dist/src/runtime/actoviqBackgroundTasks.js +4 -2
  324. package/dist/src/runtime/actoviqBackgroundTasks.js.map +1 -1
  325. package/dist/src/runtime/actoviqCompact.d.ts +15 -0
  326. package/dist/src/runtime/actoviqCompact.d.ts.map +1 -1
  327. package/dist/src/runtime/actoviqCompact.js +36 -10
  328. package/dist/src/runtime/actoviqCompact.js.map +1 -1
  329. package/dist/src/runtime/actoviqModelApi.d.ts.map +1 -1
  330. package/dist/src/runtime/actoviqModelApi.js +16 -2
  331. package/dist/src/runtime/actoviqModelApi.js.map +1 -1
  332. package/dist/src/runtime/actoviqPermissions.js +5 -1
  333. package/dist/src/runtime/actoviqPermissions.js.map +1 -1
  334. package/dist/src/runtime/agentClient.d.ts +3 -0
  335. package/dist/src/runtime/agentClient.d.ts.map +1 -1
  336. package/dist/src/runtime/agentClient.js +127 -45
  337. package/dist/src/runtime/agentClient.js.map +1 -1
  338. package/dist/src/runtime/agentRuntimeDiscovery.d.ts +75 -0
  339. package/dist/src/runtime/agentRuntimeDiscovery.d.ts.map +1 -0
  340. package/dist/src/runtime/agentRuntimeDiscovery.js +311 -0
  341. package/dist/src/runtime/agentRuntimeDiscovery.js.map +1 -0
  342. package/dist/src/runtime/agentSession.d.ts +18 -0
  343. package/dist/src/runtime/agentSession.d.ts.map +1 -1
  344. package/dist/src/runtime/agentSession.js +36 -0
  345. package/dist/src/runtime/agentSession.js.map +1 -1
  346. package/dist/src/runtime/asyncQueue.d.ts +99 -8
  347. package/dist/src/runtime/asyncQueue.d.ts.map +1 -1
  348. package/dist/src/runtime/asyncQueue.js +437 -37
  349. package/dist/src/runtime/asyncQueue.js.map +1 -1
  350. package/dist/src/runtime/conversationEngine.d.ts +7 -0
  351. package/dist/src/runtime/conversationEngine.d.ts.map +1 -1
  352. package/dist/src/runtime/conversationEngine.js +278 -18
  353. package/dist/src/runtime/conversationEngine.js.map +1 -1
  354. package/dist/src/runtime/deadline.d.ts +13 -0
  355. package/dist/src/runtime/deadline.d.ts.map +1 -0
  356. package/dist/src/runtime/deadline.js +67 -0
  357. package/dist/src/runtime/deadline.js.map +1 -0
  358. package/dist/src/runtime/messageUtils.d.ts +5 -0
  359. package/dist/src/runtime/messageUtils.d.ts.map +1 -1
  360. package/dist/src/runtime/messageUtils.js +17 -0
  361. package/dist/src/runtime/messageUtils.js.map +1 -1
  362. package/dist/src/runtime/sessionTurnCoordinator.d.ts +12 -0
  363. package/dist/src/runtime/sessionTurnCoordinator.d.ts.map +1 -0
  364. package/dist/src/runtime/sessionTurnCoordinator.js +23 -0
  365. package/dist/src/runtime/sessionTurnCoordinator.js.map +1 -0
  366. package/dist/src/runtime/tools.d.ts.map +1 -1
  367. package/dist/src/runtime/tools.js +1 -0
  368. package/dist/src/runtime/tools.js.map +1 -1
  369. package/dist/src/runtime-v2/agentRuntime.d.ts +136 -0
  370. package/dist/src/runtime-v2/agentRuntime.d.ts.map +1 -0
  371. package/dist/src/runtime-v2/agentRuntime.js +1341 -0
  372. package/dist/src/runtime-v2/agentRuntime.js.map +1 -0
  373. package/dist/src/runtime-v2/index.d.ts +6 -0
  374. package/dist/src/runtime-v2/index.d.ts.map +1 -0
  375. package/dist/src/runtime-v2/index.js +6 -0
  376. package/dist/src/runtime-v2/index.js.map +1 -0
  377. package/dist/src/runtime-v2/middleware/index.d.ts +5 -0
  378. package/dist/src/runtime-v2/middleware/index.d.ts.map +1 -0
  379. package/dist/src/runtime-v2/middleware/index.js +4 -0
  380. package/dist/src/runtime-v2/middleware/index.js.map +1 -0
  381. package/dist/src/runtime-v2/middleware/pipeline.d.ts +56 -0
  382. package/dist/src/runtime-v2/middleware/pipeline.d.ts.map +1 -0
  383. package/dist/src/runtime-v2/middleware/pipeline.js +242 -0
  384. package/dist/src/runtime-v2/middleware/pipeline.js.map +1 -0
  385. package/dist/src/runtime-v2/middleware/registry.d.ts +17 -0
  386. package/dist/src/runtime-v2/middleware/registry.d.ts.map +1 -0
  387. package/dist/src/runtime-v2/middleware/registry.js +46 -0
  388. package/dist/src/runtime-v2/middleware/registry.js.map +1 -0
  389. package/dist/src/runtime-v2/middleware/stages.d.ts +25 -0
  390. package/dist/src/runtime-v2/middleware/stages.d.ts.map +1 -0
  391. package/dist/src/runtime-v2/middleware/stages.js +48 -0
  392. package/dist/src/runtime-v2/middleware/stages.js.map +1 -0
  393. package/dist/src/runtime-v2/middleware/types.d.ts +51 -0
  394. package/dist/src/runtime-v2/middleware/types.d.ts.map +1 -0
  395. package/dist/src/runtime-v2/middleware/types.js +2 -0
  396. package/dist/src/runtime-v2/middleware/types.js.map +1 -0
  397. package/dist/src/runtime-v2/services.d.ts +33 -0
  398. package/dist/src/runtime-v2/services.d.ts.map +1 -0
  399. package/dist/src/runtime-v2/services.js +92 -0
  400. package/dist/src/runtime-v2/services.js.map +1 -0
  401. package/dist/src/runtime-v2/state.d.ts +71 -0
  402. package/dist/src/runtime-v2/state.d.ts.map +1 -0
  403. package/dist/src/runtime-v2/state.js +2 -0
  404. package/dist/src/runtime-v2/state.js.map +1 -0
  405. package/dist/src/runtime-v2/tools.d.ts +124 -0
  406. package/dist/src/runtime-v2/tools.d.ts.map +1 -0
  407. package/dist/src/runtime-v2/tools.js +185 -0
  408. package/dist/src/runtime-v2/tools.js.map +1 -0
  409. package/dist/src/scheduling/durableAgentScheduler.d.ts +46 -0
  410. package/dist/src/scheduling/durableAgentScheduler.d.ts.map +1 -0
  411. package/dist/src/scheduling/durableAgentScheduler.js +97 -0
  412. package/dist/src/scheduling/durableAgentScheduler.js.map +1 -0
  413. package/dist/src/scheduling/index.d.ts +3 -0
  414. package/dist/src/scheduling/index.d.ts.map +1 -1
  415. package/dist/src/scheduling/index.js +2 -0
  416. package/dist/src/scheduling/index.js.map +1 -1
  417. package/dist/src/scheduling/taskPersistence.d.ts +9 -0
  418. package/dist/src/scheduling/taskPersistence.d.ts.map +1 -0
  419. package/dist/src/scheduling/taskPersistence.js +238 -0
  420. package/dist/src/scheduling/taskPersistence.js.map +1 -0
  421. package/dist/src/storage/atomicJsonWrite.d.ts +13 -0
  422. package/dist/src/storage/atomicJsonWrite.d.ts.map +1 -0
  423. package/dist/src/storage/atomicJsonWrite.js +40 -0
  424. package/dist/src/storage/atomicJsonWrite.js.map +1 -0
  425. package/dist/src/storage/backgroundTaskStore.d.ts.map +1 -1
  426. package/dist/src/storage/backgroundTaskStore.js +2 -6
  427. package/dist/src/storage/backgroundTaskStore.js.map +1 -1
  428. package/dist/src/storage/mailboxStore.d.ts.map +1 -1
  429. package/dist/src/storage/mailboxStore.js +2 -6
  430. package/dist/src/storage/mailboxStore.js.map +1 -1
  431. package/dist/src/storage/sessionStore.d.ts +3 -0
  432. package/dist/src/storage/sessionStore.d.ts.map +1 -1
  433. package/dist/src/storage/sessionStore.js +169 -10
  434. package/dist/src/storage/sessionStore.js.map +1 -1
  435. package/dist/src/storage/teammateStore.d.ts.map +1 -1
  436. package/dist/src/storage/teammateStore.js +2 -6
  437. package/dist/src/storage/teammateStore.js.map +1 -1
  438. package/dist/src/storage-v2/contracts.d.ts +36 -0
  439. package/dist/src/storage-v2/contracts.d.ts.map +1 -0
  440. package/dist/src/storage-v2/contracts.js +2 -0
  441. package/dist/src/storage-v2/contracts.js.map +1 -0
  442. package/dist/src/storage-v2/errors.d.ts +21 -0
  443. package/dist/src/storage-v2/errors.d.ts.map +1 -0
  444. package/dist/src/storage-v2/errors.js +44 -0
  445. package/dist/src/storage-v2/errors.js.map +1 -0
  446. package/dist/src/storage-v2/index.d.ts +8 -0
  447. package/dist/src/storage-v2/index.d.ts.map +1 -0
  448. package/dist/src/storage-v2/index.js +8 -0
  449. package/dist/src/storage-v2/index.js.map +1 -0
  450. package/dist/src/storage-v2/legacyJsonV1Items.d.ts +10 -0
  451. package/dist/src/storage-v2/legacyJsonV1Items.d.ts.map +1 -0
  452. package/dist/src/storage-v2/legacyJsonV1Items.js +153 -0
  453. package/dist/src/storage-v2/legacyJsonV1Items.js.map +1 -0
  454. package/dist/src/storage-v2/migration.d.ts +32 -0
  455. package/dist/src/storage-v2/migration.d.ts.map +1 -0
  456. package/dist/src/storage-v2/migration.js +242 -0
  457. package/dist/src/storage-v2/migration.js.map +1 -0
  458. package/dist/src/storage-v2/sqliteDriver.d.ts +24 -0
  459. package/dist/src/storage-v2/sqliteDriver.d.ts.map +1 -0
  460. package/dist/src/storage-v2/sqliteDriver.js +90 -0
  461. package/dist/src/storage-v2/sqliteDriver.js.map +1 -0
  462. package/dist/src/storage-v2/sqliteStorage.d.ts +55 -0
  463. package/dist/src/storage-v2/sqliteStorage.d.ts.map +1 -0
  464. package/dist/src/storage-v2/sqliteStorage.js +905 -0
  465. package/dist/src/storage-v2/sqliteStorage.js.map +1 -0
  466. package/dist/src/storage-v2/types.d.ts +198 -0
  467. package/dist/src/storage-v2/types.d.ts.map +1 -0
  468. package/dist/src/storage-v2/types.js +2 -0
  469. package/dist/src/storage-v2/types.js.map +1 -0
  470. package/dist/src/surfaces/index.d.ts +8 -0
  471. package/dist/src/surfaces/index.d.ts.map +1 -0
  472. package/dist/src/surfaces/index.js +8 -0
  473. package/dist/src/surfaces/index.js.map +1 -0
  474. package/dist/src/surfaces/internal.d.ts +17 -0
  475. package/dist/src/surfaces/internal.d.ts.map +1 -0
  476. package/dist/src/surfaces/internal.js +116 -0
  477. package/dist/src/surfaces/internal.js.map +1 -0
  478. package/dist/src/surfaces/legacyEventAdapter.d.ts +38 -0
  479. package/dist/src/surfaces/legacyEventAdapter.d.ts.map +1 -0
  480. package/dist/src/surfaces/legacyEventAdapter.js +373 -0
  481. package/dist/src/surfaces/legacyEventAdapter.js.map +1 -0
  482. package/dist/src/surfaces/legacySurfacePipeline.d.ts +18 -0
  483. package/dist/src/surfaces/legacySurfacePipeline.d.ts.map +1 -0
  484. package/dist/src/surfaces/legacySurfacePipeline.js +25 -0
  485. package/dist/src/surfaces/legacySurfacePipeline.js.map +1 -0
  486. package/dist/src/surfaces/redaction.d.ts +12 -0
  487. package/dist/src/surfaces/redaction.d.ts.map +1 -0
  488. package/dist/src/surfaces/redaction.js +111 -0
  489. package/dist/src/surfaces/redaction.js.map +1 -0
  490. package/dist/src/surfaces/runEventLegacyCompat.d.ts +26 -0
  491. package/dist/src/surfaces/runEventLegacyCompat.d.ts.map +1 -0
  492. package/dist/src/surfaces/runEventLegacyCompat.js +339 -0
  493. package/dist/src/surfaces/runEventLegacyCompat.js.map +1 -0
  494. package/dist/src/surfaces/runEventProjector.d.ts +44 -0
  495. package/dist/src/surfaces/runEventProjector.d.ts.map +1 -0
  496. package/dist/src/surfaces/runEventProjector.js +404 -0
  497. package/dist/src/surfaces/runEventProjector.js.map +1 -0
  498. package/dist/src/surfaces/runtimeBridgeAdapter.d.ts +30 -0
  499. package/dist/src/surfaces/runtimeBridgeAdapter.d.ts.map +1 -0
  500. package/dist/src/surfaces/runtimeBridgeAdapter.js +38 -0
  501. package/dist/src/surfaces/runtimeBridgeAdapter.js.map +1 -0
  502. package/dist/src/surfaces/types.d.ts +38 -0
  503. package/dist/src/surfaces/types.d.ts.map +1 -0
  504. package/dist/src/surfaces/types.js +2 -0
  505. package/dist/src/surfaces/types.js.map +1 -0
  506. package/dist/src/team/agentPool.d.ts +2 -0
  507. package/dist/src/team/agentPool.d.ts.map +1 -1
  508. package/dist/src/team/agentPool.js +3 -1
  509. package/dist/src/team/agentPool.js.map +1 -1
  510. package/dist/src/team/modelTeam.d.ts +25 -19
  511. package/dist/src/team/modelTeam.d.ts.map +1 -1
  512. package/dist/src/team/modelTeam.js +293 -294
  513. package/dist/src/team/modelTeam.js.map +1 -1
  514. package/dist/src/team/pricing.d.ts.map +1 -1
  515. package/dist/src/team/pricing.js +2 -1
  516. package/dist/src/team/pricing.js.map +1 -1
  517. package/dist/src/team/teamDefinitions.d.ts +28 -1
  518. package/dist/src/team/teamDefinitions.d.ts.map +1 -1
  519. package/dist/src/team/teamDefinitions.js +204 -8
  520. package/dist/src/team/teamDefinitions.js.map +1 -1
  521. package/dist/src/team/teamGraph.d.ts +191 -0
  522. package/dist/src/team/teamGraph.d.ts.map +1 -0
  523. package/dist/src/team/teamGraph.js +616 -0
  524. package/dist/src/team/teamGraph.js.map +1 -0
  525. package/dist/src/team/teamGraphLayout.d.ts +44 -0
  526. package/dist/src/team/teamGraphLayout.d.ts.map +1 -0
  527. package/dist/src/team/teamGraphLayout.js +120 -0
  528. package/dist/src/team/teamGraphLayout.js.map +1 -0
  529. package/dist/src/team/teamGraphScaffold.d.ts +76 -0
  530. package/dist/src/team/teamGraphScaffold.d.ts.map +1 -0
  531. package/dist/src/team/teamGraphScaffold.js +409 -0
  532. package/dist/src/team/teamGraphScaffold.js.map +1 -0
  533. package/dist/src/team/teamGraphV3.d.ts +28 -0
  534. package/dist/src/team/teamGraphV3.d.ts.map +1 -0
  535. package/dist/src/team/teamGraphV3.js +640 -0
  536. package/dist/src/team/teamGraphV3.js.map +1 -0
  537. package/dist/src/team/teamPreferences.d.ts +11 -0
  538. package/dist/src/team/teamPreferences.d.ts.map +1 -0
  539. package/dist/src/team/teamPreferences.js +48 -0
  540. package/dist/src/team/teamPreferences.js.map +1 -0
  541. package/dist/src/team/teamPrompts.d.ts +16 -0
  542. package/dist/src/team/teamPrompts.d.ts.map +1 -0
  543. package/dist/src/team/teamPrompts.js +44 -0
  544. package/dist/src/team/teamPrompts.js.map +1 -0
  545. package/dist/src/team/teamRunView.d.ts +78 -0
  546. package/dist/src/team/teamRunView.d.ts.map +1 -0
  547. package/dist/src/team/teamRunView.js +205 -0
  548. package/dist/src/team/teamRunView.js.map +1 -0
  549. package/dist/src/team/teamRuntime.d.ts +19 -2
  550. package/dist/src/team/teamRuntime.d.ts.map +1 -1
  551. package/dist/src/team/teamRuntime.js +13 -7
  552. package/dist/src/team/teamRuntime.js.map +1 -1
  553. package/dist/src/tools/actoviqCoreTools.d.ts +2 -1
  554. package/dist/src/tools/actoviqCoreTools.d.ts.map +1 -1
  555. package/dist/src/tools/actoviqCoreTools.js +4 -1
  556. package/dist/src/tools/actoviqCoreTools.js.map +1 -1
  557. package/dist/src/tools/actoviqShellTools.d.ts.map +1 -1
  558. package/dist/src/tools/actoviqShellTools.js +10 -0
  559. package/dist/src/tools/actoviqShellTools.js.map +1 -1
  560. package/dist/src/tools/askUserQuestion/AskUserQuestionTool.d.ts.map +1 -1
  561. package/dist/src/tools/askUserQuestion/AskUserQuestionTool.js +2 -0
  562. package/dist/src/tools/askUserQuestion/AskUserQuestionTool.js.map +1 -1
  563. package/dist/src/tools/bash/BashTool.d.ts +33 -2
  564. package/dist/src/tools/bash/BashTool.d.ts.map +1 -1
  565. package/dist/src/tools/bash/BashTool.js +140 -2
  566. package/dist/src/tools/bash/BashTool.js.map +1 -1
  567. package/dist/src/tools/bash/prompt.d.ts +1 -1
  568. package/dist/src/tools/bash/prompt.d.ts.map +1 -1
  569. package/dist/src/tools/bash/prompt.js +1 -0
  570. package/dist/src/tools/bash/prompt.js.map +1 -1
  571. package/dist/src/tools/planMode/PlanModeTools.js +2 -2
  572. package/dist/src/tools/planMode/PlanModeTools.js.map +1 -1
  573. package/dist/src/tools/todo/TodoWriteTool.d.ts +1 -1
  574. package/dist/src/tui/actoviqTui.d.ts.map +1 -1
  575. package/dist/src/tui/actoviqTui.js +522 -97
  576. package/dist/src/tui/actoviqTui.js.map +1 -1
  577. package/dist/src/tui/pluginCatalog.d.ts.map +1 -1
  578. package/dist/src/tui/pluginCatalog.js +3 -1
  579. package/dist/src/tui/pluginCatalog.js.map +1 -1
  580. package/dist/src/types.d.ts +355 -23
  581. package/dist/src/types.d.ts.map +1 -1
  582. package/dist/src/types.js.map +1 -1
  583. package/dist/src/ui/commandSurface.d.ts.map +1 -1
  584. package/dist/src/ui/commandSurface.js +23 -3
  585. package/dist/src/ui/commandSurface.js.map +1 -1
  586. package/dist/src/workflow/workflowPersistence.d.ts.map +1 -1
  587. package/dist/src/workflow/workflowPersistence.js +2 -1
  588. package/dist/src/workflow/workflowPersistence.js.map +1 -1
  589. package/dist/src/workflow/workflowScriptRuntime.d.ts +4 -0
  590. package/dist/src/workflow/workflowScriptRuntime.d.ts.map +1 -1
  591. package/dist/src/workflow/workflowScriptRuntime.js +69 -18
  592. package/dist/src/workflow/workflowScriptRuntime.js.map +1 -1
  593. package/dist/src/workflow-v2/boundary.d.ts +2 -0
  594. package/dist/src/workflow-v2/boundary.d.ts.map +1 -0
  595. package/dist/src/workflow-v2/boundary.js +45 -0
  596. package/dist/src/workflow-v2/boundary.js.map +1 -0
  597. package/dist/src/workflow-v2/capabilities.d.ts +5 -0
  598. package/dist/src/workflow-v2/capabilities.d.ts.map +1 -0
  599. package/dist/src/workflow-v2/capabilities.js +32 -0
  600. package/dist/src/workflow-v2/capabilities.js.map +1 -0
  601. package/dist/src/workflow-v2/errors.d.ts +43 -0
  602. package/dist/src/workflow-v2/errors.d.ts.map +1 -0
  603. package/dist/src/workflow-v2/errors.js +84 -0
  604. package/dist/src/workflow-v2/errors.js.map +1 -0
  605. package/dist/src/workflow-v2/index.d.ts +9 -0
  606. package/dist/src/workflow-v2/index.d.ts.map +1 -0
  607. package/dist/src/workflow-v2/index.js +6 -0
  608. package/dist/src/workflow-v2/index.js.map +1 -0
  609. package/dist/src/workflow-v2/json.d.ts +5 -0
  610. package/dist/src/workflow-v2/json.d.ts.map +1 -0
  611. package/dist/src/workflow-v2/json.js +40 -0
  612. package/dist/src/workflow-v2/json.js.map +1 -0
  613. package/dist/src/workflow-v2/limits.d.ts +15 -0
  614. package/dist/src/workflow-v2/limits.d.ts.map +1 -0
  615. package/dist/src/workflow-v2/limits.js +37 -0
  616. package/dist/src/workflow-v2/limits.js.map +1 -0
  617. package/dist/src/workflow-v2/localIsolatedProcessExecutor.d.ts +25 -0
  618. package/dist/src/workflow-v2/localIsolatedProcessExecutor.d.ts.map +1 -0
  619. package/dist/src/workflow-v2/localIsolatedProcessExecutor.js +423 -0
  620. package/dist/src/workflow-v2/localIsolatedProcessExecutor.js.map +1 -0
  621. package/dist/src/workflow-v2/localProcessChild.d.ts +2 -0
  622. package/dist/src/workflow-v2/localProcessChild.d.ts.map +1 -0
  623. package/dist/src/workflow-v2/localProcessChild.js +305 -0
  624. package/dist/src/workflow-v2/localProcessChild.js.map +1 -0
  625. package/dist/src/workflow-v2/router.d.ts +10 -0
  626. package/dist/src/workflow-v2/router.d.ts.map +1 -0
  627. package/dist/src/workflow-v2/router.js +28 -0
  628. package/dist/src/workflow-v2/router.js.map +1 -0
  629. package/dist/src/workflow-v2/trustedCompatibilityExecutor.d.ts +17 -0
  630. package/dist/src/workflow-v2/trustedCompatibilityExecutor.d.ts.map +1 -0
  631. package/dist/src/workflow-v2/trustedCompatibilityExecutor.js +159 -0
  632. package/dist/src/workflow-v2/trustedCompatibilityExecutor.js.map +1 -0
  633. package/dist/src/workflow-v2/types.d.ts +67 -0
  634. package/dist/src/workflow-v2/types.d.ts.map +1 -0
  635. package/dist/src/workflow-v2/types.js +2 -0
  636. package/dist/src/workflow-v2/types.js.map +1 -0
  637. package/package.json +96 -10
@@ -6,9 +6,11 @@
6
6
  * and real-time streaming output. Uses the main terminal buffer for
7
7
  * native scrollback.
8
8
  */
9
- import { createAgentSdk, loadJsonConfigFile, loadDefaultActoviqSettings, createActoviqCoreTools, listWorkflows, loadWorkflow, listTeamDefinitions, loadTeamDefinition, createModelTeam, WorktreeService, } from 'actoviq-agent-sdk';
9
+ import { createAgentSdk, loadJsonConfigFile, loadDefaultActoviqSettings, getLoadedJsonConfig, createActoviqCoreTools, listWorkflows, loadWorkflow, listTeamDefinitions, loadTeamDefinition, cloneTeamDefinition, instantiateTeamDefinition, listTeamAgentLabels, countTeamAgents, createModelTeam, createTeamTool, readTeamPreferences, createManagerTools, buildManagerSystemPrompt, buildUpdateProgressPrompt, formatManagerUpdatePreview, resolveGitHubDigestForUpdate, readManagerConfig, writeManagerConfig, readProjectPlanFile, readProgressFile, managerProgressPath, createProjectIssue, executeProjectIssue, isIssueStatus, isIssueStorageMode, listProjectIssues, listScheduledAutomationTasks, resolveActoviqHome, transitionProjectIssue, WorktreeService, } from 'actoviq-agent-sdk';
10
+ import { readProjectMeta } from '../gui/projectMeta.js';
11
+ import { LegacySurfaceEventPipeline, } from '../surfaces/index.js';
12
+ import { applyTeamRunEvent, createTeamRunViewState, formatTeamRunTreeLines } from '../team/teamRunView.js';
10
13
  import { execSync } from 'node:child_process';
11
- import os from 'node:os';
12
14
  import path from 'node:path';
13
15
  import * as readline from 'node:readline';
14
16
  import { hasVersionFlag, readPackageVersion } from './version.js';
@@ -17,7 +19,7 @@ if (hasVersionFlag(process.argv.slice(2))) {
17
19
  process.exit(0);
18
20
  }
19
21
  const WORK_DIR = path.resolve(process.argv[2] ?? process.cwd());
20
- const CONFIG_PATH = process.argv[3] ?? path.join(os.homedir(), '.actoviq', 'settings.json');
22
+ const CONFIG_PATH = process.argv[3] ?? path.join(resolveActoviqHome(), 'settings.json');
21
23
  const DEFAULT_PERMISSION_MODE = 'bypassPermissions';
22
24
  const PERMISSION_MODES = new Set([
23
25
  'default',
@@ -40,6 +42,17 @@ const C = {
40
42
  function stripAnsi(s) {
41
43
  return s.replace(/\x1b\[[0-9;]*m/g, '').length;
42
44
  }
45
+ function surfaceRecord(value) {
46
+ return typeof value === 'object' && value !== null && !Array.isArray(value)
47
+ ? value
48
+ : undefined;
49
+ }
50
+ function surfaceString(value) {
51
+ return typeof value === 'string' ? value : undefined;
52
+ }
53
+ function surfaceInteger(value) {
54
+ return Number.isSafeInteger(value) && value >= 0 ? value : undefined;
55
+ }
43
56
  // ── System prompt ────────────────────────────────────────────────────
44
57
  const SYSTEM_PROMPT = `You are Actoviq, an interactive CLI agent. Working directory: ${WORK_DIR}\n\n` +
45
58
  `<env>\nWorking directory: ${WORK_DIR}\nIs git repo: ${isGit ? 'Yes' : 'No'}\nPlatform: ${process.platform}\nDate: ${new Date().toISOString().slice(0, 10)}\n</env>\n\n` +
@@ -74,7 +87,9 @@ const CMDS = {
74
87
  dream: 'Trigger memory consolidation',
75
88
  workflows: 'List or run dynamic workflows',
76
89
  worktree: 'Enter, exit, or list git worktrees',
77
- team: 'List or query Model Teams',
90
+ team: 'List, attach, or run Model Teams',
91
+ issues: 'List or update project issues',
92
+ manager: 'Project Manager: progress docs + status',
78
93
  };
79
94
  function completer(line) {
80
95
  if (!line.startsWith('/'))
@@ -145,6 +160,54 @@ async function main() {
145
160
  process.stdout.write(`${C.c}├${'─'.repeat(Math.min(w - 2, 60))}┤${C.r}\n\n`);
146
161
  let abortCtrl = null;
147
162
  let msgCount = 0;
163
+ // Persistent Manager session (kind: 'manager') — reused across /manager
164
+ // update/chat turns so the Manager keeps its own conversation context.
165
+ let managerSession = null;
166
+ // ── Team state (Phase 0: attach / autoInvoke / status) ─────────
167
+ const teamPrefs = readTeamPreferences(getLoadedJsonConfig()?.raw);
168
+ let activeTeamTool = null;
169
+ let activeTeamName = null;
170
+ let lastTeamRunSummary = null;
171
+ const attachTeam = (name) => {
172
+ const loaded = loadTeamDefinition(name, sdk.config.workDir);
173
+ if (!loaded)
174
+ return null;
175
+ const definition = instantiateTeamDefinition(loaded.definition, session.model);
176
+ activeTeamTool = createTeamTool(definition);
177
+ activeTeamName = definition.name;
178
+ return definition;
179
+ };
180
+ if (teamPrefs.defaultAttached) {
181
+ // Silently ignore unresolvable names; /team status surfaces the hint.
182
+ try {
183
+ attachTeam(teamPrefs.defaultAttached);
184
+ }
185
+ catch { /* ignore */ }
186
+ }
187
+ async function resolveManagerSession() {
188
+ if (managerSession)
189
+ return managerSession;
190
+ const managers = (await sdk.sessions.list()).filter(item => item.kind === 'manager');
191
+ managers.sort((a, b) => {
192
+ if (b.messageCount !== a.messageCount)
193
+ return b.messageCount - a.messageCount;
194
+ return (b.updatedAt || '').localeCompare(a.updatedAt || '');
195
+ });
196
+ for (const dup of managers.slice(1)) {
197
+ await sdk.sessions.delete(dup.id).catch(() => undefined);
198
+ }
199
+ const existing = managers[0];
200
+ if (existing) {
201
+ managerSession = await sdk.resumeSession(existing.id, { permissionMode: DEFAULT_PERMISSION_MODE });
202
+ return managerSession;
203
+ }
204
+ managerSession = await sdk.createSession({
205
+ title: 'Manager',
206
+ metadata: { __actoviqKind: 'manager' },
207
+ permissionMode: DEFAULT_PERMISSION_MODE,
208
+ });
209
+ return managerSession;
210
+ }
148
211
  // ── Process message ────────────────────────────────────────────
149
212
  async function processMsg(text) {
150
213
  const t = text.trim();
@@ -202,7 +265,7 @@ async function main() {
202
265
  process.stdout.write(`${C.d}No stored sessions.${C.r}\n\n`);
203
266
  return;
204
267
  }
205
- for (const stored of sessions) {
268
+ for (const stored of sessions.filter(item => item.kind !== 'manager')) {
206
269
  const current = stored.id === session.id ? '*' : ' ';
207
270
  process.stdout.write(`${C.d}${current} ${stored.id} ${stored.title} ${stored.model}${C.r}\n`);
208
271
  }
@@ -215,6 +278,12 @@ async function main() {
215
278
  process.stdout.write(`${C.R}Usage: /resume <session-id>${C.r}\n\n`);
216
279
  return;
217
280
  }
281
+ const listed = await sdk.sessions.list();
282
+ const target = listed.find(item => item.id === sessionId);
283
+ if (target?.kind === 'manager') {
284
+ process.stdout.write(`${C.R}Manager sessions live in the Project Manager panel only.${C.r}\n\n`);
285
+ return;
286
+ }
218
287
  session = await sdk.resumeSession(sessionId);
219
288
  process.stdout.write(`${C.g}Resumed ${session.id}: ${session.title} (${session.model})${C.r}\n\n`);
220
289
  return;
@@ -286,6 +355,7 @@ async function main() {
286
355
  const { WorkflowScriptRuntime } = await import('../workflow/workflowScriptRuntime.js');
287
356
  const runtime = new WorkflowScriptRuntime({
288
357
  sdk: sdk,
358
+ trust: 'trusted',
289
359
  args: wfTask,
290
360
  onEvent: (e) => {
291
361
  if (e.type === 'workflow.log')
@@ -364,17 +434,55 @@ async function main() {
364
434
  }
365
435
  // ── v0.5.0: Model Team ─────────────────────────────────────
366
436
  case 'team': {
367
- const sub = t.slice(sp + 1).trim();
437
+ const sub = sp === -1 ? '' : t.slice(sp + 1).trim();
368
438
  if (!sub || sub === 'list') {
369
439
  const teams = listTeamDefinitions(sdk.config.workDir);
370
- if (teams.length === 0) {
371
- process.stdout.write(`${C.d}No saved team definitions. Save JSON files to .actoviq/teams/${C.r}\n\n`);
440
+ for (const item of teams) {
441
+ const active = item.name === activeTeamName ? `${C.g}*${C.r}` : ' ';
442
+ process.stdout.write(`${active}${C.c}${item.name}${C.r}${C.d} · ${item.definition.mode} · ${item.source} · ${countTeamAgents(item.definition)} agents${C.r}\n`);
372
443
  }
373
- else {
374
- for (const t of teams) {
375
- process.stdout.write(`${C.c}${t.name}${C.r}${C.d} · ${t.definition.mode} · ${t.source} · ${t.definition.members?.length ?? 0} members${C.r}\n`);
376
- }
377
- process.stdout.write('\n');
444
+ process.stdout.write(`${C.d}\n/team attach <name> · /team ask <name> <prompt> · /team off · /team status${C.r}\n\n`);
445
+ return;
446
+ }
447
+ if (sub === 'status') {
448
+ const lines = [
449
+ `attached: ${activeTeamName ?? 'none'}`,
450
+ `autoInvoke: ${teamPrefs.autoInvoke ? 'on (main agent can call the team as a tool)' : 'off (manual /team ask only)'}`,
451
+ `defaultAttached: ${teamPrefs.defaultAttached ?? 'none'}` +
452
+ (teamPrefs.defaultAttached && !activeTeamName ? ` ${C.y}(not found)${C.r}` : ''),
453
+ `last run: ${lastTeamRunSummary ?? 'none'}`,
454
+ ];
455
+ process.stdout.write(`${C.d}${lines.join('\n')}${C.r}\n\n`);
456
+ return;
457
+ }
458
+ if (sub === 'off') {
459
+ activeTeamTool = null;
460
+ activeTeamName = null;
461
+ process.stdout.write(`${C.d}team: none${C.r}\n\n`);
462
+ return;
463
+ }
464
+ if (sub.startsWith('attach ')) {
465
+ const teamName = sub.slice(7).trim();
466
+ const definition = attachTeam(teamName);
467
+ if (!definition) {
468
+ process.stdout.write(`${C.R}Team not found: ${teamName}${C.r}\n\n`);
469
+ return;
470
+ }
471
+ process.stdout.write(`${C.g}team attached: ${definition.name}${C.r}${C.d} (${definition.mode}) · autoInvoke ${teamPrefs.autoInvoke ? 'on' : 'off — run /team ask to use it'}${C.r}\n\n`);
472
+ return;
473
+ }
474
+ if (sub.startsWith('clone ')) {
475
+ const parts = sub.slice(6).trim().split(/\s+/);
476
+ if (parts.length !== 2) {
477
+ process.stdout.write(`${C.R}Usage: /team clone <source> <new-name>${C.r}\n\n`);
478
+ return;
479
+ }
480
+ try {
481
+ const clone = await cloneTeamDefinition(parts[0], parts[1], { projectDir: sdk.config.workDir });
482
+ process.stdout.write(`${C.g}team cloned: ${parts[0]} → ${clone.name}${C.r}${C.d} (${clone.filePath})${C.r}\n\n`);
483
+ }
484
+ catch (e) {
485
+ process.stdout.write(`${C.R}✕ Clone failed: ${e.message}${C.r}\n\n`);
378
486
  }
379
487
  return;
380
488
  }
@@ -392,10 +500,33 @@ async function main() {
392
500
  process.stdout.write(`${C.R}Team not found: ${teamName}${C.r}\n\n`);
393
501
  return;
394
502
  }
395
- process.stdout.write(`${C.d}Asking team "${teamName}" (${loaded.definition.mode})...${C.r}\n`);
503
+ const definition = instantiateTeamDefinition(loaded.definition, session.model);
504
+ const memberModels = listTeamAgentLabels(definition);
505
+ process.stdout.write(`${C.d}Asking team "${teamName}" (${definition.mode})...${C.r}\n`);
396
506
  try {
397
- const team = createModelTeam(loaded.definition);
398
- const result = await team.ask(prompt);
507
+ const team = createModelTeam(definition);
508
+ const teamRunView = createTeamRunViewState(definition.name);
509
+ const printTeamRunTree = () => {
510
+ for (const line of formatTeamRunTreeLines(teamRunView)) {
511
+ process.stdout.write(`${C.d}${line}${C.r}\n`);
512
+ }
513
+ };
514
+ const result = await team.ask(prompt, undefined, {
515
+ workDir: sdk.config.workDir,
516
+ onEvent: (e) => {
517
+ applyTeamRunEvent(teamRunView, e);
518
+ if (e.type === 'team.synthesis') {
519
+ process.stdout.write(`${C.d} ◈ synthesis round ${e.round}: ${e.decision}${C.r}\n`);
520
+ }
521
+ else if (e.type === 'team.started'
522
+ || e.type === 'team.member.completed'
523
+ || e.type === 'team.edge.triggered'
524
+ || e.type === 'team.completed') {
525
+ printTeamRunTree();
526
+ }
527
+ },
528
+ });
529
+ lastTeamRunSummary = `${teamName} · ${result.mode} · ${Math.round(result.durationMs / 1000)}s`;
399
530
  process.stdout.write(`${C.g}✓ Response${C.r}${C.d} · ${result.mode} · ${Math.round(result.durationMs / 1000)}s${C.r}\n`);
400
531
  if (result.cost.estimatedCost !== null) {
401
532
  process.stdout.write(`${C.d} cost: $${result.cost.estimatedCost.toFixed(4)} · ${result.cost.totalInputTokens + result.cost.totalOutputTokens} tokens${C.r}\n`);
@@ -407,7 +538,272 @@ async function main() {
407
538
  }
408
539
  return;
409
540
  }
410
- process.stdout.write(`${C.d}Usage: /team [list|ask <name> <prompt>]${C.r}\n\n`);
541
+ process.stdout.write(`${C.d}Usage: /team [list|attach <name>|off|ask <name> <prompt>|clone <source> <new>|status]${C.r}\n\n`);
542
+ return;
543
+ }
544
+ // Project issues
545
+ case 'issues': {
546
+ const sub = sp === -1 ? '' : t.slice(sp + 1).trim();
547
+ const homeDir = sdk.config.homeDir;
548
+ const meta = await readProjectMeta(WORK_DIR, homeDir);
549
+ const storage = isIssueStorageMode(meta.issueStorage) ? meta.issueStorage : 'home';
550
+ if (!sub || sub === 'list') {
551
+ const issues = await listProjectIssues(WORK_DIR, homeDir, storage);
552
+ if (issues.length === 0) {
553
+ process.stdout.write(`${C.d}No issues yet. Use /issues create <title>${C.r}\n\n`);
554
+ return;
555
+ }
556
+ process.stdout.write(`${C.b}Issues (${storage})${C.r}\n`);
557
+ for (const issue of issues) {
558
+ process.stdout.write(`#${issue.number} ${issue.title} ${C.d}${issue.status} · ${issue.priority}${C.r}\n`);
559
+ }
560
+ process.stdout.write('\n');
561
+ return;
562
+ }
563
+ if (sub.startsWith('create ')) {
564
+ const title = sub.slice(7).trim();
565
+ if (!title) {
566
+ process.stdout.write(`${C.R}Usage: /issues create <title>${C.r}\n\n`);
567
+ return;
568
+ }
569
+ const issue = await createProjectIssue(WORK_DIR, homeDir, { title }, storage);
570
+ process.stdout.write(`${C.g}issue created: #${issue.number} ${issue.title}${C.r}\n\n`);
571
+ return;
572
+ }
573
+ if (sub.startsWith('show ')) {
574
+ const rawId = sub.slice(5).trim().replace(/^#/, '');
575
+ const issues = await listProjectIssues(WORK_DIR, homeDir, storage);
576
+ const issue = issues.find(candidate => candidate.id === rawId ||
577
+ String(candidate.number) === rawId ||
578
+ `ISS-${candidate.number}` === rawId.toUpperCase());
579
+ if (!issue) {
580
+ process.stdout.write(`${C.R}Issue not found: ${rawId}${C.r}\n\n`);
581
+ return;
582
+ }
583
+ process.stdout.write(`${C.b}ISS-${issue.number} ${issue.title}${C.r}\n` +
584
+ `${C.d}${issue.status} · ${issue.priority}${C.r}\n` +
585
+ `${issue.description || '(no description)'}\n` +
586
+ `${issue.acceptanceCriteria.length ? `\nAcceptance criteria:\n${issue.acceptanceCriteria.map(item => `- ${item}`).join('\n')}` : ''}` +
587
+ `${issue.brief ? `\n\nManager brief:\n${issue.brief}` : ''}\n\n`);
588
+ return;
589
+ }
590
+ if (sub.startsWith('start ')) {
591
+ const [, rawId, agentProfile] = sub.split(/\s+/, 3);
592
+ const id = rawId?.replace(/^#/, '');
593
+ const issues = await listProjectIssues(WORK_DIR, homeDir, storage);
594
+ const issue = issues.find(candidate => candidate.id === id ||
595
+ String(candidate.number) === id ||
596
+ `ISS-${candidate.number}` === id?.toUpperCase());
597
+ if (!issue) {
598
+ process.stdout.write(`${C.R}Issue not found: ${rawId ?? ''}${C.r}\n\n`);
599
+ return;
600
+ }
601
+ process.stdout.write(`${C.d}Decomposing and dispatching ISS-${issue.number}...${C.r}\n`);
602
+ const dispatched = await executeProjectIssue({
603
+ sdk,
604
+ managerSession: await resolveManagerSession(),
605
+ workDir: WORK_DIR,
606
+ homeDir,
607
+ storageMode: storage,
608
+ issue,
609
+ agentProfile,
610
+ defaultModel: session.model,
611
+ permissionMode: session.permissionContext.mode ?? DEFAULT_PERMISSION_MODE,
612
+ systemPrompt: SYSTEM_PROMPT,
613
+ onEvent: event => {
614
+ if (event.type === 'response.text.delta')
615
+ process.stdout.write(event.delta);
616
+ else if (event.type === 'tool.call')
617
+ toolLine(event.call.name, event.call.input);
618
+ else if (event.type === 'tool.result')
619
+ resultLine(event.result.isError, event.result.durationMs, event.result.output);
620
+ },
621
+ });
622
+ session = dispatched.session;
623
+ process.stdout.write(`\n${C.g}ISS-${dispatched.issue.number}: ${dispatched.issue.status} · session ${session.id}${C.r}\n\n`);
624
+ return;
625
+ }
626
+ const transitions = {
627
+ review: 'in_review',
628
+ done: 'done',
629
+ block: 'blocked',
630
+ };
631
+ const [verb, rawId] = sub.split(/\s+/, 2);
632
+ const nextStatus = transitions[verb ?? ''];
633
+ if (nextStatus && isIssueStatus(nextStatus) && rawId) {
634
+ const issue = await transitionProjectIssue(WORK_DIR, homeDir, rawId.replace(/^#/, ''), nextStatus, 'user', storage);
635
+ if (!issue)
636
+ process.stdout.write(`${C.R}Issue not found: ${rawId}${C.r}\n\n`);
637
+ else
638
+ process.stdout.write(`${C.g}issue #${issue.number}: ${issue.status}${C.r}\n\n`);
639
+ return;
640
+ }
641
+ process.stdout.write(`${C.d}Usage: /issues [list|show <id>|create <title>|start <id> [agent-profile]|review <id>|done <id>|block <id>]${C.r}\n\n`);
642
+ return;
643
+ }
644
+ // ── Project Manager ────────────────────────────────────────
645
+ case 'manager': {
646
+ const sub = sp === -1 ? '' : t.slice(sp + 1).trim();
647
+ const homeDir = sdk.config.homeDir;
648
+ if (!sub || sub === 'status') {
649
+ const cfg = await readManagerConfig(WORK_DIR, homeDir);
650
+ const plan = await readProjectPlanFile(WORK_DIR, homeDir);
651
+ const progress = await readProgressFile(WORK_DIR, homeDir);
652
+ const lines = [
653
+ `model: ${cfg.model ?? session.model + ' (session default)'}`,
654
+ `readScope: ${cfg.readScope}`,
655
+ `mirror to workspace: ${cfg.mirrorProgressToWorkspace ? 'on' : 'off'}`,
656
+ `plan.json: ${plan.milestones.length} milestones · ${plan.today.length} today · ${plan.upcoming.length} upcoming`,
657
+ `PROGRESS.md: ${progress ? `${progress.length} chars · ${managerProgressPath(WORK_DIR, homeDir)}` : '(none yet — /manager update)'}`,
658
+ ];
659
+ process.stdout.write(`${C.b}Manager${C.r}\n${C.d}${lines.join('\n')}${C.r}\n\n`);
660
+ return;
661
+ }
662
+ if (sub === 'config') {
663
+ const cfg = await readManagerConfig(WORK_DIR, homeDir);
664
+ process.stdout.write(`${C.d}${JSON.stringify(cfg, null, 2)}\nSet: /manager config set <model|bridgeConfig|readScope|mirror|allow> <value>\nThe Manager always runs read-only regardless of model.${C.r}\n\n`);
665
+ return;
666
+ }
667
+ if (sub.startsWith('config set ')) {
668
+ const rest = sub.slice('config set '.length).trim();
669
+ const spIdx = rest.indexOf(' ');
670
+ const key = spIdx === -1 ? rest : rest.slice(0, spIdx);
671
+ const value = spIdx === -1 ? '' : rest.slice(spIdx + 1).trim();
672
+ const cfg = await readManagerConfig(WORK_DIR, homeDir);
673
+ if (key === 'model')
674
+ cfg.model = value || undefined;
675
+ else if (key === 'bridgeConfig' || key === 'config')
676
+ cfg.bridgeConfig = value || undefined;
677
+ else if (key === 'readScope') {
678
+ if (value !== 'workspace-only' && value !== 'workspace+docs' && value !== 'explicit-allowlist' && value !== 'full-access') {
679
+ process.stdout.write(`${C.R}readScope must be workspace-only | workspace+docs | explicit-allowlist | full-access${C.r}\n\n`);
680
+ return;
681
+ }
682
+ cfg.readScope = value;
683
+ }
684
+ else if (key === 'mirror')
685
+ cfg.mirrorProgressToWorkspace = value === 'on' || value === 'true';
686
+ else if (key === 'allow')
687
+ cfg.allowedReadPaths = value ? value.split(',').map(p => p.trim()).filter(Boolean) : [];
688
+ else {
689
+ process.stdout.write(`${C.R}usage: /manager config set <model|bridgeConfig|readScope|mirror|allow> <value>${C.r}\n\n`);
690
+ return;
691
+ }
692
+ await writeManagerConfig(WORK_DIR, homeDir, cfg);
693
+ process.stdout.write(`${C.g}✓ Manager config updated: ${key}${C.r}\n\n`);
694
+ return;
695
+ }
696
+ if (sub === 'schedule') {
697
+ const tasks = (await listScheduledAutomationTasks(WORK_DIR)).filter(task => task.kind === 'manager');
698
+ if (tasks.length === 0) {
699
+ process.stdout.write(`${C.d}No manager schedules. Add kind:"manager" tasks to .actoviq/scheduled-tasks.json${C.r}\n\n`);
700
+ return;
701
+ }
702
+ for (const task of tasks) {
703
+ process.stdout.write(`${C.c}${task.name}${C.r}${C.d} · ${task.cron} · ${task.enabled ? 'enabled' : 'paused'}${C.r}\n`);
704
+ }
705
+ process.stdout.write('\n');
706
+ return;
707
+ }
708
+ const isUpdate = sub === 'update' || sub.startsWith('update ');
709
+ const isChat = sub === 'chat' || sub.startsWith('chat ');
710
+ if (isUpdate || isChat) {
711
+ const arg = isUpdate
712
+ ? (sub === 'update' ? '' : sub.slice('update'.length).trim())
713
+ : sub.slice('chat'.length).trim();
714
+ if (isChat && !arg) {
715
+ process.stdout.write(`${C.d}Usage: /manager chat <message>${C.r}\n\n`);
716
+ return;
717
+ }
718
+ if (isUpdate)
719
+ process.stdout.write(`${C.d}Manager: updating progress documents...${C.r}\n`);
720
+ try {
721
+ const cfg = await readManagerConfig(WORK_DIR, homeDir);
722
+ const managerTools = await createManagerTools({ workDir: WORK_DIR, homeDir, config: cfg });
723
+ let prompt;
724
+ if (isUpdate) {
725
+ // Host-collected context (the Manager itself has no shell).
726
+ let gitSummary = '';
727
+ try {
728
+ const branch = execSync('git rev-parse --abbrev-ref HEAD', { cwd: WORK_DIR, encoding: 'utf8' }).trim();
729
+ const dirty = execSync('git status --porcelain', { cwd: WORK_DIR, encoding: 'utf8' }).trim();
730
+ const log = execSync('git log --oneline -10', { cwd: WORK_DIR, encoding: 'utf8' }).trim();
731
+ gitSummary = `branch: ${branch}\ndirty files: ${dirty ? dirty.split('\n').length : 0}\nrecent commits:\n${log}`;
732
+ }
733
+ catch { /* not a git repo */ }
734
+ const stored = await sdk.sessions.list();
735
+ const conversationSummaries = stored
736
+ .filter(s => s.kind !== 'manager')
737
+ .slice(0, 20)
738
+ .map(s => `- [${s.updatedAt.slice(0, 10)}] ${s.title} (${s.messageCount} msgs): ${s.preview}`)
739
+ .join('\n');
740
+ const plan = await readProjectPlanFile(WORK_DIR, homeDir);
741
+ const progress = await readProgressFile(WORK_DIR, homeDir);
742
+ process.stdout.write(`${C.d}${formatManagerUpdatePreview(plan, progress).split('\n').slice(0, 2).join('\n')}${C.r}\n`);
743
+ const githubDigest = await resolveGitHubDigestForUpdate(WORK_DIR, arg || undefined);
744
+ prompt = buildUpdateProgressPrompt({
745
+ instruction: arg || undefined,
746
+ gitSummary,
747
+ conversationSummaries,
748
+ githubDigest,
749
+ currentPlanJson: JSON.stringify(plan, null, 2),
750
+ currentProgress: progress ?? undefined,
751
+ });
752
+ }
753
+ else {
754
+ prompt = arg;
755
+ }
756
+ managerSession = await resolveManagerSession();
757
+ try {
758
+ const compactResult = await managerSession.compact({});
759
+ if (compactResult.compacted) {
760
+ process.stdout.write(`${C.d}Manager: compacted ${compactResult.messagesRemoved ?? '?'} older messages${C.r}\n`);
761
+ }
762
+ }
763
+ catch { /* auto-compact is best-effort */ }
764
+ abortCtrl = new AbortController();
765
+ const runOptions = {
766
+ systemPrompt: buildManagerSystemPrompt(WORK_DIR, cfg),
767
+ tools: managerTools,
768
+ signal: abortCtrl.signal,
769
+ ...(cfg.model ? { model: cfg.model } : {}),
770
+ __actoviqUseDefaultTools: false,
771
+ __actoviqAllowedTools: managerTools.map(tool => tool.name),
772
+ };
773
+ const stream = managerSession.stream(prompt, runOptions);
774
+ const managerSurfaceEvents = new LegacySurfaceEventPipeline();
775
+ for await (const event of stream) {
776
+ for (const surfaceEvent of managerSurfaceEvents.projectFor(event, 'cli')) {
777
+ const data = surfaceEvent.data;
778
+ if (surfaceEvent.type === 'tool.started') {
779
+ toolLine(surfaceString(data.name) ?? surfaceString(data.publicName) ?? 'tool', surfaceRecord(data.input) ?? {});
780
+ }
781
+ else if (surfaceEvent.type === 'tool.completed'
782
+ || surfaceEvent.type === 'tool.failed'
783
+ || surfaceEvent.type === 'tool.rejected') {
784
+ resultLine(data.isError === true, undefined, data.output);
785
+ }
786
+ }
787
+ }
788
+ const result = await stream.result;
789
+ if (result.text)
790
+ process.stdout.write(`${result.text}\n`);
791
+ if (isUpdate) {
792
+ process.stdout.write(`${C.g}✓ Progress updated${C.r}${C.d} · ${managerProgressPath(WORK_DIR, homeDir)}${C.r}\n\n`);
793
+ }
794
+ else {
795
+ process.stdout.write('\n');
796
+ }
797
+ }
798
+ catch (e) {
799
+ process.stdout.write(`${C.R}✕ Manager error: ${e.message}${C.r}\n\n`);
800
+ }
801
+ finally {
802
+ abortCtrl = null;
803
+ }
804
+ return;
805
+ }
806
+ process.stdout.write(`${C.d}Usage: /manager [status|chat <message>|update [instruction]|config|schedule]${C.r}\n\n`);
411
807
  return;
412
808
  }
413
809
  default:
@@ -421,52 +817,71 @@ async function main() {
421
817
  signal: abortCtrl.signal,
422
818
  model: session.model,
423
819
  permissionMode: session.permissionContext.mode ?? DEFAULT_PERMISSION_MODE,
820
+ // Attached team is only exposed to the main agent when autoInvoke is on;
821
+ // otherwise attach is a selection and /team ask stays the manual path.
822
+ ...(activeTeamTool && teamPrefs.autoInvoke ? { tools: [activeTeamTool] } : {}),
424
823
  });
425
824
  let iteration = 0;
426
825
  let hasText = false;
427
826
  const activeTools = new Map();
827
+ const surfaceEvents = new LegacySurfaceEventPipeline();
428
828
  for await (const event of stream) {
429
- switch (event.type) {
430
- case 'request.started':
431
- iteration = event.iteration;
432
- if (iteration > 1)
433
- process.stdout.write(`\n${C.d}── iteration ${iteration} ──${C.r}\n`);
434
- break;
435
- case 'response.text.delta': {
436
- const txt = typeof event.delta === 'string' ? event.delta : event.delta?.text ?? '';
437
- process.stdout.write(txt);
438
- hasText = true;
439
- break;
440
- }
441
- case 'response.content':
442
- if (event.content.type === 'thinking') {
443
- const th = (event.content.thinking ?? '').slice(0, 250);
444
- process.stdout.write(`\n${C.d}💭 ${th}${C.r}\n`);
445
- }
446
- break;
447
- case 'tool.call': {
448
- activeTools.set(event.call.id, { name: event.call.name, start: Date.now() });
449
- toolLine(event.call.name, event.call.input);
450
- break;
451
- }
452
- case 'tool.progress': {
453
- const p = event.data;
454
- if (p?.message)
455
- process.stdout.write(`\r\x1b[K${C.d} ${p.message}${C.r}`);
456
- break;
457
- }
458
- case 'tool.result': {
459
- const info = activeTools.get(event.result.id);
460
- activeTools.delete(event.result.id);
461
- resultLine(event.result.isError, info ? Date.now() - info.start : undefined, event.result.output);
462
- break;
829
+ for (const surfaceEvent of surfaceEvents.projectFor(event, 'cli')) {
830
+ const data = surfaceEvent.data;
831
+ switch (surfaceEvent.type) {
832
+ case 'request.started':
833
+ iteration = surfaceInteger(data.iteration) ?? iteration;
834
+ if (iteration > 1)
835
+ process.stdout.write(`\n${C.d}── iteration ${iteration} ──${C.r}\n`);
836
+ break;
837
+ case 'text.delta': {
838
+ const txt = surfaceString(data.delta) ?? '';
839
+ process.stdout.write(txt);
840
+ hasText = true;
841
+ break;
842
+ }
843
+ case 'model.content': {
844
+ const content = surfaceRecord(data.content);
845
+ if (data.kind === 'content' && content?.type === 'thinking') {
846
+ const th = (surfaceString(content.thinking) ?? '').slice(0, 250);
847
+ process.stdout.write(`\n${C.d}💭 ${th}${C.r}\n`);
848
+ }
849
+ break;
850
+ }
851
+ case 'tool.started': {
852
+ const callId = surfaceString(data.callId);
853
+ const name = surfaceString(data.name) ?? surfaceString(data.publicName) ?? 'tool';
854
+ if (callId)
855
+ activeTools.set(callId, { name, start: Date.now() });
856
+ toolLine(name, surfaceRecord(data.input) ?? {});
857
+ break;
858
+ }
859
+ case 'tool.progress': {
860
+ const message = surfaceString(data.message)
861
+ ?? surfaceString(surfaceRecord(data.progress)?.message);
862
+ if (message)
863
+ process.stdout.write(`\r\x1b[K${C.d} ${message}${C.r}`);
864
+ break;
865
+ }
866
+ case 'tool.completed':
867
+ case 'tool.failed':
868
+ case 'tool.rejected': {
869
+ const callId = surfaceString(data.callId);
870
+ const info = callId ? activeTools.get(callId) : undefined;
871
+ if (callId)
872
+ activeTools.delete(callId);
873
+ resultLine(data.isError === true, info ? Date.now() - info.start : undefined, data.output);
874
+ break;
875
+ }
876
+ case 'compaction.completed':
877
+ process.stdout.write(`\n${C.d}── context compacted ──${C.r}\n`);
878
+ break;
879
+ case 'error':
880
+ process.stdout.write(`\n${C.R} ✕ ${surfaceString(data.message) ?? 'run failed'}${C.r}\n`);
881
+ break;
882
+ default:
883
+ break;
463
884
  }
464
- case 'session.compacted':
465
- process.stdout.write(`\n${C.d}── context compacted ──${C.r}\n`);
466
- break;
467
- case 'error':
468
- process.stdout.write(`\n${C.R} ✕ ${event.error.message}${C.r}\n`);
469
- break;
470
885
  }
471
886
  }
472
887
  if (!hasText) {
@@ -529,15 +944,35 @@ async function main() {
529
944
  });
530
945
  rl.prompt();
531
946
  rl.on('line', async (line) => {
532
- abortCtrl = null;
947
+ const queued = line.trim();
948
+ if (abortCtrl) {
949
+ if (!queued) {
950
+ rl.prompt();
951
+ return;
952
+ }
953
+ if (queued.startsWith('/')) {
954
+ process.stdout.write(`${C.d}Slash commands are unavailable while the agent is working.${C.r}\n`);
955
+ rl.prompt();
956
+ return;
957
+ }
958
+ session.steer(queued);
959
+ process.stdout.write(`${C.d} ⧗ queued steering message${C.r}\n`);
960
+ rl.prompt();
961
+ return;
962
+ }
533
963
  try {
534
964
  await processMsg(line);
535
965
  }
536
966
  catch (e) {
537
- if (e.name === 'AbortError')
967
+ if (e.name === 'AbortError' || e.name === 'RunAbortedError') {
538
968
  process.stdout.write(`\n${C.y} ⏹ aborted${C.r}\n`);
539
- else
969
+ }
970
+ else {
540
971
  process.stdout.write(`\n${C.R} ✕ ${e.message}${C.r}\n`);
972
+ }
973
+ }
974
+ finally {
975
+ abortCtrl = null;
541
976
  }
542
977
  rl.prompt();
543
978
  });