@xopcai/xopc 0.0.277 → 0.0.278

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 (330) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/feishu/src/adapters/cli-login.js +3 -3
  3. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  4. package/dist/extensions/telegram/src/inbound-processor.js +2 -2
  5. package/dist/extensions/telegram/src/outbound-sender.js +1 -1
  6. package/dist/extensions/telegram/src/plugin.js +2 -2
  7. package/dist/extensions/telegram/xopc.extension.json +1 -1
  8. package/dist/extensions/weixin/src/api/api.js +2 -2
  9. package/dist/extensions/weixin/src/auth/accounts.js +12 -12
  10. package/dist/extensions/weixin/src/messaging/debug-mode.js +5 -5
  11. package/dist/extensions/weixin/src/messaging/inbound.js +11 -11
  12. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Cavbls0E.js → agent-avatar-dicebear-lRVOwbrK.js} +1 -1
  13. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DyCyuJpi.js → agent-defaults-settings-panel-DAqn5DdL.js} +1 -1
  14. package/dist/gateway/static/root/assets/{agents-DlDTItrB.js → agents-DNQNTDkU.js} +1 -1
  15. package/dist/gateway/static/root/assets/{app-management-settings-panel-5gS0_LWl.js → app-management-settings-panel-oHTY5PDs.js} +1 -1
  16. package/dist/gateway/static/root/assets/{appearance-settings-DHzZCJon.js → appearance-settings-B0YnZ3ig.js} +1 -1
  17. package/dist/gateway/static/root/assets/{apps-page-__yzruGu.js → apps-page-Bh0etSmL.js} +1 -1
  18. package/dist/gateway/static/root/assets/{archive-plugin-Ia98yZe3.js → archive-plugin-D4x142le.js} +1 -1
  19. package/dist/gateway/static/root/assets/{attachment-load-DiWW88c8.js → attachment-load-zibD2Hod.js} +1 -1
  20. package/dist/gateway/static/root/assets/{automations-page-BuhTeGRJ.js → automations-page-Dkp7gp_S.js} +1 -1
  21. package/dist/gateway/static/root/assets/{automations-workspace-DaisbmEh.js → automations-workspace-w4McwueN.js} +1 -1
  22. package/dist/gateway/static/root/assets/{binary-plugins-DDD48cJv.js → binary-plugins-CfUzu1Hc.js} +1 -1
  23. package/dist/gateway/static/root/assets/{block-editor-0AWVCD3F.js → block-editor-r5nCBBan.js} +1 -1
  24. package/dist/gateway/static/root/assets/{browser-automations-page-BKOYX5xV.js → browser-automations-page-BnL4JnTM.js} +1 -1
  25. package/dist/gateway/static/root/assets/{browser-settings-page-C7zjxscU.js → browser-settings-page-DxX-t0EJ.js} +1 -1
  26. package/dist/gateway/static/root/assets/{capabilities-settings-panel-7kZMT1r6.js → capabilities-settings-panel-CvacBQAI.js} +1 -1
  27. package/dist/gateway/static/root/assets/{channels-settings-BKUh6hzO.js → channels-settings-CJzSNo-L.js} +1 -1
  28. package/dist/gateway/static/root/assets/{chat-terminal-dock-CW9Byi8V.js → chat-terminal-dock-CWVnJtBp.js} +1 -1
  29. package/dist/gateway/static/root/assets/{connectors-page-m8J-F3u8.js → connectors-page-DNBhBT0b.js} +1 -1
  30. package/dist/gateway/static/root/assets/{date-picker-gdYmKC8W.js → date-picker-XjPSlgq_.js} +1 -1
  31. package/dist/gateway/static/root/assets/{dependency-picker-40BYmiMc.js → dependency-picker-CkyfEP88.js} +1 -1
  32. package/dist/gateway/static/root/assets/{desktop-pet-By1z6tKE.js → desktop-pet-BAE_NVx5.js} +1 -1
  33. package/dist/gateway/static/root/assets/{desktop-pet-settings-ByjJqx9H.js → desktop-pet-settings-BUw6V2R9.js} +1 -1
  34. package/dist/gateway/static/root/assets/{device-pairing-wizard-CfWQfz7a.js → device-pairing-wizard-DsR5NQEC.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-debug-page-DQO65KbM.js → extension-debug-page-giBeIVUT.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-page-Db32jip6.js → extension-page-Bqo9bNtx.js} +1 -1
  37. package/dist/gateway/static/root/assets/{extension-settings-page-CL8Wx8lf.js → extension-settings-page-BX-6AA3k.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-settings-wLly-Kc1.js → gateway-settings-Dil7vuyU.js} +1 -1
  39. package/dist/gateway/static/root/assets/{heartbeat-settings-CRXWu2q6.js → heartbeat-settings-DWFAopk_.js} +1 -1
  40. package/dist/gateway/static/root/assets/{home-page-FqgSwpmy.js → home-page-Dpeuvazg.js} +1 -1
  41. package/dist/gateway/static/root/assets/{index-5UchbidQ.js → index-B03HGpzt.js} +9 -9
  42. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CjehhHPz.js → keyboard-shortcuts-settings-BKGPpBnV.js} +1 -1
  43. package/dist/gateway/static/root/assets/{local-app-workbench-page-DtYZa4GK.js → local-app-workbench-page-CBtemxFc.js} +1 -1
  44. package/dist/gateway/static/root/assets/{local-apps-page-CrIdaTrK.js → local-apps-page-B06ToOxB.js} +1 -1
  45. package/dist/gateway/static/root/assets/{logs-page-FfSwV_VH.js → logs-page-DibI1GsP.js} +1 -1
  46. package/dist/gateway/static/root/assets/{management-settings-BakV5aOw.js → management-settings-DJ6yMZCd.js} +1 -1
  47. package/dist/gateway/static/root/assets/{media-plugins-Blv9U6Jp.js → media-plugins-CdrLNAks.js} +1 -1
  48. package/dist/gateway/static/root/assets/{note-detail-panel-JbvyGdEX.js → note-detail-panel-GOxomxOK.js} +3 -3
  49. package/dist/gateway/static/root/assets/{notes-page-Dm7mE2FK.js → notes-page-CQBgk3_x.js} +1 -1
  50. package/dist/gateway/static/root/assets/{page-tabs-BQfVtLLC.js → page-tabs-B7LA4z-x.js} +1 -1
  51. package/dist/gateway/static/root/assets/{preview-open-alternatives-kjHFiO81.js → preview-open-alternatives-DTQRN7WR.js} +1 -1
  52. package/dist/gateway/static/root/assets/proactive-card-BF3741px.js +1 -0
  53. package/dist/gateway/static/root/assets/proactive-page-1EM217v0.js +1 -0
  54. package/dist/gateway/static/root/assets/{project-detail-page-h00lfcVI.js → project-detail-page-B1Pm-fQd.js} +1 -1
  55. package/dist/gateway/static/root/assets/{projects-page-C2Bo1FAL.js → projects-page-DUrxyNR9.js} +1 -1
  56. package/dist/gateway/static/root/assets/{remote-access-hub-_bZYAl49.js → remote-access-hub-C6VzHUwx.js} +1 -1
  57. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BhJlopSW.js → runtime-tools-settings-panel-D-DZf4I1.js} +1 -1
  58. package/dist/gateway/static/root/assets/{schema-form-cxoO_5I1.js → schema-form-B-Yj9DVW.js} +1 -1
  59. package/dist/gateway/static/root/assets/{sessions-page-F7CHsvPa.js → sessions-page-DtemHfkv.js} +1 -1
  60. package/dist/gateway/static/root/assets/settings-advanced-gate-ByEVQe0c.js +1 -0
  61. package/dist/gateway/static/root/assets/{settings-form-section-BiRTWiBi.js → settings-form-section-BxPUqwY6.js} +1 -1
  62. package/dist/gateway/static/root/assets/{settings-page-D-Cb71pq.js → settings-page-zLn8lIrs.js} +1 -1
  63. package/dist/gateway/static/root/assets/setup-status-panel-BwIrk3Jx.js +1 -0
  64. package/dist/gateway/static/root/assets/{share-preview-page-DciHfTay.js → share-preview-page-DAc_FkVc.js} +1 -1
  65. package/dist/gateway/static/root/assets/{shares-settings-BS2pnWO0.js → shares-settings-Dwdv6QyS.js} +1 -1
  66. package/dist/gateway/static/root/assets/{skill-reload-api-DX344nVV.js → skill-reload-api-CDzQWN60.js} +1 -1
  67. package/dist/gateway/static/root/assets/{skills-page-BhfKUsv7.js → skills-page-CO5XVkbY.js} +1 -1
  68. package/dist/gateway/static/root/assets/{skills-page.utils-CU7PALQB.js → skills-page.utils-BR5bk2vT.js} +1 -1
  69. package/dist/gateway/static/root/assets/{system-settings-panel-GpjNbqvM.js → system-settings-panel-C0ptJutB.js} +1 -1
  70. package/dist/gateway/static/root/assets/task-detail-page-DOjcKOzQ.js +1 -0
  71. package/dist/gateway/static/root/assets/{tunnel-api-Bhi_x_h4.js → tunnel-api-BABuQvGD.js} +1 -1
  72. package/dist/gateway/static/root/assets/{use-autosave-LvCiBidm.js → use-autosave-Dc5aN2px.js} +1 -1
  73. package/dist/gateway/static/root/assets/{user-model-page-BydARq2C.js → user-model-page-UhsSP_pC.js} +1 -1
  74. package/dist/gateway/static/root/assets/{voice-api-key-field-BlGysZxj.js → voice-api-key-field-CY0DpJui.js} +1 -1
  75. package/dist/gateway/static/root/assets/{work-discovery-overlay-DvIQOR5x.js → work-discovery-overlay-Brg9yJBr.js} +1 -1
  76. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-JIp60bXT.js → workflow-run-setup-panel-D3fq7boB.js} +1 -1
  77. package/dist/gateway/static/root/assets/{workflows-page-B972t6zx.js → workflows-page-S7XXNBWa.js} +1 -1
  78. package/dist/gateway/static/root/index.html +1 -1
  79. package/dist/package.js +1 -1
  80. package/dist/src/agent/agent-manager.js +17 -17
  81. package/dist/src/agent/agent-scope.js +2 -2
  82. package/dist/src/agent/background-review/run-background-review.js +4 -4
  83. package/dist/src/agent/commands/command-isolation.d.ts +1 -0
  84. package/dist/src/agent/commands/command-isolation.js +17 -1
  85. package/dist/src/agent/commands/commandMounts.d.ts +2 -0
  86. package/dist/src/agent/commands/commandMounts.js +32 -0
  87. package/dist/src/agent/context/coordinator.js +3 -3
  88. package/dist/src/agent/context/execution-context.js +4 -4
  89. package/dist/src/agent/context/execution-scope.js +2 -2
  90. package/dist/src/agent/context/project-context.js +4 -4
  91. package/dist/src/agent/embedded/index.js +2 -2
  92. package/dist/src/agent/embedded/model-runtime.js +1 -1
  93. package/dist/src/agent/embedded/run-for-session.js +5 -5
  94. package/dist/src/agent/embedded/run-turn.js +2 -2
  95. package/dist/src/agent/embedded/session-tool-result-guard.js +3 -3
  96. package/dist/src/agent/external-tools/composio-provider.js +1 -1
  97. package/dist/src/agent/external-tools/gateway-tools.js +1 -1
  98. package/dist/src/agent/external-tools/mcp-provider.js +2 -2
  99. package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
  100. package/dist/src/agent/image/generation/providers/dashscope.js +1 -1
  101. package/dist/src/agent/image/generation/providers/fal.js +1 -1
  102. package/dist/src/agent/image/generation/providers/google.js +1 -1
  103. package/dist/src/agent/image/generation/runtime.js +1 -1
  104. package/dist/src/agent/image/index.js +1 -1
  105. package/dist/src/agent/image/load-image-media.js +1 -1
  106. package/dist/src/agent/image/tool-model-config.js +1 -1
  107. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  108. package/dist/src/agent/inbound/inbound-loop.js +2 -2
  109. package/dist/src/agent/index.js +1 -1
  110. package/dist/src/agent/mcp/bundle-mcp-gateway.js +1 -1
  111. package/dist/src/agent/mcp/bundle-mcp-runtime.js +2 -2
  112. package/dist/src/agent/mcp/index.js +2 -2
  113. package/dist/src/agent/mcp/mcp-transport.js +1 -1
  114. package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
  115. package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
  116. package/dist/src/agent/memory/index.js +2 -2
  117. package/dist/src/agent/messaging/outbound-coordinator.js +1 -1
  118. package/dist/src/agent/orchestration/agent-orchestrator.js +5 -5
  119. package/dist/src/agent/prompt/service-prompt-builder.js +2 -2
  120. package/dist/src/agent/sandbox/command-validator.js +0 -20
  121. package/dist/src/agent/sandbox/exec-policy.d.ts +1 -0
  122. package/dist/src/agent/sandbox/exec-policy.js +3 -3
  123. package/dist/src/agent/sandbox/fileAccess.d.ts +7 -0
  124. package/dist/src/agent/sandbox/fileAccess.js +100 -0
  125. package/dist/src/agent/sandbox/path-policy.d.ts +2 -0
  126. package/dist/src/agent/sandbox/path-policy.js +54 -17
  127. package/dist/src/agent/sandbox/sanitize-env-vars.js +10 -9
  128. package/dist/src/agent/service/direct-turn-helpers.js +6 -6
  129. package/dist/src/agent/service/process-direct-one-shot.js +1 -1
  130. package/dist/src/agent/service/process-direct-streaming.js +5 -5
  131. package/dist/src/agent/service/webchat-tts.js +2 -2
  132. package/dist/src/agent/service.js +19 -19
  133. package/dist/src/agent/session/session-inspector.js +1 -1
  134. package/dist/src/agent/skills/filesystem-watcher.js +1 -1
  135. package/dist/src/agent/skills/hub-lock.js +1 -1
  136. package/dist/src/agent/skills/hub-pull.js +3 -3
  137. package/dist/src/agent/skills/marketplace/adapters/store/adapter.js +1 -1
  138. package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
  139. package/dist/src/agent/tasks/task-judge-service.js +5 -5
  140. package/dist/src/agent/tools/apply-patch.js +25 -38
  141. package/dist/src/agent/tools/create-share-tool.js +13 -5
  142. package/dist/src/agent/tools/delegate-tool.js +3 -3
  143. package/dist/src/agent/tools/exec-command.js +2 -1
  144. package/dist/src/agent/tools/executor.js +1 -1
  145. package/dist/src/agent/tools/factory.js +13 -13
  146. package/dist/src/agent/tools/find.js +5 -3
  147. package/dist/src/agent/tools/grep.js +21 -4
  148. package/dist/src/agent/tools/image-generate-tool.js +5 -6
  149. package/dist/src/agent/tools/index.js +5 -5
  150. package/dist/src/agent/tools/list-dir.js +2 -1
  151. package/dist/src/agent/tools/managed-job-tool.js +1 -0
  152. package/dist/src/agent/tools/publish-artifacts.js +4 -3
  153. package/dist/src/agent/tools/read.js +9 -6
  154. package/dist/src/agent/tools/repository-search.d.ts +2 -0
  155. package/dist/src/agent/tools/repository-search.js +51 -7
  156. package/dist/src/agent/tools/review-workspace.js +76 -10
  157. package/dist/src/agent/tools/send-media.js +5 -4
  158. package/dist/src/agent/tools/skills-tools.js +1 -1
  159. package/dist/src/agent/tools/tool-paths.js +3 -1
  160. package/dist/src/agent/tools/tts-tool.js +1 -1
  161. package/dist/src/agent/tools/user-context-tool.js +1 -1
  162. package/dist/src/agent/tools/write.js +6 -19
  163. package/dist/src/agent/tools/xopc-use-tool.js +6 -6
  164. package/dist/src/agent/workflow/subagent-runner.js +1 -1
  165. package/dist/src/agent-config/schema.d.ts +24 -0
  166. package/dist/src/agent-config/schema.js +2 -1
  167. package/dist/src/ai-assist/text-assist.js +1 -1
  168. package/dist/src/auth/credentials.js +2 -2
  169. package/dist/src/auth/oauth/xopc-cloud.js +1 -1
  170. package/dist/src/auth/profiles/store.js +1 -1
  171. package/dist/src/auth/sync-provider-auth.js +2 -2
  172. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  173. package/dist/src/capabilities/store-connector.js +1 -1
  174. package/dist/src/channels/attachments/voice-stt-webchat.js +2 -2
  175. package/dist/src/channels/index.js +2 -2
  176. package/dist/src/channels/outbound-sender.js +1 -1
  177. package/dist/src/channels/pairing/allow-from-file.js +9 -9
  178. package/dist/src/channels/pairing/pairing-store.js +6 -6
  179. package/dist/src/chat-commands/builtins/config.js +2 -2
  180. package/dist/src/chat-commands/builtins/review.js +1 -1
  181. package/dist/src/chat-commands/builtins/session.js +1 -1
  182. package/dist/src/chat-commands/builtins/thinking.js +1 -1
  183. package/dist/src/chat-commands/builtins/tts.js +1 -1
  184. package/dist/src/chat-commands/builtins/understanding.js +1 -1
  185. package/dist/src/chat-commands/builtins/workflow.js +2 -2
  186. package/dist/src/chat-commands/context.js +2 -2
  187. package/dist/src/chat-commands/index.js +3 -3
  188. package/dist/src/cli/commands/agent.js +6 -6
  189. package/dist/src/cli/commands/agents.js +1 -1
  190. package/dist/src/cli/commands/config.js +1 -1
  191. package/dist/src/cli/commands/doctor/checks/provider-auth.js +21 -20
  192. package/dist/src/cli/commands/extension-dev.js +1 -1
  193. package/dist/src/cli/commands/extension.js +1 -1
  194. package/dist/src/cli/commands/gateway/shared.js +1 -1
  195. package/dist/src/cli/commands/gateway/token.js +1 -1
  196. package/dist/src/cli/commands/image.js +1 -1
  197. package/dist/src/cli/commands/init.js +1 -1
  198. package/dist/src/cli/commands/models.js +1 -1
  199. package/dist/src/cli/commands/onboard.js +1 -1
  200. package/dist/src/cli/commands/project.js +2 -2
  201. package/dist/src/cli/commands/runtime.js +1 -1
  202. package/dist/src/cli/commands/skills.js +2 -2
  203. package/dist/src/cli/commands/tui.js +1 -1
  204. package/dist/src/cli/commands/tunnel.js +3 -3
  205. package/dist/src/cli/extension-cli-register.js +4 -4
  206. package/dist/src/cli/utils/gateway-client.js +1 -1
  207. package/dist/src/config/index.js +5 -5
  208. package/dist/src/config/loader.js +2 -2
  209. package/dist/src/config/models-json.js +1 -1
  210. package/dist/src/config/schema.d.ts +16 -0
  211. package/dist/src/connectors/connected-source-understanding.js +2 -2
  212. package/dist/src/connectors/connection-recovery-service.js +3 -3
  213. package/dist/src/discussions/live-worker.js +1 -1
  214. package/dist/src/discussions/sealer.js +1 -1
  215. package/dist/src/extensions/api.js +3 -3
  216. package/dist/src/extensions/bundled-extension-activation.js +1 -1
  217. package/dist/src/extensions/index.js +1 -1
  218. package/dist/src/extensions/loader.js +1 -1
  219. package/dist/src/extensions/lockfile.js +1 -1
  220. package/dist/src/extensions/sdk/index.js +1 -1
  221. package/dist/src/gateway/agents-admin.js +4 -4
  222. package/dist/src/gateway/device-routes.js +2 -2
  223. package/dist/src/gateway/file-path-classifier.js +2 -2
  224. package/dist/src/gateway/heartbeat/service.js +1 -1
  225. package/dist/src/gateway/hono/app.js +3 -3
  226. package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -0
  227. package/dist/src/gateway/hono/lib/config-payload.js +3 -3
  228. package/dist/src/gateway/hono/routes/agents.js +1 -1
  229. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  230. package/dist/src/gateway/hono/routes/browser.js +1 -1
  231. package/dist/src/gateway/hono/routes/commands-skills.js +3 -3
  232. package/dist/src/gateway/hono/routes/config-patch/gateway.js +1 -1
  233. package/dist/src/gateway/hono/routes/mcp.js +2 -2
  234. package/dist/src/gateway/hono/routes/media.js +1 -1
  235. package/dist/src/gateway/hono/routes/models.js +5 -5
  236. package/dist/src/gateway/hono/routes/notes.js +1 -1
  237. package/dist/src/gateway/hono/routes/proactive-control.js +4 -4
  238. package/dist/src/gateway/hono/routes/projects.js +2 -2
  239. package/dist/src/gateway/hono/routes/sessions.js +1 -1
  240. package/dist/src/gateway/hono/routes/shares.js +25 -4
  241. package/dist/src/gateway/hono/routes/site-shares.js +1 -1
  242. package/dist/src/gateway/hono/routes/status.js +1 -1
  243. package/dist/src/gateway/hono/routes/tasks.js +4 -4
  244. package/dist/src/gateway/hono/routes/user-model.js +4 -4
  245. package/dist/src/gateway/hono/routes/voice.js +3 -3
  246. package/dist/src/gateway/hono/routes/workflows.js +2 -2
  247. package/dist/src/gateway/image-generation-setup.js +1 -1
  248. package/dist/src/gateway/lock.js +10 -10
  249. package/dist/src/gateway/media-access.js +2 -2
  250. package/dist/src/gateway/ports.js +6 -6
  251. package/dist/src/gateway/server.js +1 -1
  252. package/dist/src/gateway/service/config-coordinator.js +4 -4
  253. package/dist/src/gateway/service/marketplace-service.js +3 -3
  254. package/dist/src/gateway/service/run-gateway-agent.js +3 -3
  255. package/dist/src/gateway/service.js +36 -36
  256. package/dist/src/gateway/session-context-summary.js +2 -2
  257. package/dist/src/gateway/workspace-editor-path.js +2 -2
  258. package/dist/src/heartbeat/index.js +1 -1
  259. package/dist/src/infra/gateway-processes.js +2 -2
  260. package/dist/src/infra/path-env.js +3 -3
  261. package/dist/src/infra/update-global.js +10 -10
  262. package/dist/src/local-apps/service.js +1 -1
  263. package/dist/src/media-shared/http/ssrf-guard.js +1 -1
  264. package/dist/src/notes/agent-context.js +3 -3
  265. package/dist/src/proactive/actions/service.js +1 -1
  266. package/dist/src/proactive/execution/agent-executor.js +1 -1
  267. package/dist/src/proactive/execution/context.js +1 -1
  268. package/dist/src/proactive/execution/worker.js +1 -1
  269. package/dist/src/proactive/experience.js +7 -2
  270. package/dist/src/proactive/follow-ups.js +1 -1
  271. package/dist/src/proactive/inbox/cards.js +2 -2
  272. package/dist/src/proactive/inbox/delivery.js +2 -2
  273. package/dist/src/proactive/inbox/digest.js +2 -2
  274. package/dist/src/proactive/inbox/notification-policy.js +1 -1
  275. package/dist/src/proactive/inbox/repository.js +1 -1
  276. package/dist/src/proactive/inbox/service.js +1 -1
  277. package/dist/src/proactive/index.js +1 -1
  278. package/dist/src/proactive/temporal/worker.js +1 -1
  279. package/dist/src/projects/project-skill-service.js +2 -2
  280. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  281. package/dist/src/providers/index.js +2 -2
  282. package/dist/src/providers/model-reference-auditor.js +1 -1
  283. package/dist/src/providers/model-registry.js +1 -1
  284. package/dist/src/providers/register-runtime-providers.js +1 -1
  285. package/dist/src/remote-access/exposure-manager.js +1 -1
  286. package/dist/src/session/index.js +2 -2
  287. package/dist/src/session/session-title.js +1 -1
  288. package/dist/src/session/store.js +3 -3
  289. package/dist/src/session/thinking-resolve.js +1 -1
  290. package/dist/src/share/share-store.js +6 -2
  291. package/dist/src/share/share-thumbnail.js +1 -1
  292. package/dist/src/share/site-share-store.js +1 -1
  293. package/dist/src/storage/sqlite/connection.js +9 -9
  294. package/dist/src/tasks/execution-context.js +1 -1
  295. package/dist/src/tasks/home-query-service.js +3 -3
  296. package/dist/src/tasks/index.js +3 -3
  297. package/dist/src/tasks/task-application-service.js +78 -4
  298. package/dist/src/tasks/task-context-assembler.js +2 -1
  299. package/dist/src/tasks/task-handoff-service.js +1 -1
  300. package/dist/src/tasks/task-run-coordinator.js +1 -1
  301. package/dist/src/tui/backends/embedded-backend.js +9 -9
  302. package/dist/src/tui/backends/gateway-realtime-backend.js +2 -2
  303. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  304. package/dist/src/tui/tui-command-formatters.js +1 -1
  305. package/dist/src/tui/tui-commands.js +5 -5
  306. package/dist/src/tui/tui-picker-overlay.js +1 -1
  307. package/dist/src/tui/tui-skills-autocomplete.js +1 -1
  308. package/dist/src/tui/tui-startup-resources.js +5 -5
  309. package/dist/src/tui/tui.js +3 -3
  310. package/dist/src/tunnel/gateway-lifecycle.js +1 -1
  311. package/dist/src/voice/local/runtime-worker.js +1 -1
  312. package/dist/src/voice/realtime/memory-context.js +3 -3
  313. package/dist/src/voice/stt/index.js +2 -2
  314. package/dist/src/voice/stt/preflight.js +1 -1
  315. package/dist/src/voice/stt/providers/local-transcription.js +1 -1
  316. package/dist/src/voice/stt/transcribe-core.js +1 -1
  317. package/dist/src/voice/tts/index.js +3 -3
  318. package/dist/src/voice/tts/merge-config.js +1 -1
  319. package/dist/src/voice/tts/payload.js +1 -1
  320. package/dist/src/voice/tts/speak-core.js +1 -1
  321. package/dist/src/work-discovery/service.js +3 -3
  322. package/dist/src/workflows/context/workflow-context.js +1 -1
  323. package/dist/src/workflows/service/workflow-run-service.js +6 -6
  324. package/dist/src/workflows/service/workflow-session-bridge.js +1 -1
  325. package/package.json +3 -3
  326. package/dist/gateway/static/root/assets/proactive-card-Ap_wfos3.js +0 -1
  327. package/dist/gateway/static/root/assets/proactive-page-D1lEuanT.js +0 -1
  328. package/dist/gateway/static/root/assets/settings-advanced-gate-DtZSUX4H.js +0 -1
  329. package/dist/gateway/static/root/assets/setup-status-panel-VPfBsNVv.js +0 -1
  330. package/dist/gateway/static/root/assets/task-detail-page-CElcQ9Sh.js +0 -1
@@ -0,0 +1,100 @@
1
+ import { evaluateFilePolicy } from "./exec-policy.js";
2
+ import { dirname, join, resolve } from "node:path";
3
+ import { closeSync, constants, fstatSync, ftruncateSync, lstatSync, mkdirSync, openSync, readSync, readdirSync, statSync, unlinkSync, writeFileSync } from "node:fs";
4
+ //#region src/agent/sandbox/fileAccess.ts
5
+ /** Revalidate at I/O time; never truncate a file before checking the opened inode. */
6
+ function checkedFilePath(workspaceRoot, path, operation) {
7
+ const policy = evaluateFilePolicy({
8
+ workspaceRoot,
9
+ path,
10
+ operation
11
+ });
12
+ if (!policy.allowed || !policy.canonicalPath) throw new Error(`Sandbox: ${policy.reason ?? "Cannot resolve file"}`);
13
+ return policy.canonicalPath;
14
+ }
15
+ function mkdirChecked(workspace, directory) {
16
+ const path = checkedFilePath(workspace, directory, "write");
17
+ try {
18
+ if (!lstatSync(path).isDirectory()) throw new Error("Expected a directory");
19
+ } catch (error) {
20
+ if (error.code !== "ENOENT") throw error;
21
+ mkdirChecked(workspace, dirname(path));
22
+ if (checkedFilePath(workspace, path, "write") !== path) throw new Error("Directory changed during operation");
23
+ mkdirSync(path);
24
+ }
25
+ }
26
+ function openChecked(workspace, inputPath, write) {
27
+ const operation = write ? "write" : "read";
28
+ const path = checkedFilePath(workspace, inputPath, operation);
29
+ if (write) mkdirChecked(workspace, dirname(path));
30
+ if (checkedFilePath(workspace, path, operation) !== path) throw new Error("Path changed during operation");
31
+ const flags = (write ? constants.O_WRONLY : constants.O_RDONLY) | constants.O_NOFOLLOW | constants.O_NONBLOCK;
32
+ let fd;
33
+ try {
34
+ fd = openSync(path, flags);
35
+ } catch (error) {
36
+ if (!write || error.code !== "ENOENT") throw error;
37
+ fd = openSync(path, flags | constants.O_CREAT | constants.O_EXCL, 384);
38
+ }
39
+ try {
40
+ const opened = fstatSync(fd);
41
+ const currentPath = checkedFilePath(workspace, inputPath, operation);
42
+ const current = statSync(currentPath);
43
+ if (currentPath !== path || current.dev !== opened.dev || current.ino !== opened.ino) throw new Error("File changed during operation");
44
+ if (!opened.isFile() || opened.nlink !== 1) throw new Error("Sandbox requires a regular file without hard links");
45
+ return fd;
46
+ } catch (error) {
47
+ closeSync(fd);
48
+ throw error;
49
+ }
50
+ }
51
+ function readWorkspaceFile(workspace, path, maxBytes = 10 * 1024 * 1024) {
52
+ const fd = openChecked(workspace, path, false);
53
+ try {
54
+ if (fstatSync(fd).size > maxBytes) throw new Error(`File too large: maximum ${maxBytes} bytes`);
55
+ const chunks = [];
56
+ let total = 0;
57
+ for (;;) {
58
+ const chunk = Buffer.alloc(Math.min(64 * 1024, maxBytes - total + 1));
59
+ const count = readSync(fd, chunk);
60
+ if (count === 0) break;
61
+ total += count;
62
+ if (total > maxBytes) throw new Error(`File too large: maximum ${maxBytes} bytes`);
63
+ chunks.push(chunk.subarray(0, count));
64
+ }
65
+ return Buffer.concat(chunks);
66
+ } finally {
67
+ closeSync(fd);
68
+ }
69
+ }
70
+ function writeWorkspaceFile(workspace, path, content) {
71
+ const fd = openChecked(workspace, path, true);
72
+ try {
73
+ ftruncateSync(fd, 0);
74
+ writeFileSync(fd, content, "utf8");
75
+ } finally {
76
+ closeSync(fd);
77
+ }
78
+ }
79
+ function deleteWorkspaceFile(workspace, path) {
80
+ const target = checkedFilePath(workspace, path, "delete");
81
+ if (!lstatSync(target).isFile()) throw new Error("Expected a regular file");
82
+ if (checkedFilePath(workspace, resolve(target), "delete") !== target) throw new Error("File changed during operation");
83
+ unlinkSync(target);
84
+ }
85
+ /** Refuse publication of directory trees containing protected or escaping entries. */
86
+ function assertWorkspaceTreeReadable(workspace, path) {
87
+ const seen = /* @__PURE__ */ new Set();
88
+ let count = 0;
89
+ const visit = (input) => {
90
+ if (++count > 2e5) throw new Error("Share exceeds safe traversal limit");
91
+ const target = checkedFilePath(workspace, input, "read");
92
+ if (seen.has(target)) return;
93
+ seen.add(target);
94
+ if (lstatSync(target).isDirectory()) for (const name of readdirSync(target)) visit(join(target, name));
95
+ else closeSync(openChecked(workspace, target, false));
96
+ };
97
+ visit(path);
98
+ }
99
+ //#endregion
100
+ export { assertWorkspaceTreeReadable, checkedFilePath, deleteWorkspaceFile, readWorkspaceFile, writeWorkspaceFile };
@@ -5,6 +5,8 @@
5
5
  * Aligned with OpenClaw's validate-sandbox-security.ts blocked-path approach.
6
6
  */
7
7
  import type { PathValidationResult } from './types.js';
8
+ export declare function getBlockedPaths(): string[];
9
+ export declare function containsBlockedCredentialSegment(target: string): string | null;
8
10
  /**
9
11
  * Validate that a path does not escape into blocked system/credential directories.
10
12
  *
@@ -1,6 +1,6 @@
1
1
  import { homedir } from "node:os";
2
2
  import { isAbsolute, normalize, posix, resolve, sep } from "node:path";
3
- import { realpathSync } from "node:fs";
3
+ import { lstatSync, realpathSync } from "node:fs";
4
4
  //#region src/agent/sandbox/path-policy.ts
5
5
  /**
6
6
  * Path safety validation for sandbox isolation.
@@ -52,6 +52,23 @@ function getBlockedPaths() {
52
52
  process.env.USERPROFILE
53
53
  ].filter((home) => Boolean(home && home !== "/")));
54
54
  for (const home of homes) for (const sub of BLOCKED_HOME_SUBPATHS) blocked.add(normalizePosixPath(resolvePolicyPath(`${home}/${sub}`)));
55
+ for (const path of [
56
+ process.env.XOPC_CONFIG_PATH,
57
+ process.env.XOPC_CONFIG,
58
+ ...[
59
+ "",
60
+ "-wal",
61
+ "-shm",
62
+ "-journal"
63
+ ].map((suffix) => process.env.XOPC_STATE_DIR ? resolve(process.env.XOPC_STATE_DIR, `xopc.db${suffix}`) : void 0)
64
+ ]) {
65
+ if (!path) continue;
66
+ const resolved = resolvePolicyPath(path);
67
+ blocked.add(normalizePosixPath(resolved));
68
+ try {
69
+ blocked.add(normalizePosixPath(realpathSync(resolved)));
70
+ } catch {}
71
+ }
55
72
  return [...blocked];
56
73
  }
57
74
  /**
@@ -70,6 +87,8 @@ function containsBlockedCredentialSegment(target) {
70
87
  const prefix = `/${sub.replace(/\\/g, "/")}`;
71
88
  if (normalized.endsWith(prefix) || normalized.includes(`${prefix}/`)) return sub;
72
89
  }
90
+ if (/(?:^|\/)\.xopc\/(?:xopc\.json|xopc\.db(?:-[^/]*)?)(?:\/|$)/.test(normalized)) return ".xopc config/state";
91
+ if (/(?:^|\/)\.env(?:\.[^/]*)?(?:\/|$)/.test(normalized)) return ".env";
73
92
  return null;
74
93
  }
75
94
  /**
@@ -80,20 +99,16 @@ function containsBlockedCredentialSegment(target) {
80
99
  function resolveCanonicalPath(targetPath) {
81
100
  try {
82
101
  return realpathSync(targetPath);
83
- } catch {
84
- const segments = targetPath.split(sep);
85
- let resolved = segments[0] === "" ? "/" : segments[0];
86
- let unresolved = "";
87
- for (let i = 1; i < segments.length; i++) {
88
- const candidate = resolve(resolved, segments[i]);
89
- try {
90
- resolved = realpathSync(candidate);
91
- } catch {
92
- unresolved = segments.slice(i).join("/");
93
- break;
94
- }
102
+ } catch (error) {
103
+ if (error.code !== "ENOENT") throw error;
104
+ try {
105
+ if (lstatSync(targetPath).isSymbolicLink()) throw new Error("Unresolvable symbolic link");
106
+ } catch (statError) {
107
+ if (statError.code !== "ENOENT") throw statError;
95
108
  }
96
- return unresolved ? `${resolved}/${unresolved}` : resolved;
109
+ const parent = resolve(targetPath, "..");
110
+ if (parent === targetPath) throw error;
111
+ return resolve(resolveCanonicalPath(parent), targetPath.split(sep).at(-1));
97
112
  }
98
113
  }
99
114
  /**
@@ -134,7 +149,21 @@ function validatePath(rawPath, options) {
134
149
  };
135
150
  }
136
151
  }
137
- const canonicalNormalized = normalizePosixPath(resolveCanonicalPath(target));
152
+ let canonical;
153
+ try {
154
+ canonical = resolveCanonicalPath(target);
155
+ } catch {
156
+ return {
157
+ allowed: false,
158
+ reason: "Cannot safely resolve path"
159
+ };
160
+ }
161
+ const canonicalNormalized = normalizePosixPath(canonical);
162
+ const canonicalCredential = containsBlockedCredentialSegment(canonicalNormalized);
163
+ if (canonicalCredential) return {
164
+ allowed: false,
165
+ reason: `Path resolves to protected credential path: ${canonicalCredential}`
166
+ };
138
167
  if (canonicalNormalized !== target) {
139
168
  for (const blocked of blockedPaths) if (isPathInsideOrEqual(blocked, canonicalNormalized)) return {
140
169
  allowed: false,
@@ -142,7 +171,15 @@ function validatePath(rawPath, options) {
142
171
  };
143
172
  }
144
173
  if (options?.allowedRoots && options.allowedRoots.length > 0) {
145
- const normalizedRoots = options.allowedRoots.map((r) => normalizePosixPath(resolveCanonicalPath(resolvePolicyPath(r))));
174
+ let normalizedRoots;
175
+ try {
176
+ normalizedRoots = options.allowedRoots.map((r) => normalizePosixPath(resolveCanonicalPath(resolvePolicyPath(r))));
177
+ } catch {
178
+ return {
179
+ allowed: false,
180
+ reason: "Cannot safely resolve allowed roots"
181
+ };
182
+ }
146
183
  if (!normalizedRoots.some((root) => isPathInsideOrEqual(root, canonicalNormalized))) return {
147
184
  allowed: false,
148
185
  reason: `Path is outside allowed roots: ${normalizedRoots.join(", ")}`
@@ -173,4 +210,4 @@ function validateWritePath(rawPath, workspaceRoot, options) {
173
210
  return validatePath(resolvedPath, options);
174
211
  }
175
212
  //#endregion
176
- export { validatePath, validateWritePath };
213
+ export { containsBlockedCredentialSegment, getBlockedPaths, validatePath, validateWritePath };
@@ -1,3 +1,4 @@
1
+ import { isDangerousHostEnvVarName } from "../../infra/host-env-security.js";
1
2
  //#region src/agent/sandbox/sanitize-env-vars.ts
2
3
  /**
3
4
  * Filters process environment before passing it to child processes (e.g. exec_command)
@@ -21,10 +22,10 @@ function isDangerousEnvVar(key) {
21
22
  const upperKey = key.toUpperCase();
22
23
  return BLOCKED_ENV_VAR_PATTERNS.some((pattern) => pattern.test(upperKey));
23
24
  }
24
- function validateEnvVarValue(key, value) {
25
+ function validateEnvVarValue(key, value, allowCredentialData = false) {
25
26
  if (value.includes("\0")) return `Environment variable ${key} contains null bytes`;
26
27
  if (value.length > MAX_ENV_VAR_LENGTH) return `Environment variable ${key} exceeds maximum length (${MAX_ENV_VAR_LENGTH})`;
27
- if (/^[A-Za-z0-9+/=]{80,}$/.test(value)) return `Environment variable ${key} looks like base64-encoded credential data`;
28
+ if (!allowCredentialData && /^[A-Za-z0-9+/=]{80,}$/.test(value)) return `Environment variable ${key} looks like base64-encoded credential data`;
28
29
  return null;
29
30
  }
30
31
  function sanitizeEnvVars(env, options) {
@@ -35,17 +36,17 @@ function sanitizeEnvVars(env, options) {
35
36
  const customBlocked = options?.customBlocked ?? [];
36
37
  for (const [key, value] of Object.entries(env)) {
37
38
  if (value === void 0) continue;
38
- if (allowedVars.has(key)) {
39
- safe[key] = value;
39
+ const warning = validateEnvVarValue(key, value, allowedVars.has(key));
40
+ if (warning) {
41
+ warnings.push(warning);
40
42
  continue;
41
43
  }
42
- if (isDangerousEnvVar(key) || customBlocked.some((pattern) => pattern.test(key))) {
44
+ if (isDangerousHostEnvVarName(key)) {
43
45
  blocked.push(key);
44
46
  continue;
45
47
  }
46
- const warning = validateEnvVarValue(key, value);
47
- if (warning) {
48
- warnings.push(warning);
48
+ if (!allowedVars.has(key) && (isDangerousEnvVar(key) || customBlocked.some((pattern) => pattern.test(key)))) {
49
+ blocked.push(key);
49
50
  continue;
50
51
  }
51
52
  safe[key] = value;
@@ -63,7 +64,7 @@ function prepareSafeToolEnv(baseEnv, options) {
63
64
  const { safe } = sanitizeEnvVars(baseEnv, options);
64
65
  return {
65
66
  ...safe,
66
- HOME: typeof baseEnv.HOME === "string" && baseEnv.HOME ? baseEnv.HOME : safe.HOME || "/tmp"
67
+ HOME: safe.HOME || "/tmp"
67
68
  };
68
69
  }
69
70
  //#endregion
@@ -1,16 +1,16 @@
1
1
  import { getClarificationResumeInput } from "../../storage/sqlite/clarification-wait-repository.js";
2
2
  import { getConnectionResumeInput } from "../../storage/sqlite/connection-wait-repository.js";
3
- import { resolveImageHandlingStrategy } from "../image/vision-detection.js";
4
- import { hydrateUserTurnForLlm } from "../inbound/attachment-pipeline.js";
5
- import { buildTaskExecutionDirective } from "../../tasks/task-context-assembler.js";
6
- import { prependAgentContext } from "../context/prepend.js";
7
- import { extractAgentUserPlainText } from "../memory/user-message-text.js";
8
- import { shouldSkipResetOverlapCommand } from "../../session/reset-triggers.js";
9
3
  import { parseSlashCommand } from "../../chat-commands/command-parse.js";
10
4
  import { commandRegistry } from "../../chat-commands/registry.js";
11
5
  import "../../chat-commands/index.js";
6
+ import { shouldSkipResetOverlapCommand } from "../../session/reset-triggers.js";
7
+ import { resolveImageHandlingStrategy } from "../image/vision-detection.js";
8
+ import { hydrateUserTurnForLlm } from "../inbound/attachment-pipeline.js";
12
9
  import { runEmbeddedTurnForSession } from "../embedded/run-for-session.js";
13
10
  import { injectSourceContextsIntoUserMessage } from "../source-context/injector.js";
11
+ import { extractAgentUserPlainText } from "../memory/user-message-text.js";
12
+ import { buildTaskExecutionDirective } from "../../tasks/task-context-assembler.js";
13
+ import { prependAgentContext } from "../context/prepend.js";
14
14
  import crypto from "node:crypto";
15
15
  //#region src/agent/service/direct-turn-helpers.ts
16
16
  /**
@@ -1,6 +1,6 @@
1
- import { clearPendingTranscriptUserMessage, setPendingTranscriptUserMessage } from "../inbound/attachment-pipeline.js";
2
1
  import { initSessionTurn } from "../../session/init-session-turn.js";
3
2
  import "../../session/index.js";
3
+ import { clearPendingTranscriptUserMessage, setPendingTranscriptUserMessage } from "../inbound/attachment-pipeline.js";
4
4
  import { buildDirectUserMessageContent } from "./build-direct-message-content.js";
5
5
  import { hydratePerTurnState, runDirectAgentTurn, tryRunSlashCommand } from "./direct-turn-helpers.js";
6
6
  //#region src/agent/service/process-direct-one-shot.ts
@@ -1,16 +1,16 @@
1
1
  import { getClarificationResumeInput } from "../../storage/sqlite/clarification-wait-repository.js";
2
2
  import { getConnectionResumeInput } from "../../storage/sqlite/connection-wait-repository.js";
3
+ import { mergeSttConfigFromAppConfig } from "../../voice/stt/config.js";
4
+ import "../../voice/stt/index.js";
3
5
  import { readAgentMessageContent } from "../memory/agent-message-access.js";
4
- import { abortEmbeddedRun } from "../embedded/runs.js";
5
- import { clearPendingTranscriptUserMessage, setPendingTranscriptUserMessage } from "../inbound/attachment-pipeline.js";
6
- import { formatAgentRunErrorForClient } from "../client-error-format.js";
7
6
  import { resolveConfiguredActivityDetailDefault, resolveEffectiveReasoningLevel } from "../../session/thinking-resolve.js";
8
7
  import { initSessionTurn } from "../../session/init-session-turn.js";
9
8
  import "../../session/index.js";
10
- import { mergeSttConfigFromAppConfig } from "../../voice/stt/config.js";
11
- import "../../voice/stt/index.js";
9
+ import { abortEmbeddedRun } from "../embedded/runs.js";
10
+ import { clearPendingTranscriptUserMessage, setPendingTranscriptUserMessage } from "../inbound/attachment-pipeline.js";
12
11
  import { isVoiceLikeAttachment, mergeVoiceTranscriptsIntoUserText } from "../../channels/attachments/voice-stt-webchat.js";
13
12
  import { applyReasoningVisibility } from "../streaming/reasoning-visibility.js";
13
+ import { formatAgentRunErrorForClient } from "../client-error-format.js";
14
14
  import { isSessionSourceBinding, summarizeSourceContext } from "../source-context/types.js";
15
15
  import { injectSourceContextsIntoUserMessage } from "../source-context/injector.js";
16
16
  import { AsyncQueue, AsyncQueueOverflowError } from "./async-queue.js";
@@ -1,10 +1,10 @@
1
1
  import { isTTSAvailable } from "../../voice/tts/factory.js";
2
- import { speak } from "../../voice/tts/speak-core.js";
3
2
  import { mergeTtsConfigFromAppConfig } from "../../voice/tts/merge-config.js";
4
3
  import { getChannelOutputFormat, shouldUseTTS } from "../../voice/tts/service.js";
4
+ import { speak } from "../../voice/tts/speak-core.js";
5
5
  import { compressAudio } from "../../voice/tts/audio.js";
6
- import { persistOutboundTtsAudio } from "../../channels/attachments/outbound-tts-persist.js";
7
6
  import "../../voice/tts/index.js";
7
+ import { persistOutboundTtsAudio } from "../../channels/attachments/outbound-tts-persist.js";
8
8
  //#region src/agent/service/webchat-tts.ts
9
9
  /** True when the explicit TTS tool already produced durable Webchat audio. */
10
10
  function isSuccessfulWebchatTtsToolEvent(event) {
@@ -2,40 +2,32 @@ import { createLogger } from "../utils/logger/index.js";
2
2
  import { init_logger } from "../utils/logger.js";
3
3
  import { parseNoteAttachmentTarget } from "../notes/attachment-ref.js";
4
4
  import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
5
- import { applyConfigOverrides } from "../config/runtime-overrides.js";
6
5
  import { init_agent_scope, resolveAgentHomeDir, resolveDefaultAgentId } from "./agent-scope.js";
7
- import { extractProfileAgentId } from "../config/agent-profile.js";
8
6
  import { init_providers, resolveModel } from "../providers/index.js";
9
- import { extractTextContent } from "./context/workspace.js";
10
- import { effectiveWorkspacePathForSession } from "../session/session-workspace.js";
11
- import { getProjectForSession } from "../projects/workspace.js";
12
- import { runWithEmbeddedExecutionSession } from "./embedded/execution-context.js";
13
- import { resolveWorkspaceSkillsDir, resolveWorkspaceSkillsLockPath } from "./skills/workspace-skills-dir.js";
14
7
  import { removeSkillsLockEntry } from "./skills/hub-lock.js";
15
8
  import { installSkillFromZip } from "./skills/managed-store.js";
16
- import { pullSkillFromSource } from "./skills/hub-pull.js";
9
+ import { extractProfileAgentId } from "../config/agent-profile.js";
10
+ import { effectiveWorkspacePathForSession } from "../session/session-workspace.js";
11
+ import { getProjectForSession } from "../projects/workspace.js";
17
12
  import { getUserTimezone } from "../user-model/repository.js";
18
13
  import "../user-model/index.js";
19
- import { resolveAgentTurnTimeoutMs } from "./orchestration/run-agent-turn-with-timeout.js";
20
- import { onSessionTranscriptUpdate } from "../session/transcript-events.js";
21
- import { persistInboundAttachments } from "../channels/attachments/inbound-persist.js";
22
- import { buildTranscriptUserMessage, hydrateUserTurnForLlm } from "./inbound/attachment-pipeline.js";
23
- import { runXopcEmbeddedTurn } from "./embedded/run-turn.js";
24
- import { resolveResponseLanguageForSession } from "./prompt/response-language.js";
25
- import { normalizeSkillInstallTarget } from "./skills/install-target.js";
26
- import { AgentManager } from "./agent-manager.js";
14
+ import { initializeCommands } from "../chat-commands/index.js";
15
+ import { applyConfigOverrides } from "../config/runtime-overrides.js";
16
+ import { ExtensionHookRunner } from "../extensions/hooks.js";
17
+ import "../extensions/index.js";
18
+ import { resolveWorkspaceSkillsDir, resolveWorkspaceSkillsLockPath } from "./skills/workspace-skills-dir.js";
19
+ import { pullSkillFromSource } from "./skills/hub-pull.js";
20
+ import { extractTextContent } from "./context/workspace.js";
27
21
  import { MAX_WEBCHAT_ATTACHMENT_FILE_BYTES } from "../gateway/chat-limits.js";
28
22
  import { maybeRefineSessionTitleWithLlm, maybeSetProvisionalSessionTitle } from "../session/session-title.js";
29
23
  import { resolveCompactionPolicy } from "./memory/compaction-policy.js";
30
24
  import { SessionStore } from "../session/store.js";
25
+ import { onSessionTranscriptUpdate } from "../session/transcript-events.js";
31
26
  import { SessionConfigStore } from "../session/config-store.js";
32
27
  import "../session/index.js";
33
- import { ExtensionHookRunner } from "../extensions/hooks.js";
34
- import "../extensions/index.js";
35
28
  import { SessionTracker } from "./session/tracker.js";
36
29
  import { ModelManager } from "./models/manager.js";
37
30
  import "./models/index.js";
38
- import { initializeCommands } from "../chat-commands/index.js";
39
31
  import { HookHandler } from "./lifecycle/hook-handler.js";
40
32
  import { ToolErrorTracker } from "./tools/error-tracker.js";
41
33
  import { RequestLimiter } from "./models/request-limiter.js";
@@ -47,6 +39,11 @@ import { ContextMiddleware } from "./middleware/context.js";
47
39
  import "./middleware/index.js";
48
40
  import { LifecycleManager } from "./lifecycle/manager.js";
49
41
  import "./lifecycle/index.js";
42
+ import { resolveAgentTurnTimeoutMs } from "./orchestration/run-agent-turn-with-timeout.js";
43
+ import { persistInboundAttachments } from "../channels/attachments/inbound-persist.js";
44
+ import { buildTranscriptUserMessage, hydrateUserTurnForLlm } from "./inbound/attachment-pipeline.js";
45
+ import { runXopcEmbeddedTurn } from "./embedded/run-turn.js";
46
+ import { runWithEmbeddedExecutionSession } from "./embedded/execution-context.js";
50
47
  import { MessageRouter } from "./messaging/message-router.js";
51
48
  import { CommandHandler } from "./messaging/command-handler.js";
52
49
  import { StreamManager } from "./messaging/stream-manager.js";
@@ -65,7 +62,10 @@ import { AgentOrchestrator } from "./orchestration/agent-orchestrator.js";
65
62
  import { AgentEventHandler } from "./orchestration/agent-event-handler.js";
66
63
  import "./orchestration/index.js";
67
64
  import { getWorkflowProgressBroker } from "./workflow/progress-broker.js";
65
+ import { resolveResponseLanguageForSession } from "./prompt/response-language.js";
68
66
  import "./workflow/index.js";
67
+ import { normalizeSkillInstallTarget } from "./skills/install-target.js";
68
+ import { AgentManager } from "./agent-manager.js";
69
69
  import { TaskJudgeService } from "./tasks/task-judge-service.js";
70
70
  import { analyzeResponseLanguage } from "../i18n/language-consistency.js";
71
71
  import { readFile } from "node:fs/promises";
@@ -1,8 +1,8 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
3
  import { init_workspace_defaults, resolveDefaultAgentWorkspaceDir } from "../../config/workspace-defaults.js";
4
- import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
5
4
  import { init_providers, resolveModel } from "../../providers/index.js";
5
+ import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
6
6
  import { getExecutionEnvironmentForSession } from "../../execution-environments/subject.js";
7
7
  import { effectiveWorkspacePathForSession, projectWorkspacePath } from "../../session/session-workspace.js";
8
8
  import { getProjectForSession } from "../../projects/workspace.js";
@@ -2,10 +2,10 @@ import { resolveStateDir } from "../../config/paths-state.js";
2
2
  import { createLogger } from "../../utils/logger/index.js";
3
3
  import { init_logger } from "../../utils/logger.js";
4
4
  import { init_paths, resolveSkillsDir } from "../../config/paths.js";
5
+ import { isManagedSkillTransientDirName } from "./managed-store.js";
5
6
  import { createSkillConfigManager } from "./config.js";
6
7
  import { resolveWorkspaceSkillsDir } from "./workspace-skills-dir.js";
7
8
  import { resolveAgentsSkillsDir, resolveWorkspaceAgentsSkillsDir } from "./skill-sources.js";
8
- import { isManagedSkillTransientDirName } from "./managed-store.js";
9
9
  import path from "node:path";
10
10
  import chokidar from "chokidar";
11
11
  //#region src/agent/skills/filesystem-watcher.ts
@@ -1,5 +1,5 @@
1
- import { init_paths, resolveSkillsLockPath } from "../../config/paths.js";
2
1
  import { init_write_file_atomic, writeTextAtomicSync } from "../../infra/write-file-atomic.js";
2
+ import { init_paths, resolveSkillsLockPath } from "../../config/paths.js";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  //#region src/agent/skills/hub-lock.ts
5
5
  /**
@@ -1,15 +1,15 @@
1
1
  import { parseFrontmatter } from "../../markdown/frontmatter.js";
2
- import { formatScanSummary, scanSkillDirectory } from "./scanner.js";
3
- import { computeSkillTreeHashSync } from "./hub-hash.js";
4
2
  import { getSkillsLockEntry, recordSkillsHubInstall } from "./hub-lock.js";
5
3
  import { installSkillFromZip, isIgnorableZipEntry, isValidSkillId, prepareManagedSkillTempDir, promoteManagedSkillTempDir } from "./managed-store.js";
4
+ import { formatScanSummary, scanSkillDirectory } from "./scanner.js";
5
+ import { computeSkillTreeHashSync } from "./hub-hash.js";
6
6
  import { tmpdir } from "node:os";
7
7
  import { basename, dirname, join, normalize, resolve, sep } from "node:path";
8
8
  import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
9
9
  import { fileURLToPath } from "node:url";
10
10
  import { execFileSync } from "node:child_process";
11
- import { fetch } from "undici";
12
11
  import AdmZip from "adm-zip";
12
+ import { fetch } from "undici";
13
13
  //#region src/agent/skills/hub-pull.ts
14
14
  /**
15
15
  * CLI / hub: install or update skills from git or archive (zip / tar.gz) into ~/.xopc/skills.
@@ -1,6 +1,6 @@
1
+ import { downloadSkillZipBuffer, fetchMarketplacePackageDetail, listSkillCategories, listSkillPackages, resolveSkillZipDownloadUrl, resolveSkillsStoreBaseUrl, skillIdForMarketplaceInstall, verifyStoreArtifactSha256 } from "./store-api-client.js";
1
2
  import { registerMarketplaceAdapter } from "../../registry.js";
2
3
  import { buildSkillMarkdownPreviewFromRaw } from "../../../skill-markdown-preview-from-raw.js";
3
- import { downloadSkillZipBuffer, fetchMarketplacePackageDetail, listSkillCategories, listSkillPackages, resolveSkillZipDownloadUrl, resolveSkillsStoreBaseUrl, skillIdForMarketplaceInstall, verifyStoreArtifactSha256 } from "./store-api-client.js";
4
4
  //#region src/agent/skills/marketplace/adapters/store/adapter.ts
5
5
  const storeMarketplaceAdapter = {
6
6
  id: "store",
@@ -1,6 +1,6 @@
1
1
  import { init_resolution, resolveConnectedPlatformEndpoint } from "../../../../../platform/resolution.js";
2
- import { MAX_SKILL_ZIP_BYTES, isValidSkillId } from "../../../managed-store.js";
3
2
  import { MAX_EXTENSION_STORE_ZIP_BYTES } from "../../../../../extensions/store-zip-limits.js";
3
+ import { MAX_SKILL_ZIP_BYTES, isValidSkillId } from "../../../managed-store.js";
4
4
  import { createHash } from "node:crypto";
5
5
  //#region src/agent/skills/marketplace/adapters/store/store-api-client.ts
6
6
  /**
@@ -1,15 +1,15 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
3
  import { TaskRunRepository } from "../../tasks/task-run-repository.js";
4
+ import { extractAssistantText, getAssistantMessageErrorReason, stripCodeFences } from "../../providers/model-response.js";
4
5
  import { getAgentDefaultModelRef, init_schema } from "../../config/schema.js";
5
- import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
6
6
  import { getApiKey, init_providers, resolveModel } from "../../providers/index.js";
7
- import { TaskRepository } from "../../tasks/task-repository.js";
8
- import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
9
- import { readWorkspaceRevision } from "../coding/workspace-revision.js";
10
7
  import { completeWithResolvedCredentials } from "../../providers/model-call.js";
8
+ import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
9
+ import { readWorkspaceRevision } from "../coding/workspace-revision.js";
10
+ import { TaskRepository } from "../../tasks/task-repository.js";
11
11
  import { TaskApplicationService } from "../../tasks/task-application-service.js";
12
- import { extractAssistantText, getAssistantMessageErrorReason, stripCodeFences } from "../../providers/model-response.js";
12
+ import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
13
13
  //#region src/agent/tasks/task-judge-service.ts
14
14
  init_schema();
15
15
  init_providers();
@@ -1,9 +1,7 @@
1
- import { checkFileSafety } from "../prompt/safety.js";
2
- import { resolvePathUnderWorkspace } from "./tool-paths.js";
3
- import { evaluateFilePolicy } from "../sandbox/exec-policy.js";
1
+ import { checkedFilePath, deleteWorkspaceFile, readWorkspaceFile, writeWorkspaceFile } from "../sandbox/fileAccess.js";
4
2
  import { detectLineEnding, generateDiffString, normalizeToLF, restoreLineEndings } from "./edit-diff.js";
5
- import { dirname, relative } from "node:path";
6
- import { mkdir, readFile, rm, stat, writeFile } from "node:fs/promises";
3
+ import { relative } from "node:path";
4
+ import { stat } from "node:fs/promises";
7
5
  import { Type } from "@sinclair/typebox";
8
6
  //#region src/agent/tools/apply-patch.ts
9
7
  const ApplyPatchSchema = Type.Object({ patch: Type.String({ description: [
@@ -128,19 +126,11 @@ function applyHunks(original, hunks, path) {
128
126
  }
129
127
  return content;
130
128
  }
131
- async function readExisting(path) {
132
- return readFile(path, "utf-8");
129
+ async function readExisting(workspace, path) {
130
+ return readWorkspaceFile(workspace, path).toString("utf8");
133
131
  }
134
132
  async function assertWritable(workspace, path) {
135
- const quick = checkFileSafety("write", path);
136
- if (!quick.allowed) throw new Error(quick.message ?? `Cannot write ${path}`);
137
- const policy = evaluateFilePolicy({
138
- operation: "write",
139
- path,
140
- workspaceRoot: workspace
141
- });
142
- if (!policy.allowed) throw new Error(`Sandbox: ${policy.reason}`);
143
- return resolvePathUnderWorkspace(path, workspace);
133
+ return checkedFilePath(workspace, path, "write");
144
134
  }
145
135
  async function pathExists(path) {
146
136
  try {
@@ -178,7 +168,7 @@ async function buildPatchPlan(workspace, parsed) {
178
168
  if (op.kind === "delete") {
179
169
  const target = await assertWritable(workspace, op.path);
180
170
  rememberTarget(target);
181
- const oldContent = await readExisting(target);
171
+ const oldContent = await readExisting(workspace, target);
182
172
  const diff = generateDiffString(oldContent, "", op.path);
183
173
  const counts = countDiff(diff);
184
174
  changes.push({
@@ -193,7 +183,7 @@ async function buildPatchPlan(workspace, parsed) {
193
183
  }
194
184
  const target = await assertWritable(workspace, op.path);
195
185
  rememberTarget(target);
196
- const oldContent = await readExisting(target);
186
+ const oldContent = await readExisting(workspace, target);
197
187
  const lineEnding = detectLineEnding(oldContent);
198
188
  const newContent = restoreLineEndings(applyHunks(normalizeToLF(oldContent), op.hunks, op.path), lineEnding);
199
189
  const destination = op.moveTo ? await assertWritable(workspace, op.moveTo) : target;
@@ -217,33 +207,28 @@ async function buildPatchPlan(workspace, parsed) {
217
207
  }
218
208
  return changes;
219
209
  }
220
- async function commitPatchPlan(changes) {
210
+ async function commitPatchPlan(workspace, changes) {
221
211
  const committed = [];
222
212
  try {
223
213
  for (const change of changes) {
224
214
  committed.push(change);
225
- if (change.kind === "add") {
226
- await mkdir(dirname(change.absolutePath), { recursive: true });
227
- await writeFile(change.absolutePath, change.newContent ?? "", "utf-8");
228
- } else if (change.kind === "delete") await rm(change.absolutePath);
215
+ if (change.kind === "add") writeWorkspaceFile(workspace, change.absolutePath, change.newContent ?? "");
216
+ else if (change.kind === "delete") deleteWorkspaceFile(workspace, change.absolutePath);
229
217
  else {
230
218
  const destination = change.absoluteMoveTo ?? change.absolutePath;
231
- await mkdir(dirname(destination), { recursive: true });
232
- await writeFile(destination, change.newContent ?? "", "utf-8");
233
- if (destination !== change.absolutePath) await rm(change.absolutePath);
219
+ writeWorkspaceFile(workspace, destination, change.newContent ?? "");
220
+ if (destination !== change.absolutePath) deleteWorkspaceFile(workspace, change.absolutePath);
234
221
  }
235
222
  }
236
223
  } catch (error) {
237
224
  for (const change of committed.reverse()) try {
238
- if (change.kind === "add") await rm(change.absolutePath, { force: true });
239
- else if (change.kind === "delete") {
240
- await mkdir(dirname(change.absolutePath), { recursive: true });
241
- await writeFile(change.absolutePath, change.oldContent ?? "", "utf-8");
242
- } else if (change.absoluteMoveTo) {
243
- await rm(change.absoluteMoveTo, { force: true });
244
- await mkdir(dirname(change.absolutePath), { recursive: true });
245
- await writeFile(change.absolutePath, change.oldContent ?? "", "utf-8");
246
- } else await writeFile(change.absolutePath, change.oldContent ?? "", "utf-8");
225
+ if (change.kind === "add") {
226
+ if (await pathExists(change.absolutePath)) deleteWorkspaceFile(workspace, change.absolutePath);
227
+ } else if (change.kind === "delete") writeWorkspaceFile(workspace, change.absolutePath, change.oldContent ?? "");
228
+ else if (change.absoluteMoveTo) {
229
+ if (await pathExists(change.absoluteMoveTo)) deleteWorkspaceFile(workspace, change.absoluteMoveTo);
230
+ writeWorkspaceFile(workspace, change.absolutePath, change.oldContent ?? "");
231
+ } else writeWorkspaceFile(workspace, change.absolutePath, change.oldContent ?? "");
247
232
  } catch {}
248
233
  throw error;
249
234
  }
@@ -262,12 +247,14 @@ function createApplyPatchTool(workspace) {
262
247
  finalGuardRelevant: true,
263
248
  async execute(_toolCallId, params) {
264
249
  try {
265
- const changes = await buildPatchPlan(workspace, parsePatch(params.patch ?? ""));
266
- await commitPatchPlan(changes);
250
+ const parsed = parsePatch(params.patch ?? "");
251
+ const canonicalWorkspace = checkedFilePath(workspace, workspace, "write");
252
+ const changes = await buildPatchPlan(canonicalWorkspace, parsed);
253
+ await commitPatchPlan(canonicalWorkspace, changes);
267
254
  const diff = changes.map((change) => change.diff).join("\n");
268
255
  const added = changes.reduce((sum, change) => sum + change.added, 0);
269
256
  const removed = changes.reduce((sum, change) => sum + change.removed, 0);
270
- const files = changes.map((change) => relative(workspace, change.absoluteMoveTo ?? change.absolutePath));
257
+ const files = changes.map((change) => relative(canonicalWorkspace, change.absoluteMoveTo ?? change.absolutePath));
271
258
  const summary = changes.map((change) => {
272
259
  const display = change.moveTo ? `${change.path} -> ${change.moveTo}` : change.path;
273
260
  return `${change.kind}: ${display} (+${change.added}/-${change.removed})`;