@xopcai/xopc 0.0.285 → 0.0.286

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 (935) hide show
  1. package/dist/browser-ext/dist/assets/{auth-DB30ywek.js → auth-BXCWrPlg.js} +1 -1
  2. package/dist/browser-ext/dist/background.js +2 -2
  3. package/dist/browser-ext/dist/sidepanel.html +1 -1
  4. package/dist/browser-ext/dist/sidepanel.js +136 -136
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/extensions/feishu/src/adapters/gateway-setup.js +14 -14
  7. package/dist/extensions/feishu/src/state/message-bindings.d.ts +1 -1
  8. package/dist/extensions/feishu/src/state/thread-bindings.d.ts +4 -4
  9. package/dist/extensions/feishu/src/state/thread-bindings.js +6 -6
  10. package/dist/extensions/feishu/src/subagent-hooks.d.ts +1 -1
  11. package/dist/extensions/feishu/src/subagent-hooks.js +5 -5
  12. package/dist/extensions/feishu/src/transport/socket-mode/monitor.js +9 -9
  13. package/dist/extensions/feishu/src/transport/webhook/monitor.js +4 -4
  14. package/dist/extensions/feishu/src/workflow-progress.d.ts +1 -1
  15. package/dist/extensions/feishu/src/workflow-progress.js +8 -7
  16. package/dist/extensions/telegram/src/approval-store.d.ts +2 -2
  17. package/dist/extensions/telegram/src/approval-store.js +1 -1
  18. package/dist/extensions/telegram/src/command-handler.d.ts +2 -2
  19. package/dist/extensions/telegram/src/command-handler.js +8 -8
  20. package/dist/extensions/telegram/src/delivery-chat-id.d.ts +1 -1
  21. package/dist/extensions/telegram/src/delivery-chat-id.js +7 -3
  22. package/dist/extensions/telegram/src/exec-approval-handler.js +1 -1
  23. package/dist/extensions/telegram/src/focus-handler.d.ts +2 -2
  24. package/dist/extensions/telegram/src/focus-handler.js +10 -10
  25. package/dist/extensions/telegram/src/inbound-processor.d.ts +3 -3
  26. package/dist/extensions/telegram/src/inbound-processor.js +11 -11
  27. package/dist/extensions/telegram/src/plugin.js +5 -5
  28. package/dist/extensions/telegram/src/routing-integration.d.ts +1 -1
  29. package/dist/extensions/telegram/src/routing-integration.js +19 -21
  30. package/dist/extensions/telegram/src/thread-bindings.d.ts +1 -1
  31. package/dist/extensions/telegram/src/workflow-progress.js +8 -7
  32. package/dist/extensions/telegram/xopc.extension.json +1 -1
  33. package/dist/extensions/weixin/src/auth/login-qr.d.ts +4 -4
  34. package/dist/extensions/weixin/src/auth/login-qr.js +21 -21
  35. package/dist/extensions/weixin/src/auth/weixin-account-id.d.ts +1 -1
  36. package/dist/extensions/weixin/src/auth/weixin-account-id.js +1 -1
  37. package/dist/extensions/weixin/src/cli/gateway-qr-login.d.ts +2 -2
  38. package/dist/extensions/weixin/src/cli/gateway-qr-login.js +13 -13
  39. package/dist/extensions/weixin/src/cli/qr-login.js +1 -1
  40. package/dist/extensions/weixin/src/delivery-to.js +6 -2
  41. package/dist/extensions/weixin/src/messaging/inbound.d.ts +1 -1
  42. package/dist/extensions/weixin/src/messaging/inbound.js +1 -1
  43. package/dist/extensions/weixin/src/messaging/process-message.js +3 -3
  44. package/dist/extensions/weixin/src/plugin.js +5 -5
  45. package/dist/extensions/weixin/src/routing-integration.d.ts +1 -1
  46. package/dist/extensions/weixin/src/routing-integration.js +3 -3
  47. package/dist/extensions/weixin/src/workflow-progress.d.ts +1 -1
  48. package/dist/extensions/weixin/src/workflow-progress.js +7 -6
  49. package/dist/gateway/static/root/assets/{activity-store-B0BTIk9j.js → activity-store-xOhV8FHx.js} +1 -1
  50. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Dc-0QZTQ.js → agent-avatar-dicebear-BzQbYWEj.js} +1 -1
  51. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-CcmqK1Sc.js → agent-defaults-settings-panel-BxR5eog4.js} +1 -1
  52. package/dist/gateway/static/root/assets/{agents-B_7PVt7S.js → agents-Dx1om1eN.js} +1 -1
  53. package/dist/gateway/static/root/assets/{api-Coly9ab6.js → api-CVJQLBv9.js} +1 -1
  54. package/dist/gateway/static/root/assets/api-q1kIMCLW.js +1 -0
  55. package/dist/gateway/static/root/assets/{app-management-settings-panel-TWBO-msg.js → app-management-settings-panel-CTyuXkNC.js} +1 -1
  56. package/dist/gateway/static/root/assets/{appearance-settings-CpTZ2KuT.js → appearance-settings-Tk-GJtvF.js} +1 -1
  57. package/dist/gateway/static/root/assets/apps-page-BA-7OrhJ.js +1 -0
  58. package/dist/gateway/static/root/assets/{archive-plugin-z_u6alob.js → archive-plugin-O49jeeXo.js} +1 -1
  59. package/dist/gateway/static/root/assets/{attachment-load-C2nS04TC.js → attachment-load-r9lBF2tW.js} +1 -1
  60. package/dist/gateway/static/root/assets/{automations-page-aIBsw9zR.js → automations-page-CFFLXYgS.js} +1 -1
  61. package/dist/gateway/static/root/assets/{automations-workspace-BRQlU4qk.js → automations-workspace-DUZE1NOH.js} +3 -3
  62. package/dist/gateway/static/root/assets/{binary-plugins-CGmXoZnl.js → binary-plugins-BpM43vsn.js} +1 -1
  63. package/dist/gateway/static/root/assets/{block-editor-CtvzCZhC.js → block-editor-DFrfEcGw.js} +1 -1
  64. package/dist/gateway/static/root/assets/{browser-automation-inputs-BOTU1isH.js → browser-automation-inputs-CyHGQwxQ.js} +1 -1
  65. package/dist/gateway/static/root/assets/{browser-automations-page-BwU5V8J0.js → browser-automations-page-CPkOWfM9.js} +1 -1
  66. package/dist/gateway/static/root/assets/{browser-settings-page-DDjbDeHQ.js → browser-settings-page-BOcseZxg.js} +2 -2
  67. package/dist/gateway/static/root/assets/button-CGlRPNzi.js +1 -0
  68. package/dist/gateway/static/root/assets/capabilities-settings-panel-ohEV64hG.js +8 -0
  69. package/dist/gateway/static/root/assets/channels-settings-UOf9mgqt.js +1 -0
  70. package/dist/gateway/static/root/assets/{channels-status-swr-Dfi0Desh.js → channels-status-swr-BArPeImO.js} +1 -1
  71. package/dist/gateway/static/root/assets/{chat-terminal-dock-B0MvcO6j.js → chat-terminal-dock-D5Aka4S8.js} +2 -2
  72. package/dist/gateway/static/root/assets/{connectors-page-L8JehrxF.js → connectors-page-BEQR0NRq.js} +2 -2
  73. package/dist/gateway/static/root/assets/{cron-expression-CjrWuy2m.js → cron-expression-GDPX4NxC.js} +1 -1
  74. package/dist/gateway/static/root/assets/{date-picker-DXOvbHCr.js → date-picker-DNtRu6EB.js} +1 -1
  75. package/dist/gateway/static/root/assets/{dependency-picker-BEnC-eS0.js → dependency-picker-Dng3dIQa.js} +1 -1
  76. package/dist/gateway/static/root/assets/desktop-pet-BicYycxy.js +1 -0
  77. package/dist/gateway/static/root/assets/{desktop-pet-settings-CYyjcSn6.js → desktop-pet-settings-BEse55eX.js} +1 -1
  78. package/dist/gateway/static/root/assets/{device-pairing-wizard-BPMGvAKE.js → device-pairing-wizard-be30HuFI.js} +1 -1
  79. package/dist/gateway/static/root/assets/{extension-debug-page-H_aPMGXW.js → extension-debug-page-YzhYyuay.js} +1 -1
  80. package/dist/gateway/static/root/assets/{extension-page-C1JnpeMt.js → extension-page-CEXVIkDl.js} +1 -1
  81. package/dist/gateway/static/root/assets/extension-settings-page-CrlbgK8g.js +1 -0
  82. package/dist/gateway/static/root/assets/{gateway-config-swr-G2lQt7Ak.js → gateway-config-swr-BNuoHXiZ.js} +1 -1
  83. package/dist/gateway/static/root/assets/gateway-settings-CDJY1AOW.js +1 -0
  84. package/dist/gateway/static/root/assets/{gateway-startup-retry-GP31PUrG.js → gateway-startup-retry-zMPfje0n.js} +1 -1
  85. package/dist/gateway/static/root/assets/{heartbeat-settings-C7fjiowt.js → heartbeat-settings-BtxitqZ3.js} +1 -1
  86. package/dist/gateway/static/root/assets/{home-page-DZXeXdUL.js → home-page-_oqo0pNR.js} +1 -1
  87. package/dist/gateway/static/root/assets/{image-generation-api-CKFhfHSw.js → image-generation-api-B_Tyx74A.js} +1 -1
  88. package/dist/gateway/static/root/assets/{imports-page-GROumhj8.js → imports-page-eZciuLw_.js} +1 -1
  89. package/dist/gateway/static/root/assets/index--YC42LAz.css +2 -0
  90. package/dist/gateway/static/root/assets/index-fVtuw2o9.js +75 -0
  91. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-zcI822m_.js → keyboard-shortcuts-settings-B796W039.js} +1 -1
  92. package/dist/gateway/static/root/assets/{local-app-workbench-page-CAEKGTAg.js → local-app-workbench-page-Z8mpau9d.js} +1 -1
  93. package/dist/gateway/static/root/assets/{local-apps-page-BtgDJ92Q.js → local-apps-page-DXmY5jwM.js} +1 -1
  94. package/dist/gateway/static/root/assets/locale-store-D0001I7p.js +1 -0
  95. package/dist/gateway/static/root/assets/logs-page-BGOO8ouT.js +2 -0
  96. package/dist/gateway/static/root/assets/{management-settings-DasZxCyD.js → management-settings-b1MG7s-3.js} +1 -1
  97. package/dist/gateway/static/root/assets/{markdown-view-6oYdBahT.js → markdown-view-2txE_Blz.js} +1 -1
  98. package/dist/gateway/static/root/assets/{media-plugins-CxthbBvk.js → media-plugins-CDEf3ksI.js} +1 -1
  99. package/dist/gateway/static/root/assets/messages-BWANv-N-.js +3 -0
  100. package/dist/gateway/static/root/assets/{note-detail-panel-BcWq3ddw.js → note-detail-panel-Bm33_3xJ.js} +3 -3
  101. package/dist/gateway/static/root/assets/notes-page-C32-xssK.js +8 -0
  102. package/dist/gateway/static/root/assets/page-tabs-Bi_-DA5J.js +1 -0
  103. package/dist/gateway/static/root/assets/popover-select-DldSX8GX.js +1 -0
  104. package/dist/gateway/static/root/assets/{preview-open-alternatives-Bevpbq9f.js → preview-open-alternatives-Dhfdf14p.js} +1 -1
  105. package/dist/gateway/static/root/assets/proactive-page-BNouL7Tv.js +1 -0
  106. package/dist/gateway/static/root/assets/{product-open-page-Bi1seZpM.js → product-open-page-BkbZBqBr.js} +1 -1
  107. package/dist/gateway/static/root/assets/project-detail-page-CZ7glGYw.js +1 -0
  108. package/dist/gateway/static/root/assets/projects-page-DP3ZINZz.js +1 -0
  109. package/dist/gateway/static/root/assets/{registry-api-D0ddwBFj.js → registry-api-icwoEKYB.js} +1 -1
  110. package/dist/gateway/static/root/assets/remote-access-hub-xqJcPdOO.js +1 -0
  111. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Wkru8_My.js → runtime-tools-settings-panel-bmgxwWpW.js} +1 -1
  112. package/dist/gateway/static/root/assets/{schema-form-CSMRzj9Y.js → schema-form-DoZeepCg.js} +1 -1
  113. package/dist/gateway/static/root/assets/{sessions-page-Hj9uFcIO.js → sessions-page-BaxIfjpm.js} +1 -1
  114. package/dist/gateway/static/root/assets/settings-advanced-gate-Cy3Ab3Vg.js +1 -0
  115. package/dist/gateway/static/root/assets/settings-form-section-sw2bbS2b.js +1 -0
  116. package/dist/gateway/static/root/assets/{settings-page-BcQGAnCs.js → settings-page-BWF8uac0.js} +1 -1
  117. package/dist/gateway/static/root/assets/settings-page-layout-CsUQKRq0.js +1 -0
  118. package/dist/gateway/static/root/assets/{setup-status-panel-DzxmsaQG.js → setup-status-panel-BuYto2mT.js} +1 -1
  119. package/dist/gateway/static/root/assets/{share-preview-page-DQocUl-1.js → share-preview-page-BIHYD6-O.js} +1 -1
  120. package/dist/gateway/static/root/assets/shares-settings-DKtWUneq.js +1 -0
  121. package/dist/gateway/static/root/assets/skill-reload-api-Dn7ElMUk.js +1 -0
  122. package/dist/gateway/static/root/assets/{skills-page-AmqtBJo7.js → skills-page-D-7UtJIc.js} +1 -1
  123. package/dist/gateway/static/root/assets/{skills-page.utils-DtlfCgJp.js → skills-page.utils-dvue6Ish.js} +1 -1
  124. package/dist/gateway/static/root/assets/{system-settings-panel-Ct698Nf-.js → system-settings-panel-DCyxPWCl.js} +1 -1
  125. package/dist/gateway/static/root/assets/task-detail-page-efmH43Pq.js +1 -0
  126. package/dist/gateway/static/root/assets/{theme-store-ng8KJsAT.js → theme-store-CZwYGpbY.js} +1 -1
  127. package/dist/gateway/static/root/assets/tunnel-api-__auf8Ww.js +1 -0
  128. package/dist/gateway/static/root/assets/{use-autosave-BSyxRHt2.js → use-autosave-Iq83UDt3.js} +1 -1
  129. package/dist/gateway/static/root/assets/{user-model-page-DIEHnAER.js → user-model-page-DByIJcQq.js} +1 -1
  130. package/dist/gateway/static/root/assets/{voice-api-key-field-SE3OQI1s.js → voice-api-key-field-D-QssKik.js} +1 -1
  131. package/dist/gateway/static/root/assets/{voice-config-api-VNuCmdFe.js → voice-config-api-B0wNN_tE.js} +1 -1
  132. package/dist/gateway/static/root/assets/{work-discovery-overlay-Dn1vy2oq.js → work-discovery-overlay-5NRYg1iI.js} +1 -1
  133. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BJEfGY-k.js → workflow-run-setup-panel-Ds2SZjLG.js} +1 -1
  134. package/dist/gateway/static/root/assets/{workflows-page-DgRNIyr7.js → workflows-page-BJv3eoKR.js} +2 -2
  135. package/dist/gateway/static/root/index.html +12 -12
  136. package/dist/package.js +1 -1
  137. package/dist/packages/endpoint-tools-protocol/src/index.js +312 -305
  138. package/dist/packages/gateway-contract/src/agent-stream.js +6 -0
  139. package/dist/packages/gateway-contract/src/automations.js +215 -0
  140. package/dist/packages/gateway-contract/src/browser-page-context.js +48 -39
  141. package/dist/packages/gateway-contract/src/browser-tab-binding.js +30 -25
  142. package/dist/packages/gateway-contract/src/clarifications.js +6 -0
  143. package/dist/packages/gateway-contract/src/connection-waits.js +6 -0
  144. package/dist/packages/gateway-contract/src/conversation-identity.js +17 -0
  145. package/dist/packages/gateway-contract/src/device-pairing.js +84 -78
  146. package/dist/packages/gateway-contract/src/discussions.js +19 -15
  147. package/dist/packages/gateway-contract/src/files.js +55 -0
  148. package/dist/packages/gateway-contract/src/home.js +188 -0
  149. package/dist/packages/gateway-contract/src/index.js +65 -0
  150. package/dist/packages/gateway-contract/src/mobile-privacy.js +26 -0
  151. package/dist/packages/gateway-contract/src/model-selection.js +4 -1
  152. package/dist/packages/gateway-contract/src/new-session.js +5 -1
  153. package/dist/packages/gateway-contract/src/notifications.js +64 -59
  154. package/dist/packages/gateway-contract/src/proactive.js +133 -128
  155. package/dist/packages/gateway-contract/src/product-delivery.js +56 -50
  156. package/dist/packages/gateway-contract/src/project-monitoring.js +33 -28
  157. package/dist/packages/gateway-contract/src/project-operating.js +100 -0
  158. package/dist/packages/gateway-contract/src/session-identity.js +38 -34
  159. package/dist/packages/gateway-contract/src/session-input-reliability.js +6 -0
  160. package/dist/packages/gateway-contract/src/sessions.js +145 -0
  161. package/dist/packages/gateway-contract/src/task-lifecycle.js +69 -64
  162. package/dist/packages/gateway-contract/src/task-runs.js +80 -75
  163. package/dist/packages/gateway-contract/src/tasks.js +445 -438
  164. package/dist/packages/gateway-contract/src/tool-activity.js +154 -149
  165. package/dist/packages/gateway-contract/src/turn-outcome.js +118 -112
  166. package/dist/packages/gateway-contract/src/user-message-display.js +13 -8
  167. package/dist/packages/gateway-contract/src/welcome-suggestions.js +6 -0
  168. package/dist/packages/realtime-client/src/index.js +1 -1
  169. package/dist/packages/realtime-protocol/src/index.js +4 -2
  170. package/dist/packages/realtime-protocol/src/voice.js +4 -4
  171. package/dist/src/activity/types.d.ts +1 -1
  172. package/dist/src/agent/agent-instance-gateway.d.ts +18 -18
  173. package/dist/src/agent/agent-manager.d.ts +27 -27
  174. package/dist/src/agent/agent-manager.js +180 -179
  175. package/dist/src/agent/background-review/coordinator.d.ts +3 -3
  176. package/dist/src/agent/background-review/coordinator.js +10 -10
  177. package/dist/src/agent/background-review/run-background-review.d.ts +1 -1
  178. package/dist/src/agent/background-review/run-background-review.js +14 -14
  179. package/dist/src/agent/bootstrap/bootstrap-cache.d.ts +4 -4
  180. package/dist/src/agent/bootstrap/bootstrap-cache.js +9 -9
  181. package/dist/src/agent/bootstrap/bootstrap-files.d.ts +4 -4
  182. package/dist/src/agent/bootstrap/bootstrap-files.js +9 -9
  183. package/dist/src/agent/bootstrap/filter-bootstrap-files.d.ts +1 -1
  184. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +3 -3
  185. package/dist/src/agent/child-agent-factory.d.ts +3 -3
  186. package/dist/src/agent/child-agent-factory.js +5 -5
  187. package/dist/src/agent/coding/workspace-revision.js +1 -1
  188. package/dist/src/agent/commands/command-registry.js +2 -1
  189. package/dist/src/agent/context/audit.d.ts +2 -2
  190. package/dist/src/agent/context/audit.js +5 -4
  191. package/dist/src/agent/context/coordinator.d.ts +6 -6
  192. package/dist/src/agent/context/coordinator.js +13 -13
  193. package/dist/src/agent/context/execution-context.js +4 -3
  194. package/dist/src/agent/context/execution-scope.d.ts +3 -3
  195. package/dist/src/agent/context/execution-scope.js +13 -13
  196. package/dist/src/agent/context/project-context.d.ts +1 -1
  197. package/dist/src/agent/context/project-context.js +4 -4
  198. package/dist/src/agent/embedded/execution-context.d.ts +1 -1
  199. package/dist/src/agent/embedded/execution-context.js +3 -3
  200. package/dist/src/agent/embedded/index.d.ts +1 -1
  201. package/dist/src/agent/embedded/index.js +2 -2
  202. package/dist/src/agent/embedded/run-for-session.d.ts +1 -1
  203. package/dist/src/agent/embedded/run-for-session.js +78 -104
  204. package/dist/src/agent/embedded/run-turn.js +77 -33
  205. package/dist/src/agent/embedded/runs.d.ts +11 -11
  206. package/dist/src/agent/embedded/runs.js +22 -22
  207. package/dist/src/agent/embedded/session-runner.d.ts +2 -2
  208. package/dist/src/agent/embedded/session-runner.js +5 -5
  209. package/dist/src/agent/embedded/session-tool-result-guard.d.ts +2 -2
  210. package/dist/src/agent/embedded/session-tool-result-guard.js +8 -8
  211. package/dist/src/agent/embedded/sqlite-hydrating-session-manager.d.ts +2 -2
  212. package/dist/src/agent/embedded/sqlite-hydrating-session-manager.js +4 -4
  213. package/dist/src/agent/embedded/transcript-runtime.d.ts +4 -3
  214. package/dist/src/agent/embedded/transcript-runtime.js +33 -20
  215. package/dist/src/agent/embedded/types.d.ts +2 -1
  216. package/dist/src/agent/external-tools/composio-provider.d.ts +1 -1
  217. package/dist/src/agent/external-tools/composio-provider.js +12 -11
  218. package/dist/src/agent/external-tools/endpoint-provider.js +1 -1
  219. package/dist/src/agent/external-tools/extension-provider.d.ts +1 -1
  220. package/dist/src/agent/external-tools/extension-provider.js +1 -1
  221. package/dist/src/agent/external-tools/gateway-tools.js +9 -8
  222. package/dist/src/agent/external-tools/index.js +3 -3
  223. package/dist/src/agent/external-tools/mcp-provider.d.ts +2 -2
  224. package/dist/src/agent/external-tools/mcp-provider.js +8 -8
  225. package/dist/src/agent/external-tools/memory-provider.d.ts +1 -1
  226. package/dist/src/agent/external-tools/memory-provider.js +1 -1
  227. package/dist/src/agent/external-tools/types.d.ts +1 -1
  228. package/dist/src/agent/inbound/attachment-pipeline.d.ts +7 -7
  229. package/dist/src/agent/inbound/attachment-pipeline.js +22 -21
  230. package/dist/src/agent/inbound/inbound-loop.d.ts +6 -6
  231. package/dist/src/agent/inbound/inbound-loop.js +23 -23
  232. package/dist/src/agent/inbound/turn-dispatcher.d.ts +14 -14
  233. package/dist/src/agent/inbound/turn-dispatcher.js +16 -16
  234. package/dist/src/agent/ipc/bus.d.ts +1 -1
  235. package/dist/src/agent/ipc/types.d.ts +3 -3
  236. package/dist/src/agent/ipc/types.js +1 -1
  237. package/dist/src/agent/lifecycle/hook-handler.d.ts +2 -2
  238. package/dist/src/agent/lifecycle/hook-handler.js +6 -6
  239. package/dist/src/agent/lifecycle/manager.d.ts +1 -1
  240. package/dist/src/agent/lifecycle/manager.js +4 -4
  241. package/dist/src/agent/lifecycle/types.d.ts +1 -1
  242. package/dist/src/agent/mcp/bundle-mcp-runtime.d.ts +4 -4
  243. package/dist/src/agent/mcp/bundle-mcp-runtime.js +21 -20
  244. package/dist/src/agent/mcp/bundle-mcp-tools.d.ts +1 -1
  245. package/dist/src/agent/mcp/bundle-mcp-tools.js +2 -2
  246. package/dist/src/agent/mcp/bundle-mcp-types.d.ts +4 -4
  247. package/dist/src/agent/mcp/index.js +2 -2
  248. package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +9 -8
  249. package/dist/src/agent/memory/compaction-ledger.js +9 -2
  250. package/dist/src/agent/memory/compaction-promotion.d.ts +2 -2
  251. package/dist/src/agent/memory/compaction-promotion.js +6 -6
  252. package/dist/src/agent/memory/compaction-source-planner.d.ts +2 -0
  253. package/dist/src/agent/memory/compaction-source-planner.js +9 -1
  254. package/dist/src/agent/memory/compaction.d.ts +6 -1
  255. package/dist/src/agent/memory/compaction.js +22 -11
  256. package/dist/src/agent/memory/context-recovery.d.ts +44 -0
  257. package/dist/src/agent/memory/context-recovery.js +96 -0
  258. package/dist/src/agent/memory/manager.js +11 -11
  259. package/dist/src/agent/memory/turn-provenance.d.ts +5 -5
  260. package/dist/src/agent/memory/turn-provenance.js +21 -17
  261. package/dist/src/agent/memory/types.d.ts +2 -2
  262. package/dist/src/agent/messaging/command-handler.d.ts +11 -11
  263. package/dist/src/agent/messaging/command-handler.js +7 -7
  264. package/dist/src/agent/messaging/message-router.d.ts +1 -1
  265. package/dist/src/agent/messaging/message-router.js +4 -4
  266. package/dist/src/agent/messaging/outbound-coordinator.d.ts +2 -2
  267. package/dist/src/agent/messaging/outbound-coordinator.js +4 -4
  268. package/dist/src/agent/middleware/context.d.ts +1 -2
  269. package/dist/src/agent/middleware/context.js +2 -5
  270. package/dist/src/agent/models/manager.d.ts +10 -10
  271. package/dist/src/agent/models/manager.js +34 -34
  272. package/dist/src/agent/orchestration/agent-event-handler.js +14 -14
  273. package/dist/src/agent/orchestration/agent-orchestrator.d.ts +7 -7
  274. package/dist/src/agent/orchestration/agent-orchestrator.js +29 -29
  275. package/dist/src/agent/orchestration/context-overflow.js +2 -0
  276. package/dist/src/agent/orchestration/llm-turn-retry.d.ts +1 -1
  277. package/dist/src/agent/orchestration/llm-turn-retry.js +2 -2
  278. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +1 -1
  279. package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +2 -2
  280. package/dist/src/agent/prompt/response-language.d.ts +1 -1
  281. package/dist/src/agent/prompt/response-language.js +2 -2
  282. package/dist/src/agent/prompt/service-prompt-builder.d.ts +2 -2
  283. package/dist/src/agent/prompt/service-prompt-builder.js +4 -4
  284. package/dist/src/agent/prompt/subagent-context.d.ts +4 -4
  285. package/dist/src/agent/prompt/subagent-context.js +1 -1
  286. package/dist/src/agent/prompt/system-prompt-params.d.ts +4 -4
  287. package/dist/src/agent/prompt/system-prompt-params.js +13 -12
  288. package/dist/src/agent/reply/apply-turn-user-enrichment.d.ts +1 -1
  289. package/dist/src/agent/reply/apply-turn-user-enrichment.js +3 -3
  290. package/dist/src/agent/reply/post-compaction-context.d.ts +1 -1
  291. package/dist/src/agent/reply/post-compaction-context.js +2 -2
  292. package/dist/src/agent/service/btw-query.d.ts +1 -1
  293. package/dist/src/agent/service/btw-query.js +4 -4
  294. package/dist/src/agent/service/build-direct-message-content.d.ts +1 -1
  295. package/dist/src/agent/service/build-direct-message-content.js +2 -2
  296. package/dist/src/agent/service/direct-turn-helpers.d.ts +6 -6
  297. package/dist/src/agent/service/direct-turn-helpers.js +17 -16
  298. package/dist/src/agent/service/parse-outbound-session-key.d.ts +1 -1
  299. package/dist/src/agent/service/parse-outbound-session-key.js +8 -9
  300. package/dist/src/agent/service/process-direct-one-shot.d.ts +11 -11
  301. package/dist/src/agent/service/process-direct-one-shot.js +16 -16
  302. package/dist/src/agent/service/process-direct-streaming.d.ts +18 -18
  303. package/dist/src/agent/service/process-direct-streaming.js +45 -40
  304. package/dist/src/agent/service/session-context-report.d.ts +1 -1
  305. package/dist/src/agent/service/session-context-report.js +3 -3
  306. package/dist/src/agent/service/webchat-tts.d.ts +3 -3
  307. package/dist/src/agent/service/webchat-tts.js +7 -7
  308. package/dist/src/agent/service.d.ts +23 -23
  309. package/dist/src/agent/service.js +111 -108
  310. package/dist/src/agent/service.types.d.ts +3 -3
  311. package/dist/src/agent/session/session-config-service.d.ts +5 -5
  312. package/dist/src/agent/session/session-config-service.js +53 -66
  313. package/dist/src/agent/session/session-context.d.ts +2 -2
  314. package/dist/src/agent/session/session-context.js +2 -2
  315. package/dist/src/agent/session/session-hydrator.d.ts +3 -3
  316. package/dist/src/agent/session/session-hydrator.js +19 -19
  317. package/dist/src/agent/session/session-inspector.d.ts +7 -7
  318. package/dist/src/agent/session/session-inspector.js +45 -45
  319. package/dist/src/agent/session/session-lifecycle.d.ts +2 -2
  320. package/dist/src/agent/session/session-lifecycle.js +17 -17
  321. package/dist/src/agent/session/session-state-bag.d.ts +18 -18
  322. package/dist/src/agent/session/session-state-bag.js +46 -46
  323. package/dist/src/agent/session/tracker.d.ts +7 -7
  324. package/dist/src/agent/session/tracker.js +27 -27
  325. package/dist/src/agent/source-context/types.d.ts +1 -1
  326. package/dist/src/agent/tasks/task-judge-service.d.ts +1 -1
  327. package/dist/src/agent/tasks/task-judge-service.js +11 -10
  328. package/dist/src/agent/tools/automation-tool.js +2 -0
  329. package/dist/src/agent/tools/chain-tracker.d.ts +10 -10
  330. package/dist/src/agent/tools/chain-tracker.js +31 -31
  331. package/dist/src/agent/tools/clarify-tool.d.ts +1 -1
  332. package/dist/src/agent/tools/create-share-tool.js +2 -0
  333. package/dist/src/agent/tools/delegate-tool.d.ts +1 -1
  334. package/dist/src/agent/tools/delegate-tool.js +4 -4
  335. package/dist/src/agent/tools/exec-command.d.ts +1 -1
  336. package/dist/src/agent/tools/exec-command.js +1 -1
  337. package/dist/src/agent/tools/factory.d.ts +3 -3
  338. package/dist/src/agent/tools/factory.js +36 -36
  339. package/dist/src/agent/tools/knowledge-memory-tool.js +2 -2
  340. package/dist/src/agent/tools/managed-job-tool.d.ts +1 -1
  341. package/dist/src/agent/tools/managed-job-tool.js +2 -2
  342. package/dist/src/agent/tools/publish-artifacts.js +2 -0
  343. package/dist/src/agent/tools/send-media.js +2 -0
  344. package/dist/src/agent/tools/session-recall-tool.d.ts +1 -1
  345. package/dist/src/agent/tools/session-recall-tool.js +3 -3
  346. package/dist/src/agent/tools/session-search-tool.d.ts +1 -1
  347. package/dist/src/agent/tools/session-search-tool.js +6 -6
  348. package/dist/src/agent/tools/skill-install-tool.d.ts +3 -3
  349. package/dist/src/agent/tools/skill-install-tool.js +3 -3
  350. package/dist/src/agent/tools/todo-tool.d.ts +3 -3
  351. package/dist/src/agent/tools/todo-tool.js +4 -4
  352. package/dist/src/agent/tools/workflow-tool.d.ts +1 -1
  353. package/dist/src/agent/tools/workflow-tool.js +15 -13
  354. package/dist/src/agent/tools/write.js +2 -0
  355. package/dist/src/agent/tools/xopc-use-tool.d.ts +1 -1
  356. package/dist/src/agent/tools/xopc-use-tool.js +16 -13
  357. package/dist/src/agent/types.d.ts +1 -1
  358. package/dist/src/agent/workflow/catalog.js +4 -2
  359. package/dist/src/agent/workflow/channel-capability.d.ts +2 -2
  360. package/dist/src/agent/workflow/progress-broker.d.ts +4 -4
  361. package/dist/src/agent/workflow/progress-broker.js +17 -17
  362. package/dist/src/agent/workflow/subagent-runner.js +10 -10
  363. package/dist/src/agent/workflow/types.d.ts +2 -2
  364. package/dist/src/agent/workflow/workflow-child-tools.js +1 -1
  365. package/dist/src/agent/workspace-runtime/registry.js +1 -1
  366. package/dist/src/automations/domain/types.d.ts +7 -7
  367. package/dist/src/automations/domain/validation.js +2 -0
  368. package/dist/src/automations/service/action-executor.js +15 -15
  369. package/dist/src/automations/service/automation-service.js +4 -3
  370. package/dist/src/automations/storage/automation-repository.js +2 -1
  371. package/dist/src/automations/storage/automation-run-repository.js +9 -8
  372. package/dist/src/browser/native-messaging-host.js +4 -1
  373. package/dist/src/browser/policy/approval-store.d.ts +4 -4
  374. package/dist/src/browser/policy/approval-store.js +8 -8
  375. package/dist/src/browser/providers/extension.js +6 -6
  376. package/dist/src/browser/providers/realtime-extension.js +2 -2
  377. package/dist/src/browser/runtime/browser-runtime.js +3 -3
  378. package/dist/src/channels/exec-approval-runtime.d.ts +1 -1
  379. package/dist/src/channels/manager.js +1 -1
  380. package/dist/src/channels/pipeline.js +2 -2
  381. package/dist/src/channels/plugin-types.d.ts +2 -2
  382. package/dist/src/channels/plugins/types.adapters.d.ts +1 -1
  383. package/dist/src/channels/telegram/index.d.ts +1 -1
  384. package/dist/src/channels/telegram/index.js +2 -2
  385. package/dist/src/chat-commands/agent-edit.js +2 -2
  386. package/dist/src/chat-commands/builtins/review.js +4 -4
  387. package/dist/src/chat-commands/builtins/session.js +1 -1
  388. package/dist/src/chat-commands/builtins/system.js +2 -2
  389. package/dist/src/chat-commands/builtins/thinking.js +7 -7
  390. package/dist/src/chat-commands/builtins/understanding.js +4 -4
  391. package/dist/src/chat-commands/builtins/workflow.js +8 -8
  392. package/dist/src/chat-commands/context.d.ts +9 -9
  393. package/dist/src/chat-commands/context.js +35 -35
  394. package/dist/src/chat-commands/index.d.ts +1 -1
  395. package/dist/src/chat-commands/index.js +2 -2
  396. package/dist/src/chat-commands/processor.js +2 -2
  397. package/dist/src/chat-commands/registry.js +1 -1
  398. package/dist/src/chat-commands/session-key.d.ts +3 -3
  399. package/dist/src/chat-commands/session-key.js +20 -24
  400. package/dist/src/chat-commands/types.d.ts +3 -3
  401. package/dist/src/cli/command-manifest.js +1 -1
  402. package/dist/src/cli/commands/agent/interactive.d.ts +1 -1
  403. package/dist/src/cli/commands/agent/interactive.js +8 -8
  404. package/dist/src/cli/commands/agent/stream-renderer.d.ts +1 -1
  405. package/dist/src/cli/commands/agent/stream-renderer.js +2 -2
  406. package/dist/src/cli/commands/agent.js +10 -6
  407. package/dist/src/cli/commands/doctor/checks/database-schema.js +3 -2
  408. package/dist/src/cli/commands/doctor/checks/session-integrity.js +9 -9
  409. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  410. package/dist/src/cli/commands/gateway/run-foreground.js +2 -1
  411. package/dist/src/cli/commands/import.js +2 -1
  412. package/dist/src/cli/commands/logs.js +3 -3
  413. package/dist/src/cli/commands/project.js +5 -5
  414. package/dist/src/cli/commands/resume.js +4 -4
  415. package/dist/src/cli/commands/tunnel.js +2 -1
  416. package/dist/src/config/agent-profile.d.ts +3 -3
  417. package/dist/src/config/agent-profile.js +12 -12
  418. package/dist/src/config/models-json.d.ts +6 -6
  419. package/dist/src/config/schema.d.ts +1 -1
  420. package/dist/src/connectors/catalog.js +2 -1
  421. package/dist/src/connectors/composio-sessions.d.ts +1 -1
  422. package/dist/src/connectors/composio-sessions.js +3 -3
  423. package/dist/src/connectors/connection-recovery-service.d.ts +4 -4
  424. package/dist/src/connectors/connection-recovery-service.js +41 -37
  425. package/dist/src/connectors/principal.d.ts +1 -1
  426. package/dist/src/connectors/principal.js +4 -3
  427. package/dist/src/connectors/types.d.ts +2 -2
  428. package/dist/src/discussions/action-tasks.js +5 -2
  429. package/dist/src/discussions/analyzer.js +2 -1
  430. package/dist/src/discussions/edits.js +4 -2
  431. package/dist/src/discussions/index.js +1 -1
  432. package/dist/src/discussions/organizer.js +3 -2
  433. package/dist/src/discussions/recording.js +5 -2
  434. package/dist/src/discussions/recordingJobs.js +2 -1
  435. package/dist/src/discussions/repository.js +2 -1
  436. package/dist/src/discussions/revisions.js +2 -1
  437. package/dist/src/discussions/sealer.js +1 -1
  438. package/dist/src/discussions/service.js +6 -3
  439. package/dist/src/discussions/types.js +4 -0
  440. package/dist/src/endpoint-tools/auth.js +2 -1
  441. package/dist/src/endpoint-tools/binding-service.d.ts +8 -8
  442. package/dist/src/endpoint-tools/binding-service.js +14 -14
  443. package/dist/src/endpoint-tools/invocation-service.js +2 -1
  444. package/dist/src/endpoint-tools/policy.js +2 -1
  445. package/dist/src/endpoint-tools/registry.js +2 -1
  446. package/dist/src/endpoint-tools/upload-service.js +2 -1
  447. package/dist/src/execution-environments/local-worktree-manager.d.ts +1 -1
  448. package/dist/src/execution-environments/local-worktree-manager.js +2 -2
  449. package/dist/src/execution-environments/session-environment-service.d.ts +3 -3
  450. package/dist/src/execution-environments/session-environment-service.js +10 -10
  451. package/dist/src/execution-environments/store.d.ts +2 -2
  452. package/dist/src/execution-environments/store.js +15 -14
  453. package/dist/src/execution-environments/subject.d.ts +1 -1
  454. package/dist/src/execution-environments/subject.js +2 -2
  455. package/dist/src/execution-environments/types.d.ts +2 -2
  456. package/dist/src/extensions/api.js +1 -1
  457. package/dist/src/extensions/install.js +1 -1
  458. package/dist/src/extensions/loader.d.ts +1 -1
  459. package/dist/src/extensions/types/core.d.ts +2 -2
  460. package/dist/src/extensions/types/hooks.d.ts +12 -12
  461. package/dist/src/extensions/types/tools.d.ts +3 -3
  462. package/dist/src/extensions/types/tui.d.ts +3 -3
  463. package/dist/src/files/file-service.d.ts +3 -3
  464. package/dist/src/files/file-service.js +3 -3
  465. package/dist/src/gateway/automation-agent-session.js +5 -5
  466. package/dist/src/gateway/chat-stream/mapper.d.ts +1 -1
  467. package/dist/src/gateway/chat-stream/mapper.js +4 -2
  468. package/dist/src/gateway/chat-stream/protocol.d.ts +1 -1
  469. package/dist/src/gateway/chat-stream/thinking-delta-coalescer.js +1 -1
  470. package/dist/src/gateway/clarify-runtime.d.ts +2 -2
  471. package/dist/src/gateway/clarify-runtime.js +2 -2
  472. package/dist/src/gateway/file-path-classifier.d.ts +2 -2
  473. package/dist/src/gateway/file-path-classifier.js +4 -4
  474. package/dist/src/gateway/file-reference-registry.d.ts +2 -2
  475. package/dist/src/gateway/file-reference-registry.js +1 -1
  476. package/dist/src/gateway/file-space-service.js +3 -3
  477. package/dist/src/gateway/gateway-workflow-host.types.d.ts +1 -1
  478. package/dist/src/gateway/heartbeat/check-store.js +2 -1
  479. package/dist/src/gateway/heartbeat/service.js +23 -9
  480. package/dist/src/gateway/hono/middleware/log-context.d.ts +1 -1
  481. package/dist/src/gateway/hono/middleware/log-context.js +3 -3
  482. package/dist/src/gateway/hono/routes/agent-stream.js +20 -20
  483. package/dist/src/gateway/hono/routes/browser-session.js +2 -2
  484. package/dist/src/gateway/hono/routes/browser.js +22 -20
  485. package/dist/src/gateway/hono/routes/chat-model-config.d.ts +1 -1
  486. package/dist/src/gateway/hono/routes/chat-model-config.js +6 -6
  487. package/dist/src/gateway/hono/routes/commands-skills.js +13 -13
  488. package/dist/src/gateway/hono/routes/connection-waits.js +5 -5
  489. package/dist/src/gateway/hono/routes/connectors.js +5 -5
  490. package/dist/src/gateway/hono/routes/context-sources.js +2 -1
  491. package/dist/src/gateway/hono/routes/device-pairing-approval.js +2 -0
  492. package/dist/src/gateway/hono/routes/devices.js +2 -0
  493. package/dist/src/gateway/hono/routes/discussions.js +2 -2
  494. package/dist/src/gateway/hono/routes/endpoint-tools.js +8 -7
  495. package/dist/src/gateway/hono/routes/execution-environments.js +11 -11
  496. package/dist/src/gateway/hono/routes/file-references.js +5 -5
  497. package/dist/src/gateway/hono/routes/home.js +1 -1
  498. package/dist/src/gateway/hono/routes/interaction-state.js +6 -6
  499. package/dist/src/gateway/hono/routes/logs.js +2 -2
  500. package/dist/src/gateway/hono/routes/media.js +3 -3
  501. package/dist/src/gateway/hono/routes/notes.js +11 -11
  502. package/dist/src/gateway/hono/routes/projects.js +26 -26
  503. package/dist/src/gateway/hono/routes/public-gateway.js +3 -3
  504. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +10 -10
  505. package/dist/src/gateway/hono/routes/session-input-handler.js +20 -17
  506. package/dist/src/gateway/hono/routes/sessions.js +79 -50
  507. package/dist/src/gateway/hono/routes/shares.js +38 -38
  508. package/dist/src/gateway/hono/routes/side-chats.js +4 -2
  509. package/dist/src/gateway/hono/routes/site-shares.js +6 -6
  510. package/dist/src/gateway/hono/routes/tasks.js +18 -13
  511. package/dist/src/gateway/hono/routes/tui.js +2 -2
  512. package/dist/src/gateway/hono/routes/user-model.js +1 -1
  513. package/dist/src/gateway/hono/routes/voice.js +1 -1
  514. package/dist/src/gateway/hono/routes/workflows.js +9 -9
  515. package/dist/src/gateway/media-access.d.ts +1 -1
  516. package/dist/src/gateway/media-access.js +3 -3
  517. package/dist/src/gateway/resolve-webchat-session-key.d.ts +5 -5
  518. package/dist/src/gateway/resolve-webchat-session-key.js +5 -5
  519. package/dist/src/gateway/service/agent-runner.d.ts +15 -15
  520. package/dist/src/gateway/service/agent-runner.js +63 -62
  521. package/dist/src/gateway/service/marketplace-service.d.ts +3 -3
  522. package/dist/src/gateway/service/marketplace-service.js +6 -6
  523. package/dist/src/gateway/service/run-gateway-agent.js +51 -49
  524. package/dist/src/gateway/service/session-input-coordinator.d.ts +11 -11
  525. package/dist/src/gateway/service/session-input-coordinator.js +76 -74
  526. package/dist/src/gateway/service/sessions-api.d.ts +19 -20
  527. package/dist/src/gateway/service/sessions-api.js +30 -38
  528. package/dist/src/gateway/service/task-conversation-query-service.d.ts +3 -2
  529. package/dist/src/gateway/service/task-conversation-query-service.js +3 -3
  530. package/dist/src/gateway/service.d.ts +4 -4
  531. package/dist/src/gateway/service.js +75 -69
  532. package/dist/src/gateway/session-context-summary.d.ts +1 -1
  533. package/dist/src/gateway/session-context-summary.js +13 -11
  534. package/dist/src/gateway/session-reset-service.d.ts +4 -4
  535. package/dist/src/gateway/session-reset-service.js +12 -12
  536. package/dist/src/gateway/side-chat/context-snapshot.d.ts +2 -2
  537. package/dist/src/gateway/side-chat/context-snapshot.js +2 -2
  538. package/dist/src/gateway/side-chat/manager.d.ts +4 -4
  539. package/dist/src/gateway/side-chat/manager.js +13 -13
  540. package/dist/src/gateway/side-chat/run-service.js +8 -8
  541. package/dist/src/gateway/side-chat/types.d.ts +4 -4
  542. package/dist/src/heartbeat/index.js +1 -1
  543. package/dist/src/heartbeat/wake.d.ts +1 -1
  544. package/dist/src/history/ctx/exporter.js +11 -11
  545. package/dist/src/history/ctx/format.d.ts +1 -1
  546. package/dist/src/history/ctx/format.js +7 -7
  547. package/dist/src/imports/contextImport.js +2 -1
  548. package/dist/src/imports/productImport.js +2 -1
  549. package/dist/src/infra/node-sqlite.js +9 -3
  550. package/dist/src/infra/process-diagnostics.js +9 -5
  551. package/dist/src/infra/sqlite-errors.js +25 -20
  552. package/dist/src/infra/unhandled-rejections.js +15 -7
  553. package/dist/src/infra/update-restart.js +1 -1
  554. package/dist/src/infra/warning-filter.js +9 -3
  555. package/dist/src/knowledge-memory/domain.d.ts +2 -2
  556. package/dist/src/knowledge-memory/repository.d.ts +1 -1
  557. package/dist/src/knowledge-memory/repository.js +10 -8
  558. package/dist/src/mcp/channel-bridge.d.ts +3 -3
  559. package/dist/src/mcp/channel-bridge.js +7 -7
  560. package/dist/src/mcp/channel-shared.d.ts +4 -4
  561. package/dist/src/mcp/channel-shared.js +3 -3
  562. package/dist/src/mcp/channel-tools.js +19 -19
  563. package/dist/src/media/session-references.js +2 -2
  564. package/dist/src/memory-maintenance/service.js +2 -1
  565. package/dist/src/migrations/conversation-routing-config.d.ts +2 -0
  566. package/dist/src/migrations/conversation-routing-config.js +42 -0
  567. package/dist/src/migrations/runner.js +6 -5
  568. package/dist/src/notes/service.d.ts +2 -2
  569. package/dist/src/notes/service.js +6 -6
  570. package/dist/src/notes/store.js +2 -1
  571. package/dist/src/notes/types.d.ts +3 -3
  572. package/dist/src/notifications/device-store.js +2 -1
  573. package/dist/src/notifications/planner.js +5 -3
  574. package/dist/src/notifications/proactive-channel.js +4 -1
  575. package/dist/src/notifications/proactive-policy.js +2 -1
  576. package/dist/src/notifications/service.d.ts +4 -4
  577. package/dist/src/notifications/service.js +4 -1
  578. package/dist/src/notifications/store.js +4 -1
  579. package/dist/src/notifications/web-push.js +4 -1
  580. package/dist/src/platform/contracts.d.ts +3 -3
  581. package/dist/src/proactive/actions/service.js +2 -1
  582. package/dist/src/proactive/events/product-event-bridge.js +1 -1
  583. package/dist/src/proactive/events/repository.js +2 -1
  584. package/dist/src/proactive/execution/authorization.js +2 -1
  585. package/dist/src/proactive/execution/context.js +2 -1
  586. package/dist/src/proactive/execution/insight.js +2 -0
  587. package/dist/src/proactive/execution/repository.js +2 -1
  588. package/dist/src/proactive/execution/worker.js +3 -2
  589. package/dist/src/proactive/experience.d.ts +1 -1
  590. package/dist/src/proactive/experience.js +4 -3
  591. package/dist/src/proactive/follow-ups.d.ts +7 -7
  592. package/dist/src/proactive/follow-ups.js +5 -4
  593. package/dist/src/proactive/inbox/cards.js +5 -2
  594. package/dist/src/proactive/inbox/delivery.js +2 -1
  595. package/dist/src/proactive/inbox/digest.js +2 -1
  596. package/dist/src/proactive/inbox/lifecycle.js +2 -1
  597. package/dist/src/proactive/inbox/repository.js +2 -1
  598. package/dist/src/proactive/inbox/service.js +2 -1
  599. package/dist/src/proactive/mail-thread.js +2 -1
  600. package/dist/src/proactive/maintenance.js +2 -1
  601. package/dist/src/proactive/metrics.js +2 -1
  602. package/dist/src/proactive/policy/presence.js +2 -1
  603. package/dist/src/proactive/policy/service.js +4 -1
  604. package/dist/src/proactive/routing/batch-repository.js +2 -1
  605. package/dist/src/proactive/scenarios/control.js +4 -1
  606. package/dist/src/proactive/scenarios/repository.js +2 -1
  607. package/dist/src/proactive/service.js +2 -1
  608. package/dist/src/proactive/source-freshness.js +2 -1
  609. package/dist/src/proactive/status.js +2 -1
  610. package/dist/src/proactive/temporal/schedule.js +2 -1
  611. package/dist/src/projects/automation-bind.js +2 -1
  612. package/dist/src/projects/index.js +2 -2
  613. package/dist/src/projects/knowledge-bind.js +2 -1
  614. package/dist/src/projects/project-agent.js +4 -1
  615. package/dist/src/projects/project-service.d.ts +4 -4
  616. package/dist/src/projects/project-service.js +11 -10
  617. package/dist/src/projects/project-store.js +11 -9
  618. package/dist/src/projects/session-bind.d.ts +5 -5
  619. package/dist/src/projects/session-bind.js +18 -17
  620. package/dist/src/projects/types.d.ts +1 -1
  621. package/dist/src/projects/workflow-bind.js +2 -1
  622. package/dist/src/projects/workspace.d.ts +3 -3
  623. package/dist/src/projects/workspace.js +6 -6
  624. package/dist/src/providers/model-reference-auditor.js +1 -1
  625. package/dist/src/providers/prompt-cache-lifecycle.d.ts +2 -2
  626. package/dist/src/providers/prompt-cache-lifecycle.js +6 -6
  627. package/dist/src/realtime/broker.js +3 -3
  628. package/dist/src/realtime/runtime.js +1 -1
  629. package/dist/src/retrieval/queryProfile.d.ts +1 -1
  630. package/dist/src/routing/agent-session-key.d.ts +12 -41
  631. package/dist/src/routing/agent-session-key.js +39 -120
  632. package/dist/src/routing/conversation-route.d.ts +28 -0
  633. package/dist/src/routing/conversation-route.js +50 -0
  634. package/dist/src/routing/index.d.ts +2 -2
  635. package/dist/src/routing/index.js +5 -5
  636. package/dist/src/routing/resolve-route.d.ts +4 -9
  637. package/dist/src/routing/resolve-route.js +20 -60
  638. package/dist/src/routing/resolve-tui-session-key.d.ts +5 -13
  639. package/dist/src/routing/resolve-tui-session-key.js +11 -36
  640. package/dist/src/routing/session-key.d.ts +6 -39
  641. package/dist/src/routing/session-key.js +13 -161
  642. package/dist/src/session/client-history.js +2 -0
  643. package/dist/src/session/compaction-types.js +18 -13
  644. package/dist/src/session/config-store.d.ts +8 -8
  645. package/dist/src/session/config-store.js +19 -19
  646. package/dist/src/session/index.d.ts +2 -2
  647. package/dist/src/session/index.js +9 -5
  648. package/dist/src/session/init-session-turn.d.ts +7 -7
  649. package/dist/src/session/init-session-turn.js +18 -18
  650. package/dist/src/session/manager.d.ts +7 -7
  651. package/dist/src/session/manager.js +6 -6
  652. package/dist/src/session/model-config-lock.d.ts +1 -1
  653. package/dist/src/session/model-config-lock.js +4 -4
  654. package/dist/src/session/resolve-session.d.ts +10 -10
  655. package/dist/src/session/resolve-session.js +20 -20
  656. package/dist/src/session/session-context-for-llm.js +17 -10
  657. package/dist/src/session/session-title.d.ts +5 -5
  658. package/dist/src/session/session-title.js +28 -28
  659. package/dist/src/session/session-workspace.d.ts +1 -1
  660. package/dist/src/session/session-workspace.js +3 -3
  661. package/dist/src/session/store.d.ts +14 -14
  662. package/dist/src/session/store.js +70 -50
  663. package/dist/src/session/stored-rows-to-file-entries.d.ts +1 -1
  664. package/dist/src/session/stored-rows-to-file-entries.js +5 -3
  665. package/dist/src/session/thinking-resolve.d.ts +2 -2
  666. package/dist/src/session/thinking-resolve.js +4 -4
  667. package/dist/src/session/transcript-events.d.ts +1 -1
  668. package/dist/src/session/transcript-events.js +3 -3
  669. package/dist/src/session/transcript-outline.js +2 -1
  670. package/dist/src/session/turn-outcome-projector.js +2 -0
  671. package/dist/src/session/types.d.ts +5 -4
  672. package/dist/src/session/types.js +13 -9
  673. package/dist/src/session/user-message-display.js +2 -0
  674. package/dist/src/session/user-round-delete.js +2 -1
  675. package/dist/src/session/voice-transcript.js +8 -3
  676. package/dist/src/share/hosted-session-share.d.ts +6 -6
  677. package/dist/src/share/hosted-session-share.js +13 -11
  678. package/dist/src/share/hosted-static-site-publish.d.ts +1 -1
  679. package/dist/src/share/hosted-static-site-publish.js +1 -1
  680. package/dist/src/share/session-share-service.d.ts +9 -9
  681. package/dist/src/share/session-share-service.js +19 -19
  682. package/dist/src/share/share-store.d.ts +2 -2
  683. package/dist/src/share/share-store.js +9 -7
  684. package/dist/src/share/share-types.d.ts +2 -2
  685. package/dist/src/share/site-share-router.d.ts +2 -2
  686. package/dist/src/share/site-share-store.js +4 -2
  687. package/dist/src/share/site-share-types.d.ts +1 -1
  688. package/dist/src/storage/sqlite/activity-repository.js +2 -1
  689. package/dist/src/storage/sqlite/browser-session-repository.js +2 -1
  690. package/dist/src/storage/sqlite/browser-tab-binding-repository.d.ts +2 -2
  691. package/dist/src/storage/sqlite/browser-tab-binding-repository.js +10 -9
  692. package/dist/src/storage/sqlite/clarification-wait-repository.d.ts +7 -7
  693. package/dist/src/storage/sqlite/clarification-wait-repository.js +58 -53
  694. package/dist/src/storage/sqlite/collaboration-rule-repository.js +2 -1
  695. package/dist/src/storage/sqlite/composer-input-history-repository.js +2 -1
  696. package/dist/src/storage/sqlite/config-repository.d.ts +6 -6
  697. package/dist/src/storage/sqlite/config-repository.js +29 -25
  698. package/dist/src/storage/sqlite/connection-wait-repository.d.ts +11 -11
  699. package/dist/src/storage/sqlite/connection-wait-repository.js +61 -51
  700. package/dist/src/storage/sqlite/connection.js +28 -18
  701. package/dist/src/storage/sqlite/connector-account-repository.js +2 -1
  702. package/dist/src/storage/sqlite/connector-learning-repository.js +2 -1
  703. package/dist/src/storage/sqlite/connector-repository.d.ts +1 -1
  704. package/dist/src/storage/sqlite/connector-repository.js +11 -10
  705. package/dist/src/storage/sqlite/connector-sync-policy-repository.js +2 -1
  706. package/dist/src/storage/sqlite/context-evidence-repository.d.ts +1 -1
  707. package/dist/src/storage/sqlite/context-evidence-repository.js +7 -6
  708. package/dist/src/storage/sqlite/context-extraction-repository.js +2 -1
  709. package/dist/src/storage/sqlite/context-relation-repository.js +2 -1
  710. package/dist/src/storage/sqlite/conversation-repository.d.ts +12 -0
  711. package/dist/src/storage/sqlite/conversation-repository.js +76 -0
  712. package/dist/src/storage/sqlite/device-access-repository.js +4 -1
  713. package/dist/src/storage/sqlite/device-pairing-approval.js +4 -1
  714. package/dist/src/storage/sqlite/device-pairing-repository.js +2 -1
  715. package/dist/src/storage/sqlite/durable-queue.js +4 -2
  716. package/dist/src/storage/sqlite/durable-state.js +4 -2
  717. package/dist/src/storage/sqlite/endpoint-principal-repository.js +2 -1
  718. package/dist/src/storage/sqlite/endpoint-session-binding-repository.d.ts +3 -3
  719. package/dist/src/storage/sqlite/endpoint-session-binding-repository.js +12 -11
  720. package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +2 -1
  721. package/dist/src/storage/sqlite/fts.js +39 -34
  722. package/dist/src/storage/sqlite/gateway-identity-repository.js +2 -1
  723. package/dist/src/storage/sqlite/home-attention-repository.js +2 -1
  724. package/dist/src/storage/sqlite/import-repository.js +2 -1
  725. package/dist/src/storage/sqlite/import-selection-repository.js +2 -1
  726. package/dist/src/storage/sqlite/index.d.ts +1 -1
  727. package/dist/src/storage/sqlite/index.js +25 -11
  728. package/dist/src/storage/sqlite/interaction-state-repository.d.ts +4 -4
  729. package/dist/src/storage/sqlite/interaction-state-repository.js +12 -11
  730. package/dist/src/storage/sqlite/knowledge-repository.js +2 -1
  731. package/dist/src/storage/sqlite/migrations/178_conversation_uuid.sql +2 -0
  732. package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +3 -0
  733. package/dist/src/storage/sqlite/migrations/conversation-backup.js +88 -0
  734. package/dist/src/storage/sqlite/migrations/conversation-backup.ts +66 -0
  735. package/dist/src/storage/sqlite/migrations/conversation-key-decoder.d.ts +8 -0
  736. package/dist/src/storage/sqlite/migrations/conversation-key-decoder.js +87 -0
  737. package/dist/src/storage/sqlite/migrations/conversation-key-decoder.ts +50 -0
  738. package/dist/src/storage/sqlite/migrations/conversation-uuid.d.ts +8 -0
  739. package/dist/src/storage/sqlite/migrations/conversation-uuid.js +366 -0
  740. package/dist/src/storage/sqlite/migrations/conversation-uuid.ts +324 -0
  741. package/dist/src/storage/sqlite/migrations/conversation-windows-owners.d.ts +1 -0
  742. package/dist/src/storage/sqlite/migrations/conversation-windows-owners.js +92 -0
  743. package/dist/src/storage/sqlite/migrations/conversation-windows-owners.ts +71 -0
  744. package/dist/src/storage/sqlite/migrations/discover.js +7 -3
  745. package/dist/src/storage/sqlite/migrations/errors.js +28 -23
  746. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  747. package/dist/src/storage/sqlite/migrations/runner.js +43 -14
  748. package/dist/src/storage/sqlite/migrations/runner.ts +13 -3
  749. package/dist/src/storage/sqlite/migrations/types.d.ts +1 -1
  750. package/dist/src/storage/sqlite/migrations/types.ts +1 -1
  751. package/dist/src/storage/sqlite/note-agent-context-repository.js +2 -1
  752. package/dist/src/storage/sqlite/notes-repository.js +4 -2
  753. package/dist/src/storage/sqlite/paths.js +6 -2
  754. package/dist/src/storage/sqlite/relationship-settings-repository.js +2 -1
  755. package/dist/src/storage/sqlite/row-mappers.d.ts +10 -10
  756. package/dist/src/storage/sqlite/row-mappers.js +22 -15
  757. package/dist/src/storage/sqlite/schema-version.js +7 -2
  758. package/dist/src/storage/sqlite/schema.js +14 -6
  759. package/dist/src/storage/sqlite/session-identity-sql.js +12 -5
  760. package/dist/src/storage/sqlite/session-input-repository.d.ts +14 -14
  761. package/dist/src/storage/sqlite/session-input-repository.js +69 -61
  762. package/dist/src/storage/sqlite/session-instance-repository.d.ts +1 -1
  763. package/dist/src/storage/sqlite/session-instance-repository.js +6 -3
  764. package/dist/src/storage/sqlite/session-metadata.d.ts +2 -2
  765. package/dist/src/storage/sqlite/session-metadata.js +7 -3
  766. package/dist/src/storage/sqlite/session-repository.d.ts +15 -15
  767. package/dist/src/storage/sqlite/session-repository.js +126 -102
  768. package/dist/src/storage/sqlite/session-task-plan-repository.d.ts +3 -3
  769. package/dist/src/storage/sqlite/session-task-plan-repository.js +21 -19
  770. package/dist/src/storage/sqlite/session-turn-replace-repository.d.ts +2 -2
  771. package/dist/src/storage/sqlite/session-turn-replace-repository.js +26 -22
  772. package/dist/src/storage/sqlite/transaction.js +12 -6
  773. package/dist/src/storage/sqlite/transcript-repository.d.ts +14 -14
  774. package/dist/src/storage/sqlite/transcript-repository.js +107 -102
  775. package/dist/src/storage/sqlite/user-people-repository.js +2 -1
  776. package/dist/src/storage/sqlite/user-trust-repository.js +2 -1
  777. package/dist/src/support/collect-support-report.js +7 -7
  778. package/dist/src/support/types.d.ts +2 -2
  779. package/dist/src/support/types.js +1 -1
  780. package/dist/src/tasks/execution-context.d.ts +2 -2
  781. package/dist/src/tasks/execution-context.js +3 -3
  782. package/dist/src/tasks/home-query-service.d.ts +2 -2
  783. package/dist/src/tasks/home-query-service.js +6 -6
  784. package/dist/src/tasks/index.js +6 -2
  785. package/dist/src/tasks/project-monitoring-service.js +2 -1
  786. package/dist/src/tasks/project-operating-view-service.js +2 -1
  787. package/dist/src/tasks/task-application-service.js +9 -4
  788. package/dist/src/tasks/task-change-events.js +7 -2
  789. package/dist/src/tasks/task-context-assembler.d.ts +2 -2
  790. package/dist/src/tasks/task-context-assembler.js +12 -9
  791. package/dist/src/tasks/task-context-repository.d.ts +1 -1
  792. package/dist/src/tasks/task-context-repository.js +4 -3
  793. package/dist/src/tasks/task-conversation-repository.d.ts +7 -7
  794. package/dist/src/tasks/task-conversation-repository.js +27 -26
  795. package/dist/src/tasks/task-deletion-service.js +2 -1
  796. package/dist/src/tasks/task-dependency-service.js +2 -1
  797. package/dist/src/tasks/task-handoff-service.d.ts +2 -2
  798. package/dist/src/tasks/task-handoff-service.js +16 -15
  799. package/dist/src/tasks/task-outbox-dispatcher.js +2 -1
  800. package/dist/src/tasks/task-read-model-projector.js +4 -2
  801. package/dist/src/tasks/task-repository.js +2 -1
  802. package/dist/src/tasks/task-run-coordinator.js +6 -5
  803. package/dist/src/tasks/task-run-dispatcher.d.ts +1 -1
  804. package/dist/src/tasks/task-run-dispatcher.js +4 -3
  805. package/dist/src/tasks/task-run-repository.d.ts +2 -2
  806. package/dist/src/tasks/task-run-repository.js +219 -212
  807. package/dist/src/tasks/task-signal-service.js +6 -2
  808. package/dist/src/tasks/task-workflow-coordinator.js +2 -1
  809. package/dist/src/tui/backends/embedded-backend.d.ts +33 -32
  810. package/dist/src/tui/backends/embedded-backend.js +95 -83
  811. package/dist/src/tui/backends/gateway-realtime-backend.d.ts +34 -33
  812. package/dist/src/tui/backends/gateway-realtime-backend.js +95 -78
  813. package/dist/src/tui/components/branch-summary.js +3 -3
  814. package/dist/src/tui/components/session-selector.d.ts +5 -5
  815. package/dist/src/tui/components/session-selector.js +7 -7
  816. package/dist/src/tui/components/tui-bottom-bar.js +1 -1
  817. package/dist/src/tui/components/tui-header.d.ts +1 -1
  818. package/dist/src/tui/components/tui-header.js +2 -2
  819. package/dist/src/tui/extension-host/autocomplete.d.ts +2 -2
  820. package/dist/src/tui/extension-host/autocomplete.js +4 -4
  821. package/dist/src/tui/extension-host/host.d.ts +1 -1
  822. package/dist/src/tui/extension-host/runtime-context.d.ts +1 -1
  823. package/dist/src/tui/extension-host/runtime-context.js +2 -2
  824. package/dist/src/tui/extension-host/runtime.d.ts +1 -1
  825. package/dist/src/tui/extension-host/runtime.js +6 -6
  826. package/dist/src/tui/tui-backend.d.ts +43 -39
  827. package/dist/src/tui/tui-command-formatters.d.ts +2 -2
  828. package/dist/src/tui/tui-command-formatters.js +10 -18
  829. package/dist/src/tui/tui-commands.d.ts +3 -3
  830. package/dist/src/tui/tui-commands.js +31 -33
  831. package/dist/src/tui/tui-empty-session-cleanup.d.ts +2 -3
  832. package/dist/src/tui/tui-empty-session-cleanup.js +7 -15
  833. package/dist/src/tui/tui-file-autocomplete.d.ts +1 -1
  834. package/dist/src/tui/tui-file-autocomplete.js +2 -2
  835. package/dist/src/tui/tui-new-session-preferences.js +2 -0
  836. package/dist/src/tui/tui-picker-overlay.d.ts +1 -1
  837. package/dist/src/tui/tui-picker-overlay.js +41 -53
  838. package/dist/src/tui/tui-picker-services.d.ts +3 -3
  839. package/dist/src/tui/tui-session-actions.d.ts +1 -1
  840. package/dist/src/tui/tui-session-actions.js +8 -17
  841. package/dist/src/tui/tui-session-format.js +4 -1
  842. package/dist/src/tui/tui-session-snapshot.d.ts +2 -2
  843. package/dist/src/tui/tui-session-snapshot.js +4 -4
  844. package/dist/src/tui/tui-settings.js +2 -0
  845. package/dist/src/tui/tui-startup-resources.d.ts +1 -1
  846. package/dist/src/tui/tui-startup-resources.js +3 -3
  847. package/dist/src/tui/tui-startup-text.js +1 -1
  848. package/dist/src/tui/tui-transcript-tree-picker.d.ts +1 -1
  849. package/dist/src/tui/tui-transcript-tree-picker.js +2 -2
  850. package/dist/src/tui/tui-types.d.ts +4 -2
  851. package/dist/src/tui/tui-types.js +2 -2
  852. package/dist/src/tui/tui.js +114 -112
  853. package/dist/src/user-context/access-policy.d.ts +1 -1
  854. package/dist/src/user-context/access-policy.js +6 -5
  855. package/dist/src/user-context/changes.js +9 -4
  856. package/dist/src/user-context/domain.d.ts +1 -1
  857. package/dist/src/user-context/relationship-continuity.d.ts +1 -1
  858. package/dist/src/user-context/relationship-continuity.js +1 -1
  859. package/dist/src/user-context/sources/repository.js +4 -2
  860. package/dist/src/user-model/capture/executor.d.ts +1 -1
  861. package/dist/src/user-model/capture/executor.js +3 -3
  862. package/dist/src/user-model/goals.js +2 -1
  863. package/dist/src/user-model/repository.js +2 -1
  864. package/dist/src/utils/global-singleton.js +4 -1
  865. package/dist/src/utils/logger/context.d.ts +1 -1
  866. package/dist/src/utils/logger/context.js +2 -2
  867. package/dist/src/utils/logger/log-store.js +2 -2
  868. package/dist/src/utils/logger/pino-record.js +6 -6
  869. package/dist/src/utils/logger/types.d.ts +6 -6
  870. package/dist/src/voice/realtime/agentBroker.d.ts +6 -6
  871. package/dist/src/voice/realtime/agentBroker.js +6 -6
  872. package/dist/src/voice/realtime/agentEngine.js +6 -6
  873. package/dist/src/voice/realtime/memory-context.d.ts +2 -2
  874. package/dist/src/voice/realtime/memory-context.js +15 -15
  875. package/dist/src/voice/realtime/persona-context.d.ts +1 -1
  876. package/dist/src/voice/realtime/persona-context.js +6 -6
  877. package/dist/src/voice/realtime/runtime.d.ts +1 -1
  878. package/dist/src/voice/realtime/runtime.js +14 -13
  879. package/dist/src/voice/realtime/runtime.types.d.ts +6 -6
  880. package/dist/src/work-discovery/investigation-repository.js +4 -2
  881. package/dist/src/work-discovery/probe.js +1 -1
  882. package/dist/src/work-discovery/repository.js +7 -5
  883. package/dist/src/work-discovery/service.js +33 -29
  884. package/dist/src/work-discovery/types.d.ts +1 -1
  885. package/dist/src/workflows/context/workflow-context-snapshot-repository.js +2 -1
  886. package/dist/src/workflows/domain/event.d.ts +1 -1
  887. package/dist/src/workflows/domain/run.d.ts +5 -5
  888. package/dist/src/workflows/engine/projector.js +1 -1
  889. package/dist/src/workflows/engine/workflow-engine.d.ts +2 -2
  890. package/dist/src/workflows/engine/workflow-engine.js +15 -18
  891. package/dist/src/workflows/index.js +3 -3
  892. package/dist/src/workflows/project-presets/project-workflow-preset-repository.js +2 -1
  893. package/dist/src/workflows/service/run-view-to-snapshot.js +1 -1
  894. package/dist/src/workflows/service/workflow-run-service.d.ts +2 -2
  895. package/dist/src/workflows/service/workflow-run-service.js +53 -42
  896. package/dist/src/workflows/service/workflow-run-service.types.d.ts +2 -2
  897. package/dist/src/workflows/service/workflow-session-bridge.d.ts +2 -2
  898. package/dist/src/workflows/service/workflow-session-bridge.js +31 -31
  899. package/dist/src/workflows/service/workflow-session-key.d.ts +1 -1
  900. package/dist/src/workflows/service/workflow-session-key.js +4 -4
  901. package/dist/src/workflows/service/workflow-writeback-service.js +2 -1
  902. package/dist/src/workflows/store/event-store.js +4 -2
  903. package/dist/src/workflows/store/run-index-store.js +9 -8
  904. package/package.json +4 -4
  905. package/dist/gateway/static/root/assets/api-COG_Tzpv.js +0 -1
  906. package/dist/gateway/static/root/assets/apps-page-6qxxKFsK.js +0 -1
  907. package/dist/gateway/static/root/assets/button-BA45yciM.js +0 -1
  908. package/dist/gateway/static/root/assets/capabilities-settings-panel-DM1Bcf1x.js +0 -8
  909. package/dist/gateway/static/root/assets/channels-settings-Bq36CUxL.js +0 -1
  910. package/dist/gateway/static/root/assets/desktop-pet-DtPNvznL.js +0 -1
  911. package/dist/gateway/static/root/assets/extension-settings-page-C75kCOqe.js +0 -1
  912. package/dist/gateway/static/root/assets/gateway-settings-BCF732TU.js +0 -1
  913. package/dist/gateway/static/root/assets/index-ChIrvv3t.js +0 -74
  914. package/dist/gateway/static/root/assets/index-R1VNlHjj.css +0 -2
  915. package/dist/gateway/static/root/assets/locale-store-DlOv7896.js +0 -1
  916. package/dist/gateway/static/root/assets/logs-page-DHZ4BEkG.js +0 -2
  917. package/dist/gateway/static/root/assets/messages-Ls1Aaiqd.js +0 -3
  918. package/dist/gateway/static/root/assets/notes-page-DfZ8QWyv.js +0 -8
  919. package/dist/gateway/static/root/assets/page-tabs-BG39KidE.js +0 -1
  920. package/dist/gateway/static/root/assets/popover-select-DGmMQt4t.js +0 -1
  921. package/dist/gateway/static/root/assets/proactive-page-D2U_xQaS.js +0 -1
  922. package/dist/gateway/static/root/assets/project-detail-page-CzlGTW4F.js +0 -1
  923. package/dist/gateway/static/root/assets/projects-page-mQsM-TsP.js +0 -1
  924. package/dist/gateway/static/root/assets/remote-access-hub-Cb56JcO1.js +0 -1
  925. package/dist/gateway/static/root/assets/settings-advanced-gate-CV4-_EVA.js +0 -1
  926. package/dist/gateway/static/root/assets/settings-form-section-wcAdCkK8.js +0 -1
  927. package/dist/gateway/static/root/assets/settings-page-layout-DYelDcMV.js +0 -1
  928. package/dist/gateway/static/root/assets/shares-settings-xlJh1ccG.js +0 -1
  929. package/dist/gateway/static/root/assets/skill-reload-api-wSXJRSxX.js +0 -1
  930. package/dist/gateway/static/root/assets/task-detail-page-sQpwq5-c.js +0 -1
  931. package/dist/gateway/static/root/assets/tunnel-api-Boajol0M.js +0 -1
  932. package/dist/src/routing/session-key-utils.d.ts +0 -23
  933. package/dist/src/routing/session-key-utils.js +0 -85
  934. package/dist/src/session/session-id.d.ts +0 -3
  935. package/dist/src/session/session-id.js +0 -10
@@ -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{d as i,t as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as o}from"./plus-Q2yW6OE7.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./cn-JdwAhgNB.js";import{n as l}from"./locale-store-DlOv7896.js";import{t as u}from"./messages-Ls1Aaiqd.js";import{a as d,i as f,n as p,o as m,r as h,s as g,t as _}from"./dist-BGTk37IG.js";import{i as v}from"./vendor-swr-BIWyz7Rc.js";import{t as y}from"./button-BA45yciM.js";import{t as b}from"./skeleton-BwbyijEw.js";import{Br as x,Ds as S,Fs as C,Hc as w,No as T,Os as E,Su as D,_u as ee,an as O,dc as k,di as A,ei as j,el as M,fi as N,in as P,mo as F,oa as I,on as te,r as ne,sn as re,ti as ie,vs as ae,vu as L,ws as oe,zl as R}from"./index-ChIrvv3t.js";import{t as se}from"./api-COG_Tzpv.js";import{n as ce}from"./tab-completion-input-D64VNmiA.js";var z=n(),B=r(),V={meeting_preparation:{Icon:D,en:`Next meeting`,zh:`下一场会议`},project_momentum:{Icon:R,en:`Project momentum`,zh:`项目进展`},communication_follow_up:{Icon:M,en:`Waiting on a reply`,zh:`沟通跟进`}},le={needs_decision:{en:`Needs your decision`,zh:`需要你决定`},prepared:{en:`Ready for you`,zh:`已为你准备好`},changed:{en:`Something changed`,zh:`出现了新变化`},following:{en:`Following quietly`,zh:`正在安静跟进`}};function H(e){let t=(0,z.c)(56),{scene:n,zh:r}=e,i=V[n.kind],o=le[n.status],s=n.card?`/assistant-work?item=${encodeURIComponent(n.card.id)}`:n.object?.route??n.manageRoute,c=n.status===`needs_decision`?r?`查看并决定`:`Review and decide`:n.status===`prepared`?r?`查看准备结果`:`Open prepared work`:n.status===`changed`?r?`查看变化`:`Review change`:n.object?r?`打开${n.kind===`project_momentum`?`项目`:`相关内容`}`:`Open context`:r?`查看安排`:`View arrangement`,l;t[0]===i.Icon?l=t[1]:(l=(0,B.jsx)(`span`,{className:`mt-0.5 rounded-xl bg-accent-soft p-2 text-accent`,children:(0,B.jsx)(i.Icon,{className:`size-4`,"aria-hidden":!0})}),t[0]=i.Icon,t[1]=l);let u=r?i.zh:i.en,d;t[2]===u?d=t[3]:(d=(0,B.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:u}),t[2]=u,t[3]=d);let f=n.status===`following`?`text-xs text-fg-subtle`:`text-xs font-medium text-accent`,p=r?o.zh:o.en,m;t[4]!==f||t[5]!==p?(m=(0,B.jsx)(`span`,{className:f,children:p}),t[4]=f,t[5]=p,t[6]=m):m=t[6];let h;t[7]!==d||t[8]!==m?(h=(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[d,m]}),t[7]=d,t[8]=m,t[9]=h):h=t[9];let g;t[10]===n.title?g=t[11]:(g=(0,B.jsx)(`h3`,{className:`mt-1 font-semibold text-fg`,children:n.title}),t[10]=n.title,t[11]=g);let _;t[12]!==h||t[13]!==g?(_=(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[h,g]}),t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==l||t[16]!==_?(v=(0,B.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-5 py-4`,children:[l,_]}),t[15]=l,t[16]=_,t[17]=v):v=t[17];let y=r?`现在`:`Now`,b;t[18]===y?b=t[19]:(b=(0,B.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:y}),t[18]=y,t[19]=b);let x;t[20]===n.moment?x=t[21]:(x=(0,B.jsx)(`p`,{className:`mt-1 text-sm font-medium text-fg`,children:n.moment}),t[20]=n.moment,t[21]=x);let S;t[22]!==b||t[23]!==x?(S=(0,B.jsxs)(`div`,{children:[b,x]}),t[22]=b,t[23]=x,t[24]=S):S=t[24];let C=n.status===`following`?r?`跟进要求`:`What the assistant remembers`:r?`为什么值得关注`:`Why it matters`,w;t[25]===C?w=t[26]:(w=(0,B.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:C}),t[25]=C,t[26]=w);let T=n.status===`following`?n.promise:n.relevance,E;t[27]===T?E=t[28]:(E=(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:T}),t[27]=T,t[28]=E);let D;t[29]!==w||t[30]!==E?(D=(0,B.jsxs)(`div`,{children:[w,E]}),t[29]=w,t[30]=E,t[31]=D):D=t[31];let ee=r?`助理已经做了什么`:`What your assistant did`,O;t[32]===ee?O=t[33]:(O=(0,B.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:ee}),t[32]=ee,t[33]=O);let k;t[34]===n.help?k=t[35]:(k=(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:n.help}),t[34]=n.help,t[35]=k);let A;t[36]!==O||t[37]!==k?(A=(0,B.jsxs)(`div`,{className:`rounded-xl bg-surface-hover px-4 py-3`,children:[O,k]}),t[36]=O,t[37]=k,t[38]=A):A=t[38];let j;t[39]!==c||t[40]!==s?(j=(0,B.jsx)(a,{className:`text-sm font-medium text-accent`,to:s,children:c}),t[39]=c,t[40]=s,t[41]=j):j=t[41];let M=r?`调整助理跟进`:`Adjust arrangement`,N;t[42]!==n.manageRoute||t[43]!==M?(N=(0,B.jsx)(a,{className:`text-xs text-fg-subtle hover:text-fg`,to:n.manageRoute,children:M}),t[42]=n.manageRoute,t[43]=M,t[44]=N):N=t[44];let P;t[45]!==j||t[46]!==N?(P=(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[j,N]}),t[45]=j,t[46]=N,t[47]=P):P=t[47];let F;t[48]!==S||t[49]!==D||t[50]!==A||t[51]!==P?(F=(0,B.jsxs)(`div`,{className:`space-y-4 px-5 py-4`,children:[S,D,A,P]}),t[48]=S,t[49]=D,t[50]=A,t[51]=P,t[52]=F):F=t[52];let I;return t[53]!==v||t[54]!==F?(I=(0,B.jsxs)(`article`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[v,F]}),t[53]=v,t[54]=F,t[55]=I):I=t[55],I}function ue(e){let t=(0,z.c)(42),{compact:n}=e,r=n===void 0?!1:n,i=l(U)===`zh`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={refreshInterval:15e3},t[0]=o):o=t[0];let s=v(`/api/proactive/overview`,se,o);if(s.isLoading){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,B.jsx)(b,{className:`h-44 rounded-2xl`}),t[1]=e):e=t[1],e}if(s.error){let e=String(s.error),n;return t[2]===e?n=t[3]:(n=(0,B.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e}),t[2]=e,t[3]=n),n}let c;t[4]===s.data?.scenes?c=t[5]:(c=s.data?.scenes??[],t[4]=s.data?.scenes,t[5]=c);let u=c;if(!u.length){let e=r?`px-4 text-center`:`rounded-2xl border border-edge bg-surface-panel p-6`,n=r?`text-sm font-medium text-fg-muted`:`font-medium text-fg`,a=i?`今天没有需要你接手的变化`:`Nothing needs your attention today`,o;t[6]!==n||t[7]!==a?(o=(0,B.jsx)(`h2`,{className:n,children:a}),t[6]=n,t[7]=a,t[8]=o):o=t[8];let s=r?`mx-auto mt-2 max-w-lg text-xs leading-5 text-fg-subtle`:`mt-2 text-sm text-fg-muted`,c=i?`继续工作即可。需要持续关注的事,可以直接在项目或对话里交给助理。`:`Keep working. You can ask the assistant to follow something from its project or conversation.`,l;t[9]!==s||t[10]!==c?(l=(0,B.jsx)(`p`,{className:s,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11];let u;return t[12]!==l||t[13]!==e||t[14]!==o?(u=(0,B.jsxs)(`section`,{className:e,children:[o,l]}),t[12]=l,t[13]=e,t[14]=o,t[15]=u):u=t[15],u}let d;t[16]!==r||t[17]!==u?(d=r?u.slice(0,3):u,t[16]=r,t[17]=u,t[18]=d):d=t[18];let f=d,p=i?`正在发生的事`:`What is happening`,m;t[19]===p?m=t[20]:(m=(0,B.jsx)(`h2`,{id:`proactive-scenes-title`,className:`text-sm font-semibold text-fg`,children:p}),t[19]=p,t[20]=m);let h=i?`助理跟进`:`Assistant follow-ups`,g;t[21]===h?g=t[22]:(g=(0,B.jsx)(a,{className:`text-xs text-fg-subtle hover:text-accent`,to:`/assistant-work`,children:h}),t[21]=h,t[22]=g);let _;t[23]!==m||t[24]!==g?(_=(0,B.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3 px-1`,children:[m,g]}),t[23]=m,t[24]=g,t[25]=_):_=t[25];let y;if(t[26]!==f||t[27]!==i){let e;t[29]===i?e=t[30]:(e=e=>(0,B.jsx)(H,{scene:e,zh:i},e.id),t[29]=i,t[30]=e),y=f.map(e),t[26]=f,t[27]=i,t[28]=y}else y=t[28];let x;t[31]===y?x=t[32]:(x=(0,B.jsx)(`div`,{className:`space-y-3`,children:y}),t[31]=y,t[32]=x);let S;t[33]!==r||t[34]!==u.length||t[35]!==f.length||t[36]!==i?(S=r&&u.length>f.length&&(0,B.jsx)(a,{className:`mt-3 block text-sm text-accent`,to:`/assistant-work`,children:i?`还有 ${u.length-f.length} 个场景`:`${u.length-f.length} more scenes`}),t[33]=r,t[34]=u.length,t[35]=f.length,t[36]=i,t[37]=S):S=t[37];let C;return t[38]!==x||t[39]!==S||t[40]!==_?(C=(0,B.jsxs)(`section`,{"aria-labelledby":`proactive-scenes-title`,children:[_,x,S]}),t[38]=x,t[39]=S,t[40]=_,t[41]=C):C=t[41],C}function U(e){return e.language}var W=e(t(),1),de=12e3;function G(e){let t=(0,z.c)(106),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:l,attachmentBusy:u,attachmentsFull:d,voice:f,chat:p,cancelAction:m,onIntentChange:h,onPickFiles:g,onRemoveAttachment:_,onPaste:v,onDragOver:b,onDragLeave:x,onDrop:S,onSubmit:C}=e,T=n===`inline`,E;t[0]!==s||t[1]!==a?(E=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=E):E=t[2];let D=E,ee=f.voiceActive&&f.phase!==`error`,O;t[3]!==C||t[4]!==f.voiceActive?(O=e=>{if(f.voiceActive){e.preventDefault();return}C(e)},t[3]=C,t[4]=f.voiceActive,t[5]=O):O=t[5];let j=T?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,M;t[6]===j?M=t[7]:(M=c(`relative`,j),t[6]=j,t[7]=M);let N;t[8]!==T||t[9]!==l||t[10]!==o.dropFiles?(N=l?(0,B.jsx)(`div`,{className:c(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,T&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=T,t[9]=l,t[10]=o.dropFiles,t[11]=N):N=t[11];let P=!T&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,F;t[12]===P?F=t[13]:(F=c(P),t[12]=P,t[13]=F);let I=T?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,ne;t[14]!==r||t[15]!==o.intentLabel||t[16]!==I?(ne=(0,B.jsx)(`label`,{htmlFor:r,className:I,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=I,t[17]=ne):ne=t[17];let re;t[18]!==u||t[19]!==p||t[20]!==f.audioLevel||t[21]!==f.cancelVoiceInput||t[22]!==f.confirmVoiceInput||t[23]!==f.elapsedLabel||t[24]!==f.error||t[25]!==f.finalTranscript||t[26]!==f.partialTranscript||t[27]!==f.phase||t[28]!==f.retryVoiceInput||t[29]!==f.settingsRequired||t[30]!==f.voiceActive?(re=f.voiceActive?(0,B.jsx)(te,{phase:f.phase,elapsedLabel:f.elapsedLabel,audioLevel:f.audioLevel,partialTranscript:f.partialTranscript,finalTranscript:f.finalTranscript,error:f.error,settingsRequired:f.settingsRequired,disabled:u,chat:p,onCancel:f.cancelVoiceInput,onConfirm:f.confirmVoiceInput,onRetry:f.retryVoiceInput}):null,t[18]=u,t[19]=p,t[20]=f.audioLevel,t[21]=f.cancelVoiceInput,t[22]=f.confirmVoiceInput,t[23]=f.elapsedLabel,t[24]=f.error,t[25]=f.finalTranscript,t[26]=f.partialTranscript,t[27]=f.phase,t[28]=f.retryVoiceInput,t[29]=f.settingsRequired,t[30]=f.voiceActive,t[31]=re):re=t[31];let ae=ee&&`hidden`,L=T?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,oe;t[32]!==ae||t[33]!==L?(oe=c(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,ae,L),t[32]=ae,t[33]=L,t[34]=oe):oe=t[34];let R;t[35]===h?R=t[36]:(R=e=>h(e.target.value),t[35]=h,t[36]=R);let se=!T,V;t[37]!==r||t[38]!==i||t[39]!==a||t[40]!==o.intentPlaceholder||t[41]!==o.intentSuggestion||t[42]!==h||t[43]!==v||t[44]!==oe||t[45]!==R||t[46]!==se?(V=(0,B.jsx)(ce,{ref:i,id:r,className:oe,value:a,onChange:R,onPaste:v,suggestion:o.intentSuggestion,onAcceptSuggestion:h,onKeyDown:fe,placeholder:o.intentPlaceholder,maxLength:de,autoFocus:se}),t[37]=r,t[38]=i,t[39]=a,t[40]=o.intentPlaceholder,t[41]=o.intentSuggestion,t[42]=h,t[43]=v,t[44]=oe,t[45]=R,t[46]=se,t[47]=V):V=t[47];let le=T?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,H;t[48]!==s||t[49]!==_||t[50]!==le?(H=(0,B.jsx)(A,{attachments:s,topPadded:!1,onRemove:_,className:le}),t[48]=s,t[49]=_,t[50]=le,t[51]=H):H=t[51];let ue;t[52]!==T||t[53]!==a.length||t[54]!==o.shortcut?(ue=T?null:(0,B.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,B.jsx)(`span`,{children:o.shortcut}),(0,B.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,de.toLocaleString()]})]}),t[52]=T,t[53]=a.length,t[54]=o.shortcut,t[55]=ue):ue=t[55];let U;t[56]!==re||t[57]!==V||t[58]!==H||t[59]!==ue||t[60]!==F||t[61]!==ne?(U=(0,B.jsxs)(`div`,{className:F,children:[ne,re,V,H,ue]}),t[56]=re,t[57]=V,t[58]=H,t[59]=ue,t[60]=F,t[61]=ne,t[62]=U):U=t[62];let W=T?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,G;t[63]===W?G=t[64]:(G=c(`flex shrink-0 items-center gap-2 border-t`,W),t[63]=W,t[64]=G);let K=!T&&`mr-auto`,pe;t[65]===K?pe=t[66]:(pe=c(`flex items-center gap-1`,K),t[65]=K,t[66]=pe);let me=u||d,he;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,B.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[67]=he):he=t[67];let q;t[68]!==o.attachTitle||t[69]!==g||t[70]!==me?(q=(0,B.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:me,title:o.attachTitle,"aria-label":o.attachTitle,onClick:g,children:he}),t[68]=o.attachTitle,t[69]=g,t[70]=me,t[71]=q):q=t[71];let J;t[72]!==u||t[73]!==p||t[74]!==f.startVoiceInput||t[75]!==f.voiceActive?(J=f.voiceActive?null:(0,B.jsx)(ie,{disabled:u,chat:p,onStart:f.startVoiceInput}),t[72]=u,t[73]=p,t[74]=f.startVoiceInput,t[75]=f.voiceActive,t[76]=J):J=t[76];let Y;t[77]!==pe||t[78]!==q||t[79]!==J?(Y=(0,B.jsxs)(`div`,{className:pe,children:[q,J]}),t[77]=pe,t[78]=q,t[79]=J,t[80]=Y):Y=t[80];let X;t[81]!==m||t[82]!==T||t[83]!==o.shortcut?(X=T?(0,B.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):m,t[81]=m,t[82]=T,t[83]=o.shortcut,t[84]=X):X=t[84];let ge=T?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,Z=!D||u||f.voiceActive,Q=T?`size-3.5`:`size-4`,$;t[85]===Q?$=t[86]:($=(0,B.jsx)(k,{className:Q,"aria-hidden":!0}),t[85]=Q,t[86]=$);let _e;t[87]!==o.submit||t[88]!==ge||t[89]!==Z||t[90]!==$?(_e=(0,B.jsxs)(y,{type:`submit`,variant:`primary`,className:ge,disabled:Z,children:[$,o.submit]}),t[87]=o.submit,t[88]=ge,t[89]=Z,t[90]=$,t[91]=_e):_e=t[91];let ve;t[92]!==G||t[93]!==Y||t[94]!==X||t[95]!==_e?(ve=(0,B.jsxs)(`div`,{className:G,children:[Y,X,_e]}),t[92]=G,t[93]=Y,t[94]=X,t[95]=_e,t[96]=ve):ve=t[96];let ye;return t[97]!==x||t[98]!==b||t[99]!==S||t[100]!==O||t[101]!==U||t[102]!==ve||t[103]!==M||t[104]!==N?(ye=(0,B.jsxs)(`form`,{onSubmit:O,onDragOver:b,onDragLeave:x,onDrop:S,className:M,children:[N,U,ve]}),t[97]=x,t[98]=b,t[99]=S,t[100]=O,t[101]=U,t[102]=ve,t[103]=M,t[104]=N,t[105]=ye):ye=t[105],ye}function fe(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function K(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function pe(){let e=(0,z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,B.jsxs)(`div`,{className:`space-y-8`,"aria-busy":!0,children:[(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(b,{className:`h-10 w-3/5 rounded-xl`}),(0,B.jsx)(b,{className:`h-5 w-4/5 rounded-lg`})]}),(0,B.jsx)(b,{className:`h-64 rounded-2xl`}),(0,B.jsx)(b,{className:`h-32 rounded-xl`})]}),e[0]=t):t=e[0],t}function me(e){let t=(0,z.c)(33),{item:n,busy:r,recommendationLabel:i,dueLabel:a,failureLabel:o,locale:s,onAction:c}=e,l;t[0]!==a||t[1]!==n.dueAt||t[2]!==s?(l=n.dueAt?`${a} ${x(new Date(n.dueAt),s)}`:null,t[0]=a,t[1]=n.dueAt,t[2]=s,t[3]=l):l=t[3];let u=l,d=n.kind===`failure`?o:u,f;t[4]===d?f=t[5]:(f=d?(0,B.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-warning`,children:[(0,B.jsx)(`span`,{className:`size-1.5 rounded-full bg-warning`,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:d})]}):null,t[4]=d,t[5]=f);let p=!n.openAction,m;t[6]!==n.id||t[7]!==n.openAction||t[8]!==c?(m=()=>n.openAction&&c(n.openAction,n.id),t[6]=n.id,t[7]=n.openAction,t[8]=c,t[9]=m):m=t[9];let h;t[10]===n.title?h=t[11]:(h=(0,B.jsx)(`span`,{className:`block text-lg font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[10]=n.title,t[11]=h);let g;t[12]===n.summary?g=t[13]:(g=(0,B.jsx)(`span`,{className:`mt-1.5 block text-sm leading-6 text-fg-muted`,children:n.summary}),t[12]=n.summary,t[13]=g);let _;t[14]!==p||t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,B.jsxs)(`button`,{type:`button`,className:`block w-full text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:p,onClick:m,children:[h,g]}),t[14]=p,t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;t[19]!==n.recommendation||t[20]!==i?(v=n.recommendation?(0,B.jsxs)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:[(0,B.jsxs)(`span`,{className:`font-semibold text-fg`,children:[i,`:`]}),n.recommendation]}):null,t[19]=n.recommendation,t[20]=i,t[21]=v):v=t[21];let b;t[22]!==r||t[23]!==n.id||t[24]!==n.primaryAction||t[25]!==n.secondaryActions||t[26]!==c?(b=n.primaryAction||n.secondaryActions.length>0?(0,B.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[n.primaryAction?(0,B.jsx)(y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3.5 text-xs`,disabled:r,onClick:()=>c(n.primaryAction,n.id),children:n.primaryAction.label}):null,n.secondaryActions.map(e=>(0,B.jsx)(y,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3.5 text-xs shadow-none`,disabled:r,onClick:()=>c(e,n.id),children:e.label},`${e.type}:${e.label}`))]}):null,t[22]=r,t[23]=n.id,t[24]=n.primaryAction,t[25]=n.secondaryActions,t[26]=c,t[27]=b):b=t[27];let S;return t[28]!==f||t[29]!==_||t[30]!==v||t[31]!==b?(S=(0,B.jsxs)(`article`,{className:`px-5 py-5 sm:px-6 sm:py-6`,children:[f,_,v,b]}),t[28]=f,t[29]=_,t[30]=v,t[31]=b,t[32]=S):S=t[32],S}function he(e){let t=(0,z.c)(26),{item:n,onAction:r}=e,i;t[0]===n.kind?i=t[1]:(i=n.kind===`scheduled`?(0,B.jsx)(D,{className:`size-4`,"aria-hidden":!0}):(0,B.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`,"aria-hidden":!0}),t[0]=n.kind,t[1]=i);let a=i,o=!n.openAction,s;t[2]!==n.id||t[3]!==n.openAction||t[4]!==r?(s=()=>n.openAction&&r(n.openAction,n.id),t[2]=n.id,t[3]=n.openAction,t[4]=r,t[5]=s):s=t[5];let c;t[6]===a?c=t[7]:(c=(0,B.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-fg-subtle`,children:a}),t[6]=a,t[7]=c);let l;t[8]===n.title?l=t[9]:(l=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.title}),t[8]=n.title,t[9]=l);let u;t[10]===n.summary?u=t[11]:(u=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.summary}),t[10]=n.summary,t[11]=u);let d;t[12]!==l||t[13]!==u?(d=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f;t[15]===n.statusLabel?f=t[16]:(f=n.statusLabel?(0,B.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.statusLabel}):null,t[15]=n.statusLabel,t[16]=f);let p;t[17]===n.openAction?p=t[18]:(p=n.openAction?(0,B.jsx)(L,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[17]=n.openAction,t[18]=p);let m;return t[19]!==o||t[20]!==s||t[21]!==c||t[22]!==d||t[23]!==f||t[24]!==p?(m=(0,B.jsxs)(`button`,{type:`button`,className:`flex min-h-16 w-full items-center gap-3 py-3 text-left outline-none hover:text-fg focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:o,onClick:s,children:[c,d,f,p]}),t[19]=o,t[20]=s,t[21]=c,t[22]=d,t[23]=f,t[24]=p,t[25]=m):m=t[25],m}function q(){let e=l(e=>e.language),t=u(e),n=t.projectsPage,r=C(e),a=i(),c=F(e=>e.setPageHeader),b=F(e=>e.clearPageHeader),[x,w]=(0,W.useState)(null),[D,k]=(0,W.useState)(!0),[A,M]=(0,W.useState)(null),[te,ie]=(0,W.useState)(!1),[L,R]=(0,W.useState)(``),[ce,z]=(0,W.useState)(null),[V,le]=(0,W.useState)(!1),H=j({chat:t.chat}),U=(0,W.useRef)(null),de=T({disabled:V,chat:t.chat,onTranscript:e=>{R(t=>re(t,e)),window.setTimeout(()=>U.current?.focus(),0)}}),{phase:fe,voiceActive:q,startVoiceInput:J,cancelVoiceInput:Y,confirmVoiceInput:X,retryVoiceInput:ge}=de,Z=(0,W.useCallback)(async(t=!1)=>{t&&k(!0),M(null);try{let t=await oe(e);w({...t,needsUser:t.needsUser.filter(e=>e.primaryAction?.type!==`review_judgment`&&e.openAction?.type!==`review_judgment`),background:t.background.filter(e=>e.primaryAction?.type!==`review_judgment`&&e.openAction?.type!==`review_judgment`)})}catch(e){M(e instanceof Error?e.message:String(e))}finally{k(!1)}},[e]);(0,W.useEffect)(()=>{Z(!0)},[Z]),(0,W.useEffect)(()=>{let e,t=t=>{e!==void 0&&window.clearTimeout(e),e=window.setTimeout(()=>{e=void 0,Z()},t)},n=()=>t(100),r=()=>t(750),i=[`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`workflow-run-updated`,`workflow-run-error`],a=[`session-updated`,`session-transcript-updated`];return i.forEach(e=>window.addEventListener(e,n)),a.forEach(e=>window.addEventListener(e,r)),()=>{i.forEach(e=>window.removeEventListener(e,n)),a.forEach(e=>window.removeEventListener(e,r)),e!==void 0&&window.clearTimeout(e)}},[Z]);let Q=(0,W.useCallback)(async e=>{if(!(e.length===0||V)){le(!0);try{await H.processFiles(e)}finally{le(!1)}}},[V,H.processFiles]),$=(0,W.useCallback)(async e=>{let t=N(e.clipboardData);t.length!==0&&(e.preventDefault(),await Q(t))},[Q]),_e=(0,W.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,H.setIsDragging(!0))},[H.setIsDragging]),ve=(0,W.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&H.setIsDragging(!1)},[H.setIsDragging]),ye=(0,W.useCallback)(async e=>{e.preventDefault(),H.setIsDragging(!1),await Q(Array.from(e.dataTransfer.files))},[H.setIsDragging,Q]),be=(0,W.useCallback)(e=>{e.preventDefault();let t=H.wireAttachmentsPayload(),n=I(L,t.length>0?ne(t):void 0,{projectScope:`none`});n&&(ie(!1),R(``),H.clearAttachments(),a(n))},[H.clearAttachments,H.wireAttachmentsPayload,L,a]),xe=H.attachments.length>=10,Se={attachTitle:xe?K(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${H.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},Ce=v(`/api/proactive/overview`,se,{refreshInterval:15e3}),we=!!Ce.data?.scenes.some(e=>e.status===`prepared`),Te=!!Ce.data?.scenes.some(e=>e.status===`changed`),Ee=!!Ce.data?.scenes.some(e=>e.status===`following`),De=!!Ce.data?.scenes.length,Oe=!!(x&&x.needsUser.length===0&&x.backgroundCount===0&&Ce.data&&!De),ke=Oe||te;(0,W.useEffect)(()=>{!ke&&q&&Y()},[Y,ke,q]),(0,W.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!ke||V||(e.preventDefault(),fe===`recording`?X():fe===`idle`?(U.current?.focus(),J()):fe===`error`&&ge())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!ke||!q||(e.preventDefault(),Y(),U.current?.focus())};return window.addEventListener(O,e),window.addEventListener(P,t),()=>{window.removeEventListener(O,e),window.removeEventListener(P,t)}},[V,Y,ke,X,ge,J,q,fe]);let Ae=(0,W.useCallback)(e=>{e||Y(),ie(e)},[Y]),je=(0,W.useMemo)(()=>Oe?null:(0,B.jsxs)(y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>ie(!0),children:[(0,B.jsx)(o,{className:`size-4`,"aria-hidden":!0}),r.newWork]}),[r.newWork,Oe]),Me=(0,W.useCallback)((e,t)=>{if(e.type===`open`){a(e.href);return}if(e.type===`review_judgment`){a(`/assistant-work?item=${encodeURIComponent(e.itemId)}`);return}z(t),M(null),(async()=>{try{e.type===`connector_decision`?await S({kind:`connector_approval`,approvalId:e.approvalId},e.decision):e.type===`retry_run`?await E({kind:e.subjectKind,runId:e.runId}):e.type===`acknowledge_run`&&await ae({kind:e.subjectKind,runId:e.runId}),await Z()}catch(e){M(e instanceof Error?e.message:String(e))}finally{z(null)}})()},[Z,a]);(0,W.useLayoutEffect)(()=>(c({startExtra:null,main:(0,B.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:je}),()=>b()),[b,je,c,n.title]);let Ne=(x?.needsUser.length??0)+(Ce.data?.scenes.filter(e=>e.status===`needs_decision`).length??0),Pe=x?.backgroundCount??0,Fe=Ne>0?K(n.home.attentionTitle,{count:Ne}):we?e===`zh`?`助理准备好了这些`:`Your assistant prepared these`:Te?e===`zh`?`有一些值得知道的变化`:`A few changes are worth knowing`:Pe>0?n.home.clearTitle:Ee?e===`zh`?`助理在跟进你交代的事`:`Your assistant is following through`:Ce.data?n.home.idleTitle:e===`zh`?`今天的工作`:`Your work today`,Ie=Ne>0?Pe>0?K(n.home.attentionIntroWithBackground,{count:Pe}):n.home.attentionIntro:we?e===`zh`?`成果已经整理好,可以直接查看或继续办理。`:`The results are ready to review or continue.`:Te?e===`zh`?`这里是可能影响你当前工作的最新变化。`:`These changes may affect your current work.`:Pe>0?K(n.home.clearIntro,{count:Pe}):Ee?e===`zh`?`助理记着这些事项,有实质进展时会带回来。`:`Your assistant remembers these items and will bring back useful progress.`:Ce.data?n.home.idleIntro:e===`zh`?`正在核对已交代的事项。`:`Checking your delegated work.`;return(0,B.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[920px] flex-1 flex-col px-4 py-8 sm:px-6 lg:px-8 lg:py-12`,children:[(0,B.jsx)(`input`,{ref:H.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&Q(Array.from(t)),e.target.value=``}}),(0,B.jsx)(_,{open:te,onOpenChange:Ae,children:(0,B.jsxs)(m,{children:[(0,B.jsx)(d,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,B.jsxs)(h,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,B.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(g,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,B.jsx)(f,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,B.jsx)(p,{asChild:!0,children:(0,B.jsx)(y,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,B.jsx)(s,{className:`size-4`,"aria-hidden":!0})})})]}),(0,B.jsx)(G,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:U,intent:L,labels:{...Se,submit:r.submit},attachments:H.attachments,isDragging:H.isDragging,attachmentBusy:V,attachmentsFull:xe,voice:de,chat:t.chat,cancelAction:(0,B.jsx)(p,{asChild:!0,children:(0,B.jsx)(y,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:R,onPickFiles:()=>H.fileInputRef.current?.click(),onRemoveAttachment:H.removeAttachment,onPaste:e=>void $(e),onDragOver:_e,onDragLeave:ve,onDrop:e=>void ye(e),onSubmit:be})]})]})}),A?(0,B.jsxs)(`div`,{className:`mb-6 flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,B.jsx)(`span`,{children:A}),(0,B.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Z(),children:n.home.retry})]}):null,D?(0,B.jsx)(pe,{}):x?(0,B.jsxs)(`div`,{className:Oe?`mx-auto my-auto w-full max-w-[640px]`:`w-full`,children:[(0,B.jsxs)(`section`,{className:Oe?`w-full text-center`:`max-w-3xl`,children:[(0,B.jsx)(`h2`,{className:`text-3xl font-semibold leading-tight tracking-[-0.035em] text-fg sm:text-4xl`,children:Fe}),(0,B.jsx)(`p`,{className:Oe?`mx-auto mt-3 max-w-xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`:`mt-3 max-w-2xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`,children:Ie}),Oe?(0,B.jsx)(G,{variant:`inline`,inputId:`idle-conversation-intent`,inputRef:U,intent:L,labels:Se,attachments:H.attachments,isDragging:H.isDragging,attachmentBusy:V,attachmentsFull:xe,voice:de,chat:t.chat,onIntentChange:R,onPickFiles:()=>H.fileInputRef.current?.click(),onRemoveAttachment:H.removeAttachment,onPaste:e=>void $(e),onDragOver:_e,onDragLeave:ve,onDrop:e=>void ye(e),onSubmit:be}):null]}),x.needsUser.length>0?(0,B.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-needs-user-title`,children:[(0,B.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 px-1`,children:[(0,B.jsx)(ee,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,B.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-sm font-semibold text-fg`,children:n.home.needsUserTitle})]}),(0,B.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:x.needsUser.map(t=>(0,B.jsx)(me,{item:t,busy:ce===t.id,recommendationLabel:n.home.recommendationLabel,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:Me},t.id))})]}):null,(0,B.jsx)(`section`,{className:Oe?`mt-6 sm:mt-8`:`mt-10`,children:(0,B.jsx)(ue,{compact:!0})}),x.background.length>0?(0,B.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-background-title`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,B.jsx)(`h2`,{id:`home-background-title`,className:`text-sm font-semibold text-fg`,children:n.home.backgroundTitle}),(0,B.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:K(n.home.backgroundCount,{count:x.backgroundCount})})]}),(0,B.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle border-y border-edge-subtle`,children:x.background.map(e=>(0,B.jsx)(he,{item:e,onAction:Me},e.id))})]}):null]}):null]})}export{q as HomePage};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,t as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as o}from"./plus-Q2yW6OE7.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./cn-JdwAhgNB.js";import{n as l}from"./locale-store-D0001I7p.js";import{t as u}from"./messages-BWANv-N-.js";import{a as d,i as f,n as p,o as m,r as h,s as g,t as _}from"./dist-BGTk37IG.js";import{i as v}from"./vendor-swr-BIWyz7Rc.js";import{t as y}from"./button-CGlRPNzi.js";import{t as b}from"./skeleton-BwbyijEw.js";import{Br as x,Ds as S,Fs as C,Hc as w,No as T,Os as E,Su as D,_u as ee,an as O,dc as k,di as A,ei as j,el as M,fi as N,in as P,mo as F,oa as I,on as te,r as ne,sn as re,ti as ie,vs as ae,vu as L,ws as oe,zl as R}from"./index-fVtuw2o9.js";import{t as se}from"./api-q1kIMCLW.js";import{n as ce}from"./tab-completion-input-D64VNmiA.js";var z=n(),B=r(),V={meeting_preparation:{Icon:D,en:`Next meeting`,zh:`下一场会议`},project_momentum:{Icon:R,en:`Project momentum`,zh:`项目进展`},communication_follow_up:{Icon:M,en:`Waiting on a reply`,zh:`沟通跟进`}},le={needs_decision:{en:`Needs your decision`,zh:`需要你决定`},prepared:{en:`Ready for you`,zh:`已为你准备好`},changed:{en:`Something changed`,zh:`出现了新变化`},following:{en:`Following quietly`,zh:`正在安静跟进`}};function H(e){let t=(0,z.c)(56),{scene:n,zh:r}=e,i=V[n.kind],o=le[n.status],s=n.card?`/assistant-work?item=${encodeURIComponent(n.card.id)}`:n.object?.route??n.manageRoute,c=n.status===`needs_decision`?r?`查看并决定`:`Review and decide`:n.status===`prepared`?r?`查看准备结果`:`Open prepared work`:n.status===`changed`?r?`查看变化`:`Review change`:n.object?r?`打开${n.kind===`project_momentum`?`项目`:`相关内容`}`:`Open context`:r?`查看安排`:`View arrangement`,l;t[0]===i.Icon?l=t[1]:(l=(0,B.jsx)(`span`,{className:`mt-0.5 rounded-xl bg-accent-soft p-2 text-accent`,children:(0,B.jsx)(i.Icon,{className:`size-4`,"aria-hidden":!0})}),t[0]=i.Icon,t[1]=l);let u=r?i.zh:i.en,d;t[2]===u?d=t[3]:(d=(0,B.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:u}),t[2]=u,t[3]=d);let f=n.status===`following`?`text-xs text-fg-subtle`:`text-xs font-medium text-accent`,p=r?o.zh:o.en,m;t[4]!==f||t[5]!==p?(m=(0,B.jsx)(`span`,{className:f,children:p}),t[4]=f,t[5]=p,t[6]=m):m=t[6];let h;t[7]!==d||t[8]!==m?(h=(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[d,m]}),t[7]=d,t[8]=m,t[9]=h):h=t[9];let g;t[10]===n.title?g=t[11]:(g=(0,B.jsx)(`h3`,{className:`mt-1 font-semibold text-fg`,children:n.title}),t[10]=n.title,t[11]=g);let _;t[12]!==h||t[13]!==g?(_=(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[h,g]}),t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]!==l||t[16]!==_?(v=(0,B.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-5 py-4`,children:[l,_]}),t[15]=l,t[16]=_,t[17]=v):v=t[17];let y=r?`现在`:`Now`,b;t[18]===y?b=t[19]:(b=(0,B.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:y}),t[18]=y,t[19]=b);let x;t[20]===n.moment?x=t[21]:(x=(0,B.jsx)(`p`,{className:`mt-1 text-sm font-medium text-fg`,children:n.moment}),t[20]=n.moment,t[21]=x);let S;t[22]!==b||t[23]!==x?(S=(0,B.jsxs)(`div`,{children:[b,x]}),t[22]=b,t[23]=x,t[24]=S):S=t[24];let C=n.status===`following`?r?`跟进要求`:`What the assistant remembers`:r?`为什么值得关注`:`Why it matters`,w;t[25]===C?w=t[26]:(w=(0,B.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:C}),t[25]=C,t[26]=w);let T=n.status===`following`?n.promise:n.relevance,E;t[27]===T?E=t[28]:(E=(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:T}),t[27]=T,t[28]=E);let D;t[29]!==w||t[30]!==E?(D=(0,B.jsxs)(`div`,{children:[w,E]}),t[29]=w,t[30]=E,t[31]=D):D=t[31];let ee=r?`助理已经做了什么`:`What your assistant did`,O;t[32]===ee?O=t[33]:(O=(0,B.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:ee}),t[32]=ee,t[33]=O);let k;t[34]===n.help?k=t[35]:(k=(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:n.help}),t[34]=n.help,t[35]=k);let A;t[36]!==O||t[37]!==k?(A=(0,B.jsxs)(`div`,{className:`rounded-xl bg-surface-hover px-4 py-3`,children:[O,k]}),t[36]=O,t[37]=k,t[38]=A):A=t[38];let j;t[39]!==c||t[40]!==s?(j=(0,B.jsx)(a,{className:`text-sm font-medium text-accent`,to:s,children:c}),t[39]=c,t[40]=s,t[41]=j):j=t[41];let M=r?`调整助理跟进`:`Adjust arrangement`,N;t[42]!==n.manageRoute||t[43]!==M?(N=(0,B.jsx)(a,{className:`text-xs text-fg-subtle hover:text-fg`,to:n.manageRoute,children:M}),t[42]=n.manageRoute,t[43]=M,t[44]=N):N=t[44];let P;t[45]!==j||t[46]!==N?(P=(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[j,N]}),t[45]=j,t[46]=N,t[47]=P):P=t[47];let F;t[48]!==S||t[49]!==D||t[50]!==A||t[51]!==P?(F=(0,B.jsxs)(`div`,{className:`space-y-4 px-5 py-4`,children:[S,D,A,P]}),t[48]=S,t[49]=D,t[50]=A,t[51]=P,t[52]=F):F=t[52];let I;return t[53]!==v||t[54]!==F?(I=(0,B.jsxs)(`article`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:[v,F]}),t[53]=v,t[54]=F,t[55]=I):I=t[55],I}function ue(e){let t=(0,z.c)(42),{compact:n}=e,r=n===void 0?!1:n,i=l(U)===`zh`,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={refreshInterval:15e3},t[0]=o):o=t[0];let s=v(`/api/proactive/overview`,se,o);if(s.isLoading){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,B.jsx)(b,{className:`h-44 rounded-2xl`}),t[1]=e):e=t[1],e}if(s.error){let e=String(s.error),n;return t[2]===e?n=t[3]:(n=(0,B.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:e}),t[2]=e,t[3]=n),n}let c;t[4]===s.data?.scenes?c=t[5]:(c=s.data?.scenes??[],t[4]=s.data?.scenes,t[5]=c);let u=c;if(!u.length){let e=r?`px-4 text-center`:`rounded-2xl border border-edge bg-surface-panel p-6`,n=r?`text-sm font-medium text-fg-muted`:`font-medium text-fg`,a=i?`今天没有需要你接手的变化`:`Nothing needs your attention today`,o;t[6]!==n||t[7]!==a?(o=(0,B.jsx)(`h2`,{className:n,children:a}),t[6]=n,t[7]=a,t[8]=o):o=t[8];let s=r?`mx-auto mt-2 max-w-lg text-xs leading-5 text-fg-subtle`:`mt-2 text-sm text-fg-muted`,c=i?`继续工作即可。需要持续关注的事,可以直接在项目或对话里交给助理。`:`Keep working. You can ask the assistant to follow something from its project or conversation.`,l;t[9]!==s||t[10]!==c?(l=(0,B.jsx)(`p`,{className:s,children:c}),t[9]=s,t[10]=c,t[11]=l):l=t[11];let u;return t[12]!==l||t[13]!==e||t[14]!==o?(u=(0,B.jsxs)(`section`,{className:e,children:[o,l]}),t[12]=l,t[13]=e,t[14]=o,t[15]=u):u=t[15],u}let d;t[16]!==r||t[17]!==u?(d=r?u.slice(0,3):u,t[16]=r,t[17]=u,t[18]=d):d=t[18];let f=d,p=i?`正在发生的事`:`What is happening`,m;t[19]===p?m=t[20]:(m=(0,B.jsx)(`h2`,{id:`proactive-scenes-title`,className:`text-sm font-semibold text-fg`,children:p}),t[19]=p,t[20]=m);let h=i?`助理跟进`:`Assistant follow-ups`,g;t[21]===h?g=t[22]:(g=(0,B.jsx)(a,{className:`text-xs text-fg-subtle hover:text-accent`,to:`/assistant-work`,children:h}),t[21]=h,t[22]=g);let _;t[23]!==m||t[24]!==g?(_=(0,B.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3 px-1`,children:[m,g]}),t[23]=m,t[24]=g,t[25]=_):_=t[25];let y;if(t[26]!==f||t[27]!==i){let e;t[29]===i?e=t[30]:(e=e=>(0,B.jsx)(H,{scene:e,zh:i},e.id),t[29]=i,t[30]=e),y=f.map(e),t[26]=f,t[27]=i,t[28]=y}else y=t[28];let x;t[31]===y?x=t[32]:(x=(0,B.jsx)(`div`,{className:`space-y-3`,children:y}),t[31]=y,t[32]=x);let S;t[33]!==r||t[34]!==u.length||t[35]!==f.length||t[36]!==i?(S=r&&u.length>f.length&&(0,B.jsx)(a,{className:`mt-3 block text-sm text-accent`,to:`/assistant-work`,children:i?`还有 ${u.length-f.length} 个场景`:`${u.length-f.length} more scenes`}),t[33]=r,t[34]=u.length,t[35]=f.length,t[36]=i,t[37]=S):S=t[37];let C;return t[38]!==x||t[39]!==S||t[40]!==_?(C=(0,B.jsxs)(`section`,{"aria-labelledby":`proactive-scenes-title`,children:[_,x,S]}),t[38]=x,t[39]=S,t[40]=_,t[41]=C):C=t[41],C}function U(e){return e.language}var W=e(t(),1),de=12e3;function G(e){let t=(0,z.c)(106),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:l,attachmentBusy:u,attachmentsFull:d,voice:f,chat:p,cancelAction:m,onIntentChange:h,onPickFiles:g,onRemoveAttachment:_,onPaste:v,onDragOver:b,onDragLeave:x,onDrop:S,onSubmit:C}=e,T=n===`inline`,E;t[0]!==s||t[1]!==a?(E=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=E):E=t[2];let D=E,ee=f.voiceActive&&f.phase!==`error`,O;t[3]!==C||t[4]!==f.voiceActive?(O=e=>{if(f.voiceActive){e.preventDefault();return}C(e)},t[3]=C,t[4]=f.voiceActive,t[5]=O):O=t[5];let j=T?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,M;t[6]===j?M=t[7]:(M=c(`relative`,j),t[6]=j,t[7]=M);let N;t[8]!==T||t[9]!==l||t[10]!==o.dropFiles?(N=l?(0,B.jsx)(`div`,{className:c(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,T&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=T,t[9]=l,t[10]=o.dropFiles,t[11]=N):N=t[11];let P=!T&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,F;t[12]===P?F=t[13]:(F=c(P),t[12]=P,t[13]=F);let I=T?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,ne;t[14]!==r||t[15]!==o.intentLabel||t[16]!==I?(ne=(0,B.jsx)(`label`,{htmlFor:r,className:I,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=I,t[17]=ne):ne=t[17];let re;t[18]!==u||t[19]!==p||t[20]!==f.audioLevel||t[21]!==f.cancelVoiceInput||t[22]!==f.confirmVoiceInput||t[23]!==f.elapsedLabel||t[24]!==f.error||t[25]!==f.finalTranscript||t[26]!==f.partialTranscript||t[27]!==f.phase||t[28]!==f.retryVoiceInput||t[29]!==f.settingsRequired||t[30]!==f.voiceActive?(re=f.voiceActive?(0,B.jsx)(te,{phase:f.phase,elapsedLabel:f.elapsedLabel,audioLevel:f.audioLevel,partialTranscript:f.partialTranscript,finalTranscript:f.finalTranscript,error:f.error,settingsRequired:f.settingsRequired,disabled:u,chat:p,onCancel:f.cancelVoiceInput,onConfirm:f.confirmVoiceInput,onRetry:f.retryVoiceInput}):null,t[18]=u,t[19]=p,t[20]=f.audioLevel,t[21]=f.cancelVoiceInput,t[22]=f.confirmVoiceInput,t[23]=f.elapsedLabel,t[24]=f.error,t[25]=f.finalTranscript,t[26]=f.partialTranscript,t[27]=f.phase,t[28]=f.retryVoiceInput,t[29]=f.settingsRequired,t[30]=f.voiceActive,t[31]=re):re=t[31];let ae=ee&&`hidden`,L=T?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,oe;t[32]!==ae||t[33]!==L?(oe=c(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,ae,L),t[32]=ae,t[33]=L,t[34]=oe):oe=t[34];let R;t[35]===h?R=t[36]:(R=e=>h(e.target.value),t[35]=h,t[36]=R);let se=!T,V;t[37]!==r||t[38]!==i||t[39]!==a||t[40]!==o.intentPlaceholder||t[41]!==o.intentSuggestion||t[42]!==h||t[43]!==v||t[44]!==oe||t[45]!==R||t[46]!==se?(V=(0,B.jsx)(ce,{ref:i,id:r,className:oe,value:a,onChange:R,onPaste:v,suggestion:o.intentSuggestion,onAcceptSuggestion:h,onKeyDown:fe,placeholder:o.intentPlaceholder,maxLength:de,autoFocus:se}),t[37]=r,t[38]=i,t[39]=a,t[40]=o.intentPlaceholder,t[41]=o.intentSuggestion,t[42]=h,t[43]=v,t[44]=oe,t[45]=R,t[46]=se,t[47]=V):V=t[47];let le=T?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,H;t[48]!==s||t[49]!==_||t[50]!==le?(H=(0,B.jsx)(A,{attachments:s,topPadded:!1,onRemove:_,className:le}),t[48]=s,t[49]=_,t[50]=le,t[51]=H):H=t[51];let ue;t[52]!==T||t[53]!==a.length||t[54]!==o.shortcut?(ue=T?null:(0,B.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,B.jsx)(`span`,{children:o.shortcut}),(0,B.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,de.toLocaleString()]})]}),t[52]=T,t[53]=a.length,t[54]=o.shortcut,t[55]=ue):ue=t[55];let U;t[56]!==re||t[57]!==V||t[58]!==H||t[59]!==ue||t[60]!==F||t[61]!==ne?(U=(0,B.jsxs)(`div`,{className:F,children:[ne,re,V,H,ue]}),t[56]=re,t[57]=V,t[58]=H,t[59]=ue,t[60]=F,t[61]=ne,t[62]=U):U=t[62];let W=T?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,G;t[63]===W?G=t[64]:(G=c(`flex shrink-0 items-center gap-2 border-t`,W),t[63]=W,t[64]=G);let K=!T&&`mr-auto`,pe;t[65]===K?pe=t[66]:(pe=c(`flex items-center gap-1`,K),t[65]=K,t[66]=pe);let me=u||d,he;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,B.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[67]=he):he=t[67];let q;t[68]!==o.attachTitle||t[69]!==g||t[70]!==me?(q=(0,B.jsx)(y,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:me,title:o.attachTitle,"aria-label":o.attachTitle,onClick:g,children:he}),t[68]=o.attachTitle,t[69]=g,t[70]=me,t[71]=q):q=t[71];let J;t[72]!==u||t[73]!==p||t[74]!==f.startVoiceInput||t[75]!==f.voiceActive?(J=f.voiceActive?null:(0,B.jsx)(ie,{disabled:u,chat:p,onStart:f.startVoiceInput}),t[72]=u,t[73]=p,t[74]=f.startVoiceInput,t[75]=f.voiceActive,t[76]=J):J=t[76];let Y;t[77]!==pe||t[78]!==q||t[79]!==J?(Y=(0,B.jsxs)(`div`,{className:pe,children:[q,J]}),t[77]=pe,t[78]=q,t[79]=J,t[80]=Y):Y=t[80];let X;t[81]!==m||t[82]!==T||t[83]!==o.shortcut?(X=T?(0,B.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):m,t[81]=m,t[82]=T,t[83]=o.shortcut,t[84]=X):X=t[84];let ge=T?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,Z=!D||u||f.voiceActive,Q=T?`size-3.5`:`size-4`,$;t[85]===Q?$=t[86]:($=(0,B.jsx)(k,{className:Q,"aria-hidden":!0}),t[85]=Q,t[86]=$);let _e;t[87]!==o.submit||t[88]!==ge||t[89]!==Z||t[90]!==$?(_e=(0,B.jsxs)(y,{type:`submit`,variant:`primary`,className:ge,disabled:Z,children:[$,o.submit]}),t[87]=o.submit,t[88]=ge,t[89]=Z,t[90]=$,t[91]=_e):_e=t[91];let ve;t[92]!==G||t[93]!==Y||t[94]!==X||t[95]!==_e?(ve=(0,B.jsxs)(`div`,{className:G,children:[Y,X,_e]}),t[92]=G,t[93]=Y,t[94]=X,t[95]=_e,t[96]=ve):ve=t[96];let ye;return t[97]!==x||t[98]!==b||t[99]!==S||t[100]!==O||t[101]!==U||t[102]!==ve||t[103]!==M||t[104]!==N?(ye=(0,B.jsxs)(`form`,{onSubmit:O,onDragOver:b,onDragLeave:x,onDrop:S,className:M,children:[N,U,ve]}),t[97]=x,t[98]=b,t[99]=S,t[100]=O,t[101]=U,t[102]=ve,t[103]=M,t[104]=N,t[105]=ye):ye=t[105],ye}function fe(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function K(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function pe(){let e=(0,z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,B.jsxs)(`div`,{className:`space-y-8`,"aria-busy":!0,children:[(0,B.jsxs)(`div`,{className:`space-y-3`,children:[(0,B.jsx)(b,{className:`h-10 w-3/5 rounded-xl`}),(0,B.jsx)(b,{className:`h-5 w-4/5 rounded-lg`})]}),(0,B.jsx)(b,{className:`h-64 rounded-2xl`}),(0,B.jsx)(b,{className:`h-32 rounded-xl`})]}),e[0]=t):t=e[0],t}function me(e){let t=(0,z.c)(33),{item:n,busy:r,recommendationLabel:i,dueLabel:a,failureLabel:o,locale:s,onAction:c}=e,l;t[0]!==a||t[1]!==n.dueAt||t[2]!==s?(l=n.dueAt?`${a} ${x(new Date(n.dueAt),s)}`:null,t[0]=a,t[1]=n.dueAt,t[2]=s,t[3]=l):l=t[3];let u=l,d=n.kind===`failure`?o:u,f;t[4]===d?f=t[5]:(f=d?(0,B.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-warning`,children:[(0,B.jsx)(`span`,{className:`size-1.5 rounded-full bg-warning`,"aria-hidden":!0}),(0,B.jsx)(`span`,{children:d})]}):null,t[4]=d,t[5]=f);let p=!n.openAction,m;t[6]!==n.id||t[7]!==n.openAction||t[8]!==c?(m=()=>n.openAction&&c(n.openAction,n.id),t[6]=n.id,t[7]=n.openAction,t[8]=c,t[9]=m):m=t[9];let h;t[10]===n.title?h=t[11]:(h=(0,B.jsx)(`span`,{className:`block text-lg font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[10]=n.title,t[11]=h);let g;t[12]===n.summary?g=t[13]:(g=(0,B.jsx)(`span`,{className:`mt-1.5 block text-sm leading-6 text-fg-muted`,children:n.summary}),t[12]=n.summary,t[13]=g);let _;t[14]!==p||t[15]!==m||t[16]!==h||t[17]!==g?(_=(0,B.jsxs)(`button`,{type:`button`,className:`block w-full text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:p,onClick:m,children:[h,g]}),t[14]=p,t[15]=m,t[16]=h,t[17]=g,t[18]=_):_=t[18];let v;t[19]!==n.recommendation||t[20]!==i?(v=n.recommendation?(0,B.jsxs)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:[(0,B.jsxs)(`span`,{className:`font-semibold text-fg`,children:[i,`:`]}),n.recommendation]}):null,t[19]=n.recommendation,t[20]=i,t[21]=v):v=t[21];let b;t[22]!==r||t[23]!==n.id||t[24]!==n.primaryAction||t[25]!==n.secondaryActions||t[26]!==c?(b=n.primaryAction||n.secondaryActions.length>0?(0,B.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[n.primaryAction?(0,B.jsx)(y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3.5 text-xs`,disabled:r,onClick:()=>c(n.primaryAction,n.id),children:n.primaryAction.label}):null,n.secondaryActions.map(e=>(0,B.jsx)(y,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3.5 text-xs shadow-none`,disabled:r,onClick:()=>c(e,n.id),children:e.label},`${e.type}:${e.label}`))]}):null,t[22]=r,t[23]=n.id,t[24]=n.primaryAction,t[25]=n.secondaryActions,t[26]=c,t[27]=b):b=t[27];let S;return t[28]!==f||t[29]!==_||t[30]!==v||t[31]!==b?(S=(0,B.jsxs)(`article`,{className:`px-5 py-5 sm:px-6 sm:py-6`,children:[f,_,v,b]}),t[28]=f,t[29]=_,t[30]=v,t[31]=b,t[32]=S):S=t[32],S}function he(e){let t=(0,z.c)(26),{item:n,onAction:r}=e,i;t[0]===n.kind?i=t[1]:(i=n.kind===`scheduled`?(0,B.jsx)(D,{className:`size-4`,"aria-hidden":!0}):(0,B.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`,"aria-hidden":!0}),t[0]=n.kind,t[1]=i);let a=i,o=!n.openAction,s;t[2]!==n.id||t[3]!==n.openAction||t[4]!==r?(s=()=>n.openAction&&r(n.openAction,n.id),t[2]=n.id,t[3]=n.openAction,t[4]=r,t[5]=s):s=t[5];let c;t[6]===a?c=t[7]:(c=(0,B.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-fg-subtle`,children:a}),t[6]=a,t[7]=c);let l;t[8]===n.title?l=t[9]:(l=(0,B.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.title}),t[8]=n.title,t[9]=l);let u;t[10]===n.summary?u=t[11]:(u=(0,B.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.summary}),t[10]=n.summary,t[11]=u);let d;t[12]!==l||t[13]!==u?(d=(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[l,u]}),t[12]=l,t[13]=u,t[14]=d):d=t[14];let f;t[15]===n.statusLabel?f=t[16]:(f=n.statusLabel?(0,B.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.statusLabel}):null,t[15]=n.statusLabel,t[16]=f);let p;t[17]===n.openAction?p=t[18]:(p=n.openAction?(0,B.jsx)(L,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[17]=n.openAction,t[18]=p);let m;return t[19]!==o||t[20]!==s||t[21]!==c||t[22]!==d||t[23]!==f||t[24]!==p?(m=(0,B.jsxs)(`button`,{type:`button`,className:`flex min-h-16 w-full items-center gap-3 py-3 text-left outline-none hover:text-fg focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:o,onClick:s,children:[c,d,f,p]}),t[19]=o,t[20]=s,t[21]=c,t[22]=d,t[23]=f,t[24]=p,t[25]=m):m=t[25],m}function q(){let e=l(e=>e.language),t=u(e),n=t.projectsPage,r=C(e),a=i(),c=F(e=>e.setPageHeader),b=F(e=>e.clearPageHeader),[x,w]=(0,W.useState)(null),[D,k]=(0,W.useState)(!0),[A,M]=(0,W.useState)(null),[te,ie]=(0,W.useState)(!1),[L,R]=(0,W.useState)(``),[ce,z]=(0,W.useState)(null),[V,le]=(0,W.useState)(!1),H=j({chat:t.chat}),U=(0,W.useRef)(null),de=T({disabled:V,chat:t.chat,onTranscript:e=>{R(t=>re(t,e)),window.setTimeout(()=>U.current?.focus(),0)}}),{phase:fe,voiceActive:q,startVoiceInput:J,cancelVoiceInput:Y,confirmVoiceInput:X,retryVoiceInput:ge}=de,Z=(0,W.useCallback)(async(t=!1)=>{t&&k(!0),M(null);try{let t=await oe(e);w({...t,needsUser:t.needsUser.filter(e=>e.primaryAction?.type!==`review_judgment`&&e.openAction?.type!==`review_judgment`),background:t.background.filter(e=>e.primaryAction?.type!==`review_judgment`&&e.openAction?.type!==`review_judgment`)})}catch(e){M(e instanceof Error?e.message:String(e))}finally{k(!1)}},[e]);(0,W.useEffect)(()=>{Z(!0)},[Z]),(0,W.useEffect)(()=>{let e,t=t=>{e!==void 0&&window.clearTimeout(e),e=window.setTimeout(()=>{e=void 0,Z()},t)},n=()=>t(100),r=()=>t(750),i=[`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`workflow-run-updated`,`workflow-run-error`],a=[`session-updated`,`session-transcript-updated`];return i.forEach(e=>window.addEventListener(e,n)),a.forEach(e=>window.addEventListener(e,r)),()=>{i.forEach(e=>window.removeEventListener(e,n)),a.forEach(e=>window.removeEventListener(e,r)),e!==void 0&&window.clearTimeout(e)}},[Z]);let Q=(0,W.useCallback)(async e=>{if(!(e.length===0||V)){le(!0);try{await H.processFiles(e)}finally{le(!1)}}},[V,H.processFiles]),$=(0,W.useCallback)(async e=>{let t=N(e.clipboardData);t.length!==0&&(e.preventDefault(),await Q(t))},[Q]),_e=(0,W.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,H.setIsDragging(!0))},[H.setIsDragging]),ve=(0,W.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&H.setIsDragging(!1)},[H.setIsDragging]),ye=(0,W.useCallback)(async e=>{e.preventDefault(),H.setIsDragging(!1),await Q(Array.from(e.dataTransfer.files))},[H.setIsDragging,Q]),be=(0,W.useCallback)(e=>{e.preventDefault();let t=H.wireAttachmentsPayload(),n=I(L,t.length>0?ne(t):void 0,{projectScope:`none`});n&&(ie(!1),R(``),H.clearAttachments(),a(n))},[H.clearAttachments,H.wireAttachmentsPayload,L,a]),xe=H.attachments.length>=10,Se={attachTitle:xe?K(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${H.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},Ce=v(`/api/proactive/overview`,se,{refreshInterval:15e3}),we=!!Ce.data?.scenes.some(e=>e.status===`prepared`),Te=!!Ce.data?.scenes.some(e=>e.status===`changed`),Ee=!!Ce.data?.scenes.some(e=>e.status===`following`),De=!!Ce.data?.scenes.length,Oe=!!(x&&x.needsUser.length===0&&x.backgroundCount===0&&Ce.data&&!De),ke=Oe||te;(0,W.useEffect)(()=>{!ke&&q&&Y()},[Y,ke,q]),(0,W.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!ke||V||(e.preventDefault(),fe===`recording`?X():fe===`idle`?(U.current?.focus(),J()):fe===`error`&&ge())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!ke||!q||(e.preventDefault(),Y(),U.current?.focus())};return window.addEventListener(O,e),window.addEventListener(P,t),()=>{window.removeEventListener(O,e),window.removeEventListener(P,t)}},[V,Y,ke,X,ge,J,q,fe]);let Ae=(0,W.useCallback)(e=>{e||Y(),ie(e)},[Y]),je=(0,W.useMemo)(()=>Oe?null:(0,B.jsxs)(y,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>ie(!0),children:[(0,B.jsx)(o,{className:`size-4`,"aria-hidden":!0}),r.newWork]}),[r.newWork,Oe]),Me=(0,W.useCallback)((e,t)=>{if(e.type===`open`){a(e.href);return}if(e.type===`review_judgment`){a(`/assistant-work?item=${encodeURIComponent(e.itemId)}`);return}z(t),M(null),(async()=>{try{e.type===`connector_decision`?await S({kind:`connector_approval`,approvalId:e.approvalId},e.decision):e.type===`retry_run`?await E({kind:e.subjectKind,runId:e.runId}):e.type===`acknowledge_run`&&await ae({kind:e.subjectKind,runId:e.runId}),await Z()}catch(e){M(e instanceof Error?e.message:String(e))}finally{z(null)}})()},[Z,a]);(0,W.useLayoutEffect)(()=>(c({startExtra:null,main:(0,B.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:je}),()=>b()),[b,je,c,n.title]);let Ne=(x?.needsUser.length??0)+(Ce.data?.scenes.filter(e=>e.status===`needs_decision`).length??0),Pe=x?.backgroundCount??0,Fe=Ne>0?K(n.home.attentionTitle,{count:Ne}):we?e===`zh`?`助理准备好了这些`:`Your assistant prepared these`:Te?e===`zh`?`有一些值得知道的变化`:`A few changes are worth knowing`:Pe>0?n.home.clearTitle:Ee?e===`zh`?`助理在跟进你交代的事`:`Your assistant is following through`:Ce.data?n.home.idleTitle:e===`zh`?`今天的工作`:`Your work today`,Ie=Ne>0?Pe>0?K(n.home.attentionIntroWithBackground,{count:Pe}):n.home.attentionIntro:we?e===`zh`?`成果已经整理好,可以直接查看或继续办理。`:`The results are ready to review or continue.`:Te?e===`zh`?`这里是可能影响你当前工作的最新变化。`:`These changes may affect your current work.`:Pe>0?K(n.home.clearIntro,{count:Pe}):Ee?e===`zh`?`助理记着这些事项,有实质进展时会带回来。`:`Your assistant remembers these items and will bring back useful progress.`:Ce.data?n.home.idleIntro:e===`zh`?`正在核对已交代的事项。`:`Checking your delegated work.`;return(0,B.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[920px] flex-1 flex-col px-4 py-8 sm:px-6 lg:px-8 lg:py-12`,children:[(0,B.jsx)(`input`,{ref:H.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&Q(Array.from(t)),e.target.value=``}}),(0,B.jsx)(_,{open:te,onOpenChange:Ae,children:(0,B.jsxs)(m,{children:[(0,B.jsx)(d,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,B.jsxs)(h,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,B.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(g,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,B.jsx)(f,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,B.jsx)(p,{asChild:!0,children:(0,B.jsx)(y,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,B.jsx)(s,{className:`size-4`,"aria-hidden":!0})})})]}),(0,B.jsx)(G,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:U,intent:L,labels:{...Se,submit:r.submit},attachments:H.attachments,isDragging:H.isDragging,attachmentBusy:V,attachmentsFull:xe,voice:de,chat:t.chat,cancelAction:(0,B.jsx)(p,{asChild:!0,children:(0,B.jsx)(y,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:R,onPickFiles:()=>H.fileInputRef.current?.click(),onRemoveAttachment:H.removeAttachment,onPaste:e=>void $(e),onDragOver:_e,onDragLeave:ve,onDrop:e=>void ye(e),onSubmit:be})]})]})}),A?(0,B.jsxs)(`div`,{className:`mb-6 flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,B.jsx)(`span`,{children:A}),(0,B.jsx)(y,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Z(),children:n.home.retry})]}):null,D?(0,B.jsx)(pe,{}):x?(0,B.jsxs)(`div`,{className:Oe?`mx-auto my-auto w-full max-w-[640px]`:`w-full`,children:[(0,B.jsxs)(`section`,{className:Oe?`w-full text-center`:`max-w-3xl`,children:[(0,B.jsx)(`h2`,{className:`text-3xl font-semibold leading-tight tracking-[-0.035em] text-fg sm:text-4xl`,children:Fe}),(0,B.jsx)(`p`,{className:Oe?`mx-auto mt-3 max-w-xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`:`mt-3 max-w-2xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`,children:Ie}),Oe?(0,B.jsx)(G,{variant:`inline`,inputId:`idle-conversation-intent`,inputRef:U,intent:L,labels:Se,attachments:H.attachments,isDragging:H.isDragging,attachmentBusy:V,attachmentsFull:xe,voice:de,chat:t.chat,onIntentChange:R,onPickFiles:()=>H.fileInputRef.current?.click(),onRemoveAttachment:H.removeAttachment,onPaste:e=>void $(e),onDragOver:_e,onDragLeave:ve,onDrop:e=>void ye(e),onSubmit:be}):null]}),x.needsUser.length>0?(0,B.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-needs-user-title`,children:[(0,B.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 px-1`,children:[(0,B.jsx)(ee,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,B.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-sm font-semibold text-fg`,children:n.home.needsUserTitle})]}),(0,B.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:x.needsUser.map(t=>(0,B.jsx)(me,{item:t,busy:ce===t.id,recommendationLabel:n.home.recommendationLabel,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:Me},t.id))})]}):null,(0,B.jsx)(`section`,{className:Oe?`mt-6 sm:mt-8`:`mt-10`,children:(0,B.jsx)(ue,{compact:!0})}),x.background.length>0?(0,B.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-background-title`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,B.jsx)(`h2`,{id:`home-background-title`,className:`text-sm font-semibold text-fg`,children:n.home.backgroundTitle}),(0,B.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:K(n.home.backgroundCount,{count:x.backgroundCount})})]}),(0,B.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle border-y border-edge-subtle`,children:x.background.map(e=>(0,B.jsx)(he,{item:e,onAction:Me},e.id))})]}):null]}):null]})}export{q as HomePage};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./locale-store-DlOv7896.js";async function n(){let n=await e(t(`/api/image-generation/catalog`));if(!Array.isArray(n.payload?.providers))throw Error(`Invalid image provider catalog`);return n.payload.providers}async function r(){let n=await e(t(`/api/image-generation/custom-providers`));if(!Array.isArray(n.payload?.providers))throw Error(`Invalid custom image provider list`);return n.payload.providers}async function i(n,r){await e(t(`/api/image-generation/custom-providers/${encodeURIComponent(n)}`),{method:`PUT`,body:JSON.stringify(r)})}async function a(n){await e(t(`/api/image-generation/custom-providers/${encodeURIComponent(n)}`),{method:`DELETE`})}async function o(n,r){await e(t(`/api/image-generation/providers/${encodeURIComponent(n)}/credential`),{method:`PUT`,body:JSON.stringify({apiKey:r})})}async function s(n,r){let i=await e(t(`/api/image-generation/providers/${encodeURIComponent(n)}/test`),{method:`POST`,body:JSON.stringify({modelId:r})});if(!Array.isArray(i.payload?.images))throw Error(`Invalid image generation test response`);return{images:i.payload.images}}export{o as a,i,r as n,s as o,n as r,a as t};
1
+ import{a as e,r as t}from"./locale-store-D0001I7p.js";async function n(){let n=await e(t(`/api/image-generation/catalog`));if(!Array.isArray(n.payload?.providers))throw Error(`Invalid image provider catalog`);return n.payload.providers}async function r(){let n=await e(t(`/api/image-generation/custom-providers`));if(!Array.isArray(n.payload?.providers))throw Error(`Invalid custom image provider list`);return n.payload.providers}async function i(n,r){await e(t(`/api/image-generation/custom-providers/${encodeURIComponent(n)}`),{method:`PUT`,body:JSON.stringify(r)})}async function a(n){await e(t(`/api/image-generation/custom-providers/${encodeURIComponent(n)}`),{method:`DELETE`})}async function o(n,r){await e(t(`/api/image-generation/providers/${encodeURIComponent(n)}/credential`),{method:`PUT`,body:JSON.stringify({apiKey:r})})}async function s(n,r){let i=await e(t(`/api/image-generation/providers/${encodeURIComponent(n)}/test`),{method:`POST`,body:JSON.stringify({modelId:r})});if(!Array.isArray(i.payload?.images))throw Error(`Invalid image generation test response`);return{images:i.payload.images}}export{o as a,i,r as n,s as o,n as r,a 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{t as i}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./download-Dk-ZjtO6.js";import{t as s}from"./x-B_N4OPjy.js";import{a as c,n as ee,r as l}from"./locale-store-DlOv7896.js";import{t as te}from"./messages-Ls1Aaiqd.js";import{a as u,i as d,n as f,o as p,r as m,s as h,t as g}from"./dist-BGTk37IG.js";import{t as _}from"./button-BA45yciM.js";import{i as v,o as y}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as b,r as x}from"./settings-page-layout-DYelDcMV.js";import{n as ne}from"./settings-loading-skeleton-CAmWMaOT.js";var S=e(t(),1);async function C(e,t,n){return(await c(l(`/api/imports${e}`),{...t===void 0?{}:{method:`POST`,body:JSON.stringify(t)},signal:n})).data}var w=n();function T(e){return e.status===`ready`||e.status===`conflict`||e.kind===`project`&&e.status===`existing`}function E(e,t,n,r){let i=new Set(t);if(!T(n))return i;if(r){if(i.add(n.id),n.parentId&&i.add(n.parentId),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&t.kind===`skill`&&t.suggested&&T(t)&&i.add(t.id)}else if(i.delete(n.id),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&i.delete(t.id);return i}var D=r();function O(e){let t=(0,w.c)(45),{open:n,sourceName:r,inventory:i,selected:a,onSelected:o,busy:c,locked:l,error:b,onClose:x,onRefresh:C,onSubmit:O}=e,R=te(ee(re)).imports,[z,ae]=(0,S.useState)(``),oe;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>ae(``),t[0]=oe):oe=t[0];let se=i?.id,B;t[1]===se?B=t[2]:(B=[se],t[1]=se,t[2]=B),(0,S.useEffect)(oe,B);let V;t[3]===z?V=t[4]:(V=e=>`${e.name} ${e.description} ${e.displayPath}`.toLowerCase().includes(z.toLowerCase().trim()),t[3]=z,t[4]=V);let H=V,U=i?.candidates.filter(e=>a.has(e.id))??[],ce=R.selected.replace(`{skills}`,String(U.filter(L).length)).replace(`{context}`,String(U.filter(I).length)).replace(`{projects}`,String(U.filter(F).length)),W;t[5]!==i||t[6]!==o||t[7]!==a?(W=(e,t)=>{i&&o(E(i,a,e,t))},t[5]=i,t[6]=o,t[7]=a,t[8]=W):W=t[8];let le=W,ue=e=>{let t=i.candidates.filter(t=>t.kind===e&&!t.parentId);if(!t.length)return null;let n=t.filter(H);return(0,D.jsxs)(`section`,{className:`space-y-2`,"aria-label":R.kinds[e],children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,D.jsxs)(`h3`,{className:`text-sm font-medium text-fg`,children:[R.kinds[e],` · `,t.filter(e=>a.has(e.id)).length,`/`,t.length]}),(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[(0,D.jsx)(_,{variant:`ghost`,disabled:l||!n.some(T),onClick:()=>{let e=new Set(a);n.filter(T).forEach(t=>e.add(t.id)),o(e)},children:R.selectVisible}),(0,D.jsx)(_,{variant:`ghost`,disabled:l,onClick:()=>{let e=new Set(a);n.forEach(t=>e.delete(t.id)),o(e)},children:R.clearVisible})]})]}),n.map(e=>(0,D.jsx)(ie,{inventoryId:i.id,item:e,checked:a.has(e.id),disabled:l,onChange:t=>le(e,t)},e.id))]})},G;t[9]===x?G=t[10]:(G=e=>{e||x()},t[9]=x,t[10]=G);let K;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,D.jsx)(u,{className:`fixed inset-0 bg-scrim ${y}`}),t[11]=K):K=t[11];let de;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,D.jsx)(s,{className:`h-4 w-4`}),t[12]=de):de=t[12];let fe;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(fe=e=>ae(e.target.value),t[13]=fe):fe=t[13];let pe=b&&(0,D.jsxs)(`div`,{role:`alert`,className:`space-y-2 rounded-lg border border-edge p-3 text-sm text-fg`,children:[(0,D.jsx)(`p`,{children:b}),(0,D.jsx)(_,{variant:`secondary`,disabled:l,onClick:C,children:R.refresh})]}),q;t[14]!==b||t[15]!==i?(q=!i&&!b&&(0,D.jsx)(ne,{sections:2}),t[14]=b,t[15]=i,t[16]=q):q=t[16];let me=i&&(0,D.jsxs)(D.Fragment,{children:[!i.complete&&(0,D.jsx)(`p`,{className:`text-sm text-fg-muted`,children:R.incomplete}),ue(`skill`),ue(`context`),(0,D.jsxs)(`section`,{"aria-label":R.kinds.project,className:`space-y-2`,children:[(0,D.jsxs)(`h3`,{className:`text-sm font-medium text-fg`,children:[R.kinds.project,` · `,U.filter(P).length,`/`,i.candidates.filter(N).length]}),(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:R.projectHint}),i.candidates.filter(M).map(e=>{let t=i.candidates.filter(t=>t.parentId===e.id);return!H(e)&&!t.some(H)?null:(0,D.jsxs)(`div`,{className:`rounded-xl border border-edge p-3`,children:[(0,D.jsx)(ie,{inventoryId:i.id,item:e,checked:a.has(e.id),disabled:l,onChange:t=>le(e,t)}),t.length?(0,D.jsxs)(`details`,{open:z.trim()?!0:void 0,className:`mt-2 text-sm text-fg-muted`,children:[(0,D.jsxs)(`summary`,{className:`cursor-pointer`,children:[R.projectContents.replace(`{skills}`,String(t.filter(j).length)).replace(`{context}`,String(t.filter(A).length)),` · `,R.chosenCount.replace(`{count}`,String(t.filter(e=>a.has(e.id)).length))]}),(0,D.jsx)(`div`,{className:`mt-2 space-y-2 border-l border-edge pl-3`,children:t.filter(t=>H(e)||H(t)).map(e=>(0,D.jsx)(ie,{inventoryId:i.id,item:e,checked:a.has(e.id),disabled:l,onChange:t=>le(e,t)},e.id))})]}):(0,D.jsx)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:R.directoryOnly})]},e.id)})]}),!i.candidates.length&&(0,D.jsx)(`p`,{className:`text-sm text-fg-muted`,children:R.noContent}),!!i.notices.length&&(0,D.jsxs)(`details`,{className:`text-sm text-fg-muted`,children:[(0,D.jsxs)(`summary`,{className:`cursor-pointer`,children:[R.scanNotices,` (`,i.notices.length,`)`]}),(0,D.jsx)(`ul`,{className:`mt-2 space-y-2`,children:i.notices.map(k)})]})]}),he;t[17]!==pe||t[18]!==q||t[19]!==me?(he=(0,D.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-4 sm:p-5`,children:[pe,q,me]}),t[17]=pe,t[18]=q,t[19]=me,t[20]=he):he=t[20];let J;t[21]===ce?J=t[22]:(J=(0,D.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-fg-muted`,children:ce}),t[21]=ce,t[22]=J);let Y;t[23]!==c||t[24]!==R.runningHint?(Y=c&&(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:R.runningHint}),t[23]=c,t[24]=R.runningHint,t[25]=Y):Y=t[25];let X;t[26]!==c||t[27]!==l||t[28]!==R.retryHint?(X=l&&!c&&(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:R.retryHint}),t[26]=c,t[27]=l,t[28]=R.retryHint,t[29]=X):X=t[29];let ge=c?R.close:R.cancel,Z;t[30]!==x||t[31]!==ge?(Z=(0,D.jsx)(_,{variant:`ghost`,onClick:x,children:ge}),t[30]=x,t[31]=ge,t[32]=Z):Z=t[32];let _e=!i||!a.size||c,ve=c?R.importing:l?R.retry:R.importSelected,Q;t[33]!==O||t[34]!==_e||t[35]!==ve?(Q=(0,D.jsx)(_,{disabled:_e,onClick:O,children:ve}),t[33]=O,t[34]=_e,t[35]=ve,t[36]=Q):Q=t[36];let $;t[37]!==Z||t[38]!==Q?($=(0,D.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[Z,Q]}),t[37]=Z,t[38]=Q,t[39]=$):$=t[39];let ye;return t[40]!==J||t[41]!==Y||t[42]!==X||t[43]!==$?(ye=(0,D.jsxs)(`footer`,{className:`shrink-0 space-y-3 border-t border-edge p-4 sm:p-5`,children:[J,Y,X,$]}),t[40]=J,t[41]=Y,t[42]=X,t[43]=$,t[44]=ye):ye=t[44],(0,D.jsx)(g,{open:n,onOpenChange:G,children:(0,D.jsxs)(p,{children:[K,(0,D.jsxs)(m,{className:`fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),760px)] w-[min(calc(100%-2rem),760px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel outline-none ${v}`,children:[(0,D.jsxs)(`header`,{className:`shrink-0 space-y-2 border-b border-edge p-4 sm:p-5`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,D.jsx)(h,{className:`text-lg font-semibold text-fg`,children:R.chooseTitle.replace(`{source}`,r)}),(0,D.jsx)(f,{asChild:!0,children:(0,D.jsx)(_,{variant:`ghost`,"aria-label":R.close,className:`h-8 w-8 shrink-0 p-0`,children:de})})]}),(0,D.jsx)(d,{className:`text-sm text-fg-muted`,children:R.chooseHint}),(0,D.jsx)(`input`,{"aria-label":R.search,placeholder:R.search,value:z,onChange:fe,className:`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg`})]}),he,ye]})]})})}function k(e,t){return(0,D.jsx)(`li`,{className:`break-words`,children:e},t)}function A(e){return e.kind===`context`}function j(e){return e.kind===`skill`}function M(e){return e.kind===`project`}function N(e){return e.kind===`project`}function P(e){return e.kind===`project`}function F(e){return e.kind===`project`}function I(e){return e.kind===`context`}function L(e){return e.kind===`skill`}function re(e){return e.language}function ie(e){let t=(0,w.c)(54),{inventoryId:n,item:r,checked:i,disabled:a,onChange:o}=e,s=ee(z),c;t[0]===s?c=t[1]:(c=te(s),t[0]=s,t[1]=c);let l=c.imports,[u,d]=(0,S.useState)(),[f,p]=(0,S.useState)(``),[m,h]=(0,S.useState)(!1),g;t[2]!==n||t[3]!==r.id||t[4]!==u?(g=async function(){if(h(R),!u)try{d(await C(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;p(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=u,t[5]=g):g=t[5];let v=g,y;t[6]!==a||t[7]!==r?(y=a||!T(r),t[6]=a,t[7]=r,t[8]=y):y=t[8];let b;t[9]===o?b=t[10]:(b=e=>o(e.target.checked),t[9]=o,t[10]=b);let x;t[11]!==i||t[12]!==y||t[13]!==b?(x=(0,D.jsx)(`input`,{type:`checkbox`,className:`mt-1 h-4 w-4 shrink-0 accent-accent`,checked:i,disabled:y,onChange:b}),t[11]=i,t[12]=y,t[13]=b,t[14]=x):x=t[14];let E;t[15]===r.name?E=t[16]:(E=(0,D.jsx)(`span`,{className:`block break-words text-sm font-medium text-fg`,children:r.name}),t[15]=r.name,t[16]=E);let O;t[17]===r.displayPath?O=t[18]:(O=(0,D.jsx)(`span`,{className:`block break-all text-xs text-fg-muted`,children:r.displayPath}),t[17]=r.displayPath,t[18]=O);let k;t[19]!==E||t[20]!==O?(k=(0,D.jsxs)(`span`,{className:`min-w-0`,children:[E,O]}),t[19]=E,t[20]=O,t[21]=k):k=t[21];let A;t[22]!==x||t[23]!==k?(A=(0,D.jsxs)(`label`,{className:`flex min-w-0 flex-1 cursor-pointer items-start gap-3`,children:[x,k]}),t[22]=x,t[23]=k,t[24]=A):A=t[24];let j;t[25]!==r.kind||t[26]!==r.name||t[27]!==r.status||t[28]!==l||t[29]!==v?(j=r.kind!==`project`&&r.status!==`blocked`&&(0,D.jsx)(_,{variant:`ghost`,"aria-label":`${l.preview}: ${r.name}`,onClick:()=>void v(),children:l.preview}),t[25]=r.kind,t[26]=r.name,t[27]=r.status,t[28]=l,t[29]=v,t[30]=j):j=t[30];let M;t[31]!==A||t[32]!==j?(M=(0,D.jsxs)(`div`,{className:`flex items-start gap-2`,children:[A,j]}),t[31]=A,t[32]=j,t[33]=M):M=t[33];let N;t[34]===r.description?N=t[35]:(N=r.description&&(0,D.jsx)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:r.description}),t[34]=r.description,t[35]=N);let P;t[36]!==r.kind||t[37]!==r.status||t[38]!==r.targetName||t[39]!==l?(P=r.status!==`ready`&&(0,D.jsxs)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:[r.kind===`project`&&r.status===`existing`?l.existingProject:l.statuses[r.status],r.status===`conflict`?` → ${r.targetName}`:``]}),t[36]=r.kind,t[37]=r.status,t[38]=r.targetName,t[39]=l,t[40]=P):P=t[40];let F;t[41]===r.reason?F=t[42]:(F=r.reason&&(0,D.jsx)(`p`,{className:`break-words pl-7 text-xs text-fg-muted`,children:r.reason}),t[41]=r.reason,t[42]=F);let I;t[43]!==u||t[44]!==f||t[45]!==m||t[46]!==l?(I=m&&(0,D.jsx)(`div`,{className:`ml-7 rounded-lg border border-edge p-3`,children:f?(0,D.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:f}):u?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`pre`,{className:`max-h-60 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:u.text}),u.truncated&&(0,D.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:l.previewTruncated})]}):(0,D.jsx)(ne,{sections:1})}),t[43]=u,t[44]=f,t[45]=m,t[46]=l,t[47]=I):I=t[47];let L;return t[48]!==M||t[49]!==N||t[50]!==P||t[51]!==F||t[52]!==I?(L=(0,D.jsxs)(`div`,{className:`min-w-0 space-y-1 rounded-lg p-1`,children:[M,N,P,F,I]}),t[48]=M,t[49]=N,t[50]=P,t[51]=F,t[52]=I,t[53]=L):L=t[53],L}function R(e){return!e}function z(e){return e.language}function ae(){let e=te(ee(e=>e.language)).imports,[t,n]=(0,S.useState)(),[r,s]=(0,S.useState)(),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(),[f,p]=(0,S.useState)(new Set),[m,h]=(0,S.useState)(!1),[g,v]=(0,S.useState)(),[y,w]=(0,S.useState)(),[T,E]=(0,S.useState)(``),[k,A]=(0,S.useState)(``),[j,M]=(0,S.useState)(0),N=(0,S.useRef)(null),P=(0,S.useRef)(!1);(0,S.useEffect)(()=>{let e=new AbortController;return E(``),C(`/sources`,void 0,e.signal).then(e=>n(e.sources)).catch(t=>{e.signal.aborted||E(t instanceof Error?t.message:String(t))}),()=>{e.abort(),N.current?.abort()}},[j]);let F=(t?.flatMap(e=>e.lastImport?.status===`running`?[e.lastImport.id]:[])??[]).join(`,`);(0,S.useEffect)(()=>{if(!F)return;let e=new AbortController,t,n=async()=>{for(let t of F.split(`,`))try{let n=await C(`/runs/${t}`,void 0,e.signal);e.signal.aborted||I(n)}catch{}e.signal.aborted||(t=setTimeout(()=>void n(),3e3))};return t=setTimeout(()=>void n(),1500),()=>{e.abort(),clearTimeout(t)}},[F]);function I(e){n(t=>t?.map(t=>t.id===e.source?{...t,lastImport:e}:t)),e.status!==`running`&&v(t=>t?.requestId===e.id?void 0:t)}async function L(e){N.current?.abort();let t=new AbortController;N.current=t,s(e),l(!0),d(void 0),p(new Set),A(``),w(void 0),v(void 0);try{let n=await C(`/sources/${e}/scan`,{},t.signal);t.signal.aborted||(d(n),p(new Set(n.candidates.filter(e=>!e.parentId&&e.suggested).map(e=>e.id))))}catch(e){t.signal.aborted||A(e instanceof Error?e.message:String(e))}}async function re(){if(!u||!f.size||P.current)return;P.current=!0,h(!0),A(``),E(``);let e=g??{inventoryId:u.id,candidateIds:[...f],requestId:crypto.randomUUID(),retryOf:y};v(e);try{I(await C(`/runs`,e)),l(!1)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),E(t);let n=e.body?.code;n&&[`invalid_input`,`inventory_stale`,`invalid_selection`,`missing_parent`,`not_found`,`conflict`].includes(n)&&v(void 0)}finally{P.current=!1,h(!1)}}async function ie(e){s(e.source),l(!0),d(void 0),p(new Set),A(``),v(void 0),w(e.id),N.current?.abort();let t=new AbortController;N.current=t;try{let n=await C(`/inventories/${e.inventoryId}`,void 0,t.signal);if(t.signal.aborted)return;let r=new Set(e.items.filter(e=>e.status===`failed`).map(e=>e.candidateId));n.candidates.forEach(e=>{r.has(e.id)&&e.parentId&&r.add(e.parentId)}),d({...n,candidates:n.candidates.filter(e=>r.has(e.id))}),p(r)}catch(e){t.signal.aborted||A(e instanceof Error?e.message:String(e))}}let R=t?.filter(e=>e.detected||e.lastImport);return(0,D.jsxs)(x,{children:[(0,D.jsx)(b,{title:e.title,subtitle:e.subtitle}),T&&(0,D.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-edge p-4 text-sm text-fg`,children:[(0,D.jsx)(`p`,{children:T}),!t&&(0,D.jsx)(_,{variant:`ghost`,onClick:()=>M(e=>e+1),children:e.retry})]}),!t&&!T&&(0,D.jsx)(ne,{sections:1}),t&&(0,D.jsxs)(`section`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h2`,{className:`text-base font-medium text-fg`,children:e.apps}),(0,D.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.detectedHint})]}),R?.length?(0,D.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge`,children:R.map(t=>(0,D.jsxs)(`article`,{className:`space-y-3 p-5 sm:p-6`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,D.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg`,children:(0,D.jsx)(o,{className:`h-5 w-5`})}),(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:t.name}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.includes})]}),(0,D.jsx)(_,{variant:`secondary`,disabled:m||!t.detected||!!g&&r!==t.id||t.lastImport?.status===`running`,onClick:()=>{E(``),g&&r===t.id?l(!0):L(t.id)},children:m&&r===t.id?e.importing:g&&r===t.id?e.retry:t.lastImport?e.importAgain:e.import})]}),t.lastImport&&(0,D.jsxs)(`div`,{role:`status`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,D.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(a,{className:`h-4 w-4 shrink-0`}),t.lastImport.status===`running`?e.importing:t.lastImport.issues.length?e.finishedWithIssues:e.finished]}),(0,D.jsxs)(`p`,{children:[e.summary.replace(`{skills}`,String(t.lastImport.skills)).replace(`{context}`,String(t.lastImport.context)).replace(`{projects}`,String(t.lastImport.projects)),t.lastImport.skipped>0&&` · ${e.skipped.replace(`{count}`,String(t.lastImport.skipped))}`]}),!!t.lastImport.issues.length&&(0,D.jsxs)(`details`,{children:[(0,D.jsxs)(`summary`,{className:`cursor-pointer text-fg`,children:[e.details,` (`,t.lastImport.issues.length,`)`]}),(0,D.jsx)(`ul`,{className:`mt-2 space-y-2`,children:t.lastImport.issues.map((e,t)=>(0,D.jsxs)(`li`,{className:`break-words`,children:[(0,D.jsx)(`span`,{className:`font-medium`,children:e.name}),` — `,e.reason]},t))})]}),t.lastImport.status===`partial`&&(0,D.jsx)(_,{variant:`ghost`,disabled:m||!!g,onClick:()=>void ie(t.lastImport),children:e.retryFailed})]})]},t.id))}):(0,D.jsxs)(`div`,{className:`rounded-2xl border border-edge p-6 text-sm text-fg-muted`,children:[(0,D.jsx)(`p`,{children:e.empty}),(0,D.jsx)(_,{variant:`ghost`,className:`mt-3`,onClick:()=>M(e=>e+1),children:e.refresh})]}),(0,D.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:e.footnote}),R?.some(e=>e.lastImport)&&(0,D.jsxs)(`div`,{className:`flex gap-4 text-sm`,children:[(0,D.jsx)(i,{className:`text-accent`,to:`/skills`,children:e.openSkills}),(0,D.jsx)(i,{className:`text-accent`,to:`/projects`,children:e.openProjects}),(0,D.jsx)(i,{className:`text-accent`,to:`/connectors`,children:e.connections})]})]}),(0,D.jsx)(O,{open:c,sourceName:t?.find(e=>e.id===r)?.name??``,inventory:u,selected:f,onSelected:p,busy:m,locked:m||!!g,error:k,onClose:()=>{N.current?.abort(),l(!1)},onRefresh:()=>{r&&L(r)},onSubmit:()=>void re()})]})}export{ae as ImportsPage};
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-Cq1tE_3b.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./download-Dk-ZjtO6.js";import{t as s}from"./x-B_N4OPjy.js";import{a as c,n as ee,r as l}from"./locale-store-D0001I7p.js";import{t as te}from"./messages-BWANv-N-.js";import{a as u,i as d,n as f,o as p,r as m,s as h,t as g}from"./dist-BGTk37IG.js";import{t as _}from"./button-CGlRPNzi.js";import{i as v,o as y}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{n as b,r as x}from"./settings-page-layout-CsUQKRq0.js";import{n as ne}from"./settings-loading-skeleton-CAmWMaOT.js";var S=e(t(),1);async function C(e,t,n){return(await c(l(`/api/imports${e}`),{...t===void 0?{}:{method:`POST`,body:JSON.stringify(t)},signal:n})).data}var w=n();function T(e){return e.status===`ready`||e.status===`conflict`||e.kind===`project`&&e.status===`existing`}function E(e,t,n,r){let i=new Set(t);if(!T(n))return i;if(r){if(i.add(n.id),n.parentId&&i.add(n.parentId),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&t.kind===`skill`&&t.suggested&&T(t)&&i.add(t.id)}else if(i.delete(n.id),n.kind===`project`)for(let t of e.candidates)t.parentId===n.id&&i.delete(t.id);return i}var D=r();function O(e){let t=(0,w.c)(45),{open:n,sourceName:r,inventory:i,selected:a,onSelected:o,busy:c,locked:l,error:b,onClose:x,onRefresh:C,onSubmit:O}=e,R=te(ee(re)).imports,[z,ae]=(0,S.useState)(``),oe;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(oe=()=>ae(``),t[0]=oe):oe=t[0];let se=i?.id,B;t[1]===se?B=t[2]:(B=[se],t[1]=se,t[2]=B),(0,S.useEffect)(oe,B);let V;t[3]===z?V=t[4]:(V=e=>`${e.name} ${e.description} ${e.displayPath}`.toLowerCase().includes(z.toLowerCase().trim()),t[3]=z,t[4]=V);let H=V,U=i?.candidates.filter(e=>a.has(e.id))??[],ce=R.selected.replace(`{skills}`,String(U.filter(L).length)).replace(`{context}`,String(U.filter(I).length)).replace(`{projects}`,String(U.filter(F).length)),W;t[5]!==i||t[6]!==o||t[7]!==a?(W=(e,t)=>{i&&o(E(i,a,e,t))},t[5]=i,t[6]=o,t[7]=a,t[8]=W):W=t[8];let le=W,ue=e=>{let t=i.candidates.filter(t=>t.kind===e&&!t.parentId);if(!t.length)return null;let n=t.filter(H);return(0,D.jsxs)(`section`,{className:`space-y-2`,"aria-label":R.kinds[e],children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,D.jsxs)(`h3`,{className:`text-sm font-medium text-fg`,children:[R.kinds[e],` · `,t.filter(e=>a.has(e.id)).length,`/`,t.length]}),(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[(0,D.jsx)(_,{variant:`ghost`,disabled:l||!n.some(T),onClick:()=>{let e=new Set(a);n.filter(T).forEach(t=>e.add(t.id)),o(e)},children:R.selectVisible}),(0,D.jsx)(_,{variant:`ghost`,disabled:l,onClick:()=>{let e=new Set(a);n.forEach(t=>e.delete(t.id)),o(e)},children:R.clearVisible})]})]}),n.map(e=>(0,D.jsx)(ie,{inventoryId:i.id,item:e,checked:a.has(e.id),disabled:l,onChange:t=>le(e,t)},e.id))]})},G;t[9]===x?G=t[10]:(G=e=>{e||x()},t[9]=x,t[10]=G);let K;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,D.jsx)(u,{className:`fixed inset-0 bg-scrim ${y}`}),t[11]=K):K=t[11];let de;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,D.jsx)(s,{className:`h-4 w-4`}),t[12]=de):de=t[12];let fe;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(fe=e=>ae(e.target.value),t[13]=fe):fe=t[13];let pe=b&&(0,D.jsxs)(`div`,{role:`alert`,className:`space-y-2 rounded-lg border border-edge p-3 text-sm text-fg`,children:[(0,D.jsx)(`p`,{children:b}),(0,D.jsx)(_,{variant:`secondary`,disabled:l,onClick:C,children:R.refresh})]}),q;t[14]!==b||t[15]!==i?(q=!i&&!b&&(0,D.jsx)(ne,{sections:2}),t[14]=b,t[15]=i,t[16]=q):q=t[16];let me=i&&(0,D.jsxs)(D.Fragment,{children:[!i.complete&&(0,D.jsx)(`p`,{className:`text-sm text-fg-muted`,children:R.incomplete}),ue(`skill`),ue(`context`),(0,D.jsxs)(`section`,{"aria-label":R.kinds.project,className:`space-y-2`,children:[(0,D.jsxs)(`h3`,{className:`text-sm font-medium text-fg`,children:[R.kinds.project,` · `,U.filter(P).length,`/`,i.candidates.filter(N).length]}),(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:R.projectHint}),i.candidates.filter(M).map(e=>{let t=i.candidates.filter(t=>t.parentId===e.id);return!H(e)&&!t.some(H)?null:(0,D.jsxs)(`div`,{className:`rounded-xl border border-edge p-3`,children:[(0,D.jsx)(ie,{inventoryId:i.id,item:e,checked:a.has(e.id),disabled:l,onChange:t=>le(e,t)}),t.length?(0,D.jsxs)(`details`,{open:z.trim()?!0:void 0,className:`mt-2 text-sm text-fg-muted`,children:[(0,D.jsxs)(`summary`,{className:`cursor-pointer`,children:[R.projectContents.replace(`{skills}`,String(t.filter(j).length)).replace(`{context}`,String(t.filter(A).length)),` · `,R.chosenCount.replace(`{count}`,String(t.filter(e=>a.has(e.id)).length))]}),(0,D.jsx)(`div`,{className:`mt-2 space-y-2 border-l border-edge pl-3`,children:t.filter(t=>H(e)||H(t)).map(e=>(0,D.jsx)(ie,{inventoryId:i.id,item:e,checked:a.has(e.id),disabled:l,onChange:t=>le(e,t)},e.id))})]}):(0,D.jsx)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:R.directoryOnly})]},e.id)})]}),!i.candidates.length&&(0,D.jsx)(`p`,{className:`text-sm text-fg-muted`,children:R.noContent}),!!i.notices.length&&(0,D.jsxs)(`details`,{className:`text-sm text-fg-muted`,children:[(0,D.jsxs)(`summary`,{className:`cursor-pointer`,children:[R.scanNotices,` (`,i.notices.length,`)`]}),(0,D.jsx)(`ul`,{className:`mt-2 space-y-2`,children:i.notices.map(k)})]})]}),he;t[17]!==pe||t[18]!==q||t[19]!==me?(he=(0,D.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-4 sm:p-5`,children:[pe,q,me]}),t[17]=pe,t[18]=q,t[19]=me,t[20]=he):he=t[20];let J;t[21]===ce?J=t[22]:(J=(0,D.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-fg-muted`,children:ce}),t[21]=ce,t[22]=J);let Y;t[23]!==c||t[24]!==R.runningHint?(Y=c&&(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:R.runningHint}),t[23]=c,t[24]=R.runningHint,t[25]=Y):Y=t[25];let X;t[26]!==c||t[27]!==l||t[28]!==R.retryHint?(X=l&&!c&&(0,D.jsx)(`p`,{className:`text-xs text-fg-muted`,children:R.retryHint}),t[26]=c,t[27]=l,t[28]=R.retryHint,t[29]=X):X=t[29];let ge=c?R.close:R.cancel,Z;t[30]!==x||t[31]!==ge?(Z=(0,D.jsx)(_,{variant:`ghost`,onClick:x,children:ge}),t[30]=x,t[31]=ge,t[32]=Z):Z=t[32];let _e=!i||!a.size||c,ve=c?R.importing:l?R.retry:R.importSelected,Q;t[33]!==O||t[34]!==_e||t[35]!==ve?(Q=(0,D.jsx)(_,{disabled:_e,onClick:O,children:ve}),t[33]=O,t[34]=_e,t[35]=ve,t[36]=Q):Q=t[36];let $;t[37]!==Z||t[38]!==Q?($=(0,D.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[Z,Q]}),t[37]=Z,t[38]=Q,t[39]=$):$=t[39];let ye;return t[40]!==J||t[41]!==Y||t[42]!==X||t[43]!==$?(ye=(0,D.jsxs)(`footer`,{className:`shrink-0 space-y-3 border-t border-edge p-4 sm:p-5`,children:[J,Y,X,$]}),t[40]=J,t[41]=Y,t[42]=X,t[43]=$,t[44]=ye):ye=t[44],(0,D.jsx)(g,{open:n,onOpenChange:G,children:(0,D.jsxs)(p,{children:[K,(0,D.jsxs)(m,{className:`fixed left-1/2 top-1/2 flex h-[min(calc(100dvh-2rem),760px)] w-[min(calc(100%-2rem),760px)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel outline-none ${v}`,children:[(0,D.jsxs)(`header`,{className:`shrink-0 space-y-2 border-b border-edge p-4 sm:p-5`,children:[(0,D.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,D.jsx)(h,{className:`text-lg font-semibold text-fg`,children:R.chooseTitle.replace(`{source}`,r)}),(0,D.jsx)(f,{asChild:!0,children:(0,D.jsx)(_,{variant:`ghost`,"aria-label":R.close,className:`h-8 w-8 shrink-0 p-0`,children:de})})]}),(0,D.jsx)(d,{className:`text-sm text-fg-muted`,children:R.chooseHint}),(0,D.jsx)(`input`,{"aria-label":R.search,placeholder:R.search,value:z,onChange:fe,className:`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg`})]}),he,ye]})]})})}function k(e,t){return(0,D.jsx)(`li`,{className:`break-words`,children:e},t)}function A(e){return e.kind===`context`}function j(e){return e.kind===`skill`}function M(e){return e.kind===`project`}function N(e){return e.kind===`project`}function P(e){return e.kind===`project`}function F(e){return e.kind===`project`}function I(e){return e.kind===`context`}function L(e){return e.kind===`skill`}function re(e){return e.language}function ie(e){let t=(0,w.c)(54),{inventoryId:n,item:r,checked:i,disabled:a,onChange:o}=e,s=ee(z),c;t[0]===s?c=t[1]:(c=te(s),t[0]=s,t[1]=c);let l=c.imports,[u,d]=(0,S.useState)(),[f,p]=(0,S.useState)(``),[m,h]=(0,S.useState)(!1),g;t[2]!==n||t[3]!==r.id||t[4]!==u?(g=async function(){if(h(R),!u)try{d(await C(`/inventories/${n}/items/${r.id}/preview`))}catch(e){let t=e;p(t instanceof Error?t.message:String(t))}},t[2]=n,t[3]=r.id,t[4]=u,t[5]=g):g=t[5];let v=g,y;t[6]!==a||t[7]!==r?(y=a||!T(r),t[6]=a,t[7]=r,t[8]=y):y=t[8];let b;t[9]===o?b=t[10]:(b=e=>o(e.target.checked),t[9]=o,t[10]=b);let x;t[11]!==i||t[12]!==y||t[13]!==b?(x=(0,D.jsx)(`input`,{type:`checkbox`,className:`mt-1 h-4 w-4 shrink-0 accent-accent`,checked:i,disabled:y,onChange:b}),t[11]=i,t[12]=y,t[13]=b,t[14]=x):x=t[14];let E;t[15]===r.name?E=t[16]:(E=(0,D.jsx)(`span`,{className:`block break-words text-sm font-medium text-fg`,children:r.name}),t[15]=r.name,t[16]=E);let O;t[17]===r.displayPath?O=t[18]:(O=(0,D.jsx)(`span`,{className:`block break-all text-xs text-fg-muted`,children:r.displayPath}),t[17]=r.displayPath,t[18]=O);let k;t[19]!==E||t[20]!==O?(k=(0,D.jsxs)(`span`,{className:`min-w-0`,children:[E,O]}),t[19]=E,t[20]=O,t[21]=k):k=t[21];let A;t[22]!==x||t[23]!==k?(A=(0,D.jsxs)(`label`,{className:`flex min-w-0 flex-1 cursor-pointer items-start gap-3`,children:[x,k]}),t[22]=x,t[23]=k,t[24]=A):A=t[24];let j;t[25]!==r.kind||t[26]!==r.name||t[27]!==r.status||t[28]!==l||t[29]!==v?(j=r.kind!==`project`&&r.status!==`blocked`&&(0,D.jsx)(_,{variant:`ghost`,"aria-label":`${l.preview}: ${r.name}`,onClick:()=>void v(),children:l.preview}),t[25]=r.kind,t[26]=r.name,t[27]=r.status,t[28]=l,t[29]=v,t[30]=j):j=t[30];let M;t[31]!==A||t[32]!==j?(M=(0,D.jsxs)(`div`,{className:`flex items-start gap-2`,children:[A,j]}),t[31]=A,t[32]=j,t[33]=M):M=t[33];let N;t[34]===r.description?N=t[35]:(N=r.description&&(0,D.jsx)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:r.description}),t[34]=r.description,t[35]=N);let P;t[36]!==r.kind||t[37]!==r.status||t[38]!==r.targetName||t[39]!==l?(P=r.status!==`ready`&&(0,D.jsxs)(`p`,{className:`pl-7 text-xs text-fg-muted`,children:[r.kind===`project`&&r.status===`existing`?l.existingProject:l.statuses[r.status],r.status===`conflict`?` → ${r.targetName}`:``]}),t[36]=r.kind,t[37]=r.status,t[38]=r.targetName,t[39]=l,t[40]=P):P=t[40];let F;t[41]===r.reason?F=t[42]:(F=r.reason&&(0,D.jsx)(`p`,{className:`break-words pl-7 text-xs text-fg-muted`,children:r.reason}),t[41]=r.reason,t[42]=F);let I;t[43]!==u||t[44]!==f||t[45]!==m||t[46]!==l?(I=m&&(0,D.jsx)(`div`,{className:`ml-7 rounded-lg border border-edge p-3`,children:f?(0,D.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:f}):u?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`pre`,{className:`max-h-60 overflow-auto whitespace-pre-wrap break-words text-xs text-fg`,children:u.text}),u.truncated&&(0,D.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:l.previewTruncated})]}):(0,D.jsx)(ne,{sections:1})}),t[43]=u,t[44]=f,t[45]=m,t[46]=l,t[47]=I):I=t[47];let L;return t[48]!==M||t[49]!==N||t[50]!==P||t[51]!==F||t[52]!==I?(L=(0,D.jsxs)(`div`,{className:`min-w-0 space-y-1 rounded-lg p-1`,children:[M,N,P,F,I]}),t[48]=M,t[49]=N,t[50]=P,t[51]=F,t[52]=I,t[53]=L):L=t[53],L}function R(e){return!e}function z(e){return e.language}function ae(){let e=te(ee(e=>e.language)).imports,[t,n]=(0,S.useState)(),[r,s]=(0,S.useState)(),[c,l]=(0,S.useState)(!1),[u,d]=(0,S.useState)(),[f,p]=(0,S.useState)(new Set),[m,h]=(0,S.useState)(!1),[g,v]=(0,S.useState)(),[y,w]=(0,S.useState)(),[T,E]=(0,S.useState)(``),[k,A]=(0,S.useState)(``),[j,M]=(0,S.useState)(0),N=(0,S.useRef)(null),P=(0,S.useRef)(!1);(0,S.useEffect)(()=>{let e=new AbortController;return E(``),C(`/sources`,void 0,e.signal).then(e=>n(e.sources)).catch(t=>{e.signal.aborted||E(t instanceof Error?t.message:String(t))}),()=>{e.abort(),N.current?.abort()}},[j]);let F=(t?.flatMap(e=>e.lastImport?.status===`running`?[e.lastImport.id]:[])??[]).join(`,`);(0,S.useEffect)(()=>{if(!F)return;let e=new AbortController,t,n=async()=>{for(let t of F.split(`,`))try{let n=await C(`/runs/${t}`,void 0,e.signal);e.signal.aborted||I(n)}catch{}e.signal.aborted||(t=setTimeout(()=>void n(),3e3))};return t=setTimeout(()=>void n(),1500),()=>{e.abort(),clearTimeout(t)}},[F]);function I(e){n(t=>t?.map(t=>t.id===e.source?{...t,lastImport:e}:t)),e.status!==`running`&&v(t=>t?.requestId===e.id?void 0:t)}async function L(e){N.current?.abort();let t=new AbortController;N.current=t,s(e),l(!0),d(void 0),p(new Set),A(``),w(void 0),v(void 0);try{let n=await C(`/sources/${e}/scan`,{},t.signal);t.signal.aborted||(d(n),p(new Set(n.candidates.filter(e=>!e.parentId&&e.suggested).map(e=>e.id))))}catch(e){t.signal.aborted||A(e instanceof Error?e.message:String(e))}}async function re(){if(!u||!f.size||P.current)return;P.current=!0,h(!0),A(``),E(``);let e=g??{inventoryId:u.id,candidateIds:[...f],requestId:crypto.randomUUID(),retryOf:y};v(e);try{I(await C(`/runs`,e)),l(!1)}catch(e){let t=e instanceof Error?e.message:String(e);A(t),E(t);let n=e.body?.code;n&&[`invalid_input`,`inventory_stale`,`invalid_selection`,`missing_parent`,`not_found`,`conflict`].includes(n)&&v(void 0)}finally{P.current=!1,h(!1)}}async function ie(e){s(e.source),l(!0),d(void 0),p(new Set),A(``),v(void 0),w(e.id),N.current?.abort();let t=new AbortController;N.current=t;try{let n=await C(`/inventories/${e.inventoryId}`,void 0,t.signal);if(t.signal.aborted)return;let r=new Set(e.items.filter(e=>e.status===`failed`).map(e=>e.candidateId));n.candidates.forEach(e=>{r.has(e.id)&&e.parentId&&r.add(e.parentId)}),d({...n,candidates:n.candidates.filter(e=>r.has(e.id))}),p(r)}catch(e){t.signal.aborted||A(e instanceof Error?e.message:String(e))}}let R=t?.filter(e=>e.detected||e.lastImport);return(0,D.jsxs)(x,{children:[(0,D.jsx)(b,{title:e.title,subtitle:e.subtitle}),T&&(0,D.jsxs)(`div`,{role:`alert`,className:`rounded-xl border border-edge p-4 text-sm text-fg`,children:[(0,D.jsx)(`p`,{children:T}),!t&&(0,D.jsx)(_,{variant:`ghost`,onClick:()=>M(e=>e+1),children:e.retry})]}),!t&&!T&&(0,D.jsx)(ne,{sections:1}),t&&(0,D.jsxs)(`section`,{className:`space-y-4`,children:[(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`h2`,{className:`text-base font-medium text-fg`,children:e.apps}),(0,D.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.detectedHint})]}),R?.length?(0,D.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge`,children:R.map(t=>(0,D.jsxs)(`article`,{className:`space-y-3 p-5 sm:p-6`,children:[(0,D.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,D.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-surface-hover text-fg`,children:(0,D.jsx)(o,{className:`h-5 w-5`})}),(0,D.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,D.jsx)(`h3`,{className:`font-medium text-fg`,children:t.name}),(0,D.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.includes})]}),(0,D.jsx)(_,{variant:`secondary`,disabled:m||!t.detected||!!g&&r!==t.id||t.lastImport?.status===`running`,onClick:()=>{E(``),g&&r===t.id?l(!0):L(t.id)},children:m&&r===t.id?e.importing:g&&r===t.id?e.retry:t.lastImport?e.importAgain:e.import})]}),t.lastImport&&(0,D.jsxs)(`div`,{role:`status`,className:`space-y-2 text-sm text-fg-muted`,children:[(0,D.jsxs)(`p`,{className:`flex items-center gap-2`,children:[(0,D.jsx)(a,{className:`h-4 w-4 shrink-0`}),t.lastImport.status===`running`?e.importing:t.lastImport.issues.length?e.finishedWithIssues:e.finished]}),(0,D.jsxs)(`p`,{children:[e.summary.replace(`{skills}`,String(t.lastImport.skills)).replace(`{context}`,String(t.lastImport.context)).replace(`{projects}`,String(t.lastImport.projects)),t.lastImport.skipped>0&&` · ${e.skipped.replace(`{count}`,String(t.lastImport.skipped))}`]}),!!t.lastImport.issues.length&&(0,D.jsxs)(`details`,{children:[(0,D.jsxs)(`summary`,{className:`cursor-pointer text-fg`,children:[e.details,` (`,t.lastImport.issues.length,`)`]}),(0,D.jsx)(`ul`,{className:`mt-2 space-y-2`,children:t.lastImport.issues.map((e,t)=>(0,D.jsxs)(`li`,{className:`break-words`,children:[(0,D.jsx)(`span`,{className:`font-medium`,children:e.name}),` — `,e.reason]},t))})]}),t.lastImport.status===`partial`&&(0,D.jsx)(_,{variant:`ghost`,disabled:m||!!g,onClick:()=>void ie(t.lastImport),children:e.retryFailed})]})]},t.id))}):(0,D.jsxs)(`div`,{className:`rounded-2xl border border-edge p-6 text-sm text-fg-muted`,children:[(0,D.jsx)(`p`,{children:e.empty}),(0,D.jsx)(_,{variant:`ghost`,className:`mt-3`,onClick:()=>M(e=>e+1),children:e.refresh})]}),(0,D.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:e.footnote}),R?.some(e=>e.lastImport)&&(0,D.jsxs)(`div`,{className:`flex gap-4 text-sm`,children:[(0,D.jsx)(i,{className:`text-accent`,to:`/skills`,children:e.openSkills}),(0,D.jsx)(i,{className:`text-accent`,to:`/projects`,children:e.openProjects}),(0,D.jsx)(i,{className:`text-accent`,to:`/connectors`,children:e.connections})]})]}),(0,D.jsx)(O,{open:c,sourceName:t?.find(e=>e.id===r)?.name??``,inventory:u,selected:f,onSelected:p,busy:m,locked:m||!!g,error:k,onClose:()=>{N.current?.abort(),l(!1)},onRefresh:()=>{r&&L(r)},onSubmit:()=>void re()})]})}export{ae as ImportsPage};