@xopcai/xopc 0.0.208 → 0.0.211

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 (316) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-D0mYZqhc.js → activity-store-BzjFoSr0.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-MWLQWL_i.js → agent-avatar-dicebear-DTfjhfVE.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-CjhgfuVJ.js +68 -0
  6. package/dist/gateway/static/root/assets/{api-DZA1yVzM.js → api-D269PnU9.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-B2X6quAF.js → app-management-settings-panel-BFpfQDWc.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-BZW-c38q.js → appearance-settings-DLxFdqhY.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-CjmlGB5V.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-CK-gsjsJ.js → archive-plugin-DPlH4dnc.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-EJGP4rCw.js → attachment-load-xqfLLd0I.js} +1 -1
  12. package/dist/gateway/static/root/assets/automations-page-4m6Ey6wG.js +6 -0
  13. package/dist/gateway/static/root/assets/{binary-plugins-Tbss_4P-.js → binary-plugins-C0tuoPXk.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-C-dOWigw.js → block-editor-Deyphj1o.js} +6 -6
  15. package/dist/gateway/static/root/assets/browser-settings-page-CAGCYx8U.js +8 -0
  16. package/dist/gateway/static/root/assets/{browser-workflow-inputs-DW06Zo1N.js → browser-workflow-inputs-CYEbXyRF.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-workflows-page-B6RnRGwm.js → browser-workflows-page-Bf0tPbGi.js} +2 -2
  18. package/dist/gateway/static/root/assets/capabilities-settings-panel-CKfLsxTI.js +7 -0
  19. package/dist/gateway/static/root/assets/{capability-presets-api-Cc3BtQar.js → capability-presets-api-DPkFA_-R.js} +1 -1
  20. package/dist/gateway/static/root/assets/capability-presets-settings-panel-CpipKNqX.js +3 -0
  21. package/dist/gateway/static/root/assets/{channel-recipient-api-BvZO5FaO.js → channel-recipient-api-DqKaAcnZ.js} +1 -1
  22. package/dist/gateway/static/root/assets/channels-settings-Bvq-O4pt.js +1 -0
  23. package/dist/gateway/static/root/assets/channels-status-swr-CrMld2l7.js +1 -0
  24. package/dist/gateway/static/root/assets/chat-terminal-dock-CTDRZa7e.js +36 -0
  25. package/dist/gateway/static/root/assets/{connectors-api-CUl6_EQJ.js → connectors-api-Buu8fif8.js} +1 -1
  26. package/dist/gateway/static/root/assets/connectors-page-CSQRzaVn.js +2 -0
  27. package/dist/gateway/static/root/assets/{cron-expression-BD9MgoE_.js → cron-expression-DTLR82NB.js} +1 -1
  28. package/dist/gateway/static/root/assets/{date-picker-ChqNmoxw.js → date-picker-DyNogHQH.js} +1 -1
  29. package/dist/gateway/static/root/assets/{dependency-picker-CDUmFs6H.js → dependency-picker-BpnCuo7B.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-D61gqxaD.js → desktop-pet-CDKI4gVB.js} +1 -1
  31. package/dist/gateway/static/root/assets/{desktop-pet-settings-QvuJvIX_.js → desktop-pet-settings-DjT5C2a3.js} +1 -1
  32. package/dist/gateway/static/root/assets/{directory-picker-path-field-DvXMvDNY.js → directory-picker-path-field-DlJY90TM.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-debug-page-DMdVTAQ3.js → extension-debug-page-DWf2z7q5.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-BNzxZtaK.js → extension-page-Dorx0kf9.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-DoEfyizU.js → extension-settings-page-B1wU9ZOB.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-config-api-o7AKvthC.js → gateway-config-api-B1lG4dNr.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-config-swr-BQbkUP5X.js → gateway-config-swr-BIxuwPQi.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-settings-TO5YYZ9a.js → gateway-settings-DqIOqJjM.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-startup-retry-DIgdpHgk.js → gateway-startup-retry-BpZgd4U-.js} +1 -1
  40. package/dist/gateway/static/root/assets/heartbeat-settings-DG4Kmgkc.js +1 -0
  41. package/dist/gateway/static/root/assets/home-page-BhqItS_s.js +1 -0
  42. package/dist/gateway/static/root/assets/image-generation-api-PkhYohDa.js +1 -0
  43. package/dist/gateway/static/root/assets/index-DLhvsU9B.css +2 -0
  44. package/dist/gateway/static/root/assets/index-_cuTcWjB.js +107 -0
  45. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-4xaM3jjU.js → keyboard-shortcuts-settings-6OQT3gQF.js} +1 -1
  46. package/dist/gateway/static/root/assets/local-app-workbench-page-DWjTmzxw.js +2 -0
  47. package/dist/gateway/static/root/assets/{local-apps-page-C1xDicdr.js → local-apps-page-DfruRAmE.js} +1 -1
  48. package/dist/gateway/static/root/assets/{locale-store-pByvK12G.js → locale-store-C5MK9WcP.js} +1 -1
  49. package/dist/gateway/static/root/assets/logs-page-BA5efZ8B.js +2 -0
  50. package/dist/gateway/static/root/assets/{management-settings-D1XdHm7v.js → management-settings-L1VYkywO.js} +1 -1
  51. package/dist/gateway/static/root/assets/{markdown-split-B_Ijq1Fr.js → markdown-split-oqgHbqt-.js} +1 -1
  52. package/dist/gateway/static/root/assets/markdown-view-DD_PgVue.css +1 -0
  53. package/dist/gateway/static/root/assets/{markdown-view-CyJlGUxB.js → markdown-view-V4rcPPH0.js} +1 -1
  54. package/dist/gateway/static/root/assets/{media-plugins-CXXNRROJ.js → media-plugins-Bb6gSX2o.js} +1 -1
  55. package/dist/gateway/static/root/assets/messages-ctG2e-ix.js +3 -0
  56. package/dist/gateway/static/root/assets/{notes-page-rkePB4CB.js → notes-page-B1rOXjpT.js} +1 -1
  57. package/dist/gateway/static/root/assets/notes-workbench-CkHXVmKP.js +4 -0
  58. package/dist/gateway/static/root/assets/{page-tabs-gw-RMQCV.js → page-tabs-CBuCKeyy.js} +1 -1
  59. package/dist/gateway/static/root/assets/{preview-open-alternatives-B8aMScJ2.js → preview-open-alternatives-BQ0tLfPO.js} +1 -1
  60. package/dist/gateway/static/root/assets/{product-open-page-CjcpkWAz.js → product-open-page-DPeFn7Hu.js} +1 -1
  61. package/dist/gateway/static/root/assets/project-detail-page-DCqet9-L.js +1 -0
  62. package/dist/gateway/static/root/assets/projects-page-D0t_AjzG.js +1 -0
  63. package/dist/gateway/static/root/assets/remote-access-hub-BUWPoBvw.js +1 -0
  64. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Ch5qq86o.js → runtime-tools-settings-panel-BCfQNzjG.js} +2 -2
  65. package/dist/gateway/static/root/assets/{schema-form-DHYWYUFt.js → schema-form-Bo7YbHYN.js} +1 -1
  66. package/dist/gateway/static/root/assets/sessions-page-vLhrrM3m.js +1 -0
  67. package/dist/gateway/static/root/assets/settings-advanced-gate-OP1y0Y8M.js +1 -0
  68. package/dist/gateway/static/root/assets/{settings-form-section-DlzZx0-i.js → settings-form-section-B9dnKr3M.js} +1 -1
  69. package/dist/gateway/static/root/assets/{settings-loading-skeleton-BVLhreQi.js → settings-loading-skeleton-CYDV2JtY.js} +1 -1
  70. package/dist/gateway/static/root/assets/{settings-page-BJU-kUnN.js → settings-page-DbrIYfS9.js} +1 -1
  71. package/dist/gateway/static/root/assets/setup-status-panel-Cxc-Ejl5.js +1 -0
  72. package/dist/gateway/static/root/assets/{share-preview-page-hvIuZXMe.js → share-preview-page-olgr7LLN.js} +1 -1
  73. package/dist/gateway/static/root/assets/shares-settings-ZOqC6-aA.js +1 -0
  74. package/dist/gateway/static/root/assets/skill-reload-api-DwvC3Iuf.js +1 -0
  75. package/dist/gateway/static/root/assets/{skills-page-Dlvuh7D-.js → skills-page-PE16CNw5.js} +1 -1
  76. package/dist/gateway/static/root/assets/{skills-page.utils-B6ddOpnf.js → skills-page.utils-nXmBcBxt.js} +1 -1
  77. package/dist/gateway/static/root/assets/{system-settings-panel-BdbCAyoA.js → system-settings-panel-C3qPwAdY.js} +1 -1
  78. package/dist/gateway/static/root/assets/task-detail-page-DCRB-5q-.js +1 -0
  79. package/dist/gateway/static/root/assets/{theme-store-BtdGacMI.js → theme-store-KR5Otp5w.js} +1 -1
  80. package/dist/gateway/static/root/assets/{typed-models-lib-CL6qHYJA.js → typed-models-lib-lMZodtDF.js} +1 -1
  81. package/dist/gateway/static/root/assets/{use-autosave-DysNnqCS.js → use-autosave-CKpatP3S.js} +1 -1
  82. package/dist/gateway/static/root/assets/user-context-page-CoiedRuA.js +1 -0
  83. package/dist/gateway/static/root/assets/{voice-api-key-field-UEsO9Jr-.js → voice-api-key-field-CDcv0Wbh.js} +1 -1
  84. package/dist/gateway/static/root/assets/{work-discovery-overlay-B9disASf.js → work-discovery-overlay-CGdT22un.js} +1 -1
  85. package/dist/gateway/static/root/assets/work-discovery-page-BwaU1RqI.js +1 -0
  86. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-A0zTQHFQ.js → workflow-run-setup-panel-BAHYNlQt.js} +2 -2
  87. package/dist/gateway/static/root/assets/workflows-page-DHYmh9G7.js +5 -0
  88. package/dist/gateway/static/root/index.html +10 -10
  89. package/dist/package.js +1 -1
  90. package/dist/src/agent/agent-manager.js +1 -1
  91. package/dist/src/agent/background-review/coordinator.d.ts +1 -1
  92. package/dist/src/agent/background-review/coordinator.js +4 -5
  93. package/dist/src/agent/background-review/run-background-review.js +0 -1
  94. package/dist/src/agent/background-review/settings.d.ts +1 -2
  95. package/dist/src/agent/background-review/settings.js +3 -4
  96. package/dist/src/agent/external-tools/composio-provider.js +8 -4
  97. package/dist/src/agent/image/generation/providers/xopc-cloud.js +2 -1
  98. package/dist/src/agent/image/tool-model-config.js +15 -9
  99. package/dist/src/agent/memory/builtin-provider.js +1 -2
  100. package/dist/src/agent/memory/manager.js +2 -0
  101. package/dist/src/agent/memory/sensitivity.js +1 -1
  102. package/dist/src/agent/memory/understanding/service.js +43 -19
  103. package/dist/src/agent/memory/user-context-coordinator.js +1 -1
  104. package/dist/src/agent/tools/image-generate-tool.js +23 -7
  105. package/dist/src/automations/domain/validation.d.ts +7 -7
  106. package/dist/src/automations/draft/automation-draft-validator.d.ts +2 -2
  107. package/dist/src/capabilities/readiness/from-config.d.ts +10 -0
  108. package/dist/src/capabilities/readiness/from-config.js +128 -0
  109. package/dist/src/capabilities/readiness/index.d.ts +3 -0
  110. package/dist/src/capabilities/readiness/index.js +3 -0
  111. package/dist/src/capabilities/readiness/planner.d.ts +3 -0
  112. package/dist/src/capabilities/readiness/planner.js +56 -0
  113. package/dist/src/capabilities/readiness/types.d.ts +35 -0
  114. package/dist/src/capabilities/readiness/types.js +1 -0
  115. package/dist/src/cli/commands/agent.js +9 -0
  116. package/dist/src/cli/commands/auth.js +4 -3
  117. package/dist/src/cli/commands/connectors.js +1 -1
  118. package/dist/src/cli/commands/models.js +2 -1
  119. package/dist/src/cli/commands/onboard/model.d.ts +3 -21
  120. package/dist/src/cli/commands/onboard/model.js +10 -86
  121. package/dist/src/cli/utils/oauth-login.d.ts +2 -0
  122. package/dist/src/cli/utils/oauth-login.js +9 -1
  123. package/dist/src/config/agent-profile.js +1 -1
  124. package/dist/src/config/index.js +2 -2
  125. package/dist/src/config/paths-state.d.ts +2 -0
  126. package/dist/src/config/paths-state.js +5 -1
  127. package/dist/src/config/paths.d.ts +1 -1
  128. package/dist/src/config/paths.js +2 -2
  129. package/dist/src/config/schema.js +1 -1
  130. package/dist/src/connectors/auth-provider-registry.d.ts +2 -1
  131. package/dist/src/connectors/auth-provider-registry.js +5 -2
  132. package/dist/src/connectors/composio-sessions.d.ts +39 -0
  133. package/dist/src/connectors/composio-sessions.js +66 -7
  134. package/dist/src/connectors/composio.d.ts +4 -1
  135. package/dist/src/connectors/composio.js +34 -7
  136. package/dist/src/connectors/connected-source-cursor.d.ts +9 -0
  137. package/dist/src/connectors/connected-source-cursor.js +30 -0
  138. package/dist/src/connectors/connected-source-ingestion.js +67 -46
  139. package/dist/src/connectors/connected-source-normalizers.d.ts +1 -0
  140. package/dist/src/connectors/connected-source-normalizers.js +33 -2
  141. package/dist/src/connectors/connected-source-sanitization.d.ts +1 -0
  142. package/dist/src/connectors/connected-source-sanitization.js +21 -0
  143. package/dist/src/connectors/connector-identity.js +10 -2
  144. package/dist/src/connectors/content-enrichment.d.ts +29 -0
  145. package/dist/src/connectors/content-enrichment.js +273 -0
  146. package/dist/src/connectors/health.js +1 -1
  147. package/dist/src/connectors/learning-coordinator.js +1 -2
  148. package/dist/src/connectors/learning-recipes.js +28 -33
  149. package/dist/src/connectors/runtime-adapter-registry.js +14 -1
  150. package/dist/src/discussions/live-worker.d.ts +1 -0
  151. package/dist/src/discussions/live-worker.js +7 -1
  152. package/dist/src/discussions/repository.js +11 -1
  153. package/dist/src/discussions/sealer.d.ts +1 -1
  154. package/dist/src/discussions/sealer.js +16 -7
  155. package/dist/src/discussions/transcript.js +27 -1
  156. package/dist/src/discussions/types.d.ts +4 -0
  157. package/dist/src/gateway/agents-admin.js +1 -1
  158. package/dist/src/gateway/hono/app.js +8 -3
  159. package/dist/src/gateway/hono/middleware/strict-rate-limit.d.ts +4 -0
  160. package/dist/src/gateway/hono/middleware/strict-rate-limit.js +8 -1
  161. package/dist/src/gateway/hono/oauth-async.d.ts +11 -5
  162. package/dist/src/gateway/hono/oauth-async.js +29 -16
  163. package/dist/src/gateway/hono/oauth.d.ts +1 -3
  164. package/dist/src/gateway/hono/oauth.js +22 -22
  165. package/dist/src/gateway/hono/routes/agent-stream.js +4 -1
  166. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
  167. package/dist/src/gateway/hono/routes/connectors.js +16 -3
  168. package/dist/src/gateway/hono/routes/deps.d.ts +1 -0
  169. package/dist/src/gateway/hono/routes/discussions.js +2 -1
  170. package/dist/src/gateway/hono/routes/lazy-bundles.js +2 -1
  171. package/dist/src/gateway/hono/routes/mcp.js +1 -1
  172. package/dist/src/gateway/hono/routes/models.js +59 -5
  173. package/dist/src/gateway/hono/routes/session-input-handler.d.ts +60 -0
  174. package/dist/src/gateway/hono/routes/session-input-handler.js +75 -1
  175. package/dist/src/gateway/hono/routes/understanding-sources.js +29 -0
  176. package/dist/src/gateway/hono/routes/voice.d.ts +1 -2
  177. package/dist/src/gateway/hono/routes/voice.js +16 -35
  178. package/dist/src/gateway/rate-limit/buckets.d.ts +3 -0
  179. package/dist/src/gateway/rate-limit/buckets.js +12 -0
  180. package/dist/src/gateway/service/agent-runner.d.ts +9 -1
  181. package/dist/src/gateway/service/agent-runner.js +9 -0
  182. package/dist/src/gateway/service/session-input-coordinator.d.ts +12 -0
  183. package/dist/src/gateway/service/session-input-coordinator.js +63 -6
  184. package/dist/src/gateway/service.d.ts +8 -0
  185. package/dist/src/gateway/service.js +18 -0
  186. package/dist/src/knowledge/connected-understanding-pipeline.d.ts +1 -1
  187. package/dist/src/knowledge/connected-understanding-pipeline.js +74 -25
  188. package/dist/src/knowledge/ingestion-service.js +33 -15
  189. package/dist/src/knowledge/types.d.ts +2 -0
  190. package/dist/src/media-understanding/audio-transcription-runner.d.ts +2 -0
  191. package/dist/src/media-understanding/audio-transcription-runner.js +3 -1
  192. package/dist/src/media-understanding/runner.js +3 -1
  193. package/dist/src/media-understanding/types.d.ts +2 -0
  194. package/dist/src/providers/model-catalog-persistence.d.ts +9 -0
  195. package/dist/src/providers/model-catalog-persistence.js +172 -0
  196. package/dist/src/providers/model-catalog-ranking.d.ts +2 -0
  197. package/dist/src/providers/model-catalog-ranking.js +17 -0
  198. package/dist/src/providers/model-catalog-store.d.ts +13 -3
  199. package/dist/src/providers/model-catalog-store.js +24 -5
  200. package/dist/src/providers/model-catalog-sync-service.d.ts +3 -3
  201. package/dist/src/providers/model-catalog-sync-service.js +12 -7
  202. package/dist/src/providers/provider-auth-service.d.ts +1 -0
  203. package/dist/src/providers/provider-auth-service.js +3 -0
  204. package/dist/src/providers/provider-disconnect.d.ts +11 -0
  205. package/dist/src/providers/provider-disconnect.js +33 -0
  206. package/dist/src/providers/xopc-cloud-catalog-coordinator.d.ts +56 -0
  207. package/dist/src/providers/xopc-cloud-catalog-coordinator.js +182 -0
  208. package/dist/src/providers/xopc-cloud-model-source.d.ts +6 -10
  209. package/dist/src/providers/xopc-cloud-model-source.js +49 -27
  210. package/dist/src/retrieval/audit.d.ts +1 -0
  211. package/dist/src/retrieval/audit.js +8 -0
  212. package/dist/src/retrieval/candidateFusion.d.ts +5 -0
  213. package/dist/src/retrieval/candidateFusion.js +20 -0
  214. package/dist/src/retrieval/queryProfile.d.ts +16 -0
  215. package/dist/src/retrieval/queryProfile.js +66 -0
  216. package/dist/src/retrieval/textFeatures.d.ts +5 -0
  217. package/dist/src/retrieval/textFeatures.js +71 -0
  218. package/dist/src/session/client-history.d.ts +1 -0
  219. package/dist/src/session/client-history.js +4 -0
  220. package/dist/src/session/index.js +1 -1
  221. package/dist/src/session/store.js +1 -1
  222. package/dist/src/storage/sqlite/fts.d.ts +0 -4
  223. package/dist/src/storage/sqlite/fts.js +2 -49
  224. package/dist/src/storage/sqlite/index.d.ts +3 -2
  225. package/dist/src/storage/sqlite/index.js +6 -5
  226. package/dist/src/storage/sqlite/knowledge-repository.d.ts +1 -0
  227. package/dist/src/storage/sqlite/knowledge-repository.js +4 -0
  228. package/dist/src/storage/sqlite/memory-records-repository.js +60 -38
  229. package/dist/src/storage/sqlite/row-mappers.js +2 -2
  230. package/dist/src/storage/sqlite/session-repository.js +2 -2
  231. package/dist/src/storage/sqlite/session-turn-replace-repository.d.ts +34 -0
  232. package/dist/src/storage/sqlite/session-turn-replace-repository.js +110 -0
  233. package/dist/src/storage/sqlite/transcript-repository.js +1 -1
  234. package/dist/src/storage/sqlite/user-context-quality-repository.d.ts +15 -0
  235. package/dist/src/storage/sqlite/user-context-quality-repository.js +46 -2
  236. package/dist/src/storage/sqlite/user-context-repository.d.ts +4 -0
  237. package/dist/src/storage/sqlite/user-context-repository.js +29 -3
  238. package/dist/src/tasks/home-query-service.d.ts +3 -1
  239. package/dist/src/tasks/home-query-service.js +73 -70
  240. package/dist/src/tui/backends/embedded-backend.js +12 -4
  241. package/dist/src/tui/tui-oauth-login.js +5 -0
  242. package/dist/src/tui/tui-startup-resources.js +1 -1
  243. package/dist/src/user-context/planner.d.ts +1 -0
  244. package/dist/src/user-context/planner.js +16 -29
  245. package/dist/src/user-context/retriever.d.ts +15 -0
  246. package/dist/src/user-context/retriever.js +65 -0
  247. package/dist/src/user-context/scope.d.ts +7 -0
  248. package/dist/src/user-context/scope.js +9 -0
  249. package/dist/src/user-context/sources/activity-clustering.js +30 -117
  250. package/dist/src/user-context/sources/index.d.ts +1 -0
  251. package/dist/src/user-context/sources/index.js +2 -1
  252. package/dist/src/user-context/sources/signal-clustering.d.ts +18 -0
  253. package/dist/src/user-context/sources/signal-clustering.js +131 -0
  254. package/dist/src/voice/audio/normalize.d.ts +17 -0
  255. package/dist/src/voice/audio/normalize.js +155 -0
  256. package/dist/src/voice/language-profile.d.ts +1 -4
  257. package/dist/src/voice/language-profile.js +2 -25
  258. package/dist/src/voice/local/runtime-client.d.ts +2 -0
  259. package/dist/src/voice/local/runtime-client.js +20 -1
  260. package/dist/src/voice/local/runtime-worker.js +7 -13
  261. package/dist/src/voice/local/wav.js +1 -1
  262. package/dist/src/voice/stt/availability.d.ts +1 -4
  263. package/dist/src/voice/stt/availability.js +3 -15
  264. package/dist/src/voice/stt/config.js +1 -0
  265. package/dist/src/voice/stt/factory.js +23 -0
  266. package/dist/src/voice/stt/index.d.ts +1 -0
  267. package/dist/src/voice/stt/index.js +2 -2
  268. package/dist/src/voice/stt/list-providers.js +1 -1
  269. package/dist/src/voice/stt/providers/local-transcription.js +7 -3
  270. package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +3 -1
  271. package/dist/src/voice/stt/transcribe-core.d.ts +5 -1
  272. package/dist/src/voice/stt/transcribe-core.js +13 -5
  273. package/dist/src/voice/stt/types.d.ts +2 -0
  274. package/dist/src/voice/tts/factory.d.ts +1 -1
  275. package/dist/src/voice/tts/factory.js +23 -1
  276. package/dist/src/voice/tts/merge-config.js +5 -3
  277. package/dist/src/voice/tts/providers/xopc-cloud-speech.js +3 -1
  278. package/dist/src/voice/tts/types.d.ts +2 -0
  279. package/dist/src/voice/tts/types.js +4 -2
  280. package/dist/src/work-discovery/evaluation.d.ts +23 -0
  281. package/dist/src/work-discovery/evaluation.js +18 -1
  282. package/dist/src/work-discovery/index.js +2 -2
  283. package/package.json +4 -3
  284. package/dist/gateway/static/root/assets/agents-Bl8FQZxW.js +0 -68
  285. package/dist/gateway/static/root/assets/apps-page-CRUgTO10.js +0 -1
  286. package/dist/gateway/static/root/assets/automations-page-DrSwolhG.js +0 -6
  287. package/dist/gateway/static/root/assets/browser-settings-page-NlvDyMwD.js +0 -8
  288. package/dist/gateway/static/root/assets/capabilities-settings-panel-BWXUznw5.js +0 -7
  289. package/dist/gateway/static/root/assets/capability-presets-settings-panel-D0loEbzq.js +0 -3
  290. package/dist/gateway/static/root/assets/channels-settings-CcivCw8U.js +0 -1
  291. package/dist/gateway/static/root/assets/channels-status-swr-DkHAD2Zn.js +0 -1
  292. package/dist/gateway/static/root/assets/chat-terminal-dock-DVedGAeX.js +0 -36
  293. package/dist/gateway/static/root/assets/connectors-page-DlBSlfkv.js +0 -2
  294. package/dist/gateway/static/root/assets/heartbeat-settings-UZAn1aAQ.js +0 -1
  295. package/dist/gateway/static/root/assets/home-page-CRJDpy5E.js +0 -3
  296. package/dist/gateway/static/root/assets/index-BSjP0Wsx.css +0 -2
  297. package/dist/gateway/static/root/assets/index-C2ZYFBGL.js +0 -85
  298. package/dist/gateway/static/root/assets/local-app-workbench-page-D9bguWRo.js +0 -2
  299. package/dist/gateway/static/root/assets/logs-page-Gr-nE4nW.js +0 -2
  300. package/dist/gateway/static/root/assets/markdown-view-B12xeflb.css +0 -1
  301. package/dist/gateway/static/root/assets/messages-yG5P43Q9.js +0 -3
  302. package/dist/gateway/static/root/assets/notes-workbench-CpbD4XG2.js +0 -4
  303. package/dist/gateway/static/root/assets/project-detail-page-GvSYDbjR.js +0 -1
  304. package/dist/gateway/static/root/assets/projects-page-DPRxKGbs.js +0 -1
  305. package/dist/gateway/static/root/assets/remote-access-hub-WIzeu-gB.js +0 -1
  306. package/dist/gateway/static/root/assets/sessions-page-2XEJM0YE.js +0 -1
  307. package/dist/gateway/static/root/assets/settings-advanced-gate-g1GThZ0O.js +0 -1
  308. package/dist/gateway/static/root/assets/setup-status-panel-C6qj2L-q.js +0 -1
  309. package/dist/gateway/static/root/assets/shares-settings-BBpE1bep.js +0 -1
  310. package/dist/gateway/static/root/assets/skill-reload-api-DXORBJNk.js +0 -1
  311. package/dist/gateway/static/root/assets/task-detail-page-DC0hc8hp.js +0 -1
  312. package/dist/gateway/static/root/assets/user-context-page-Bwg4KV8B.js +0 -1
  313. package/dist/gateway/static/root/assets/work-discovery-page-CmPfOfHl.js +0 -1
  314. package/dist/gateway/static/root/assets/workflows-page-DhQNh7W6.js +0 -5
  315. package/dist/src/voice/local/runtime-dispatcher.d.ts +0 -9
  316. package/dist/src/voice/local/runtime-dispatcher.js +0 -20
@@ -0,0 +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,f as a,t as o}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{n as s,r as c}from"./popover-select-BzdnTy3h.js";import{t as l}from"./external-link-DjqjBmc3.js";import{f as u,u as d}from"./markdown-view-V4rcPPH0.js";import{t as f}from"./x-B_N4OPjy.js";import{t as p}from"./cn-JdwAhgNB.js";import{t as m}from"./button-CSEbl4zT.js";import{l as h,n as g}from"./locale-store-C5MK9WcP.js";import{i as _,n as ee,o as te,r as ne,s as re,t as v}from"./dist-BPoKqzeH.js";import{$n as ie,$t as ae,A as oe,Al as y,Cl as se,Da as b,H as ce,Ha as x,K as S,M as le,Oa as C,Qc as ue,Ql as de,Qn as fe,Qs as w,Qt as pe,R as T,Sl as E,W as D,Zc as me,Zn as O,cl as he,en as ge,er as _e,et as k,ic as A,ii as j,mc as M,n as N,nr as P,pa as F,q as ve,vi as ye,wr as be,yi as I}from"./index-_cuTcWjB.js";import{t as xe}from"./date-picker-DyNogHQH.js";import{t as L}from"./dependency-picker-BpnCuo7B.js";var R=e(t(),1),z=n();function Se(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Ce(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}var B=r();function we(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function Te(){let e=(0,z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,B.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,B.jsx)(C,{className:`h-32 rounded-2xl`}),(0,B.jsx)(C,{className:`h-52 rounded-2xl`}),(0,B.jsx)(C,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Ee(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function De(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var Oe=[`backlog`,`ready`,`active`,`review`,`closed`],ke=[`low`,`normal`,`high`,`critical`],Ae=(0,R.memo)(function(e){let t=(0,z.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:l,label:u,onChange:d}=e,f;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(f=e=>e!==n&&(e===`closed`?!a:n===`closed`?!o:!i),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=f):f=t[4];let p=f,m;t[5]===u?m=t[6]:(m=(0,B.jsx)(`span`,{children:u}),t[5]=u,t[6]=m);let h;t[7]===d?h=t[8]:(h=e=>d(e.target.value),t[7]=d,t[8]=h);let g;t[9]!==l||t[10]!==p?(g=Oe.map(e=>(0,B.jsx)(c,{value:e,disabled:p(e),children:we(e,l)},e)),t[9]=l,t[10]=p,t[11]=g):g=t[11];let _;t[12]!==r||t[13]!==h||t[14]!==g||t[15]!==n?(_=(0,B.jsx)(s,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:h,children:g}),t[12]=r,t[13]=h,t[14]=g,t[15]=n,t[16]=_):_=t[16];let ee;return t[17]!==m||t[18]!==_?(ee=(0,B.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=ee):ee=t[19],ee}),je=(0,R.memo)(function(e){let t=(0,z.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,l;t[0]===i?l=t[1]:(l=(0,B.jsx)(`span`,{children:i}),t[0]=i,t[1]=l);let u;t[2]===o?u=t[3]:(u=e=>o(e.target.value),t[2]=o,t[3]=u);let d;t[4]===a?d=t[5]:(d=ke.map(e=>(0,B.jsx)(c,{value:e,children:a[e]},e)),t[4]=a,t[5]=d);let f;t[6]!==r||t[7]!==u||t[8]!==d||t[9]!==n?(f=(0,B.jsx)(s,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:u,children:d}),t[6]=r,t[7]=u,t[8]=d,t[9]=n,t[10]=f):f=t[10];let p;return t[11]!==l||t[12]!==f?(p=(0,B.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[l,f]}),t[11]=l,t[12]=f,t[13]=p):p=t[13],p}),Me=(0,R.memo)(function(e){let t=(0,z.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,B.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,B.jsx)(xe,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,B.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),Ne=(0,R.memo)(function(e){let t=(0,z.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:l}=e,u;t[0]===i?u=t[1]:(u=(0,B.jsx)(`span`,{children:i}),t[0]=i,t[1]=u);let d;t[2]===l?d=t[3]:(d=e=>l(e.target.value),t[2]=l,t[3]=d);let f;t[4]===a?f=t[5]:(f=(0,B.jsx)(c,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=f);let p;t[6]===o?p=t[7]:(p=o.map(Ye),t[6]=o,t[7]=p);let m;t[8]!==r||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==n?(m=(0,B.jsxs)(s,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:d,children:[f,p]}),t[8]=r,t[9]=d,t[10]=f,t[11]=p,t[12]=n,t[13]=m):m=t[13];let h;return t[14]!==u||t[15]!==m?(h=(0,B.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[u,m]}),t[14]=u,t[15]=m,t[16]=h):h=t[16],h}),Pe=(0,R.memo)(function(e){let t=(0,z.c)(8),{candidates:n,selected:r,disabled:i,labels:a,onChange:o}=e,s;t[0]===r?s=t[1]:(s=r.map(Xe),t[0]=r,t[1]=s);let c;return t[2]!==n||t[3]!==i||t[4]!==a||t[5]!==o||t[6]!==s?(c=(0,B.jsx)(L,{borderless:!0,candidates:n,selectedIds:s,disabled:i,onChange:o,labels:a}),t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c):c=t[7],c},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),Fe=`xopc.taskDetail.chatPanelPercent`,Ie=42;function Le(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?Ie:Math.min(r,Math.max(n,e))}function Re(){try{let e=Number(window.localStorage.getItem(Fe));return Number.isFinite(e)&&e>=30&&e<=60?e:Ie}catch{return Ie}}function ze(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`)?`needsUser`:e.operationalState===`idle`?e.task.phase===`backlog`?`captured`:e.task.phase===`ready`?`ready`:e.task.phase===`review`?`review`:`paused`:e.operationalState}function V(e){let t=(0,z.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,B.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=i?.get(e)??`unverified`;return(0,B.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,B.jsx)(t===`passed`?y:t===`failed`?se:E,{className:t===`passed`?`mt-1 size-4 shrink-0 text-success`:t===`failed`?`mt-1 size-4 shrink-0 text-danger`:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,B.jsx)(`span`,{children:e})]},e)},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,B.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function H({taskId:e,presentation:t,backgroundPath:n}){let[r]=a(),i=g(e=>e.language),s=h(e=>e.token),c=(0,R.useMemo)(()=>ve(i),[i]),f=x(e=>e.setPageHeader),_=x(e=>e.clearPageHeader),ee=I(e=>e.open),te=I(e=>e.sessionKeyOverride),ne=I(e=>e.openForSession),re=be(e=>e.setOpen),{data:v,error:se,mutate:C,lastChange:E,conversationLoading:ge,conversationError:ye}=oe(e),[xe,L]=(0,R.useState)(null),[z,we]=(0,R.useState)(()=>new Set),[Oe,ke]=(0,R.useState)([]),[H,Be]=(0,R.useState)(null),[Ve,He]=(0,R.useState)([]),[Ue,U]=(0,R.useState)(!1),[We,Ge]=(0,R.useState)(``),[Ke,W]=(0,R.useState)(!1),[qe,Je]=(0,R.useState)(``),[G,Ye]=(0,R.useState)(Re),[Xe,Ze]=(0,R.useState)(!1),Qe=(0,R.useRef)(null),$e=(0,R.useRef)(!1),et=(0,R.useRef)(!1),tt=(0,R.useRef)(``),nt=(0,R.useRef)(null),rt=(0,R.useRef)(null),it=(0,R.useRef)(null),at=(0,R.useRef)(v),[ot,K]=(0,R.useState)(null),[st,ct]=(0,R.useState)(null),lt=(0,R.useMemo)(()=>({link:c.linkDependencies,linked:c.linkedDependencies,searchPlaceholder:c.dependencySearchPlaceholder,noMatches:c.noDependencyMatches,noCandidates:c.noDependencyCandidates,remove:c.removeDependency}),[c.dependencySearchPlaceholder,c.linkDependencies,c.linkedDependencies,c.noDependencyCandidates,c.noDependencyMatches,c.removeDependency]),ut=v?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,dt=(0,R.useMemo)(()=>d(r.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[r]);at.current=v;let q=(0,R.useCallback)((e,t)=>{we(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,R.useEffect)(()=>{L(null),K(null),U(!1),W(!1),ct(null)},[e]),(0,R.useEffect)(()=>{let e=!0;return b().then(t=>{e&&He(t.items)}).catch(()=>void 0),()=>{e=!1}},[s]),(0,R.useEffect)(()=>{if(!E||E.source===`user`)return;ct(E);let e=window.setTimeout(()=>ct(null),3500);return()=>window.clearTimeout(e)},[E]),(0,R.useEffect)(()=>{let t=v?.task.projectId,n=v?.dependencies??[];if(!t){it.current=null,Be(null),ke(n);return}it.current!==t&&(it.current=t,Be(null));let r=!0;return F(t).then(t=>{if(!r)return;Be(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});ke([...i.values()])}).catch(()=>{r&&ke(n)}),()=>{r=!1}},[ut,v?.task.projectId,e]);let J=(0,R.useCallback)(async(t,n=`command`)=>{let r=at.current;if(r){q(n,!0),L(null);try{await C(await le(e,t,r.task.version),{revalidate:!1})}catch{L(c.actionFailed)}finally{q(n,!1)}}},[c.actionFailed,C,q,e]),Y=(0,R.useCallback)(async(t,n)=>{let r=at.current;if(!r)return!1;n&&q(n,!0),L(null);try{return await C(D(e,t,r.task.version),{optimisticData:Ce(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return L(c.actionFailed),!1}finally{n&&q(n,!1)}},[c.actionFailed,C,q,e]),ft=async()=>{if(!v)return;if($e.current){$e.current=!1;return}let e=We.trim(),t=nt.current;if(Se(t,v.task.version,v.task.title,e)){K(`title`);return}if(!e||e===v.task.title){Ge(v.task.title),U(!1);return}await Y({title:e})&&(K(null),U(!1))},pt=async()=>{if(!v)return;if(et.current){et.current=!1;return}let e=qe.trim(),t=rt.current;if(Se(t,v.task.version,v.task.body??``,e)){K(`description`);return}if(qe===tt.current||e===(v.task.body??``).trim()){W(!1);return}await Y({body:e||null})&&(K(null),W(!1))},mt=(0,R.useCallback)(async e=>{let t=at.current;if(!(!t||e===t.task.phase)){if(t.task.phase===`closed`){await J({type:`reopen`,phase:e===`closed`?`ready`:e},`phase`);return}if(e===`closed`){await J({type:`close`,resolution:`done`},`phase`);return}await J({type:`move`,phase:e},`phase`)}},[J]),ht=(0,R.useCallback)(e=>{Y({priority:e},`priority`)},[Y]),gt=(0,R.useCallback)(e=>{Y({dueAt:De(e)},`dueAt`)},[Y]),_t=(0,R.useCallback)(e=>{Ye(e);try{window.localStorage.setItem(Fe,String(e))}catch{}},[]),vt=(0,R.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=Qe.current?.clientWidth??0;_t(Le(e.key===`Home`?Ie:G+(e.key===`ArrowLeft`?2:-2),t))},[G,_t]),yt=(0,R.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=Qe.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),Ze(!0);let i=G,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=Le((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}Ze(!1),_t(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[G,_t]),bt=(0,R.useCallback)(async t=>{let n=at.current;if(n){q(`dependencies`,!0),L(null);try{await C(await S(e,t,n.task.version),{revalidate:!1})}catch{L(c.dependencyUpdateFailed)}finally{q(`dependencies`,!1)}}},[c.dependencyUpdateFailed,C,q,e]),xt=(0,R.useCallback)(async t=>{let n=at.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){q(`delegateAgentId`,!0),L(null);try{await C(await T(e,t,n.task.version),{revalidate:!1})}catch{L(c.actionFailed)}finally{q(`delegateAgentId`,!1)}}},[c.actionFailed,C,q,e]);if((0,R.useLayoutEffect)(()=>{if(t!==`modal`)return f({startExtra:(0,B.jsx)(o,{to:dt,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":c.backToWork,children:(0,B.jsx)(de,{className:`size-4`})}),main:v?(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:H?`${H} / ${c.taskLabel}`:c.taskLabel}),(0,B.jsx)(`p`,{className:`text-xs text-fg-muted`,children:c.detailStatuses[ze(v)]})]}):null,end:null}),_},[_,c.backToWork,c.detailStatuses,c.taskLabel,v,t,H,dt,f]),se&&!v)return(0,B.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:c.taskNotFound});if(!v)return(0,B.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,B.jsx)(Te,{})});let St=v.waits[0],Ct=St?.kind===`paused`?St:void 0,X=v.receipts[0],wt=c.detailStatuses[ze(v)],Tt=c.detailStatusDescriptions[ze(v)],Et=v.task.body?.trim()||v.task.contract?.objective.trim(),Dt=new Map(X?.verification.checks.map(e=>[e.criterion,e.status])),Ot=v.allowedCommands.includes(`mark_ready`),kt=v.allowedCommands.includes(`start`),At=v.allowedCommands.includes(`add_wait`),jt=v.task.phase===`review`&&v.allowedCommands.includes(`close`),Mt=v.allowedCommands.includes(`reopen`),Z=v.conversation.activeSessionKey,Nt=v.conversation.currentExecutorAgentId??v.task.delegateAgentId??v.task.ownerId,Pt=Ve.find(e=>e.id===Nt),Ft=!!(Z&&ee&&te===Z),It=v.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),Lt=v.task.contract?.acceptanceCriteria??[],Rt=Lt.filter(e=>Dt.get(e)===`passed`).length,zt=v.task.contract?.expectedOutputs??[],Bt=v.task.contract?.constraints??[],Vt=v.task.contract?.approvalRequired??[],Ht=v.task.contract?.assumptions??[],Ut=v.task.contract?.risks??[],Q=(...e)=>!!st?.changedFields.some(t=>e.includes(t)),Wt=e=>t===`modal`&&n?ae(n,e):u(`/tasks/${e}`,dt),Gt=v.allowedCommands.includes(`move`),$=z.has(`command`),Kt=(0,B.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Ot?(0,B.jsxs)(m,{variant:`primary`,disabled:$,onClick:()=>void J({type:`mark_ready`}),children:[(0,B.jsx)(w,{className:`size-4`}),c.scheduleTask]}):null,Ct?(0,B.jsxs)(m,{variant:`primary`,disabled:$,onClick:()=>void J({type:`resolve_wait`,waitId:Ct.id}),children:[(0,B.jsx)(w,{className:`size-4`}),c.resumeTask]}):null,!St&&kt&&Nt?(0,B.jsxs)(m,{variant:`primary`,disabled:$,onClick:()=>void J({type:`start`,executor:{kind:`agent`,agentId:Nt}}),children:[(0,B.jsx)(w,{className:`size-4`}),c.runTask]}):null,jt?(0,B.jsxs)(m,{variant:`primary`,disabled:$,onClick:()=>void J({type:`close`,resolution:`done`}),children:[(0,B.jsx)(y,{className:`size-4`}),c.approveTask]}):null,Mt?(0,B.jsxs)(m,{variant:`primary`,disabled:$,onClick:()=>void J({type:`reopen`,phase:`ready`}),children:[(0,B.jsx)(w,{className:`size-4`}),c.reopenTask]}):null,!St&&At?(0,B.jsxs)(m,{variant:`secondary`,className:`border-0 bg-surface-hover shadow-none`,disabled:$,onClick:()=>void J({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,B.jsx)(A,{className:`size-4`}),c.pauseTask]}):null,v.task.phase===`closed`?null:(0,B.jsxs)(_e,{children:[(0,B.jsx)(P,{asChild:!0,children:(0,B.jsx)(m,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:$,"aria-label":c.moreActions,children:(0,B.jsx)(he,{className:`size-4`,"aria-hidden":!0})})}),(0,B.jsx)(ie,{children:(0,B.jsx)(O,{align:`end`,sideOffset:6,className:`z-[100] min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:(0,B.jsx)(fe,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void J({type:`close`,resolution:`cancelled`}),children:c.cancelTask})})})]})]});return(0,B.jsxs)(`div`,{ref:Qe,className:`${t===`modal`?`flex h-full min-h-0 flex-col lg:flex-row`:`flex min-h-[calc(100dvh-8rem)] flex-col overflow-hidden lg:flex-row`} ${Xe?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${G}%`},children:[(0,B.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,B.jsxs)(`header`,{className:p(`px-4 pb-5`,Q(`title`)&&`task-detail-live-update`),children:[(0,B.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[H?(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(ue,{className:`size-3.5`,"aria-hidden":!0}),H]}):null,(0,B.jsx)(`span`,{children:`/`}),(0,B.jsx)(`span`,{children:c.taskLabel}),st?(0,B.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:st.source===`agent`?i===`zh`?`Agent 刚刚更新`:`Updated by Agent`:i===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),Ue?(0,B.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:We,onChange:e=>Ge(e.target.value),onBlur:()=>void ft(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),$e.current=!0,Ge(v.task.title),U(!1),queueMicrotask(()=>{$e.current=!1}))},className:`mt-3 w-full max-w-3xl rounded-lg bg-surface-hover px-3 py-2 text-2xl font-semibold leading-8 text-fg outline-none ring-2 ring-accent/30 focus:ring-accent/60`}):(0,B.jsx)(`button`,{type:`button`,className:`mt-3 block max-w-3xl rounded-lg text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{nt.current={value:v.task.title,version:v.task.version},K(null),Ge(v.task.title),U(!0)},children:(0,B.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:v.task.title})}),ot===`title`?(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,B.jsx)(`span`,{children:i===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{Ge(v.task.title),K(null),U(!1)},children:i===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({title:We.trim()}).then(e=>{e&&(K(null),U(!1))}),children:i===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),xe?(0,B.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:xe}):null]}),(0,B.jsxs)(`div`,{className:`mt-5 flex flex-col gap-5`,children:[(0,B.jsxs)(`main`,{className:`order-2 min-w-0 space-y-5`,children:[(0,B.jsxs)(`section`,{className:p(`rounded-xl bg-surface-panel p-4`,Q(`body`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskDescription}),Ke?(0,B.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:qe,onChange:e=>Je(e.target.value),onBlur:()=>void pt(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),et.current=!0,Je(v.task.body??v.task.contract?.objective??``),W(!1),queueMicrotask(()=>{et.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,B.jsx)(`button`,{type:`button`,className:`-mx-1 mt-2 block w-[calc(100%+0.5rem)] rounded-lg px-1 py-1 text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=v.task.body??v.task.contract?.objective??``;tt.current=e,rt.current={value:v.task.body??``,version:v.task.version},K(null),Je(e),W(!0)},children:(0,B.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:Et&&Et!==v.task.title?Et:c.noTaskDescription})}),ot===`description`?(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,B.jsx)(`span`,{children:i===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{Je(v.task.body??``),K(null),W(!1)},children:i===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,B.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void Y({body:qe.trim()||null}).then(e=>{e&&(K(null),W(!1))}),children:i===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),v.attention.length>0?(0,B.jsxs)(`section`,{className:p(`rounded-xl bg-warning/10 p-4`,Q(`attention`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h3`,{className:`font-medium text-fg`,children:It?c.needsAttention:c.waitingStatus}),(0,B.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:v.attention.map((e,t)=>(0,B.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,B.jsxs)(`section`,{className:p(`rounded-xl bg-surface-panel p-4`,Q(`contract`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskDefinition}),(0,B.jsxs)(`div`,{className:`mt-5`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:c.successDefinition}),Lt.length>0?(0,B.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:c.criteriaProgress.replace(`{{verified}}`,String(Rt)).replace(`{{total}}`,String(Lt.length))}):null]}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(V,{items:Lt,empty:c.noDefinition,verificationByCriterion:Dt})})]}),zt.length>0?(0,B.jsxs)(`div`,{className:`mt-5 rounded-lg bg-surface-hover p-4`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:c.expectedOutputs}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(V,{items:zt,empty:c.noDefinition})})]}):null,Bt.length>0?(0,B.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.constraints}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(V,{items:Bt,empty:c.noDefinition})})]}):null,Vt.length>0?(0,B.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.approvalRequired}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(V,{items:Vt,empty:c.noDefinition})})]}):null,Ht.length>0?(0,B.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.contextAssumptions}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(V,{items:Ht,empty:c.noDefinition})})]}):null,Ut.length>0?(0,B.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.contextRisks}),(0,B.jsx)(`div`,{className:`mt-3`,children:(0,B.jsx)(V,{items:Ut,empty:c.noDefinition})})]}):null]}),X?(0,B.jsxs)(`section`,{className:p(`rounded-xl bg-surface-panel p-4`,Q(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,B.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`font-medium text-fg`,children:c.latestResult}),(0,B.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg`,children:X.summary})]}),(0,B.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[c.receiptStatuses[X.status],` · `,c.verificationStatuses[X.verification.status]]})]}),X.remainingWork.length>0?(0,B.jsxs)(`div`,{className:`mt-4`,children:[(0,B.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:c.remainingWork}),(0,B.jsx)(`div`,{className:`mt-2`,children:(0,B.jsx)(V,{items:X.remainingWork,empty:c.noRemainingWork})})]}):null,X.nextAction?(0,B.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,B.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:c.nextAction}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:X.nextAction})]}):null,(0,B.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(m,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void ce(X.runId,`helpful`),children:c.doneWell}),(0,B.jsx)(m,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void ce(X.runId,`not_helpful`),children:c.needsFix}),X.evidence.filter(e=>e.uri).map(e=>(0,B.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,B.jsx)(l,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),v.receipts.length>1?(0,B.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,B.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:c.executionHistory.replace(`{{count}}`,String(v.receipts.length-1))}),(0,B.jsx)(`div`,{className:`mt-3 space-y-3`,children:v.receipts.slice(1).map(e=>(0,B.jsx)(`article`,{className:`rounded-lg bg-surface-active p-3`,children:(0,B.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,B.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,B.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:c.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,v.context.length>0?(0,B.jsxs)(`section`,{className:p(`rounded-xl bg-surface-panel p-4`,Q(`context`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`font-medium text-fg`,children:c.contextUsed}),(0,B.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:v.context.map(e=>(0,B.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,B.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[c.contextRoleLabels[e.role],` · `,c.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,B.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,B.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,B.jsxs)(`aside`,{className:`order-1 min-w-0 space-y-4`,children:[(0,B.jsxs)(`section`,{className:p(`rounded-xl bg-surface-subtle p-4`,Q(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskProperties}),(0,B.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,B.jsx)(Ae,{value:v.task.phase,disabled:z.has(`phase`),canMove:Gt,canApprove:jt,canReopen:Mt,language:i,label:c.taskPhase,onChange:mt}),(0,B.jsx)(je,{value:v.task.priority,disabled:z.has(`priority`),label:c.priority,labels:c.priorityLabels,onChange:ht}),(0,B.jsx)(Me,{value:Ee(v.task.dueAt),disabled:z.has(`dueAt`),label:c.dueDate,onChange:gt}),(0,B.jsx)(Ne,{value:v.conversation.currentExecutorAgentId??``,disabled:z.has(`delegateAgentId`),label:c.executorLabel,unassignedLabel:c.unassigned,agents:Ve,onChange:xt}),H?(0,B.jsxs)(`div`,{className:`grid gap-1 text-xs text-fg-muted`,children:[(0,B.jsx)(`span`,{children:c.projectLabel}),(0,B.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-lg bg-surface-hover px-3 py-2 text-sm text-fg`,children:[(0,B.jsx)(ue,{className:`size-3.5`}),H]})]}):null]}),(0,B.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3 text-xs leading-5 text-fg-subtle`,children:[(0,B.jsx)(`p`,{children:wt}),(0,B.jsx)(`p`,{children:Tt}),(0,B.jsx)(`p`,{className:`mt-2`,children:c.updatedAt.replace(`{{date}}`,j(v.task.updatedAt,i))})]})]}),(0,B.jsxs)(`section`,{className:p(`rounded-xl bg-surface-panel p-4`,Q(`dependencies`)&&`task-detail-live-update`),children:[(0,B.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskRelations}),(0,B.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:c.dependencies}),(0,B.jsx)(Pe,{candidates:Oe,selected:v.dependencies,disabled:z.has(`dependencies`),labels:lt,onChange:bt})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:c.dependents}),v.dependents.length>0?(0,B.jsx)(`div`,{className:`space-y-1.5`,children:v.dependents.map(e=>(0,B.jsx)(o,{to:Wt(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:e.title},e.id))}):(0,B.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:c.noDependents})]})]})]})]})]})]}),(0,B.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":i===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(G),tabIndex:0,onPointerDown:yt,onKeyDown:vt,onDoubleClick:()=>_t(Ie),className:`group hidden w-2 shrink-0 cursor-col-resize touch-none items-stretch justify-center bg-surface-panel outline-none transition-colors hover:bg-surface-hover focus-visible:bg-surface-hover lg:flex ${Xe?`bg-surface-hover`:``}`,children:(0,B.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,B.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:shrink-0`,children:[(0,B.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,B.jsx)(`div`,{className:`min-w-0`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Nt?(0,B.jsx)(k,{agentId:Nt,avatar:Pt?.avatar,size:28,className:`shrink-0`}):null,(0,B.jsxs)(`div`,{className:`min-w-0`,children:[(0,B.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:i===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,B.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[Pt?.name??Nt??c.unassigned,` · `,wt]})]})]})}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[Kt,Z&&t!==`modal`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(m,{type:`button`,variant:`ghost`,className:p(`h-8 shrink-0 px-2 text-xs`,Ft&&`bg-surface-hover text-fg`),"aria-label":i===`zh`?`项目文件`:`Project files`,"aria-pressed":Ft,onClick:()=>{re(Z,!1),ne(Z)},children:[(0,B.jsx)(me,{className:`size-3.5`,"aria-hidden":!0}),i===`zh`?`文件`:`Files`]}),(0,B.jsx)(m,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,B.jsxs)(o,{to:pe(e),children:[(0,B.jsx)(l,{className:`size-3.5`}),i===`zh`?`全屏`:`Full screen`]})})]}):null]})]}),Z?(0,B.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,B.jsx)(N,{embedded:!0,sessionKey:Z,taskId:e})}):ge?(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,B.jsxs)(`div`,{className:`max-w-xs`,children:[(0,B.jsx)(M,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,B.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):ye?(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,B.jsxs)(`div`,{className:`max-w-xs`,children:[(0,B.jsx)(M,{className:`mx-auto size-8 text-danger`}),(0,B.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,B.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:ye instanceof Error?ye.message:String(ye)})]})}):(0,B.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,B.jsxs)(`div`,{className:`max-w-xs`,children:[(0,B.jsx)(M,{className:`mx-auto size-8 text-fg-subtle`}),(0,B.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,B.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:i===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]})]})}function Be(){let e=(0,z.c)(2),{taskId:t}=i(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,B.jsx)(H,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function Ve(e){let t=(0,z.c)(54),{taskId:n,backgroundPath:r,onClose:i}=e,a=g(G),{data:s}=oe(n),c=s?.conversation.activeSessionKey??null,u=I(Je),d=I(qe),m=I(W),h=I(Ke),ie=be(Ge),ae=ye(We),y=ye(U),se=u?d:0,b;t[0]!==i||t[1]!==y?(b=e=>{e||(y(null),i())},t[0]=i,t[1]=y,t[2]=b):b=t[2];let ce=a===`zh`?`关闭任务详情`:`Close task details`,x;t[3]!==i||t[4]!==y?(x=()=>{y(null),i()},t[3]=i,t[4]=y,t[5]=x):x=t[5];let S;t[6]!==ce||t[7]!==x?(S=(0,B.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`,"aria-label":ce,onClick:x}),t[6]=ce,t[7]=x,t[8]=S):S=t[8];let le=u?`true`:`false`,C=`${se/2}px`,ue=`${se}px`,de;t[9]!==C||t[10]!==ue?(de={"--task-detail-workspace-offset":C,"--task-detail-workspace-width":ue},t[9]=C,t[10]=ue,t[11]=de):de=t[11];let fe=de,w=a===`zh`?`任务详情`:`Task details`,T;t[12]===w?T=t[13]:(T=(0,B.jsx)(re,{className:`font-medium text-fg`,children:w}),t[12]=w,t[13]=T);let E=a===`zh`?`查看并操作任务详情`:`View and manage task details`,D;t[14]===E?D=t[15]:(D=(0,B.jsx)(_,{className:`sr-only`,children:E}),t[14]=E,t[15]=D);let O;t[16]!==c||t[17]!==a||t[18]!==h||t[19]!==ie||t[20]!==n||t[21]!==u||t[22]!==m?(O=c?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`button`,{type:`button`,className:p(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,u&&m===c&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":u&&m===c,onClick:()=>{ie(c,!1),h(c)},children:(0,B.jsx)(me,{className:`size-4`,"aria-hidden":!0})}),(0,B.jsx)(o,{to:pe(n),className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a===`zh`?`全屏打开对话`:`Open chat full screen`,title:a===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,B.jsx)(l,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=c,t[17]=a,t[18]=h,t[19]=ie,t[20]=n,t[21]=u,t[22]=m,t[23]=O):O=t[23];let he=a===`zh`?`关闭任务详情`:`Close task details`,_e;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(_e=(0,B.jsx)(f,{className:`size-4`,"aria-hidden":!0}),t[24]=_e):_e=t[24];let k;t[25]===he?k=t[26]:(k=(0,B.jsx)(ee,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":he,children:_e}),t[25]=he,t[26]=k);let A;t[27]!==O||t[28]!==k?(A=(0,B.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[O,k]}),t[27]=O,t[28]=k,t[29]=A):A=t[29];let j;t[30]!==T||t[31]!==D||t[32]!==A?(j=(0,B.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[T,D,A]}),t[30]=T,t[31]=D,t[32]=A,t[33]=j):j=t[33];let M;t[34]!==r||t[35]!==n?(M=(0,B.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,B.jsx)(H,{taskId:n,presentation:`modal`,backgroundPath:r})}),t[34]=r,t[35]=n,t[36]=M):M=t[36];let N;t[37]!==j||t[38]!==M||t[39]!==le||t[40]!==fe?(N=(0,B.jsxs)(ne,{className:`task-detail-modal-content fixed top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl bg-surface-base shadow-float focus:outline-none`,"data-workspace-panel-open":le,style:fe,onEscapeKeyDown:Ue,onInteractOutside:He,children:[j,M]}),t[37]=j,t[38]=M,t[39]=le,t[40]=fe,t[41]=N):N=t[41];let P;t[42]!==ae||t[43]!==u||t[44]!==d||t[45]!==m?(P=ae?(0,B.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-[100] flex min-h-0 min-w-0 overflow-hidden bg-surface-panel transition-[right] duration-200 ease-out motion-reduce:transition-none`,style:{right:u?d:0},children:(0,B.jsx)(ge,{allowOutsideChat:!0,sessionKey:m??void 0})}):null,t[42]=ae,t[43]=u,t[44]=d,t[45]=m,t[46]=P):P=t[46];let F;t[47]!==N||t[48]!==P||t[49]!==S?(F=(0,B.jsxs)(te,{children:[S,N,P]}),t[47]=N,t[48]=P,t[49]=S,t[50]=F):F=t[50];let ve;return t[51]!==b||t[52]!==F?(ve=(0,B.jsx)(v,{modal:!1,open:!0,onOpenChange:b,children:F}),t[51]=b,t[52]=F,t[53]=ve):ve=t[53],ve}function He(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function Ue(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function U(e){return e.setPath}function We(e){return e.path}function Ge(e){return e.setOpen}function Ke(e){return e.openForSession}function W(e){return e.sessionKeyOverride}function qe(e){return e.widthPx}function Je(e){return e.open}function G(e){return e.language}function Ye(e){return(0,B.jsx)(c,{value:e.id,children:e.name||e.id},e.id)}function Xe(e){return e.id}export{Ve as TaskDetailModal,Be as TaskDetailPage};
@@ -1 +1 @@
1
- import{p as e}from"./locale-store-pByvK12G.js";import{t}from"./middleware-Pd0e8Igk.js";var n=`default`,r={light:{default:`#ffffff`,emerald:`#f0fdf4`,mono:`#ffffff`,clay:`#fffaf0`},dark:{default:`#0a0a0a`,emerald:`#000000`,mono:`#101010`,clay:`#0a1a1a`}};function i(e,t){let n=document.head;if(!n)return;let i=n.querySelector(`meta[name="theme-color"][data-xopc-theme-color="true"]`);i||(i=document.createElement(`meta`),i.setAttribute(`name`,`theme-color`),i.setAttribute(`data-xopc-theme-color`,`true`),n.appendChild(i)),i.setAttribute(`content`,r[e][t])}function a(){return globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}function o(e){return e===`system`?a()?`dark`:`light`:e}function s(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function c(e){return e===`cal`?`mono`:e==="default"||e===`emerald`||e===`mono`||e===`clay`?e:n}function l(e,t,n){let r=document.documentElement,a=()=>{r.classList.toggle(`dark`,e===`dark`),r.dataset.theme=e,r.dataset.colorScheme=t,i(e,t)},o=document;n&&!s()&&typeof o.startViewTransition==`function`?o.startViewTransition(a):a()}function u(){try{let e=localStorage.getItem(`xopc-web-theme`),t=`system`,r=n;if(e){let n=JSON.parse(e);n.state?.preference&&(t=n.state.preference),n.state&&`colorScheme`in n.state&&(r=c(n.state.colorScheme))}l(o(t),r,!1)}catch{l(o(`system`),`default`,!1)}}var d=e(t((e,t)=>({preference:`system`,colorScheme:n,resolved:o(`system`),setPreference:n=>{let r=o(n),{resolved:i,colorScheme:a}=t();l(r,a,r!==i),e({preference:n,resolved:r})},setColorScheme:n=>{let{resolved:r}=t();l(r,n,!0),e({colorScheme:n})}}),{name:`xopc-web-theme`,merge:(e,t)=>{let n=e??{};return{...t,...n,colorScheme:c(n.colorScheme)}}}));function f(){let{preference:e,colorScheme:t}=d.getState(),n=o(e);l(n,t,!1),d.setState({resolved:n})}function p(){let e=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`);if(!e)return()=>{};let t=()=>{let{preference:e,colorScheme:t}=d.getState();if(e!==`system`)return;let n=o(`system`),r=d.getState().resolved;l(n,t,n!==r),d.setState({resolved:n})};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}export{d as i,p as n,f as r,u as t};
1
+ import{p as e}from"./locale-store-C5MK9WcP.js";import{t}from"./middleware-Pd0e8Igk.js";var n=`default`,r={light:{default:`#ffffff`,emerald:`#f0fdf4`,mono:`#ffffff`,clay:`#fffaf0`},dark:{default:`#0a0a0a`,emerald:`#000000`,mono:`#101010`,clay:`#0a1a1a`}};function i(e,t){let n=document.head;if(!n)return;let i=n.querySelector(`meta[name="theme-color"][data-xopc-theme-color="true"]`);i||(i=document.createElement(`meta`),i.setAttribute(`name`,`theme-color`),i.setAttribute(`data-xopc-theme-color`,`true`),n.appendChild(i)),i.setAttribute(`content`,r[e][t])}function a(){return globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}function o(e){return e===`system`?a()?`dark`:`light`:e}function s(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function c(e){return e===`cal`?`mono`:e==="default"||e===`emerald`||e===`mono`||e===`clay`?e:n}function l(e,t,n){let r=document.documentElement,a=()=>{r.classList.toggle(`dark`,e===`dark`),r.dataset.theme=e,r.dataset.colorScheme=t,i(e,t)},o=document;n&&!s()&&typeof o.startViewTransition==`function`?o.startViewTransition(a):a()}function u(){try{let e=localStorage.getItem(`xopc-web-theme`),t=`system`,r=n;if(e){let n=JSON.parse(e);n.state?.preference&&(t=n.state.preference),n.state&&`colorScheme`in n.state&&(r=c(n.state.colorScheme))}l(o(t),r,!1)}catch{l(o(`system`),`default`,!1)}}var d=e(t((e,t)=>({preference:`system`,colorScheme:n,resolved:o(`system`),setPreference:n=>{let r=o(n),{resolved:i,colorScheme:a}=t();l(r,a,r!==i),e({preference:n,resolved:r})},setColorScheme:n=>{let{resolved:r}=t();l(r,n,!0),e({colorScheme:n})}}),{name:`xopc-web-theme`,merge:(e,t)=>{let n=e??{};return{...t,...n,colorScheme:c(n.colorScheme)}}}));function f(){let{preference:e,colorScheme:t}=d.getState(),n=o(e);l(n,t,!1),d.setState({resolved:n})}function p(){let e=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`);if(!e)return()=>{};let t=()=>{let{preference:e,colorScheme:t}=d.getState();if(e!==`system`)return;let n=o(`system`),r=d.getState().resolved;l(n,t,n!==r),d.setState({resolved:n})};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}export{d as i,p as n,f as r,u as t};
@@ -1 +1 @@
1
- import{t as e}from"./cn-JdwAhgNB.js";import{es as t,ns as n,ts as r}from"./index-C2ZYFBGL.js";function i(){return e(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,n,`dark:border-edge`)}function a(){return e(r,t)}var o=`h-auto shrink-0 px-2.5 py-1.5 text-xs font-medium`,s=/^[a-z][a-z0-9_-]{0,63}$/;function c(e){let t=e.trim(),n=t.indexOf(`/`);return n>0&&n<t.length-1}function l(e){let t=e&&typeof e==`object`&&!Array.isArray(e)&&`roles`in e?Object.entries(e.roles??{}).map(([e,t])=>({id:e,...t&&typeof t==`object`&&!Array.isArray(t)?t:{}})):e;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`||Array.isArray(e))continue;let t=e,r=typeof t.id==`string`?t.id.trim():``,i=typeof t.model==`string`?t.model.trim():``;if(!r||!i)continue;let a=typeof t.description==`string`?t.description.trim():``,o=Array.isArray(t.fallbacks)?t.fallbacks.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean):[];n.push({id:r,model:i,fallbacks:o,description:a})}return n}function u(e,t){let n=new Set([t.toLowerCase()]),r=[];for(let t of e){let e=t.trim(),i=e.toLowerCase();!e||!c(e)||n.has(i)||(n.add(i),r.push(e))}return r}function d(e){let t=new Map;for(let n of e){let e=n.id.trim(),r=n.model.trim();if(!e||!s.test(e)||!r||!c(r))continue;let i=n.description.trim(),a=u(n.fallbacks??[],r);t.set(e,{model:r,...a.length>0?{fallbacks:a}:{},...i?{description:i}:{}})}return t.size===0?null:{roles:Object.fromEntries(t.entries())}}function f(e,t){let n=new Set;for(let r of e){let e=r.id.trim(),i=r.model.trim(),a=r.fallbacks??[];if(!(!e&&!i&&!r.description.trim()&&a.every(e=>!e.trim()))){if(!e||!s.test(e))return t.invalidId;if(n.has(e))return t.duplicateId;if(n.add(e),!i||!c(i)||a.some(e=>e.trim()&&!c(e)))return t.invalidModel}}return null}function p(e){return e.length===0?`—`:e.map(e=>`${e.id} -> ${e.model}${e.fallbacks?.length?` (+${e.fallbacks.length})`:``}`).join(`, `)}function m(e){return(e??[]).map(e=>({id:e.id,model:e.model,fallbacks:e.fallbacks??[],description:e.description?.trim()??``}))}export{f as a,a as c,m as i,p as n,o,l as r,i as s,d as t};
1
+ import{t as e}from"./cn-JdwAhgNB.js";import{$o as t,Qo as n,Zo as r}from"./index-_cuTcWjB.js";function i(){return e(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,t,`dark:border-edge`)}function a(){return e(n,r)}var o=`h-auto shrink-0 px-2.5 py-1.5 text-xs font-medium`,s=/^[a-z][a-z0-9_-]{0,63}$/;function c(e){let t=e.trim(),n=t.indexOf(`/`);return n>0&&n<t.length-1}function l(e){let t=e&&typeof e==`object`&&!Array.isArray(e)&&`roles`in e?Object.entries(e.roles??{}).map(([e,t])=>({id:e,...t&&typeof t==`object`&&!Array.isArray(t)?t:{}})):e;if(!Array.isArray(t))return[];let n=[];for(let e of t){if(!e||typeof e!=`object`||Array.isArray(e))continue;let t=e,r=typeof t.id==`string`?t.id.trim():``,i=typeof t.model==`string`?t.model.trim():``;if(!r||!i)continue;let a=typeof t.description==`string`?t.description.trim():``,o=Array.isArray(t.fallbacks)?t.fallbacks.filter(e=>typeof e==`string`).map(e=>e.trim()).filter(Boolean):[];n.push({id:r,model:i,fallbacks:o,description:a})}return n}function u(e,t){let n=new Set([t.toLowerCase()]),r=[];for(let t of e){let e=t.trim(),i=e.toLowerCase();!e||!c(e)||n.has(i)||(n.add(i),r.push(e))}return r}function d(e){let t=new Map;for(let n of e){let e=n.id.trim(),r=n.model.trim();if(!e||!s.test(e)||!r||!c(r))continue;let i=n.description.trim(),a=u(n.fallbacks??[],r);t.set(e,{model:r,...a.length>0?{fallbacks:a}:{},...i?{description:i}:{}})}return t.size===0?null:{roles:Object.fromEntries(t.entries())}}function f(e,t){let n=new Set;for(let r of e){let e=r.id.trim(),i=r.model.trim(),a=r.fallbacks??[];if(!(!e&&!i&&!r.description.trim()&&a.every(e=>!e.trim()))){if(!e||!s.test(e))return t.invalidId;if(n.has(e))return t.duplicateId;if(n.add(e),!i||!c(i)||a.some(e=>e.trim()&&!c(e)))return t.invalidModel}}return null}function p(e){return e.length===0?`—`:e.map(e=>`${e.id} -> ${e.model}${e.fallbacks?.length?` (+${e.fallbacks.length})`:``}`).join(`, `)}function m(e){return(e??[]).map(e=>({id:e.id,model:e.model,fallbacks:e.fallbacks??[],description:e.description?.trim()??``}))}export{f as a,a as c,m as i,p as n,o,l as r,i as s,d 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"./check-DUBLcKHA.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./cn-JdwAhgNB.js";import{n as s}from"./locale-store-pByvK12G.js";import{Fl as c}from"./index-C2ZYFBGL.js";var l=n(),u=r();function d(e){let t=(0,l.c)(21),{status:n,error:r,className:d}=e,p=s(f)===`zh`,m=n===`saving`?p?`正在保存…`:`Saving…`:n===`saved`?p?`已自动保存`:`Saved automatically`:n===`error`?r||(p?`自动保存失败`:`Autosave failed`):n===`dirty`?p?`编辑中,将自动保存`:`Editing — autosave pending`:p?`自动保存`:`Autosave`,h=n===`error`?`text-danger`:n===`saved`?`text-success`:`text-fg-subtle`,g;t[0]!==d||t[1]!==h?(g=o(`inline-flex min-w-0 items-center gap-1.5 text-xs`,h,d),t[0]=d,t[1]=h,t[2]=g):g=t[2];let _;t[3]===n?_=t[4]:(_=n===`saving`?(0,u.jsx)(a,{className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}):null,t[3]=n,t[4]=_);let v;t[5]===n?v=t[6]:(v=n===`saved`?(0,u.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[5]=n,t[6]=v);let y;t[7]===n?y=t[8]:(y=n===`error`?(0,u.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[7]=n,t[8]=y);let b;t[9]===n?b=t[10]:(b=n===`dirty`?(0,u.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-current`,"aria-hidden":!0}):null,t[9]=n,t[10]=b);let x;t[11]===m?x=t[12]:(x=(0,u.jsx)(`span`,{className:`truncate`,children:m}),t[11]=m,t[12]=x);let S;return t[13]!==m||t[14]!==g||t[15]!==_||t[16]!==v||t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,u.jsxs)(`span`,{className:g,role:`status`,"aria-live":`polite`,title:m,children:[_,v,y,b,x]}),t[13]=m,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20],S}function f(e){return e.language}var p=e(t(),1);function m({value:e,dirty:t,onSave:n,enabled:r=!0,delayMs:i=700,validate:a,serialize:o=JSON.stringify}){let[s,c]=(0,p.useState)(`idle`),[l,u]=(0,p.useState)(null),d=(0,p.useRef)(e),f=(0,p.useRef)(n),m=(0,p.useRef)(a),h=(0,p.useRef)(o),g=(0,p.useRef)(null),_=(0,p.useRef)(!1),v=(0,p.useRef)(null),y=(0,p.useRef)(null),b=(0,p.useRef)(null),x=(0,p.useRef)(!0);d.current=e,f.current=n,m.current=a,h.current=o;let S=(0,p.useCallback)(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),C=(0,p.useCallback)(async e=>{S();let t=h.current(e);b.current=t;let n=m.current?.(e)??null;if(n){u(n),c(`error`);return}if(_.current){v.current=e;return}_.current=!0,u(null),c(`saving`);try{await f.current(e),y.current=t,x.current&&c(`saved`)}catch(e){x.current&&(u(e instanceof Error?e.message:String(e)),c(`error`))}finally{_.current=!1;let e=v.current;v.current=null,e&&h.current(e)!==y.current&&C(e)}},[S]),w=(0,p.useCallback)(()=>{let e=d.current;!r||!t||e===null||C(e)},[t,r,C]),T=(0,p.useCallback)(e=>{let t=e??d.current;!r||t===null||C(t)},[r,C]);return(0,p.useEffect)(()=>{if(!r||!t||e===null){S(),!t&&s===`dirty`&&c(`idle`);return}let n=o(e);if(n!==y.current&&!(s===`error`&&n===b.current))return c(e=>e===`saving`?e:`dirty`),S(),g.current=window.setTimeout(()=>void C(e),i),S},[S,i,t,r,C,o,s,e]),(0,p.useEffect)(()=>(x.current=!0,()=>{x.current=!1,S()}),[S]),{status:s,error:l,flush:w,saveNow:T,retry:w,onBlurCapture:w}}export{d as n,m as t};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./check-DUBLcKHA.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./cn-JdwAhgNB.js";import{n as s}from"./locale-store-C5MK9WcP.js";import{Ml as c}from"./index-_cuTcWjB.js";var l=n(),u=r();function d(e){let t=(0,l.c)(21),{status:n,error:r,className:d}=e,p=s(f)===`zh`,m=n===`saving`?p?`正在保存…`:`Saving…`:n===`saved`?p?`已自动保存`:`Saved automatically`:n===`error`?r||(p?`自动保存失败`:`Autosave failed`):n===`dirty`?p?`编辑中,将自动保存`:`Editing — autosave pending`:p?`自动保存`:`Autosave`,h=n===`error`?`text-danger`:n===`saved`?`text-success`:`text-fg-subtle`,g;t[0]!==d||t[1]!==h?(g=o(`inline-flex min-w-0 items-center gap-1.5 text-xs`,h,d),t[0]=d,t[1]=h,t[2]=g):g=t[2];let _;t[3]===n?_=t[4]:(_=n===`saving`?(0,u.jsx)(a,{className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}):null,t[3]=n,t[4]=_);let v;t[5]===n?v=t[6]:(v=n===`saved`?(0,u.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[5]=n,t[6]=v);let y;t[7]===n?y=t[8]:(y=n===`error`?(0,u.jsx)(c,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[7]=n,t[8]=y);let b;t[9]===n?b=t[10]:(b=n===`dirty`?(0,u.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-current`,"aria-hidden":!0}):null,t[9]=n,t[10]=b);let x;t[11]===m?x=t[12]:(x=(0,u.jsx)(`span`,{className:`truncate`,children:m}),t[11]=m,t[12]=x);let S;return t[13]!==m||t[14]!==g||t[15]!==_||t[16]!==v||t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,u.jsxs)(`span`,{className:g,role:`status`,"aria-live":`polite`,title:m,children:[_,v,y,b,x]}),t[13]=m,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20],S}function f(e){return e.language}var p=e(t(),1);function m({value:e,dirty:t,onSave:n,enabled:r=!0,delayMs:i=700,validate:a,serialize:o=JSON.stringify}){let[s,c]=(0,p.useState)(`idle`),[l,u]=(0,p.useState)(null),d=(0,p.useRef)(e),f=(0,p.useRef)(n),m=(0,p.useRef)(a),h=(0,p.useRef)(o),g=(0,p.useRef)(null),_=(0,p.useRef)(!1),v=(0,p.useRef)(null),y=(0,p.useRef)(null),b=(0,p.useRef)(null),x=(0,p.useRef)(!0);d.current=e,f.current=n,m.current=a,h.current=o;let S=(0,p.useCallback)(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),C=(0,p.useCallback)(async e=>{S();let t=h.current(e);b.current=t;let n=m.current?.(e)??null;if(n){u(n),c(`error`);return}if(_.current){v.current=e;return}_.current=!0,u(null),c(`saving`);try{await f.current(e),y.current=t,x.current&&c(`saved`)}catch(e){x.current&&(u(e instanceof Error?e.message:String(e)),c(`error`))}finally{_.current=!1;let e=v.current;v.current=null,e&&h.current(e)!==y.current&&C(e)}},[S]),w=(0,p.useCallback)(()=>{let e=d.current;!r||!t||e===null||C(e)},[t,r,C]),T=(0,p.useCallback)(e=>{let t=e??d.current;!r||t===null||C(t)},[r,C]);return(0,p.useEffect)(()=>{if(!r||!t||e===null){S(),!t&&s===`dirty`&&c(`idle`);return}let n=o(e);if(n!==y.current&&!(s===`error`&&n===b.current))return c(e=>e===`saving`?e:`dirty`),S(),g.current=window.setTimeout(()=>void C(e),i),S},[S,i,t,r,C,o,s,e]),(0,p.useEffect)(()=>(x.current=!0,()=>{x.current=!1,S()}),[S]),{status:s,error:l,flush:w,saveNow:T,retry:w,onBlurCapture:w}}export{d as n,m as t};
@@ -0,0 +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{f as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{n as o,r as s}from"./popover-select-BzdnTy3h.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./button-CSEbl4zT.js";import{n as p}from"./locale-store-C5MK9WcP.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./dist-BPoKqzeH.js";import{i as x}from"./vendor-swr-BIWyz7Rc.js";import{Ha as S,Kc as C,Nl as w,Oa as T,Ps as E,Rl as D,_o as O,ao as k,bo as A,co as j,dl as M,do as N,fo as P,go as F,ho as I,hs as L,io as R,lo as z,mo as B,nc as V,no as H,oo as U,po as W,ro as ee,so as G,uc as K,uo as q,vo as J,wl as Y,yo as X,zl as te}from"./index-_cuTcWjB.js";import{n as ne,t as re}from"./use-autosave-CKpatP3S.js";import{t as ie}from"./page-tabs-CBuCKeyy.js";import{I as ae,a as oe,i as se}from"./connectors-api-Buu8fif8.js";var Z=n(),Q=e(t(),1),$=r(),ce=new Set([`profile`,`understanding`,`collaboration`,`sources`,`dreaming`,`privacy`]),le=`w-full rounded-xl border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/60 focus:ring-2 focus:ring-accent/20`,ue={en:{title:`About You`,subtitle:`What xopc knows, why it knows it, and how it should work with you.`,profile:`Profile`,understanding:`Understanding`,collaboration:`Working agreement`,sources:`Sources`,dreaming:`Background review`,privacy:`Privacy`,profileHint:`Facts you provide directly. These are available across conversations.`,done:`Done`,required:`This field cannot be empty.`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: product designer, founder, or engineer`,primaryGoal:`What are you mainly trying to achieve?`,primaryGoalPlaceholder:`The outcome you want xopc to optimize for`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,locale:`Language / locale`,detect:`Use this device`,understoodHint:`Reviewable beliefs learned from your conversations and work. Inferences stay pending until confirmed.`,addUnderstanding:`Add understanding`,statement:`What should xopc understand?`,kind:`Type`,add:`Add`,cancel:`Cancel`,active:`Active`,review:`Needs review`,confirm:`Confirm`,reject:`Wrong`,edit:`Edit`,delete:`Delete`,confirmDelete:`Delete now`,rulesHint:`Explicit instructions for how xopc should collaborate with you. Rules outrank inferred understanding.`,addRule:`Add rule`,ruleStatement:`How should xopc work with you?`,category:`Category`,disable:`Disable`,enable:`Enable`,emptyUnderstanding:`Nothing here yet. Tell xopc something explicitly, or confirm a suggestion after it learns one.`,qualityTitle:`Learning quality`,qualityActive:`Confirmed`,qualityPending:`Pending review`,qualityAcceptance:`30-day acceptance`,qualityRecall:`Helpful recall`,qualitySourceCoverage:`Source coverage`,qualityBootstrapTime:`Median first sync`,qualityNoData:`Not enough feedback yet`,emptyRules:`No working agreements yet.`,sourceExplicit:`You said this directly`,sourceInferred:`Inferred — may be wrong`,sourceObserved:`Observed across prior work`,sourcesHint:`Review every granted source, its access mode, retention, and last collection. Revoking stops future learning.`,manageSources:`Connect another source`,authorizedSources:`Authorized sources`,connectorsTitle:`Connectors`,openConnector:`Open connector`,noSources:`No sources are authorized.`,noConnectors:`No connectors are installed.`,connected:`Connected`,unavailable:`Needs attention`,revoke:`Revoke source`,revokeHint:`Revoke this source and remove its derived understanding`,confirmRevoke:`Confirm revoke`,revoking:`Revoking…`,revokeDone:`Source revoked and derived understanding removed.`,refresh:`Update`,refreshing:`Updating…`,refreshStarted:`Update started.`,actionFailed:`Action failed`,once:`One-time`,continuous:`Continuous`,localOnly:`Local only`,derivedOnly:`Derived understanding only`,focuses:`Current focuses`,focusHint:`Candidate focuses never activate until you confirm them.`,activate:`Activate`,pause:`Pause`,complete:`Complete`,noFocuses:`No focus candidates yet.`,focusCandidate:`Suggested`,focusActive:`Active`,focusPaused:`Paused`,focusCompleted:`Completed`,confidence:`Confidence`,confidenceHigh:`High`,confidenceMedium:`Medium`,confidenceLow:`Low`,contentReadTitle:`Optional deeper reading`,contentReadHint:`Metadata identified these recent items. Select up to 5 to explicitly allow one bounded content read; nothing is opened automatically.`,readSelected:`Read selected`,reading:`Reading…`,contentReadDone:`Selected content was read and indexed.`,dreamingHint:`A deterministic daily review checks expiry, contradictory evidence, and corroborated candidates. It never auto-activates an inference.`,mode:`Background review`,on:`On — propose for review`,off:`Off`,reviewTime:`Daily review time`,evidenceThreshold:`Supporting evidence required`,scanLimit:`Maximum items per run`,lastRun:`Last review`,neverRun:`Not run yet`,runCompleted:`Completed`,runFailed:`Failed`,runRunning:`Running`,runItems:`items`,privacyHint:`Choose how generic memory providers handle sensitive content. Structured user understanding applies stricter rules of its own.`,sensitivePolicy:`Sensitive memory writes`,policyDeny:`Do not store`,policyConfirm:`Ask before storing`,policyAllow:`Store when relevant`,privacyWarning:`Secret and regulated content is never stored as structured user understanding, regardless of this setting.`,error:`Could not load your context.`,retry:`Try again`},zh:{title:`关于你`,subtitle:`清楚查看 xopc 知道什么、为什么知道,以及应该如何与你协作。`,profile:`个人资料`,understanding:`对你的理解`,collaboration:`协作约定`,sources:`数据来源`,dreaming:`后台复核`,privacy:`隐私`,profileHint:`由你直接提供的事实,会在不同对话中使用。`,done:`完成`,required:`此项不能为空。`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:产品设计师、创业者、工程师`,primaryGoal:`你目前最想达成什么?`,primaryGoalPlaceholder:`希望 xopc 优先帮助你实现的结果`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,locale:`语言 / 地区`,detect:`使用本机时区`,understoodHint:`从对话和工作中形成、可复核的理解。推断内容在你确认前保持待审核。`,addUnderstanding:`添加理解`,statement:`希望 xopc 了解什么?`,kind:`类型`,add:`添加`,cancel:`取消`,active:`使用中`,review:`待审核`,confirm:`确认`,reject:`不正确`,edit:`编辑`,delete:`删除`,confirmDelete:`确认删除`,rulesHint:`你明确设定的协作方式。协作约定的优先级高于推断出的理解。`,addRule:`添加约定`,ruleStatement:`希望 xopc 如何与你协作?`,category:`类别`,disable:`停用`,enable:`启用`,emptyUnderstanding:`还没有内容。你可以直接告诉 xopc,或在它学到建议后进行确认。`,emptyRules:`还没有协作约定。`,qualityTitle:`学习质量`,qualityActive:`已确认`,qualityPending:`待审核`,qualityAcceptance:`30 天采纳率`,qualityRecall:`有效召回`,qualitySourceCoverage:`来源覆盖率`,qualityBootstrapTime:`首次同步中位耗时`,qualityNoData:`反馈数据还不足`,sourceExplicit:`由你直接告知`,sourceInferred:`推断内容,可能有误`,sourceObserved:`从过往工作中观察到`,sourcesHint:`查看每项授权的访问方式、保留策略和最近采集时间;撤销后将停止后续学习。`,manageSources:`连接其他来源`,authorizedSources:`已授权数据来源`,connectorsTitle:`连接器`,openConnector:`打开连接器`,noSources:`尚未授权任何来源。`,noConnectors:`尚未安装连接器。`,connected:`已连接`,unavailable:`需要处理`,revoke:`撤销来源`,revokeHint:`撤销此来源并删除由它产生的理解`,confirmRevoke:`确认撤销`,revoking:`正在撤销…`,revokeDone:`已撤销来源并删除派生理解。`,refresh:`更新`,refreshing:`正在更新…`,refreshStarted:`更新任务已开始。`,actionFailed:`操作失败`,once:`仅一次`,continuous:`持续更新`,localOnly:`仅本地处理`,derivedOnly:`仅保留派生理解`,focuses:`当前关注`,focusHint:`候选关注不会自动生效,只有你确认后才会启用。`,activate:`启用`,pause:`暂停`,complete:`完成`,noFocuses:`还没有候选关注。`,focusCandidate:`待确认`,focusActive:`进行中`,focusPaused:`已暂停`,focusCompleted:`已完成`,confidence:`置信度`,confidenceHigh:`高`,confidenceMedium:`中`,confidenceLow:`低`,contentReadTitle:`可选的深入读取`,contentReadHint:`元数据识别出这些近期条目。你可以选择最多 5 项,明确授权一次有界正文读取;系统不会自动打开内容。`,readSelected:`读取所选内容`,reading:`正在读取…`,contentReadDone:`已读取并索引所选内容。`,dreamingHint:`每天进行一次确定性复核,检查过期、矛盾证据和得到佐证的候选理解;推断内容不会自动生效。`,mode:`后台复核`,on:`开启并生成待审核项`,off:`关闭`,reviewTime:`每日复核时间`,evidenceThreshold:`所需支持证据数`,scanLimit:`每次最多检查`,lastRun:`最近一次复核`,neverRun:`尚未运行`,runCompleted:`已完成`,runFailed:`失败`,runRunning:`运行中`,runItems:`项`,privacyHint:`选择通用记忆服务如何处理敏感内容;结构化用户理解有独立且更严格的规则。`,sensitivePolicy:`敏感记忆写入`,policyDeny:`不保存`,policyConfirm:`保存前询问`,policyAllow:`相关时允许保存`,privacyWarning:`无论这里如何设置,秘密和受监管内容都不会保存为结构化用户理解。`,error:`无法加载用户上下文。`,retry:`重试`}},de={preference:{en:`Preference`,zh:`偏好`},boundary:{en:`Boundary`,zh:`边界`},relationship:{en:`Relationship`,zh:`关系`},routine:{en:`Routine`,zh:`习惯`},current_state:{en:`Current state`,zh:`当前状态`},long_term_goal:{en:`Long-term goal`,zh:`长期目标`},project_context:{en:`Project context`,zh:`项目背景`},task_lesson:{en:`Task lesson`,zh:`任务经验`},derived_insight:{en:`Insight`,zh:`洞察`}},fe={communication:{en:`Communication`,zh:`沟通`},execution:{en:`Execution`,zh:`执行`},boundary:{en:`Boundary`,zh:`边界`},routine:{en:`Routine`,zh:`习惯`},proactive:{en:`Proactive help`,zh:`主动协助`}};function pe(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,children:n}),t[0]=n,t[1]=r),r}function me(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge px-5 py-10 text-center text-sm text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function he(e){let t=(0,Z.c)(33),{open:n,onOpenChange:r,title:i,description:a,submitLabel:o,cancelLabel:s,submitDisabled:c,onSubmit:l,children:u}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(m,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=p):p=t[0];let x;t[1]===i?x=t[2]:(x=(0,$.jsx)(y,{className:`text-base font-semibold text-fg`,children:i}),t[1]=i,t[2]=x);let S;t[3]===a?S=t[4]:(S=(0,$.jsx)(h,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a}),t[3]=a,t[4]=S);let C;t[5]!==x||t[6]!==S?(C=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[5]=x,t[6]=S,t[7]=C):C=t[7];let w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(d,{className:`size-4`}),t[8]=w):w=t[8];let T;t[9]===s?T=t[10]:(T=(0,$.jsx)(g,{asChild:!0,children:(0,$.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":s,children:w})}),t[9]=s,t[10]=T);let E;t[11]!==C||t[12]!==T?(E=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[C,T]}),t[11]=C,t[12]=T,t[13]=E):E=t[13];let D;t[14]===u?D=t[15]:(D=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:u}),t[14]=u,t[15]=D);let O;t[16]===s?O=t[17]:(O=(0,$.jsx)(g,{asChild:!0,children:(0,$.jsx)(f,{type:`button`,children:s})}),t[16]=s,t[17]=O);let k;t[18]!==c||t[19]!==o?(k=(0,$.jsx)(f,{type:`submit`,variant:`primary`,disabled:c,children:o}),t[18]=c,t[19]=o,t[20]=k):k=t[20];let A;t[21]!==k||t[22]!==O?(A=(0,$.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3`,children:[O,k]}),t[21]=k,t[22]=O,t[23]=A):A=t[23];let j;t[24]!==l||t[25]!==A||t[26]!==E||t[27]!==D?(j=(0,$.jsxs)(_,{children:[p,(0,$.jsx)(v,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(30rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:l,children:[E,D,A]})})]}),t[24]=l,t[25]=A,t[26]=E,t[27]=D,t[28]=j):j=t[28];let M;return t[29]!==r||t[30]!==n||t[31]!==j?(M=(0,$.jsx)(b,{open:n,onOpenChange:r,children:j}),t[29]=r,t[30]=n,t[31]=j,t[32]=M):M=t[32],M}function ge(e){return JSON.stringify(e)}function _e(e){let t=(0,Z.c)(10),[n,r]=(0,Q.useState)(e),i;t[0]===e?i=t[1]:(i=ge(e),t[0]=e,t[1]=i);let a=(0,Q.useRef)(i),o;t[2]===e?o=t[3]:(o=ge(e),t[2]=e,t[3]=o);let s=o,c,l;t[4]!==e||t[5]!==s?(c=()=>{if(s===a.current)return;let t=a.current;a.current=s,r(n=>ge(n)===t?e:n)},l=[e,s],t[4]=e,t[5]=s,t[6]=c,t[7]=l):(c=t[6],l=t[7]),(0,Q.useEffect)(c,l);let u;return t[8]===n?u=t[9]:(u=[n,r],t[8]=n,t[9]=u),u}function ve(e){return{callName:e.callName,role:e.role,primaryGoal:e.primaryGoal,pronouns:e.pronouns,timezone:e.timezone,locale:e.locale}}function ye(){let e=(0,Z.c)(87),t=p(Ce),n=ue[t],[r,a]=i(),o;if(e[0]!==r){let t=r.get(`tab`);o=t&&ce.has(t)?t:`profile`,e[0]=r,e[1]=o}else o=e[1];let s=o,c=S(Se),l=S(xe),{data:u,error:d,isLoading:f,mutate:m}=x(`/api/you`,q),h;e[2]!==l||e[3]!==c||e[4]!==n.subtitle||e[5]!==n.title?(h=()=>(c({startExtra:null,main:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:n.subtitle})]}),end:null}),l),e[2]=l,e[3]=c,e[4]=n.subtitle,e[5]=n.title,e[6]=h):h=e[6];let g;if(e[7]!==l||e[8]!==c||e[9]!==n?(g=[l,c,n],e[7]=l,e[8]=c,e[9]=n,e[10]=g):g=e[10],(0,Q.useEffect)(h,g),f){let t;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`space-y-4 p-4 sm:p-6`,children:[(0,$.jsx)(T,{className:`h-10 w-96 max-w-full`}),(0,$.jsx)(T,{className:`h-72 rounded-2xl`})]}),e[11]=t):t=e[11],t}if(d||!u){let t;e[12]===m?t=e[13]:(t=()=>void m(),e[12]=m,e[13]=t);let r;e[14]!==n.retry||e[15]!==t?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:t,children:n.retry}),e[14]=n.retry,e[15]=t,e[16]=r):r=e[16];let i;return e[17]!==n.error||e[18]!==r?(i=(0,$.jsx)(`div`,{className:`p-6`,children:(0,$.jsxs)(me,{children:[n.error,` `,r]})}),e[17]=n.error,e[18]=r,e[19]=i):i=e[19],i}let _=n.title,v;e[20]===a?v=e[21]:(v=e=>a({tab:e}),e[20]=a,e[21]=v);let y;e[22]===n.profile?y=e[23]:(y={id:`profile`,label:n.profile,icon:Y},e[22]=n.profile,e[23]=y);let b;e[24]!==u.understandings.length||e[25]!==n.understanding?(b={id:`understanding`,label:n.understanding,icon:te,count:u.understandings.length},e[24]=u.understandings.length,e[25]=n.understanding,e[26]=b):b=e[26];let w=n.collaboration,O;e[27]===u.rules?O=e[28]:(O=u.rules.filter(be),e[27]=u.rules,e[28]=O);let k;e[29]!==n.collaboration||e[30]!==O.length?(k={id:`collaboration`,label:w,icon:C,count:O.length},e[29]=n.collaboration,e[30]=O.length,e[31]=k):k=e[31];let A;e[32]===n.sources?A=e[33]:(A={id:`sources`,label:n.sources,icon:D},e[32]=n.sources,e[33]=A);let j;e[34]===n.dreaming?j=e[35]:(j={id:`dreaming`,label:n.dreaming,icon:K},e[34]=n.dreaming,e[35]=j);let M;e[36]===n.privacy?M=e[37]:(M={id:`privacy`,label:n.privacy,icon:E},e[36]=n.privacy,e[37]=M);let N;e[38]!==A||e[39]!==j||e[40]!==M||e[41]!==y||e[42]!==b||e[43]!==k?(N=[y,b,k,A,j,M],e[38]=A,e[39]=j,e[40]=M,e[41]=y,e[42]=b,e[43]=k,e[44]=N):N=e[44];let P;e[45]!==n.title||e[46]!==N||e[47]!==v||e[48]!==s?(P=(0,$.jsx)(ie,{ariaLabel:_,activeTab:s,onChange:v,items:N}),e[45]=n.title,e[46]=N,e[47]=v,e[48]=s,e[49]=P):P=e[49];let F;e[50]!==u.profile||e[51]!==t||e[52]!==m||e[53]!==n||e[54]!==s?(F=s===`profile`?(0,$.jsx)(we,{profile:u.profile,language:t,t:n,onChanged:e=>m(t=>t&&{...t,profile:e},{revalidate:!1})}):null,e[50]=u.profile,e[51]=t,e[52]=m,e[53]=n,e[54]=s,e[55]=F):F=e[55];let I;e[56]!==u.quality||e[57]!==u.understandings||e[58]!==t||e[59]!==m||e[60]!==n||e[61]!==s?(I=s===`understanding`?(0,$.jsx)(Ee,{items:u.understandings,quality:u.quality,language:t,t:n,onChanged:e=>e?m(t=>t&&{...t,understandings:t.understandings.map(t=>t.id===e.id?e:t)},{revalidate:!0}):m()}):null,e[56]=u.quality,e[57]=u.understandings,e[58]=t,e[59]=m,e[60]=n,e[61]=s,e[62]=I):I=e[62];let L;e[63]!==u.rules||e[64]!==t||e[65]!==m||e[66]!==n||e[67]!==s?(L=s===`collaboration`?(0,$.jsx)(Pe,{rules:u.rules,language:t,t:n,onChanged:()=>m()}):null,e[63]=u.rules,e[64]=t,e[65]=m,e[66]=n,e[67]=s,e[68]=L):L=e[68];let R;e[69]!==n||e[70]!==s?(R=s===`sources`?(0,$.jsx)(Le,{t:n}):null,e[69]=n,e[70]=s,e[71]=R):R=e[71];let z;e[72]!==u.consolidation?.lastRun||e[73]!==n||e[74]!==s?(z=s===`dreaming`?(0,$.jsx)(Re,{lastRun:u.consolidation?.lastRun??null,t:n}):null,e[72]=u.consolidation?.lastRun,e[73]=n,e[74]=s,e[75]=z):z=e[75];let B;e[76]!==n||e[77]!==s?(B=s===`privacy`?(0,$.jsx)(Be,{t:n}):null,e[76]=n,e[77]=s,e[78]=B):B=e[78];let V;return e[79]!==P||e[80]!==F||e[81]!==I||e[82]!==L||e[83]!==R||e[84]!==z||e[85]!==B?(V=(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-5xl space-y-5 p-4 sm:p-6`,children:[P,F,I,L,R,z,B]}),e[79]=P,e[80]=F,e[81]=I,e[82]=L,e[83]=R,e[84]=z,e[85]=B,e[86]=V):V=e[86],V}function be(e){return e.status===`active`}function xe(e){return e.clearPageHeader}function Se(e){return e.setPageHeader}function Ce(e){return e.language}function we(e){let t=(0,Z.c)(78),{profile:n,language:r,t:i,onChanged:a}=e,o;t[0]===n?o=t[1]:(o=ve(n),t[0]=n,t[1]=o);let s=o,[c,l]=_e(s),u;t[2]===c?u=t[3]:(u=ge(c),t[2]=c,t[3]=u);let d;t[4]===s?d=t[5]:(d=ge(s),t[4]=s,t[5]=d);let p=u!==d,m;t[6]!==a||t[7]!==n?(m=async e=>{await a((await A({...e,accessibility:n.accessibility})).profile)},t[6]=a,t[7]=n,t[8]=m):m=t[8];let h;t[9]!==c||t[10]!==p||t[11]!==m?(h={value:c,dirty:p,delayMs:500,onSave:m},t[9]=c,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g=re(h),_;t[13]!==c||t[14]!==l?(_=(e,t,n)=>(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,$.jsx)(`input`,{className:le,placeholder:n,value:c[e],onChange:t=>l(n=>({...n,[e]:t.target.value}))})]}),t[13]=c,t[14]=l,t[15]=_):_=t[15];let v=_,y=g.onBlurCapture,b;t[16]===i.profileHint?b=t[17]:(b=(0,$.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-fg-muted`,children:i.profileHint}),t[16]=i.profileHint,t[17]=b);let x;t[18]!==v||t[19]!==i.callName||t[20]!==i.callNamePlaceholder?(x=v(`callName`,i.callName,i.callNamePlaceholder),t[18]=v,t[19]=i.callName,t[20]=i.callNamePlaceholder,t[21]=x):x=t[21];let S;t[22]!==v||t[23]!==i.role||t[24]!==i.rolePlaceholder?(S=v(`role`,i.role,i.rolePlaceholder),t[22]=v,t[23]=i.role,t[24]=i.rolePlaceholder,t[25]=S):S=t[25];let C;t[26]===i.primaryGoal?C=t[27]:(C=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.primaryGoal}),t[26]=i.primaryGoal,t[27]=C);let w;t[28]===l?w=t[29]:(w=e=>l(t=>({...t,primaryGoal:e.target.value})),t[28]=l,t[29]=w);let T;t[30]!==c.primaryGoal||t[31]!==i.primaryGoalPlaceholder||t[32]!==w?(T=(0,$.jsx)(`textarea`,{className:le,rows:3,placeholder:i.primaryGoalPlaceholder,value:c.primaryGoal,onChange:w}),t[30]=c.primaryGoal,t[31]=i.primaryGoalPlaceholder,t[32]=w,t[33]=T):T=t[33];let E;t[34]!==C||t[35]!==T?(E=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[C,T]}),t[34]=C,t[35]=T,t[36]=E):E=t[36];let D;t[37]!==v||t[38]!==r||t[39]!==i.pronouns||t[40]!==i.pronounsPlaceholder?(D=r===`en`?v(`pronouns`,i.pronouns,i.pronounsPlaceholder):null,t[37]=v,t[38]=r,t[39]=i.pronouns,t[40]=i.pronounsPlaceholder,t[41]=D):D=t[41];let O;t[42]===i.timezone?O=t[43]:(O=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[42]=i.timezone,t[43]=O);let k;t[44]===l?k=t[45]:(k=e=>l(t=>({...t,timezone:e.target.value})),t[44]=l,t[45]=k);let j;t[46]!==c.timezone||t[47]!==k?(j=(0,$.jsx)(`input`,{className:`${le} min-w-0 flex-1`,value:c.timezone,onChange:k}),t[46]=c.timezone,t[47]=k,t[48]=j):j=t[48];let M;t[49]===l?M=t[50]:(M=()=>l(Te),t[49]=l,t[50]=M);let N;t[51]!==i.detect||t[52]!==M?(N=(0,$.jsx)(f,{className:`shrink-0 whitespace-nowrap`,onClick:M,children:i.detect}),t[51]=i.detect,t[52]=M,t[53]=N):N=t[53];let P;t[54]!==j||t[55]!==N?(P=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[j,N]}),t[54]=j,t[55]=N,t[56]=P):P=t[56];let F;t[57]!==O||t[58]!==P?(F=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[O,P]}),t[57]=O,t[58]=P,t[59]=F):F=t[59];let I;t[60]!==v||t[61]!==i.locale?(I=v(`locale`,i.locale),t[60]=v,t[61]=i.locale,t[62]=I):I=t[62];let L;t[63]!==x||t[64]!==S||t[65]!==E||t[66]!==D||t[67]!==F||t[68]!==I?(L=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[x,S,E,D,F,I]}),t[63]=x,t[64]=S,t[65]=E,t[66]=D,t[67]=F,t[68]=I,t[69]=L):L=t[69];let R;t[70]!==g.error||t[71]!==g.status?(R=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ne,{status:g.status,error:g.error})}),t[70]=g.error,t[71]=g.status,t[72]=R):R=t[72];let z;return t[73]!==g.onBlurCapture||t[74]!==L||t[75]!==R||t[76]!==b?(z=(0,$.jsx)(pe,{children:(0,$.jsxs)(`div`,{onBlurCapture:y,children:[b,L,R]})}),t[73]=g.onBlurCapture,t[74]=L,t[75]=R,t[76]=b,t[77]=z):z=t[77],z}function Te(e){return{...e,timezone:G()}}function Ee(e){let t=(0,Z.c)(78),{items:n,quality:r,language:i,t:a,onChanged:c}=e,[l,d]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(`preference`),_;t[0]===n?_=t[1]:(_=n.filter(Oe),t[0]=n,t[1]=_);let v=_,y;t[2]===n?y=t[3]:(y=n.filter(De),t[2]=n,t[3]=y);let b=y,x;t[4]!==h||t[5]!==c||t[6]!==p?(x=async e=>{e.preventDefault(),p.trim()&&(await ee({statement:p,kind:h}),m(``),d(!1),await c())},t[4]=h,t[5]=c,t[6]=p,t[7]=x):x=t[7];let S=x,C;t[8]===a.understoodHint?C=t[9]:(C=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:a.understoodHint}),t[8]=a.understoodHint,t[9]=C);let w,T;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>d(!0),T=(0,$.jsx)(u,{className:`size-4`}),t[10]=w,t[11]=T):(w=t[10],T=t[11]);let E;t[12]===a.addUnderstanding?E=t[13]:(E=(0,$.jsxs)(f,{variant:`primary`,onClick:w,children:[T,a.addUnderstanding]}),t[12]=a.addUnderstanding,t[13]=E);let D;t[14]!==C||t[15]!==E?(D=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[C,E]}),t[14]=C,t[15]=E,t[16]=D):D=t[16];let O=a.addUnderstanding,k=a.understoodHint,A=a.add,j=a.cancel,M;t[17]===p?M=t[18]:(M=p.trim(),t[17]=p,t[18]=M);let N=!M,P;t[19]===a.statement?P=t[20]:(P=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.statement}),t[19]=a.statement,t[20]=P);let F;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(F=e=>m(e.target.value),t[21]=F):F=t[21];let I;t[22]!==p||t[23]!==a.statement?(I=(0,$.jsx)(`textarea`,{autoFocus:!0,className:le,rows:4,placeholder:a.statement,value:p,onChange:F}),t[22]=p,t[23]=a.statement,t[24]=I):I=t[24];let L;t[25]!==P||t[26]!==I?(L=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[P,I]}),t[25]=P,t[26]=I,t[27]=L):L=t[27];let R;t[28]===a.kind?R=t[29]:(R=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.kind}),t[28]=a.kind,t[29]=R);let z,B;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>g(e.target.value),B=Object.entries(de),t[30]=z,t[31]=B):(z=t[30],B=t[31]);let V;t[32]===i?V=t[33]:(V=B.map(e=>{let[t,n]=e;return(0,$.jsx)(s,{value:t,children:n[i]},t)}),t[32]=i,t[33]=V);let H;t[34]!==h||t[35]!==V?(H=(0,$.jsx)(o,{value:h,onChange:z,children:V}),t[34]=h,t[35]=V,t[36]=H):H=t[36];let U;t[37]!==R||t[38]!==H?(U=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[R,H]}),t[37]=R,t[38]=H,t[39]=U):U=t[39];let W;t[40]!==l||t[41]!==S||t[42]!==a.add||t[43]!==a.addUnderstanding||t[44]!==a.cancel||t[45]!==a.understoodHint||t[46]!==N||t[47]!==L||t[48]!==U?(W=(0,$.jsxs)(he,{open:l,onOpenChange:d,title:O,description:k,submitLabel:A,cancelLabel:j,submitDisabled:N,onSubmit:S,children:[L,U]}),t[40]=l,t[41]=S,t[42]=a.add,t[43]=a.addUnderstanding,t[44]=a.cancel,t[45]=a.understoodHint,t[46]=N,t[47]=L,t[48]=U,t[49]=W):W=t[49];let G;t[50]!==r||t[51]!==a?(G=(0,$.jsx)(ke,{quality:r,t:a}),t[50]=r,t[51]=a,t[52]=G):G=t[52];let K;t[53]===a?K=t[54]:(K=(0,$.jsx)(Me,{t:a}),t[53]=a,t[54]=K);let q;t[55]!==i||t[56]!==c||t[57]!==b||t[58]!==a?(q=b.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.review,` · `,b.length]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:b.map(e=>(0,$.jsx)(je,{item:e,language:i,t:a,onChanged:c},e.id))})]}):null,t[55]=i,t[56]=c,t[57]=b,t[58]=a,t[59]=q):q=t[59];let J;t[60]!==v.length||t[61]!==a.active?(J=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.active,` · `,v.length]}),t[60]=v.length,t[61]=a.active,t[62]=J):J=t[62];let Y;t[63]!==v||t[64]!==i||t[65]!==c||t[66]!==a?(Y=v.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:v.map(e=>(0,$.jsx)(je,{item:e,language:i,t:a,onChanged:c},e.id))}):(0,$.jsx)(me,{children:a.emptyUnderstanding}),t[63]=v,t[64]=i,t[65]=c,t[66]=a,t[67]=Y):Y=t[67];let X;t[68]!==J||t[69]!==Y?(X=(0,$.jsxs)(`section`,{className:`space-y-2`,children:[J,Y]}),t[68]=J,t[69]=Y,t[70]=X):X=t[70];let te;return t[71]!==W||t[72]!==G||t[73]!==K||t[74]!==q||t[75]!==X||t[76]!==D?(te=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[D,W,G,K,q,X]}),t[71]=W,t[72]=G,t[73]=K,t[74]=q,t[75]=X,t[76]=D,t[77]=te):te=t[77],te}function De(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function Oe(e){return e.status===`active`}function ke(e){let t=(0,Z.c)(46),{quality:n,t:r}=e,i;t[0]===r.qualityNoData?i=t[1]:(i=e=>e==null?r.qualityNoData:`${Math.round(e*100)}%`,t[0]=r.qualityNoData,t[1]=i);let a=i,o=r.qualityActive,s=String(n.records.active),c;t[2]!==r.qualityActive||t[3]!==s?(c=[o,s],t[2]=r.qualityActive,t[3]=s,t[4]=c):c=t[4];let l=r.qualityPending,u=String(n.records.candidate+n.records.needsReview),d;t[5]!==r.qualityPending||t[6]!==u?(d=[l,u],t[5]=r.qualityPending,t[6]=u,t[7]=d):d=t[7];let f=r.qualityAcceptance,p;t[8]!==n.decisions.acceptanceRate||t[9]!==a?(p=a(n.decisions.acceptanceRate),t[8]=n.decisions.acceptanceRate,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==r.qualityAcceptance||t[12]!==p?(m=[f,p],t[11]=r.qualityAcceptance,t[12]=p,t[13]=m):m=t[13];let h=r.qualityRecall,g;t[14]!==n.recall.helpfulRate||t[15]!==a?(g=a(n.recall.helpfulRate),t[14]=n.recall.helpfulRate,t[15]=a,t[16]=g):g=t[16];let _;t[17]!==r.qualityRecall||t[18]!==g?(_=[h,g],t[17]=r.qualityRecall,t[18]=g,t[19]=_):_=t[19];let v=r.qualitySourceCoverage,y;t[20]!==n.quickUnderstanding.sourceCoverage||t[21]!==a?(y=a(n.quickUnderstanding.sourceCoverage),t[20]=n.quickUnderstanding.sourceCoverage,t[21]=a,t[22]=y):y=t[22];let b;t[23]!==r.qualitySourceCoverage||t[24]!==y?(b=[v,y],t[23]=r.qualitySourceCoverage,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==n.quickUnderstanding.medianBootstrapDurationMs||t[27]!==r.qualityNoData?(x=n.quickUnderstanding.medianBootstrapDurationMs==null?r.qualityNoData:`${(n.quickUnderstanding.medianBootstrapDurationMs/1e3).toFixed(1)}s`,t[26]=n.quickUnderstanding.medianBootstrapDurationMs,t[27]=r.qualityNoData,t[28]=x):x=t[28];let S;t[29]!==r.qualityBootstrapTime||t[30]!==x?(S=[r.qualityBootstrapTime,x],t[29]=r.qualityBootstrapTime,t[30]=x,t[31]=S):S=t[31];let C;t[32]!==m||t[33]!==_||t[34]!==b||t[35]!==S||t[36]!==c||t[37]!==d?(C=[c,d,m,_,b,S],t[32]=m,t[33]=_,t[34]=b,t[35]=S,t[36]=c,t[37]=d,t[38]=C):C=t[38];let w=C,T;t[39]===r.qualityTitle?T=t[40]:(T=(0,$.jsx)(`h2`,{className:`text-xs font-medium text-fg-muted`,children:r.qualityTitle}),t[39]=r.qualityTitle,t[40]=T);let E;t[41]===w?E=t[42]:(E=w.map(Ae),t[41]=w,t[42]=E);let D;return t[43]!==T||t[44]!==E?(D=(0,$.jsxs)(`section`,{className:`flex flex-wrap items-center gap-x-5 gap-y-2 rounded-xl bg-surface-muted px-3 py-2.5`,children:[T,E]}),t[43]=T,t[44]=E,t[45]=D):D=t[45],D}function Ae(e){let[t,n]=e;return(0,$.jsxs)(`div`,{className:`flex items-baseline gap-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`text-fg-subtle`,children:t}),(0,$.jsx)(`span`,{className:`font-semibold text-fg`,children:n})]},t)}function je(e){let t=(0,Z.c)(60),{item:n,language:r,t:i,onChanged:a}=e,[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=_e(n.statement),p=u!==n.statement,m;t[0]===i.required?m=t[1]:(m=e=>e.trim()?null:i.required,t[0]=i.required,t[1]=m);let h;t[2]!==n.id||t[3]!==a?(h=async e=>{await a((await O(n.id,{statement:e})).understanding)},t[2]=n.id,t[3]=a,t[4]=h):h=t[4];let g;t[5]!==u||t[6]!==o||t[7]!==p||t[8]!==m||t[9]!==h?(g={value:u,dirty:p,enabled:o,delayMs:500,validate:m,onSave:h},t[5]=u,t[6]=o,t[7]=p,t[8]=m,t[9]=h,t[10]=g):g=t[10];let _=re(g),v;t[11]!==u||t[12]!==o||t[13]!==d?(v=o?(0,$.jsx)(`textarea`,{autoFocus:!0,className:le,value:u,onChange:e=>d(e.target.value),rows:3}):(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:u}),t[11]=u,t[12]=o,t[13]=d,t[14]=v):v=t[14];let y=de[n.kind][r],b;t[15]===y?b=t[16]:(b=(0,$.jsx)(`span`,{children:y}),t[15]=y,t[16]=b);let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(`span`,{children:`·`}),t[17]=x):x=t[17];let S=n.explicitness===`explicit`?i.sourceExplicit:n.explicitness===`observed`?i.sourceObserved:i.sourceInferred,C;t[18]===S?C=t[19]:(C=(0,$.jsx)(`span`,{children:S}),t[18]=S,t[19]=C);let w;t[20]!==C||t[21]!==b?(w=(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[b,x,C]}),t[20]=C,t[21]=b,t[22]=w):w=t[22];let T;t[23]!==w||t[24]!==v?(T=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[v,w]}),t[23]=w,t[24]=v,t[25]=T):T=t[25];let E;t[26]!==_||t[27]!==o||t[28]!==i.done||t[29]!==i.edit?(E=o?(0,$.jsx)(f,{variant:`ghost`,onClick:()=>{_.flush(),s(!1)},children:i.done}):(0,$.jsxs)(f,{variant:`ghost`,onClick:()=>s(!0),children:[(0,$.jsx)(V,{className:`size-3.5`}),i.edit]}),t[26]=_,t[27]=o,t[28]=i.done,t[29]=i.edit,t[30]=E):E=t[30];let D;t[31]!==n.id||t[32]!==n.status||t[33]!==a||t[34]!==i.confirm||t[35]!==i.reject?(D=n.status===`active`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{variant:`primary`,onClick:async()=>{await a((await O(n.id,{status:`active`})).understanding)},children:i.confirm}),(0,$.jsx)(f,{onClick:async()=>{await a((await O(n.id,{status:`rejected`})).understanding)},children:i.reject})]}),t[31]=n.id,t[32]=n.status,t[33]=a,t[34]=i.confirm,t[35]=i.reject,t[36]=D):D=t[36];let A;t[37]!==c||t[38]!==n.id||t[39]!==a?(A=async()=>{if(!c){l(!0);return}await k(n.id),l(!1),await a()},t[37]=c,t[38]=n.id,t[39]=a,t[40]=A):A=t[40];let j;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(L,{className:`size-3.5`}),t[41]=j):j=t[41];let M=c?i.confirmDelete:i.delete,N;t[42]!==A||t[43]!==M?(N=(0,$.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:A,children:[j,M]}),t[42]=A,t[43]=M,t[44]=N):N=t[44];let P;t[45]!==E||t[46]!==D||t[47]!==N?(P=(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[E,D,N]}),t[45]=E,t[46]=D,t[47]=N,t[48]=P):P=t[48];let F;t[49]!==T||t[50]!==P?(F=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:gap-4`,children:[T,P]}),t[49]=T,t[50]=P,t[51]=F):F=t[51];let I;t[52]!==_.error||t[53]!==_.status||t[54]!==o?(I=o||_.status!==`idle`?(0,$.jsx)(ne,{className:`mt-2`,status:_.status,error:_.error}):null,t[52]=_.error,t[53]=_.status,t[54]=o,t[55]=I):I=t[55];let R;return t[56]!==_.onBlurCapture||t[57]!==F||t[58]!==I?(R=(0,$.jsx)(`article`,{className:`px-4 py-3 sm:px-5`,children:(0,$.jsxs)(`div`,{onBlurCapture:_.onBlurCapture,children:[F,I]})}),t[56]=_.onBlurCapture,t[57]=F,t[58]=I,t[59]=R):R=t[59],R}function Me(e){let t=(0,Z.c)(35),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=x(`you-focuses`,P),[s,c]=(0,Q.useState)(null);if(a){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(T,{className:`h-40 rounded-2xl`}),t[0]=e):e=t[0],e}if(i){let e;return t[1]===n.error?e=t[2]:(e=(0,$.jsx)(me,{children:n.error}),t[1]=n.error,t[2]=e),e}let l;if(t[3]!==r||t[4]!==s||t[5]!==o||t[6]!==n.activate||t[7]!==n.complete||t[8]!==n.confidence||t[9]!==n.confidenceHigh||t[10]!==n.confidenceLow||t[11]!==n.confidenceMedium||t[12]!==n.confirmDelete||t[13]!==n.delete||t[14]!==n.focusActive||t[15]!==n.focusCandidate||t[16]!==n.focusCompleted||t[17]!==n.focusHint||t[18]!==n.focusPaused||t[19]!==n.focuses||t[20]!==n.noFocuses||t[21]!==n.pause||t[22]!==n.reject){let e=(r??[]).filter(Ne),i;t[24]!==n.focusActive||t[25]!==n.focusCandidate||t[26]!==n.focusCompleted||t[27]!==n.focusPaused?(i=e=>e===`candidate`?n.focusCandidate:e===`active`?n.focusActive:e===`paused`?n.focusPaused:n.focusCompleted,t[24]=n.focusActive,t[25]=n.focusCandidate,t[26]=n.focusCompleted,t[27]=n.focusPaused,t[28]=i):i=t[28];let a=i,u;t[29]!==n.confidenceHigh||t[30]!==n.confidenceLow||t[31]!==n.confidenceMedium?(u=e=>e>=.85?n.confidenceHigh:e>=.65?n.confidenceMedium:n.confidenceLow,t[29]=n.confidenceHigh,t[30]=n.confidenceLow,t[31]=n.confidenceMedium,t[32]=u):u=t[32];let d=u,p;t[33]===n.focusHint?p=t[34]:(p=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.focusHint}),t[33]=n.focusHint,t[34]=p),l=(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[n.focuses,` · `,e.length]}),p]}),e.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`flex flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:a(e.status)}),(0,$.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[n.confidence,` · `,d(e.confidence)]})]}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:e.summary})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1 sm:justify-end`,children:[e.status===`active`?(0,$.jsx)(f,{onClick:async()=>{await X(e.id,`paused`),await o()},children:n.pause}):(0,$.jsx)(f,{variant:`primary`,onClick:async()=>{await X(e.id,`active`),await o()},children:n.activate}),(0,$.jsx)(f,{variant:`ghost`,onClick:async()=>{await X(e.id,`completed`),await o()},children:n.complete}),e.status===`candidate`?(0,$.jsx)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{await X(e.id,`rejected`),await o()},children:n.reject}):null,(0,$.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(s!==e.id){c(e.id);return}await U(e.id),c(null),await o()},children:[(0,$.jsx)(L,{className:`size-3.5`}),s===e.id?n.confirmDelete:n.delete]})]})]},e.id))}):(0,$.jsx)(me,{children:n.noFocuses})]}),t[3]=r,t[4]=s,t[5]=o,t[6]=n.activate,t[7]=n.complete,t[8]=n.confidence,t[9]=n.confidenceHigh,t[10]=n.confidenceLow,t[11]=n.confidenceMedium,t[12]=n.confirmDelete,t[13]=n.delete,t[14]=n.focusActive,t[15]=n.focusCandidate,t[16]=n.focusCompleted,t[17]=n.focusHint,t[18]=n.focusPaused,t[19]=n.focuses,t[20]=n.noFocuses,t[21]=n.pause,t[22]=n.reject,t[23]=l}else l=t[23];return l}function Ne(e){return e.status!==`rejected`}function Pe(e){let t=(0,Z.c)(80),{rules:n,language:r,t:i,onChanged:a}=e,[c,l]=(0,Q.useState)(!1),[d,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(`communication`),[g,_]=(0,Q.useState)(null),v,y,b,x,S,C;if(t[0]!==c||t[1]!==m||t[2]!==g||t[3]!==r||t[4]!==a||t[5]!==n||t[6]!==d||t[7]!==i.add||t[8]!==i.addRule||t[9]!==i.cancel||t[10]!==i.category||t[11]!==i.collaboration||t[12]!==i.confirmDelete||t[13]!==i.delete||t[14]!==i.disable||t[15]!==i.emptyRules||t[16]!==i.enable||t[17]!==i.ruleStatement||t[18]!==i.rulesHint){let e=n.filter(Fe),w;t[25]!==m||t[26]!==a||t[27]!==d?(w=async e=>{e.preventDefault(),d.trim()&&(await H({statement:d,category:m}),p(``),l(!1),await a())},t[25]=m,t[26]=a,t[27]=d,t[28]=w):w=t[28];let T=w;x=`space-y-5`;let E;t[29]===i.rulesHint?E=t[30]:(E=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:i.rulesHint}),t[29]=i.rulesHint,t[30]=E);let D,O;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>l(!0),D=(0,$.jsx)(u,{className:`size-4`}),t[31]=D,t[32]=O):(D=t[31],O=t[32]);let k;t[33]===i.addRule?k=t[34]:(k=(0,$.jsxs)(f,{variant:`primary`,onClick:O,children:[D,i.addRule]}),t[33]=i.addRule,t[34]=k),t[35]!==k||t[36]!==E?(S=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[E,k]}),t[35]=k,t[36]=E,t[37]=S):S=t[37];let A=i.addRule,j=i.rulesHint,M=i.add,N=i.cancel,P;t[38]===d?P=t[39]:(P=d.trim(),t[38]=d,t[39]=P);let I=!P,z;t[40]===i.ruleStatement?z=t[41]:(z=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.ruleStatement}),t[40]=i.ruleStatement,t[41]=z);let B;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>p(e.target.value),t[42]=B):B=t[42];let V;t[43]!==d||t[44]!==i.ruleStatement?(V=(0,$.jsx)(`textarea`,{autoFocus:!0,className:le,rows:4,placeholder:i.ruleStatement,value:d,onChange:B}),t[43]=d,t[44]=i.ruleStatement,t[45]=V):V=t[45];let U;t[46]!==z||t[47]!==V?(U=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[z,V]}),t[46]=z,t[47]=V,t[48]=U):U=t[48];let W;t[49]===i.category?W=t[50]:(W=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.category}),t[49]=i.category,t[50]=W);let ee,G;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(ee=e=>h(e.target.value),G=Object.entries(fe),t[51]=ee,t[52]=G):(ee=t[51],G=t[52]);let K;t[53]===r?K=t[54]:(K=G.map(e=>{let[t,n]=e;return(0,$.jsx)(s,{value:t,children:n[r]},t)}),t[53]=r,t[54]=K);let q;t[55]!==m||t[56]!==K?(q=(0,$.jsx)(o,{value:m,onChange:ee,children:K}),t[55]=m,t[56]=K,t[57]=q):q=t[57];let J;t[58]!==W||t[59]!==q?(J=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[W,q]}),t[58]=W,t[59]=q,t[60]=J):J=t[60],t[61]!==c||t[62]!==T||t[63]!==i.add||t[64]!==i.addRule||t[65]!==i.cancel||t[66]!==i.rulesHint||t[67]!==I||t[68]!==U||t[69]!==J?(C=(0,$.jsxs)(he,{open:c,onOpenChange:l,title:A,description:j,submitLabel:M,cancelLabel:N,submitDisabled:I,onSubmit:T,children:[U,J]}),t[61]=c,t[62]=T,t[63]=i.add,t[64]=i.addRule,t[65]=i.cancel,t[66]=i.rulesHint,t[67]=I,t[68]=U,t[69]=J,t[70]=C):C=t[70],v=`space-y-2`,y=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[i.collaboration,` · `,e.length]}),b=e.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`flex flex-col gap-2 px-4 py-3 sm:flex-row sm:items-start sm:gap-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 ${e.status===`disabled`?`text-fg-subtle line-through`:`text-fg`}`,children:e.statement}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:fe[e.category][r]}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[`P`,e.priority]}),e.status===`disabled`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`span`,{children:i.disable})]}):null]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[(0,$.jsx)(f,{variant:`ghost`,onClick:async()=>{await F(e.id,{status:e.status===`active`?`disabled`:`active`}),await a()},children:e.status===`active`?i.disable:i.enable}),(0,$.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(g!==e.id){_(e.id);return}await R(e.id),_(null),await a()},children:[(0,$.jsx)(L,{className:`size-3.5`}),g===e.id?i.confirmDelete:i.delete]})]})]},e.id))}):(0,$.jsx)(me,{children:i.emptyRules}),t[0]=c,t[1]=m,t[2]=g,t[3]=r,t[4]=a,t[5]=n,t[6]=d,t[7]=i.add,t[8]=i.addRule,t[9]=i.cancel,t[10]=i.category,t[11]=i.collaboration,t[12]=i.confirmDelete,t[13]=i.delete,t[14]=i.disable,t[15]=i.emptyRules,t[16]=i.enable,t[17]=i.ruleStatement,t[18]=i.rulesHint,t[19]=v,t[20]=y,t[21]=b,t[22]=x,t[23]=S,t[24]=C}else v=t[19],y=t[20],b=t[21],x=t[22],S=t[23],C=t[24];let w;t[71]!==v||t[72]!==y||t[73]!==b?(w=(0,$.jsxs)(`section`,{className:v,children:[y,b]}),t[71]=v,t[72]=y,t[73]=b,t[74]=w):w=t[74];let T;return t[75]!==x||t[76]!==S||t[77]!==C||t[78]!==w?(T=(0,$.jsxs)(`div`,{className:x,children:[S,C,w]}),t[75]=x,t[76]=S,t[77]=C,t[78]=w,t[79]=T):T=t[79],T}function Fe(e){return e.status!==`archived`}async function Ie(){let[e,t,n]=await Promise.all([z(),oe(),se()]);return{grants:e,connectors:t,catalog:n}}function Le({t:e}){let{data:t,error:n,isLoading:r,mutate:i}=x(`you-understanding-sources`,Ie),{data:o=[],mutate:s}=x(`you-connected-content-candidates`,j),[u,d]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)([]),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(null);if(r)return(0,$.jsx)(T,{className:`h-64 rounded-2xl`});if(n)return(0,$.jsxs)(me,{children:[e.error,` `,(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:()=>void i(),children:e.retry})]});let S=t?.grants??[],C=t?.connectors??[],E=new Map((t?.catalog??[]).map(e=>[e.id,e])),D=e=>{let t=e.displayName.trim().toLocaleLowerCase(),n=C.find(e=>e.displayName.trim().toLocaleLowerCase()===t);return n?E.get(n.connectorId):[...E.values()].find(n=>n.displayName.trim().toLocaleLowerCase()===t||e.sourceKey.toLocaleLowerCase().includes(n.id.toLocaleLowerCase()))},O=t=>`${e.actionFailed}: ${t instanceof Error?t.message:String(t)}`,k=async t=>{b(null),m(null),d({grantId:t.id,kind:`refresh`});try{await B(t.id),await i().catch(()=>void 0),b({tone:`success`,message:`${t.displayName}: ${e.refreshStarted}`})}catch(e){b({tone:`error`,message:O(e)})}finally{d(null)}},A=async t=>{if(p!==t.id){m(t.id),b(null);return}d({grantId:t.id,kind:`revoke`});try{await I(t.id),await i().catch(()=>void 0),m(null),b({tone:`success`,message:`${t.displayName}: ${e.revokeDone}`})}catch(e){b({tone:`error`,message:O(e)})}finally{d(null)}},N=async()=>{if(h.length){v(!0),b(null);try{let t=await W(h);t.result.failed.length?b({tone:`error`,message:t.result.failed.map(e=>e.error).join(`; `)}):b({tone:`success`,message:e.contentReadDone}),g([]),await s()}catch(e){b({tone:`error`,message:O(e)})}finally{v(!1)}}};return(0,$.jsxs)(`div`,{className:`space-y-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:e.sourcesHint}),(0,$.jsx)(f,{asChild:!0,variant:`primary`,children:(0,$.jsxs)(a,{to:`/connectors?understanding=1&returnTo=%2Fyou%3Ftab%3Dsources`,children:[e.manageSources,(0,$.jsx)(c,{className:`size-4`})]})})]}),y?(0,$.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`rounded-xl px-3 py-2 text-sm ${y.tone===`success`?`bg-success-soft text-success`:`bg-danger/10 text-danger`}`,children:y.message}):null,(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.authorizedSources,` · `,S.length]}),S.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:S.map(t=>{let n=D(t);return(0,$.jsxs)(`article`,{className:`flex min-h-28 items-start gap-3 rounded-2xl border border-edge bg-surface-panel p-4`,children:[n?(0,$.jsx)(ae,{connector:n,size:`sm`}):(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base`,children:(0,$.jsx)(M,{className:`size-4 text-fg-muted`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:[t.accessMode===`continuous`?e.continuous:e.once,` · `,t.processingPolicy===`local_only`?e.localOnly:t.retentionPolicy===`derived_only`?e.derivedOnly:t.retentionPolicy]}),t.lastCollectedAt?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:new Date(t.lastCollectedAt).toLocaleString()}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1`,children:[t.accessMode===`continuous`?(0,$.jsx)(f,{variant:`ghost`,disabled:u!==null,"aria-busy":u?.grantId===t.id&&u.kind===`refresh`,onClick:()=>void k(t),children:u?.grantId===t.id&&u.kind===`refresh`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),e.refreshing]}):e.refresh}):null,(0,$.jsx)(f,{variant:`ghost`,className:`text-danger`,title:e.revokeHint,"aria-label":`${e.revoke}: ${t.displayName}`,disabled:u!==null,"aria-busy":u?.grantId===t.id&&u.kind===`revoke`,onClick:()=>void A(t),children:u?.grantId===t.id&&u.kind===`revoke`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),e.revoking]}):p===t.id?e.confirmRevoke:e.revoke})]})]},t.id)})}):(0,$.jsx)(me,{children:e.noSources})]}),o.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.contentReadTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-xs leading-5 text-fg-muted`,children:e.contentReadHint})]}),(0,$.jsx)(f,{variant:`primary`,disabled:!h.length||_,onClick:()=>void N(),children:_?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),e.reading]}):`${e.readSelected} · ${h.length}`})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:o.map(e=>{let t=h.includes(e.sourceItemId),n=h.length>=5&&!t;return(0,$.jsxs)(`label`,{className:`flex items-center gap-3 px-4 py-3 ${n?`opacity-50`:`cursor-pointer hover:bg-surface-hover`}`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-[var(--color-accent)]`,checked:t,disabled:n||_,onChange:t=>g(n=>t.target.checked?[...n,e.sourceItemId]:n.filter(t=>t!==e.sourceItemId))}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm text-fg`,children:e.title}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[e.toolkit===`gmail`?`Gmail`:`Google Drive`,e.occurredAt?` · ${new Date(e.occurredAt).toLocaleDateString()}`:``]})]})]},e.sourceItemId)})})]}):null,(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.connectorsTitle,` · `,C.length]}),C.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:C.map(t=>{let n=t.enabled&&(t.status===`connected`||t.connectionStatus===`connected`||t.authStatus===`connected`),r=E.get(t.connectorId);return(0,$.jsxs)(a,{to:`/connectors?tab=connected&instance=${encodeURIComponent(t.instanceId)}`,"aria-label":`${e.openConnector}: ${t.displayName}`,className:`group flex min-h-24 items-center gap-3 rounded-2xl border border-edge bg-surface-panel p-4 transition-colors hover:border-edge-strong hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,$.jsx)(ae,{connector:r??{displayName:t.displayName}}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:t.connectorId})]}),(0,$.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-1 text-xs ${n?`bg-success-soft text-success`:`bg-warning-soft text-warning`}`,children:n?e.connected:e.unavailable}),(0,$.jsx)(w,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`})]},t.instanceId)})}):(0,$.jsx)(me,{children:e.noConnectors})]})]})}function Re(e){let t=(0,Z.c)(112),{lastRun:n,t:r}=e,{data:i,error:a,isLoading:c,mutate:l}=x(`you-context-settings`,N),u=i?.dreaming??null,[d,p]=_e(u),m;t[0]!==d||t[1]!==u?(m=d&&u&&ge(d)!==ge(u),t[0]=d,t[1]=u,t[2]=m):m=t[2];let h=!!m,g;t[3]===l?g=t[4]:(g=async e=>{await J({dreaming:e}),await l()},t[3]=l,t[4]=g);let _;t[5]!==d||t[6]!==h||t[7]!==g?(_={value:d,dirty:h,delayMs:500,onSave:g},t[5]=d,t[6]=h,t[7]=g,t[8]=_):_=t[8];let v=re(_);if(a){let e;t[9]===l?e=t[10]:(e=()=>void l(),t[9]=l,t[10]=e);let n;t[11]!==r.retry||t[12]!==e?(n=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:r.retry}),t[11]=r.retry,t[12]=e,t[13]=n):n=t[13];let i;return t[14]!==r.error||t[15]!==n?(i=(0,$.jsxs)(me,{children:[r.error,` `,n]}),t[14]=r.error,t[15]=n,t[16]=i):i=t[16],i}if(c||!d){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(T,{className:`h-72 rounded-2xl`}),t[17]=e):e=t[17],e}let y=n?.status===`completed`?r.runCompleted:n?.status===`failed`?r.runFailed:r.runRunning,b;t[18]===r.dreamingHint?b=t[19]:(b=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:r.dreamingHint}),t[18]=r.dreamingHint,t[19]=b);let S=v.onBlurCapture,C;t[20]===r.mode?C=t[21]:(C=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.mode}),t[20]=r.mode,t[21]=C);let w;t[22]===p?w=t[23]:(w=e=>p(t=>t&&{...t,mode:e.target.value}),t[22]=p,t[23]=w);let E;t[24]===r.on?E=t[25]:(E=(0,$.jsx)(s,{value:`review`,children:r.on}),t[24]=r.on,t[25]=E);let D;t[26]===r.off?D=t[27]:(D=(0,$.jsx)(s,{value:`off`,children:r.off}),t[26]=r.off,t[27]=D);let O;t[28]!==d.mode||t[29]!==D||t[30]!==w||t[31]!==E?(O=(0,$.jsxs)(o,{value:d.mode,onChange:w,children:[E,D]}),t[28]=d.mode,t[29]=D,t[30]=w,t[31]=E,t[32]=O):O=t[32];let k;t[33]!==O||t[34]!==C?(k=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[C,O]}),t[33]=O,t[34]=C,t[35]=k):k=t[35];let A;t[36]===r.reviewTime?A=t[37]:(A=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.reviewTime}),t[36]=r.reviewTime,t[37]=A);let j;t[38]===p?j=t[39]:(j=e=>p(t=>t&&{...t,schedule:{time:e.target.value}}),t[38]=p,t[39]=j);let M;t[40]!==d.schedule.time||t[41]!==j?(M=(0,$.jsx)(`input`,{type:`time`,className:le,value:d.schedule.time,onChange:j}),t[40]=d.schedule.time,t[41]=j,t[42]=M):M=t[42];let P;t[43]!==A||t[44]!==M?(P=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[A,M]}),t[43]=A,t[44]=M,t[45]=P):P=t[45];let F;t[46]===r.timezone?F=t[47]:(F=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.timezone}),t[46]=r.timezone,t[47]=F);let I=d.timezone??``,L;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(L=G(),t[48]=L):L=t[48];let R;t[49]===p?R=t[50]:(R=e=>p(t=>t&&{...t,timezone:e.target.value||void 0}),t[49]=p,t[50]=R);let z;t[51]!==I||t[52]!==R?(z=(0,$.jsx)(`input`,{className:`${le} min-w-0 flex-1`,value:I,placeholder:L,onChange:R}),t[51]=I,t[52]=R,t[53]=z):z=t[53];let B;t[54]===p?B=t[55]:(B=()=>p(ze),t[54]=p,t[55]=B);let V;t[56]!==r.detect||t[57]!==B?(V=(0,$.jsx)(f,{className:`shrink-0 whitespace-nowrap`,onClick:B,children:r.detect}),t[56]=r.detect,t[57]=B,t[58]=V):V=t[58];let H;t[59]!==z||t[60]!==V?(H=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[z,V]}),t[59]=z,t[60]=V,t[61]=H):H=t[61];let U;t[62]!==F||t[63]!==H?(U=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[F,H]}),t[62]=F,t[63]=H,t[64]=U):U=t[64];let W;t[65]===r.evidenceThreshold?W=t[66]:(W=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.evidenceThreshold}),t[65]=r.evidenceThreshold,t[66]=W);let ee;t[67]===p?ee=t[68]:(ee=e=>p(t=>t&&{...t,minEvidenceSources:Number(e.target.value)}),t[67]=p,t[68]=ee);let K;t[69]!==d.minEvidenceSources||t[70]!==ee?(K=(0,$.jsx)(`input`,{type:`number`,min:2,max:10,className:le,value:d.minEvidenceSources,onChange:ee}),t[69]=d.minEvidenceSources,t[70]=ee,t[71]=K):K=t[71];let q;t[72]!==W||t[73]!==K?(q=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[W,K]}),t[72]=W,t[73]=K,t[74]=q):q=t[74];let Y;t[75]===r.scanLimit?Y=t[76]:(Y=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.scanLimit}),t[75]=r.scanLimit,t[76]=Y);let X;t[77]===p?X=t[78]:(X=e=>p(t=>t&&{...t,limit:Number(e.target.value)}),t[77]=p,t[78]=X);let te;t[79]!==d.limit||t[80]!==X?(te=(0,$.jsx)(`input`,{type:`number`,min:1,max:2e3,className:le,value:d.limit,onChange:X}),t[79]=d.limit,t[80]=X,t[81]=te):te=t[81];let ie;t[82]!==Y||t[83]!==te?(ie=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[Y,te]}),t[82]=Y,t[83]=te,t[84]=ie):ie=t[84];let ae;t[85]!==k||t[86]!==P||t[87]!==U||t[88]!==q||t[89]!==ie?(ae=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[k,P,U,q,ie]}),t[85]=k,t[86]=P,t[87]=U,t[88]=q,t[89]=ie,t[90]=ae):ae=t[90];let oe;t[91]!==v.error||t[92]!==v.status?(oe=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ne,{status:v.status,error:v.error})}),t[91]=v.error,t[92]=v.status,t[93]=oe):oe=t[93];let se;t[94]!==v.onBlurCapture||t[95]!==ae||t[96]!==oe?(se=(0,$.jsx)(pe,{children:(0,$.jsxs)(`div`,{onBlurCapture:S,children:[ae,oe]})}),t[94]=v.onBlurCapture,t[95]=ae,t[96]=oe,t[97]=se):se=t[97];let Q;t[98]===r.lastRun?Q=t[99]:(Q=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.lastRun}),t[98]=r.lastRun,t[99]=Q);let ce;t[100]!==n||t[101]!==y||t[102]!==r.neverRun||t[103]!==r.runItems?(ce=n?(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`span`,{children:y}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`time`,{children:new Date(n.startedAt).toLocaleString()}),typeof n.metrics.scanned==`number`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[String(n.metrics.scanned),` `,r.runItems]})]}):null]}):(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:r.neverRun}),t[100]=n,t[101]=y,t[102]=r.neverRun,t[103]=r.runItems,t[104]=ce):ce=t[104];let ue;t[105]!==Q||t[106]!==ce?(ue=(0,$.jsxs)(pe,{children:[Q,ce]}),t[105]=Q,t[106]=ce,t[107]=ue):ue=t[107];let de;return t[108]!==se||t[109]!==ue||t[110]!==b?(de=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[b,se,ue]}),t[108]=se,t[109]=ue,t[110]=b,t[111]=de):de=t[111],de}function ze(e){return e&&{...e,timezone:G()}}function Be(e){let t=(0,Z.c)(49),{t:n}=e,{data:r,error:i,isLoading:a,mutate:c}=x(`you-context-settings`,N),l=r?.privacy.sensitiveWritePolicy??null,[u,d]=_e(l),f=!!(u&&l&&u!==l),p;t[0]===c?p=t[1]:(p=async e=>{await J({privacy:{sensitiveWritePolicy:e}}),await c()},t[0]=c,t[1]=p);let m;t[2]!==u||t[3]!==f||t[4]!==p?(m={value:u,dirty:f,delayMs:350,onSave:p},t[2]=u,t[3]=f,t[4]=p,t[5]=m):m=t[5];let h=re(m);if(i){let e;t[6]===c?e=t[7]:(e=()=>void c(),t[6]=c,t[7]=e);let r;t[8]!==n.retry||t[9]!==e?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:n.retry}),t[8]=n.retry,t[9]=e,t[10]=r):r=t[10];let i;return t[11]!==n.error||t[12]!==r?(i=(0,$.jsxs)(me,{children:[n.error,` `,r]}),t[11]=n.error,t[12]=r,t[13]=i):i=t[13],i}if(a||!u){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(T,{className:`h-56 rounded-2xl`}),t[14]=e):e=t[14],e}let g;t[15]===n.privacyHint?g=t[16]:(g=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.privacyHint}),t[15]=n.privacyHint,t[16]=g);let _;t[17]===n.sensitivePolicy?_=t[18]:(_=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:n.sensitivePolicy}),t[17]=n.sensitivePolicy,t[18]=_);let v;t[19]===d?v=t[20]:(v=e=>d(e.target.value),t[19]=d,t[20]=v);let y;t[21]===n.policyDeny?y=t[22]:(y=(0,$.jsx)(s,{value:`deny`,children:n.policyDeny}),t[21]=n.policyDeny,t[22]=y);let b;t[23]===n.policyConfirm?b=t[24]:(b=(0,$.jsx)(s,{value:`confirm`,children:n.policyConfirm}),t[23]=n.policyConfirm,t[24]=b);let S;t[25]===n.policyAllow?S=t[26]:(S=(0,$.jsx)(s,{value:`allow`,children:n.policyAllow}),t[25]=n.policyAllow,t[26]=S);let C;t[27]!==u||t[28]!==v||t[29]!==y||t[30]!==b||t[31]!==S?(C=(0,$.jsxs)(o,{value:u,onChange:v,children:[y,b,S]}),t[27]=u,t[28]=v,t[29]=y,t[30]=b,t[31]=S,t[32]=C):C=t[32];let w;t[33]!==C||t[34]!==_?(w=(0,$.jsxs)(`label`,{className:`block max-w-xl space-y-1.5 text-sm`,children:[_,C]}),t[33]=C,t[34]=_,t[35]=w):w=t[35];let E;t[36]===n.privacyWarning?E=t[37]:(E=(0,$.jsx)(`p`,{className:`mt-3 max-w-2xl text-xs leading-5 text-fg-subtle`,children:n.privacyWarning}),t[36]=n.privacyWarning,t[37]=E);let D;t[38]!==h.error||t[39]!==h.status?(D=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ne,{status:h.status,error:h.error})}),t[38]=h.error,t[39]=h.status,t[40]=D):D=t[40];let O;t[41]!==h.onBlurCapture||t[42]!==w||t[43]!==E||t[44]!==D?(O=(0,$.jsx)(pe,{children:(0,$.jsxs)(`div`,{onBlurCapture:h.onBlurCapture,children:[w,E,D]})}),t[41]=h.onBlurCapture,t[42]=w,t[43]=E,t[44]=D,t[45]=O):O=t[45];let k;return t[46]!==O||t[47]!==g?(k=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[g,O]}),t[46]=O,t[47]=g,t[48]=k):k=t[48],k}export{ye as UserContextPage};
@@ -1 +1 @@
1
- import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{r as i,s as a}from"./locale-store-pByvK12G.js";import{n as o}from"./gateway-config-swr-BQbkUP5X.js";import{Jo as s}from"./index-C2ZYFBGL.js";e();var c=t();async function l(e,t){return(await a(i(`/api/voice/tts-voices?${new URLSearchParams({provider:e,model:t}).toString()}`))).payload?.voices??[]}function u(){return{enabled:!0,provider:`xopc-local`,providers:{"xopc-local":{model:`sensevoice-small`},alibaba:{model:`qwen-audio-3.0-asr-flash`},openai:{model:`gpt-4o-mini-transcribe`},groq:{model:`whisper-large-v3-turbo`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function d(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,providers:{alibaba:{model:`qwen-tts`,voice:`Cherry`},openai:{model:`tts-1`,voice:`alloy`},edge:{voice:`zh-CN-XiaoxiaoNeural`,lang:`zh-CN`},minimax:{model:`speech-2.8-hd`,voice:`male-qn-qingse`},"tts-local-cli":{command:``,outputFormat:`wav`}}}}function f(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function p(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function m(e){let t=u();if(!f(e))return t;let n=p(e.provider),r=t.fallback??{enabled:!1,order:[`xopc-local`]};if(f(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):r.order;r={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:r.enabled,order:t.length?t:r.order}}let i={...t.providers??{},...f(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,f(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,providers:i,fallback:r}}function h(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function g(e){let t=d();if(!f(e))return t;let n=h(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i={...t.providers??{},...f(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,f(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,trigger:r,maxTextLength:typeof e.maxTextLength==`number`&&Number.isFinite(e.maxTextLength)?e.maxTextLength:t.maxTextLength,timeoutMs:typeof e.timeoutMs==`number`&&Number.isFinite(e.timeoutMs)?e.timeoutMs:t.timeoutMs,providers:i}}function _(e){return{...e}}function v(e){return{...e}}function y(e){let t=f(e)?e:{},n=f(t.voice)?t.voice:{},r=f(n.input)?n.input:{},i=f(r.refinement)?r.refinement:{},a=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:m(t.stt),tts:g(t.tts),voice:{languageMode:n.languageMode===`manual`?`manual`:`auto`,language:n.language===`zh`?`zh`:`en`,input:{refinement:{mode:a,...typeof i.model==`string`&&i.model.trim()?{model:i.model.trim()}:{},...typeof i.customInstruction==`string`?{customInstruction:i.customInstruction}:{}}}}}}async function b(){return y((await a(i(`/api/config`))).payload?.config??{})}async function x(e){await a(i(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:_(e.stt),tts:v(e.tts),voice:e.voice})}),e.voice.languageMode===`auto`&&await a(i(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),o()}async function S(){let e=await a(i(`/api/voice/models`));if(!e.payload?.models)throw Error(`Missing voice models payload`);return e.payload.models}async function C(){let e=await a(i(`/api/voice/providers`));if(!e.payload?.providers)throw Error(`Missing voice providers payload`);return e.payload}async function w(){let e=await a(i(`/api/voice/stt-providers`));if(!e.payload?.providers)throw Error(`Missing STT providers payload`);return e.payload}async function T(){let e=await a(i(`/api/voice/local/status`));if(!e.payload)throw Error(`Missing local voice status payload`);return e.payload}async function E(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}/install`),{method:`POST`,body:`{}`})}async function D(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}`),{method:`DELETE`})}async function O(e){let t=await a(i(`/api/voice/tts-test`),{method:`POST`,body:JSON.stringify(e)});if(t.ok===!1){let e=typeof t.error==`string`?t.error:t.error?.message;throw Error(e||`TTS test failed`)}if(!t.payload||typeof t.payload.audio!=`string`||!t.payload.audio.trim())throw Error(`TTS test returned no audio. Check the selected voice engine and try again.`);return t.payload}async function k(e){let t=await a(i(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(e)});if(!t.payload)throw Error(`Missing reveal payload`);return t.payload}var A=n();function j(e){let t=(0,c.c)(15),{kind:n,providerId:i,fieldId:a,value:o,onChange:l,labels:u,placeholder:d,className:f}=e,p=d===void 0?`sk-...`:d,m;t[0]!==n||t[1]!==i?(m=()=>k({kind:n,provider:i}).then(M),t[0]=n,t[1]=i,t[2]=m):m=t[2];let h=m,g;t[3]===f?g=t[4]:(g=r(`flex min-w-0 flex-col gap-1.5`,f),t[3]=f,t[4]=g);let _;t[5]!==a||t[6]!==u||t[7]!==l||t[8]!==p||t[9]!==h||t[10]!==o?(_=(0,A.jsx)(s,{id:a,value:o,onChange:l,placeholder:p,labels:u,reveal:h,loadFailedLabel:u.loadFailed,maskedHelp:u.maskedHelp,notInConfigFile:u.notInConfigFile,inputClassName:`text-xs`}),t[5]=a,t[6]=u,t[7]=l,t[8]=p,t[9]=h,t[10]=o,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,A.jsx)(`div`,{className:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function M(e){return e.apiKey??null}export{C as a,E as c,D as d,O as f,S as i,y as l,T as n,b as o,l as r,w as s,j as t,x as u};
1
+ import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{r as i,s as a}from"./locale-store-C5MK9WcP.js";import{n as o}from"./gateway-config-swr-BIxuwPQi.js";import{Go as s}from"./index-_cuTcWjB.js";e();var c=t();async function l(e,t){return(await a(i(`/api/voice/tts-voices?${new URLSearchParams({provider:e,model:t}).toString()}`))).payload?.voices??[]}function u(){return{enabled:!0,provider:`xopc-local`,providers:{"xopc-local":{model:`sensevoice-small`},alibaba:{model:`qwen-audio-3.0-asr-flash`},openai:{model:`gpt-4o-mini-transcribe`},groq:{model:`whisper-large-v3-turbo`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function d(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,providers:{alibaba:{model:`qwen-tts`,voice:`Cherry`},openai:{model:`tts-1`,voice:`alloy`},edge:{voice:`zh-CN-XiaoxiaoNeural`,lang:`zh-CN`},minimax:{model:`speech-2.8-hd`,voice:`male-qn-qingse`},"tts-local-cli":{command:``,outputFormat:`wav`}}}}function f(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function p(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function m(e){let t=u();if(!f(e))return t;let n=p(e.provider),r=t.fallback??{enabled:!1,order:[`xopc-local`]};if(f(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):r.order;r={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:r.enabled,order:t.length?t:r.order}}let i={...t.providers??{},...f(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,f(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,providers:i,fallback:r}}function h(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function g(e){let t=d();if(!f(e))return t;let n=h(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i={...t.providers??{},...f(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,f(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,trigger:r,maxTextLength:typeof e.maxTextLength==`number`&&Number.isFinite(e.maxTextLength)?e.maxTextLength:t.maxTextLength,timeoutMs:typeof e.timeoutMs==`number`&&Number.isFinite(e.timeoutMs)?e.timeoutMs:t.timeoutMs,providers:i}}function _(e){return{...e}}function v(e){return{...e}}function y(e){let t=f(e)?e:{},n=f(t.voice)?t.voice:{},r=f(n.input)?n.input:{},i=f(r.refinement)?r.refinement:{},a=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:m(t.stt),tts:g(t.tts),voice:{languageMode:n.languageMode===`manual`?`manual`:`auto`,language:n.language===`zh`?`zh`:`en`,input:{refinement:{mode:a,...typeof i.model==`string`&&i.model.trim()?{model:i.model.trim()}:{},...typeof i.customInstruction==`string`?{customInstruction:i.customInstruction}:{}}}}}}async function b(){return y((await a(i(`/api/config`))).payload?.config??{})}async function x(e){await a(i(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:_(e.stt),tts:v(e.tts),voice:e.voice})}),e.voice.languageMode===`auto`&&await a(i(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),o()}async function S(){let e=await a(i(`/api/voice/models`));if(!e.payload?.models)throw Error(`Missing voice models payload`);return e.payload.models}async function C(){let e=await a(i(`/api/voice/providers`));if(!e.payload?.providers)throw Error(`Missing voice providers payload`);return e.payload}async function w(){let e=await a(i(`/api/voice/stt-providers`));if(!e.payload?.providers)throw Error(`Missing STT providers payload`);return e.payload}async function T(){let e=await a(i(`/api/voice/local/status`));if(!e.payload)throw Error(`Missing local voice status payload`);return e.payload}async function E(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}/install`),{method:`POST`,body:`{}`})}async function D(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}`),{method:`DELETE`})}async function O(e){let t=await a(i(`/api/voice/tts-test`),{method:`POST`,body:JSON.stringify(e)});if(t.ok===!1){let e=typeof t.error==`string`?t.error:t.error?.message;throw Error(e||`TTS test failed`)}if(!t.payload||typeof t.payload.audio!=`string`||!t.payload.audio.trim())throw Error(`TTS test returned no audio. Check the selected voice engine and try again.`);return t.payload}async function k(e){let t=await a(i(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(e)});if(!t.payload)throw Error(`Missing reveal payload`);return t.payload}var A=n();function j(e){let t=(0,c.c)(15),{kind:n,providerId:i,fieldId:a,value:o,onChange:l,labels:u,placeholder:d,className:f}=e,p=d===void 0?`sk-...`:d,m;t[0]!==n||t[1]!==i?(m=()=>k({kind:n,provider:i}).then(M),t[0]=n,t[1]=i,t[2]=m):m=t[2];let h=m,g;t[3]===f?g=t[4]:(g=r(`flex min-w-0 flex-col gap-1.5`,f),t[3]=f,t[4]=g);let _;t[5]!==a||t[6]!==u||t[7]!==l||t[8]!==p||t[9]!==h||t[10]!==o?(_=(0,A.jsx)(s,{id:a,value:o,onChange:l,placeholder:p,labels:u,reveal:h,loadFailedLabel:u.loadFailed,maskedHelp:u.maskedHelp,notInConfigFile:u.notInConfigFile,inputClassName:`text-xs`}),t[5]=a,t[6]=u,t[7]=l,t[8]=p,t[9]=h,t[10]=o,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,A.jsx)(`div`,{className:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function M(e){return e.apiKey??null}export{C as a,E as c,D as d,O as f,S as i,y as l,T as n,b as o,l as r,w as s,j as t,x as u};
@@ -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"./x-B_N4OPjy.js";import{t as a}from"./button-CSEbl4zT.js";import{t as o}from"./messages-yG5P43Q9.js";import{n as s}from"./locale-store-pByvK12G.js";import{a as c,i as l,o as u,r as d,s as f,t as p}from"./dist-BPoKqzeH.js";import{Ja as m,rs as h}from"./index-C2ZYFBGL.js";import{WorkDiscoveryPage as g}from"./work-discovery-page-CmPfOfHl.js";var _=n(),v=e(t(),1),y=r(),b=180;function x(e){let t=(0,_.c)(40),{requestedOpen:n,onExited:r}=e,x=s(C),w=m(S),[T,E]=(0,v.useState)(!0),D=(0,v.useRef)(!1),O=(0,v.useRef)(null),k;t[0]===x?k=t[1]:(k=o(x),t[0]=x,t[1]=k);let A=k.onboarding.workDiscovery,j=w?x===`zh`?`在后台继续`:`Continue in background`:x===`zh`?`稍后再说`:`Maybe later`,M;t[2]===r?M=t[3]:(M=()=>{if(D.current)return;D.current=!0,E(!1);let e=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:b;O.current=window.setTimeout(r,e)},t[2]=r,t[3]=M);let N=M,P,F;t[4]!==N||t[5]!==n?(P=()=>{n||N()},F=[N,n],t[4]=N,t[5]=n,t[6]=P,t[7]=F):(P=t[6],F=t[7]),(0,v.useEffect)(P,F);let I,L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{O.current!==null&&window.clearTimeout(O.current)},L=[],t[8]=I,t[9]=L):(I=t[8],L=t[9]),(0,v.useEffect)(I,L);let R;t[10]===N?R=t[11]:(R=e=>{e||N()},t[10]=N,t[11]=R);let z;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,y.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[75] bg-scrim backdrop-blur-[1px]`}),t[12]=z):z=t[12];let B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,y.jsx)(h,{className:`size-7 shrink-0`,"aria-hidden":!0}),t[13]=B):B=t[13];let V;t[14]===A.title?V=t[15]:(V=(0,y.jsx)(f,{className:`truncate text-sm font-semibold text-fg`,children:A.title}),t[14]=A.title,t[15]=V);let H;t[16]===A.subtitle?H=t[17]:(H=(0,y.jsx)(l,{className:`sr-only`,children:A.subtitle}),t[16]=A.subtitle,t[17]=H);let U;t[18]!==V||t[19]!==H?(U=(0,y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[B,V,H]}),t[18]=V,t[19]=H,t[20]=U):U=t[20];let W;t[21]===j?W=t[22]:(W=(0,y.jsx)(`span`,{className:`hidden text-xs sm:inline`,children:j}),t[21]=j,t[22]=W);let G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,y.jsx)(i,{className:`size-4`,"aria-hidden":!0}),t[23]=G):G=t[23];let K;t[24]!==j||t[25]!==N||t[26]!==W?(K=(0,y.jsxs)(a,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1.5 px-2.5 text-fg-muted`,title:j,"aria-label":j,onClick:N,children:[W,G]}),t[24]=j,t[25]=N,t[26]=W,t[27]=K):K=t[27];let q;t[28]!==U||t[29]!==K?(q=(0,y.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center justify-between gap-4 border-b border-edge bg-surface-panel px-4 sm:px-5`,children:[U,K]}),t[28]=U,t[29]=K,t[30]=q):q=t[30];let J;t[31]===N?J=t[32]:(J=(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,y.jsx)(g,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(u,{children:[z,(0,y.jsx)(d,{className:`xopc-work-discovery-dialog pointer-events-none fixed inset-0 z-[76] flex items-center justify-center p-3 outline-none sm:p-6`,children:(0,y.jsxs)(`section`,{className:`xopc-work-discovery-panel pointer-events-auto flex h-[min(47.5rem,calc(100dvh-1.5rem))] w-[min(45rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-float sm:h-[min(47.5rem,calc(100dvh-3rem))] sm:w-[min(45rem,calc(100vw-3rem))]`,children:[q,J]})})]}),t[33]=q,t[34]=J,t[35]=Y):Y=t[35];let X;return t[36]!==T||t[37]!==Y||t[38]!==R?(X=(0,y.jsx)(p,{open:T,onOpenChange:R,children:Y}),t[36]=T,t[37]=Y,t[38]=R,t[39]=X):X=t[39],X}function S(e){return e.status===`running`}function C(e){return e.language}export{x as WorkDiscoveryOverlay};
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"./x-B_N4OPjy.js";import{t as a}from"./button-CSEbl4zT.js";import{t as o}from"./messages-ctG2e-ix.js";import{n as s}from"./locale-store-C5MK9WcP.js";import{a as c,i as l,o as u,r as d,s as f,t as p}from"./dist-BPoKqzeH.js";import{Ua as m,es as h}from"./index-_cuTcWjB.js";import{WorkDiscoveryPage as g}from"./work-discovery-page-BwaU1RqI.js";var _=n(),v=e(t(),1),y=r(),b=180;function x(e){let t=(0,_.c)(40),{requestedOpen:n,onExited:r}=e,x=s(C),w=m(S),[T,E]=(0,v.useState)(!0),D=(0,v.useRef)(!1),O=(0,v.useRef)(null),k;t[0]===x?k=t[1]:(k=o(x),t[0]=x,t[1]=k);let A=k.onboarding.workDiscovery,j=w?x===`zh`?`在后台继续`:`Continue in background`:x===`zh`?`稍后再说`:`Maybe later`,M;t[2]===r?M=t[3]:(M=()=>{if(D.current)return;D.current=!0,E(!1);let e=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?0:b;O.current=window.setTimeout(r,e)},t[2]=r,t[3]=M);let N=M,P,F;t[4]!==N||t[5]!==n?(P=()=>{n||N()},F=[N,n],t[4]=N,t[5]=n,t[6]=P,t[7]=F):(P=t[6],F=t[7]),(0,v.useEffect)(P,F);let I,L;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{O.current!==null&&window.clearTimeout(O.current)},L=[],t[8]=I,t[9]=L):(I=t[8],L=t[9]),(0,v.useEffect)(I,L);let R;t[10]===N?R=t[11]:(R=e=>{e||N()},t[10]=N,t[11]=R);let z;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,y.jsx)(c,{className:`xopc-dialog-overlay fixed inset-0 z-[75] bg-scrim backdrop-blur-[1px]`}),t[12]=z):z=t[12];let B;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,y.jsx)(h,{className:`size-7 shrink-0`,"aria-hidden":!0}),t[13]=B):B=t[13];let V;t[14]===A.title?V=t[15]:(V=(0,y.jsx)(f,{className:`truncate text-sm font-semibold text-fg`,children:A.title}),t[14]=A.title,t[15]=V);let H;t[16]===A.subtitle?H=t[17]:(H=(0,y.jsx)(l,{className:`sr-only`,children:A.subtitle}),t[16]=A.subtitle,t[17]=H);let U;t[18]!==V||t[19]!==H?(U=(0,y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[B,V,H]}),t[18]=V,t[19]=H,t[20]=U):U=t[20];let W;t[21]===j?W=t[22]:(W=(0,y.jsx)(`span`,{className:`hidden text-xs sm:inline`,children:j}),t[21]=j,t[22]=W);let G;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,y.jsx)(i,{className:`size-4`,"aria-hidden":!0}),t[23]=G):G=t[23];let K;t[24]!==j||t[25]!==N||t[26]!==W?(K=(0,y.jsxs)(a,{type:`button`,variant:`ghost`,className:`h-9 shrink-0 gap-1.5 px-2.5 text-fg-muted`,title:j,"aria-label":j,onClick:N,children:[W,G]}),t[24]=j,t[25]=N,t[26]=W,t[27]=K):K=t[27];let q;t[28]!==U||t[29]!==K?(q=(0,y.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center justify-between gap-4 border-b border-edge bg-surface-panel px-4 sm:px-5`,children:[U,K]}),t[28]=U,t[29]=K,t[30]=q):q=t[30];let J;t[31]===N?J=t[32]:(J=(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,y.jsx)(g,{embedded:!0,onRequestClose:N})}),t[31]=N,t[32]=J);let Y;t[33]!==q||t[34]!==J?(Y=(0,y.jsxs)(u,{children:[z,(0,y.jsx)(d,{className:`xopc-work-discovery-dialog pointer-events-none fixed inset-0 z-[76] flex items-center justify-center p-3 outline-none sm:p-6`,children:(0,y.jsxs)(`section`,{className:`xopc-work-discovery-panel pointer-events-auto flex h-[min(47.5rem,calc(100dvh-1.5rem))] w-[min(45rem,calc(100vw-1.5rem))] flex-col overflow-hidden rounded-2xl border border-edge bg-surface-base shadow-float sm:h-[min(47.5rem,calc(100dvh-3rem))] sm:w-[min(45rem,calc(100vw-3rem))]`,children:[q,J]})})]}),t[33]=q,t[34]=J,t[35]=Y):Y=t[35];let X;return t[36]!==T||t[37]!==Y||t[38]!==R?(X=(0,y.jsx)(p,{open:T,onOpenChange:R,children:Y}),t[36]=T,t[37]=Y,t[38]=R,t[39]=X):X=t[39],X}function S(e){return e.status===`running`}function C(e){return e.language}export{x as WorkDiscoveryOverlay};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r,l as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as ee}from"./x-B_N4OPjy.js";import{t as te}from"./cn-JdwAhgNB.js";import{t as s}from"./button-CSEbl4zT.js";import{t as ne}from"./messages-ctG2e-ix.js";import{n as re}from"./locale-store-C5MK9WcP.js";import{$a as c,Fl as ie,Ga as ae,Ja as l,Ka as oe,Nl as u,Oa as d,Ps as f,Q as se,Qa as ce,Ua as p,Wa as le,Xa as ue,Ya as de,Z as fe,Za as pe,Zc as m,eo as h,es as me,qa as he,qc as ge,rl as _e,to as ve,yl as ye}from"./index-_cuTcWjB.js";var g=e(t(),1),_=new Set([`completed`,`failed`,`canceled`]);function be(){return new Promise(e=>window.setTimeout(e,1200))}async function xe(e,t){let n=[],r=t.wait??be;for(let i=0;i<e.length&&!t.shouldStop?.();i+=1){let a=e[i];if(a)try{await t.grantDirectory(a.rootPath);let o=await t.startRun(a.rootPath);for(t.onRun(o,i,e.length);!_.has(o.status)&&!t.shouldStop?.();)await r(),o=await t.fetchRun(o.id),t.onRun(o,i,e.length);if(n.push(o),o.status===`canceled`||t.shouldStop?.())break}catch(e){if(t.onError?.(e,a,i),t.shouldStop?.())break}}return n}var v=new Set([`local-recent-files`,`chromium-bookmarks`,`apple-notes`,`apple-calendar`,`apple-reminders`]);function Se(e){return new Set(e.filter(e=>e.availability===`available`&&v.has(e.id)).map(e=>e.id))}var y=n(),Ce=[`folder_structure`,`recent_progress`,`next_steps`];function b(e){return e instanceof Error?e.message:String(e)}function we({embedded:e=!1,onRequestClose:t}={}){let n=re(e=>e.language),_=ne(n).onboarding.workDiscovery,be=ne(n).chat.workingDirectory,v=i(),[we]=r(),x=e||we.get(`new`)===`1`,[S,C]=(0,g.useState)(`loading`),[w,T]=(0,g.useState)(null),[E,D]=(0,g.useState)(null),[O,k]=(0,g.useState)(!1),[A,j]=(0,g.useState)(null),[Te,M]=(0,g.useState)(!1),[N,P]=(0,g.useState)(``),[F,I]=(0,g.useState)(!1),[L,R]=(0,g.useState)(()=>new Set),[z,Ee]=(0,g.useState)([]),[B,V]=(0,g.useState)(()=>new Set),[De,H]=(0,g.useState)([]),[U,Oe]=(0,g.useState)(!1),[W,G]=(0,g.useState)({current:0,total:0}),[ke,Ae]=(0,g.useState)([]),[K,je]=(0,g.useState)(()=>new Set),q=(0,g.useRef)(!1),Me=e=>{je(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})};(0,g.useEffect)(()=>{let e=!1;return window.electronAPI?.understandingSources?.catalog().then(t=>{e||(Ae(t),je(Se(t)))}),()=>{e=!0}},[]);let J=(0,g.useCallback)(e=>{p.getState().updateDirectoryRun(e),D(e),e.status===`completed`?(R(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),C(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`)):e.status===`failed`||e.status===`canceled`?C(`error`):C(`running`)},[]),Ne=async()=>{k(!0),j(null);try{let e=await ae();if(!e.length){j(_.noCandidates);return}Ee(e),V(new Set([e[0].rootPath])),C(`candidates`)}catch(e){j(b(e))}finally{k(!1)}},Pe=e=>{V(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Fe=(0,g.useCallback)((e,t,n)=>{p.getState().updateDirectoryRun(e),D(e),G({current:t+1,total:n}),H(n=>{let r=[...n];return r[t]=e,r}),C(`running`)},[]),Ie=(0,g.useCallback)(e=>{H(t=>t.map(t=>t?.id===e.id?e:t))},[]),Le=async()=>{let e=z.filter(e=>B.has(e.rootPath));if(!e.length)return;k(!0),j(null),H([]),G({current:1,total:e.length}),Oe(!0),q.current=!1;let t=!1;try{let n=await xe(e,{grantDirectory:de,startRun:c,fetchRun:l,shouldStop:()=>q.current,onRun:(e,n,r)=>{Fe(e,n,r),t||(t=!0,p.getState().collectSources(e.id,[...K]))},onError:(t,n,r)=>{G({current:r+1,total:e.length}),j(_.folderAnalysisFailed.replace(`{{folder}}`,n.displayName).replace(`{{error}}`,b(t)))}});if(q.current)return;let r=n.find(e=>e.status===`completed`)??n.at(-1);r?J(r):C(`candidates`)}catch(e){j(b(e)),C(`candidates`)}finally{Oe(!1),k(!1)}},Y=se({onPicked:(0,g.useCallback)(async e=>{k(!0),j(null);try{T(await ue(e)),C(`consent`)}catch(e){j(b(e)),C(`intro`)}finally{k(!1)}},[])});(0,g.useEffect)(()=>{let e=!1;return he().then(async({enabled:n,state:r})=>{if(!e){if(!n){t?t():v(`/chat`,{replace:!0});return}if(!x&&r.activeRunId)try{let t=await l(r.activeRunId);e||J(t);return}catch{}e||C(`intro`)}}).catch(t=>{e||(j(b(t)),C(`intro`))}),()=>{e=!0}},[J,v,t,x]),(0,g.useEffect)(()=>{if(!E||S!==`running`||U)return;let e=!1,t=async()=>{try{let t=await l(E.id);e||J(t)}catch{}},n=window.setInterval(()=>void t(),1200),r=e=>{let n=e.detail;(!n?.runId||n.runId===E.id)&&t()};for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.addEventListener(e,r);return()=>{e=!0,window.clearInterval(n);for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.removeEventListener(e,r)}},[J,U,S,E]);let Re=async()=>{k(!0);try{await oe()}finally{t?t():v(`/chat`,{replace:!0})}},ze=async()=>{if(w){k(!0),j(null),H([]),G({current:0,total:0});try{await de(w.canonicalRootPath);let e=await c(w.canonicalRootPath);J(e),p.getState().collectSources(e.id,[...K])}catch(e){j(b(e)),C(`consent`)}finally{k(!1)}}},X=(e,t)=>{let n=t?`?draft=${encodeURIComponent(t)}`:``;v(`/chat/${encodeURIComponent(e)}${n}`)},Be=e=>{D(e),M(!1),I(!1),R(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),e.status===`completed`?C(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?C(`error`):C(`running`)},Ve=async()=>{E&&(q.current=!0,J(await le(E.id)))},Z=async(e,t)=>{if(!E)return;await ce(E.id,e.id).catch(()=>{});let r=t?`${n===`zh`?`先帮我评估这个方向,不要修改文件:`:`First assess this direction without changing files:`}\n\n${e.actionPrompt}`:e.actionPrompt;X(E.sessionKey,r)},He=async()=>{if(E){k(!0),j(null);try{let e=E.result?.profileCandidates??[],t=await h((e.length>0?await ve(E.id,e.map(e=>({id:e.id,status:L.has(e.id)?`accepted`:`rejected`}))):E).id,`confirmed`);D(t),Ie(t),C(`recommendation`)}catch(e){j(b(e))}finally{k(!1)}}},Q=async e=>{if(!(!E||!N.trim())){k(!0),j(null);try{let t=await h(E.id,e,N.trim());D(t),X(t.sessionKey,N.trim())}catch(e){j(b(e)),k(!1)}}},Ue=async()=>{if(E){k(!0);try{X((await h(E.id,`dismissed`)).sessionKey)}catch(e){j(b(e)),k(!1)}}},$=E?.result?.suggestions.find(e=>e.id===E.result?.primarySuggestionId)??E?.result?.suggestions[0],We=E?.result?.suggestions.filter(e=>e.id!==$?.id)??[],Ge=e=>e===`command`?_.riskCommand:e===`file_write`?_.riskFileWrite:_.riskAnalysis,Ke=De.filter(e=>e?.status===`completed`),qe=e&&S===`candidates`,Je=Ke.length>1?(0,y.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,y.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:_.analysisResults}),(0,y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Ke.map(e=>{let t=z.find(t=>t.rootPath===e.rootPath)?.displayName??e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return(0,y.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-sm font-medium transition ${e.id===E?.id?`bg-accent text-white`:`bg-surface-muted text-fg hover:bg-surface-hover`}`,onClick:()=>Be(e),children:t},e.id)})})]}):null;return(0,y.jsxs)(`div`,{className:e?`flex h-full min-h-0 flex-1 flex-col overflow-hidden bg-surface-base`:`flex min-h-full flex-1 flex-col bg-surface-base`,children:[(0,y.jsxs)(`main`,{className:e?`mx-auto flex h-full min-h-0 w-full max-w-[40rem] flex-1 flex-col px-5 py-7 sm:px-8 sm:py-9 ${qe?`overflow-hidden`:`overflow-y-auto [scrollbar-gutter:stable]`}`:`mx-auto flex w-full max-w-[40rem] flex-1 flex-col px-5 py-10 sm:px-8 sm:py-16`,children:[e?null:(0,y.jsx)(`div`,{className:`mb-10 flex items-center justify-center`,children:(0,y.jsx)(me,{className:`size-11`})}),S===`loading`?(0,y.jsxs)(`div`,{className:`mx-auto flex min-h-[26rem] w-full max-w-md flex-col items-center`,"aria-busy":!0,children:[(0,y.jsx)(d,{className:`h-8 w-64 max-w-full`}),(0,y.jsx)(d,{className:`mt-4 h-4 w-full max-w-sm`}),(0,y.jsx)(d,{className:`mt-2 h-4 w-4/5 max-w-xs`}),(0,y.jsx)(d,{className:`mt-10 h-12 w-full rounded-xl`}),(0,y.jsx)(d,{className:`mt-3 h-11 w-full rounded-xl`}),(0,y.jsx)(d,{className:`mt-5 h-4 w-3/5 max-w-56`})]}):null,S===`intro`?(0,y.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,y.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:_.title}),(0,y.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:_.subtitle})]}),(0,y.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[ke.length?(0,y.jsxs)(`div`,{className:`mb-5 rounded-xl border border-edge bg-surface-panel p-3 text-left`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:_.localSourcesTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:_.localSourcesSubtitle}),(0,y.jsx)(`div`,{className:`mt-3 grid grid-cols-2 gap-2 sm:grid-cols-3`,children:ke.map(e=>{let t=K.has(e.id);return(0,y.jsxs)(`button`,{type:`button`,className:te(`flex min-h-16 flex-col items-center justify-center gap-1 rounded-lg border px-2 py-2 text-xs font-medium transition-colors`,t?`border-accent/40 bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-pressed":t,onClick:()=>Me(e.id),children:[(0,y.jsx)(`span`,{className:te(`flex size-4 items-center justify-center rounded-full border`,t?`border-accent bg-accent text-white`:`border-edge`),children:t?(0,y.jsx)(a,{className:`size-3`,"aria-hidden":!0}):null}),e.displayName]},e.id)})})]}):null,(0,y.jsxs)(s,{type:`button`,className:`h-12 w-full gap-2 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void Ne(),disabled:O||Y.picking,children:[O?(0,y.jsx)(o,{className:`size-4 animate-spin`}):(0,y.jsx)(f,{className:`size-4`}),_.quickScan]}),(0,y.jsxs)(s,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:Y.pick,disabled:O||Y.picking,children:[Y.picking?(0,y.jsx)(o,{className:`size-4 animate-spin`}):(0,y.jsx)(m,{className:`size-4`}),_.chooseFolderManually]}),(0,y.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,y.jsx)(f,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,y.jsx)(`span`,{children:_.quickScanNote})]}),(0,y.jsx)(`button`,{type:`button`,className:`mt-4 text-sm font-medium text-accent-fg hover:underline`,onClick:()=>v(`/connectors?understanding=1&returnTo=%2Fonboarding%2Fworkspace`),children:_.connectCloudSource}),A?(0,y.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null]}),(0,y.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void Re(),disabled:O,children:_.skip})]}):null,S===`candidates`?(0,y.jsxs)(`section`,{className:e?`flex h-full min-h-0 flex-col`:void 0,"aria-labelledby":`work-discovery-candidates-title`,children:[(0,y.jsxs)(`div`,{className:e?`shrink-0 text-center`:`text-center`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:_.candidatesTitle}),(0,y.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:_.candidatesSubtitle})]}),(0,y.jsx)(`div`,{className:e?`mt-5 min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain pr-1 [scrollbar-gutter:stable]`:`mt-7 space-y-2`,children:z.map((e,t)=>{let n=B.has(e.rootPath);return(0,y.jsxs)(`button`,{type:`button`,"aria-pressed":n,className:`flex w-full items-start gap-3 rounded-xl border p-4 text-left transition ${n?`border-accent bg-accent-soft/45`:`border-edge bg-surface-panel hover:border-edge-strong`}`,onClick:()=>Pe(e.rootPath),children:[(0,y.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border ${n?`border-accent bg-accent text-white`:`border-edge bg-surface-base text-transparent`}`,children:(0,y.jsx)(a,{className:`size-3.5`})}),(0,y.jsx)(m,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),t===0?(0,y.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:_.recommendedCandidate}):null]}),(0,y.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,y.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,y.jsx)(`span`,{children:e.projectKind===`coding`?_.codingProject:e.projectKind===`general`?_.generalProject:_.unknownProject}),e.branch?(0,y.jsx)(`span`,{children:_.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,y.jsx)(`span`,{children:_.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,y.jsxs)(`div`,{className:e?`shrink-0 border-t border-edge-subtle pt-4`:void 0,children:[(0,y.jsxs)(`div`,{className:`${e?``:`mt-5 `}flex items-start gap-2 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 text-xs leading-5 text-fg-muted`,children:[(0,y.jsx)(f,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,y.jsx)(`span`,{children:_.multiFolderPrivacyNote})]}),A?(0,y.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:A}):null,(0,y.jsxs)(`div`,{className:`${e?`mt-4`:`mt-7`} flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsxs)(s,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O||B.size===0,onClick:()=>void Le(),children:[O?(0,y.jsx)(o,{className:`mr-2 size-4 animate-spin`}):null,_.analyzeSelected.replace(`{{count}}`,String(B.size))]}),(0,y.jsx)(s,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:Y.pick,children:_.chooseFolderManually})]}),(0,y.jsx)(`button`,{type:`button`,className:`${e?`mt-3`:`mt-6`} mx-auto block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>C(`intro`),children:_.back})]})]}):null,S===`consent`&&w?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:_.selectedTitle}),(0,y.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:_.selectedSubtitle})]}),(0,y.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,y.jsx)(m,{className:`size-5 shrink-0 text-accent-fg`}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:w.displayName}),(0,y.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:w.canonicalRootPath})]}),(0,y.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:w.projectKind===`coding`?_.codingProject:w.projectKind===`general`?_.generalProject:_.unknownProject})]}),(0,y.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle bg-surface-base/60 p-4 sm:grid-cols-2`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:_.localFingerprint}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:w.fingerprint.branch?_.branchValue.replace(`{{branch}}`,w.fingerprint.branch):_.noGitBranch})]}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:_.recentActivity}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:_.changedFiles.replace(`{{count}}`,String(w.fingerprint.changedFileCount))})]}),w.fingerprint.recentAreas.length>0?(0,y.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:_.recentAreas}),(0,y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:w.fingerprint.recentAreas.map(e=>(0,y.jsx)(`code`,{className:`rounded-md bg-surface-muted px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,y.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,y.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,y.jsx)(_e,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:_.willRead}),(0,y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:_.willReadValue})]})]}),(0,y.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,y.jsx)(ee,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:_.willIgnore}),(0,y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:_.willIgnoreValue})]})]}),(0,y.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,y.jsx)(f,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,y.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:w.remoteModel?_.providerDisclosure.replace(`{{provider}}`,w.provider):_.localDisclosure})]})]})]}),A?(0,y.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null,(0,y.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsxs)(s,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O,onClick:()=>void ze(),children:[O?(0,y.jsx)(o,{className:`mr-2 size-4 animate-spin`}):null,_.startAnalysis]}),(0,y.jsx)(s,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:Y.pick,children:_.changeFolder})]}),(0,y.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void Re(),children:_.skip})]}):null,S===`running`&&E?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:_.analyzingTitle}),(0,y.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:_.analyzingSubtitle}),W.total>1?(0,y.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:_.analyzingFolderProgress.replace(`{{current}}`,String(W.current)).replace(`{{total}}`,String(W.total))}):null]}),(0,y.jsx)(`div`,{className:`mt-9 rounded-xl border border-edge bg-surface-panel px-5 py-2`,children:Ce.map((e,t)=>{let n=Math.max(0,Ce.indexOf(E.stage??`folder_structure`)),r=t<n,i=t===n;return(0,y.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,y.jsx)(`span`,{className:`flex size-7 items-center justify-center rounded-full ${r?`bg-accent text-white`:i?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-subtle`}`,children:r?(0,y.jsx)(a,{className:`size-4`}):i?(0,y.jsx)(o,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,y.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`})}),(0,y.jsx)(`span`,{className:i||r?`text-sm font-medium text-fg`:`text-sm text-fg-muted`,children:_.stages[e]})]},e)})}),(0,y.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:E.rootPath}),(0,y.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3`,children:[(0,y.jsx)(s,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:()=>v(`/chat`),children:_.continueInBackground}),(0,y.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void Ve(),children:_.cancelAnalysis})]})]}):null,S===`recognition`&&E?.result?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-recognition-title`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:_.recognitionEyebrow}),(0,y.jsx)(`h1`,{id:`work-discovery-recognition-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:E.result.lowConfidence?_.lowConfidenceTitle:_.recognitionTitle})]}),Je,(0,y.jsxs)(`div`,{className:`mt-7 rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/45 via-surface-panel to-surface-panel p-5 sm:p-6`,children:[(0,y.jsx)(`p`,{className:`text-base font-medium leading-7 text-fg`,children:E.result.projectSummary}),(0,y.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:E.result.currentState}),!E.result.lowConfidence&&$?.evidence.length?(0,y.jsx)(`ul`,{className:`mt-5 space-y-2 border-t border-edge-subtle pt-4`,children:$.evidence.slice(0,3).map((e,t)=>(0,y.jsxs)(`li`,{className:`flex gap-2 text-xs leading-5 text-fg-muted`,children:[(0,y.jsx)(ge,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,y.jsxs)(`span`,{children:[e.path?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${$.id}-recognition-${t}`))}):null]}),E.result.workThreads?.length?(0,y.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:_.workThreadsTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:_.workThreadsSubtitle}),(0,y.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle`,children:E.result.workThreads.map(e=>(0,y.jsxs)(`div`,{className:`py-3 first:pt-0 last:pb-0`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:e.horizon===`current`?_.workThreadCurrent:e.horizon===`ongoing`?_.workThreadOngoing:_.workThreadLongTerm}),(0,y.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title})]}),(0,y.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:e.summary})]},e.id))})]}):null,E.result.profileCandidates?.length?(0,y.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:_.profileCandidatesTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:_.profileCandidatesSubtitle}),(0,y.jsx)(`div`,{className:`mt-3 space-y-2`,children:E.result.profileCandidates.map(e=>(0,y.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg px-2 py-2 hover:bg-surface-muted`,children:[(0,y.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 rounded border-edge accent-accent`,checked:L.has(e.id),onChange:()=>R(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})}),(0,y.jsx)(`span`,{className:`text-sm leading-5 text-fg`,children:e.statement})]},e.id))})]}):null,E.result.lowConfidence?(0,y.jsxs)(`div`,{className:`mt-5`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium leading-6 text-fg`,children:E.result.contextQuestion}),(0,y.jsx)(`textarea`,{value:N,onChange:e=>P(e.target.value),placeholder:_.correctionPlaceholder,className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,y.jsx)(s,{className:`mt-3 w-full bg-accent text-white hover:bg-accent-hover`,disabled:O||!N.trim(),onClick:()=>void Q(`different_goal`),children:_.continueWithCorrection})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsxs)(s,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O,onClick:()=>void He(),children:[O?(0,y.jsx)(o,{className:`size-4 animate-spin`}):(0,y.jsx)(a,{className:`size-4`}),_.confirmUnderstanding]}),(0,y.jsx)(s,{variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:()=>M(e=>!e),children:_.notQuiteRight})]}),Te?(0,y.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,y.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`work-discovery-correction`,children:_.correctionLabel}),(0,y.jsx)(`textarea`,{id:`work-discovery-correction`,value:N,onChange:e=>P(e.target.value),placeholder:_.correctionPlaceholder,className:`mt-2 min-h-24 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,y.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,y.jsx)(s,{variant:`ghost`,disabled:O||!N.trim(),onClick:()=>void Q(`different_goal`),children:_.differentGoal}),(0,y.jsx)(s,{variant:`primary`,disabled:O||!N.trim(),onClick:()=>void Q(`corrected`),children:_.useCorrection})]})]}):null]}),A?(0,y.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null,(0,y.jsx)(`button`,{type:`button`,disabled:O,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:()=>void Ue(),children:_.openConversation})]}):null,S===`recommendation`&&E?.result&&$?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:_.understandingConfirmed}),(0,y.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:_.primaryRecommendationTitle})]}),Je,(0,y.jsx)(`article`,{className:`mt-7 rounded-2xl border border-accent/30 bg-surface-panel p-5 sm:p-6`,children:(0,y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,y.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,y.jsx)(u,{className:`size-5`})}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:$.title}),(0,y.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:$.rationale}),(0,y.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:[(0,y.jsx)(ye,{className:`size-3.5`}),_.estimatedMinutes.replace(`{{count}}`,String($.estimatedMinutes))]}),(0,y.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:Ge($.risk)})]}),(0,y.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:_.expectedTask}),(0,y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:$.expectedTask})]}),(0,y.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,y.jsx)(s,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void Z($,!1),children:_.startRecommendedAction}),(0,y.jsx)(s,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void Z($,!0),children:_.explainFirst})]})]})]})}),We.length>0?(0,y.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between py-2 text-sm font-medium text-fg-muted hover:text-fg`,onClick:()=>I(e=>!e),children:[_.otherDirections,(0,y.jsx)(ie,{className:`size-4 transition-transform ${F?`rotate-180`:``}`})]}),F?(0,y.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:We.map(e=>(0,y.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void Z(e,!0),children:[(0,y.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,y.jsxs)(`span`,{children:[(0,y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,y.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedTask})]})]},e.id))}):null]}):null,(0,y.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,y.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>X(E.sessionKey),children:_.doSomethingElse}),(0,y.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>{M(!0),C(`recognition`)},children:_.correctUnderstanding})]})]}):null,S===`error`&&E?(0,y.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,y.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,y.jsx)(ee,{className:`size-5`})}),(0,y.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:_.errorTitle}),(0,y.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:E.errorMessage}),(0,y.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsx)(s,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void pe(E.id).then(J),children:_.retry}),(0,y.jsx)(s,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{D(null),T(null),C(`intro`)},children:_.chooseDifferent})]}),(0,y.jsx)(`button`,{type:`button`,className:`mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>X(E.sessionKey),children:_.openConversation})]}):null]}),Y.hasNativePicker?null:(0,y.jsx)(fe,{open:Y.modalOpen,onOpenChange:Y.setModalOpen,initialAbsolutePath:w?.canonicalRootPath,onConfirm:Y.confirmPick,wd:be})]})}export{we as WorkDiscoveryPage};