@xopcai/xopc 0.0.488 → 0.0.489

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 (499) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/dingtalk/src/index.js +54 -10
  3. package/dist/extensions/discord/src/index.js +39 -6
  4. package/dist/extensions/feishu/src/adapters/cli-login.js +1 -1
  5. package/dist/extensions/feishu/src/adapters/gateway-setup.js +1 -1
  6. package/dist/extensions/feishu/src/outbound/media-load.d.ts +1 -0
  7. package/dist/extensions/feishu/src/outbound/media-load.js +2 -2
  8. package/dist/extensions/feishu/src/outbound/outbound-adapter.js +2 -1
  9. package/dist/extensions/feishu/src/pairing/feishu-pairing-prompt.js +1 -1
  10. package/dist/extensions/feishu/src/plugin.js +1 -1
  11. package/dist/extensions/feishu/src/streaming/streaming-adapter.js +1 -1
  12. package/dist/extensions/feishu/src/transport/client/install-sdk.js +2 -2
  13. package/dist/extensions/feishu/src/transport/reliability/message-ingress.js +3 -3
  14. package/dist/extensions/feishu/src/transport/socket-mode/monitor.js +1 -1
  15. package/dist/extensions/slack/src/index.js +51 -1
  16. package/dist/extensions/slack/src/manifest.js +1 -0
  17. package/dist/extensions/telegram/src/adapters/outbound-adapter.js +6 -1
  18. package/dist/extensions/telegram/src/adapters/streaming-adapter.js +3 -3
  19. package/dist/extensions/telegram/src/doctor.js +2 -2
  20. package/dist/extensions/telegram/src/draft-stream.js +1 -1
  21. package/dist/extensions/telegram/src/exec-approval-handler.js +1 -1
  22. package/dist/extensions/telegram/src/focus-handler.js +1 -1
  23. package/dist/extensions/telegram/src/inbound-processor.js +7 -7
  24. package/dist/extensions/telegram/src/outbound-sender.js +6 -5
  25. package/dist/extensions/telegram/src/plugin.js +23 -23
  26. package/dist/extensions/telegram/xopc.extension.json +1 -1
  27. package/dist/extensions/wecom/src/index.js +82 -6
  28. package/dist/extensions/weixin/src/api/api.js +1 -1
  29. package/dist/extensions/weixin/src/auth/accounts.js +2 -2
  30. package/dist/extensions/weixin/src/auth/pairing.js +1 -1
  31. package/dist/extensions/weixin/src/cdn/upload.js +1 -1
  32. package/dist/extensions/weixin/src/cli/gateway-qr-login.js +1 -1
  33. package/dist/extensions/weixin/src/cli/qr-login.js +2 -2
  34. package/dist/extensions/weixin/src/media/data-url.d.ts +1 -0
  35. package/dist/extensions/weixin/src/media/data-url.js +5 -2
  36. package/dist/extensions/weixin/src/messaging/debug-mode.js +1 -1
  37. package/dist/extensions/weixin/src/messaging/inbound.js +2 -2
  38. package/dist/extensions/weixin/src/messaging/process-message.js +5 -5
  39. package/dist/extensions/weixin/src/messaging/quote-cache.js +1 -1
  40. package/dist/extensions/weixin/src/messaging/send.js +1 -1
  41. package/dist/extensions/weixin/src/monitor/monitor.js +2 -2
  42. package/dist/extensions/weixin/src/outbound-send.js +18 -6
  43. package/dist/extensions/weixin/src/plugin.js +3 -3
  44. package/dist/gateway/server/chunks.bin +1560 -1521
  45. package/dist/gateway/server/chunks.json +1 -1
  46. package/dist/gateway/static/root/assets/{automations-page-DelDZorh.js → automations-page-B3i5x1Lc.js} +1 -1
  47. package/dist/gateway/static/root/assets/{automations-workspace-leY4yCvw.js → automations-workspace-D6-Kk33X.js} +2 -2
  48. package/dist/gateway/static/root/assets/{chat-page-XqG9aYBd.js → chat-page-oy4EGdO1.js} +2 -2
  49. package/dist/gateway/static/root/assets/{home-page-Bxr3V5lc.js → home-page-BmoT_EN4.js} +3 -3
  50. package/dist/gateway/static/root/assets/{home-task-actions-GAO06s1_.js → home-task-actions-Ck0AhcYe.js} +1 -1
  51. package/dist/gateway/static/root/assets/{index-BjU5H5hz.js → index-BiQP7-5r.js} +8 -8
  52. package/dist/gateway/static/root/assets/{note-detail-panel-BTNX68oO.js → note-detail-panel-CYNPJVVE.js} +2 -2
  53. package/dist/gateway/static/root/assets/{notes-page-FocipOyc.js → notes-page-Dpd98vQp.js} +1 -1
  54. package/dist/gateway/static/root/assets/{personal-page-CSc2n5UD.js → personal-page-BfljqOp5.js} +1 -1
  55. package/dist/gateway/static/root/assets/{project-detail-page-CK_EN6Jq.js → project-detail-page-CcnOT_aq.js} +1 -1
  56. package/dist/gateway/static/root/assets/right-workspace-store-DsVm6C0V.js +1 -0
  57. package/dist/gateway/static/root/assets/{route-preload-Ab7Zw-df.js → route-preload-CsBdFJHO.js} +2 -2
  58. package/dist/gateway/static/root/assets/{routine-panel-DzdJGicv.js → routine-panel-pVuJtctD.js} +2 -2
  59. package/dist/gateway/static/root/assets/{settings-page-CzW5GM5r.js → settings-page-BRAijVXZ.js} +1 -1
  60. package/dist/gateway/static/root/assets/{space-page-BCzDsNJd.js → space-page-CUwakPrj.js} +2 -2
  61. package/dist/gateway/static/root/assets/{task-detail-page-B_YXsT9W.js → task-detail-page-Cvx-XtFO.js} +1 -1
  62. package/dist/gateway/static/root/assets/{task-header-title-bZVPIbyR.js → task-header-title-DHb7z-hq.js} +1 -1
  63. package/dist/gateway/static/root/assets/{task-run-issue-notice-BXOES2t9.js → task-run-issue-notice-CqjS8_gi.js} +1 -1
  64. package/dist/gateway/static/root/assets/{use-composer-attachments-DWiIdMIi.js → use-composer-attachments-CQwCTKAp.js} +1 -1
  65. package/dist/gateway/static/root/assets/{use-personal-work-D0tMU1bP.js → use-personal-work-fvvZDK_7.js} +1 -1
  66. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-DPHnm_7A.js → workspace-file-preview-dialog-DdVyIRKm.js} +1 -1
  67. package/dist/gateway/static/root/index.html +9 -9
  68. package/dist/package.js +1 -1
  69. package/dist/src/activity/emitter.js +1 -1
  70. package/dist/src/agent/agent-manager.js +8 -8
  71. package/dist/src/agent/background-review/prompts.js +1 -1
  72. package/dist/src/agent/background-review/run-background-review.js +3 -3
  73. package/dist/src/agent/coding/repository-instructions.js +1 -1
  74. package/dist/src/agent/coding/workspace-revision.js +1 -1
  75. package/dist/src/agent/commands/command-isolation.js +1 -1
  76. package/dist/src/agent/commands/command-registry.js +1 -1
  77. package/dist/src/agent/context/execution-context.js +2 -2
  78. package/dist/src/agent/context/workspace-seed.js +1 -1
  79. package/dist/src/agent/data-acquisition/git.js +1 -1
  80. package/dist/src/agent/data-acquisition/service.js +1 -1
  81. package/dist/src/agent/embedded/codemode-output.js +2 -2
  82. package/dist/src/agent/embedded/execution-tool-policy.js +1 -1
  83. package/dist/src/agent/embedded/model-runtime.js +1 -1
  84. package/dist/src/agent/embedded/run-for-session.js +6 -6
  85. package/dist/src/agent/embedded/run-turn.js +76 -17
  86. package/dist/src/agent/embedded/runs.js +1 -1
  87. package/dist/src/agent/embedded/session-runner.js +2 -1
  88. package/dist/src/agent/embedded/types.d.ts +1 -1
  89. package/dist/src/agent/embedded/xopc-stream-bridge.js +3 -3
  90. package/dist/src/agent/external-tools/endpoint-provider.js +1 -1
  91. package/dist/src/agent/external-tools/index.js +1 -1
  92. package/dist/src/agent/image/generation/providers/xopc-cloud.js +2 -2
  93. package/dist/src/agent/image/load-image-media.js +2 -2
  94. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  95. package/dist/src/agent/inbound/inbound-loop.js +6 -1
  96. package/dist/src/agent/independent-execution.js +2 -2
  97. package/dist/src/agent/mcp/connection-drafts.js +2 -2
  98. package/dist/src/agent/mcp/connection-setup.js +1 -1
  99. package/dist/src/agent/mcp/conversation-setup.js +1 -1
  100. package/dist/src/agent/mcp/discovery.js +1 -1
  101. package/dist/src/agent/mcp/transport.js +1 -1
  102. package/dist/src/agent/mcp/weixin-setup-scope.js +2 -2
  103. package/dist/src/agent/messaging/command-handler.js +1 -1
  104. package/dist/src/agent/prompt/response-language.js +1 -1
  105. package/dist/src/agent/prompt/sections/tooling.d.ts +1 -0
  106. package/dist/src/agent/prompt/sections/tooling.js +7 -2
  107. package/dist/src/agent/prompt/service-prompt-builder.js +1 -1
  108. package/dist/src/agent/prompt/system-prompt-params.js +1 -1
  109. package/dist/src/agent/prompt/system-prompt.js +1 -0
  110. package/dist/src/agent/sandbox/exec-policy.js +1 -1
  111. package/dist/src/agent/sandbox/native-command.js +1 -1
  112. package/dist/src/agent/sandbox/path-policy.js +1 -1
  113. package/dist/src/agent/service/direct-turn-helpers.js +3 -3
  114. package/dist/src/agent/service/process-direct-streaming.js +2 -2
  115. package/dist/src/agent/service.js +7 -5
  116. package/dist/src/agent/session/session-config-service.js +1 -1
  117. package/dist/src/agent/skills/hub-hash.js +1 -1
  118. package/dist/src/agent/skills/hub-lock.js +1 -1
  119. package/dist/src/agent/skills/hub-pull.js +3 -3
  120. package/dist/src/agent/skills/index.js +1 -1
  121. package/dist/src/agent/skills/managed-store.js +1 -1
  122. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  123. package/dist/src/agent/skills/skill-sources.js +1 -1
  124. package/dist/src/agent/tools/browser/tool/browser-use-tool.js +48 -2
  125. package/dist/src/agent/tools/browser/tool/schemas.d.ts +2 -1
  126. package/dist/src/agent/tools/browser/tool/schemas.js +6 -0
  127. package/dist/src/agent/tools/communication.d.ts +1 -0
  128. package/dist/src/agent/tools/communication.js +10 -3
  129. package/dist/src/agent/tools/delegate-tool.js +1 -1
  130. package/dist/src/agent/tools/exec-command.js +1 -1
  131. package/dist/src/agent/tools/executor.js +1 -1
  132. package/dist/src/agent/tools/factory.js +13 -4
  133. package/dist/src/agent/tools/fetch-text.js +1 -1
  134. package/dist/src/agent/tools/image-generate-tool.d.ts +7 -0
  135. package/dist/src/agent/tools/image-generate-tool.js +21 -1
  136. package/dist/src/agent/tools/managed-job-tool.js +1 -1
  137. package/dist/src/agent/tools/personal-attention-tool.js +1 -1
  138. package/dist/src/agent/tools/personal-memory-tool.js +3 -3
  139. package/dist/src/agent/tools/publish-artifacts.js +1 -1
  140. package/dist/src/agent/tools/read.js +1 -1
  141. package/dist/src/agent/tools/review-workspace.js +2 -2
  142. package/dist/src/agent/tools/scoped-workspace-tools.js +1 -1
  143. package/dist/src/agent/tools/send-media.d.ts +1 -0
  144. package/dist/src/agent/tools/send-media.js +7 -4
  145. package/dist/src/agent/tools/task-collaboration-tool.js +2 -2
  146. package/dist/src/agent/tools/tool-media.d.ts +1 -0
  147. package/dist/src/agent/tools/tool-media.js +14 -1
  148. package/dist/src/agent/tools/user-context-tool.js +2 -2
  149. package/dist/src/agent/tools/web-extract.js +1 -1
  150. package/dist/src/agent/tools/write.js +1 -1
  151. package/dist/src/agent/tools/xopc-use-tool.js +6 -6
  152. package/dist/src/agent-catalog/repository.js +1 -1
  153. package/dist/src/auth/credentials.js +1 -1
  154. package/dist/src/auth/oauth/openai.js +1 -1
  155. package/dist/src/auth/oauth/xopc-cloud.js +2 -2
  156. package/dist/src/auth/oauth-provider-lock.js +1 -1
  157. package/dist/src/auth/profiles/store.js +1 -1
  158. package/dist/src/automations/delivery/delivery-router.js +1 -1
  159. package/dist/src/automations/service/action-executor.js +1 -1
  160. package/dist/src/automations/service/automation-service.js +1 -1
  161. package/dist/src/backup/archive.js +4 -4
  162. package/dist/src/browser/assistance.d.ts +34 -0
  163. package/dist/src/browser/assistance.js +243 -0
  164. package/dist/src/browser/cache-dir-policy.js +1 -1
  165. package/dist/src/browser/drivers/browser-driver.d.ts +44 -0
  166. package/dist/src/browser/drivers/playwright-driver.d.ts +2 -1
  167. package/dist/src/browser/drivers/playwright-driver.js +161 -0
  168. package/dist/src/browser/managed-live-runtime.d.ts +79 -0
  169. package/dist/src/browser/managed-live-runtime.js +313 -0
  170. package/dist/src/browser/native-messaging-host.js +1 -1
  171. package/dist/src/browser/providers/browser-ext-install.js +4 -4
  172. package/dist/src/browser/runtime/browser-runtime.d.ts +18 -1
  173. package/dist/src/browser/runtime/browser-runtime.js +55 -4
  174. package/dist/src/capabilities/capability-catalog.js +2 -2
  175. package/dist/src/capabilities/readiness/from-config.js +2 -2
  176. package/dist/src/capabilities/store-connector.js +1 -1
  177. package/dist/src/channels/attachments/voice-stt-webchat.js +1 -1
  178. package/dist/src/channels/channel-domain.d.ts +1 -0
  179. package/dist/src/channels/enterprise/media.d.ts +14 -0
  180. package/dist/src/channels/enterprise/media.js +208 -0
  181. package/dist/src/channels/enterprise/plugin.d.ts +4 -0
  182. package/dist/src/channels/enterprise/plugin.js +40 -12
  183. package/dist/src/channels/format.js +1 -1
  184. package/dist/src/channels/index.js +2 -2
  185. package/dist/src/channels/internal-outbound.d.ts +2 -0
  186. package/dist/src/channels/internal-outbound.js +17 -1
  187. package/dist/src/channels/lifecycle-supervisor.js +1 -1
  188. package/dist/src/channels/outbound-sender.js +2 -2
  189. package/dist/src/channels/pairing/pairing-service.js +1 -1
  190. package/dist/src/channels/pairing/pairing-store.js +1 -1
  191. package/dist/src/chat-commands/builtins/config.js +2 -2
  192. package/dist/src/chat-commands/builtins/review.js +1 -1
  193. package/dist/src/chat-commands/builtins/session.js +1 -1
  194. package/dist/src/chat-commands/builtins/thinking.js +1 -1
  195. package/dist/src/chat-commands/builtins/tts.js +1 -1
  196. package/dist/src/chat-commands/builtins/understanding.js +1 -1
  197. package/dist/src/chat-commands/context.js +2 -2
  198. package/dist/src/chat-commands/index.js +1 -1
  199. package/dist/src/cli/commands/agent.js +2 -2
  200. package/dist/src/cli/commands/browser-cli-helpers.js +1 -1
  201. package/dist/src/cli/commands/connectors.js +1 -1
  202. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  203. package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
  204. package/dist/src/cli/commands/doctor/checks/image-providers.js +1 -1
  205. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  206. package/dist/src/cli/commands/doctor/checks/tool-runtimes.js +1 -1
  207. package/dist/src/cli/commands/extension-agent-plugin.js +2 -2
  208. package/dist/src/cli/commands/extension-marketplace.js +3 -3
  209. package/dist/src/cli/commands/extension-pack.js +1 -1
  210. package/dist/src/cli/commands/extension.js +1 -1
  211. package/dist/src/cli/commands/mcp.js +1 -1
  212. package/dist/src/cli/commands/models.js +3 -3
  213. package/dist/src/cli/commands/onboard/model.js +2 -2
  214. package/dist/src/cli/commands/onboard.js +1 -1
  215. package/dist/src/cli/commands/project.js +1 -1
  216. package/dist/src/cli/commands/runtime.js +1 -1
  217. package/dist/src/cli/commands/skills.js +1 -1
  218. package/dist/src/cli/commands/tunnel.js +1 -1
  219. package/dist/src/cli/utils/gateway-client.js +1 -1
  220. package/dist/src/cli/utils/init-workspace-core.js +2 -2
  221. package/dist/src/computer/broker.js +1 -1
  222. package/dist/src/computer/runtime.js +2 -2
  223. package/dist/src/config/index.js +3 -3
  224. package/dist/src/config/loader.js +2 -2
  225. package/dist/src/config/models-json.js +1 -1
  226. package/dist/src/config/paths-state.js +1 -1
  227. package/dist/src/config/schema.js +2 -2
  228. package/dist/src/config/workspace-path.js +1 -1
  229. package/dist/src/connectors/cli/installer.js +1 -1
  230. package/dist/src/connectors/connected-source-ingestion.js +1 -1
  231. package/dist/src/connectors/connected-source-understanding.js +1 -1
  232. package/dist/src/connectors/content-enrichment.js +1 -1
  233. package/dist/src/connectors/health.js +1 -1
  234. package/dist/src/daemon/constants.js +1 -1
  235. package/dist/src/daemon/install-plan.js +1 -1
  236. package/dist/src/daemon/launchd.js +1 -1
  237. package/dist/src/daemon/schtasks.js +1 -1
  238. package/dist/src/daemon/systemd.js +1 -1
  239. package/dist/src/discussions/action-tasks.js +1 -1
  240. package/dist/src/discussions/live-worker.js +2 -2
  241. package/dist/src/discussions/recording.js +2 -2
  242. package/dist/src/discussions/repository.js +1 -1
  243. package/dist/src/discussions/sealer.js +3 -3
  244. package/dist/src/discussions/service.js +1 -1
  245. package/dist/src/endpoint-tools/delegation.js +1 -1
  246. package/dist/src/endpoint-tools/upload-service.js +1 -1
  247. package/dist/src/execution-environments/local-worktree-manager.js +1 -1
  248. package/dist/src/execution-environments/worktree-safety.js +1 -1
  249. package/dist/src/extensions/activation-context.js +2 -2
  250. package/dist/src/extensions/agent-plugins/auth.js +3 -3
  251. package/dist/src/extensions/agent-plugins/branding.js +1 -1
  252. package/dist/src/extensions/agent-plugins/cli-authorization.js +3 -3
  253. package/dist/src/extensions/agent-plugins/credentials.js +1 -1
  254. package/dist/src/extensions/agent-plugins/mcp-adapter.js +2 -2
  255. package/dist/src/extensions/agent-plugins/resources.js +1 -1
  256. package/dist/src/extensions/agent-plugins/setup.js +1 -1
  257. package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
  258. package/dist/src/extensions/agent-plugins/source-catalog.js +2 -2
  259. package/dist/src/extensions/agent-plugins/source-http-fetch.js +1 -1
  260. package/dist/src/extensions/agent-plugins/sources.js +1 -1
  261. package/dist/src/extensions/agent-plugins/store.js +2 -2
  262. package/dist/src/extensions/agent-plugins/user-config.js +2 -2
  263. package/dist/src/extensions/agent-plugins/validation.js +3 -3
  264. package/dist/src/extensions/api.js +2 -2
  265. package/dist/src/extensions/install.js +1 -1
  266. package/dist/src/extensions/loader.js +2 -2
  267. package/dist/src/extensions/lockfile.js +1 -1
  268. package/dist/src/extensions/sdk/index.js +1 -1
  269. package/dist/src/extensions/update.js +2 -2
  270. package/dist/src/files/file-service.js +1 -1
  271. package/dist/src/gateway/agent-reactions/reaction.js +1 -1
  272. package/dist/src/gateway/file-path-classifier.js +1 -1
  273. package/dist/src/gateway/hono/lib/config-payload.js +3 -3
  274. package/dist/src/gateway/hono/lib/static-ui.js +1 -1
  275. package/dist/src/gateway/hono/routes/agent-plugins.js +1 -1
  276. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  277. package/dist/src/gateway/hono/routes/browser.js +261 -3
  278. package/dist/src/gateway/hono/routes/channels.js +1 -1
  279. package/dist/src/gateway/hono/routes/commands-skills.js +1 -1
  280. package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
  281. package/dist/src/gateway/hono/routes/connectors.js +1 -1
  282. package/dist/src/gateway/hono/routes/device-connections.js +1 -1
  283. package/dist/src/gateway/hono/routes/files.js +1 -1
  284. package/dist/src/gateway/hono/routes/host-fs.js +1 -1
  285. package/dist/src/gateway/hono/routes/local-apps.js +1 -1
  286. package/dist/src/gateway/hono/routes/memory-learning.js +1 -1
  287. package/dist/src/gateway/hono/routes/mobile-capability-actions.js +3 -3
  288. package/dist/src/gateway/hono/routes/mobile-capability-panels.js +4 -4
  289. package/dist/src/gateway/hono/routes/mobile-model-settings.js +13 -5
  290. package/dist/src/gateway/hono/routes/models.js +6 -6
  291. package/dist/src/gateway/hono/routes/notes.js +1 -1
  292. package/dist/src/gateway/hono/routes/observability.js +1 -1
  293. package/dist/src/gateway/hono/routes/personal-agent.js +1 -1
  294. package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
  295. package/dist/src/gateway/hono/routes/phone.js +1 -1
  296. package/dist/src/gateway/hono/routes/session-command-handler.js +1 -1
  297. package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
  298. package/dist/src/gateway/hono/routes/sessions.js +2 -2
  299. package/dist/src/gateway/hono/routes/shares.js +1 -1
  300. package/dist/src/gateway/hono/routes/status.js +1 -1
  301. package/dist/src/gateway/hono/routes/tasks.js +1 -1
  302. package/dist/src/gateway/hono/routes/user-model.js +3 -3
  303. package/dist/src/gateway/hono/routes/video-generation.js +1 -1
  304. package/dist/src/gateway/hono/routes/voice.js +4 -4
  305. package/dist/src/gateway/image-generation-setup.js +2 -2
  306. package/dist/src/gateway/lock.js +2 -2
  307. package/dist/src/gateway/mobile-privacy.js +1 -1
  308. package/dist/src/gateway/next-turn-suggestions/snapshot.js +1 -1
  309. package/dist/src/gateway/ports.js +1 -1
  310. package/dist/src/gateway/provider-model-setup.js +1 -1
  311. package/dist/src/gateway/security/device-request-proof.js +1 -1
  312. package/dist/src/gateway/security/gateway-scopes.js +2 -0
  313. package/dist/src/gateway/service/agent-runner.js +2 -2
  314. package/dist/src/gateway/service/config-coordinator.js +2 -2
  315. package/dist/src/gateway/service/run-gateway-agent.js +5 -3
  316. package/dist/src/gateway/service/session-command-service.js +1 -1
  317. package/dist/src/gateway/service/session-input-coordinator.d.ts +1 -0
  318. package/dist/src/gateway/service/session-input-coordinator.js +13 -3
  319. package/dist/src/gateway/service.d.ts +4 -0
  320. package/dist/src/gateway/service.js +42 -17
  321. package/dist/src/gateway/xopc-cloud-capability-setup.js +2 -2
  322. package/dist/src/home-intelligence/follow-ups.js +1 -1
  323. package/dist/src/home-intelligence/host.js +1 -1
  324. package/dist/src/home-intelligence/repository.js +1 -1
  325. package/dist/src/home-intelligence/routines.js +1 -1
  326. package/dist/src/imports/files.js +1 -1
  327. package/dist/src/imports/importService.js +2 -2
  328. package/dist/src/imports/inventory.js +1 -1
  329. package/dist/src/imports/planner.js +1 -1
  330. package/dist/src/imports/productImport.js +1 -1
  331. package/dist/src/imports/scanner.js +1 -1
  332. package/dist/src/imports/sources.js +1 -1
  333. package/dist/src/infra/brew.js +1 -1
  334. package/dist/src/infra/bus/queue.js +1 -1
  335. package/dist/src/infra/package-runtime-check.js +1 -1
  336. package/dist/src/infra/path-env.js +1 -1
  337. package/dist/src/infra/ports.js +1 -1
  338. package/dist/src/infra/process-diagnostics.js +1 -1
  339. package/dist/src/infra/ssh-tunnel.js +1 -1
  340. package/dist/src/infra/update-startup.js +1 -1
  341. package/dist/src/infra/write-file-atomic.js +1 -1
  342. package/dist/src/knowledge-memory/repository.js +1 -1
  343. package/dist/src/knowledge-memory/usage-policy.js +1 -1
  344. package/dist/src/local-apps/artifact-files.js +1 -1
  345. package/dist/src/local-apps/execution-authority.js +1 -1
  346. package/dist/src/local-apps/p1-services.js +1 -1
  347. package/dist/src/local-apps/preview-sessions.js +1 -1
  348. package/dist/src/local-apps/preview-worker.js +1 -1
  349. package/dist/src/local-apps/public-assets.js +1 -1
  350. package/dist/src/local-apps/service.js +3 -3
  351. package/dist/src/local-apps/store.js +1 -1
  352. package/dist/src/markdown/index.js +1 -1
  353. package/dist/src/mcp/connection-grants.js +1 -1
  354. package/dist/src/mcp/delegation.js +3 -3
  355. package/dist/src/mcp/gateway-http-client.js +1 -1
  356. package/dist/src/media/session-references.js +1 -1
  357. package/dist/src/media-shared/http/provider-http.js +1 -1
  358. package/dist/src/media-understanding/runner.js +1 -1
  359. package/dist/src/memory-learning/choice-observations.js +1 -1
  360. package/dist/src/memory-learning/source-learning.js +2 -2
  361. package/dist/src/music-generation/artifact.js +2 -2
  362. package/dist/src/notes/agent-context.js +1 -1
  363. package/dist/src/notes/service.js +1 -1
  364. package/dist/src/notes/store.js +1 -1
  365. package/dist/src/notifications/store.js +1 -1
  366. package/dist/src/observability/runtime.js +1 -1
  367. package/dist/src/personal-agent/proactivity/repository.js +1 -1
  368. package/dist/src/personal-agent/proactivity/routes.js +1 -1
  369. package/dist/src/personal-agent/proactivity/service.js +3 -3
  370. package/dist/src/personal-agent/prompt-context.js +2 -2
  371. package/dist/src/personal-agent/reply-composer.js +4 -4
  372. package/dist/src/personal-agent/reply-style.d.ts +2 -2
  373. package/dist/src/personal-agent/reply-style.js +8 -7
  374. package/dist/src/personal-agent/request-delivery.js +1 -1
  375. package/dist/src/personal-agent/request-service.js +1 -1
  376. package/dist/src/personal-agent/result-reader.js +3 -3
  377. package/dist/src/personal-agent/service.js +1 -1
  378. package/dist/src/personal-agent/unread.js +1 -1
  379. package/dist/src/phone/adb-driver.js +2 -2
  380. package/dist/src/phone/cloud-adb-connection.js +1 -1
  381. package/dist/src/phone/execution-trace.js +1 -1
  382. package/dist/src/phone/hdc-driver.js +2 -2
  383. package/dist/src/phone/hdc-video-tools.js +1 -1
  384. package/dist/src/phone/model-adapter.js +1 -1
  385. package/dist/src/phone/ui-session.js +1 -1
  386. package/dist/src/platform/index.js +1 -1
  387. package/dist/src/project-trust/trust-store.js +1 -1
  388. package/dist/src/projects/workspace-project.js +1 -1
  389. package/dist/src/providers/extension-stream-bridge.js +2 -2
  390. package/dist/src/providers/index.js +4 -4
  391. package/dist/src/providers/model-call.js +3 -3
  392. package/dist/src/providers/model-catalog-persistence.js +2 -2
  393. package/dist/src/providers/model-registry.js +3 -3
  394. package/dist/src/providers/provider-disconnect-core.js +1 -1
  395. package/dist/src/providers/register-runtime-providers.js +1 -1
  396. package/dist/src/providers/setup/voice.js +1 -1
  397. package/dist/src/providers/xopc-cloud-catalog-coordinator.js +1 -1
  398. package/dist/src/providers/xopc-cloud-credit-budget.js +1 -1
  399. package/dist/src/providers/xopc-cloud-model-source.js +1 -1
  400. package/dist/src/review/review-git.js +1 -1
  401. package/dist/src/runtime-tools/downloader.js +1 -1
  402. package/dist/src/runtime-tools/harmony-dependencies.js +1 -1
  403. package/dist/src/runtime-tools/manager.js +2 -2
  404. package/dist/src/runtime-tools/phone-dependencies.js +1 -1
  405. package/dist/src/session/history-recall-policy.js +1 -1
  406. package/dist/src/session/init-session-turn.js +1 -1
  407. package/dist/src/session/resolve-session.js +1 -1
  408. package/dist/src/share/hosted-note-publication.js +1 -1
  409. package/dist/src/share/hosted-session-share.js +1 -1
  410. package/dist/src/share/hosted-static-site-publication.js +1 -1
  411. package/dist/src/share/session-share-service.js +1 -1
  412. package/dist/src/share/share-auto.js +1 -1
  413. package/dist/src/share/share-zip.js +1 -1
  414. package/dist/src/share/site-proxy.js +1 -1
  415. package/dist/src/space/budget-workbook.js +1 -1
  416. package/dist/src/space/ingest.js +1 -1
  417. package/dist/src/space/repository.js +2 -2
  418. package/dist/src/space/workbook-turn.js +1 -1
  419. package/dist/src/space/worker.js +1 -1
  420. package/dist/src/storage/sqlite/ai-usage-repository.js +1 -1
  421. package/dist/src/storage/sqlite/clarification-wait-repository.js +2 -2
  422. package/dist/src/storage/sqlite/connection.js +2 -2
  423. package/dist/src/storage/sqlite/conversation-repository.js +2 -2
  424. package/dist/src/storage/sqlite/desktop-execution-repository.js +1 -1
  425. package/dist/src/storage/sqlite/desktop-execution-stop-repository.js +1 -1
  426. package/dist/src/storage/sqlite/device-access-repository.js +1 -1
  427. package/dist/src/storage/sqlite/device-pairing-approval.js +1 -1
  428. package/dist/src/storage/sqlite/index.js +1 -1
  429. package/dist/src/storage/sqlite/schema-upgrade.js +3 -3
  430. package/dist/src/storage/sqlite/session-creation-repository.js +1 -1
  431. package/dist/src/storage/sqlite/session-input-control-repository.js +1 -1
  432. package/dist/src/storage/sqlite/session-repository.js +1 -1
  433. package/dist/src/support/collect-support-report.js +1 -1
  434. package/dist/src/tasks/capabilities/management.js +1 -1
  435. package/dist/src/tasks/capabilities/relations.js +1 -1
  436. package/dist/src/tasks/delegated-run-result.js +1 -1
  437. package/dist/src/tasks/task-allocation-service.js +2 -2
  438. package/dist/src/tasks/task-application-service.js +1 -1
  439. package/dist/src/tasks/task-context-assembler.js +2 -2
  440. package/dist/src/tasks/task-criterion-review-repository.js +1 -1
  441. package/dist/src/tasks/task-deliverables.js +1 -1
  442. package/dist/src/tasks/task-delivery-checks.js +1 -1
  443. package/dist/src/tasks/task-handoff-service.js +1 -1
  444. package/dist/src/tasks/task-handoff.js +4 -4
  445. package/dist/src/tasks/task-json-acceptance.js +1 -1
  446. package/dist/src/tasks/task-main-update-decision-service.js +1 -1
  447. package/dist/src/tasks/task-origin-repository.js +1 -1
  448. package/dist/src/tasks/task-read-model-projector.js +1 -1
  449. package/dist/src/tasks/task-research-repair.js +2 -2
  450. package/dist/src/tasks/task-research-result.js +3 -3
  451. package/dist/src/tasks/task-result-delivery-repository.js +1 -1
  452. package/dist/src/tasks/task-result-delivery-service.js +2 -2
  453. package/dist/src/tasks/task-run-coordinator.js +3 -3
  454. package/dist/src/tasks/task-run-repository.js +1 -1
  455. package/dist/src/tasks/task-signal-service.js +1 -1
  456. package/dist/src/tasks/task-workspace-verification.js +2 -2
  457. package/dist/src/tui/backends/embedded-backend.js +5 -5
  458. package/dist/src/tui/backends/embedded-drafts.js +1 -1
  459. package/dist/src/tui/clipboard-image.js +2 -2
  460. package/dist/src/tui/extension-host/load-extensions.js +1 -1
  461. package/dist/src/tui/tui-capabilities.js +1 -1
  462. package/dist/src/tui/tui-commands.js +1 -1
  463. package/dist/src/tui/tui-skills-autocomplete.js +2 -2
  464. package/dist/src/tui/tui-startup-resources.js +1 -1
  465. package/dist/src/tui/tui.js +4 -4
  466. package/dist/src/tunnel/frpc-binary.js +2 -2
  467. package/dist/src/usage/cloud-capability.js +1 -1
  468. package/dist/src/usage/recorder.js +2 -2
  469. package/dist/src/user-context/access-policy.js +2 -2
  470. package/dist/src/user-model/bootstrap.js +1 -1
  471. package/dist/src/user-model/capture/executor.js +1 -1
  472. package/dist/src/user-model/index.js +2 -2
  473. package/dist/src/user-model/usage-policy.js +1 -1
  474. package/dist/src/utils/index.js +1 -1
  475. package/dist/src/utils/logger/index.js +2 -2
  476. package/dist/src/utils/logger.js +1 -1
  477. package/dist/src/video-generation/artifact.js +2 -2
  478. package/dist/src/video-generation/repository.js +1 -1
  479. package/dist/src/voice/audio/normalize.js +1 -1
  480. package/dist/src/voice/platform-settings.js +1 -1
  481. package/dist/src/voice/realtime/conversation-context.js +1 -1
  482. package/dist/src/voice/realtime/memory-context.js +2 -2
  483. package/dist/src/voice/realtime/runtime.js +2 -2
  484. package/dist/src/voice/realtime/user-context.js +1 -1
  485. package/dist/src/voice/stt/factory.js +1 -1
  486. package/dist/src/voice/stt/index.js +2 -2
  487. package/dist/src/voice/stt/preflight.js +2 -2
  488. package/dist/src/voice/stt/providers/bailian-plan-transcription.js +3 -3
  489. package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +3 -3
  490. package/dist/src/voice/stt/transcribe-core.js +1 -1
  491. package/dist/src/voice/tts/factory.js +1 -1
  492. package/dist/src/voice/tts/providers/bailian-plan-speech.js +2 -2
  493. package/dist/src/voice/tts/providers/edge-speech.js +1 -1
  494. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +2 -2
  495. package/dist/src/work-discovery/candidate-discovery.js +2 -2
  496. package/dist/src/work-discovery/probe.js +2 -2
  497. package/dist/src/work-discovery/service.js +4 -4
  498. package/package.json +1 -1
  499. package/dist/gateway/static/root/assets/right-workspace-store-CcRApllu.js +0 -1
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{a,c as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-DlirbHVs.js";import{h as p}from"./chat-page-XqG9aYBd.js";import{D as m}from"./markdown-view-ByuzuGRb.js";import{t as h}from"./x-B_N4OPjy.js";import{t as g}from"./cn-0WouolD0.js";import{t as _}from"./skeleton-DzdOeGYz.js";import{r as v}from"./turn-outcome-Bf3N3Bmj.js";import{o as y}from"./product-delivery-4gEqUIsK.js";import{n as b}from"./attachment-utils-core-BPYdUI6y.js";import{r as x}from"./right-workspace-store-CcRApllu.js";var S=n(),C=e(t(),1),w=r();function T(e){if(!e)return;let t=URL.parse(e,window.location.origin);return t&&[`http:`,`https:`].includes(t.protocol)&&/^(?:https?:\/\/|\/(?!\/))/i.test(e)?t.href:void 0}function E(e){let t=(0,S.c)(30),{item:n,workspaceScope:r,conversationId:g,backgroundPath:_,zh:E,className:O,children:k}=e,{artifact:A,reference:j,task:M}=n,[N,P]=(0,C.useState)(!1),F=A?.title??j?.title??n.id,I;t[0]===j?I=t[1]:(I=j&&y(j),t[0]=j,t[1]=I);let L=I,R=j?.kind===`chat_preview`?j.revision:void 0,z;t[2]!==A?.shareUrl||t[3]!==A?.uri?(z=T(A?.uri)??T(A?.shareUrl),t[2]=A?.shareUrl,t[3]=A?.uri,t[4]=z):z=t[4];let B=z,V=A?.uri,H;t[5]!==V||t[6]!==B?(H=V&&/^\/api\/(?:music-generation\/sessions\/[^/]+\/jobs\/[a-f0-9]{64}\/audio|video-generation\/sessions\/[^/]+\/jobs\/[a-fA-F0-9-]+\/video)$/.test(V)?B:void 0,t[5]=V,t[6]=B,t[7]=H):H=t[7];let U=H,W;t[8]!==A?.workspaceRelativePath||t[9]!==V?(W=V?.startsWith(`media://`)||V&&v(V)||A?.workspaceRelativePath,t[8]=A?.workspaceRelativePath,t[9]=V,t[10]=W):W=t[10];let G=!!W,K=!!(B&&window.electronAPI?.browser),q;return t[11]!==A||t[12]!==_||t[13]!==k||t[14]!==O||t[15]!==g||t[16]!==K||t[17]!==G||t[18]!==U||t[19]!==n.id||t[20]!==N||t[21]!==L||t[22]!==j||t[23]!==R||t[24]!==M?.id||t[25]!==F||t[26]!==B||t[27]!==r||t[28]!==E?(q=L?(0,w.jsx)(i,{to:m(_,L),className:O,children:k}):U||j&&R?(0,w.jsxs)(f,{open:N,onOpenChange:P,children:[(0,w.jsx)(o,{className:O,children:k}),N?(0,w.jsxs)(l,{children:[(0,w.jsx)(a,{className:`xopc-dialog-overlay fixed inset-0 z-[90] bg-black/45`}),(0,w.jsxs)(u,{onKeyDown:D,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[91] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(56rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge`,children:[(0,w.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,w.jsx)(d,{className:`truncate font-medium text-fg`,children:F}),(0,w.jsx)(s,{className:`sr-only`,children:E?`预览交付物`:`Preview deliverable`}),(0,w.jsx)(c,{"aria-label":E?`关闭预览`:`Close preview`,className:`grid size-8 shrink-0 place-items-center rounded-lg hover:bg-surface-hover`,children:(0,w.jsx)(h,{className:`size-4`})})]}),(0,w.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 pb-4`,children:U?(0,w.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 py-4`,children:[A?.kind===`audio`?(0,w.jsx)(`audio`,{controls:!0,preload:`metadata`,src:U,"aria-label":F,className:`w-full max-w-xl`}):(0,w.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:U,"aria-label":F,className:`min-h-0 max-w-full rounded-lg bg-black`}),(0,w.jsx)(`a`,{href:`${U}?download=1`,download:!0,className:`shrink-0 text-sm text-accent-fg hover:underline`,children:E?`下载`:`Download`})]}):j&&R?(0,w.jsx)(p,{leaseId:`personal-deliverable:${n.id}`,reference:j,sourceHash:R,preferredHeight:480,language:E?`zh`:`en`}):null})]})]}):null]}):G||K?(0,w.jsx)(`button`,{type:`button`,className:O,onClick:()=>{let e=x.getState();G&&A?e.openFile({attachment:{...b(A),taskId:M?.id},conversationId:g},r):e.openBrowser(B,r)},children:k}):B?(0,w.jsx)(`a`,{href:B,target:`_blank`,rel:`noopener noreferrer`,className:O,children:k}):(0,w.jsx)(`div`,{className:O,children:k}),t[11]=A,t[12]=_,t[13]=k,t[14]=O,t[15]=g,t[16]=K,t[17]=G,t[18]=U,t[19]=n.id,t[20]=N,t[21]=L,t[22]=j,t[23]=R,t[24]=M?.id,t[25]=F,t[26]=B,t[27]=r,t[28]=E,t[29]=q):q=t[29],q}function D(e){return e.stopPropagation()}function O(){let e=(0,S.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,w.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,w.jsx)(_,{className:`h-32 rounded-2xl`}),(0,w.jsx)(_,{className:`h-52 rounded-2xl`}),(0,w.jsx)(_,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function k(e){let t=(0,S.c)(16),{label:n,title:r,compact:i}=e,a=i&&!!r,o=a&&`-translate-y-2 opacity-0`,s;t[0]===o?s=t[1]:(s=g(`truncate [grid-area:1/1] motion-safe:transition-[opacity,translate] motion-safe:duration-200 motion-safe:ease-out`,o),t[0]=o,t[1]=s);let c;t[2]!==n||t[3]!==a||t[4]!==s?(c=(0,w.jsx)(`span`,{"aria-hidden":a,className:s,children:n}),t[2]=n,t[3]=a,t[4]=s,t[5]=c):c=t[5];let l=!a,u=!a&&`translate-y-2 opacity-0`,d;t[6]===u?d=t[7]:(d=g(`truncate [grid-area:1/1] motion-safe:transition-[opacity,translate] motion-safe:duration-200 motion-safe:ease-out`,u),t[6]=u,t[7]=d);let f;t[8]!==l||t[9]!==d||t[10]!==r?(f=(0,w.jsx)(`span`,{"aria-hidden":l,className:d,children:r}),t[8]=l,t[9]=d,t[10]=r,t[11]=f):f=t[11];let p;return t[12]!==a||t[13]!==c||t[14]!==f?(p=(0,w.jsxs)(`span`,{className:`grid min-w-0 overflow-hidden leading-6`,"data-task-header-compact":a,children:[c,f]}),t[12]=a,t[13]=c,t[14]=f,t[15]=p):p=t[15],p}export{O as n,E as r,k as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{a,c as o,i as s,n as c,o as l,r as u,s as d,t as f}from"./dist-DlirbHVs.js";import{h as p}from"./chat-page-oy4EGdO1.js";import{D as m}from"./markdown-view-ByuzuGRb.js";import{t as h}from"./x-B_N4OPjy.js";import{t as g}from"./cn-0WouolD0.js";import{t as _}from"./skeleton-DzdOeGYz.js";import{r as v}from"./turn-outcome-Bf3N3Bmj.js";import{o as y}from"./product-delivery-4gEqUIsK.js";import{n as b}from"./attachment-utils-core-BPYdUI6y.js";import{r as x}from"./right-workspace-store-DsVm6C0V.js";var S=n(),C=e(t(),1),w=r();function T(e){if(!e)return;let t=URL.parse(e,window.location.origin);return t&&[`http:`,`https:`].includes(t.protocol)&&/^(?:https?:\/\/|\/(?!\/))/i.test(e)?t.href:void 0}function E(e){let t=(0,S.c)(30),{item:n,workspaceScope:r,conversationId:g,backgroundPath:_,zh:E,className:O,children:k}=e,{artifact:A,reference:j,task:M}=n,[N,P]=(0,C.useState)(!1),F=A?.title??j?.title??n.id,I;t[0]===j?I=t[1]:(I=j&&y(j),t[0]=j,t[1]=I);let L=I,R=j?.kind===`chat_preview`?j.revision:void 0,z;t[2]!==A?.shareUrl||t[3]!==A?.uri?(z=T(A?.uri)??T(A?.shareUrl),t[2]=A?.shareUrl,t[3]=A?.uri,t[4]=z):z=t[4];let B=z,V=A?.uri,H;t[5]!==V||t[6]!==B?(H=V&&/^\/api\/(?:music-generation\/sessions\/[^/]+\/jobs\/[a-f0-9]{64}\/audio|video-generation\/sessions\/[^/]+\/jobs\/[a-fA-F0-9-]+\/video)$/.test(V)?B:void 0,t[5]=V,t[6]=B,t[7]=H):H=t[7];let U=H,W;t[8]!==A?.workspaceRelativePath||t[9]!==V?(W=V?.startsWith(`media://`)||V&&v(V)||A?.workspaceRelativePath,t[8]=A?.workspaceRelativePath,t[9]=V,t[10]=W):W=t[10];let G=!!W,K=!!(B&&window.electronAPI?.browser),q;return t[11]!==A||t[12]!==_||t[13]!==k||t[14]!==O||t[15]!==g||t[16]!==K||t[17]!==G||t[18]!==U||t[19]!==n.id||t[20]!==N||t[21]!==L||t[22]!==j||t[23]!==R||t[24]!==M?.id||t[25]!==F||t[26]!==B||t[27]!==r||t[28]!==E?(q=L?(0,w.jsx)(i,{to:m(_,L),className:O,children:k}):U||j&&R?(0,w.jsxs)(f,{open:N,onOpenChange:P,children:[(0,w.jsx)(o,{className:O,children:k}),N?(0,w.jsxs)(l,{children:[(0,w.jsx)(a,{className:`xopc-dialog-overlay fixed inset-0 z-[90] bg-black/45`}),(0,w.jsxs)(u,{onKeyDown:D,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[91] flex h-[min(42rem,calc(100dvh-2rem))] w-[min(56rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge`,children:[(0,w.jsxs)(`header`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,w.jsx)(d,{className:`truncate font-medium text-fg`,children:F}),(0,w.jsx)(s,{className:`sr-only`,children:E?`预览交付物`:`Preview deliverable`}),(0,w.jsx)(c,{"aria-label":E?`关闭预览`:`Close preview`,className:`grid size-8 shrink-0 place-items-center rounded-lg hover:bg-surface-hover`,children:(0,w.jsx)(h,{className:`size-4`})})]}),(0,w.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 pb-4`,children:U?(0,w.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-4 py-4`,children:[A?.kind===`audio`?(0,w.jsx)(`audio`,{controls:!0,preload:`metadata`,src:U,"aria-label":F,className:`w-full max-w-xl`}):(0,w.jsx)(`video`,{controls:!0,playsInline:!0,preload:`metadata`,src:U,"aria-label":F,className:`min-h-0 max-w-full rounded-lg bg-black`}),(0,w.jsx)(`a`,{href:`${U}?download=1`,download:!0,className:`shrink-0 text-sm text-accent-fg hover:underline`,children:E?`下载`:`Download`})]}):j&&R?(0,w.jsx)(p,{leaseId:`personal-deliverable:${n.id}`,reference:j,sourceHash:R,preferredHeight:480,language:E?`zh`:`en`}):null})]})]}):null]}):G||K?(0,w.jsx)(`button`,{type:`button`,className:O,onClick:()=>{let e=x.getState();G&&A?e.openFile({attachment:{...b(A),taskId:M?.id},conversationId:g},r):e.openBrowser(B,r)},children:k}):B?(0,w.jsx)(`a`,{href:B,target:`_blank`,rel:`noopener noreferrer`,className:O,children:k}):(0,w.jsx)(`div`,{className:O,children:k}),t[11]=A,t[12]=_,t[13]=k,t[14]=O,t[15]=g,t[16]=K,t[17]=G,t[18]=U,t[19]=n.id,t[20]=N,t[21]=L,t[22]=j,t[23]=R,t[24]=M?.id,t[25]=F,t[26]=B,t[27]=r,t[28]=E,t[29]=q):q=t[29],q}function D(e){return e.stopPropagation()}function O(){let e=(0,S.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,w.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,w.jsx)(_,{className:`h-32 rounded-2xl`}),(0,w.jsx)(_,{className:`h-52 rounded-2xl`}),(0,w.jsx)(_,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function k(e){let t=(0,S.c)(16),{label:n,title:r,compact:i}=e,a=i&&!!r,o=a&&`-translate-y-2 opacity-0`,s;t[0]===o?s=t[1]:(s=g(`truncate [grid-area:1/1] motion-safe:transition-[opacity,translate] motion-safe:duration-200 motion-safe:ease-out`,o),t[0]=o,t[1]=s);let c;t[2]!==n||t[3]!==a||t[4]!==s?(c=(0,w.jsx)(`span`,{"aria-hidden":a,className:s,children:n}),t[2]=n,t[3]=a,t[4]=s,t[5]=c):c=t[5];let l=!a,u=!a&&`translate-y-2 opacity-0`,d;t[6]===u?d=t[7]:(d=g(`truncate [grid-area:1/1] motion-safe:transition-[opacity,translate] motion-safe:duration-200 motion-safe:ease-out`,u),t[6]=u,t[7]=d);let f;t[8]!==l||t[9]!==d||t[10]!==r?(f=(0,w.jsx)(`span`,{"aria-hidden":l,className:d,children:r}),t[8]=l,t[9]=d,t[10]=r,t[11]=f):f=t[11];let p;return t[12]!==a||t[13]!==c||t[14]!==f?(p=(0,w.jsxs)(`span`,{className:`grid min-w-0 overflow-hidden leading-6`,"data-task-header-compact":a,children:[c,f]}),t[12]=a,t[13]=c,t[14]=f,t[15]=p):p=t[15],p}export{O as n,E as r,k as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i,t as a}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{t as o}from"./external-link-DjqjBmc3.js";import{t as s}from"./file-text-D12HbeVy.js";import{t as c}from"./markdown-view-ByuzuGRb.js";import{t as l}from"./cn-0WouolD0.js";import{kt as u}from"./session-manager-7nbjJYyy.js";import{i as d,p as f}from"./home-task-actions-GAO06s1_.js";import{t as p}from"./button-C5tRaJxt.js";import{t as m}from"./activity-store-DyHjQrpP.js";import{m as h,o as g}from"./shares-api-CoRLwDnw.js";import{n as _}from"./task-result-presentation-_VWkiekf.js";var v=n(),y=e(t(),1),b=r();function x(e){let t=(0,v.c)(38),{content:n,contentKey:r,language:a,markdown:o,breaks:s,previewHeight:d,className:f,children:p}=e,m=o===void 0||o,h=s!==void 0&&s,g=d===void 0?240:d,_;t[0]===n?_=t[1]:(_=u(n),t[0]=n,t[1]=_),n=_;let x=(0,y.useId)(),S=(0,y.useRef)(null),[C,w]=(0,y.useState)(!1),[T,E]=i(),D;t[2]!==r||t[3]!==T?(D=T.getAll(`taskExpanded`).includes(r),t[2]=r,t[3]=T,t[4]=D):D=t[4];let O=D,k;t[5]===g?k=t[6]:(k=()=>{let e=S.current;if(!e)return;let t=()=>w(e.scrollHeight>g);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},t[5]=g,t[6]=k);let A;t[7]!==n||t[8]!==g?(A=[n,g],t[7]=n,t[8]=g,t[9]=A):A=t[9],(0,y.useLayoutEffect)(k,A);let j=C&&!O,M;t[10]===f?M=t[11]:(M=l(`min-w-0`,f),t[10]=f,t[11]=M);let N;t[12]!==j||t[13]!==g?(N=j?{maxHeight:g,overflow:`hidden`,maskImage:`linear-gradient(to bottom, black calc(100% - ${Math.min(24,g/3)}px), transparent)`}:void 0,t[12]=j,t[13]=g,t[14]=N):N=t[14];let P;t[15]!==h||t[16]!==p||t[17]!==n||t[18]!==m?(P=p??(m?(0,b.jsx)(c,{content:n,compact:!0,breaks:h,className:`text-sm leading-6 text-fg`}):(0,b.jsx)(`p`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:n})),t[15]=h,t[16]=p,t[17]=n,t[18]=m,t[19]=P):P=t[19];let F;t[20]!==j||t[21]!==P?(F=(0,b.jsx)(`div`,{ref:S,inert:j,children:P}),t[20]=j,t[21]=P,t[22]=F):F=t[22];let I;t[23]!==x||t[24]!==F||t[25]!==N?(I=(0,b.jsx)(`div`,{id:x,style:N,children:F}),t[23]=x,t[24]=F,t[25]=N,t[26]=I):I=t[26];let L;t[27]!==r||t[28]!==O||t[29]!==x||t[30]!==a||t[31]!==C||t[32]!==E?(L=C?(0,b.jsx)(`button`,{type:`button`,"aria-expanded":O,"aria-controls":x,className:`mt-2 min-h-9 rounded-sm text-xs font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,onClick:()=>E(e=>{let t=new URLSearchParams(e),n=t.getAll(`taskExpanded`).filter(e=>e!==r);t.delete(`taskExpanded`);for(let e of n)t.append(`taskExpanded`,e);return O||t.append(`taskExpanded`,r),t},{preventScrollReset:!0}),children:a===`zh`?O?`收起`:`查看更多`:O?`Show less`:`Show more`}):null,t[27]=r,t[28]=O,t[29]=x,t[30]=a,t[31]=C,t[32]=E,t[33]=L):L=t[33];let R;return t[34]!==I||t[35]!==L||t[36]!==M?(R=(0,b.jsxs)(`div`,{className:M,children:[I,L]}),t[34]=I,t[35]=L,t[36]=M,t[37]=R):R=t[37],R}function S({wait:e,detail:t,zh:n,onUpdated:r}){let[i,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(``),[u,d]=(0,y.useState)(!1),h=(0,y.useRef)(null),g=e.kind===`approval`,_=Array.isArray(e.condition.choices)?e.condition.choices.filter(e=>typeof e==`string`):[];async function v(a){if(!g&&!i.trim()||g&&!a||o)return;let c=JSON.stringify([t.task.version,i.trim(),a]);h.current?.signature!==c&&(h.current={signature:c,key:crypto.randomUUID()}),s(!0),l(``);try{let o=await f(t.task.id,{type:`resolve_wait`,waitId:e.id,resolution:g?{kind:`task_approval`,decision:a}:{kind:`user_answer`,answer:i.trim()}},t.task.version,h.current.key);d(!0),r(o),m({tone:`success`,title:g?n?`决定已保存`:`Decision saved`:n?`补充信息已保存`:`Answer saved`,message:o.waits.length?n?`仍有其他等待条件,任务尚未恢复执行。`:`Other waiting conditions remain.`:n?`等待已解除,请在任务状态中查看后续执行进展。`:`The wait is resolved. Follow progress in the task status.`,source:n?`任务`:`Task`})}catch{l(n?`提交未确认,内容已保留。可重试;若问题已变化,请刷新。`:`Submission not confirmed. Your answer is saved here; retry or refresh if the question changed.`)}finally{s(!1)}}return(0,b.jsxs)(`form`,{className:`mt-3 space-y-3 rounded-lg border border-edge p-3`,onSubmit:e=>{e.preventDefault(),v()},children:[g?(0,b.jsxs)(`div`,{className:`text-sm text-fg`,children:[(0,b.jsx)(`p`,{children:e.reason}),(0,b.jsxs)(`p`,{className:`mt-2`,children:[n?`授权范围:`:`Permission: `,String(e.condition.capability)]}),(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,b.jsx)(p,{type:`button`,variant:`primary`,disabled:o||u,onClick:()=>void v(`approve`),children:n?`批准`:`Approve`}),(0,b.jsx)(p,{type:`button`,disabled:o||u,onClick:()=>void v(`deny`),children:n?`拒绝并暂停`:`Deny and pause`})]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{className:`block text-sm text-fg`,children:[typeof e.condition.question==`string`?e.condition.question:e.reason,(0,b.jsx)(`textarea`,{className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel p-3`,rows:3,maxLength:12e3,value:i,disabled:o||u,onChange:e=>a(e.target.value)})]}),_.length>0&&(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:_.map(e=>(0,b.jsx)(p,{type:`button`,disabled:o||u,variant:`secondary`,"aria-pressed":i===e,onClick:()=>a(e),children:e},e))}),(0,b.jsx)(p,{type:`submit`,variant:`primary`,disabled:o||u||!i.trim(),children:o?n?`正在提交`:`Submitting`:n?`提交补充信息`:`Submit answer`})]}),(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`保存到任务上下文;其他等待条件满足后继续执行。`:`Saved to task context. Work continues once all waiting conditions are met.`}),c&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:c})]})}function C(e,t){let n;try{n=new URL(e)}catch{return}return t.find(e=>[e.shareUrl,e.lanUrl].some(e=>{if(!e)return!1;try{let t=new URL(e);return t.origin===n.origin&&t.pathname.replace(/\/$/,``)===n.pathname.replace(/\/$/,``)}catch{return!1}}))}function w({uri:e,zh:t}){let[n,r]=(0,y.useState)(),[i,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(!1),[l,u]=(0,y.useState)(``),[d,f]=(0,y.useState)(``);async function m(){o(!0),u(``);try{let n=C(e,(await h()).payload.shares);r(n),c(!0),n?n.kind!==`file`&&n.kind!==`directory`?u(t?`这是文档快照,请从原笔记或对话的分享面板重新发布。`:`This is a document snapshot. Republish it from the original note or conversation.`):n.revoked?u(t?`分享已被撤销,不能自动恢复。请从原任务重新生成并分享。`:`This share was revoked. Generate and share a new artifact from the task.`):n.maxViews!==null&&n.downloadCount>=n.maxViews?u(t?`已达到访问次数上限,请在分享设置中调整后重试。`:`The access limit was reached. Adjust it in share settings.`):n.expired||(f(n.shareUrl),u(t?`链接仍在有效期内;若打不开,请检查网关连接。`:`The link has not expired. If it cannot open, check gateway connectivity.`)):u(t?`未找到本机管理的分享记录。外部链接或已清理的记录无法在这里续期,请从原任务重新生成产物。`:`No locally managed share matches this link. Regenerate the artifact from its task.`)}catch{u(t?`检查失败,请重试。`:`Check failed. Please retry.`)}finally{o(!1)}}async function _(){if(!(!n||i)){o(!0),u(``);try{let e=await g(n.id,864e5);f(e.payload.shareUrl),r({...n,expired:!1,expiresAt:e.payload.expiresAt}),u(t?`已续期 24 小时,访问范围与次数限制保持不变。`:`Renewed for 24 hours. Access scope and view limits are unchanged.`)}catch(e){u(`${t?`恢复失败:`:`Recovery failed: `}${e instanceof Error?e.message:String(e)}`)}finally{o(!1)}}}return(0,b.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t?`链接打不开?`:`Trouble opening the link?`}),(0,b.jsxs)(`div`,{className:`space-y-2`,children:[(0,b.jsx)(p,{type:`button`,variant:`ghost`,disabled:i,onClick:()=>void m(),children:t?`检查链接状态`:`Check link`}),s&&n?.expired&&(n.kind===`file`||n.kind===`directory`)&&!n.revoked&&(n.maxViews===null||n.downloadCount<n.maxViews)&&(0,b.jsx)(p,{type:`button`,disabled:i,onClick:()=>void _(),children:t?`恢复链接 · 续期 24 小时`:`Restore link for 24 hours`}),l&&(0,b.jsx)(`p`,{role:`status`,className:`break-words leading-5`,children:l}),d&&(0,b.jsx)(`a`,{className:`block py-2 text-accent`,href:d,target:`_blank`,rel:`noopener noreferrer`,children:t?`打开产物`:`Open artifact`}),s&&(0,b.jsx)(a,{className:`block py-2 text-accent`,to:`/settings/shares`,children:t?`管理分享记录`:`Manage shares`})]})]})}function T(e){let t=(0,v.c)(18),{evidence:n,projectId:r,conversationId:i,language:a,onOpenFile:c,compact:l}=e,u=l!==void 0&&l,f=d(E);if(!n.length)return null;let p=a===`zh`?`交付物与验证依据`:`Deliverables and evidence`,m;if(t[0]!==u||t[1]!==i||t[2]!==n||t[3]!==a||t[4]!==c||t[5]!==r||t[6]!==f){let e;t[8]!==u||t[9]!==i||t[10]!==a||t[11]!==c||t[12]!==r||t[13]!==f?(e=(e,t)=>{let n=e.uri?.trim(),l=n&&/^https?:\/\//i.test(n),d=n&&!l&&e.kind===`artifact`&&!/^[a-z][a-z0-9+.-]*:/i.test(n)&&!n.startsWith(`//`),p=a===`zh`,m=e.kind===`source`&&e.provenance===`judge`&&e.title.startsWith(`Research claim: `),h=l?URL.parse(n)?.hostname:void 0,g=m?h?p?`查看来源 · ${h}`:`Open source · ${h}`:p?`结论依据`:`Evidence for this finding`:e.title||(p?`查看交付物`:`Open artifact`),v=_(e.summary,a);return(0,b.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge-subtle p-3`,children:[(0,b.jsx)(x,{content:g,contentKey:`${i??r}:evidence-title:${t}:${e.title}`,language:a,previewHeight:60,children:l?(0,b.jsxs)(`a`,{className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline [overflow-wrap:anywhere]`,href:n,target:`_blank`,rel:`noopener noreferrer`,children:[(0,b.jsx)(o,{className:`size-4 shrink-0`}),(0,b.jsx)(`span`,{className:`min-w-0 break-words`,children:g})]}):d&&(r||i)?(0,b.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline [overflow-wrap:anywhere]`,onClick:()=>c?c(n):f(n,null,r,i),children:[(0,b.jsx)(s,{className:`size-4 shrink-0`}),g]}):(0,b.jsx)(`p`,{className:`break-words [overflow-wrap:anywhere] text-sm font-medium text-fg`,children:g})}),l&&e.kind===`artifact`&&(0,b.jsx)(w,{uri:n,zh:a===`zh`},n),u&&!l&&!(d&&(r||i))?(0,b.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a===`zh`?`位置待确认`:`Location needs confirmation`}):null,!u&&v?(0,b.jsx)(x,{content:v,contentKey:`${i??r}:evidence:${t}:${e.title}`,language:a,markdown:!1,previewHeight:80,className:`mt-1 text-xs leading-5 text-fg-muted`}):null,u?null:(0,b.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:e.provenance===`judge`?e.strength===`verified`?a===`zh`?`模型审阅通过`:`Model reviewed`:a===`zh`?`模型未确认,待核验`:`Not confirmed by review`:e.strength===`verified`?a===`zh`?`已验证`:`Verified`:a===`zh`?`已记录,待验证`:`Observed, not verified`})]},`${e.title}-${t}`)},t[8]=u,t[9]=i,t[10]=a,t[11]=c,t[12]=r,t[13]=f,t[14]=e):e=t[14],m=n.map(e),t[0]=u,t[1]=i,t[2]=n,t[3]=a,t[4]=c,t[5]=r,t[6]=f,t[7]=m}else m=t[7];let h;return t[15]!==p||t[16]!==m?(h=(0,b.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,"aria-label":p,children:m}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function E(e){return e.setPath}function D(e){let t=(0,v.c)(10),{issue:n}=e,r;t[0]===n.title?r=t[1]:(r=(0,b.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=r);let i;t[2]===n.description?i=t[3]:(i=n.description?(0,b.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n.description}):null,t[2]=n.description,t[3]=i);let o;t[4]===n.action?o=t[5]:(o=n.action?(0,b.jsx)(p,{asChild:!0,variant:`secondary`,children:(0,b.jsx)(a,{to:n.action.href,children:n.action.label})}):null,t[4]=n.action,t[5]=o);let s;return t[6]!==r||t[7]!==i||t[8]!==o?(s=(0,b.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge bg-surface-inset p-3`,children:[r,i,o]}),t[6]=r,t[7]=i,t[8]=o,t[9]=s):s=t[9],s}export{x as i,T as n,S as r,D as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i,t as a}from"./chunk-KS7C4IRE-DIIvxCDx.js";import{t as o}from"./external-link-DjqjBmc3.js";import{t as s}from"./file-text-D12HbeVy.js";import{t as c}from"./markdown-view-ByuzuGRb.js";import{t as l}from"./cn-0WouolD0.js";import{kt as u}from"./session-manager-7nbjJYyy.js";import{i as d,p as f}from"./home-task-actions-Ck0AhcYe.js";import{t as p}from"./button-C5tRaJxt.js";import{t as m}from"./activity-store-DyHjQrpP.js";import{m as h,o as g}from"./shares-api-CoRLwDnw.js";import{n as _}from"./task-result-presentation-_VWkiekf.js";var v=n(),y=e(t(),1),b=r();function x(e){let t=(0,v.c)(38),{content:n,contentKey:r,language:a,markdown:o,breaks:s,previewHeight:d,className:f,children:p}=e,m=o===void 0||o,h=s!==void 0&&s,g=d===void 0?240:d,_;t[0]===n?_=t[1]:(_=u(n),t[0]=n,t[1]=_),n=_;let x=(0,y.useId)(),S=(0,y.useRef)(null),[C,w]=(0,y.useState)(!1),[T,E]=i(),D;t[2]!==r||t[3]!==T?(D=T.getAll(`taskExpanded`).includes(r),t[2]=r,t[3]=T,t[4]=D):D=t[4];let O=D,k;t[5]===g?k=t[6]:(k=()=>{let e=S.current;if(!e)return;let t=()=>w(e.scrollHeight>g);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},t[5]=g,t[6]=k);let A;t[7]!==n||t[8]!==g?(A=[n,g],t[7]=n,t[8]=g,t[9]=A):A=t[9],(0,y.useLayoutEffect)(k,A);let j=C&&!O,M;t[10]===f?M=t[11]:(M=l(`min-w-0`,f),t[10]=f,t[11]=M);let N;t[12]!==j||t[13]!==g?(N=j?{maxHeight:g,overflow:`hidden`,maskImage:`linear-gradient(to bottom, black calc(100% - ${Math.min(24,g/3)}px), transparent)`}:void 0,t[12]=j,t[13]=g,t[14]=N):N=t[14];let P;t[15]!==h||t[16]!==p||t[17]!==n||t[18]!==m?(P=p??(m?(0,b.jsx)(c,{content:n,compact:!0,breaks:h,className:`text-sm leading-6 text-fg`}):(0,b.jsx)(`p`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:n})),t[15]=h,t[16]=p,t[17]=n,t[18]=m,t[19]=P):P=t[19];let F;t[20]!==j||t[21]!==P?(F=(0,b.jsx)(`div`,{ref:S,inert:j,children:P}),t[20]=j,t[21]=P,t[22]=F):F=t[22];let I;t[23]!==x||t[24]!==F||t[25]!==N?(I=(0,b.jsx)(`div`,{id:x,style:N,children:F}),t[23]=x,t[24]=F,t[25]=N,t[26]=I):I=t[26];let L;t[27]!==r||t[28]!==O||t[29]!==x||t[30]!==a||t[31]!==C||t[32]!==E?(L=C?(0,b.jsx)(`button`,{type:`button`,"aria-expanded":O,"aria-controls":x,className:`mt-2 min-h-9 rounded-sm text-xs font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,onClick:()=>E(e=>{let t=new URLSearchParams(e),n=t.getAll(`taskExpanded`).filter(e=>e!==r);t.delete(`taskExpanded`);for(let e of n)t.append(`taskExpanded`,e);return O||t.append(`taskExpanded`,r),t},{preventScrollReset:!0}),children:a===`zh`?O?`收起`:`查看更多`:O?`Show less`:`Show more`}):null,t[27]=r,t[28]=O,t[29]=x,t[30]=a,t[31]=C,t[32]=E,t[33]=L):L=t[33];let R;return t[34]!==I||t[35]!==L||t[36]!==M?(R=(0,b.jsxs)(`div`,{className:M,children:[I,L]}),t[34]=I,t[35]=L,t[36]=M,t[37]=R):R=t[37],R}function S({wait:e,detail:t,zh:n,onUpdated:r}){let[i,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(``),[u,d]=(0,y.useState)(!1),h=(0,y.useRef)(null),g=e.kind===`approval`,_=Array.isArray(e.condition.choices)?e.condition.choices.filter(e=>typeof e==`string`):[];async function v(a){if(!g&&!i.trim()||g&&!a||o)return;let c=JSON.stringify([t.task.version,i.trim(),a]);h.current?.signature!==c&&(h.current={signature:c,key:crypto.randomUUID()}),s(!0),l(``);try{let o=await f(t.task.id,{type:`resolve_wait`,waitId:e.id,resolution:g?{kind:`task_approval`,decision:a}:{kind:`user_answer`,answer:i.trim()}},t.task.version,h.current.key);d(!0),r(o),m({tone:`success`,title:g?n?`决定已保存`:`Decision saved`:n?`补充信息已保存`:`Answer saved`,message:o.waits.length?n?`仍有其他等待条件,任务尚未恢复执行。`:`Other waiting conditions remain.`:n?`等待已解除,请在任务状态中查看后续执行进展。`:`The wait is resolved. Follow progress in the task status.`,source:n?`任务`:`Task`})}catch{l(n?`提交未确认,内容已保留。可重试;若问题已变化,请刷新。`:`Submission not confirmed. Your answer is saved here; retry or refresh if the question changed.`)}finally{s(!1)}}return(0,b.jsxs)(`form`,{className:`mt-3 space-y-3 rounded-lg border border-edge p-3`,onSubmit:e=>{e.preventDefault(),v()},children:[g?(0,b.jsxs)(`div`,{className:`text-sm text-fg`,children:[(0,b.jsx)(`p`,{children:e.reason}),(0,b.jsxs)(`p`,{className:`mt-2`,children:[n?`授权范围:`:`Permission: `,String(e.condition.capability)]}),(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,b.jsx)(p,{type:`button`,variant:`primary`,disabled:o||u,onClick:()=>void v(`approve`),children:n?`批准`:`Approve`}),(0,b.jsx)(p,{type:`button`,disabled:o||u,onClick:()=>void v(`deny`),children:n?`拒绝并暂停`:`Deny and pause`})]})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`label`,{className:`block text-sm text-fg`,children:[typeof e.condition.question==`string`?e.condition.question:e.reason,(0,b.jsx)(`textarea`,{className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel p-3`,rows:3,maxLength:12e3,value:i,disabled:o||u,onChange:e=>a(e.target.value)})]}),_.length>0&&(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:_.map(e=>(0,b.jsx)(p,{type:`button`,disabled:o||u,variant:`secondary`,"aria-pressed":i===e,onClick:()=>a(e),children:e},e))}),(0,b.jsx)(p,{type:`submit`,variant:`primary`,disabled:o||u||!i.trim(),children:o?n?`正在提交`:`Submitting`:n?`提交补充信息`:`Submit answer`})]}),(0,b.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`保存到任务上下文;其他等待条件满足后继续执行。`:`Saved to task context. Work continues once all waiting conditions are met.`}),c&&(0,b.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:c})]})}function C(e,t){let n;try{n=new URL(e)}catch{return}return t.find(e=>[e.shareUrl,e.lanUrl].some(e=>{if(!e)return!1;try{let t=new URL(e);return t.origin===n.origin&&t.pathname.replace(/\/$/,``)===n.pathname.replace(/\/$/,``)}catch{return!1}}))}function w({uri:e,zh:t}){let[n,r]=(0,y.useState)(),[i,o]=(0,y.useState)(!1),[s,c]=(0,y.useState)(!1),[l,u]=(0,y.useState)(``),[d,f]=(0,y.useState)(``);async function m(){o(!0),u(``);try{let n=C(e,(await h()).payload.shares);r(n),c(!0),n?n.kind!==`file`&&n.kind!==`directory`?u(t?`这是文档快照,请从原笔记或对话的分享面板重新发布。`:`This is a document snapshot. Republish it from the original note or conversation.`):n.revoked?u(t?`分享已被撤销,不能自动恢复。请从原任务重新生成并分享。`:`This share was revoked. Generate and share a new artifact from the task.`):n.maxViews!==null&&n.downloadCount>=n.maxViews?u(t?`已达到访问次数上限,请在分享设置中调整后重试。`:`The access limit was reached. Adjust it in share settings.`):n.expired||(f(n.shareUrl),u(t?`链接仍在有效期内;若打不开,请检查网关连接。`:`The link has not expired. If it cannot open, check gateway connectivity.`)):u(t?`未找到本机管理的分享记录。外部链接或已清理的记录无法在这里续期,请从原任务重新生成产物。`:`No locally managed share matches this link. Regenerate the artifact from its task.`)}catch{u(t?`检查失败,请重试。`:`Check failed. Please retry.`)}finally{o(!1)}}async function _(){if(!(!n||i)){o(!0),u(``);try{let e=await g(n.id,864e5);f(e.payload.shareUrl),r({...n,expired:!1,expiresAt:e.payload.expiresAt}),u(t?`已续期 24 小时,访问范围与次数限制保持不变。`:`Renewed for 24 hours. Access scope and view limits are unchanged.`)}catch(e){u(`${t?`恢复失败:`:`Recovery failed: `}${e instanceof Error?e.message:String(e)}`)}finally{o(!1)}}}return(0,b.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,b.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t?`链接打不开?`:`Trouble opening the link?`}),(0,b.jsxs)(`div`,{className:`space-y-2`,children:[(0,b.jsx)(p,{type:`button`,variant:`ghost`,disabled:i,onClick:()=>void m(),children:t?`检查链接状态`:`Check link`}),s&&n?.expired&&(n.kind===`file`||n.kind===`directory`)&&!n.revoked&&(n.maxViews===null||n.downloadCount<n.maxViews)&&(0,b.jsx)(p,{type:`button`,disabled:i,onClick:()=>void _(),children:t?`恢复链接 · 续期 24 小时`:`Restore link for 24 hours`}),l&&(0,b.jsx)(`p`,{role:`status`,className:`break-words leading-5`,children:l}),d&&(0,b.jsx)(`a`,{className:`block py-2 text-accent`,href:d,target:`_blank`,rel:`noopener noreferrer`,children:t?`打开产物`:`Open artifact`}),s&&(0,b.jsx)(a,{className:`block py-2 text-accent`,to:`/settings/shares`,children:t?`管理分享记录`:`Manage shares`})]})]})}function T(e){let t=(0,v.c)(18),{evidence:n,projectId:r,conversationId:i,language:a,onOpenFile:c,compact:l}=e,u=l!==void 0&&l,f=d(E);if(!n.length)return null;let p=a===`zh`?`交付物与验证依据`:`Deliverables and evidence`,m;if(t[0]!==u||t[1]!==i||t[2]!==n||t[3]!==a||t[4]!==c||t[5]!==r||t[6]!==f){let e;t[8]!==u||t[9]!==i||t[10]!==a||t[11]!==c||t[12]!==r||t[13]!==f?(e=(e,t)=>{let n=e.uri?.trim(),l=n&&/^https?:\/\//i.test(n),d=n&&!l&&e.kind===`artifact`&&!/^[a-z][a-z0-9+.-]*:/i.test(n)&&!n.startsWith(`//`),p=a===`zh`,m=e.kind===`source`&&e.provenance===`judge`&&e.title.startsWith(`Research claim: `),h=l?URL.parse(n)?.hostname:void 0,g=m?h?p?`查看来源 · ${h}`:`Open source · ${h}`:p?`结论依据`:`Evidence for this finding`:e.title||(p?`查看交付物`:`Open artifact`),v=_(e.summary,a);return(0,b.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge-subtle p-3`,children:[(0,b.jsx)(x,{content:g,contentKey:`${i??r}:evidence-title:${t}:${e.title}`,language:a,previewHeight:60,children:l?(0,b.jsxs)(`a`,{className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline [overflow-wrap:anywhere]`,href:n,target:`_blank`,rel:`noopener noreferrer`,children:[(0,b.jsx)(o,{className:`size-4 shrink-0`}),(0,b.jsx)(`span`,{className:`min-w-0 break-words`,children:g})]}):d&&(r||i)?(0,b.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline [overflow-wrap:anywhere]`,onClick:()=>c?c(n):f(n,null,r,i),children:[(0,b.jsx)(s,{className:`size-4 shrink-0`}),g]}):(0,b.jsx)(`p`,{className:`break-words [overflow-wrap:anywhere] text-sm font-medium text-fg`,children:g})}),l&&e.kind===`artifact`&&(0,b.jsx)(w,{uri:n,zh:a===`zh`},n),u&&!l&&!(d&&(r||i))?(0,b.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a===`zh`?`位置待确认`:`Location needs confirmation`}):null,!u&&v?(0,b.jsx)(x,{content:v,contentKey:`${i??r}:evidence:${t}:${e.title}`,language:a,markdown:!1,previewHeight:80,className:`mt-1 text-xs leading-5 text-fg-muted`}):null,u?null:(0,b.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:e.provenance===`judge`?e.strength===`verified`?a===`zh`?`模型审阅通过`:`Model reviewed`:a===`zh`?`模型未确认,待核验`:`Not confirmed by review`:e.strength===`verified`?a===`zh`?`已验证`:`Verified`:a===`zh`?`已记录,待验证`:`Observed, not verified`})]},`${e.title}-${t}`)},t[8]=u,t[9]=i,t[10]=a,t[11]=c,t[12]=r,t[13]=f,t[14]=e):e=t[14],m=n.map(e),t[0]=u,t[1]=i,t[2]=n,t[3]=a,t[4]=c,t[5]=r,t[6]=f,t[7]=m}else m=t[7];let h;return t[15]!==p||t[16]!==m?(h=(0,b.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,"aria-label":p,children:m}),t[15]=p,t[16]=m,t[17]=h):h=t[17],h}function E(e){return e.setPath}function D(e){let t=(0,v.c)(10),{issue:n}=e,r;t[0]===n.title?r=t[1]:(r=(0,b.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=r);let i;t[2]===n.description?i=t[3]:(i=n.description?(0,b.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n.description}):null,t[2]=n.description,t[3]=i);let o;t[4]===n.action?o=t[5]:(o=n.action?(0,b.jsx)(p,{asChild:!0,variant:`secondary`,children:(0,b.jsx)(a,{to:n.action.href,children:n.action.label})}):null,t[4]=n.action,t[5]=o);let s;return t[6]!==r||t[7]!==i||t[8]!==o?(s=(0,b.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-edge bg-surface-inset p-3`,children:[r,i,o]}),t[6]=r,t[7]=i,t[8]=o,t[9]=s):s=t[9],s}export{x as i,T as n,S as r,D as t};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-load-C9iZLUHv.js","assets/rolldown-runtime-aKtaBQYM.js","assets/attachment-utils-core-BPYdUI6y.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{n as a}from"./locale-store-Dy0B0XDJ.js";import{t as o}from"./messages-Bj6DCoic.js";import{o as s,r as c,s as l,t as u}from"./dist-DlirbHVs.js";import{t as d}from"./chevron-left-DqFhpbvK.js";import{t as f}from"./chevron-right-BweFrslA.js";import{t as p}from"./file-code-corner-byQA1VfD.js";import{t as m}from"./file-CStvVK2S.js";import{n as h,r as g,s as _,t as v}from"./use-file-preview-expanded-CA9vFUTT.js";import{t as y}from"./mic-CuUb7zc-.js";import{u as b}from"./preview-runtime-DUJ7XhMP.js";import{n as x}from"./share-link-dialog-WR7Op1vL.js";import{t as S}from"./cn-0WouolD0.js";import{r as C}from"./turn-outcome-Bf3N3Bmj.js";import{i as w}from"./attachment-utils-core-BPYdUI6y.js";import{t as T}from"./constants-D5Z-mUto.js";import{r as E}from"./right-workspace-store-CcRApllu.js";import{n as D}from"./interaction-BdhHBbYa.js";import{t as O}from"./composer-notifications-CpBgWAE4.js";import{n as k}from"./electron-env-DHOGevH3.js";import{t as A}from"./use-share-link-CqV3o-VZ.js";import{n as j,t as M}from"./file-preview-surface-Da1xZiG6.js";var N=n(),P=e(t(),1),F=r();function I(e){let t=(0,N.c)(6),n=_(),r,i;if(t[0]!==n||t[1]!==e?(r=()=>{!n||e.embedded||!e.open||!e.attachment||(E.getState().openFile({attachment:e.attachment,images:e.images,conversationId:e.conversationId||void 0,resultRevision:e.resultRevision},n),e.onClose())},i=[n,e],t[0]=n,t[1]=e,t[2]=r,t[3]=i):(r=t[2],i=t[3]),(0,P.useEffect)(r,i),n&&!e.embedded)return null;let a;return t[4]===e?a=t[5]:(a=(0,F.jsx)(L,{...e}),t[4]=e,t[5]=a),a}function L({open:e,embedded:t=!1,showEmbeddedClose:n=!1,tabId:r,attachment:i,images:p=[],resultRevision:m,onAttachmentChange:g,authToken:_,conversationId:y,layerClassName:w=`z-[115]`,onClose:T}){let E=a(e=>e.language),N=o(E).chat,I=b({open:e,attachment:i,authToken:_,conversationId:y,language:E}),L=A(),{expanded:R,setExpanded:z}=v(e,L.dialogOpen),[B,V]=(0,P.useState)(!1),{preview:H,fileType:U,hasExtractedText:W}=I,G=i?p.findIndex(e=>e===i||e.id&&e.id===i.id||e.uri&&e.uri===i.uri||!e.id&&!e.uri&&e.name===i.name&&!!e.data&&e.data===i.data):-1,K=U===`image`&&p.length>1&&G>=0&&!!g,q=e=>{if(!K||L.dialogOpen)return;let t=G+(e===`previous`?-1:1);t>=0&&t<p.length&&g?.(p[t])},J=U!==`image`&&U!==`text`&&U!==`pptx`&&W,Y=H?.uri?C(H.uri):null,X=!!(Y||H?.uri?.startsWith(`media://`)&&(y||H.taskId)),ee=()=>{!H?.uri||!X||L.createShareLink(Y?{fileId:Y,fileName:H.name}:{uri:H.uri,conversationId:y??void 0,taskId:H.taskId,fileName:H.name})},te=!!(H&&!I.loading&&!I.loadError),Z=()=>{z(!1),T()},ne=()=>{if(!H||!I.downloadBuffer)return;let e=new Blob([I.downloadBuffer],{type:I.descriptor.mimeType}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=H.name??`download`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},re=!!I.downloadBuffer,ie=k()&&U===`spreadsheet`&&/\.xlsx?$/i.test(I.fileName)&&!!I.downloadBuffer&&!!window.electronAPI?.shell?.openTemporaryFile,ae=async()=>{let e=I.downloadBuffer,t=window.electronAPI?.shell?.openTemporaryFile;if(!(!e||!t||B)){V(!0);try{(await t({fileName:I.fileName,data:new Uint8Array(e)})).ok||O(`warning`,N.attachmentPreviewOpenLocalFailed)}catch{O(`warning`,N.attachmentPreviewOpenLocalFailed)}finally{V(!1)}}},oe={onDownload:ne,canDownload:re},Q=S(`min-h-0 min-w-0 flex-1 cursor-pointer border-0 p-0`,`bg-surface-base transition-colors`,`hover:bg-surface-hover/90 dark:bg-black/60 dark:hover:bg-black/70`,D.focusRingBase),$=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(h,{header:{expanded:R,onToggleExpanded:te?()=>z(e=>!e):void 0,hideClose:t&&!n,hideExpand:!!r,onClose:Z,share:X?{onClick:ee,loading:L.loading}:void 0,openWithSystemApp:ie?{onClick:()=>void ae(),loading:B}:void 0,textView:J?{active:I.showExtractedText,onChange:e=>{I.setShowExtractedText(e),I.clearLoadError()}}:void 0},chat:I.downloadBuffer?{conversationId:y,createFile:async()=>new File([I.downloadBuffer],I.fileName,{type:I.descriptor.mimeType})}:void 0,onImageSwipe:K?q:void 0,language:E,descriptor:r?{...I.descriptor,id:r}:I.descriptor,loading:I.loading,loadError:I.loadError,textContent:I.textContent,binaryBuffer:I.binaryBuffer,showExtractedText:I.showExtractedText,extractedText:I.extractedText,extractedTextTruncated:I.extractedTextTruncated,actions:oe}),m?(0,F.jsxs)(`p`,{className:`shrink-0 border-t border-edge px-4 py-2 text-xs text-fg-muted`,"data-result-revision":!0,children:[E===`zh`?`成果版本`:`Result version`,` `,m]}):null,K?(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center justify-center gap-4 border-t border-edge bg-surface-panel px-3 py-2`,children:[(0,F.jsx)(`button`,{type:`button`,"aria-label":N.attachmentPreviewPreviousImage,disabled:G===0,onClick:()=>q(`previous`),className:S(`flex size-11 touch-manipulation items-center justify-center rounded-lg hover:bg-surface-hover disabled:opacity-30`,D.focusRingBase),children:(0,F.jsx)(d,{size:20,"aria-hidden":`true`})}),(0,F.jsxs)(`span`,{role:`status`,className:`min-w-16 text-center text-sm tabular-nums text-fg-muted`,children:[G+1,` / `,p.length]}),(0,F.jsx)(`button`,{type:`button`,"aria-label":N.attachmentPreviewNextImage,disabled:G===p.length-1,onClick:()=>q(`next`),className:S(`flex size-11 touch-manipulation items-center justify-center rounded-lg hover:bg-surface-hover disabled:opacity-30`,D.focusRingBase),children:(0,F.jsx)(f,{size:20,"aria-hidden":`true`})})]}):null]});return t?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(M,{expanded:R,children:$}),(0,F.jsx)(x,{open:L.dialogOpen,onOpenChange:L.handleOpenChange,loading:L.loading,error:L.error,result:L.result,pendingParams:L.pendingParams,onConfirm:e=>void L.confirmShareLink(e)})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(u,{open:e,onOpenChange:e=>!e&&Z(),children:(0,F.jsx)(s,{children:(0,F.jsxs)(c,{"aria-describedby":void 0,onKeyDown:e=>{!K||L.dialogOpen||e.altKey||e.ctrlKey||e.metaKey||e.target.closest(`input, textarea, select, [contenteditable="true"]`)||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),q(e.key===`ArrowLeft`?`previous`:`next`))},className:S(`xopc-dialog-content-fullscreen fixed inset-0 flex h-[100dvh] w-full flex-row overflow-hidden`,j(),w,`border-0 bg-transparent p-0 shadow-none outline-none`),children:[(0,F.jsx)(l,{className:`sr-only`,children:H?.name??``}),(0,F.jsx)(`button`,{type:`button`,className:Q,onClick:Z,"aria-label":N.attachmentPreviewClose}),(0,F.jsx)(`div`,{className:S(`flex h-full min-h-0 shrink-0 flex-col overflow-hidden`,R?`w-full`:`w-[min(100%,var(--max-width-app-main))]`,`bg-surface-panel sm:border-x sm:border-edge dark:sm:border-edge`,`shadow-float dark:shadow-elevated`),children:$}),(0,F.jsx)(`button`,{type:`button`,className:Q,onClick:Z,"aria-label":N.attachmentPreviewClose})]})})}),(0,F.jsx)(x,{open:L.dialogOpen,onOpenChange:L.handleOpenChange,loading:L.loading,error:L.error,result:L.result,pendingParams:L.pendingParams,onConfirm:e=>void L.confirmShareLink(e)})]})}function R(e){let t=(0,N.c)(23),{attachments:n,conversationId:r,topPadded:i,onRemove:s,className:c}=e,l=a(z),u;t[0]===l?u=t[1]:(u=o(l),t[0]=l,t[1]=u);let d=u.chat,[f,h]=(0,P.useState)(null);if(n.length===0)return null;let g=i?`pt-2`:`pt-3`,_;t[2]!==c||t[3]!==g?(_=S(`flex flex-wrap gap-2 border-b border-edge-subtle/90 bg-surface-hover/20 px-4 pb-2 dark:border-edge-subtle`,g,c),t[2]=c,t[3]=g,t[4]=_):_=t[4];let v;if(t[5]!==n||t[6]!==d||t[7]!==s){let e;t[9]!==d||t[10]!==s?(e=(e,t)=>{let n=e.type===`pasted_text`?d.pastedText:e.name;return(0,F.jsxs)(`div`,{className:`flex max-w-[200px] items-center rounded-lg bg-surface-hover text-xs dark:bg-surface-hover/80`,children:[(0,F.jsxs)(`button`,{type:`button`,className:S(`flex min-w-0 flex-1 items-center gap-1.5 rounded-l-lg py-1 pl-2 pr-1 text-left hover:bg-surface-active`,D.transition,D.press,D.focusRingPanel),onClick:()=>h(e),"aria-label":`${d.attachmentPreviewOpen}: ${n}`,title:`${d.attachmentPreviewOpen}: ${n}`,children:[e.mimeType?.startsWith(`image/`)&&e.content?(0,F.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.content}`,alt:``,className:`size-6 shrink-0 rounded object-cover`}):e.type===`voice`||e.mimeType?.startsWith(`audio/`)?(0,F.jsx)(y,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}):e.type===`pasted_text`?(0,F.jsx)(p,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}):(0,F.jsx)(m,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n}),(0,F.jsx)(`span`,{className:`shrink-0 text-fg-disabled`,children:w(e.size)})]}),(0,F.jsx)(`button`,{type:`button`,className:S(`flex min-h-8 min-w-8 items-center justify-center rounded-r-lg text-fg-muted hover:bg-surface-active hover:text-fg`,D.transition,D.press,D.focusRingPanel),onClick:()=>s(t),"aria-label":`${d.attachmentPreviewRemove}: ${n}`,title:`${d.attachmentPreviewRemove}: ${n}`,children:(0,F.jsx)(`span`,{"aria-hidden":!0,children:`×`})})]},e.id??`${e.name}-${e.size}-${e.mimeType}-${e.content?.slice(0,16)??``}`)},t[9]=d,t[10]=s,t[11]=e):e=t[11],v=n.map(e),t[5]=n,t[6]=d,t[7]=s,t[8]=v}else v=t[8];let b;t[12]!==_||t[13]!==v?(b=(0,F.jsx)(`div`,{className:_,children:v}),t[12]=_,t[13]=v,t[14]=b):b=t[14];let x=f!==null,C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>h(null),t[15]=C):C=t[15];let T;t[16]!==r||t[17]!==f||t[18]!==x?(T=(0,F.jsx)(I,{open:x,attachment:f,conversationId:r,onClose:C}),t[16]=r,t[17]=f,t[18]=x,t[19]=T):T=t[19];let E;return t[20]!==b||t[21]!==T?(E=(0,F.jsxs)(F.Fragment,{children:[b,T]}),t[20]=b,t[21]=T,t[22]=E):E=t[22],E}function z(e){return e.language}function B(e){let{chat:t,initialAttachments:n=[],onAttachmentsChange:r}=e,[a,o]=(0,P.useState)(n),[s,c]=(0,P.useState)(!1),l=(0,P.useRef)(null),u=(0,P.useRef)(a),d=(0,P.useRef)(r);u.current=a,d.current=r;let f=(0,P.useCallback)(e=>{let t=typeof e==`function`?e(u.current):e;u.current=t,o(t),d.current?.(t)},[]),p=(0,P.useCallback)(()=>{f([])},[]),m=(0,P.useCallback)(e=>{f(t=>t.filter((t,n)=>n!==e))},[]),h=(0,P.useCallback)(()=>u.current.map(e=>({type:e.type===`voice`?`voice`:e.type||`file`,mimeType:e.mimeType,data:e.content,name:e.name,size:e.size,...e.uri?{uri:e.uri}:{},...typeof e.durationSeconds==`number`&&Number.isFinite(e.durationSeconds)&&e.durationSeconds>0?{durationSeconds:e.durationSeconds}:{}})),[]),_=(0,P.useCallback)(async(e,n)=>{if(e.length===0)return;let r=10-u.current.length;if(r<=0){O(`warning`,t.maxAttachmentsReached,{max:10});return}let a=e.slice(0,r);e.length>a.length&&O(`warning`,t.maxAttachmentsTruncated,{max:10,dropped:e.length-a.length});let{loadAttachment:o}=await i(async()=>{let{loadAttachment:e}=await import(`./attachment-load-C9iZLUHv.js`).then(e=>e.t);return{loadAttachment:e}},__vite__mapDeps([0,1,2])),s=(await Promise.all(a.map(async e=>{if(e.size>33554432)return O(`warning`,t.attachmentFileTooLarge,{name:e.name,maxSize:w(T)}),null;try{return await o(e,e.name)}catch{return O(`error`,t.attachmentLoadFailed,{name:e.name}),null}}))).filter(e=>e!==null).map(e=>n?{...e,type:n}:e);f(e=>[...e,...s])},[t.attachmentFileTooLarge,t.attachmentLoadFailed,t.maxAttachmentsReached,t.maxAttachmentsTruncated]),v=(0,P.useCallback)(e=>_(e),[_]);return(0,P.useEffect)(()=>{if(e.conversationId)return g(e.conversationId,async e=>{let t=u.current.length;return await _([e]),u.current.length>t})},[_,e.conversationId]),{attachments:a,setAttachments:f,attachmentsRef:u,isDragging:s,setIsDragging:c,fileInputRef:l,processFiles:v,processPastedText:(0,P.useCallback)(e=>_([new File([e.text],e.name,{type:e.mimeType})],`pasted_text`),[_]),removeAttachment:m,clearAttachments:p,wireAttachmentsPayload:h}}export{R as n,I as r,B as t};
2
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{n as a}from"./locale-store-Dy0B0XDJ.js";import{t as o}from"./messages-Bj6DCoic.js";import{o as s,r as c,s as l,t as u}from"./dist-DlirbHVs.js";import{t as d}from"./chevron-left-DqFhpbvK.js";import{t as f}from"./chevron-right-BweFrslA.js";import{t as p}from"./file-code-corner-byQA1VfD.js";import{t as m}from"./file-CStvVK2S.js";import{n as h,r as g,s as _,t as v}from"./use-file-preview-expanded-CA9vFUTT.js";import{t as y}from"./mic-CuUb7zc-.js";import{u as b}from"./preview-runtime-DUJ7XhMP.js";import{n as x}from"./share-link-dialog-WR7Op1vL.js";import{t as S}from"./cn-0WouolD0.js";import{r as C}from"./turn-outcome-Bf3N3Bmj.js";import{i as w}from"./attachment-utils-core-BPYdUI6y.js";import{t as T}from"./constants-D5Z-mUto.js";import{r as E}from"./right-workspace-store-DsVm6C0V.js";import{n as D}from"./interaction-BdhHBbYa.js";import{t as O}from"./composer-notifications-CpBgWAE4.js";import{n as k}from"./electron-env-DHOGevH3.js";import{t as A}from"./use-share-link-CqV3o-VZ.js";import{n as j,t as M}from"./file-preview-surface-Da1xZiG6.js";var N=n(),P=e(t(),1),F=r();function I(e){let t=(0,N.c)(6),n=_(),r,i;if(t[0]!==n||t[1]!==e?(r=()=>{!n||e.embedded||!e.open||!e.attachment||(E.getState().openFile({attachment:e.attachment,images:e.images,conversationId:e.conversationId||void 0,resultRevision:e.resultRevision},n),e.onClose())},i=[n,e],t[0]=n,t[1]=e,t[2]=r,t[3]=i):(r=t[2],i=t[3]),(0,P.useEffect)(r,i),n&&!e.embedded)return null;let a;return t[4]===e?a=t[5]:(a=(0,F.jsx)(L,{...e}),t[4]=e,t[5]=a),a}function L({open:e,embedded:t=!1,showEmbeddedClose:n=!1,tabId:r,attachment:i,images:p=[],resultRevision:m,onAttachmentChange:g,authToken:_,conversationId:y,layerClassName:w=`z-[115]`,onClose:T}){let E=a(e=>e.language),N=o(E).chat,I=b({open:e,attachment:i,authToken:_,conversationId:y,language:E}),L=A(),{expanded:R,setExpanded:z}=v(e,L.dialogOpen),[B,V]=(0,P.useState)(!1),{preview:H,fileType:U,hasExtractedText:W}=I,G=i?p.findIndex(e=>e===i||e.id&&e.id===i.id||e.uri&&e.uri===i.uri||!e.id&&!e.uri&&e.name===i.name&&!!e.data&&e.data===i.data):-1,K=U===`image`&&p.length>1&&G>=0&&!!g,q=e=>{if(!K||L.dialogOpen)return;let t=G+(e===`previous`?-1:1);t>=0&&t<p.length&&g?.(p[t])},J=U!==`image`&&U!==`text`&&U!==`pptx`&&W,Y=H?.uri?C(H.uri):null,X=!!(Y||H?.uri?.startsWith(`media://`)&&(y||H.taskId)),ee=()=>{!H?.uri||!X||L.createShareLink(Y?{fileId:Y,fileName:H.name}:{uri:H.uri,conversationId:y??void 0,taskId:H.taskId,fileName:H.name})},te=!!(H&&!I.loading&&!I.loadError),Z=()=>{z(!1),T()},ne=()=>{if(!H||!I.downloadBuffer)return;let e=new Blob([I.downloadBuffer],{type:I.descriptor.mimeType}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=H.name??`download`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},re=!!I.downloadBuffer,ie=k()&&U===`spreadsheet`&&/\.xlsx?$/i.test(I.fileName)&&!!I.downloadBuffer&&!!window.electronAPI?.shell?.openTemporaryFile,ae=async()=>{let e=I.downloadBuffer,t=window.electronAPI?.shell?.openTemporaryFile;if(!(!e||!t||B)){V(!0);try{(await t({fileName:I.fileName,data:new Uint8Array(e)})).ok||O(`warning`,N.attachmentPreviewOpenLocalFailed)}catch{O(`warning`,N.attachmentPreviewOpenLocalFailed)}finally{V(!1)}}},oe={onDownload:ne,canDownload:re},Q=S(`min-h-0 min-w-0 flex-1 cursor-pointer border-0 p-0`,`bg-surface-base transition-colors`,`hover:bg-surface-hover/90 dark:bg-black/60 dark:hover:bg-black/70`,D.focusRingBase),$=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(h,{header:{expanded:R,onToggleExpanded:te?()=>z(e=>!e):void 0,hideClose:t&&!n,hideExpand:!!r,onClose:Z,share:X?{onClick:ee,loading:L.loading}:void 0,openWithSystemApp:ie?{onClick:()=>void ae(),loading:B}:void 0,textView:J?{active:I.showExtractedText,onChange:e=>{I.setShowExtractedText(e),I.clearLoadError()}}:void 0},chat:I.downloadBuffer?{conversationId:y,createFile:async()=>new File([I.downloadBuffer],I.fileName,{type:I.descriptor.mimeType})}:void 0,onImageSwipe:K?q:void 0,language:E,descriptor:r?{...I.descriptor,id:r}:I.descriptor,loading:I.loading,loadError:I.loadError,textContent:I.textContent,binaryBuffer:I.binaryBuffer,showExtractedText:I.showExtractedText,extractedText:I.extractedText,extractedTextTruncated:I.extractedTextTruncated,actions:oe}),m?(0,F.jsxs)(`p`,{className:`shrink-0 border-t border-edge px-4 py-2 text-xs text-fg-muted`,"data-result-revision":!0,children:[E===`zh`?`成果版本`:`Result version`,` `,m]}):null,K?(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center justify-center gap-4 border-t border-edge bg-surface-panel px-3 py-2`,children:[(0,F.jsx)(`button`,{type:`button`,"aria-label":N.attachmentPreviewPreviousImage,disabled:G===0,onClick:()=>q(`previous`),className:S(`flex size-11 touch-manipulation items-center justify-center rounded-lg hover:bg-surface-hover disabled:opacity-30`,D.focusRingBase),children:(0,F.jsx)(d,{size:20,"aria-hidden":`true`})}),(0,F.jsxs)(`span`,{role:`status`,className:`min-w-16 text-center text-sm tabular-nums text-fg-muted`,children:[G+1,` / `,p.length]}),(0,F.jsx)(`button`,{type:`button`,"aria-label":N.attachmentPreviewNextImage,disabled:G===p.length-1,onClick:()=>q(`next`),className:S(`flex size-11 touch-manipulation items-center justify-center rounded-lg hover:bg-surface-hover disabled:opacity-30`,D.focusRingBase),children:(0,F.jsx)(f,{size:20,"aria-hidden":`true`})})]}):null]});return t?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(M,{expanded:R,children:$}),(0,F.jsx)(x,{open:L.dialogOpen,onOpenChange:L.handleOpenChange,loading:L.loading,error:L.error,result:L.result,pendingParams:L.pendingParams,onConfirm:e=>void L.confirmShareLink(e)})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(u,{open:e,onOpenChange:e=>!e&&Z(),children:(0,F.jsx)(s,{children:(0,F.jsxs)(c,{"aria-describedby":void 0,onKeyDown:e=>{!K||L.dialogOpen||e.altKey||e.ctrlKey||e.metaKey||e.target.closest(`input, textarea, select, [contenteditable="true"]`)||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),q(e.key===`ArrowLeft`?`previous`:`next`))},className:S(`xopc-dialog-content-fullscreen fixed inset-0 flex h-[100dvh] w-full flex-row overflow-hidden`,j(),w,`border-0 bg-transparent p-0 shadow-none outline-none`),children:[(0,F.jsx)(l,{className:`sr-only`,children:H?.name??``}),(0,F.jsx)(`button`,{type:`button`,className:Q,onClick:Z,"aria-label":N.attachmentPreviewClose}),(0,F.jsx)(`div`,{className:S(`flex h-full min-h-0 shrink-0 flex-col overflow-hidden`,R?`w-full`:`w-[min(100%,var(--max-width-app-main))]`,`bg-surface-panel sm:border-x sm:border-edge dark:sm:border-edge`,`shadow-float dark:shadow-elevated`),children:$}),(0,F.jsx)(`button`,{type:`button`,className:Q,onClick:Z,"aria-label":N.attachmentPreviewClose})]})})}),(0,F.jsx)(x,{open:L.dialogOpen,onOpenChange:L.handleOpenChange,loading:L.loading,error:L.error,result:L.result,pendingParams:L.pendingParams,onConfirm:e=>void L.confirmShareLink(e)})]})}function R(e){let t=(0,N.c)(23),{attachments:n,conversationId:r,topPadded:i,onRemove:s,className:c}=e,l=a(z),u;t[0]===l?u=t[1]:(u=o(l),t[0]=l,t[1]=u);let d=u.chat,[f,h]=(0,P.useState)(null);if(n.length===0)return null;let g=i?`pt-2`:`pt-3`,_;t[2]!==c||t[3]!==g?(_=S(`flex flex-wrap gap-2 border-b border-edge-subtle/90 bg-surface-hover/20 px-4 pb-2 dark:border-edge-subtle`,g,c),t[2]=c,t[3]=g,t[4]=_):_=t[4];let v;if(t[5]!==n||t[6]!==d||t[7]!==s){let e;t[9]!==d||t[10]!==s?(e=(e,t)=>{let n=e.type===`pasted_text`?d.pastedText:e.name;return(0,F.jsxs)(`div`,{className:`flex max-w-[200px] items-center rounded-lg bg-surface-hover text-xs dark:bg-surface-hover/80`,children:[(0,F.jsxs)(`button`,{type:`button`,className:S(`flex min-w-0 flex-1 items-center gap-1.5 rounded-l-lg py-1 pl-2 pr-1 text-left hover:bg-surface-active`,D.transition,D.press,D.focusRingPanel),onClick:()=>h(e),"aria-label":`${d.attachmentPreviewOpen}: ${n}`,title:`${d.attachmentPreviewOpen}: ${n}`,children:[e.mimeType?.startsWith(`image/`)&&e.content?(0,F.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.content}`,alt:``,className:`size-6 shrink-0 rounded object-cover`}):e.type===`voice`||e.mimeType?.startsWith(`audio/`)?(0,F.jsx)(y,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}):e.type===`pasted_text`?(0,F.jsx)(p,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}):(0,F.jsx)(m,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n}),(0,F.jsx)(`span`,{className:`shrink-0 text-fg-disabled`,children:w(e.size)})]}),(0,F.jsx)(`button`,{type:`button`,className:S(`flex min-h-8 min-w-8 items-center justify-center rounded-r-lg text-fg-muted hover:bg-surface-active hover:text-fg`,D.transition,D.press,D.focusRingPanel),onClick:()=>s(t),"aria-label":`${d.attachmentPreviewRemove}: ${n}`,title:`${d.attachmentPreviewRemove}: ${n}`,children:(0,F.jsx)(`span`,{"aria-hidden":!0,children:`×`})})]},e.id??`${e.name}-${e.size}-${e.mimeType}-${e.content?.slice(0,16)??``}`)},t[9]=d,t[10]=s,t[11]=e):e=t[11],v=n.map(e),t[5]=n,t[6]=d,t[7]=s,t[8]=v}else v=t[8];let b;t[12]!==_||t[13]!==v?(b=(0,F.jsx)(`div`,{className:_,children:v}),t[12]=_,t[13]=v,t[14]=b):b=t[14];let x=f!==null,C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>h(null),t[15]=C):C=t[15];let T;t[16]!==r||t[17]!==f||t[18]!==x?(T=(0,F.jsx)(I,{open:x,attachment:f,conversationId:r,onClose:C}),t[16]=r,t[17]=f,t[18]=x,t[19]=T):T=t[19];let E;return t[20]!==b||t[21]!==T?(E=(0,F.jsxs)(F.Fragment,{children:[b,T]}),t[20]=b,t[21]=T,t[22]=E):E=t[22],E}function z(e){return e.language}function B(e){let{chat:t,initialAttachments:n=[],onAttachmentsChange:r}=e,[a,o]=(0,P.useState)(n),[s,c]=(0,P.useState)(!1),l=(0,P.useRef)(null),u=(0,P.useRef)(a),d=(0,P.useRef)(r);u.current=a,d.current=r;let f=(0,P.useCallback)(e=>{let t=typeof e==`function`?e(u.current):e;u.current=t,o(t),d.current?.(t)},[]),p=(0,P.useCallback)(()=>{f([])},[]),m=(0,P.useCallback)(e=>{f(t=>t.filter((t,n)=>n!==e))},[]),h=(0,P.useCallback)(()=>u.current.map(e=>({type:e.type===`voice`?`voice`:e.type||`file`,mimeType:e.mimeType,data:e.content,name:e.name,size:e.size,...e.uri?{uri:e.uri}:{},...typeof e.durationSeconds==`number`&&Number.isFinite(e.durationSeconds)&&e.durationSeconds>0?{durationSeconds:e.durationSeconds}:{}})),[]),_=(0,P.useCallback)(async(e,n)=>{if(e.length===0)return;let r=10-u.current.length;if(r<=0){O(`warning`,t.maxAttachmentsReached,{max:10});return}let a=e.slice(0,r);e.length>a.length&&O(`warning`,t.maxAttachmentsTruncated,{max:10,dropped:e.length-a.length});let{loadAttachment:o}=await i(async()=>{let{loadAttachment:e}=await import(`./attachment-load-C9iZLUHv.js`).then(e=>e.t);return{loadAttachment:e}},__vite__mapDeps([0,1,2])),s=(await Promise.all(a.map(async e=>{if(e.size>33554432)return O(`warning`,t.attachmentFileTooLarge,{name:e.name,maxSize:w(T)}),null;try{return await o(e,e.name)}catch{return O(`error`,t.attachmentLoadFailed,{name:e.name}),null}}))).filter(e=>e!==null).map(e=>n?{...e,type:n}:e);f(e=>[...e,...s])},[t.attachmentFileTooLarge,t.attachmentLoadFailed,t.maxAttachmentsReached,t.maxAttachmentsTruncated]),v=(0,P.useCallback)(e=>_(e),[_]);return(0,P.useEffect)(()=>{if(e.conversationId)return g(e.conversationId,async e=>{let t=u.current.length;return await _([e]),u.current.length>t})},[_,e.conversationId]),{attachments:a,setAttachments:f,attachmentsRef:u,isDragging:s,setIsDragging:c,fileInputRef:l,processFiles:v,processPastedText:(0,P.useCallback)(e=>_([new File([e.text],e.name,{type:e.mimeType})],`pasted_text`),[_]),removeAttachment:m,clearAttachments:p,wireAttachmentsPayload:h}}export{R as n,I as r,B as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n}from"./vendor-react-BOUWij0V.js";import{i as r,l as i,o as a}from"./locale-store-Dy0B0XDJ.js";import{t as o}from"./createLucideIcon-DPHK1VkS.js";import{I as s}from"./chat-page-XqG9aYBd.js";import{i as c,t as l}from"./vendor-swr-CdRzEUwF.js";import{t as u}from"./task-copy-CtcqCQ78.js";var d=o(`phone`,[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),f=n(),p=e(t(),1),m=10;function h(e){return r(`/api/personal-agent/activity?view=work&limit=${m}&offset=${e}`)}async function g([e]){return(await a(e)).payload}function _(e){let t=(0,f.c)(3),n=i(v),r;return t[0]!==e||t[1]!==n?(r=e?[h(0),e,n]:null,t[0]=e,t[1]=n,t[2]=r):r=t[2],c(r,g)}function v(e){return e.conversationId}function y(e,t,n){let r=(0,f.c)(36),a=i(S),[o,s]=(0,p.useState)(!1),c=t?.total??0,u;r[0]!==a||r[1]!==e||r[2]!==o||r[3]!==c?(u=(t,n)=>{let r=(t+1)*m;return!o||r>=c||n&&n.items.length<m?null:[h(r),e,a]},r[0]=a,r[1]=e,r[2]=o,r[3]=c,r[4]=u):u=r[4];let d;r[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={revalidateFirstPage:!1,shouldRetryOnError:!1},r[5]=d):d=r[5];let{data:_,error:v,isValidating:y,size:C,setSize:w,mutate:T}=l(u,g,d),E;r[6]!==t?.items||r[7]!==c?(E=JSON.stringify([c,t?.items.map(x)]),r[6]=t?.items,r[7]=c,r[8]=E):E=r[8];let D=E,O=(0,p.useRef)(D),k,A;r[9]!==D||r[10]!==T||r[11]!==o?(k=()=>{let e=O.current!==D;O.current=D,e&&o&&T()},A=[D,T,o],r[9]=D,r[10]=T,r[11]=o,r[12]=k,r[13]=A):(k=r[12],A=r[13]),(0,p.useEffect)(k,A);let j=_?.length??0,M;r[14]!==_||r[15]!==j||r[16]!==c?(M=(j+1)*m<c&&(j===0||_?.at(-1)?.items.length===m),r[14]=_,r[15]=j,r[16]=c,r[17]=M):M=r[17];let N=M,P=o&&!v&&N&&(y||C>j),F;r[18]!==w||r[19]!==C||r[20]!==o?(F=()=>{o?w(C+1):s(!0)},r[18]=w,r[19]=C,r[20]=o,r[21]=F):F=r[21];let I=F,L;r[22]===t?.items?L=r[23]:(L=t?.items??[],r[22]=t?.items,r[23]=L);let R;r[24]!==_||r[25]!==L?(R=[...L,...(_??[]).flatMap(b)],r[24]=_,r[25]=L,r[26]=R):R=r[26];let z=n?v:void 0,B=n&&N,V=n&&P,H;r[27]===T?H=r[28]:(H=()=>void T(),r[27]=T,r[28]=H);let U;return r[29]!==I||r[30]!==B||r[31]!==V||r[32]!==H||r[33]!==R||r[34]!==z?(U={items:R,error:z,hasMore:B,loading:V,loadMore:I,retry:H},r[29]=I,r[30]=B,r[31]=V,r[32]=H,r[33]=R,r[34]=z,r[35]=U):U=r[35],U}function b(e){return e.items}function x(e){return e.id}function S(e){return e.conversationId}function C(e){let t=(0,f.c)(6),n=i(T),a=`/api/sessions/${encodeURIComponent(e??``)}/clarification`,o;t[0]===a?o=t[1]:(o=r(a),t[0]=a,t[1]=o);let s=o,l;return t[2]!==e||t[3]!==n||t[4]!==s?(l=e?[s,e,n]:null,t[2]=e,t[3]=n,t[4]=s,t[5]=l):l=t[5],c(l,w)}async function w(e){let[t]=e;return(await a(t)).payload?.clarification??null}function T(e){return e.conversationId}function E(e){return!!e.attention||e.presentation.status===`needsUser`||e.presentation.status===`review`}function D(e,t,n){let r=(0,f.c)(5),i,a;r[0]!==e||r[1]!==n||r[2]!==t?(i=()=>{if(!e)return;let r,i=()=>{window.clearTimeout(r),r=window.setTimeout(()=>{Promise.allSettled([t(),n?.()])},120)},a=[`task-changed-v2`,`task-updated`,`clarification-updated`,`gateway-realtime-connected`],o=t=>{t.detail?.key===e&&i()};a.forEach(e=>window.addEventListener(e,i)),window.addEventListener(`session-transcript-updated`,o);let s=window.setInterval(()=>{document.visibilityState===`visible`&&i()},15e3);return()=>{window.clearTimeout(r),window.clearInterval(s),a.forEach(e=>window.removeEventListener(e,i)),window.removeEventListener(`session-transcript-updated`,o)}},a=[e,t,n],r[0]=e,r[1]=n,r[2]=t,r[3]=i,r[4]=a):(i=r[3],a=r[4]),(0,p.useEffect)(i,a)}function O(e,t){let n=(0,f.c)(5),r=(0,p.useRef)(null),i=(0,p.useRef)(null),a,o;n[0]!==e||n[1]!==t?(a=()=>{let n=r.current,a=i.current;if(!e||!n||!a||typeof IntersectionObserver>`u`)return;let o=new IntersectionObserver(e=>{e.some(k)&&t()},{root:n,rootMargin:`0px 0px 120px`});return o.observe(a),()=>o.disconnect()},o=[e,t],n[0]=e,n[1]=t,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,p.useEffect)(a,o);let s;return n[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={listRef:r,loadMoreRef:i},n[4]=s):s=n[4],s}function k(e){return e.isIntersecting}function A(e){return e?.status===`open`&&(e.expiresAt===void 0||e.expiresAt>Date.now())}function j(e,t){let{status:n}=e.presentation,r=n===`failed`?`bg-danger`:[`needsUser`,`review`,`waiting`,`blocked`,`paused`].includes(n)?`bg-warning`:[`running`,`verifying`,`completed`].includes(n)?`bg-accent`:`bg-fg-subtle`;return[u(t?`zh`:`en`).detailStatuses[n],r]}function M(e,t){let n=(0,f.c)(26),r;n[0]===e?r=n[1]:(r=t=>e?t.runs[e]:void 0,n[0]=e,n[1]=r);let i=s(r),{data:a,mutate:o,error:c}=_(e),{data:l,mutate:u,error:d}=C(e),m,h,g,v;if(n[2]!==l||n[3]!==a?.current){m=a?.current??[];let e=m.filter(E);v=e.length,h=Number,g=A(l)&&!e.some(e=>e.prompt?.id===l.id),n[2]=l,n[3]=a?.current,n[4]=m,n[5]=h,n[6]=g,n[7]=v}else m=n[4],h=n[5],g=n[6],v=n[7];let y=v+h(g),b;n[8]===m?b=n[9]:(b=m.filter(F),n[8]=m,n[9]=b);let x=b,S;n[10]===m?S=n[11]:(S=m.filter(P),n[10]=m,n[11]=S);let w=S,T;n[12]===a?.items?T=n[13]:(T=a?.items.find(N)?.updatedAt,n[12]=a?.items,n[13]=T);let D=T,[O,k]=(0,p.useState)(),j,M;n[14]===D?(j=n[15],M=n[16]):(j=()=>{if(D===void 0)return;let e=D+4e3-Date.now();if(e<=0)return;k(D);let t=window.setTimeout(()=>k(void 0),e);return()=>window.clearTimeout(t)},M=[D],n[14]=D,n[15]=j,n[16]=M),(0,p.useEffect)(j,M);let I=O!==void 0&&O===D,L=y?`waiting`:x.length||w.length||i?.status===`running`?`working`:i?.status===`waiting`?`waiting`:I?`delivered`:`idle`,R=``;y?R=t?`有 ${y} 项待你处理`:`${y} to review`:x.length>1?R=t?`有 ${x.length} 项正在推进`:`${x.length} in progress`:x[0]?R=t?`正在推进 · ${x[0].title}`:`Working · ${x[0].title}`:i?.status===`running`?R=t?`正在回复`:`Responding`:w.length?R=t?`有 ${w.length} 项等待开始`:`${w.length} queued`:i?.status===`waiting`?R=t?`等待继续`:`Waiting to resume`:I?R=t?`刚刚完成交付`:`Just delivered`:(c||d)&&(R=t?`暂时无法更新状态`:`Status unavailable`);let z;return n[17]!==y||n[18]!==L||n[19]!==l||n[20]!==u||n[21]!==o||n[22]!==R||n[23]!==a||n[24]!==c?(z={work:a,workError:c,prompt:l,avatarState:L,summary:R,attentionCount:y,refreshWork:o,refreshPrompt:u},n[17]=y,n[18]=L,n[19]=l,n[20]=u,n[21]=o,n[22]=R,n[23]=a,n[24]=c,n[25]=z):z=n[25],z}function N(e){return e.resolution===`done`}function P(e){return e.operationalState===`queued`||e.operationalState===`allocating`}function F(e){return e.operationalState===`running`||e.operationalState===`verifying`}export{y as a,d as c,O as i,E as n,M as o,j as r,D as s,A as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n}from"./vendor-react-BOUWij0V.js";import{i as r,l as i,o as a}from"./locale-store-Dy0B0XDJ.js";import{t as o}from"./createLucideIcon-DPHK1VkS.js";import{I as s}from"./chat-page-oy4EGdO1.js";import{i as c,t as l}from"./vendor-swr-CdRzEUwF.js";import{t as u}from"./task-copy-CtcqCQ78.js";var d=o(`phone`,[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]),f=n(),p=e(t(),1),m=10;function h(e){return r(`/api/personal-agent/activity?view=work&limit=${m}&offset=${e}`)}async function g([e]){return(await a(e)).payload}function _(e){let t=(0,f.c)(3),n=i(v),r;return t[0]!==e||t[1]!==n?(r=e?[h(0),e,n]:null,t[0]=e,t[1]=n,t[2]=r):r=t[2],c(r,g)}function v(e){return e.conversationId}function y(e,t,n){let r=(0,f.c)(36),a=i(S),[o,s]=(0,p.useState)(!1),c=t?.total??0,u;r[0]!==a||r[1]!==e||r[2]!==o||r[3]!==c?(u=(t,n)=>{let r=(t+1)*m;return!o||r>=c||n&&n.items.length<m?null:[h(r),e,a]},r[0]=a,r[1]=e,r[2]=o,r[3]=c,r[4]=u):u=r[4];let d;r[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={revalidateFirstPage:!1,shouldRetryOnError:!1},r[5]=d):d=r[5];let{data:_,error:v,isValidating:y,size:C,setSize:w,mutate:T}=l(u,g,d),E;r[6]!==t?.items||r[7]!==c?(E=JSON.stringify([c,t?.items.map(x)]),r[6]=t?.items,r[7]=c,r[8]=E):E=r[8];let D=E,O=(0,p.useRef)(D),k,A;r[9]!==D||r[10]!==T||r[11]!==o?(k=()=>{let e=O.current!==D;O.current=D,e&&o&&T()},A=[D,T,o],r[9]=D,r[10]=T,r[11]=o,r[12]=k,r[13]=A):(k=r[12],A=r[13]),(0,p.useEffect)(k,A);let j=_?.length??0,M;r[14]!==_||r[15]!==j||r[16]!==c?(M=(j+1)*m<c&&(j===0||_?.at(-1)?.items.length===m),r[14]=_,r[15]=j,r[16]=c,r[17]=M):M=r[17];let N=M,P=o&&!v&&N&&(y||C>j),F;r[18]!==w||r[19]!==C||r[20]!==o?(F=()=>{o?w(C+1):s(!0)},r[18]=w,r[19]=C,r[20]=o,r[21]=F):F=r[21];let I=F,L;r[22]===t?.items?L=r[23]:(L=t?.items??[],r[22]=t?.items,r[23]=L);let R;r[24]!==_||r[25]!==L?(R=[...L,...(_??[]).flatMap(b)],r[24]=_,r[25]=L,r[26]=R):R=r[26];let z=n?v:void 0,B=n&&N,V=n&&P,H;r[27]===T?H=r[28]:(H=()=>void T(),r[27]=T,r[28]=H);let U;return r[29]!==I||r[30]!==B||r[31]!==V||r[32]!==H||r[33]!==R||r[34]!==z?(U={items:R,error:z,hasMore:B,loading:V,loadMore:I,retry:H},r[29]=I,r[30]=B,r[31]=V,r[32]=H,r[33]=R,r[34]=z,r[35]=U):U=r[35],U}function b(e){return e.items}function x(e){return e.id}function S(e){return e.conversationId}function C(e){let t=(0,f.c)(6),n=i(T),a=`/api/sessions/${encodeURIComponent(e??``)}/clarification`,o;t[0]===a?o=t[1]:(o=r(a),t[0]=a,t[1]=o);let s=o,l;return t[2]!==e||t[3]!==n||t[4]!==s?(l=e?[s,e,n]:null,t[2]=e,t[3]=n,t[4]=s,t[5]=l):l=t[5],c(l,w)}async function w(e){let[t]=e;return(await a(t)).payload?.clarification??null}function T(e){return e.conversationId}function E(e){return!!e.attention||e.presentation.status===`needsUser`||e.presentation.status===`review`}function D(e,t,n){let r=(0,f.c)(5),i,a;r[0]!==e||r[1]!==n||r[2]!==t?(i=()=>{if(!e)return;let r,i=()=>{window.clearTimeout(r),r=window.setTimeout(()=>{Promise.allSettled([t(),n?.()])},120)},a=[`task-changed-v2`,`task-updated`,`clarification-updated`,`gateway-realtime-connected`],o=t=>{t.detail?.key===e&&i()};a.forEach(e=>window.addEventListener(e,i)),window.addEventListener(`session-transcript-updated`,o);let s=window.setInterval(()=>{document.visibilityState===`visible`&&i()},15e3);return()=>{window.clearTimeout(r),window.clearInterval(s),a.forEach(e=>window.removeEventListener(e,i)),window.removeEventListener(`session-transcript-updated`,o)}},a=[e,t,n],r[0]=e,r[1]=n,r[2]=t,r[3]=i,r[4]=a):(i=r[3],a=r[4]),(0,p.useEffect)(i,a)}function O(e,t){let n=(0,f.c)(5),r=(0,p.useRef)(null),i=(0,p.useRef)(null),a,o;n[0]!==e||n[1]!==t?(a=()=>{let n=r.current,a=i.current;if(!e||!n||!a||typeof IntersectionObserver>`u`)return;let o=new IntersectionObserver(e=>{e.some(k)&&t()},{root:n,rootMargin:`0px 0px 120px`});return o.observe(a),()=>o.disconnect()},o=[e,t],n[0]=e,n[1]=t,n[2]=a,n[3]=o):(a=n[2],o=n[3]),(0,p.useEffect)(a,o);let s;return n[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={listRef:r,loadMoreRef:i},n[4]=s):s=n[4],s}function k(e){return e.isIntersecting}function A(e){return e?.status===`open`&&(e.expiresAt===void 0||e.expiresAt>Date.now())}function j(e,t){let{status:n}=e.presentation,r=n===`failed`?`bg-danger`:[`needsUser`,`review`,`waiting`,`blocked`,`paused`].includes(n)?`bg-warning`:[`running`,`verifying`,`completed`].includes(n)?`bg-accent`:`bg-fg-subtle`;return[u(t?`zh`:`en`).detailStatuses[n],r]}function M(e,t){let n=(0,f.c)(26),r;n[0]===e?r=n[1]:(r=t=>e?t.runs[e]:void 0,n[0]=e,n[1]=r);let i=s(r),{data:a,mutate:o,error:c}=_(e),{data:l,mutate:u,error:d}=C(e),m,h,g,v;if(n[2]!==l||n[3]!==a?.current){m=a?.current??[];let e=m.filter(E);v=e.length,h=Number,g=A(l)&&!e.some(e=>e.prompt?.id===l.id),n[2]=l,n[3]=a?.current,n[4]=m,n[5]=h,n[6]=g,n[7]=v}else m=n[4],h=n[5],g=n[6],v=n[7];let y=v+h(g),b;n[8]===m?b=n[9]:(b=m.filter(F),n[8]=m,n[9]=b);let x=b,S;n[10]===m?S=n[11]:(S=m.filter(P),n[10]=m,n[11]=S);let w=S,T;n[12]===a?.items?T=n[13]:(T=a?.items.find(N)?.updatedAt,n[12]=a?.items,n[13]=T);let D=T,[O,k]=(0,p.useState)(),j,M;n[14]===D?(j=n[15],M=n[16]):(j=()=>{if(D===void 0)return;let e=D+4e3-Date.now();if(e<=0)return;k(D);let t=window.setTimeout(()=>k(void 0),e);return()=>window.clearTimeout(t)},M=[D],n[14]=D,n[15]=j,n[16]=M),(0,p.useEffect)(j,M);let I=O!==void 0&&O===D,L=y?`waiting`:x.length||w.length||i?.status===`running`?`working`:i?.status===`waiting`?`waiting`:I?`delivered`:`idle`,R=``;y?R=t?`有 ${y} 项待你处理`:`${y} to review`:x.length>1?R=t?`有 ${x.length} 项正在推进`:`${x.length} in progress`:x[0]?R=t?`正在推进 · ${x[0].title}`:`Working · ${x[0].title}`:i?.status===`running`?R=t?`正在回复`:`Responding`:w.length?R=t?`有 ${w.length} 项等待开始`:`${w.length} queued`:i?.status===`waiting`?R=t?`等待继续`:`Waiting to resume`:I?R=t?`刚刚完成交付`:`Just delivered`:(c||d)&&(R=t?`暂时无法更新状态`:`Status unavailable`);let z;return n[17]!==y||n[18]!==L||n[19]!==l||n[20]!==u||n[21]!==o||n[22]!==R||n[23]!==a||n[24]!==c?(z={work:a,workError:c,prompt:l,avatarState:L,summary:R,attentionCount:y,refreshWork:o,refreshPrompt:u},n[17]=y,n[18]=L,n[19]=l,n[20]=u,n[21]=o,n[22]=R,n[23]=a,n[24]=c,n[25]=z):z=n[25],z}function N(e){return e.resolution===`done`}function P(e){return e.operationalState===`queued`||e.operationalState===`allocating`}function F(e){return e.operationalState===`running`||e.operationalState===`verifying`}export{y as a,d as c,O as i,E as n,M as o,j as r,D as s,A as t};
@@ -1 +1 @@
1
- import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i}from"./locale-store-Dy0B0XDJ.js";import{t as a}from"./messages-Bj6DCoic.js";import{n as ee,t as o}from"./use-file-preview-expanded-CA9vFUTT.js";import{c as s,h as c,l,s as u}from"./preview-runtime-DUJ7XhMP.js";import{n as d}from"./share-link-dialog-WR7Op1vL.js";import{t as f}from"./cn-0WouolD0.js";import{t as p}from"./skeleton-DzdOeGYz.js";import{r as m}from"./right-workspace-store-CcRApllu.js";import{t as h}from"./copy-to-clipboard-HOJ79TWv.js";import{t as g}from"./composer-notifications-CpBgWAE4.js";import{i as _}from"./theme-store-XNsFzxSj.js";import{n as v}from"./electron-env-DHOGevH3.js";import{t as y}from"./use-share-link-CqV3o-VZ.js";import{t as b}from"./file-preview-surface-Da1xZiG6.js";var x=e(n(),1);async function S(e,t){try{let n=await e();return n&&`ok`in n&&n.code===`CANCELED`?!1:n&&(`ok`in n?n.ok:n.success)?!0:(g(`warning`,n?.error||t,void 0,{duration:4e3}),!1)}catch{return g(`warning`,t,void 0,{duration:4e3}),!1}}var C=new Map;function w(e,t){return C.set(e,t),()=>{C.get(e)===t&&C.delete(e)}}async function T(e){return await C.get(e)?.()??!0}var E=t({WorkspaceFilePreviewPanel:()=>A}),D=r(),O=new Intl.DateTimeFormat(`zh-CN`,{dateStyle:`medium`,timeStyle:`short`}),k=new Intl.DateTimeFormat(`en`,{dateStyle:`medium`,timeStyle:`short`});function te(e,t){return(t===`zh`?O:k).format(new Date(e))}function A({filePath:e,tabId:t,showEmbeddedClose:n=!1,active:r=!0,onClose:C,targetLine:T,resultRevision:E,resolvedFile:O,projectId:k,conversationId:A,agentId:j}){let M=i(e=>e.language),N=a(M),P=_(e=>e.resolved),F=l({filePath:e,projectId:k,conversationId:A,agentId:j,resolvedFile:O,initialEditMode:t?u(t).sourceEditMode:!1}),{dialogOpen:I,loading:L,result:R,error:z,pendingParams:B,createShareLink:V,confirmShareLink:H,handleOpenChange:U}=y(),[W,G]=(0,x.useState)(!1),[K,q]=(0,x.useState)(!1),{expanded:J,setExpanded:Y}=o(!!e,I);(0,x.useEffect)(()=>{t&&s(t,{sourceEditMode:F.sourceEditMode})},[F.sourceEditMode,t]),(0,x.useEffect)(()=>{if(t)return w(t,F.flushSource)},[F.flushSource,t]),(0,x.useEffect)(()=>{t&&F.fileResourceId&&m.getState().resolveFileIdentity(t,F.fileResourceId)},[F.fileResourceId,t]),(0,x.useEffect)(()=>{t&&m.getState().setFileStatus(t,F.saveStatus===`error`?`error`:F.dirty?`dirty`:null)},[F.dirty,F.saveStatus,t]),(0,x.useEffect)(()=>{let e=()=>{document.visibilityState!==`hidden`&&F.checkForUpdates()};return window.addEventListener(`focus`,e),window.addEventListener(`workspace-refresh-files`,e),window.addEventListener(`agent-run-ended`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),window.removeEventListener(`workspace-refresh-files`,e),window.removeEventListener(`agent-run-ended`,e),document.removeEventListener(`visibilitychange`,e)}},[F.checkForUpdates]);let X=e?c(e):``,Z=[`text`,`markdown`,`code`,`html`].includes(F.descriptor.type),ne=(0,x.useCallback)(async()=>{if(e){if(await h(e)){G(!0),g(`success`,N.workspace.pathCopied,void 0,{duration:2500}),window.setTimeout(()=>G(!1),2e3);return}g(`warning`,N.clipboard.copyFailed,void 0,{duration:4e3})}},[e,N.clipboard.copyFailed,N.workspace.pathCopied]),Q=(0,x.useCallback)(()=>{F.fileResourceId&&V({fileId:F.fileResourceId,fileName:X})},[V,X,F.fileResourceId]),$=(0,x.useCallback)(async()=>{await S(()=>F.onOpenWithSystemApp(),N.chat.attachmentPreviewOpenLocalFailed)},[N.chat.attachmentPreviewOpenLocalFailed,F.onOpenWithSystemApp]),re=(0,x.useCallback)(async()=>{let e;return await S(async()=>{let t=await F.onChooseOpenWithApp();return t?.ok&&(e=t.app),t},N.workspace.openFileFailed),e},[N.workspace.openFileFailed,F.onChooseOpenWithApp]),ie=(0,x.useCallback)(async e=>{await S(()=>F.onOpenWithRecentApp(e),N.workspace.openFileFailed)},[N.workspace.openFileFailed,F.onOpenWithRecentApp]),ae=(0,x.useCallback)(async()=>{await S(()=>F.onRevealInFolder(),N.workspace.revealFileFailed)},[N.workspace.revealFileFailed,F.onRevealInFolder]),oe=(0,x.useCallback)(()=>{Y(!1),C()},[C]),se=!!(e&&!F.loading&&!F.loadError),ce={onDownload:()=>void F.onDownload(),canDownload:F.canDownload,onOpenWithSystemApp:()=>void $(),canOpenWithSystemApp:F.canOpenWithSystemApp,onChooseOpenWithApp:()=>void F.onChooseOpenWithApp(),canChooseOpenWithApp:F.canChooseOpenWithApp};return!e||!r?null:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(b,{expanded:J,children:(0,D.jsx)(ee,{header:{subtitle:(0,D.jsxs)(D.Fragment,{children:[!F.loading&&F.mtimeMs!=null?(0,D.jsxs)(`p`,{suppressHydrationWarning:!0,className:`min-w-0 truncate`,title:new Date(F.mtimeMs).toISOString(),children:[N.workspace.lastModified,`: `,te(F.mtimeMs,M),T?` · Line ${T}`:``]}):null,F.externalChange?(0,D.jsx)(`span`,{role:`status`,className:`text-fg-muted`,children:M===`zh`?`文件已更新,请先处理当前编辑`:`File changed; review your current edits`}):null,E?(0,D.jsxs)(`span`,{className:`shrink-0`,"data-result-revision":!0,children:[M===`zh`?`成果版本`:`Result version`,` `,E]}):null,F.loading?(0,D.jsx)(p,{className:`h-3.5 w-32`}):null,Z&&F.sourceEditMode&&F.saveStatus!==`idle`?(0,D.jsx)(`span`,{className:f(`shrink-0`,F.saveStatus===`error`&&`text-red-600 dark:text-red-400`),children:F.saveStatus===`saving`?N.workspace.saving:F.saveStatus===`error`?N.workspace.saveFailed:N.workspace.saved}):null]}),expanded:J,onRefresh:F.refresh,onRetrySave:F.saveStatus===`error`?()=>void F.flushSource():void 0,onToggleExpanded:se?()=>Y(e=>!e):void 0,hideClose:!!t&&!n,hideExpand:!!t,onClose:oe,edit:Z?{active:F.sourceEditMode,onToggle:()=>F.setSourceEditMode(e=>!e)}:void 0,wordWrap:Z&&F.sourceEditMode?{active:K,onToggle:()=>q(e=>!e)}:void 0,share:{onClick:Q,loading:L,disabled:!F.fileResourceId||F.loading||!!F.loadError},openWithSystemApp:F.canOpenWithSystemApp||v()&&window.electronAPI?.shell?.openFileResource?{onClick:()=>void $(),disabled:F.loading||!F.canOpenWithSystemApp}:void 0,chooseApp:F.canChooseOpenWithApp?{onClick:re}:void 0,recommendedApps:F.recommendedOpenWithApps,recentApps:F.recentOpenWithApps,onOpenWithApp:e=>void ie(e),onRevealInFolder:F.canRevealInFolder?()=>void ae():void 0,copyPath:{copied:W,onClick:()=>void ne()}},chat:{createFile:F.createAttachmentFile,projectId:k,conversationId:A,agentId:j,disabled:F.saveStatus===`saving`},language:M,resolvedTheme:P,descriptor:t?{...F.descriptor,id:t}:F.descriptor,loading:F.loading,loadError:F.loadError,textContent:F.textContent,binaryBuffer:F.binaryBuffer,fileResourceId:F.fileResourceId,mtimeMs:F.mtimeMs,targetLine:T,extractedText:F.extractedText,extractedTextTruncated:F.extractedTextTruncated,workspaceEditing:{sourceEditMode:F.sourceEditMode,onSourceChange:e=>{t&&m.getState().keepFileOpen(t),F.onSourceChange(e)},sourceWordWrap:K,isDark:P===`dark`},actions:ce})}),(0,D.jsx)(d,{open:I,onOpenChange:U,loading:L,error:z,result:R,pendingParams:B,onConfirm:e=>void H(e)})]})}export{S as i,E as n,T as r,A as t};
1
+ import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{a as n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i}from"./locale-store-Dy0B0XDJ.js";import{t as a}from"./messages-Bj6DCoic.js";import{n as ee,t as o}from"./use-file-preview-expanded-CA9vFUTT.js";import{c as s,h as c,l,s as u}from"./preview-runtime-DUJ7XhMP.js";import{n as d}from"./share-link-dialog-WR7Op1vL.js";import{t as f}from"./cn-0WouolD0.js";import{t as p}from"./skeleton-DzdOeGYz.js";import{r as m}from"./right-workspace-store-DsVm6C0V.js";import{t as h}from"./copy-to-clipboard-HOJ79TWv.js";import{t as g}from"./composer-notifications-CpBgWAE4.js";import{i as _}from"./theme-store-XNsFzxSj.js";import{n as v}from"./electron-env-DHOGevH3.js";import{t as y}from"./use-share-link-CqV3o-VZ.js";import{t as b}from"./file-preview-surface-Da1xZiG6.js";var x=e(n(),1);async function S(e,t){try{let n=await e();return n&&`ok`in n&&n.code===`CANCELED`?!1:n&&(`ok`in n?n.ok:n.success)?!0:(g(`warning`,n?.error||t,void 0,{duration:4e3}),!1)}catch{return g(`warning`,t,void 0,{duration:4e3}),!1}}var C=new Map;function w(e,t){return C.set(e,t),()=>{C.get(e)===t&&C.delete(e)}}async function T(e){return await C.get(e)?.()??!0}var E=t({WorkspaceFilePreviewPanel:()=>A}),D=r(),O=new Intl.DateTimeFormat(`zh-CN`,{dateStyle:`medium`,timeStyle:`short`}),k=new Intl.DateTimeFormat(`en`,{dateStyle:`medium`,timeStyle:`short`});function te(e,t){return(t===`zh`?O:k).format(new Date(e))}function A({filePath:e,tabId:t,showEmbeddedClose:n=!1,active:r=!0,onClose:C,targetLine:T,resultRevision:E,resolvedFile:O,projectId:k,conversationId:A,agentId:j}){let M=i(e=>e.language),N=a(M),P=_(e=>e.resolved),F=l({filePath:e,projectId:k,conversationId:A,agentId:j,resolvedFile:O,initialEditMode:t?u(t).sourceEditMode:!1}),{dialogOpen:I,loading:L,result:R,error:z,pendingParams:B,createShareLink:V,confirmShareLink:H,handleOpenChange:U}=y(),[W,G]=(0,x.useState)(!1),[K,q]=(0,x.useState)(!1),{expanded:J,setExpanded:Y}=o(!!e,I);(0,x.useEffect)(()=>{t&&s(t,{sourceEditMode:F.sourceEditMode})},[F.sourceEditMode,t]),(0,x.useEffect)(()=>{if(t)return w(t,F.flushSource)},[F.flushSource,t]),(0,x.useEffect)(()=>{t&&F.fileResourceId&&m.getState().resolveFileIdentity(t,F.fileResourceId)},[F.fileResourceId,t]),(0,x.useEffect)(()=>{t&&m.getState().setFileStatus(t,F.saveStatus===`error`?`error`:F.dirty?`dirty`:null)},[F.dirty,F.saveStatus,t]),(0,x.useEffect)(()=>{let e=()=>{document.visibilityState!==`hidden`&&F.checkForUpdates()};return window.addEventListener(`focus`,e),window.addEventListener(`workspace-refresh-files`,e),window.addEventListener(`agent-run-ended`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),window.removeEventListener(`workspace-refresh-files`,e),window.removeEventListener(`agent-run-ended`,e),document.removeEventListener(`visibilitychange`,e)}},[F.checkForUpdates]);let X=e?c(e):``,Z=[`text`,`markdown`,`code`,`html`].includes(F.descriptor.type),ne=(0,x.useCallback)(async()=>{if(e){if(await h(e)){G(!0),g(`success`,N.workspace.pathCopied,void 0,{duration:2500}),window.setTimeout(()=>G(!1),2e3);return}g(`warning`,N.clipboard.copyFailed,void 0,{duration:4e3})}},[e,N.clipboard.copyFailed,N.workspace.pathCopied]),Q=(0,x.useCallback)(()=>{F.fileResourceId&&V({fileId:F.fileResourceId,fileName:X})},[V,X,F.fileResourceId]),$=(0,x.useCallback)(async()=>{await S(()=>F.onOpenWithSystemApp(),N.chat.attachmentPreviewOpenLocalFailed)},[N.chat.attachmentPreviewOpenLocalFailed,F.onOpenWithSystemApp]),re=(0,x.useCallback)(async()=>{let e;return await S(async()=>{let t=await F.onChooseOpenWithApp();return t?.ok&&(e=t.app),t},N.workspace.openFileFailed),e},[N.workspace.openFileFailed,F.onChooseOpenWithApp]),ie=(0,x.useCallback)(async e=>{await S(()=>F.onOpenWithRecentApp(e),N.workspace.openFileFailed)},[N.workspace.openFileFailed,F.onOpenWithRecentApp]),ae=(0,x.useCallback)(async()=>{await S(()=>F.onRevealInFolder(),N.workspace.revealFileFailed)},[N.workspace.revealFileFailed,F.onRevealInFolder]),oe=(0,x.useCallback)(()=>{Y(!1),C()},[C]),se=!!(e&&!F.loading&&!F.loadError),ce={onDownload:()=>void F.onDownload(),canDownload:F.canDownload,onOpenWithSystemApp:()=>void $(),canOpenWithSystemApp:F.canOpenWithSystemApp,onChooseOpenWithApp:()=>void F.onChooseOpenWithApp(),canChooseOpenWithApp:F.canChooseOpenWithApp};return!e||!r?null:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(b,{expanded:J,children:(0,D.jsx)(ee,{header:{subtitle:(0,D.jsxs)(D.Fragment,{children:[!F.loading&&F.mtimeMs!=null?(0,D.jsxs)(`p`,{suppressHydrationWarning:!0,className:`min-w-0 truncate`,title:new Date(F.mtimeMs).toISOString(),children:[N.workspace.lastModified,`: `,te(F.mtimeMs,M),T?` · Line ${T}`:``]}):null,F.externalChange?(0,D.jsx)(`span`,{role:`status`,className:`text-fg-muted`,children:M===`zh`?`文件已更新,请先处理当前编辑`:`File changed; review your current edits`}):null,E?(0,D.jsxs)(`span`,{className:`shrink-0`,"data-result-revision":!0,children:[M===`zh`?`成果版本`:`Result version`,` `,E]}):null,F.loading?(0,D.jsx)(p,{className:`h-3.5 w-32`}):null,Z&&F.sourceEditMode&&F.saveStatus!==`idle`?(0,D.jsx)(`span`,{className:f(`shrink-0`,F.saveStatus===`error`&&`text-red-600 dark:text-red-400`),children:F.saveStatus===`saving`?N.workspace.saving:F.saveStatus===`error`?N.workspace.saveFailed:N.workspace.saved}):null]}),expanded:J,onRefresh:F.refresh,onRetrySave:F.saveStatus===`error`?()=>void F.flushSource():void 0,onToggleExpanded:se?()=>Y(e=>!e):void 0,hideClose:!!t&&!n,hideExpand:!!t,onClose:oe,edit:Z?{active:F.sourceEditMode,onToggle:()=>F.setSourceEditMode(e=>!e)}:void 0,wordWrap:Z&&F.sourceEditMode?{active:K,onToggle:()=>q(e=>!e)}:void 0,share:{onClick:Q,loading:L,disabled:!F.fileResourceId||F.loading||!!F.loadError},openWithSystemApp:F.canOpenWithSystemApp||v()&&window.electronAPI?.shell?.openFileResource?{onClick:()=>void $(),disabled:F.loading||!F.canOpenWithSystemApp}:void 0,chooseApp:F.canChooseOpenWithApp?{onClick:re}:void 0,recommendedApps:F.recommendedOpenWithApps,recentApps:F.recentOpenWithApps,onOpenWithApp:e=>void ie(e),onRevealInFolder:F.canRevealInFolder?()=>void ae():void 0,copyPath:{copied:W,onClick:()=>void ne()}},chat:{createFile:F.createAttachmentFile,projectId:k,conversationId:A,agentId:j,disabled:F.saveStatus===`saving`},language:M,resolvedTheme:P,descriptor:t?{...F.descriptor,id:t}:F.descriptor,loading:F.loading,loadError:F.loadError,textContent:F.textContent,binaryBuffer:F.binaryBuffer,fileResourceId:F.fileResourceId,mtimeMs:F.mtimeMs,targetLine:T,extractedText:F.extractedText,extractedTextTruncated:F.extractedTextTruncated,workspaceEditing:{sourceEditMode:F.sourceEditMode,onSourceChange:e=>{t&&m.getState().keepFileOpen(t),F.onSourceChange(e)},sourceWordWrap:K,isDark:P===`dark`},actions:ce})}),(0,D.jsx)(d,{open:I,onOpenChange:U,loading:L,error:z,result:R,pendingParams:B,onConfirm:e=>void H(e)})]})}export{S as i,E as n,T as r,A as t};
@@ -11,7 +11,7 @@
11
11
  <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=20260910-1" />
12
12
  <link rel="manifest" href="/site.webmanifest?v=20260910-1" />
13
13
  <title>XOPC — Keep what matters moving.</title>
14
- <script type="module" crossorigin src="/assets/index-BjU5H5hz.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-BiQP7-5r.js"></script>
15
15
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/marked.esm-8VXEA2AD.js">
17
17
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-BOUWij0V.js">
@@ -171,9 +171,9 @@
171
171
  <link rel="modulepreload" crossorigin href="/assets/capabilities-G2ZaAAs2.js">
172
172
  <link rel="modulepreload" crossorigin href="/assets/capabilities-B5gHYD8r.js">
173
173
  <link rel="modulepreload" crossorigin href="/assets/phone-workspace-store-CcA_vo-t.js">
174
- <link rel="modulepreload" crossorigin href="/assets/right-workspace-store-CcRApllu.js">
174
+ <link rel="modulepreload" crossorigin href="/assets/right-workspace-store-DsVm6C0V.js">
175
175
  <link rel="modulepreload" crossorigin href="/assets/workspace-editor-agent-store-BuYdf4CO.js">
176
- <link rel="modulepreload" crossorigin href="/assets/home-task-actions-GAO06s1_.js">
176
+ <link rel="modulepreload" crossorigin href="/assets/home-task-actions-Ck0AhcYe.js">
177
177
  <link rel="modulepreload" crossorigin href="/assets/chat-agents-api-DRKlkcuv.js">
178
178
  <link rel="modulepreload" crossorigin href="/assets/middleware-Pd0e8Igk.js">
179
179
  <link rel="modulepreload" crossorigin href="/assets/task-copy-CtcqCQ78.js">
@@ -209,7 +209,7 @@
209
209
  <link rel="modulepreload" crossorigin href="/assets/use-file-preview-expanded-CA9vFUTT.js">
210
210
  <link rel="modulepreload" crossorigin href="/assets/use-share-link-CqV3o-VZ.js">
211
211
  <link rel="modulepreload" crossorigin href="/assets/file-preview-surface-Da1xZiG6.js">
212
- <link rel="modulepreload" crossorigin href="/assets/use-composer-attachments-DWiIdMIi.js">
212
+ <link rel="modulepreload" crossorigin href="/assets/use-composer-attachments-CQwCTKAp.js">
213
213
  <link rel="modulepreload" crossorigin href="/assets/skill-api-utils-C7V4JVXM.js">
214
214
  <link rel="modulepreload" crossorigin href="/assets/skill-list-api-Dsfjdtuu.js">
215
215
  <link rel="modulepreload" crossorigin href="/assets/command-palette-api-CAKoTF_-.js">
@@ -233,7 +233,7 @@
233
233
  <link rel="modulepreload" crossorigin href="/assets/page-context-draft-CHAS3BY3.js">
234
234
  <link rel="modulepreload" crossorigin href="/assets/management-api-BtTRehT0.js">
235
235
  <link rel="modulepreload" crossorigin href="/assets/side-chat-shortcut-BIw-1TTD.js">
236
- <link rel="modulepreload" crossorigin href="/assets/chat-page-XqG9aYBd.js">
236
+ <link rel="modulepreload" crossorigin href="/assets/chat-page-oy4EGdO1.js">
237
237
  <link rel="modulepreload" crossorigin href="/assets/arrow-right-DSSvoX71.js">
238
238
  <link rel="modulepreload" crossorigin href="/assets/map-pin-BFRLhzQ9.js">
239
239
  <link rel="modulepreload" crossorigin href="/assets/bell-BlYch9Vg.js">
@@ -293,7 +293,7 @@
293
293
  <link rel="modulepreload" crossorigin href="/assets/panel-right-CFGrHTsD.js">
294
294
  <link rel="modulepreload" crossorigin href="/assets/panels-top-left-BKvp2Dag.js">
295
295
  <link rel="modulepreload" crossorigin href="/assets/wand-sparkles-CkSL-3Fy.js">
296
- <link rel="modulepreload" crossorigin href="/assets/use-personal-work-D0tMU1bP.js">
296
+ <link rel="modulepreload" crossorigin href="/assets/use-personal-work-fvvZDK_7.js">
297
297
  <link rel="modulepreload" crossorigin href="/assets/plug-DKYPEgkR.js">
298
298
  <link rel="modulepreload" crossorigin href="/assets/power-ZI-pBczI.js">
299
299
  <link rel="modulepreload" crossorigin href="/assets/puzzle-BptcPjKI.js">
@@ -315,17 +315,17 @@
315
315
  <link rel="modulepreload" crossorigin href="/assets/preference-select-fields-BBd5CWkM.js">
316
316
  <link rel="modulepreload" crossorigin href="/assets/navigation-ByOzYT0t.js">
317
317
  <link rel="modulepreload" crossorigin href="/assets/page-tabs-DoYMKhVO.js">
318
- <link rel="modulepreload" crossorigin href="/assets/route-preload-Ab7Zw-df.js">
318
+ <link rel="modulepreload" crossorigin href="/assets/route-preload-CsBdFJHO.js">
319
319
  <link rel="modulepreload" crossorigin href="/assets/use-personal-profile-CaCORKeL.js">
320
320
  <link rel="modulepreload" crossorigin href="/assets/personal-avatar-BCk4KoeZ.js">
321
321
  <link rel="modulepreload" crossorigin href="/assets/session-channel-icon-CJAPoVO-.js">
322
322
  <link rel="modulepreload" crossorigin href="/assets/project-understanding-CwtdVbMP.js">
323
323
  <link rel="modulepreload" crossorigin href="/assets/refresh-button-DX7bULU5.js">
324
324
  <link rel="modulepreload" crossorigin href="/assets/file-tree-CYUkQR1t.js">
325
- <link rel="modulepreload" crossorigin href="/assets/workspace-file-preview-dialog-DPHnm_7A.js">
325
+ <link rel="modulepreload" crossorigin href="/assets/workspace-file-preview-dialog-DdVyIRKm.js">
326
326
  <link rel="modulepreload" crossorigin href="/assets/use-workspace-tree-nnrez9-d.js">
327
327
  <link rel="modulepreload" crossorigin href="/assets/date-formatters-DukWSVwc.js">
328
- <link rel="modulepreload" crossorigin href="/assets/task-header-title-bZVPIbyR.js">
328
+ <link rel="modulepreload" crossorigin href="/assets/task-header-title-DHb7z-hq.js">
329
329
  <link rel="modulepreload" crossorigin href="/assets/date-time-picker-BNw099Is.js">
330
330
  <link rel="modulepreload" crossorigin href="/assets/settings-mode-store-CQofc337.js">
331
331
  <link rel="modulepreload" crossorigin href="/assets/global-defaults-api-BZnu44eA.js">
package/dist/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.0.488";
2
+ var version = "0.0.489";
3
3
  //#endregion
4
4
  export { version };
@@ -1,8 +1,8 @@
1
- import { currentActivityActor, currentActivityInitiator, currentActivitySource } from "./context.js";
2
1
  import { createLogger } from "../utils/logger/index.js";
3
2
  import { init_logger } from "../utils/logger.js";
4
3
  import { isXopcDatabaseOpen } from "../storage/sqlite/connection.js";
5
4
  import "../storage/sqlite/index.js";
5
+ import { currentActivityActor, currentActivityInitiator, currentActivitySource } from "./context.js";
6
6
  import { ActivityService } from "./service.js";
7
7
  //#region src/activity/emitter.ts
8
8
  init_logger();
@@ -10,31 +10,32 @@ import { getInteractionState } from "../storage/sqlite/interaction-state-reposit
10
10
  import { getSessionConfig } from "../storage/sqlite/config-repository.js";
11
11
  import "../storage/sqlite/index.js";
12
12
  import { init_paths, resolveBundledSkillsDir } from "../config/paths.js";
13
- import { pluginRuntimeAccessKey } from "../extensions/agent-plugins/capability-access.js";
13
+ import { isPersonalConversation } from "../personal-agent/repository.js";
14
+ import { CredentialResolver, init_credentials } from "../auth/credentials.js";
15
+ import { getEmbeddedExecutionRunId } from "./embedded/execution-context.js";
16
+ import { traceTools } from "../observability/runtime.js";
17
+ import { continuesAfterTool, trackAiUsageStream } from "../usage/recorder.js";
18
+ import { init_sync_provider_auth, resolveProviderApiKeySync } from "../auth/sync-provider-auth.js";
19
+ import { maybeRequestChannelExecApproval } from "../channels/exec-approval-runtime.js";
14
20
  import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
21
+ import { pluginRuntimeAccessKey } from "../extensions/agent-plugins/capability-access.js";
15
22
  import { AgentPluginStore } from "../extensions/agent-plugins/store.js";
16
23
  import { connectorArgumentsPreview } from "../connectors/approval.js";
17
24
  import { resolveUserContextSessionAccess } from "../user-context/access-policy.js";
18
25
  import { enqueueConversationLearning } from "../memory-learning/repository.js";
19
26
  import { resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession } from "../config/agent-profile.js";
20
- import { CredentialResolver, init_credentials } from "../auth/credentials.js";
21
- import { init_sync_provider_auth, resolveProviderApiKeySync } from "../auth/sync-provider-auth.js";
22
27
  import { getApiKeySync, getDefaultModelSync, init_providers, resolveModel } from "../providers/index.js";
23
28
  import { createExtensionAwareStreamFn } from "../providers/extension-stream-bridge.js";
24
- import { traceTools } from "../observability/runtime.js";
25
- import { continuesAfterTool, trackAiUsageStream } from "../usage/recorder.js";
26
29
  import { MemoryLearningService } from "../memory-learning/service.js";
27
30
  import { extractTextContent } from "./context/workspace.js";
28
31
  import { runPersistentLearningJob } from "./background-review/run-background-review.js";
29
32
  import { applyConfigOverrides } from "../config/runtime-overrides.js";
30
- import { isPersonalConversation } from "../personal-agent/repository.js";
31
33
  import { createSkillConfigManager, isSkillEnabled, resolveSkillConfig } from "./skills/config.js";
32
34
  import { isValidSkillEnvVarName } from "./skills/required-env-vars.js";
33
35
  import { resolveWorkspaceSkillsDir, resolveWorkspaceSkillsLockPath } from "./skills/workspace-skills-dir.js";
34
36
  import { loadSkillsLock } from "./skills/hub-lock.js";
35
37
  import { isUnderManagedSkillsDir } from "./skills/managed-store.js";
36
38
  import { PersonalPromptContext } from "../personal-agent/prompt-context.js";
37
- import { getEmbeddedExecutionRunId } from "./embedded/execution-context.js";
38
39
  import { abortEmbeddedRun } from "./embedded/runs.js";
39
40
  import { resolveExecutionToolPolicy } from "./embedded/execution-tool-policy.js";
40
41
  import { buildExecutionScopeContextForPrompt } from "./context/execution-scope.js";
@@ -51,7 +52,6 @@ import { evaluateToolGate } from "./context/execution-context.js";
51
52
  import { createRecallQueryPlanner } from "./context/deep-recall.js";
52
53
  import { ExecutionContextCoordinator } from "./context/coordinator.js";
53
54
  import { WorkspaceRuntimeRegistry } from "./workspace-runtime/registry.js";
54
- import { maybeRequestChannelExecApproval } from "../channels/exec-approval-runtime.js";
55
55
  import { SkillFilesystemWatcher } from "./skills/filesystem-watcher.js";
56
56
  import { ProjectTrustStore, hasTrustRequiringProjectResources, isProjectWorkspaceTrusted } from "../project-trust/trust-store.js";
57
57
  import { replaceAgentSystemPrompt } from "./prompt/agent-system-prompt.js";
@@ -1,6 +1,6 @@
1
+ import { USER_PROFILE_IDENTITY_RULE } from "../../user-model/profile.js";
1
2
  import { USER_UNDERSTANDING_MAINTENANCE_POLICY } from "../../user-model/maintenance-policy.js";
2
3
  import { USER_FACING_UNDERSTANDING_WRITING_GUIDANCE } from "../../user-context/understanding-writing.js";
3
- import { USER_PROFILE_IDENTITY_RULE } from "../../user-model/profile.js";
4
4
  //#region src/agent/background-review/prompts.ts
5
5
  const USER_MODEL_MAINTAINER_SYSTEM_PROMPT = `You are xopc's user-understanding maintainer. You do not chat with the user and cannot write storage. Distinguish explicit memory commands, corrections, forgetting, durable user assertions, durable goals, collaboration rules, and ordinary task requests. Return strict JSON only. Assistant text is never evidence about the user. A direct first-person ongoing preference is admissible with one grounded user quote and no separate remember command. Task-local acknowledgement instructions do not cancel an independent ongoing preference in the same message. Style names are ordinary data, not evidence of fiction. Fictional or temporary attribution must come from the actual source, never be invented by you.\n\n${USER_UNDERSTANDING_MAINTENANCE_POLICY}\n\n${USER_FACING_UNDERSTANDING_WRITING_GUIDANCE}`;
6
6
  function buildUserModelInterpreterPrompt(options) {
@@ -6,7 +6,10 @@ import { getSessionMetadata } from "../../storage/sqlite/session-read-repository
6
6
  import { loadCompactionSourceSnapshot } from "../../storage/sqlite/transcript-repository.js";
7
7
  import { readAgentMessageContent } from "../memory/agent-message-access.js";
8
8
  import "../../storage/sqlite/index.js";
9
+ import { getAssertionSlot, listUserAssertions } from "../../user-model/repository.js";
9
10
  import { init_model_usage, withModelUsageOrigin } from "../../providers/model-usage.js";
11
+ import { trackAiUsageStream } from "../../usage/recorder.js";
12
+ import { init_sync_provider_auth, resolveProviderApiKeySync } from "../../auth/sync-provider-auth.js";
10
13
  import { resolveUserContextSessionAccess } from "../../user-context/access-policy.js";
11
14
  import { learningTranscriptMessage } from "../../memory-learning/transcript-source.js";
12
15
  import { failLearningJob, finishLearningJob, learningPolicyHash } from "../../memory-learning/repository.js";
@@ -15,10 +18,8 @@ import { getKnowledgeItem, listKnowledgeItems } from "../../knowledge-memory/rep
15
18
  import "../../knowledge-memory/index.js";
16
19
  import { extractProfileAgentId } from "../../config/agent-profile.js";
17
20
  import { resolveModelIntentRef, resolveModelSelector } from "../../config/agent-model-intents.js";
18
- import { init_sync_provider_auth, resolveProviderApiKeySync } from "../../auth/sync-provider-auth.js";
19
21
  import { getApiKeySync, init_providers, resolveModel } from "../../providers/index.js";
20
22
  import { createExtensionAwareStreamFn } from "../../providers/extension-stream-bridge.js";
21
- import { trackAiUsageStream } from "../../usage/recorder.js";
22
23
  import { isLoopbackModel } from "../../providers/local-model.js";
23
24
  import { claimRegisteredExtraction } from "../../user-context/extraction/registry.js";
24
25
  import { mergeEvidenceRepair, observationCandidateIssue, workEvidenceIssues } from "../../memory-learning/evidence-repair.js";
@@ -29,7 +30,6 @@ import { stripRuntimeContextFromUserMessage } from "../../session/user-message-d
29
30
  import { applyKnowledgeDeletions } from "../../memory-learning/forget-capture.js";
30
31
  import { applyWorkReviews, prepareWorkReview, workReviewPrompt } from "../../memory-learning/work-review.js";
31
32
  import { forgetChoiceObservations, recallChoiceEvidence, recordChoiceObservations } from "../../memory-learning/choice-observations.js";
32
- import { getAssertionSlot, listUserAssertions } from "../../user-model/repository.js";
33
33
  import { emptyUserModelCaptureResult, executeUserModelInterpretation } from "../../user-model/capture/executor.js";
34
34
  import { parseUserModelInterpretation } from "../../user-model/capture/semantic.js";
35
35
  import "../../user-model/capture/index.js";
@@ -2,8 +2,8 @@ import { isDataBatchResult } from "../data-acquisition/render.js";
2
2
  import { validateDataBatch } from "../data-acquisition/schema.js";
3
3
  import { isProjectWorkspaceTrusted } from "../../project-trust/trust-store.js";
4
4
  import { basename, dirname, isAbsolute, relative, resolve, sep } from "node:path";
5
- import { execFile } from "node:child_process";
6
5
  import { promisify } from "node:util";
6
+ import { execFile } from "node:child_process";
7
7
  import { readFile, realpath, stat } from "node:fs/promises";
8
8
  //#region src/agent/coding/repository-instructions.ts
9
9
  const exec = promisify(execFile);
@@ -1,7 +1,7 @@
1
1
  import { isAbsolute, relative, resolve } from "node:path";
2
2
  import { createHash } from "node:crypto";
3
- import { execFile } from "node:child_process";
4
3
  import { promisify } from "node:util";
4
+ import { execFile } from "node:child_process";
5
5
  import { lstat, readFile, readlink, realpath } from "node:fs/promises";
6
6
  //#region src/agent/coding/workspace-revision.ts
7
7
  const exec = promisify(execFile);
@@ -1,5 +1,5 @@
1
- import { runProcess } from "../../process/run-process.js";
2
1
  import { validatePath } from "../sandbox/path-policy.js";
2
+ import { runProcess } from "../../process/run-process.js";
3
3
  import { credentialMounts } from "./commandMounts.js";
4
4
  import { isAbsolute, relative, sep } from "node:path";
5
5
  import { realpath } from "node:fs/promises";
@@ -10,8 +10,8 @@ import { getSessionInteractionPolicy } from "../session/interaction-policy-state
10
10
  import { isolatedCommand, removeCommandContainer } from "./command-isolation.js";
11
11
  import { readWorkspaceRevision } from "../coding/workspace-revision.js";
12
12
  import { join } from "node:path";
13
- import { appendFileSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
14
13
  import { createHash, randomUUID } from "node:crypto";
14
+ import { appendFileSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
15
15
  //#region src/agent/commands/command-registry.ts
16
16
  init_durable_state();
17
17
  init_paths();
@@ -1,11 +1,11 @@
1
1
  import { getSqliteDatabase, init_transaction } from "../../storage/sqlite/transaction.js";
2
2
  import { listCollaborationRules } from "../../storage/sqlite/collaboration-rule-repository.js";
3
+ import { listUserAssertions } from "../../user-model/repository.js";
4
+ import { canUseAssertion } from "../../user-model/usage-policy.js";
3
5
  import { canUseKnowledge } from "../../knowledge-memory/usage-policy.js";
4
6
  import { listKnowledgeItems, searchKnowledgeItems } from "../../knowledge-memory/repository.js";
5
7
  import "../../knowledge-memory/index.js";
6
8
  import { retrievalLexicalSimilarity } from "../../retrieval/textFeatures.js";
7
- import { listUserAssertions } from "../../user-model/repository.js";
8
- import { canUseAssertion } from "../../user-model/usage-policy.js";
9
9
  import { calculateExecutionValue } from "../../user-model/importance.js";
10
10
  import { buildUserContextBlock } from "../memory/context-fence.js";
11
11
  import { getExecutionContextFeedbackScores } from "./audit.js";
@@ -4,8 +4,8 @@ import { init_agent_scope, resolveAgentProfileDir, resolveAgentWorkspaceDir, res
4
4
  import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES } from "./workspace.js";
5
5
  import { dirname, join } from "node:path";
6
6
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
7
- import { fileURLToPath } from "node:url";
8
7
  import { execFileSync } from "node:child_process";
8
+ import { fileURLToPath } from "node:url";
9
9
  //#region src/agent/context/workspace-seed.ts
10
10
  /**
11
11
  * Seed profile Markdown files into `agents/<agentId>/profile/` (and optionally `git init` the Markdown workspace).
@@ -1,5 +1,5 @@
1
- import { runProcess } from "../../process/run-process.js";
2
1
  import { evaluateExecPolicy } from "../sandbox/exec-policy.js";
2
+ import { runProcess } from "../../process/run-process.js";
3
3
  import { checkedFilePath } from "../sandbox/fileAccess.js";
4
4
  import { dataScheduler } from "./scheduler.js";
5
5
  import { relative, resolve, sep } from "node:path";
@@ -1,6 +1,6 @@
1
+ import { checkFileSafety } from "../prompt/safety.js";
1
2
  import { executeWithTimeout } from "../lifecycle/timeout-wrapper.js";
2
3
  import { checkedFilePath, readWorkspaceFileAsync } from "../sandbox/fileAccess.js";
3
- import { checkFileSafety } from "../prompt/safety.js";
4
4
  import { dataScheduler } from "./scheduler.js";
5
5
  import { parseRepositoryMatch, repositorySearch } from "../tools/repository-search.js";
6
6
  import { DATA_OPERATION_TOOLS, nativeDataArgs, validateDataBatch } from "./schema.js";
@@ -1,7 +1,7 @@
1
- import { tmpdir } from "node:os";
2
1
  import { basename, dirname, join, relative, sep } from "node:path";
3
- import { constants } from "node:fs";
4
2
  import { randomUUID } from "node:crypto";
3
+ import { tmpdir } from "node:os";
4
+ import { constants } from "node:fs";
5
5
  import { mkdir, open, realpath, writeFile } from "node:fs/promises";
6
6
  //#region src/agent/embedded/codemode-output.ts
7
7
  /** Adopt only pi's own spill file, never a path printed by a script or an MCP server. */
@@ -1,9 +1,9 @@
1
+ import { getExecutionAuthority } from "../../infra/execution-authority.js";
1
2
  import { getXopcDatabase, init_connection, isXopcDatabaseOpen } from "../../storage/sqlite/connection.js";
2
3
  import { TaskRunRepository, init_task_run_repository, mcpDelegatedRunPrincipal } from "../../tasks/task-run-repository.js";
3
4
  import { init_request_repository, personalRequestForExecution } from "../../personal-agent/request-repository.js";
4
5
  import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
5
6
  import { init_session_repository } from "../../storage/sqlite/session-repository.js";
6
- import { getExecutionAuthority } from "../../infra/execution-authority.js";
7
7
  import { isPersonalConversation } from "../../personal-agent/repository.js";
8
8
  import { allowsReadOnlyRetryTool } from "../../tasks/task-retry-policy.js";
9
9
  import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
@@ -2,9 +2,9 @@ import { init_paths, resolveModelsJsonPath } from "../../config/paths.js";
2
2
  import { assertCurrentModelProvider, init_provider_policy } from "../../providers/provider-policy.js";
3
3
  import { init_register_bundled_oauth_flows, registerBundledOAuthFlows } from "../../providers/register-bundled-oauth-flows.js";
4
4
  import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
5
- import { init_sync_provider_auth, resolveProviderApiKeySync } from "../../auth/sync-provider-auth.js";
6
5
  import { XopcModelCredentialStore, init_model_credential_store } from "../../auth/model-credential-store.js";
7
6
  import { init_register_runtime_providers, registerRuntimeProviders } from "../../providers/register-runtime-providers.js";
7
+ import { init_sync_provider_auth, resolveProviderApiKeySync } from "../../auth/sync-provider-auth.js";
8
8
  import { getApiKeySync, init_providers } from "../../providers/index.js";
9
9
  import { InMemoryModelsStore } from "@earendil-works/pi-ai";
10
10
  //#region src/agent/embedded/model-runtime.ts
@@ -1,22 +1,22 @@
1
1
  import { createLogger } from "../../utils/logger/index.js";
2
2
  import { init_logger } from "../../utils/logger.js";
3
- import { isXopcDatabaseOpen } from "../../storage/sqlite/connection.js";
4
3
  import { parseTurnOutcome } from "../../../packages/gateway-contract/src/turn-outcome.js";
5
4
  import { init_src } from "../../../packages/gateway-contract/src/index.js";
5
+ import { isXopcDatabaseOpen } from "../../storage/sqlite/connection.js";
6
6
  import { findSessionInputByRunId, init_session_input_repository } from "../../storage/sqlite/session-input-repository.js";
7
7
  import { init_voice_transcript, isNaturalVoiceDelegation } from "../../session/voice-transcript.js";
8
8
  import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
9
9
  import { evaluateContextBudget } from "../memory/context-budget.js";
10
10
  import "../../storage/sqlite/index.js";
11
+ import { isPersonalConversation } from "../../personal-agent/repository.js";
11
12
  import { assertProviderUsage, init_model_usage, isProviderUsageScopeError } from "../../providers/model-usage.js";
13
+ import { runWithEmbeddedExecutionSession } from "./execution-context.js";
14
+ import { setTraceIdentity, startObservation, traceOperation, traceRun } from "../../observability/runtime.js";
12
15
  import { resolveEffectiveAgentProfileForSession } from "../../config/agent-profile.js";
13
16
  import { init_providers, resolveModel } from "../../providers/index.js";
14
17
  import { appendDynamicPromptSection } from "../prompt/cache-boundary.js";
15
- import { setTraceIdentity, startObservation, traceOperation, traceRun } from "../../observability/runtime.js";
16
18
  import { resolveAgentAbortReason } from "../orchestration/run-termination.js";
17
19
  import { resolveAgentTurnTimeoutMs } from "../orchestration/run-agent-turn-with-timeout.js";
18
- import { isPersonalConversation } from "../../personal-agent/repository.js";
19
- import { runWithEmbeddedExecutionSession } from "./execution-context.js";
20
20
  import { filterExecutionTools, resolveExecutionToolPolicy } from "./execution-tool-policy.js";
21
21
  import { prepareNativeMcpConfig } from "../mcp/native-mcp.js";
22
22
  import { boundAutomationMcpSource, restrictAutomationMcpConfig } from "../../automations/mcp-source.js";
@@ -96,7 +96,7 @@ async function runEmbeddedTurnForSessionInner(params) {
96
96
  hostSignalAborted: supervisor.signal.aborted,
97
97
  deadlineAtMs: supervisor.deadlineAtMs
98
98
  }, result.ok ? "Agent run completed" : `Agent run ended: ${result.errorMessage ?? "unknown failure"}`);
99
- turnCompleted = result.ok && result.stopReason !== "connection_required" && result.stopReason !== "clarification_required" && result.stopReason !== "phone_assistance_required";
99
+ turnCompleted = result.ok && result.stopReason !== "connection_required" && result.stopReason !== "clarification_required" && result.stopReason !== "phone_assistance_required" && result.stopReason !== "browser_assistance_required";
100
100
  if (voiceTranscriptId && (isNaturalVoiceDelegation(findSessionInputByRunId(conversationId, runId)) || voiceToolExecuted && !voiceContentPublished)) {
101
101
  const text = result.ok ? result.lastAssistantText : result.terminationReason === "user_cancelled" || result.terminationReason === "parent_cancelled" ? config?.voice?.language === "en" ? "The task was cancelled. Actions already completed remain in effect." : "刚才的任务已取消,已完成的操作不会撤销。" : config?.voice?.language === "en" ? "The task could not be completed. We can review the issue here." : "刚才的任务未能完成,可以在这里继续处理。";
102
102
  if (text?.trim() && text.trim() !== "NO_REPLY") try {
@@ -114,7 +114,7 @@ async function runEmbeddedTurnForSessionInner(params) {
114
114
  }, "Voice task result could not be shared in Chat");
115
115
  }
116
116
  }
117
- if (result.stopReason === "connection_required" || result.stopReason === "clarification_required" || result.stopReason === "phone_assistance_required") return result;
117
+ if (result.stopReason === "connection_required" || result.stopReason === "clarification_required" || result.stopReason === "phone_assistance_required" || result.stopReason === "browser_assistance_required") return result;
118
118
  try {
119
119
  const rows = await sessionStore.loadTranscriptRows(conversationId);
120
120
  const hasTurn = rows.some((source) => {