@xopcai/xopc 0.0.323 → 0.0.325

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 (572) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/extensions/weixin/src/plugin.js +1 -9
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DFzmThVi.js → agent-avatar-dicebear-CxfXpPWs.js} +1 -1
  5. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CDHe8gJf.js +1 -0
  6. package/dist/gateway/static/root/assets/{agent-plugin-dialog-DYFYiuig.js → agent-plugin-dialog-DMv-udoZ.js} +1 -1
  7. package/dist/gateway/static/root/assets/{agents-BqIlB5Co.js → agents-D_xOAXgj.js} +1 -1
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-BgvMRGWe.js → app-management-settings-panel-p7fZB4dT.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-CliHU03A.js → appearance-settings-C-clVcfp.js} +1 -1
  10. package/dist/gateway/static/root/assets/apps-page-Dz2g7eAN.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-DnuPpm0u.js → archive-plugin-Xm6xChUX.js} +1 -1
  12. package/dist/gateway/static/root/assets/{attachment-load-BiwaK0ie.js → attachment-load-Di8kuG4L.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-page-CJSISGQH.js → automations-page-GUZgDhKj.js} +1 -1
  14. package/dist/gateway/static/root/assets/automations-workspace-BUZhG9aJ.js +7 -0
  15. package/dist/gateway/static/root/assets/{binary-plugins-KDjduQZO.js → binary-plugins-OCrDjC9O.js} +1 -1
  16. package/dist/gateway/static/root/assets/{block-editor-bclvgove.js → block-editor-m9tqvu7x.js} +3 -3
  17. package/dist/gateway/static/root/assets/{browser-automation-inputs-CfQ2T9t6.js → browser-automation-inputs-DSWXq9lI.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-automations-page-Cxq38Nnp.js → browser-automations-page-DuOaridE.js} +2 -2
  19. package/dist/gateway/static/root/assets/browser-settings-page-D2_PgHep.js +3 -0
  20. package/dist/gateway/static/root/assets/capabilities-sAZT4brT.js +1 -0
  21. package/dist/gateway/static/root/assets/capabilities-settings-panel-7Y_pJqyt.js +8 -0
  22. package/dist/gateway/static/root/assets/channels-settings-B-Igy1ro.js +1 -0
  23. package/dist/gateway/static/root/assets/{chat-terminal-dock-DKQC62nQ.js → chat-terminal-dock-BfnVh8oo.js} +1 -1
  24. package/dist/gateway/static/root/assets/{computer-settings-page-D1whpIqL.js → computer-settings-page-aRG2lU4w.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connector-service-page-BAuYTgf5.js → connector-service-page-B5EhnfJH.js} +1 -1
  26. package/dist/gateway/static/root/assets/connectors-page-7HfRt1LW.js +2 -0
  27. package/dist/gateway/static/root/assets/date-picker-CtDyij_x.js +1 -0
  28. package/dist/gateway/static/root/assets/{dependency-picker-DOuVO2M1.js → dependency-picker-z6ouWxmz.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-D9tu6Bhu.js → desktop-pet-BsIYCAkG.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-CQPXub2f.js → desktop-pet-settings-z-0aQ5ct.js} +1 -1
  31. package/dist/gateway/static/root/assets/{device-pairing-wizard-DxkOYSut.js → device-pairing-wizard-DlmhQvY5.js} +1 -1
  32. package/dist/gateway/static/root/assets/dist-3h6cXXhT.js +1 -0
  33. package/dist/gateway/static/root/assets/{extension-debug-page-CtWClPz-.js → extension-debug-page-Ct9pABNW.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-BHh9HLCz.js → extension-page-BktsR4hj.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-BdT3v5Uh.js → extension-settings-page-BQJc-vXH.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-config-swr-1eqyz9vZ.js → gateway-config-swr-CoQVulMd.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-settings-CZas_Ekx.js → gateway-settings-BfDVlvy6.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-startup-retry-C4rsW6vJ.js → gateway-startup-retry-B5GJ-CQV.js} +1 -1
  39. package/dist/gateway/static/root/assets/home-page-CI_eQTPL.js +1 -0
  40. package/dist/gateway/static/root/assets/{image-generation-api-B5DXMylk.js → image-generation-api-DvWDkbk1.js} +1 -1
  41. package/dist/gateway/static/root/assets/{imports-page-B1JH0G5j.js → imports-page-DFpQfHVU.js} +1 -1
  42. package/dist/gateway/static/root/assets/index-19rMUT3d.js +121 -0
  43. package/dist/gateway/static/root/assets/{index-CNc4N4TX.css → index-BKL5tg2f.css} +1 -1
  44. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DGrLJ8Yh.js → keyboard-shortcuts-settings-ctJLm8TP.js} +1 -1
  45. package/dist/gateway/static/root/assets/local-app-workbench-page-C9kaP3Dy.js +1 -0
  46. package/dist/gateway/static/root/assets/{local-apps-page-DqjStqbL.js → local-apps-page-BxC_LTqq.js} +1 -1
  47. package/dist/gateway/static/root/assets/{locale-store-BIkcRr3t.js → locale-store-BPZR8x9b.js} +1 -1
  48. package/dist/gateway/static/root/assets/logs-page-Ok5SpG-G.js +2 -0
  49. package/dist/gateway/static/root/assets/{management-settings-gCfH4cwH.js → management-settings-aOzRaQHM.js} +1 -1
  50. package/dist/gateway/static/root/assets/{markdown-view-Ck_5MADq.js → markdown-view-Dft8ASFD.js} +1 -1
  51. package/dist/gateway/static/root/assets/{media-plugins-DTsZqgo6.js → media-plugins-ni5zJ4Ok.js} +1 -1
  52. package/dist/gateway/static/root/assets/messages-kFWhF6_t.js +3 -0
  53. package/dist/gateway/static/root/assets/note-detail-panel-C9OEltN9.js +5 -0
  54. package/dist/gateway/static/root/assets/notes-page-Dj9rMgdi.js +8 -0
  55. package/dist/gateway/static/root/assets/{page-context-capture-button-DTI_g4tz.js → page-context-capture-button-BJA3d8vU.js} +1 -1
  56. package/dist/gateway/static/root/assets/{page-tabs-CfW_Q-K5.js → page-tabs-Dyc3wKkl.js} +1 -1
  57. package/dist/gateway/static/root/assets/popover-select-DcsFzD_i.js +1 -0
  58. package/dist/gateway/static/root/assets/{preview-open-alternatives-CuPN-vAn.js → preview-open-alternatives-tIOIQbNX.js} +1 -1
  59. package/dist/gateway/static/root/assets/{product-open-page-BHjxRz1E.js → product-open-page-DQctU8z3.js} +1 -1
  60. package/dist/gateway/static/root/assets/project-detail-page-Dy-EwZcc.js +1 -0
  61. package/dist/gateway/static/root/assets/{projects-page-Bk-es4i9.js → projects-page-JaGKa6rM.js} +1 -1
  62. package/dist/gateway/static/root/assets/{registry-api-BAAZUGnU.js → registry-api-DWWO6ajd.js} +1 -1
  63. package/dist/gateway/static/root/assets/remote-access-hub-Cb8-nd60.js +1 -0
  64. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CHJBJKL1.js → runtime-tools-settings-panel-xhOSYfiX.js} +1 -1
  65. package/dist/gateway/static/root/assets/scenes-page-ClBkFdRY.js +2 -0
  66. package/dist/gateway/static/root/assets/{schema-form-FQAit5HL.js → schema-form-z8IeSdBp.js} +1 -1
  67. package/dist/gateway/static/root/assets/sessions-page-BYW5l_nY.js +1 -0
  68. package/dist/gateway/static/root/assets/settings-advanced-gate-CDNwmXuH.js +1 -0
  69. package/dist/gateway/static/root/assets/{settings-form-section-BDc6bw1q.js → settings-form-section-BXTJAser.js} +1 -1
  70. package/dist/gateway/static/root/assets/{settings-page-DnhxBJjV.js → settings-page-Br9no5e4.js} +1 -1
  71. package/dist/gateway/static/root/assets/{settings-page-layout-D3KNSQ5g.js → settings-page-layout-D6745w0p.js} +1 -1
  72. package/dist/gateway/static/root/assets/setup-status-panel-D2N9764S.js +1 -0
  73. package/dist/gateway/static/root/assets/{share-preview-page-DVQCRxwK.js → share-preview-page-CE0SER59.js} +1 -1
  74. package/dist/gateway/static/root/assets/shares-settings-Dk3_QOKQ.js +1 -0
  75. package/dist/gateway/static/root/assets/skill-reload-api-CPt61fEv.js +1 -0
  76. package/dist/gateway/static/root/assets/skills-page-Db6PB2C6.js +2 -0
  77. package/dist/gateway/static/root/assets/{skills-page.utils-mDwC9UJ-.js → skills-page.utils-DrtW5FBy.js} +1 -1
  78. package/dist/gateway/static/root/assets/{system-settings-panel-Bk7GrMij.js → system-settings-panel-CuY1Zh5s.js} +1 -1
  79. package/dist/gateway/static/root/assets/task-detail-page-o7RiDUMi.js +1 -0
  80. package/dist/gateway/static/root/assets/{tunnel-api-D3Aquraj.js → tunnel-api-PGHDgvWb.js} +1 -1
  81. package/dist/gateway/static/root/assets/{use-autosave-C1xQ-sHn.js → use-autosave-B55oBQUt.js} +1 -1
  82. package/dist/gateway/static/root/assets/user-model-page-DspelwAa.js +2 -0
  83. package/dist/gateway/static/root/assets/{voice-api-key-field-DCNECvcp.js → voice-api-key-field-By6Lgbse.js} +1 -1
  84. package/dist/gateway/static/root/assets/{voice-config-api-B-_niUTU.js → voice-config-api-BaxITrwZ.js} +1 -1
  85. package/dist/gateway/static/root/assets/{work-discovery-overlay-BrGx_JS_.js → work-discovery-overlay-DdhgIlyf.js} +1 -1
  86. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CmmC2Pdr.js → workflow-run-setup-panel-BOJYQaxX.js} +2 -2
  87. package/dist/gateway/static/root/assets/workflows-page-6ObD0IQZ.js +6 -0
  88. package/dist/gateway/static/root/index.html +11 -10
  89. package/dist/package.js +1 -1
  90. package/dist/packages/gateway-contract/src/home.js +284 -55
  91. package/dist/packages/gateway-contract/src/index.js +0 -2
  92. package/dist/packages/gateway-contract/src/notifications.js +3 -10
  93. package/dist/src/activity/emitter.js +2 -1
  94. package/dist/src/activity/service.js +2 -1
  95. package/dist/src/agent/agent-manager.d.ts +3 -2
  96. package/dist/src/agent/agent-manager.js +36 -44
  97. package/dist/src/agent/agent-scope.d.ts +19 -48
  98. package/dist/src/agent/agent-scope.js +47 -169
  99. package/dist/src/agent/background-review/run-background-review.js +5 -4
  100. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
  101. package/dist/src/agent/commands/command-registry.js +7 -3
  102. package/dist/src/agent/context/coordinator.js +1 -1
  103. package/dist/src/agent/context/execution-context.js +2 -1
  104. package/dist/src/agent/context/execution-scope.js +2 -1
  105. package/dist/src/agent/context/workspace-seed.d.ts +1 -2
  106. package/dist/src/agent/context/workspace-seed.js +3 -3
  107. package/dist/src/agent/context/workspace-state.js +1 -1
  108. package/dist/src/agent/embedded/run-for-session.js +2 -2
  109. package/dist/src/agent/embedded/run-turn.js +2 -1
  110. package/dist/src/agent/embedded/sqlite-hydrating-session-manager.js +2 -1
  111. package/dist/src/agent/external-tools/cliProvider.js +2 -1
  112. package/dist/src/agent/external-tools/composio-provider.js +2 -1
  113. package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
  114. package/dist/src/agent/external-tools/index.js +2 -3
  115. package/dist/src/agent/external-tools/mcp-provider.js +2 -2
  116. package/dist/src/agent/image/tool-model-config.js +4 -5
  117. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  118. package/dist/src/agent/ipc/bus.js +1 -1
  119. package/dist/src/agent/ipc/socket.js +3 -3
  120. package/dist/src/agent/media-generation/runtime-shared.d.ts +1 -1
  121. package/dist/src/agent/media-generation/runtime-shared.js +1 -1
  122. package/dist/src/agent/memory/plugin-discovery.js +1 -2
  123. package/dist/src/agent/models/manager.d.ts +1 -1
  124. package/dist/src/agent/models/manager.js +2 -2
  125. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +1 -1
  126. package/dist/src/agent/prompt/response-language.js +2 -1
  127. package/dist/src/agent/prompt/service-prompt-builder.js +6 -3
  128. package/dist/src/agent/prompt/system-prompt.js +2 -1
  129. package/dist/src/agent/reply/post-compaction-context.js +2 -2
  130. package/dist/src/agent/service/build-direct-message-content.js +1 -1
  131. package/dist/src/agent/service/direct-turn-helpers.js +2 -1
  132. package/dist/src/agent/service/parse-outbound-session-key.js +2 -1
  133. package/dist/src/agent/service/process-direct-streaming.js +3 -2
  134. package/dist/src/agent/service/webchat-tts.js +2 -1
  135. package/dist/src/agent/service.d.ts +1 -1
  136. package/dist/src/agent/service.js +12 -11
  137. package/dist/src/agent/service.types.d.ts +2 -0
  138. package/dist/src/agent/session/session-inspector.js +4 -5
  139. package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.d.ts +5 -0
  140. package/dist/src/agent/starter-agents.d.ts +4 -5
  141. package/dist/src/agent/starter-agents.js +21 -20
  142. package/dist/src/agent/tasks/task-judge-service.js +2 -2
  143. package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
  144. package/dist/src/agent/tool-manuals/xopc-use.js +31 -1
  145. package/dist/src/agent/tools/delegation-parent-policy.js +2 -3
  146. package/dist/src/agent/tools/factory.d.ts +2 -0
  147. package/dist/src/agent/tools/factory.js +10 -9
  148. package/dist/src/agent/tools/image-generate-tool.js +1 -1
  149. package/dist/src/agent/tools/workflow-tool.js +2 -3
  150. package/dist/src/agent/tools/xopc-use-tool.d.ts +3 -2
  151. package/dist/src/agent/tools/xopc-use-tool.js +54 -6
  152. package/dist/src/agent/workflow/workflow-child-tools.js +1 -2
  153. package/dist/src/agent/workspace-runtime/registry.d.ts +1 -1
  154. package/dist/src/agent/workspace-runtime/registry.js +2 -2
  155. package/dist/src/agent-catalog/capabilities.d.ts +3 -0
  156. package/dist/src/agent-catalog/capabilities.js +238 -0
  157. package/dist/src/agent-catalog/id.d.ts +15 -0
  158. package/dist/src/agent-catalog/id.js +101 -0
  159. package/dist/src/agent-catalog/index.d.ts +6 -0
  160. package/dist/src/agent-catalog/index.js +10 -0
  161. package/dist/src/agent-catalog/migrations/legacy-config-cutover.d.ts +11 -0
  162. package/dist/src/agent-catalog/migrations/legacy-config-cutover.js +195 -0
  163. package/dist/src/agent-catalog/repository.d.ts +39 -0
  164. package/dist/src/agent-catalog/repository.js +319 -0
  165. package/dist/src/agent-catalog/service.d.ts +33 -0
  166. package/dist/src/agent-catalog/service.js +202 -0
  167. package/dist/src/agent-catalog/test-support.d.ts +14 -0
  168. package/dist/src/agent-catalog/test-support.js +34 -0
  169. package/dist/src/agent-catalog/types.d.ts +26 -0
  170. package/dist/src/agent-catalog/types.js +1 -0
  171. package/dist/src/agent-config/index.js +2 -2
  172. package/dist/src/agent-config/schema.d.ts +1 -172
  173. package/dist/src/agent-config/schema.js +2 -41
  174. package/dist/src/auth/credentials.js +3 -3
  175. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  176. package/dist/src/auth/sync-provider-auth.d.ts +1 -1
  177. package/dist/src/auth/sync-provider-auth.js +5 -9
  178. package/dist/src/automations/capabilities/drafts.js +8 -7
  179. package/dist/src/automations/service/action-executor.js +2 -1
  180. package/dist/src/bootstrap/application-state.d.ts +10 -0
  181. package/dist/src/bootstrap/application-state.js +26 -0
  182. package/dist/src/browser/automations/repository.js +2 -1
  183. package/dist/src/browser/automations/schema.d.ts +1 -1
  184. package/dist/src/browser/automations/service.d.ts +1 -1
  185. package/dist/src/browser/native-messaging-host.js +5 -4
  186. package/dist/src/browser/providers/extension.js +4 -2
  187. package/dist/src/browser/providers/realtime-extension.js +2 -1
  188. package/dist/src/capabilities/readiness/from-config.js +7 -4
  189. package/dist/src/capabilities/runtime/dispatcher.d.ts +1 -0
  190. package/dist/src/capabilities/runtime/dispatcher.js +10 -4
  191. package/dist/src/capabilities/runtime/product.js +2 -0
  192. package/dist/src/channels/catalog/channel-catalog-service.js +7 -13
  193. package/dist/src/chat-commands/agent-edit.js +4 -3
  194. package/dist/src/chat-commands/builtins/config.js +6 -8
  195. package/dist/src/chat-commands/builtins/review.js +1 -1
  196. package/dist/src/chat-commands/builtins/workflow.js +1 -1
  197. package/dist/src/chat-commands/config-paths.js +1 -1
  198. package/dist/src/chat-commands/context.js +2 -3
  199. package/dist/src/chat-previews/store.js +2 -1
  200. package/dist/src/cli/command-manifest.js +1 -1
  201. package/dist/src/cli/commands/agent.js +4 -4
  202. package/dist/src/cli/commands/agents.d.ts +1 -1
  203. package/dist/src/cli/commands/agents.js +36 -48
  204. package/dist/src/cli/commands/auth.js +2 -1
  205. package/dist/src/cli/commands/browser-cli-helpers.js +1 -2
  206. package/dist/src/cli/commands/channels.js +2 -4
  207. package/dist/src/cli/commands/config.js +4 -5
  208. package/dist/src/cli/commands/connectors.js +1 -2
  209. package/dist/src/cli/commands/doctor/checks/channel-config.js +2 -4
  210. package/dist/src/cli/commands/doctor/checks/channel-pairing-pending.js +1 -2
  211. package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -2
  212. package/dist/src/cli/commands/doctor/checks/config-health.js +1 -2
  213. package/dist/src/cli/commands/doctor/checks/database-schema.js +4 -4
  214. package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -2
  215. package/dist/src/cli/commands/doctor/checks/gateway-service.js +1 -2
  216. package/dist/src/cli/commands/doctor/checks/provider-auth.js +13 -11
  217. package/dist/src/cli/commands/doctor/checks/security-audit.js +1 -2
  218. package/dist/src/cli/commands/doctor/checks/session-integrity.js +3 -3
  219. package/dist/src/cli/commands/doctor/checks/tool-runtimes.js +1 -2
  220. package/dist/src/cli/commands/doctor/checks/workspace-status.js +5 -7
  221. package/dist/src/cli/commands/extension-agent-plugin.js +1 -2
  222. package/dist/src/cli/commands/extension-dev.js +2 -4
  223. package/dist/src/cli/commands/extension-marketplace.js +1 -2
  224. package/dist/src/cli/commands/extension-pack.js +1 -2
  225. package/dist/src/cli/commands/extension.js +1 -2
  226. package/dist/src/cli/commands/gateway/run-foreground.js +3 -3
  227. package/dist/src/cli/commands/gateway/shared.js +1 -1
  228. package/dist/src/cli/commands/history.js +2 -1
  229. package/dist/src/cli/commands/image.js +2 -2
  230. package/dist/src/cli/commands/init.js +11 -30
  231. package/dist/src/cli/commands/mcp.js +1 -2
  232. package/dist/src/cli/commands/models.js +13 -11
  233. package/dist/src/cli/commands/onboard/channels/registry.js +1 -2
  234. package/dist/src/cli/commands/onboard/gateway.js +1 -2
  235. package/dist/src/cli/commands/onboard/model.d.ts +1 -1
  236. package/dist/src/cli/commands/onboard/model.js +18 -26
  237. package/dist/src/cli/commands/onboard.js +4 -2
  238. package/dist/src/cli/commands/platform.js +1 -0
  239. package/dist/src/cli/commands/project.js +3 -3
  240. package/dist/src/cli/commands/providers.js +2 -1
  241. package/dist/src/cli/commands/runtime.js +1 -2
  242. package/dist/src/cli/commands/search.js +1 -2
  243. package/dist/src/cli/commands/skills.js +1 -2
  244. package/dist/src/cli/commands/tui-runner.js +3 -2
  245. package/dist/src/cli/commands/tui.js +6 -8
  246. package/dist/src/cli/commands/tunnel.js +1 -1
  247. package/dist/src/cli/commands/voice.js +1 -2
  248. package/dist/src/cli/extension-cli-register.js +1 -1
  249. package/dist/src/cli/index.js +4 -2
  250. package/dist/src/cli/utils/gateway-client.js +1 -1
  251. package/dist/src/cli/utils/init-workspace-core.js +15 -16
  252. package/dist/src/cli/utils/session.js +1 -2
  253. package/dist/src/computer/model-config.d.ts +3 -3
  254. package/dist/src/computer/model-config.js +10 -20
  255. package/dist/src/computer/runtime.js +1 -1
  256. package/dist/src/config/agent-model-intents.js +2 -2
  257. package/dist/src/config/agent-profile.d.ts +5 -6
  258. package/dist/src/config/agent-profile.js +19 -19
  259. package/dist/src/config/config-surface.d.ts +0 -3
  260. package/dist/src/config/default-model.js +2 -6
  261. package/dist/src/config/index.js +7 -8
  262. package/dist/src/config/loader.js +12 -18
  263. package/dist/src/config/models-json.d.ts +6 -6
  264. package/dist/src/config/paths.d.ts +18 -19
  265. package/dist/src/config/paths.js +35 -35
  266. package/dist/src/config/reload.d.ts +0 -1
  267. package/dist/src/config/reload.js +1 -6
  268. package/dist/src/config/rules.js +0 -15
  269. package/dist/src/config/schema.d.ts +3 -406
  270. package/dist/src/config/schema.js +24 -86
  271. package/dist/src/config/validate-channel-configs.js +8 -14
  272. package/dist/src/config/workspace-dirs.d.ts +3 -4
  273. package/dist/src/config/workspace-dirs.js +9 -8
  274. package/dist/src/config/workspace-path-helpers.d.ts +1 -1
  275. package/dist/src/config/workspace-path-helpers.js +2 -2
  276. package/dist/src/connectors/cli/lifecycle.js +2 -1
  277. package/dist/src/connectors/composio-managed-events.js +2 -1
  278. package/dist/src/connectors/connected-source-ingestion.js +2 -1
  279. package/dist/src/connectors/connected-source-understanding.js +4 -2
  280. package/dist/src/connectors/content-enrichment.js +2 -1
  281. package/dist/src/connectors/learning-coordinator.js +2 -1
  282. package/dist/src/connectors/runtime-adapter-registry.js +2 -1
  283. package/dist/src/connectors/workflow-preflight.d.ts +8 -1
  284. package/dist/src/connectors/workflow-preflight.js +11 -3
  285. package/dist/src/discussions/analyzer.js +2 -2
  286. package/dist/src/endpoint-tools/runtime.js +2 -1
  287. package/dist/src/execution-environments/subject.js +2 -1
  288. package/dist/src/extensions/activation-context.js +3 -16
  289. package/dist/src/extensions/agent-plugins/validation.js +1 -1
  290. package/dist/src/extensions/discover-extensions.js +9 -15
  291. package/dist/src/extensions/extension-metadata-snapshot.d.ts +1 -1
  292. package/dist/src/extensions/extension-metadata-snapshot.js +9 -16
  293. package/dist/src/extensions/index.js +4 -10
  294. package/dist/src/extensions/install.js +1 -1
  295. package/dist/src/extensions/loader.js +7 -14
  296. package/dist/src/extensions/manifest-registry.js +93 -98
  297. package/dist/src/extensions/marketplace.js +5 -2
  298. package/dist/src/extensions/normalize-manifest.js +12 -17
  299. package/dist/src/extensions/update.js +1 -2
  300. package/dist/src/files/file-service.js +7 -8
  301. package/dist/src/gateway/agents-admin.d.ts +23 -27
  302. package/dist/src/gateway/agents-admin.js +109 -130
  303. package/dist/src/gateway/file-path-classifier.js +3 -3
  304. package/dist/src/gateway/file-space-service.js +2 -1
  305. package/dist/src/gateway/global-defaults-admin.d.ts +6 -4
  306. package/dist/src/gateway/global-defaults-admin.js +21 -20
  307. package/dist/src/gateway/hono/app.js +2 -1
  308. package/dist/src/gateway/hono/lib/config-payload.js +12 -9
  309. package/dist/src/gateway/hono/middleware/auth.js +2 -1
  310. package/dist/src/gateway/hono/middleware/scopes.js +2 -1
  311. package/dist/src/gateway/hono/routes/agents.js +22 -49
  312. package/dist/src/gateway/hono/routes/browser.js +4 -2
  313. package/dist/src/gateway/hono/routes/channels.js +1 -2
  314. package/dist/src/gateway/hono/routes/cli-connectors.js +2 -1
  315. package/dist/src/gateway/hono/routes/commands-skills.js +3 -1
  316. package/dist/src/gateway/hono/routes/composer-history.js +2 -1
  317. package/dist/src/gateway/hono/routes/config-patch/index.d.ts +1 -3
  318. package/dist/src/gateway/hono/routes/config-patch/index.js +1 -2
  319. package/dist/src/gateway/hono/routes/config-patch/misc.js +18 -11
  320. package/dist/src/gateway/hono/routes/config.js +0 -2
  321. package/dist/src/gateway/hono/routes/connectors.js +8 -4
  322. package/dist/src/gateway/hono/routes/context-sources.js +4 -3
  323. package/dist/src/gateway/hono/routes/device-pairing-approval.js +2 -1
  324. package/dist/src/gateway/hono/routes/device-push.js +3 -2
  325. package/dist/src/gateway/hono/routes/devices.js +6 -3
  326. package/dist/src/gateway/hono/routes/discussions.js +2 -1
  327. package/dist/src/gateway/hono/routes/endpoint-tools.js +2 -1
  328. package/dist/src/gateway/hono/routes/global-defaults.js +8 -16
  329. package/dist/src/gateway/hono/routes/home.js +93 -4
  330. package/dist/src/gateway/hono/routes/interaction-state.js +2 -1
  331. package/dist/src/gateway/hono/routes/models.js +8 -7
  332. package/dist/src/gateway/hono/routes/notes.js +4 -5
  333. package/dist/src/gateway/hono/routes/projects.js +6 -6
  334. package/dist/src/gateway/hono/routes/public-gateway.js +2 -1
  335. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  336. package/dist/src/gateway/hono/routes/sessions.js +4 -2
  337. package/dist/src/gateway/hono/routes/shares.js +4 -3
  338. package/dist/src/gateway/hono/routes/site-shares.js +2 -2
  339. package/dist/src/gateway/hono/routes/status.js +2 -3
  340. package/dist/src/gateway/hono/routes/tasks.js +1 -2
  341. package/dist/src/gateway/hono/routes/user-model-refresh.js +2 -1
  342. package/dist/src/gateway/hono/routes/user-model.js +3 -2
  343. package/dist/src/gateway/hono/routes/work-discovery.js +1 -1
  344. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  345. package/dist/src/gateway/image-generation-setup.d.ts +19 -10
  346. package/dist/src/gateway/image-generation-setup.js +59 -23
  347. package/dist/src/gateway/index.js +1 -4
  348. package/dist/src/gateway/lock.js +13 -18
  349. package/dist/src/gateway/memory-maintenance-automation-reconciler.js +4 -3
  350. package/dist/src/gateway/run-loop.js +2 -3
  351. package/dist/src/gateway/security/gateway-scopes.js +6 -2
  352. package/dist/src/gateway/security/index.js +4 -1
  353. package/dist/src/gateway/service/agent-runner.js +4 -2
  354. package/dist/src/gateway/service/app-context-access.js +2 -1
  355. package/dist/src/gateway/service/config-coordinator.d.ts +0 -1
  356. package/dist/src/gateway/service/config-coordinator.js +4 -22
  357. package/dist/src/gateway/service/marketplace-service.js +3 -1
  358. package/dist/src/gateway/service/run-gateway-agent.js +4 -2
  359. package/dist/src/gateway/service/session-input-coordinator.js +4 -2
  360. package/dist/src/gateway/service.d.ts +5 -0
  361. package/dist/src/gateway/service.js +109 -33
  362. package/dist/src/gateway/session-context-summary.js +4 -2
  363. package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +2 -0
  364. package/dist/src/gateway/xopc-cloud-capability-setup.js +15 -10
  365. package/dist/src/home-intelligence/application-service.d.ts +31 -0
  366. package/dist/src/home-intelligence/application-service.js +134 -0
  367. package/dist/src/home-intelligence/capability-preflight.d.ts +32 -0
  368. package/dist/src/home-intelligence/capability-preflight.js +118 -0
  369. package/dist/src/home-intelligence/evaluation.d.ts +34 -0
  370. package/dist/src/home-intelligence/evaluation.js +49 -0
  371. package/dist/src/home-intelligence/generator.d.ts +125 -0
  372. package/dist/src/home-intelligence/generator.js +227 -0
  373. package/dist/src/home-intelligence/host.d.ts +53 -0
  374. package/dist/src/home-intelligence/host.js +257 -0
  375. package/dist/src/home-intelligence/notification.d.ts +8 -0
  376. package/dist/src/home-intelligence/notification.js +20 -0
  377. package/dist/src/home-intelligence/policy.d.ts +16 -0
  378. package/dist/src/home-intelligence/policy.js +152 -0
  379. package/dist/src/home-intelligence/repository.d.ts +81 -0
  380. package/dist/src/home-intelligence/repository.js +495 -0
  381. package/dist/src/home-intelligence/snapshot.d.ts +43 -0
  382. package/dist/src/home-intelligence/snapshot.js +133 -0
  383. package/dist/src/home-intelligence/strategy.d.ts +14 -0
  384. package/dist/src/home-intelligence/strategy.js +10 -0
  385. package/dist/src/home-intelligence/types.d.ts +13 -0
  386. package/dist/src/home-intelligence/types.js +1 -0
  387. package/dist/src/infra/update-restart.js +4 -2
  388. package/dist/src/knowledge/connected-knowledge-pipeline.js +2 -1
  389. package/dist/src/knowledge/ingestion-service.js +2 -1
  390. package/dist/src/knowledge-memory/repository.js +2 -1
  391. package/dist/src/local-apps/service.js +1 -1
  392. package/dist/src/local-apps/store.js +2 -1
  393. package/dist/src/mcp/channel-bridge.js +1 -2
  394. package/dist/src/mcp/channel-server.js +1 -2
  395. package/dist/src/mcp/gateway-http-client.js +1 -2
  396. package/dist/src/media/session-references.js +2 -1
  397. package/dist/src/memory-maintenance/service.js +2 -1
  398. package/dist/src/migrations/memory-config.js +1 -2
  399. package/dist/src/notes/agent-context.js +2 -1
  400. package/dist/src/notes/attachment-ref.js +8 -4
  401. package/dist/src/notes/note-attachment-sync.js +2 -1
  402. package/dist/src/notes/note-index-meta.js +14 -7
  403. package/dist/src/notes/note-markdown.js +13 -7
  404. package/dist/src/notes/service.js +6 -3
  405. package/dist/src/notes/store.js +4 -2
  406. package/dist/src/notifications/device-store.js +1 -1
  407. package/dist/src/notifications/planner.js +24 -0
  408. package/dist/src/notifications/service.d.ts +7 -14
  409. package/dist/src/notifications/service.js +13 -3
  410. package/dist/src/notifications/store.js +1 -1
  411. package/dist/src/notifications/types.d.ts +1 -1
  412. package/dist/src/notifications/types.js +1 -1
  413. package/dist/src/projects/capabilities/write.js +2 -1
  414. package/dist/src/projects/project-agent-suggestion.js +1 -1
  415. package/dist/src/projects/project-agent.js +4 -4
  416. package/dist/src/projects/project-service.js +2 -1
  417. package/dist/src/projects/workspace.js +3 -2
  418. package/dist/src/providers/index.js +3 -3
  419. package/dist/src/providers/model-reference-auditor.d.ts +1 -2
  420. package/dist/src/providers/model-reference-auditor.js +8 -5
  421. package/dist/src/realtime/runtime.js +2 -1
  422. package/dist/src/routing/binding-schema.d.ts +41 -0
  423. package/dist/src/routing/binding-schema.js +26 -0
  424. package/dist/src/routing/bindings.d.ts +4 -2
  425. package/dist/src/routing/bindings.js +4 -4
  426. package/dist/src/routing/index.d.ts +1 -1
  427. package/dist/src/routing/resolve-route.d.ts +7 -24
  428. package/dist/src/routing/resolve-route.js +17 -18
  429. package/dist/src/routing/resolve-tui-session-key.d.ts +1 -4
  430. package/dist/src/routing/resolve-tui-session-key.js +10 -9
  431. package/dist/src/scenes/execution.d.ts +1 -1
  432. package/dist/src/scenes/model.js +1 -1
  433. package/dist/src/scenes/taskFollowUp/contracts.d.ts +1 -1
  434. package/dist/src/scenes/taskFollowUp/service.js +6 -4
  435. package/dist/src/scenes/templates.d.ts +2 -2
  436. package/dist/src/session/config-store.js +2 -1
  437. package/dist/src/session/init-session-turn.js +2 -1
  438. package/dist/src/session/resolve-session.js +2 -1
  439. package/dist/src/session/session-workspace.js +1 -1
  440. package/dist/src/session/store.js +3 -2
  441. package/dist/src/storage/sqlite/activity-repository.js +6 -2
  442. package/dist/src/storage/sqlite/browser-tab-binding-repository.js +6 -2
  443. package/dist/src/storage/sqlite/clarification-wait-repository.js +13 -8
  444. package/dist/src/storage/sqlite/collaboration-rule-repository.d.ts +1 -1
  445. package/dist/src/storage/sqlite/collaboration-rule-repository.js +8 -3
  446. package/dist/src/storage/sqlite/composer-input-history-repository.js +8 -3
  447. package/dist/src/storage/sqlite/config-repository.js +9 -5
  448. package/dist/src/storage/sqlite/connector-learning-repository.js +6 -2
  449. package/dist/src/storage/sqlite/connector-sync-policy-repository.js +6 -2
  450. package/dist/src/storage/sqlite/context-evidence-repository.js +8 -3
  451. package/dist/src/storage/sqlite/context-extraction-repository.js +8 -3
  452. package/dist/src/storage/sqlite/device-access-repository.js +15 -9
  453. package/dist/src/storage/sqlite/device-pairing-approval.js +6 -2
  454. package/dist/src/storage/sqlite/device-pairing-repository.js +10 -5
  455. package/dist/src/storage/sqlite/endpoint-principal-repository.js +6 -2
  456. package/dist/src/storage/sqlite/endpoint-session-binding-repository.js +6 -2
  457. package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +6 -2
  458. package/dist/src/storage/sqlite/gateway-identity-repository.js +6 -2
  459. package/dist/src/storage/sqlite/home-attention-repository.js +6 -2
  460. package/dist/src/storage/sqlite/index.d.ts +0 -1
  461. package/dist/src/storage/sqlite/index.js +72 -42
  462. package/dist/src/storage/sqlite/interaction-state-repository.js +10 -4
  463. package/dist/src/storage/sqlite/knowledge-repository.js +6 -2
  464. package/dist/src/storage/sqlite/migrations/203_remove_retired_proactive_contracts.sql +70 -0
  465. package/dist/src/storage/sqlite/migrations/204_home_intelligence.sql +78 -0
  466. package/dist/src/storage/sqlite/migrations/205_agent_catalog.sql +66 -0
  467. package/dist/src/storage/sqlite/migrations/206_home_advice_strategy_version.sql +3 -0
  468. package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +2 -0
  469. package/dist/src/storage/sqlite/migrations/conversation-backup.js +8 -4
  470. package/dist/src/storage/sqlite/migrations/conversation-windows-owners.d.ts +7 -1
  471. package/dist/src/storage/sqlite/migrations/conversation-windows-owners.js +2 -2
  472. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  473. package/dist/src/storage/sqlite/migrations/runner.js +4 -4
  474. package/dist/src/storage/sqlite/note-agent-context-repository.js +6 -2
  475. package/dist/src/storage/sqlite/notes-repository.js +9 -4
  476. package/dist/src/storage/sqlite/schema.js +1 -1
  477. package/dist/src/storage/sqlite/session-task-plan-repository.js +14 -9
  478. package/dist/src/storage/sqlite/session-turn-replace-repository.js +9 -5
  479. package/dist/src/storage/sqlite/sidebar-layout-repository.js +14 -9
  480. package/dist/src/storage/sqlite/transcript-repository.js +10 -6
  481. package/dist/src/storage/sqlite/user-people-repository.js +8 -3
  482. package/dist/src/storage/sqlite/user-trust-repository.js +8 -3
  483. package/dist/src/tasks/attention-governor.d.ts +0 -1
  484. package/dist/src/tasks/attention-governor.js +1 -7
  485. package/dist/src/tasks/capabilities/read.js +2 -2
  486. package/dist/src/tasks/capabilities/write.d.ts +1 -1
  487. package/dist/src/tasks/execution-context.d.ts +2 -2
  488. package/dist/src/tasks/execution-context.js +6 -5
  489. package/dist/src/tasks/home-query-service.d.ts +3 -2
  490. package/dist/src/tasks/home-query-service.js +23 -44
  491. package/dist/src/tasks/task-context-assembler.js +2 -1
  492. package/dist/src/tasks/task-context-repository.d.ts +1 -1
  493. package/dist/src/tasks/task-contract-planner.d.ts +0 -3
  494. package/dist/src/tasks/task-contract-planner.js +1 -4
  495. package/dist/src/tasks/task-handoff-service.d.ts +0 -2
  496. package/dist/src/tasks/task-handoff-service.js +3 -3
  497. package/dist/src/tasks/task-value-metrics-service.js +2 -1
  498. package/dist/src/tui/backends/embedded-backend.js +12 -14
  499. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  500. package/dist/src/tui/tui-commands.js +5 -3
  501. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  502. package/dist/src/tui/tui-startup-resources.js +3 -3
  503. package/dist/src/tui/tui.js +5 -5
  504. package/dist/src/tunnel/registration-proof.js +2 -1
  505. package/dist/src/user-context/access-policy.js +2 -1
  506. package/dist/src/user-context/domain.d.ts +1 -1
  507. package/dist/src/user-context/domain.js +18 -13
  508. package/dist/src/user-context/extraction/registry.js +2 -1
  509. package/dist/src/user-context/interaction-state.js +4 -1
  510. package/dist/src/user-context/relationship-continuity.js +2 -1
  511. package/dist/src/user-context/trust-policy.js +13 -8
  512. package/dist/src/user-model/bootstrap.js +2 -1
  513. package/dist/src/user-model/capture/executor.js +4 -2
  514. package/dist/src/user-model/capture/semantic.d.ts +1 -1
  515. package/dist/src/user-model/capture/semantic.js +1 -1
  516. package/dist/src/user-model/domain.js +7 -2
  517. package/dist/src/user-model/goals.js +2 -1
  518. package/dist/src/user-model/index.js +4 -1
  519. package/dist/src/user-model/repository.js +2 -1
  520. package/dist/src/utils/helpers.js +1 -4
  521. package/dist/src/utils/index.js +2 -2
  522. package/dist/src/utils/logger/index.d.ts +1 -1
  523. package/dist/src/utils/logger/index.js +2 -2
  524. package/dist/src/utils/logger/redact.d.ts +2 -0
  525. package/dist/src/utils/logger/redact.js +11 -3
  526. package/dist/src/utils/logger.js +2 -2
  527. package/dist/src/voice/realtime/memory-context.js +2 -1
  528. package/dist/src/voice/realtime/persona-context.js +6 -6
  529. package/dist/src/voice/tts/audio.js +1 -1
  530. package/dist/src/work-discovery/analyzer.js +3 -3
  531. package/dist/src/work-discovery/investigator.js +1 -1
  532. package/dist/src/work-discovery/service.js +12 -11
  533. package/dist/src/workflows/draft/workflow-draft-service.js +1 -1
  534. package/dist/src/workflows/service/workflow-run-service.js +4 -5
  535. package/dist/src/workflows/store/paths.js +1 -1
  536. package/package.json +5 -5
  537. package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CAFHadiy.js +0 -1
  538. package/dist/gateway/static/root/assets/apps-page-Drt3Foi9.js +0 -1
  539. package/dist/gateway/static/root/assets/automations-workspace-B-Eduqwz.js +0 -7
  540. package/dist/gateway/static/root/assets/browser-settings-page-Dwgir6mu.js +0 -3
  541. package/dist/gateway/static/root/assets/capabilities-settings-panel-H5L5vynP.js +0 -8
  542. package/dist/gateway/static/root/assets/capabilities-uFKh3Hd0.js +0 -1
  543. package/dist/gateway/static/root/assets/channels-settings-RFBRYe5S.js +0 -1
  544. package/dist/gateway/static/root/assets/connectors-page-Px-v3Q6Q.js +0 -2
  545. package/dist/gateway/static/root/assets/date-picker-CfCo3lqh.js +0 -1
  546. package/dist/gateway/static/root/assets/home-page-w3_aWeNt.js +0 -1
  547. package/dist/gateway/static/root/assets/index--3c0awkr.js +0 -121
  548. package/dist/gateway/static/root/assets/local-app-workbench-page-BYKrJpFF.js +0 -1
  549. package/dist/gateway/static/root/assets/logs-page-Dl4kM4Na.js +0 -2
  550. package/dist/gateway/static/root/assets/messages-7VAhscYe.js +0 -3
  551. package/dist/gateway/static/root/assets/note-detail-panel-j6sioeL1.js +0 -5
  552. package/dist/gateway/static/root/assets/notes-page-CMvvHv0f.js +0 -8
  553. package/dist/gateway/static/root/assets/popover-select-B-GDnZO9.js +0 -1
  554. package/dist/gateway/static/root/assets/project-detail-page-C9K_e-EV.js +0 -1
  555. package/dist/gateway/static/root/assets/remote-access-hub-CLGJNA42.js +0 -1
  556. package/dist/gateway/static/root/assets/scenes-page-ClLAD1pz.js +0 -2
  557. package/dist/gateway/static/root/assets/sessions-page-Xj8MkXN1.js +0 -1
  558. package/dist/gateway/static/root/assets/settings-advanced-gate-DwALV8mi.js +0 -1
  559. package/dist/gateway/static/root/assets/setup-status-panel-F0rCQ-2a.js +0 -1
  560. package/dist/gateway/static/root/assets/shares-settings-C7hf6Cov.js +0 -1
  561. package/dist/gateway/static/root/assets/skill-reload-api-xPrFejRE.js +0 -1
  562. package/dist/gateway/static/root/assets/skills-page-RdDYu7Yj.js +0 -2
  563. package/dist/gateway/static/root/assets/task-detail-page-2A966jFY.js +0 -1
  564. package/dist/gateway/static/root/assets/user-model-page-CnBxPBVe.js +0 -2
  565. package/dist/gateway/static/root/assets/workflows-page-BZVpqw4T.js +0 -6
  566. package/dist/packages/gateway-contract/src/proactive.js +0 -136
  567. package/dist/src/commands/agents.config.d.ts +0 -31
  568. package/dist/src/commands/agents.config.js +0 -129
  569. package/dist/src/gateway/hono/routes/config-patch/agents.d.ts +0 -2
  570. package/dist/src/gateway/hono/routes/config-patch/agents.js +0 -6
  571. package/dist/src/storage/sqlite/relationship-settings-repository.d.ts +0 -17
  572. package/dist/src/storage/sqlite/relationship-settings-repository.js +0 -65
@@ -15,7 +15,7 @@ var AgentSocketServer = class {
15
15
  connections = /* @__PURE__ */ new Map();
16
16
  messageHandler;
17
17
  constructor(config, agentId) {
18
- this.socketPath = resolveSocketPath(config, agentId);
18
+ this.socketPath = resolveSocketPath(agentId);
19
19
  }
20
20
  /**
21
21
  * Start the socket server
@@ -143,7 +143,7 @@ var AgentSocketClient = class {
143
143
  socketPath;
144
144
  pendingResponses = /* @__PURE__ */ new Map();
145
145
  constructor(config, targetAgentId) {
146
- this.socketPath = resolveSocketPath(config, targetAgentId);
146
+ this.socketPath = resolveSocketPath(targetAgentId);
147
147
  }
148
148
  /**
149
149
  * Connect to the socket server
@@ -255,7 +255,7 @@ var AgentSocketClient = class {
255
255
  }
256
256
  };
257
257
  async function isSocketAvailable(config, agentId) {
258
- const socketPath = resolveSocketPath(config, agentId);
258
+ const socketPath = resolveSocketPath(agentId);
259
259
  return new Promise((resolve) => {
260
260
  const socket = new Socket();
261
261
  socket.on("connect", () => {
@@ -90,7 +90,7 @@ export declare function throwCapabilityGenerationFailure(params: ThrowCapability
90
90
  export interface BuildNoCapabilityModelConfiguredMessageParams {
91
91
  /** Display label, e.g. "image-generation". */
92
92
  capabilityLabel: string;
93
- /** Config key path, e.g. "agents.defaults.models.imageGeneration". */
93
+ /** Agent model capability key, e.g. "imageGeneration". */
94
94
  modelConfigKey: string;
95
95
  providers: ReadonlyArray<CapabilityProviderCandidate>;
96
96
  /** Optional env-var lookup, e.g. (id) => PROVIDER_ENV_MAP[id]. */
@@ -190,7 +190,7 @@ function throwCapabilityGenerationFailure(params) {
190
190
  });
191
191
  }
192
192
  function buildNoCapabilityModelConfiguredMessage(params) {
193
- const lines = [`No ${params.capabilityLabel} model configured. Set agents.defaults.models.${params.modelConfigKey} or pass modelOverride at call site.`];
193
+ const lines = [`No ${params.capabilityLabel} model configured. Configure ${params.modelConfigKey} in global Agent defaults or pass modelOverride at call site.`];
194
194
  if (params.providers.length > 0) {
195
195
  lines.push("Registered providers:");
196
196
  for (const p of params.providers) {
@@ -1,9 +1,8 @@
1
- import { discoverExtensionsFromDisk, init_discover_extensions } from "../../extensions/discover-extensions.js";
1
+ import { discoverExtensionsFromDisk } from "../../extensions/discover-extensions.js";
2
2
  import { isAbsolute, join } from "node:path";
3
3
  import { pathToFileURL } from "node:url";
4
4
  import { stat } from "node:fs/promises";
5
5
  //#region src/agent/memory/plugin-discovery.ts
6
- init_discover_extensions();
7
6
  async function discoverMemoryPlugins(config) {
8
7
  const plugins = [];
9
8
  for (const extension of discoverMemoryProviderExtensions(config)) for (const providerId of extension.manifest.contracts?.memoryProviders ?? []) plugins.push({
@@ -19,7 +19,7 @@ export declare class ModelManager {
19
19
  private currentProvider;
20
20
  private sessionModels;
21
21
  private fixedSessionModels;
22
- /** Baseline model from `agents.list` / defaults merge when the session agent is created. */
22
+ /** Baseline model from the Agent catalog/defaults merge when the session Agent is created. */
23
23
  private sessionProfileDefaults;
24
24
  private sessionProfileFallbacks;
25
25
  constructor(config?: ModelManagerConfig);
@@ -16,7 +16,7 @@ var ModelManager = class {
16
16
  currentProvider;
17
17
  sessionModels = /* @__PURE__ */ new Map();
18
18
  fixedSessionModels = /* @__PURE__ */ new Set();
19
- /** Baseline model from `agents.list` / defaults merge when the session agent is created. */
19
+ /** Baseline model from the Agent catalog/defaults merge when the session Agent is created. */
20
20
  sessionProfileDefaults = /* @__PURE__ */ new Map();
21
21
  sessionProfileFallbacks = /* @__PURE__ */ new Map();
22
22
  constructor(config = {}) {
@@ -30,7 +30,7 @@ var ModelManager = class {
30
30
  */
31
31
  updateFromConfig(config) {
32
32
  this.config = config;
33
- const ref = getAgentDefaultModelRef(config);
33
+ const ref = getAgentDefaultModelRef();
34
34
  this.defaultModel = ref ? ref : getDefaultModelSync(config);
35
35
  this.sessionProfileDefaults.clear();
36
36
  this.sessionProfileFallbacks.clear();
@@ -20,7 +20,7 @@ function isAgentTurnUnsettledError(err) {
20
20
  }
21
21
  function resolveAgentTurnTimeoutMs(config, conversationId) {
22
22
  if (!config) return DEFAULT_AGENT_TURN_TIMEOUT_MS;
23
- const configured = resolveEffectiveAgentConfigForSession(config, conversationId).config.runtime.timeoutMs;
23
+ const configured = resolveEffectiveAgentConfigForSession(conversationId).config.runtime.timeoutMs;
24
24
  if (!configured) return DEFAULT_AGENT_TURN_TIMEOUT_MS;
25
25
  return Math.min(MAX_AGENT_TURN_TIMEOUT_MS, Math.max(MIN_AGENT_TURN_TIMEOUT_MS, configured));
26
26
  }
@@ -1,9 +1,10 @@
1
1
  import { isXopcDatabaseOpen } from "../../storage/sqlite/connection.js";
2
2
  import { getSessionConfig } from "../../storage/sqlite/config-repository.js";
3
- import "../../storage/sqlite/index.js";
3
+ import { init_sqlite } from "../../storage/sqlite/index.js";
4
4
  import { init_response_language, resolveResponseLanguage } from "../../i18n/response-language.js";
5
5
  //#region src/agent/prompt/response-language.ts
6
6
  init_response_language();
7
+ init_sqlite();
7
8
  function resolveResponseLanguageForSession(config, conversationId) {
8
9
  return resolveResponseLanguage(config?.userContext?.preferences?.responseLanguage ?? "auto", conversationId && isXopcDatabaseOpen() ? getSessionConfig(conversationId)?.responseLanguage : void 0);
9
10
  }
@@ -1,11 +1,11 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
3
  import { isXopcDatabaseOpen } from "../../storage/sqlite/connection.js";
4
- import { buildInteractionStatePrompt } from "../../user-context/interaction-state.js";
4
+ import { buildInteractionStatePrompt, init_interaction_state } from "../../user-context/interaction-state.js";
5
5
  import { getInteractionState } from "../../storage/sqlite/interaction-state-repository.js";
6
- import { DEFAULT_USER_TRUST_LEVEL } from "../../user-context/trust-policy.js";
6
+ import { DEFAULT_USER_TRUST_LEVEL, init_trust_policy } from "../../user-context/trust-policy.js";
7
7
  import { getUserTrustPolicy } from "../../storage/sqlite/user-trust-repository.js";
8
- import "../../storage/sqlite/index.js";
8
+ import { init_sqlite } from "../../storage/sqlite/index.js";
9
9
  import { appendStablePromptSection } from "./cache-boundary.js";
10
10
  import { getUserTimezone } from "../../user-model/repository.js";
11
11
  import "../../user-model/index.js";
@@ -15,6 +15,9 @@ import { resolveResponseLanguageForSession } from "./response-language.js";
15
15
  import { buildTtsSystemPromptHint } from "../../voice/tts/directives.js";
16
16
  import { mergeTtsConfigFromAppConfig } from "../../voice/tts/merge-config.js";
17
17
  //#region src/agent/prompt/service-prompt-builder.ts
18
+ init_sqlite();
19
+ init_interaction_state();
20
+ init_trust_policy();
18
21
  init_logger();
19
22
  const log = createLogger("SystemPromptBuilder");
20
23
  var SystemPromptBuilder = class {
@@ -1,4 +1,4 @@
1
- import { buildActionTrustPrompt } from "../../user-context/trust-policy.js";
1
+ import { buildActionTrustPrompt, init_trust_policy } from "../../user-context/trust-policy.js";
2
2
  import { PROMPT_CACHE_BOUNDARY, splitPromptCacheBoundary } from "./cache-boundary.js";
3
3
  import { buildAestheticSection, buildExecutionBiasSection, buildHumanCollaborationSection, buildProblemSolvingSection, buildSafetySection, buildToolCallStyleSection, buildWorkContinuitySection } from "./sections/behavior.js";
4
4
  import { buildExternalMemorySection, buildMemorySection, buildSkillsSection } from "./sections/memory-skills.js";
@@ -9,6 +9,7 @@ import { buildRuntimeSection, buildWorkspaceFilesIntroSection, buildWorkspaceSec
9
9
  import { buildResponseLanguageSection } from "./sections/response-language.js";
10
10
  import { buildOverridablePromptSection } from "./system-prompt-params.js";
11
11
  //#region src/agent/prompt/system-prompt.ts
12
+ init_trust_policy();
12
13
  function joinSections(sections) {
13
14
  return sections.filter((section) => Boolean(section?.trim())).join("\n\n");
14
15
  }
@@ -73,12 +73,12 @@ function readPostCompactionContext(params) {
73
73
  if (!cfg) return null;
74
74
  let agentId = params.agentId;
75
75
  if (!agentId && params.conversationId) try {
76
- agentId = resolveEffectiveAgentProfileForSession(cfg, params.conversationId).agentId;
76
+ agentId = resolveEffectiveAgentProfileForSession(params.conversationId).agentId;
77
77
  } catch {
78
78
  return null;
79
79
  }
80
80
  if (!agentId) return null;
81
- const resolved = resolve(join(resolveAgentProfileDir(cfg, agentId), "AGENTS.md"));
81
+ const resolved = resolve(join(resolveAgentProfileDir(agentId), "AGENTS.md"));
82
82
  try {
83
83
  return readPostCompactionContextFromAgentsMd(readFileSync(resolved, "utf-8"), {
84
84
  cfg,
@@ -6,7 +6,7 @@ init_schema();
6
6
  init_providers();
7
7
  async function buildDirectUserMessageContent(opts) {
8
8
  const sk = opts.conversationId ?? "";
9
- const modelRef = sk !== "" ? opts.modelManager.getModelForSession(sk) : getAgentDefaultModelRef(opts.config) ?? getDefaultModelSync(opts.config);
9
+ const modelRef = sk !== "" ? opts.modelManager.getModelForSession(sk) : getAgentDefaultModelRef() ?? getDefaultModelSync(opts.config);
10
10
  return buildTranscriptUserMessage({
11
11
  text: opts.content,
12
12
  prepared: opts.attachments,
@@ -1,4 +1,4 @@
1
- import { getClarificationResumeInput } from "../../storage/sqlite/clarification-wait-repository.js";
1
+ import { getClarificationResumeInput, init_clarification_wait_repository } from "../../storage/sqlite/clarification-wait-repository.js";
2
2
  import { getConnectionResumeInput, init_connection_wait_repository } from "../../storage/sqlite/connection-wait-repository.js";
3
3
  import { resolveImageHandlingStrategy } from "../image/vision-detection.js";
4
4
  import { hydrateUserTurnForLlm } from "../inbound/attachment-pipeline.js";
@@ -21,6 +21,7 @@ import crypto from "node:crypto";
21
21
  * TTS, transcript persistence).
22
22
  */
23
23
  init_connection_wait_repository();
24
+ init_clarification_wait_repository();
24
25
  /** Workspace + model + thinking level — common prep before any direct turn. */
25
26
  async function hydratePerTurnState(deps, conversationId, thinking) {
26
27
  await deps.hydrateSessionWorkspaceFromStore(conversationId);
@@ -1,7 +1,8 @@
1
1
  import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
2
- import "../../storage/sqlite/index.js";
2
+ import { init_sqlite } from "../../storage/sqlite/index.js";
3
3
  import { INTERNAL_OUTBOUND_DROP_CHANNEL } from "../../channels/internal-outbound.js";
4
4
  //#region src/agent/service/parse-outbound-session-key.ts
5
+ init_sqlite();
5
6
  /**
6
7
  * Map a session key to outbound channel routing (heartbeat/cron/virtual keys included).
7
8
  */
@@ -1,6 +1,6 @@
1
1
  import { parseUserTurnDocument, renderUserTurnDocument } from "../../../packages/gateway-contract/src/user-turn-document.js";
2
2
  import { init_src } from "../../../packages/gateway-contract/src/index.js";
3
- import { getClarificationResumeInput } from "../../storage/sqlite/clarification-wait-repository.js";
3
+ import { getClarificationResumeInput, init_clarification_wait_repository } from "../../storage/sqlite/clarification-wait-repository.js";
4
4
  import { getConnectionResumeInput, init_connection_wait_repository } from "../../storage/sqlite/connection-wait-repository.js";
5
5
  import { init_agent_scope, resolveDefaultAgentId } from "../agent-scope.js";
6
6
  import { init_agent_session_key, resolveAgentMainConversationId } from "../../routing/agent-session-key.js";
@@ -25,6 +25,7 @@ init_agent_session_key();
25
25
  init_agent_scope();
26
26
  init_src();
27
27
  init_connection_wait_repository();
28
+ init_clarification_wait_repository();
28
29
  const MAX_BUFFERED_STREAM_EVENTS = 512;
29
30
  const LOSSY_STREAM_EVENT_TYPES = new Set([
30
31
  "message_update",
@@ -133,7 +134,7 @@ function pushAssistantReceipt(queue, text, runId, metadata) {
133
134
  });
134
135
  }
135
136
  async function* runProcessDirectStreaming(deps, input) {
136
- const conversationId = input.conversationId ?? resolveAgentMainConversationId({ agentId: resolveDefaultAgentId(deps.getConfig()) });
137
+ const conversationId = input.conversationId ?? resolveAgentMainConversationId({ agentId: resolveDefaultAgentId() });
137
138
  const isConnectionResume = Boolean(input.runId && getConnectionResumeInput(conversationId, input.runId));
138
139
  const isClarificationResume = Boolean(input.runId && getClarificationResumeInput(conversationId, input.runId));
139
140
  const isInternalResume = isConnectionResume || isClarificationResume;
@@ -1,5 +1,5 @@
1
1
  import { appendMediaToAssistantTranscriptEntry, findLatestAssistantTranscriptEntryId } from "../../storage/sqlite/transcript-repository.js";
2
- import "../../storage/sqlite/index.js";
2
+ import { init_sqlite } from "../../storage/sqlite/index.js";
3
3
  import { isTTSAvailable } from "../../voice/tts/factory.js";
4
4
  import { speak } from "../../voice/tts/speak-core.js";
5
5
  import { mergeTtsConfigFromAppConfig } from "../../voice/tts/merge-config.js";
@@ -9,6 +9,7 @@ import { persistOutboundTtsAudio } from "../../channels/attachments/outbound-tts
9
9
  import "../../voice/tts/index.js";
10
10
  import { deleteMediaUris } from "../../media/session-references.js";
11
11
  //#region src/agent/service/webchat-tts.ts
12
+ init_sqlite();
12
13
  /** True when the explicit TTS tool already produced durable Webchat audio. */
13
14
  function isSuccessfulWebchatTtsToolEvent(event) {
14
15
  if (!event || typeof event !== "object" || Array.isArray(event)) return false;
@@ -100,7 +100,7 @@ export declare class AgentService {
100
100
  /**
101
101
  * Apply config after save or hot reload so the default model updates without restarting the gateway.
102
102
  */
103
- applyAgentDefaultsFromConfig(config: Config): void;
103
+ applyRuntimeConfiguration(config: Config): void;
104
104
  getSkillCatalog(): SkillCatalogEntry[];
105
105
  getSkillCatalogSnapshot(): SkillCatalogSnapshot;
106
106
  getAgentSkillAvailability(agentId: string): AgentSkillAvailabilityPayload;
@@ -1,13 +1,13 @@
1
1
  import { createLogger } from "../utils/logger/index.js";
2
2
  import { init_logger } from "../utils/logger.js";
3
- import { parseNoteAttachmentTarget } from "../notes/attachment-ref.js";
3
+ import { init_attachment_ref, parseNoteAttachmentTarget } from "../notes/attachment-ref.js";
4
+ import { init_agent_scope, resolveAgentHomeDir, resolveDefaultAgentId } from "./agent-scope.js";
5
+ import { extractTextContent } from "./context/workspace.js";
4
6
  import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
5
7
  import { applyConfigOverrides } from "../config/runtime-overrides.js";
6
- import { init_agent_scope, resolveAgentHomeDir, resolveDefaultAgentId } from "./agent-scope.js";
7
8
  import { init_agent_session_key, resolveAgentIdFromConversationId } from "../routing/agent-session-key.js";
8
9
  import { extractProfileAgentId } from "../config/agent-profile.js";
9
10
  import { init_providers, resolveModel } from "../providers/index.js";
10
- import { extractTextContent } from "./context/workspace.js";
11
11
  import { effectiveWorkspacePathForSession } from "../session/session-workspace.js";
12
12
  import { getProjectForSession } from "../projects/workspace.js";
13
13
  import { runWithEmbeddedExecutionSession } from "./embedded/execution-context.js";
@@ -74,6 +74,7 @@ import { readFile } from "node:fs/promises";
74
74
  init_agent_session_key();
75
75
  init_schema();
76
76
  init_logger();
77
+ init_attachment_ref();
77
78
  init_agent_scope();
78
79
  init_providers();
79
80
  const log = createLogger("AgentService");
@@ -190,9 +191,8 @@ var AgentService = class {
190
191
  const sk = update.conversationId?.trim();
191
192
  if (sk) this.onSessionTranscriptUpdated?.(sk);
192
193
  });
193
- const appCfgForPaths = this.config.config;
194
- if (!appCfgForPaths) throw new Error("AgentService requires config.config for session paths");
195
- const defaultAgentHome = resolveAgentHomeDir(appCfgForPaths, resolveDefaultAgentId(appCfgForPaths));
194
+ if (!this.config.config) throw new Error("AgentService requires config.config for session paths");
195
+ const defaultAgentHome = resolveAgentHomeDir(resolveDefaultAgentId());
196
196
  this.sessionConfigStore = new SessionConfigStore(defaultAgentHome);
197
197
  this.hookRunner = this.createHookRunner();
198
198
  this.hookHandler = new HookHandler({
@@ -243,6 +243,7 @@ var AgentService = class {
243
243
  getChatPreviewService: config.getChatPreviewService,
244
244
  dispatchTaskEvents: config.dispatchTaskEvents,
245
245
  dispatchTaskRuns: config.dispatchTaskRuns,
246
+ onAgentCatalogMutate: config.onAgentCatalogMutate,
246
247
  getWorkflowRunService: config.getWorkflowRunService,
247
248
  onSkillsUpdated: config.onSkillsUpdated,
248
249
  installSkillFromSource: (opts) => this.installSkillFromSource(opts),
@@ -287,7 +288,7 @@ var AgentService = class {
287
288
  getThinkingDefault: () => void 0,
288
289
  workspaceRoot: this.workspaceDir,
289
290
  getWorkspaceRootForSession: (conversationId) => this.agentManager.getResolvedWorkspaceForSession(conversationId),
290
- getAgentInternalStorageRootForSession: (conversationId) => resolveAgentHomeDir(this.config.config, extractProfileAgentId(conversationId, this.config.config)),
291
+ getAgentInternalStorageRootForSession: (conversationId) => resolveAgentHomeDir(extractProfileAgentId(conversationId)),
291
292
  enqueueAutoTitle: (conversationId) => this.enqueueMaybeAutoTitleAfterPersist(conversationId),
292
293
  onEmbeddedStreamEvent: (conversationId, event) => {
293
294
  const ctx = this.sessionContextManager.getContext();
@@ -478,13 +479,13 @@ var AgentService = class {
478
479
  /**
479
480
  * Apply config after save or hot reload so the default model updates without restarting the gateway.
480
481
  */
481
- applyAgentDefaultsFromConfig(config) {
482
+ applyRuntimeConfiguration(config) {
482
483
  this.config.config = config;
483
484
  this.sessionStore.updateConfig(config);
484
- const ref = getAgentDefaultModelRef(config);
485
+ const ref = getAgentDefaultModelRef();
485
486
  this.config.model = ref;
486
487
  this.modelManager.updateFromConfig(config);
487
- this.agentManager.updateAgentDefaults(config);
488
+ this.agentManager.updateRuntimeConfiguration(config);
488
489
  this.commandHandler.updateAgentConfig(config);
489
490
  }
490
491
  getSkillCatalog() {
@@ -709,7 +710,7 @@ var AgentService = class {
709
710
  enqueueMaybeAutoTitleAfterPersist(conversationId) {
710
711
  (async () => {
711
712
  try {
712
- let modelRef = getAgentDefaultModelRef(this.config.config ?? {}) ?? this.config.model;
713
+ let modelRef = getAgentDefaultModelRef() ?? this.config.model;
713
714
  if (!modelRef?.trim()) try {
714
715
  modelRef = this.modelManager.getModelForSession(conversationId);
715
716
  } catch {
@@ -41,6 +41,8 @@ export interface AgentServiceConfig {
41
41
  getChatPreviewService?: () => ChatPreviewService | undefined;
42
42
  dispatchTaskEvents?: () => void;
43
43
  dispatchTaskRuns?: () => void;
44
+ /** Gateway: refresh runtime state and notify clients after a conversational Agent mutation. */
45
+ onAgentCatalogMutate?: () => void;
44
46
  /**
45
47
  * Gateway: reuse the gateway `SessionManager` store so web API and agent share one index + files.
46
48
  * When omitted, `AgentService` creates its own `SessionStore` (CLI / embedded).
@@ -24,9 +24,8 @@ var SessionInspector = class {
24
24
  }
25
25
  async ensureEffectiveSessionModel(conversationId) {
26
26
  await this.opts.sessionHydrator.model(conversationId);
27
- const cfg = this.opts.getConfig();
28
- if (!cfg) return;
29
- const profile = resolveEffectiveAgentProfileForSession(cfg, conversationId);
27
+ if (!this.opts.getConfig()) return;
28
+ const profile = resolveEffectiveAgentProfileForSession(conversationId);
30
29
  const profileModelRef = profile.primaryModelRef?.trim();
31
30
  if (profileModelRef) this.opts.modelManager.setSessionProfileDefault(conversationId, profileModelRef, profile.fallbacks);
32
31
  }
@@ -58,7 +57,7 @@ var SessionInspector = class {
58
57
  /** One-shot LLM answer for `/btw`: transcript as background, not persisted. */
59
58
  btwQuery(conversationId, question, options) {
60
59
  const config = this.opts.getConfig();
61
- const profile = config ? resolveEffectiveAgentProfileForSession(config, conversationId) : void 0;
60
+ const profile = config ? resolveEffectiveAgentProfileForSession(conversationId) : void 0;
62
61
  return runBtwQuery({
63
62
  conversationId,
64
63
  question,
@@ -104,7 +103,7 @@ var SessionInspector = class {
104
103
  const model = this.opts.modelManager.getModelForSession(conversationId);
105
104
  const workspace = effectiveWorkspacePathForSession(cfg, conversationId, await this.opts.sessionConfigStore.get(conversationId), getProjectForSession(conversationId));
106
105
  const estTokens = await this.opts.sessionStore.estimateTokenUsage(conversationId, messages);
107
- const profile = resolveEffectiveAgentProfileForSession(cfg, conversationId);
106
+ const profile = resolveEffectiveAgentProfileForSession(conversationId);
108
107
  const deniedTools = [...profile.tools.denied].sort((a, b) => a.localeCompare(b));
109
108
  const toolsSummary = deniedTools.length > 0 ? `denied: ${deniedTools.join(", ")}` : "(no denied tools)";
110
109
  return formatSessionContextReport({
@@ -12,6 +12,10 @@ import type { SkillMarkdownPreviewPayload } from '../../../types.js';
12
12
  * via `api.registerMarketplaceAdapter()`. Built-in values: 'store', 'skillhub', 'clawhub'.
13
13
  */
14
14
  export type SkillsMarketplaceProvider = string;
15
+ export type MarketplaceSkillLocalizations = Partial<Record<'en' | 'zh-CN', {
16
+ displayName: string;
17
+ description: string;
18
+ }>>;
15
19
  export interface SkillsStoreListParams {
16
20
  q?: string;
17
21
  page?: number;
@@ -31,6 +35,7 @@ export interface SkillsStorePackageListItem {
31
35
  name: string;
32
36
  type: string;
33
37
  description: string;
38
+ localizations?: MarketplaceSkillLocalizations;
34
39
  downloads: number;
35
40
  author: {
36
41
  username: string;
@@ -1,4 +1,4 @@
1
- import type { Config } from '../config/schema.js';
1
+ import type { AgentEntry } from '../agent-config/index.js';
2
2
  export declare const STARTER_AGENTS_INITIALIZED_VERSION = 1;
3
3
  type StarterAgent = {
4
4
  id: string;
@@ -6,13 +6,12 @@ type StarterAgent = {
6
6
  description: string;
7
7
  role: string;
8
8
  emoji: string;
9
- tools?: NonNullable<Config['agents']['list']>[number]['tools'];
9
+ tools?: AgentEntry['tools'];
10
10
  profileFiles: Record<string, string>;
11
11
  };
12
12
  export declare const STARTER_AGENTS: readonly StarterAgent[];
13
- export declare function materializeStarterAgentFiles(cfg: Config): void;
14
- export declare function ensureStarterAgentsInitialized(cfg: Config): {
15
- config: Config;
13
+ export declare function materializeStarterAgentFiles(): void;
14
+ export declare function ensureStarterAgentsInitialized(): {
16
15
  changed: boolean;
17
16
  };
18
17
  export {};
@@ -1,9 +1,10 @@
1
- import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentProfileDir, resolveAgentWorkspaceDir } from "./agent-scope.js";
1
+ import { AgentCatalogRepository, init_repository } from "../agent-catalog/repository.js";
2
+ import { init_agent_scope, resolveAgentProfileDir, resolveAgentWorkspaceDir } from "./agent-scope.js";
2
3
  import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
3
- import { applyAgentConfig } from "../commands/agents.config.js";
4
4
  import { join } from "node:path";
5
5
  import { existsSync, mkdirSync, writeFileSync } from "node:fs";
6
6
  //#region src/agent/starter-agents.ts
7
+ init_repository();
7
8
  init_paths();
8
9
  init_agent_scope();
9
10
  const STARTER_AGENTS_INITIALIZED_VERSION = 1;
@@ -136,36 +137,36 @@ function renderStarterProfileFile(starter, name, content) {
136
137
  if (!legacyName || legacyName === starter.displayName) return content;
137
138
  return content.replace(`# SOUL.md - ${legacyName}`, `# SOUL.md - ${starter.displayName}`).replace(`You are ${legacyName},`, `You are ${starter.displayName},`).replace(`# TOOLS.md - ${legacyName} Tool Policy`, `# TOOLS.md - ${starter.displayName} Tool Policy`);
138
139
  }
139
- function hasAgentEntry(cfg, agentId) {
140
- const id = normalizeAgentId(agentId);
141
- return listAgentEntries(cfg).some((entry) => normalizeAgentId(entry.id) === id);
142
- }
143
140
  function writeFileIfMissing(path, content) {
144
141
  if (!existsSync(path)) writeFileSync(path, content, "utf-8");
145
142
  }
146
- function materializeStarterAgentFiles(cfg) {
143
+ function materializeStarterAgentFiles() {
147
144
  for (const starter of STARTER_AGENTS) {
148
- const profileDir = resolveAgentProfileDir(cfg, starter.id);
149
- const workspaceDir = resolveAgentWorkspaceDir(cfg, starter.id);
145
+ const profileDir = resolveAgentProfileDir(starter.id);
146
+ const workspaceDir = resolveAgentWorkspaceDir(starter.id);
150
147
  mkdirSync(profileDir, { recursive: true });
151
148
  mkdirSync(workspaceDir, { recursive: true });
152
149
  for (const [name, content] of Object.entries(starter.profileFiles)) writeFileIfMissing(join(profileDir, name), renderStarterProfileFile(starter, name, content));
153
150
  }
154
151
  }
155
- function ensureStarterAgentsInitialized(cfg) {
156
- let next = cfg;
152
+ function ensureStarterAgentsInitialized() {
153
+ const repository = new AgentCatalogRepository();
154
+ let changed = false;
155
+ materializeStarterAgentFiles();
157
156
  for (const starter of STARTER_AGENTS) {
158
- if (hasAgentEntry(next, starter.id)) continue;
159
- next = applyAgentConfig(next, {
160
- agentId: starter.id,
157
+ const existing = repository.get(starter.id);
158
+ if (existing) {
159
+ if (existing.provisioningState !== "ready") repository.markProvisioned(starter.id);
160
+ continue;
161
+ }
162
+ repository.create({
163
+ id: starter.id,
164
+ enabled: true,
161
165
  ...starter.tools ? { tools: starter.tools } : {}
162
- });
166
+ }, { ready: true });
167
+ changed = true;
163
168
  }
164
- materializeStarterAgentFiles(next);
165
- return {
166
- config: next,
167
- changed: next !== cfg
168
- };
169
+ return { changed };
169
170
  }
170
171
  //#endregion
171
172
  export { STARTER_AGENTS, STARTER_AGENTS_INITIALIZED_VERSION, ensureStarterAgentsInitialized, materializeStarterAgentFiles };
@@ -71,10 +71,10 @@ function codingCompletionEvidence(rows) {
71
71
  }
72
72
  function resolveJudgeModel(config, conversationId, runtimeModel) {
73
73
  if (config) {
74
- const profile = resolveEffectiveAgentProfileForSession(config, conversationId);
74
+ const profile = resolveEffectiveAgentProfileForSession(conversationId);
75
75
  if (profile.primaryModelRef?.trim()) return profile.primaryModelRef.trim();
76
76
  }
77
- return runtimeModel?.trim() || (config ? getAgentDefaultModelRef(config) : void 0);
77
+ return runtimeModel?.trim() || (config ? getAgentDefaultModelRef() : void 0);
78
78
  }
79
79
  var TaskJudgeService = class {
80
80
  #tasks = new TaskRepository();
@@ -1 +1 @@
1
- export declare const xopcUseManual = "# XOPC Use Tool Manual\n\n## Purpose\n\n`xopc_use` operates first-class XOPC product objects without editing SQLite or product files directly.\nLoad this manual before a non-trivial mutation.\n\n```json\n{\n \"mode\": \"scene | project | automation | note | task | task_run | chat_preview | local_app | settings\",\n \"command\": \"...\",\n \"args\": {},\n \"dryRun\": false\n}\n```\n\nSend one object command per call. Inspect the returned JSON `ok` field; a tool call can\ncomplete successfully while the product command returns `ok: false`.\n\n## Scene delegation\n\nUse mode `scene` only after the user explicitly delegates recurring or future work. Inspect\n`list` before `start`; configure an existing matching scene instead of creating a duplicate.\nConfirm the goal, source scope, timing, promised result, and read-only action boundary in ordinary\nlanguage. A scene prepares suggestions or drafts and never sends mail or performs external writes.\n\n## Object routing\n\n| Object | Tool |\n| --- | --- |\n| Scene and scene result | `xopc_use` mode `scene` |\n| Project, milestone, project update | `xopc_use` mode `project` |\n| Automation | `xopc_use` mode `automation` |\n| Task intent and lifecycle | `xopc_use` mode `task` |\n| Task execution attempt, receipt, events and waits | `xopc_use` mode `task_run` |\n| Note | `xopc_use` mode `note` |\n| Lightweight UI preview | `xopc_use` mode `chat_preview` |\n| Local app | `xopc_use` mode `local_app` |\n| Settings jump target | `xopc_use` mode `settings` |\n| Workflow run | dedicated `workflow` tool; pass `taskId` to link it to a Task |\n| Session, memory, skill, connected app or workspace file | its dedicated tool |\n\nDo not emulate Workflow APIs through `xopc_use`. A Task is durable intent;\na TaskRun is one execution attempt; a WorkflowRun is a procedure execution and may belong\nto a TaskRun. Never treat these three objects as interchangeable.\n\n## Reliable protocol\n\n1. Use `list` then `get` when an id is unknown.\n2. Read the current `version` before a Task mutation.\n3. Use `dryRun: true` for broad Project changes or uncertain mutations.\n4. Mutate once with the exact id and current concurrency token.\n5. Verify the returned object and preserve any \u201COpen in xopc\u201D delivery link.\n6. On a conflict, read again and reconsider the operation; do not blindly retry.\n\nTimestamps are Unix epoch milliseconds. Array fields are arrays of strings. Omission\npreserves a patchable field; an empty array intentionally clears it. Prefer explicit\n`projectId`, `taskId`, `runId`, `noteId`, and `localAppId` fields over `id`.\n\n## Scenes\n\nCommands: `templates`, `list`, `get`, `mail_accounts`, `mail_search`,\n`mail_sources`, `read_notes`, `preflight`, `start`, `configure`, `transition`,\n`check`, `notes`, `work_item`, `update_work_item`, `schedule`, `results`,\n`feedback`, `mark_read`, `diagnostics`, `get_preferences`, and `set_preferences`.\n\nThe built-in templates are `weekly-family-plan` and `mail-follow-up`, currently version\n`1.0.0`. Discover templates instead of guessing keys or versions. Timestamps are Unix epoch\nmilliseconds. Use `preflight` or `dryRun: true` before `start` when account or model readiness\nis uncertain.\n\n### Safe start protocol\n\n1. Call `list` and reuse a matching activation when one exists.\n2. Call `templates`; for mail, call `mail_accounts` and `mail_search` with the exact account.\n3. Explain the selected source and timing to the user before creating the scene.\n4. Call `preflight` with the complete start input.\n5. Call `start` with the same input and a stable `requestId` for retry safety.\n6. Add notes, a work item, or a schedule as required; then call `get` to verify the state.\n\nFamily plans use scope `{ \"kind\": \"personal\" }` and permissions with only\n`user_notes`. Mail follow-up uses one selected mail source in an objects scope and exactly one\nauthorized account. Never broaden either scope to make preflight pass.\n\n### Mutations and results\n\nRead the current activation `revision` before `configure` or `transition`. Read the current\nnotes, schedule, work-item, or feedback revision before changing that object. On a conflict,\nread again and reconsider; do not retry with a guessed revision.\n\n`check` queues work and does not mean a result already exists. Use a stable `requestId` and\ninspect `results` later. `no_change` intentionally creates no user-facing draft. A returned\ndraft is not a sent message. Use `diagnostics` for source, model, queue, or notification failures.\n\nScene preferences control checks and reminders globally for the current principal. Read them\nwith `get_preferences` before `set_preferences`; preserve fields the user did not ask to change.\n\n## Projects\n\nCommands: `list`, `get`, `create`, `update`, `resolve_workspace`,\n`list_milestones`, `create_milestone`, `update_milestone`, `list_updates`,\nand `create_update`.\n\nProject statuses: `planned`, `active`, `paused`, `completed`, `cancelled`,\n`archived`. Health values: `unknown`, `on_track`, `at_risk`, `off_track`.\n\nA Project defines bounded shared context for related work. Its durable planning fields are `outcome`,\n`successCriteria`, `scope`, `nonGoals`, `ownerId`, `targetAt`, and `health`.\nUse `brief` for a concise description and `instructions` for durable operating guidance.\n\n### Create\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"create\",\n \"args\": {\n \"name\": \"AI Product Research\",\n \"outcome\": \"Choose a validated product direction\",\n \"successCriteria\": [\"Ten customer interviews\", \"Decision recorded\"],\n \"scope\": { \"market\": \"developer tools\" },\n \"nonGoals\": [\"Build the production product\"],\n \"health\": \"on_track\",\n \"targetAt\": 1760000000000,\n \"workspaceRoot\": \"/path/to/repo\"\n }\n}\n```\n\n### Update\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"update\",\n \"args\": {\n \"projectId\": \"project_id\",\n \"status\": \"active\",\n \"health\": \"at_risk\",\n \"successCriteria\": [\"Ten interviews\", \"Evidence-backed decision\"]\n }\n}\n```\n\n### Resolve a workspace\n\nUse `autoCreate: false` for lookup. Set it to true only when creating a Project is authorized.\n\n```json\n{ \"mode\": \"project\", \"command\": \"resolve_workspace\", \"args\": { \"workspacePath\": \"/path/to/repo\", \"autoCreate\": false } }\n```\n\n### Milestones\n\nMilestone statuses: `planned`, `active`, `completed`, `cancelled`.\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"create_milestone\",\n \"args\": {\n \"projectId\": \"project_id\",\n \"title\": \"Finish discovery\",\n \"status\": \"active\",\n \"targetAt\": 1760000000000,\n \"sortOrder\": 10\n }\n}\n```\n\nUse `list_milestones` with `projectId`. Use `update_milestone` with both\n`projectId` and `milestoneId`. Milestone deletion is intentionally not exposed.\n\n### Immutable project updates\n\nProject updates are append-only progress snapshots. They also update Project health.\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"create_update\",\n \"args\": {\n \"projectId\": \"project_id\",\n \"health\": \"on_track\",\n \"summary\": \"Discovery is complete\",\n \"progress\": [\"Interviewed ten users\"],\n \"risks\": [\"Pricing remains unvalidated\"],\n \"nextSteps\": [\"Run pricing tests\"]\n }\n}\n```\n\nUse `list_updates` with `projectId` and optional `limit`. Updates cannot be edited.\n\n## Automations\n\nCommands: `list`, `get`, `create`, `update`, `delete`, `run`, `pause`,\n`resume`, and `history`.\n\nAutomation `create` automatically uses the current session Project when `projectId` is\nomitted. An explicit `projectId` takes precedence and is validated before mutation. Use an\nexplicit id when creating for a Project other than the current session Project.\n\n### Create in the current Project\n\n`trigger` and `action` use the same shapes as the Automation product API.\n\n```json\n{\n \"mode\": \"automation\",\n \"command\": \"create\",\n \"args\": {\n \"name\": \"Daily project review\",\n \"trigger\": { \"kind\": \"schedule\", \"schedule\": { \"kind\": \"cron\", \"expr\": \"0 9 * * 1-5\", \"tz\": \"Asia/Shanghai\" } },\n \"action\": { \"kind\": \"agent\", \"instruction\": \"Review the current project and summarize risks.\" }\n }\n}\n```\n\nTo override the inherited Project, add `\"projectId\": \"project_id\"` to `args`.\nThe create payload may also be nested under `args.automation`; top-level `args.projectId`\nhas precedence.\n\n### List and history\n\n`list` and unqualified `history` inherit the current session Project. Pass an explicit\n`projectId` to query another Project. Pass `automationId` to `history` for one Automation.\n\n### Update and operate\n\nUse `automationId` for `get`, `update`, `delete`, `run`, `pause`, and `resume`.\nFor `update`, patch fields may be direct args or nested under `args.patch`. Supplying a new\n`projectId` reassigns the Automation after validating the target Project.\n\n## Tasks\n\nCommands: `list`, `get`, `create`, `update_dependencies`, `add_context`,\n`remove_context`, `command`, and `delete`.\n\nTask phases are `backlog`, `ready`, `active`, `review`, and `closed`.\nOperational state is projected separately as `idle`, `queued`, `running`, `waiting`,\n`verifying`, `succeeded`, `failed`, or `cancelled`. Never send either value as a\nfree-form status update.\n\n`task.get` returns the Task, its projected `model`, dependencies, dependents, context,\nauthority grants, TaskRuns, receipts, and waits.\nThe projected model is the correct source for current operational state and attention items.\n\n`delete` permanently removes the Task and its contracts, waits, context links, TaskRuns,\nreceipts, and Task-owned execution records. It does not delete linked Sessions, workspace files,\nor external artifacts. Cancel an active TaskRun before deletion, and use `dryRun: true` when\nthe user's intent is ambiguous.\n\n```json\n{ \"mode\": \"task\", \"command\": \"delete\", \"args\": { \"taskId\": \"task_id\" }, \"dryRun\": true }\n```\n\n### Capture or start\n\n`createMode` defaults to `capture`, which creates a backlog Task without executing it.\nUse `start` only when immediate execution is intended.\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"create\",\n \"args\": {\n \"objective\": \"Complete the customer research report\",\n \"projectId\": \"project_id\",\n \"createMode\": \"capture\",\n \"priority\": \"high\",\n \"expectedOutputs\": [\"Research report\"],\n \"acceptanceCriteria\": [\"Sources are cited\"],\n \"constraints\": [\"Do not contact customers without approval\"],\n \"dependsOnTaskIds\": []\n }\n}\n```\n\n### Dependencies\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"update_dependencies\",\n \"args\": {\n \"taskId\": \"task_id\",\n \"expectedVersion\": 3,\n \"dependsOnTaskIds\": [\"dependency_task_id\"]\n }\n}\n```\n\n### Context links\n\nUse `add_context` to link a document, file, URL, session, memory, Task, artifact, or source\nas `input`, `reference`, `constraint`, `deliverable`, or `evidence` context.\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"add_context\",\n \"args\": {\n \"taskId\": \"task_id\",\n \"targetKind\": \"file\",\n \"targetId\": \"/path/to/spec.md\",\n \"role\": \"input\",\n \"title\": \"Product specification\",\n \"pinned\": true,\n \"retrievalPolicy\": {},\n \"metadata\": {}\n }\n}\n```\n\nUse `remove_context` with `taskId` and the exact `edgeId` returned by `task.get`.\nDo not add authority grants through this tool; an Agent must not authorize itself.\n\n### Typed lifecycle commands\n\nEvery command requires `taskId`, the Task's current `expectedVersion`, a `type`, and\ntype-specific fields inside `commandArgs`.\n\nSupported command types:\n\n- `mark_ready`\n- `start`: `{ \"executor\": { \"kind\": \"agent\", \"agentId\": \"main\" } }`\n- `request_review`\n- `close`: `{ \"resolution\": \"done | cancelled | duplicate | wont_do\" }`\n- `reopen`: `{ \"phase\": \"ready | active\" }`\n- `add_wait`: `{ \"wait\": { \"kind\": \"dependency | approval | input | schedule | external | paused\", \"reason\": \"...\", \"condition\": {} } }`\n- `resolve_wait`: `{ \"waitId\": \"wait_id\", \"resolution\": {} }`\n- `delegate`: `{ \"agentId\": \"agent_id\" }`\n- `revise_contract`: `{ \"contract\": { ...complete contract... } }`\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"command\",\n \"args\": {\n \"taskId\": \"task_id\",\n \"expectedVersion\": 3,\n \"type\": \"start\",\n \"commandArgs\": {\n \"executor\": { \"kind\": \"agent\", \"agentId\": \"main\" }\n }\n }\n}\n```\n\nContract revision is replacement, not a patch. Read the Task and preserve all contract fields\nthe user did not ask to change. Resolve a wait through `resolve_wait`; do not directly mutate\na TaskRun or manufacture a phase transition.\n\n## TaskRuns\n\nTaskRun inspection is read-only except for explicit cancellation. Other execution state is\ncontrolled by Task commands and the runtime coordinator.\n\n### List attempts for a Task\n\n```json\n{ \"mode\": \"task_run\", \"command\": \"list\", \"args\": { \"taskId\": \"task_id\", \"limit\": 20 } }\n```\n\nThe result contains run attempts, finalized receipts, and active waits.\n\n### Inspect one attempt\n\n```json\n{ \"mode\": \"task_run\", \"command\": \"get\", \"args\": { \"runId\": \"run_id\" } }\n```\n\nThe result contains the TaskRun, its receipt when terminal, ordered events, and active Task waits.\n\n### Cancel an attempt\n\nRead the run first, then pass its current version. Cancellation creates a terminal receipt.\n\n```json\n{\n \"mode\": \"task_run\",\n \"command\": \"cancel\",\n \"args\": { \"runId\": \"run_id\", \"expectedVersion\": 2, \"reason\": \"User cancelled execution\" }\n}\n```\n\nDo not guess commands such as retry, force-complete, heartbeat, or transition; they are not Agent APIs.\n\n## Notes\n\nCommands: `list`, `get`, `create`, `append`, `preview_edit`, `update`, and `delete`.\nUse Notes for durable prose and reference material, not as a Task substitute. Prefer `append`\nwhen preserving user content. Use `preview_edit` before a canonical rewrite.\n\n```json\n{ \"mode\": \"note\", \"command\": \"create\", \"args\": { \"title\": \"Decision\", \"markdown\": \"...\", \"projectId\": \"project_id\" } }\n```\n\n```json\n{ \"mode\": \"note\", \"command\": \"append\", \"args\": { \"noteId\": \"note_id\", \"heading\": \"AI synthesis\", \"content\": \"...\" } }\n```\n\nUse `update` with `status: \"trashed\"` for a recoverable removal. `delete` permanently\nremoves the Note and its stored snapshots and media; use `dryRun: true` first when the\nuser's intent is ambiguous.\n\n```json\n{ \"mode\": \"note\", \"command\": \"delete\", \"args\": { \"noteId\": \"note_id\" }, \"dryRun\": true }\n```\n\n## Chat previews, local apps, and settings\n\nUse `chat_preview` by default when the user asks to design, mock up, or quickly show a UI in\nthe current conversation. It creates no Project and no Local App. Commands are `create`,\n`get`, and `revise`. Source consists of `markup`, `styles`, and optional `script`;\ndo not include a full HTML document or remote dependencies. Revision requires the exact\n`baseRevision` returned by the prior call.\n\nUse `local_app` only when the user explicitly asks for a durable, installable app or chooses\n\u201CSave as app\u201D on a chat preview. Do not create a Local App merely to render a UI draft.\n\nLocal app commands are `list`, `get`, `create`, and `validate`. Installation,\nactivation, rollback, and uninstall remain product runtime operations.\n\nSettings supports only `open` and returns an exact product jump target without changing config.\n\n## Error recovery\n\n| Result | Recovery |\n| --- | --- |\n| service unavailable | Stop retrying and report the unavailable capability. |\n| not found | Re-list in the intended scope; do not invent another id. |\n| conflict | Read the current object and reassess using its latest version. |\n| waiting | Inspect the Task projection and TaskRun waits; resolve only the real blocker. |\n| invalid command or state | Read the object and use only a documented transition. |\n| unsupported operation | Use the dedicated tool or product UI; never write storage directly. |\n\n## Deliberate boundaries\n\n- Project deletion and milestone deletion are not Agent APIs.\n- TaskRun mutation is internal to execution coordination except for optimistic cancellation.\n- Project updates are immutable.\n- Workflow and Automation operations remain in their dedicated tools.\n- Only the documented Task and TaskRun commands are valid; do not infer hidden aliases.\n";
1
+ export declare const xopcUseManual = "# XOPC Use Tool Manual\n\n## Purpose\n\n`xopc_use` operates first-class XOPC product objects without editing SQLite or product files directly.\nLoad this manual before a non-trivial mutation.\n\n```json\n{\n \"mode\": \"agent | scene | project | automation | note | task | task_run | chat_preview | local_app | settings\",\n \"command\": \"...\",\n \"args\": {},\n \"dryRun\": false\n}\n```\n\nSend one object command per call. Inspect the returned JSON `ok` field; a tool call can\ncomplete successfully while the product command returns `ok: false`.\n\n## Scene delegation\n\nUse mode `scene` only after the user explicitly delegates recurring or future work. Inspect\n`list` before `start`; configure an existing matching scene instead of creating a duplicate.\nConfirm the goal, source scope, timing, promised result, and read-only action boundary in ordinary\nlanguage. A scene prepares suggestions or drafts and never sends mail or performs external writes.\n\n## Object routing\n\n| Object | Tool |\n| --- | --- |\n| Agent definition and default Agent | `xopc_use` mode `agent` |\n| Scene and scene result | `xopc_use` mode `scene` |\n| Project, milestone, project update | `xopc_use` mode `project` |\n| Automation | `xopc_use` mode `automation` |\n| Task intent and lifecycle | `xopc_use` mode `task` |\n| Task execution attempt, receipt, events and waits | `xopc_use` mode `task_run` |\n| Note | `xopc_use` mode `note` |\n| Lightweight UI preview | `xopc_use` mode `chat_preview` |\n| Local app | `xopc_use` mode `local_app` |\n| Settings jump target | `xopc_use` mode `settings` |\n| Workflow run | dedicated `workflow` tool; pass `taskId` to link it to a Task |\n| Session, memory, skill, connected app or workspace file | its dedicated tool |\n\nDo not emulate Workflow APIs through `xopc_use`. A Task is durable intent;\na TaskRun is one execution attempt; a WorkflowRun is a procedure execution and may belong\nto a TaskRun. Never treat these three objects as interchangeable.\n\n## Agents\n\nCommands: `list`, `get`, `create`, `update`, `set_default`, `disable`,\n`delete`, and `purge`.\n\nAn Agent profile accepts only `name` and optional `instructions`. Put personality,\nlanguage, role, and behavioral guidance in `profile.instructions`; do not invent profile\nfields such as `description`, `language`, `emoji`, or `creature`.\n\n```json\n{\n \"mode\": \"agent\",\n \"command\": \"create\",\n \"args\": {\n \"id\": \"xiaomei\",\n \"profile\": {\n \"name\": \"\u5C0F\u7F8E\",\n \"instructions\": \"\u4F7F\u7528\u4E2D\u6587\u4EA4\u6D41\uFF0C\u8BED\u6C14\u6E29\u67D4\u3001\u4EB2\u5207\u3001\u53EF\u7231\uFF0C\u540C\u65F6\u4FDD\u6301\u56DE\u7B54\u6E05\u6670\u53EF\u9760\u3002\"\n },\n \"idempotencyKey\": \"create-agent-xiaomei\"\n }\n}\n```\n\nUse `list` before creating an Agent so an existing id is updated rather than duplicated.\nMutations other than `create` require the current `expectedRevision`; `set_default` uses\nthe catalog revision returned by `list`. `delete` preserves on-disk data, while `purge`\nalso removes it. Use `dryRun: true` to validate the exact same input contract without writing.\n\n## Reliable protocol\n\n1. Use `list` then `get` when an id is unknown.\n2. Read the current `version` before a Task mutation.\n3. Use `dryRun: true` for broad Project changes or uncertain mutations.\n4. Mutate once with the exact id and current concurrency token.\n5. Verify the returned object and preserve any \u201COpen in xopc\u201D delivery link.\n6. On a conflict, read again and reconsider the operation; do not blindly retry.\n\nTimestamps are Unix epoch milliseconds. Array fields are arrays of strings. Omission\npreserves a patchable field; an empty array intentionally clears it. Prefer explicit\n`projectId`, `taskId`, `runId`, `noteId`, and `localAppId` fields over `id`.\n\n## Scenes\n\nCommands: `templates`, `list`, `get`, `mail_accounts`, `mail_search`,\n`mail_sources`, `read_notes`, `preflight`, `start`, `configure`, `transition`,\n`check`, `notes`, `work_item`, `update_work_item`, `schedule`, `results`,\n`feedback`, `mark_read`, `diagnostics`, `get_preferences`, and `set_preferences`.\n\nThe built-in templates are `weekly-family-plan` and `mail-follow-up`, currently version\n`1.0.0`. Discover templates instead of guessing keys or versions. Timestamps are Unix epoch\nmilliseconds. Use `preflight` or `dryRun: true` before `start` when account or model readiness\nis uncertain.\n\n### Safe start protocol\n\n1. Call `list` and reuse a matching activation when one exists.\n2. Call `templates`; for mail, call `mail_accounts` and `mail_search` with the exact account.\n3. Explain the selected source and timing to the user before creating the scene.\n4. Call `preflight` with the complete start input.\n5. Call `start` with the same input and a stable `requestId` for retry safety.\n6. Add notes, a work item, or a schedule as required; then call `get` to verify the state.\n\nFamily plans use scope `{ \"kind\": \"personal\" }` and permissions with only\n`user_notes`. Mail follow-up uses one selected mail source in an objects scope and exactly one\nauthorized account. Never broaden either scope to make preflight pass.\n\n### Mutations and results\n\nRead the current activation `revision` before `configure` or `transition`. Read the current\nnotes, schedule, work-item, or feedback revision before changing that object. On a conflict,\nread again and reconsider; do not retry with a guessed revision.\n\n`check` queues work and does not mean a result already exists. Use a stable `requestId` and\ninspect `results` later. `no_change` intentionally creates no user-facing draft. A returned\ndraft is not a sent message. Use `diagnostics` for source, model, queue, or notification failures.\n\nScene preferences control checks and reminders globally for the current principal. Read them\nwith `get_preferences` before `set_preferences`; preserve fields the user did not ask to change.\n\n## Projects\n\nCommands: `list`, `get`, `create`, `update`, `resolve_workspace`,\n`list_milestones`, `create_milestone`, `update_milestone`, `list_updates`,\nand `create_update`.\n\nProject statuses: `planned`, `active`, `paused`, `completed`, `cancelled`,\n`archived`. Health values: `unknown`, `on_track`, `at_risk`, `off_track`.\n\nA Project defines bounded shared context for related work. Its durable planning fields are `outcome`,\n`successCriteria`, `scope`, `nonGoals`, `ownerId`, `targetAt`, and `health`.\nUse `brief` for a concise description and `instructions` for durable operating guidance.\n\n### Create\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"create\",\n \"args\": {\n \"name\": \"AI Product Research\",\n \"outcome\": \"Choose a validated product direction\",\n \"successCriteria\": [\"Ten customer interviews\", \"Decision recorded\"],\n \"scope\": { \"market\": \"developer tools\" },\n \"nonGoals\": [\"Build the production product\"],\n \"health\": \"on_track\",\n \"targetAt\": 1760000000000,\n \"workspaceRoot\": \"/path/to/repo\"\n }\n}\n```\n\n### Update\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"update\",\n \"args\": {\n \"projectId\": \"project_id\",\n \"status\": \"active\",\n \"health\": \"at_risk\",\n \"successCriteria\": [\"Ten interviews\", \"Evidence-backed decision\"]\n }\n}\n```\n\n### Resolve a workspace\n\nUse `autoCreate: false` for lookup. Set it to true only when creating a Project is authorized.\n\n```json\n{ \"mode\": \"project\", \"command\": \"resolve_workspace\", \"args\": { \"workspacePath\": \"/path/to/repo\", \"autoCreate\": false } }\n```\n\n### Milestones\n\nMilestone statuses: `planned`, `active`, `completed`, `cancelled`.\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"create_milestone\",\n \"args\": {\n \"projectId\": \"project_id\",\n \"title\": \"Finish discovery\",\n \"status\": \"active\",\n \"targetAt\": 1760000000000,\n \"sortOrder\": 10\n }\n}\n```\n\nUse `list_milestones` with `projectId`. Use `update_milestone` with both\n`projectId` and `milestoneId`. Milestone deletion is intentionally not exposed.\n\n### Immutable project updates\n\nProject updates are append-only progress snapshots. They also update Project health.\n\n```json\n{\n \"mode\": \"project\",\n \"command\": \"create_update\",\n \"args\": {\n \"projectId\": \"project_id\",\n \"health\": \"on_track\",\n \"summary\": \"Discovery is complete\",\n \"progress\": [\"Interviewed ten users\"],\n \"risks\": [\"Pricing remains unvalidated\"],\n \"nextSteps\": [\"Run pricing tests\"]\n }\n}\n```\n\nUse `list_updates` with `projectId` and optional `limit`. Updates cannot be edited.\n\n## Automations\n\nCommands: `list`, `get`, `create`, `update`, `delete`, `run`, `pause`,\n`resume`, and `history`.\n\nAutomation `create` automatically uses the current session Project when `projectId` is\nomitted. An explicit `projectId` takes precedence and is validated before mutation. Use an\nexplicit id when creating for a Project other than the current session Project.\n\n### Create in the current Project\n\n`trigger` and `action` use the same shapes as the Automation product API.\n\n```json\n{\n \"mode\": \"automation\",\n \"command\": \"create\",\n \"args\": {\n \"name\": \"Daily project review\",\n \"trigger\": { \"kind\": \"schedule\", \"schedule\": { \"kind\": \"cron\", \"expr\": \"0 9 * * 1-5\", \"tz\": \"Asia/Shanghai\" } },\n \"action\": { \"kind\": \"agent\", \"instruction\": \"Review the current project and summarize risks.\" }\n }\n}\n```\n\nTo override the inherited Project, add `\"projectId\": \"project_id\"` to `args`.\nThe create payload may also be nested under `args.automation`; top-level `args.projectId`\nhas precedence.\n\n### List and history\n\n`list` and unqualified `history` inherit the current session Project. Pass an explicit\n`projectId` to query another Project. Pass `automationId` to `history` for one Automation.\n\n### Update and operate\n\nUse `automationId` for `get`, `update`, `delete`, `run`, `pause`, and `resume`.\nFor `update`, patch fields may be direct args or nested under `args.patch`. Supplying a new\n`projectId` reassigns the Automation after validating the target Project.\n\n## Tasks\n\nCommands: `list`, `get`, `create`, `update_dependencies`, `add_context`,\n`remove_context`, `command`, and `delete`.\n\nTask phases are `backlog`, `ready`, `active`, `review`, and `closed`.\nOperational state is projected separately as `idle`, `queued`, `running`, `waiting`,\n`verifying`, `succeeded`, `failed`, or `cancelled`. Never send either value as a\nfree-form status update.\n\n`task.get` returns the Task, its projected `model`, dependencies, dependents, context,\nauthority grants, TaskRuns, receipts, and waits.\nThe projected model is the correct source for current operational state and attention items.\n\n`delete` permanently removes the Task and its contracts, waits, context links, TaskRuns,\nreceipts, and Task-owned execution records. It does not delete linked Sessions, workspace files,\nor external artifacts. Cancel an active TaskRun before deletion, and use `dryRun: true` when\nthe user's intent is ambiguous.\n\n```json\n{ \"mode\": \"task\", \"command\": \"delete\", \"args\": { \"taskId\": \"task_id\" }, \"dryRun\": true }\n```\n\n### Capture or start\n\n`createMode` defaults to `capture`, which creates a backlog Task without executing it.\nUse `start` only when immediate execution is intended.\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"create\",\n \"args\": {\n \"objective\": \"Complete the customer research report\",\n \"projectId\": \"project_id\",\n \"createMode\": \"capture\",\n \"priority\": \"high\",\n \"expectedOutputs\": [\"Research report\"],\n \"acceptanceCriteria\": [\"Sources are cited\"],\n \"constraints\": [\"Do not contact customers without approval\"],\n \"dependsOnTaskIds\": []\n }\n}\n```\n\n### Dependencies\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"update_dependencies\",\n \"args\": {\n \"taskId\": \"task_id\",\n \"expectedVersion\": 3,\n \"dependsOnTaskIds\": [\"dependency_task_id\"]\n }\n}\n```\n\n### Context links\n\nUse `add_context` to link a document, file, URL, session, memory, Task, artifact, or source\nas `input`, `reference`, `constraint`, `deliverable`, or `evidence` context.\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"add_context\",\n \"args\": {\n \"taskId\": \"task_id\",\n \"targetKind\": \"file\",\n \"targetId\": \"/path/to/spec.md\",\n \"role\": \"input\",\n \"title\": \"Product specification\",\n \"pinned\": true,\n \"retrievalPolicy\": {},\n \"metadata\": {}\n }\n}\n```\n\nUse `remove_context` with `taskId` and the exact `edgeId` returned by `task.get`.\nDo not add authority grants through this tool; an Agent must not authorize itself.\n\n### Typed lifecycle commands\n\nEvery command requires `taskId`, the Task's current `expectedVersion`, a `type`, and\ntype-specific fields inside `commandArgs`.\n\nSupported command types:\n\n- `mark_ready`\n- `start`: `{ \"executor\": { \"kind\": \"agent\", \"agentId\": \"main\" } }`\n- `request_review`\n- `close`: `{ \"resolution\": \"done | cancelled | duplicate | wont_do\" }`\n- `reopen`: `{ \"phase\": \"ready | active\" }`\n- `add_wait`: `{ \"wait\": { \"kind\": \"dependency | approval | input | schedule | external | paused\", \"reason\": \"...\", \"condition\": {} } }`\n- `resolve_wait`: `{ \"waitId\": \"wait_id\", \"resolution\": {} }`\n- `delegate`: `{ \"agentId\": \"agent_id\" }`\n- `revise_contract`: `{ \"contract\": { ...complete contract... } }`\n\n```json\n{\n \"mode\": \"task\",\n \"command\": \"command\",\n \"args\": {\n \"taskId\": \"task_id\",\n \"expectedVersion\": 3,\n \"type\": \"start\",\n \"commandArgs\": {\n \"executor\": { \"kind\": \"agent\", \"agentId\": \"main\" }\n }\n }\n}\n```\n\nContract revision is replacement, not a patch. Read the Task and preserve all contract fields\nthe user did not ask to change. Resolve a wait through `resolve_wait`; do not directly mutate\na TaskRun or manufacture a phase transition.\n\n## TaskRuns\n\nTaskRun inspection is read-only except for explicit cancellation. Other execution state is\ncontrolled by Task commands and the runtime coordinator.\n\n### List attempts for a Task\n\n```json\n{ \"mode\": \"task_run\", \"command\": \"list\", \"args\": { \"taskId\": \"task_id\", \"limit\": 20 } }\n```\n\nThe result contains run attempts, finalized receipts, and active waits.\n\n### Inspect one attempt\n\n```json\n{ \"mode\": \"task_run\", \"command\": \"get\", \"args\": { \"runId\": \"run_id\" } }\n```\n\nThe result contains the TaskRun, its receipt when terminal, ordered events, and active Task waits.\n\n### Cancel an attempt\n\nRead the run first, then pass its current version. Cancellation creates a terminal receipt.\n\n```json\n{\n \"mode\": \"task_run\",\n \"command\": \"cancel\",\n \"args\": { \"runId\": \"run_id\", \"expectedVersion\": 2, \"reason\": \"User cancelled execution\" }\n}\n```\n\nDo not guess commands such as retry, force-complete, heartbeat, or transition; they are not Agent APIs.\n\n## Notes\n\nCommands: `list`, `get`, `create`, `append`, `preview_edit`, `update`, and `delete`.\nUse Notes for durable prose and reference material, not as a Task substitute. Prefer `append`\nwhen preserving user content. Use `preview_edit` before a canonical rewrite.\n\n```json\n{ \"mode\": \"note\", \"command\": \"create\", \"args\": { \"title\": \"Decision\", \"markdown\": \"...\", \"projectId\": \"project_id\" } }\n```\n\n```json\n{ \"mode\": \"note\", \"command\": \"append\", \"args\": { \"noteId\": \"note_id\", \"heading\": \"AI synthesis\", \"content\": \"...\" } }\n```\n\nUse `update` with `status: \"trashed\"` for a recoverable removal. `delete` permanently\nremoves the Note and its stored snapshots and media; use `dryRun: true` first when the\nuser's intent is ambiguous.\n\n```json\n{ \"mode\": \"note\", \"command\": \"delete\", \"args\": { \"noteId\": \"note_id\" }, \"dryRun\": true }\n```\n\n## Chat previews, local apps, and settings\n\nUse `chat_preview` by default when the user asks to design, mock up, or quickly show a UI in\nthe current conversation. It creates no Project and no Local App. Commands are `create`,\n`get`, and `revise`. Source consists of `markup`, `styles`, and optional `script`;\ndo not include a full HTML document or remote dependencies. Revision requires the exact\n`baseRevision` returned by the prior call.\n\nUse `local_app` only when the user explicitly asks for a durable, installable app or chooses\n\u201CSave as app\u201D on a chat preview. Do not create a Local App merely to render a UI draft.\n\nLocal app commands are `list`, `get`, `create`, and `validate`. Installation,\nactivation, rollback, and uninstall remain product runtime operations.\n\nSettings supports only `open` and returns an exact product jump target without changing config.\n\n## Error recovery\n\n| Result | Recovery |\n| --- | --- |\n| service unavailable | Stop retrying and report the unavailable capability. |\n| not found | Re-list in the intended scope; do not invent another id. |\n| conflict | Read the current object and reassess using its latest version. |\n| waiting | Inspect the Task projection and TaskRun waits; resolve only the real blocker. |\n| invalid command or state | Read the object and use only a documented transition. |\n| unsupported operation | Use the dedicated tool or product UI; never write storage directly. |\n\n## Deliberate boundaries\n\n- Project deletion and milestone deletion are not Agent APIs.\n- TaskRun mutation is internal to execution coordination except for optimistic cancellation.\n- Project updates are immutable.\n- Workflow and Automation operations remain in their dedicated tools.\n- Only the documented Task and TaskRun commands are valid; do not infer hidden aliases.\n";