@xopcai/xopc 0.0.354 → 0.0.356
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.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/adapters/cli-login.js +3 -3
- package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/telegram/src/inbound-processor.js +2 -2
- package/dist/extensions/telegram/src/outbound-sender.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +2 -2
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.js +2 -2
- package/dist/extensions/weixin/src/auth/accounts.js +12 -12
- package/dist/extensions/weixin/src/messaging/debug-mode.js +5 -5
- package/dist/extensions/weixin/src/messaging/inbound.js +11 -11
- package/dist/gateway/static/root/assets/{activity-store-X7CG9pzB.js → activity-store-Bj0GuUUk.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B8PS1eLP.js → agent-avatar-dicebear-i0dJX4Ag.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-CLBSL9hl.js → agent-defaults-settings-panel-C-gsYOIi.js} +1 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-D00xRE50.js +1 -0
- package/dist/gateway/static/root/assets/agents-Bg90PJpR.js +66 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-Ck2x78jq.js → agents-admin-api-CYqmO7gb.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-COdQOmdT.js → app-management-settings-panel-LGezxe7p.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CDNjc2yy.js → appearance-settings-By7sj-tH.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-C-kvpPj8.js → apps-page-DRX7wRpG.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-QfOaQPL_.js → archive-plugin-BZHSbFiu.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-87DN5nXX.js → automations-page-B5ZRVvra.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-CQmwjCm5.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BF2lVwR9.js → binary-plugins-x2-RmzUs.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-B04Kv5DU.js → block-editor-C8eM0IQi.js} +39 -39
- package/dist/gateway/static/root/assets/{browser-automation-inputs-FW3bYZ-z.js → browser-automation-inputs-uQ2AGFFU.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-Ck6Zb9aU.js → browser-automations-page-DonJaYJ7.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-DHlyYItE.js → browser-settings-page-Cku_iTDi.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-CF4-mrIa.js → capabilities-Btku0cS3.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-BCF_160Z.js → capabilities-Cl1RErL_.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-gUGN48Ob.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C3pM7xZ1.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-PBPJJsp6.js → capability-header-actions-aXDBY-4S.js} +1 -1
- package/dist/gateway/static/root/assets/channels-BSbO91V4.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-DTd7mWyE.js → chat-terminal-dock-Bn_O5W2o.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page--9rh1mvu.js → computer-settings-page-CqzDwqcT.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-v6Is0BOO.js → connector-service-page-BYq8YaSp.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-CXVlZmoT.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-DTsMzjoZ.js → date-picker-dIJ4tP-C.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-Y1QYCcLp.js → dependency-picker-ktHB4hRk.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-D9dfZrOp.js → desktop-pet-BqXL3Ivw.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BHVOHZUL.js → desktop-pet-settings-BspF0vWW.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-CnADxQU1.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-DeMo9KlE.js → directory-picker-path-field-CyR-4zZC.js} +1 -1
- package/dist/gateway/static/root/assets/dist-C3DSFZCi.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-BrGWLJg9.js → extension-debug-page-DPc3vTw0.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-AWrvy1Nb.js → extension-page-CWqtFuVa.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-CUpbXB2k.js → extension-provider-D-0AeFhE.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-C5KgmhYu.js → extension-settings-page-92wO2TEf.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-B31I6Gbq.js → gateway-config-swr-Da3Oob_s.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-D6ffOiPe.js → gateway-realtime-BDh3i8n7.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-B5Oq6VCQ.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-DC-lok0J.js → gateway-settings-CO_50TOx.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DVol958v.js → gateway-startup-retry-BEj_bcbm.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-Ba20kfpf.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-TVgJfz9r.js → image-generation-api-8jfU8AlD.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-BKVKfVMA.js → imports-page-ciLLYJao.js} +1 -1
- package/dist/gateway/static/root/assets/index-DUgsBdV3.css +1 -0
- package/dist/gateway/static/root/assets/index-XgbDpmNc.js +106 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DiwE4gKU.js → keyboard-shortcuts-settings-7429mJN3.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-Dt3TC64L.js → local-app-workbench-page-CQyP9KBM.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-DFPhWkxU.js → local-apps-page-Cht3NkYu.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-wiq_12oN.js → local-session-drafts-jOqfUlwj.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Y1aBayM_.js → locale-store-DodizOrj.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-C4faHZHj.js → logs-page-Bye3bESN.js} +2 -2
- package/dist/gateway/static/root/assets/loopi-C09I2mNj.css +1 -0
- package/dist/gateway/static/root/assets/loopi-Djb8XU3l.js +1 -0
- package/dist/gateway/static/root/assets/{management-settings-pZLdvIiw.js → management-settings-BG2yeKtz.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-7tzqIp_G.js → markdown-view-Bb6ohqHz.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-cjgrKnne.js → media-plugins-DIhqKSK5.js} +1 -1
- package/dist/gateway/static/root/assets/messages-D8PmAUB-.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-cache-CaYi043g.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-DA_6YKSN.js +5 -0
- package/dist/gateway/static/root/assets/{notes-api-J0yhflxC.js → notes-api-DYfvIxWh.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-kc3CMA5c.js +8 -0
- package/dist/gateway/static/root/assets/{oauth-api-CYe61zfD.js → oauth-api-gSu-iTk5.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-CiBUm2Br.js → page-context-capture-button-r0vf-oBH.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-CmZzN99O.js +1 -0
- package/dist/gateway/static/root/assets/{popover-select-DcsFzD_i.js → popover-select-BNZZDJpO.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-B8_w6c3J.js → product-open-page-BdedC52J.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-CDZdKiTz.js → project-detail-page-b23nMTcO.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-BvahSrZi.js → projects-page-DCA7oEdB.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-DqDOrPQ0.js → registry-api-D0eYNizR.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DeK3ATTQ.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BnMS50vK.js → runtime-tools-settings-panel-BqD6oWU5.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-CDR1-q25.js → scenes-page-Ds6trhfL.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-B4Xa8w8S.js → schema-form-D-cjcRAn.js} +1 -1
- package/dist/gateway/static/root/assets/{send-session-input-C7Nqy0sK.js → send-session-input-DstpmO44.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-CTN4qwiN.js → session-api-qy4gMa5t.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-DsH1DZI_.js → session-manager-CFqOuGy-.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DltxWUQd.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-Bqg7glTa.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-CHZdpvkT.js → settings-page-BVfsQrWS.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-HESfALIF.js → setup-status-panel-DqkS3DKy.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-COlX10Dc.js → share-link-dialog-B3Io5mOY.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-NtRLUieq.js → share-preview-page-BpZqXsgR.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-DICV5EKH.js → shares-api-BNNaREyB.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-CEaRXDeL.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-DYgcO7y0.js → skill-api-1Hp370EM.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-CWH3Fmx4.js → skill-reload-api-Dm6GgUYK.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-Cgze-HZy.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-wXCBwYwE.js → system-settings-panel-CFSQ3Qjr.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-DEDh0FPJ.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-BKgBPLH4.js → theme-store-AXut7b8R.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-C0t8y3Mi.js → tunnel-api-WcqOMVcQ.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-A2DZAidl.js → usage-page-C6cnfavb.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-Cn6hqqyM.js → use-autosave-BT3l-ETP.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-DL61XeSu.js → use-composer-attachments-zfL8zvRu.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-Cl9mU32w.js → use-file-preview-expanded-C4bBXf4j.js} +2 -2
- package/dist/gateway/static/root/assets/user-model-page-C6_GMD0W.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-Bw05QB_V.js → voice-api-key-field-BF9hOZ_1.js} +1 -1
- package/dist/gateway/static/root/assets/voice-config-api-D8G4fALX.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-overlay-DVvqH1d-.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-rM4U1FXc.js → workflow-run-setup-panel-MDkhjfGm.js} +2 -2
- package/dist/gateway/static/root/assets/{workflows-page-QKC34FzQ.js → workflows-page-Bhu13vVb.js} +3 -3
- package/dist/gateway/static/root/assets/{workspace-api-BbBT75Kg.js → workspace-api-C4q2GwGV.js} +2 -2
- package/dist/gateway/static/root/index.html +32 -30
- package/dist/package.js +1 -1
- package/dist/packages/realtime-protocol/src/voice-catalog.js +4 -1
- package/dist/src/agent/agent-manager.js +15 -15
- package/dist/src/agent/agent-scope.js +2 -2
- package/dist/src/agent/background-review/prompts.js +1 -1
- package/dist/src/agent/background-review/run-background-review.js +4 -4
- package/dist/src/agent/coding/repository-instructions.js +1 -1
- package/dist/src/agent/context/coordinator.js +2 -2
- package/dist/src/agent/context/execution-context.js +4 -4
- package/dist/src/agent/context/execution-scope.js +2 -2
- package/dist/src/agent/context/project-context.js +3 -3
- package/dist/src/agent/data-acquisition/service.js +1 -1
- package/dist/src/agent/embedded/index.js +2 -2
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.d.ts +1 -0
- package/dist/src/agent/embedded/run-for-session.js +6 -5
- package/dist/src/agent/embedded/run-turn.js +24 -6
- package/dist/src/agent/embedded/session-tool-result-guard.js +3 -3
- package/dist/src/agent/embedded/tool-result-truncation.js +1 -1
- package/dist/src/agent/embedded/types.d.ts +1 -0
- package/dist/src/agent/external-tools/cliProvider.js +3 -3
- package/dist/src/agent/external-tools/composio-provider.js +3 -3
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/external-tools/gateway-tools.js +1 -1
- package/dist/src/agent/external-tools/mcp-provider.js +3 -3
- package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
- package/dist/src/agent/image/generation/providers/dashscope.js +1 -1
- package/dist/src/agent/image/generation/providers/fal.js +1 -1
- package/dist/src/agent/image/generation/providers/google.js +1 -1
- package/dist/src/agent/image/generation/runtime.js +1 -1
- package/dist/src/agent/image/index.js +1 -1
- package/dist/src/agent/image/load-image-media.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +2 -2
- package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
- package/dist/src/agent/inbound/inbound-loop.js +2 -2
- package/dist/src/agent/index.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-config.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-gateway.js +1 -1
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +2 -2
- package/dist/src/agent/mcp/index.js +2 -2
- package/dist/src/agent/mcp/mcp-stdio-transport.js +1 -1
- package/dist/src/agent/mcp/mcp-transport.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/mcp/plugin-http-fetch.js +1 -1
- package/dist/src/agent/memory/context-recovery.js +1 -1
- package/dist/src/agent/memory/index.js +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
- package/dist/src/agent/prompt/sections/messaging-runtime.js +2 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +2 -2
- package/dist/src/agent/sandbox/exec-policy.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -0
- package/dist/src/agent/service/direct-turn-helpers.js +5 -4
- package/dist/src/agent/service/process-direct-one-shot.js +1 -1
- package/dist/src/agent/service/process-direct-streaming.js +6 -5
- package/dist/src/agent/service/webchat-tts.js +2 -2
- package/dist/src/agent/service.js +22 -22
- package/dist/src/agent/session/session-config-service.js +1 -1
- package/dist/src/agent/session/session-hydrator.js +1 -1
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/source-context/index.js +2 -2
- package/dist/src/agent/tasks/task-judge-service.js +4 -4
- package/dist/src/agent/tools/create-share-tool.js +3 -3
- package/dist/src/agent/tools/dataBatch.js +1 -1
- package/dist/src/agent/tools/delegate-tool.js +3 -3
- package/dist/src/agent/tools/delegation-parent-policy.js +1 -1
- package/dist/src/agent/tools/executor.js +1 -1
- package/dist/src/agent/tools/factory.js +16 -16
- package/dist/src/agent/tools/fetch-text.js +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +3 -3
- package/dist/src/agent/tools/index.js +6 -6
- package/dist/src/agent/tools/list-dir.js +1 -1
- package/dist/src/agent/tools/personal-preference-tool.d.ts +1 -1
- package/dist/src/agent/tools/personal-preference-tool.js +3 -2
- package/dist/src/agent/tools/personal-task-tool.d.ts +2 -1
- package/dist/src/agent/tools/personal-task-tool.js +27 -8
- package/dist/src/agent/tools/publish-artifacts.js +2 -2
- package/dist/src/agent/tools/read.js +2 -2
- package/dist/src/agent/tools/review-workspace.js +1 -1
- package/dist/src/agent/tools/send-media.js +2 -2
- package/dist/src/agent/tools/skills-tools.js +1 -1
- package/dist/src/agent/tools/tts-tool.js +1 -1
- package/dist/src/agent/tools/user-context-tool.js +1 -1
- package/dist/src/agent/tools/write.js +2 -2
- package/dist/src/agent/tools/xopc-use-tool.js +5 -5
- package/dist/src/agent/workflow/subagent-runner.js +1 -1
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/agent-config/schema.d.ts +20 -1
- package/dist/src/agent-config/schema.js +7 -1
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/oauth-provider-lock.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/domain/index.js +2 -2
- package/dist/src/automations/index.js +4 -4
- package/dist/src/automations/service/automation-service.js +2 -2
- package/dist/src/backup/archive.js +1 -1
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/browser/native-messaging-host.js +1 -1
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/channels/attachments/voice-stt-webchat.js +2 -2
- package/dist/src/channels/index.js +2 -2
- package/dist/src/channels/outbound-sender.js +1 -1
- package/dist/src/channels/pairing/allow-from-file.js +9 -9
- package/dist/src/channels/pairing/pairing-store.js +6 -6
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/chat-commands/builtins/config.js +3 -3
- package/dist/src/chat-commands/builtins/review.js +1 -1
- package/dist/src/chat-commands/builtins/session.js +1 -1
- package/dist/src/chat-commands/builtins/thinking.js +1 -1
- package/dist/src/chat-commands/builtins/tts.js +1 -1
- package/dist/src/chat-commands/builtins/understanding.js +1 -1
- package/dist/src/chat-commands/builtins/workflow.js +2 -2
- package/dist/src/chat-commands/context.js +3 -3
- package/dist/src/chat-commands/index.js +3 -3
- package/dist/src/cli/commands/agent.js +7 -7
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/doctor/checks/channel-plugins.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/gateway-health.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +2 -2
- package/dist/src/cli/commands/doctor/checks/tool-runtimes.js +1 -1
- package/dist/src/cli/commands/extension-agent-plugin.js +2 -2
- package/dist/src/cli/commands/extension-dev.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +2 -2
- package/dist/src/cli/commands/extension.js +4 -4
- package/dist/src/cli/commands/gateway/shared.js +1 -1
- package/dist/src/cli/commands/gateway/token.js +1 -1
- package/dist/src/cli/commands/image.js +1 -1
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/models.js +3 -3
- package/dist/src/cli/commands/onboard/channels/registry.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/project.js +2 -2
- package/dist/src/cli/commands/runtime.js +1 -1
- package/dist/src/cli/commands/skills.js +2 -2
- package/dist/src/cli/commands/tunnel.js +4 -4
- package/dist/src/cli/extension-cli-register.js +5 -5
- package/dist/src/cli/utils/gateway-client.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +2 -2
- package/dist/src/cli/utils/session.js +1 -1
- package/dist/src/computer/runtime.js +2 -2
- package/dist/src/config/index.js +8 -8
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +2 -2
- package/dist/src/config/schema.js +1 -1
- package/dist/src/connectors/cli/authorization.js +1 -1
- package/dist/src/connectors/cli/runtime.js +1 -1
- package/dist/src/connectors/composio-sessions.js +1 -1
- package/dist/src/connectors/composio.js +1 -1
- package/dist/src/connectors/connected-source-understanding.js +3 -3
- package/dist/src/connectors/connection-recovery-service.js +5 -5
- package/dist/src/connectors/health.js +1 -1
- package/dist/src/connectors/plugin-mcp-recovery.js +1 -1
- package/dist/src/discussions/live-worker.js +1 -1
- package/dist/src/discussions/recording.js +1 -1
- package/dist/src/discussions/sealer.js +1 -1
- package/dist/src/extensions/activation-context.js +3 -3
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/extensions/api.js +4 -4
- package/dist/src/extensions/bundled-extension-activation.js +1 -1
- package/dist/src/extensions/index.js +3 -3
- package/dist/src/extensions/install.js +1 -1
- package/dist/src/extensions/loader.js +2 -2
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/extensions/sdk/media.js +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/device-routes.js +2 -2
- package/dist/src/gateway/file-path-classifier.js +2 -2
- package/dist/src/gateway/global-defaults-admin.js +1 -1
- package/dist/src/gateway/hono/app.js +3 -3
- package/dist/src/gateway/hono/lib/config-payload.js +4 -4
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/browser.js +1 -1
- package/dist/src/gateway/hono/routes/commands-skills.js +4 -4
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
- package/dist/src/gateway/hono/routes/home.js +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +2 -2
- package/dist/src/gateway/hono/routes/media.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +24 -6
- package/dist/src/gateway/hono/routes/notes.js +3 -3
- package/dist/src/gateway/hono/routes/personal-agent.js +135 -8
- package/dist/src/gateway/hono/routes/projects.js +4 -4
- package/dist/src/gateway/hono/routes/session-command-handler.js +1 -1
- package/dist/src/gateway/hono/routes/session-input-handler.js +4 -4
- package/dist/src/gateway/hono/routes/sessions.js +2 -2
- package/dist/src/gateway/hono/routes/shares.js +3 -3
- package/dist/src/gateway/hono/routes/side-chats.js +1 -1
- package/dist/src/gateway/hono/routes/site-shares.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +2 -2
- package/dist/src/gateway/hono/routes/user-model-refresh.js +1 -1
- package/dist/src/gateway/hono/routes/user-model.js +5 -5
- package/dist/src/gateway/hono/routes/voice.js +33 -8
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/image-generation-setup.js +3 -3
- package/dist/src/gateway/index.js +1 -1
- package/dist/src/gateway/lock.js +11 -11
- package/dist/src/gateway/media-access.js +1 -1
- package/dist/src/gateway/mobile-privacy.js +2 -2
- package/dist/src/gateway/ports.js +6 -6
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/scenes/mailContext.js +1 -1
- package/dist/src/gateway/scenes/slackThreadSource.js +1 -1
- package/dist/src/gateway/security/gateway-scopes.js +2 -0
- package/dist/src/gateway/server.js +1 -1
- package/dist/src/gateway/service/agent-runner.js +41 -0
- package/dist/src/gateway/service/config-coordinator.js +3 -3
- package/dist/src/gateway/service/run-gateway-agent.js +5 -4
- package/dist/src/gateway/service/session-command-service.js +2 -2
- package/dist/src/gateway/service/sessions-api.js +1 -1
- package/dist/src/gateway/service.js +49 -49
- package/dist/src/gateway/session-context-summary.js +2 -2
- package/dist/src/gateway/session-reset-service.js +1 -1
- package/dist/src/gateway/workspace-editor-path.js +2 -2
- package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +11 -1
- package/dist/src/gateway/xopc-cloud-capability-setup.js +146 -10
- package/dist/src/gateway/xopc-cloud-onboarding.d.ts +3 -0
- package/dist/src/gateway/xopc-cloud-onboarding.js +27 -0
- package/dist/src/home-intelligence/generator.js +1 -1
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/infra/gateway-processes.js +2 -2
- package/dist/src/infra/path-env.js +3 -3
- package/dist/src/infra/update-global.js +10 -10
- package/dist/src/local-apps/service.js +2 -2
- package/dist/src/mcp/gateway-http-client.js +1 -1
- package/dist/src/media-understanding/openai-compatible-audio.js +1 -1
- package/dist/src/notes/agent-context.js +4 -4
- package/dist/src/notes/index.js +1 -1
- package/dist/src/notes/service.js +1 -1
- package/dist/src/notes/store.js +1 -1
- package/dist/src/personal-agent/onboarding.d.ts +27 -0
- package/dist/src/personal-agent/onboarding.js +48 -0
- package/dist/src/personal-agent/repository.d.ts +6 -1
- package/dist/src/personal-agent/repository.js +7 -2
- package/dist/src/personal-agent/service.d.ts +24 -6
- package/dist/src/personal-agent/service.js +38 -15
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-catalog-persistence.js +2 -2
- package/dist/src/providers/model-reference-auditor.js +1 -1
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/remote-access/exposure-manager.js +1 -1
- package/dist/src/scenes/taskFollowUp/agentExecutor.js +4 -4
- package/dist/src/scenes/taskFollowUp/resources.js +1 -1
- package/dist/src/scenes/taskFollowUp/service.js +4 -4
- package/dist/src/session/index.js +2 -2
- package/dist/src/session/resolve-session.js +1 -1
- package/dist/src/session/session-title.js +1 -1
- package/dist/src/session/store.js +4 -4
- package/dist/src/session/thinking-resolve.js +1 -1
- package/dist/src/share/share-store.js +1 -1
- package/dist/src/share/share-thumbnail.js +1 -1
- package/dist/src/share/share-zip.js +1 -1
- package/dist/src/share/site-proxy.js +1 -1
- package/dist/src/share/site-share-store.js +1 -1
- package/dist/src/storage/sqlite/connection.js +9 -9
- package/dist/src/storage/sqlite/migrations/230_personal_agent_onboarding.sql +8 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.js +1 -1
- package/dist/src/tasks/execution-context.js +1 -1
- package/dist/src/tasks/home-query-service.js +3 -3
- package/dist/src/tasks/index.js +4 -4
- package/dist/src/tasks/task-application-service.js +3 -3
- package/dist/src/tasks/task-collaboration-delivery.js +1 -1
- package/dist/src/tasks/task-context-assembler.js +1 -1
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-main-update-decision-service.js +1 -1
- package/dist/src/tasks/task-main-update-delivery.js +5 -2
- package/dist/src/tasks/task-origin-repository.d.ts +4 -1
- package/dist/src/tasks/task-origin-repository.js +3 -3
- package/dist/src/tasks/task-run-coordinator.d.ts +1 -0
- package/dist/src/tasks/task-run-coordinator.js +13 -7
- package/dist/src/tasks/task-run-dispatcher.d.ts +1 -1
- package/dist/src/tasks/task-run-dispatcher.js +6 -4
- package/dist/src/tui/backends/embedded-backend.js +12 -12
- package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
- package/dist/src/tui/extension-host/load-extensions.js +1 -1
- package/dist/src/tui/tui-command-formatters.js +1 -1
- package/dist/src/tui/tui-commands.js +8 -8
- package/dist/src/tui/tui-oauth-login.js +1 -1
- package/dist/src/tui/tui-picker-overlay.js +1 -1
- package/dist/src/tui/tui-skills-autocomplete.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +4 -4
- package/dist/src/tui/tui.js +7 -7
- package/dist/src/tunnel/frpc-binary.js +1 -1
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/voice/language-profile.js +1 -1
- package/dist/src/voice/metadata/builtin.js +16 -39
- package/dist/src/voice/metadata/types.d.ts +2 -0
- package/dist/src/voice/platform-catalog.d.ts +3 -0
- package/dist/src/voice/realtime/memory-context.js +3 -3
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/dist/src/voice/realtime/runtime.js +19 -4
- package/dist/src/voice/stt/index.js +2 -2
- package/dist/src/voice/stt/preflight.js +1 -1
- package/dist/src/voice/stt/providers/alibaba-transcription.js +4 -4
- package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +1 -1
- package/dist/src/voice/stt/transcribe-core.js +1 -1
- package/dist/src/voice/stt/types.js +1 -1
- package/dist/src/voice/tts/index.js +3 -3
- package/dist/src/voice/tts/merge-config.js +1 -1
- package/dist/src/voice/tts/payload.js +1 -1
- package/dist/src/voice/tts/providers/alibaba-speech.js +4 -16
- package/dist/src/voice/tts/providers/alibaba-voices.d.ts +3 -0
- package/dist/src/voice/tts/providers/alibaba-voices.js +197 -0
- package/dist/src/voice/tts/providers/xopc-cloud-speech.js +1 -1
- package/dist/src/voice/tts/speak-core.js +1 -1
- package/dist/src/voice/tts/speech-provider-types.d.ts +1 -0
- package/dist/src/voice/tts/types.js +1 -1
- package/dist/src/work-discovery/incremental-repository.js +1 -1
- package/dist/src/work-discovery/index.js +1 -1
- package/dist/src/work-discovery/service.js +5 -5
- package/dist/src/workflows/engine/workflow-engine.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +8 -8
- package/dist/src/workflows/service/workflow-session-bridge.js +1 -1
- package/package.json +4 -4
- package/dist/gateway/static/root/assets/agent-plugin-dialog-BninweSg.js +0 -1
- package/dist/gateway/static/root/assets/agents-CcVLP_WP.js +0 -66
- package/dist/gateway/static/root/assets/automations-workspace-BdZ8NO8k.js +0 -7
- package/dist/gateway/static/root/assets/capabilities-page-C-6RLFNh.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CST_HBkR.js +0 -8
- package/dist/gateway/static/root/assets/channels-CM4sIvcP.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CryQzmEZ.js +0 -2
- package/dist/gateway/static/root/assets/device-pairing-wizard-Cy5YDZ2b.js +0 -1
- package/dist/gateway/static/root/assets/dist-3h6cXXhT.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-DQuFWNjA.js +0 -1
- package/dist/gateway/static/root/assets/home-page-C29_VFAs.js +0 -1
- package/dist/gateway/static/root/assets/index-BJh5gU04.css +0 -1
- package/dist/gateway/static/root/assets/index-ByFXhQ-T.js +0 -107
- package/dist/gateway/static/root/assets/messages-DPw2X06D.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-cache-HGrORbzR.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-BLnT1tYJ.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-BawArJvP.js +0 -8
- package/dist/gateway/static/root/assets/personal-page-Cng583RH.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CU_UdkuI.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-Ymyg98G-.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-wMZhxwTM.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-CXEBo5YL.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-Dx5v64jU.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-hoIyr7tp.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-C1jGTwjK.js +0 -2
- package/dist/gateway/static/root/assets/voice-config-api-BM75K3mR.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-xB0QpOFk.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{c as a,d as o,f as s,g as c,l,m as u,t as d,u as f}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{n as p,r as m,t as h}from"./popover-select-DcsFzD_i.js";import{t as g}from"./circle-pause-CN9jYH2s.js";import{y as _}from"./markdown-view-7tzqIp_G.js";import{O as v,c as y,g as b}from"./notes-api-J0yhflxC.js";import{t as x}from"./settings-2-D-csvaET.js";import{t as S}from"./sparkles-DHlfQFAF.js";import{t as C}from"./x-B_N4OPjy.js";import{t as w}from"./messages-DPw2X06D.js";import{a as T,c as E,n as D,r as O}from"./locale-store-Y1aBayM_.js";import{a as k,i as A,n as j,o as M,r as N,s as P,t as F}from"./dist-BGTk37IG.js";import{a as I,i as L,n as ee}from"./vendor-swr-BIWyz7Rc.js";import{t as R}from"./button-CS04eWY9.js";import{a as z}from"./gateway-realtime-D6ffOiPe.js";import{t as B}from"./skeleton-BwbyijEw.js";import{$o as te,Fo as ne,Ki as re,Kt as ie,Mc as ae,Nc as oe,Po as se,Zt as ce,ai as le,ks as ue,vc as de,wi as fe}from"./index-ByFXhQ-T.js";import{t as pe}from"./page-context-capture-button-CiBUm2Br.js";var V=e(t(),1),H=r(),U=e=>T(O(`/api/scenes${e}`)),W=(e,t,n,r)=>T(O(`/api/scenes${e}`),{method:t,body:n===void 0?void 0:JSON.stringify(n),headers:{"Idempotency-Key":r??crypto.randomUUID()}});function G(e,t){let n=e?.status;return n===401?t?`登录已失效,请重新登录后查看智能关注。`:`Your session expired. Sign in again to view monitors.`:n===503?t?`智能关注服务暂不可用,请检查服务状态后重试。`:`The monitor service is unavailable. Check the Gateway and retry.`:n===409?t?`内容已被更新,请刷新后重新确认。`:`This content changed. Refresh and review it before trying again.`:(e?.body?.missing)?.some(e=>e.startsWith(`model_`))?t?`请先在模型设置中选择可用模型并配置凭据,然后重试。`:`Choose an available model and configure its credentials in model settings, then retry.`:n===422?t?`设置或授权不完整,请检查数据来源和范围。`:`Setup or permission is incomplete. Check the source and scope.`:n===404?t?`找不到这项关注或结果,请返回智能关注列表。`:`Monitor or result not found. Return to the monitors list.`:t?`操作未完成,请检查连接后重试。你的输入仍保留在当前页面。`:`Could not finish. Check your connection and retry. Your input is still on this page.`}var K=i();function me(e){let t=(0,H.c)(39),{activationId:n,zh:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={refreshInterval:15e3},t[0]=i):i=t[0];let a=L(`/diagnostics`,U,i),o,s,c,l,u,f,p,m,h,g,_;if(t[1]!==n||t[2]!==a.data||t[3]!==r){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=a.data?.activations.find(e=>e.id===n);if(!e){c=null;break bb0}let i;t[15]===r?i=t[16]:(i=e=>e==null?r?`未设置`:`Not scheduled`:new Date(e).toLocaleString(r?`zh-CN`:`en`),t[15]=r,t[16]=i);let v=i,y;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(y={needs_permission:[`邮件授权已失效,请重新连接账号。`,`Mail permission expired. Reconnect the account.`],source_rate_limited:[`邮件服务暂时限流,将自动重试。`,`Mail service rate limited. A retry is scheduled.`],source_timeout:[`读取邮件超时,将自动重试。`,`Mail read timed out. A retry is scheduled.`],unchanged_result:[`资料未变化,已保留原成果和反馈。`,`Context unchanged. The existing result and feedback were preserved.`],source_not_ready:[`来源暂不可用,请检查连接授权;稍后会重试。`,`Source unavailable. Check connection access; a retry is scheduled.`],daily_budget:[`已达每日模型调用上限,将在预算恢复后继续。`,`Daily model limit reached. Checks resume after the budget resets.`],execution_failed:[`检查失败,请检查模型凭据和服务连接,再点“现在检查”。`,`Check failed. Verify model credentials and connectivity, then check again.`],invalid_model_result:[`模型返回的格式不符合这项关注的要求,结果未发布;请重试或更换模型。`,`The model returned an unsupported result for this monitor. Nothing was published; retry or choose another model.`],empty_input:[`请先填写安排和约束。`,`Provide arrangements and constraints first.`],source_changed:[`来源已变化,旧草稿未发布;可重新检查。`,`Source changed. The stale draft was withheld; check again.`],execution_aborted:[`检查已中断,可在服务恢复后重新检查。`,`Check interrupted. Retry after the service resumes.`]},t[17]=y):y=t[17];let b=y,x=[e.next_schedule_at,e.next_deadline_check_at,e.retry_at].filter(he),S=e.source_reason??e.last_reason;l=`space-y-2 rounded-xl border border-edge p-4 text-sm text-fg-muted`,u=(0,K.jsxs)(`p`,{children:[r?`最近发起检查`:`Last check started`,`: `,e.last_check_at==null?r?`尚未检查`:`Not checked yet`:v(e.last_check_at)]});let C=r?`下次定时检查`:`Next scheduled check`,w=e.status!==`active`||a.data?.checksPaused?r?`当前不会自动检查`:`Automatic checks inactive`:x.length?`${Math.min(...x)<=Date.now()?r?`等待执行,原定 `:`Pending, scheduled for `:``}${v(Math.min(...x))}`:r?`暂无待执行检查`:`No check scheduled`;t[18]!==C||t[19]!==w?(f=(0,K.jsxs)(`p`,{children:[C,`: `,w]}),t[18]=C,t[19]=w,t[20]=f):f=t[20],p=e.deadline_at!=null&&(0,K.jsxs)(`p`,{children:[r?`邮件跟进截止时间`:`Mail follow-up deadline`,`: `,v(e.deadline_at)]}),m=e.source_reason&&e.source_attempt_at!=null&&(0,K.jsxs)(`p`,{children:[r?`最近尝试读取邮件`:`Last mail read attempt`,`: `,v(e.source_attempt_at),` · `,r?`连续失败`:`Consecutive failures`,`: `,e.source_failures]}),h=e.source_reason&&(0,K.jsx)(d,{to:`/capabilities/connectors`,className:`inline-block text-accent underline`,children:r?`检查连接授权`:`Check connection access`}),g=e.source_success_at!=null&&(0,K.jsxs)(`p`,{children:[r?`最近成功读取邮件`:`Last successful mail read`,`: `,v(e.source_success_at)]}),_=S&&b[S]&&(0,K.jsx)(`p`,{role:`status`,children:b[S][+!r]});let T=r?`当前关注使用的模型`:`Current monitor model`,E=a.data.currentModel??(r?`配置不可用`:`Configuration unavailable`);t[21]!==T||t[22]!==E?(o=(0,K.jsxs)(`p`,{children:[T,`: `,E]}),t[21]=T,t[22]=E,t[23]=o):o=t[23],s=e.source_reason&&e.status===`active`&&!a.data?.checksPaused&&e.source_retry_at!=null&&(0,K.jsxs)(`p`,{children:[r?`来源重试时间`:`Source retry`,`: `,v(e.source_retry_at)]})}t[1]=n,t[2]=a.data,t[3]=r,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let v=r?`所有智能关注待检查`:`Pending checks across monitors`,y;t[24]!==a.data.pendingChecks||t[25]!==v?(y=(0,K.jsxs)(`p`,{children:[v,`: `,a.data.pendingChecks]}),t[24]=a.data.pendingChecks,t[25]=v,t[26]=y):y=t[26];let b;return t[27]!==o||t[28]!==s||t[29]!==y||t[30]!==l||t[31]!==u||t[32]!==f||t[33]!==p||t[34]!==m||t[35]!==h||t[36]!==g||t[37]!==_?(b=(0,K.jsxs)(`section`,{className:l,children:[u,f,p,m,h,g,_,o,s,y]}),t[27]=o,t[28]=s,t[29]=y,t[30]=l,t[31]=u,t[32]=f,t[33]=p,t[34]=m,t[35]=h,t[36]=g,t[37]=_,t[38]=b):b=t[38],b}function he(e){return e!=null}function ge(e){let t=(0,H.c)(13),{dirty:n,zh:r}=e,i;t[0]===n?i=t[1]:(i=e=>{n&&(e.preventDefault(),e.returnValue=``)},t[0]=n,t[1]=i),a(i);let o=l(n),s=o.state===`blocked`,c=r?`放弃未保存的更改?`:`Discard unsaved changes?`,u=r?`当前内容尚未保存,现在离开将丢失这些更改。`:`Your changes have not been saved. Leaving now will discard them.`,d=r?`放弃并离开`:`Discard and leave`,f=r?`继续编辑`:`Keep editing`,p,m;t[2]===o?(p=t[3],m=t[4]):(p=()=>{o.state===`blocked`&&o.proceed()},m=()=>{o.state===`blocked`&&o.reset()},t[2]=o,t[3]=p,t[4]=m);let h;return t[5]!==s||t[6]!==c||t[7]!==u||t[8]!==d||t[9]!==f||t[10]!==p||t[11]!==m?(h=(0,K.jsx)(le,{open:s,title:c,description:u,confirmLabel:d,cancelLabel:f,destructive:!0,overlayClassName:`z-[100]`,contentClassName:`z-[101]`,onConfirm:p,onCancel:m}),t[5]=s,t[6]=c,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h):h=t[12],h}function _e({zh:e}){let[t,n]=(0,V.useState)(!1),[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(),[s,c]=(0,V.useState)(!1);async function l(){n(!0),o(void 0),c(!1);try{if(await Notification.requestPermission()!==`granted`){c(!0);return}let{publicKey:t}=await W(`/browser/prepare`,`POST`);await navigator.serviceWorker.register(`/notification-sw.js`);let n=await navigator.serviceWorker.ready,r=Uint8Array.from(atob(t.replace(/-/g,`+`).replace(/_/g,`/`)),e=>e.charCodeAt(0)),a=await n.pushManager.getSubscription(),o=a?.options.applicationServerKey;a&&(!o||!new Uint8Array(o).every((e,t)=>e===r[t])||o.byteLength!==r.byteLength)&&(await a.unsubscribe(),a=null),a??=await n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:r}),await W(`/browser/subscriptions`,`POST`,{...a.toJSON(),expirationTime:a.expirationTime,language:e?`zh`:`en`}),i(!0)}catch(e){o(e)}finally{n(!1)}}let u=ie()&&`PushManager`in window;return(0,K.jsxs)(`div`,{className:`space-y-2 border-t border-edge pt-3`,children:[(0,K.jsx)(R,{disabled:t||!u,onClick:()=>void l(),children:r?e?`刷新此浏览器提醒订阅`:`Refresh this browser subscription`:e?`开启页面关闭后的浏览器提醒`:`Enable reminders when this page is closed`}),r&&(0,K.jsx)(`p`,{role:`status`,children:e?`此浏览器已订阅。服务需持续运行;送达取决于浏览器和系统权限。`:`Subscribed. The Gateway must remain running; delivery depends on browser and system permissions.`}),(!u||s)&&(0,K.jsx)(`p`,{className:`text-fg-muted`,children:e?`当前环境或通知权限不支持后台提醒。成果仍会保留在智能关注收件箱;可在支持推送的 HTTPS 浏览器中开启。`:`Background reminders are unavailable here. Results remain in your monitor inbox. Use a push-capable HTTPS browser and allow notifications.`}),a!=null&&(0,K.jsx)(`p`,{role:`alert`,className:`text-danger`,children:G(a,e)})]})}function ve(e){let t=(0,H.c)(23),{zh:n,open:r,onOpenChange:i,onCloseAutoFocus:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,K.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=e=>{e.preventDefault(),a()},t[1]=a,t[2]=s);let c=n?`检查与提醒设置`:`Checks and reminders`,l;t[3]===c?l=t[4]:(l=(0,K.jsx)(P,{className:`text-base font-semibold text-fg`,children:c}),t[3]=c,t[4]=l);let u=n?`适用于所有智能关注,设置更改后自动保存。`:`Applies to all monitors. Changes are saved automatically.`,d;t[5]===u?d=t[6]:(d=(0,K.jsx)(A,{className:`mt-1 text-sm text-fg-muted`,children:u}),t[5]=u,t[6]=d);let f;t[7]!==l||t[8]!==d?(f=(0,K.jsxs)(`div`,{className:`shrink-0 border-b border-edge p-4 sm:px-6`,children:[l,d]}),t[7]=l,t[8]=d,t[9]=f):f=t[9];let p;t[10]===n?p=t[11]:(p=(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4 sm:p-6`,children:(0,K.jsx)(ye,{zh:n})}),t[10]=n,t[11]=p);let m=n?`关闭`:`Close`,h;t[12]===m?h=t[13]:(h=(0,K.jsx)(`div`,{className:`flex shrink-0 justify-end border-t border-edge p-4 sm:px-6`,children:(0,K.jsx)(j,{asChild:!0,children:(0,K.jsx)(R,{type:`button`,variant:`secondary`,children:m})})}),t[12]=m,t[13]=h);let g;t[14]!==h||t[15]!==s||t[16]!==f||t[17]!==p?(g=(0,K.jsxs)(M,{children:[o,(0,K.jsxs)(N,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(40rem,calc(100dvh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,onCloseAutoFocus:s,children:[f,p,h]})]}),t[14]=h,t[15]=s,t[16]=f,t[17]=p,t[18]=g):g=t[18];let _;return t[19]!==i||t[20]!==r||t[21]!==g?(_=(0,K.jsx)(F,{open:r,onOpenChange:i,children:g}),t[19]=i,t[20]=r,t[21]=g,t[22]=_):_=t[22],_}function ye({zh:e}){let t=L(`/preferences`,U),[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)();async function o(e,i=t.data?.revision){if(!t.data||n||i===void 0)return!1;r(!0),a(void 0);try{let n=await W(`/preferences`,`PATCH`,{...e,expectedRevision:i});return await t.mutate(n,!1),!0}catch(e){return a(e),await t.mutate(),!1}finally{r(!1)}}if(!t.data)return t.error?(0,K.jsx)(`p`,{role:`alert`,children:G(t.error,e)}):(0,K.jsx)(B,{className:`h-32 w-full`});let s=t.data,c=`w-24 rounded-md border border-edge bg-surface-panel px-2 py-1 text-fg`;return(0,K.jsxs)(`div`,{className:`space-y-4 text-sm`,children:[(0,K.jsx)(`p`,{className:`text-fg-muted`,children:e?`设备休眠或服务关闭时不会检查;服务恢复后继续。草稿不会自动发送。`:`Checks require the device and Gateway to stay running. Drafts are never sent automatically.`}),[[`checksPaused`,e?`暂停所有检查`:`Pause all checks`],[`notificationsMuted`,e?`静音提醒(继续检查并保留成果)`:`Mute reminders (continue checks and keep results)`],[`suppressWhileViewing`,e?`查看成果时不重复提醒`:`Avoid reminders while viewing a result`],[`digestEnabled`,e?`汇总为每日摘要`:`Use a daily digest`]].map(([e,t])=>(0,K.jsxs)(`label`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:s[e],disabled:n,onChange:t=>void o({[e]:t.target.checked})}),t]},e)),(0,K.jsxs)(`label`,{className:`flex flex-wrap items-center gap-2`,children:[e?`时区`:`Timezone`,(0,K.jsx)(be,{value:s.timezone,revision:s.revision,disabled:n,className:`${c} w-48`,zh:e,onSave:(e,t)=>o({timezone:String(e)},t)})]}),[[`quietStartHour`,e?`免打扰开始(小时)`:`Quiet hours start`,23],[`quietEndHour`,e?`免打扰结束(小时)`:`Quiet hours end`,23],[`dailyNotificationLimit`,e?`每日提醒上限`:`Daily reminder limit`,30],...s.digestEnabled?[[`digestHour`,e?`摘要时间(小时)`:`Digest hour`,23],[`digestMinute`,e?`摘要时间(分钟)`:`Digest minute`,59]]:[]].map(([t,r,i])=>(0,K.jsxs)(`label`,{className:`flex flex-wrap items-center gap-2`,children:[r,(0,K.jsx)(be,{value:s[t],revision:s.revision,max:i,disabled:n,className:c,zh:e,onSave:(e,n)=>o({[t]:Number(e)},n)})]},t)),(0,K.jsxs)(`label`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`input`,{type:`checkbox`,disabled:n,checked:s.preferredChannel===`browser`,onChange:e=>void o({preferredChannel:e.target.checked?`browser`:`in_app`})}),e?`允许浏览器后台提醒`:`Allow background browser reminders`]}),(0,K.jsx)(_e,{zh:e}),i!=null&&(0,K.jsx)(`p`,{role:`alert`,className:`text-danger`,children:G(i,e)}),s.checksPausedUntil&&(0,K.jsx)(R,{disabled:n,onClick:()=>void o({checksPausedUntil:null}),children:e?`取消定时暂停`:`Clear timed pause`})]})}function be(e){let t=(0,H.c)(26),{value:n,revision:r,max:i,disabled:a,className:o,zh:s,onSave:c}=e,[l,u]=(0,V.useState)(null),d;t[0]!==l||t[1]!==i||t[2]!==c||t[3]!==n?(d=async()=>{if(!l||l.value===String(n))return;let e=i===void 0?l.value:Number(l.value);!l.value||typeof e==`number`&&(!Number.isInteger(e)||e<0||e>i)||await c(e,l.revision)&&u(null)},t[0]=l,t[1]=i,t[2]=c,t[3]=n,t[4]=d):d=t[4];let f=d,p=i===void 0?`text`:`number`,m=i===void 0?void 0:0,h=l?.value??n,g;t[5]===r?g=t[6]:(g=e=>u(t=>({value:e.target.value,revision:t?.revision??r})),t[5]=r,t[6]=g);let _;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{e.key===`Escape`&&u(null)},t[7]=_):_=t[7];let v;t[8]===f?v=t[9]:(v=e=>{e.relatedTarget instanceof HTMLElement&&e.relatedTarget.hasAttribute(`data-discard-preference`)||f()},t[8]=f,t[9]=v);let y;t[10]!==o||t[11]!==a||t[12]!==i||t[13]!==p||t[14]!==m||t[15]!==h||t[16]!==g||t[17]!==v?(y=(0,K.jsx)(`input`,{type:p,min:m,max:i,value:h,disabled:a,className:o,onChange:g,onKeyDown:_,onBlur:v}),t[10]=o,t[11]=a,t[12]=i,t[13]=p,t[14]=m,t[15]=h,t[16]=g,t[17]=v,t[18]=y):y=t[18];let b;t[19]!==a||t[20]!==l||t[21]!==s?(b=l&&(0,K.jsx)(R,{"data-discard-preference":!0,type:`button`,variant:`ghost`,disabled:a,onPointerDown:xe,onClick:()=>u(null),children:s?`放弃修改`:`Discard edits`}),t[19]=a,t[20]=l,t[21]=s,t[22]=b):b=t[22];let x;return t[23]!==y||t[24]!==b?(x=(0,K.jsxs)(K.Fragment,{children:[y,b]}),t[23]=y,t[24]=b,t[25]=x):x=t[25],x}function xe(e){return e.preventDefault()}function Se({item:e,zh:t,onChange:n}){let r=(0,V.useRef)(null);(0,V.useEffect)(()=>{let t=crypto.randomUUID(),n=!1,i=()=>{W(`/presence`,`POST`,{clientId:t,surface:`web`,presentationId:e.id,visible:n&&document.visibilityState===`visible`&&document.hasFocus()}).catch(()=>void 0)},a=new IntersectionObserver(([e])=>{n=e.isIntersecting,i()},{threshold:.5});r.current&&a.observe(r.current);let o=setInterval(i,2e4);return document.addEventListener(`visibilitychange`,i),window.addEventListener(`focus`,i),window.addEventListener(`blur`,i),()=>{a.disconnect(),clearInterval(o),document.removeEventListener(`visibilitychange`,i),window.removeEventListener(`focus`,i),window.removeEventListener(`blur`,i),n=!1,i()}},[e.id]);let[i,a]=(0,V.useState)(!1),o=`/presentations/${encodeURIComponent(e.id)}`,s=L(e.readOnly?null:`${o}/feedback`,U),{mutate:c}=I(),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(),p=async e=>{if(s.data){u(!0),f(void 0);try{let t=s.data.feedback?.note??``,n=await W(`${o}/feedback`,`POST`,{expectedRevision:s.data.feedback?.revision??0,rating:e});await s.mutate({feedback:{rating:e,note:t,revision:n.revision}},{revalidate:!1}),c(`/metrics`)}catch(e){f(e),s.mutate()}finally{u(!1)}}},m=async()=>{u(!0),f(void 0);try{await W(o,`PATCH`,{read:e.status!==`read`}),n()}catch(e){f(e)}finally{u(!1)}};return(0,K.jsxs)(`article`,{ref:r,className:`space-y-3 rounded-xl border border-edge bg-surface-panel p-4 sm:p-6`,children:[e.createdAt!=null&&(0,K.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[t?`生成于`:`Generated`,` `,new Date(e.createdAt).toLocaleString(t?`zh-CN`:`en`)]}),e.sourceHealth?.reason&&(0,K.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:t?`邮件来源暂不可用,这份成果尚未核实最新邮件,请检查连接授权后重试。`:`Mail is unavailable. This result has not been checked against the latest messages. Check connection access and retry.`}),(0,K.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-relaxed text-fg`,children:e.content.summary}),(0,K.jsx)(R,{variant:`ghost`,onClick:()=>{navigator.clipboard.writeText(e.content.summary).then(()=>a(!0)).catch(f)},children:i?t?`已复制`:`Copied`:t?`复制成果`:`Copy result`}),(0,K.jsx)(`div`,{className:`space-y-1 text-xs text-fg-muted`,children:e.sources?.length?e.sources.map(e=>(0,K.jsxs)(`p`,{children:[(0,K.jsx)(`a`,{className:`text-accent underline`,href:e.href,target:e.kind===`mail`?`_blank`:void 0,rel:`noreferrer`,children:e.kind===`notes`?t?`查看关注资料`:`View monitor notes`:e.title||(t?`查看原邮件`:`View original email`)}),e.sender&&` · ${e.sender}`]},e.href)):(0,K.jsx)(`p`,{children:t?`来源详情暂不可用`:`Source details unavailable`})}),e.readOnly?(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`这份成果已结束、过期或延后,仅供查阅。`:`This result is resolved, expired or snoozed, and is available for reference.`}):(0,K.jsxs)(K.Fragment,{children:[s.error?(0,K.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[G(s.error,t),(0,K.jsx)(R,{onClick:()=>void s.mutate(),children:t?`重新加载`:`Reload`})]}):s.data?(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`useful`,`not_useful`].map(e=>(0,K.jsx)(R,{disabled:l,"aria-pressed":s.data?.feedback?.rating===e,onClick:()=>void p(e),children:e===`useful`?t?`对我有帮助`:`Helpful`:t?`没有帮助`:`Not helpful`},e))}):(0,K.jsx)(B,{className:`h-11 w-48`}),(0,K.jsx)(R,{disabled:l,variant:`ghost`,onClick:()=>void m(),children:e.status===`read`?t?`标为未读`:`Mark unread`:t?`标为已读`:`Mark read`})]}),!!d&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:G(d,t)})]})}var Ce=`min-h-11 w-full rounded-md border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`;function we({activation:e,zh:t,onDirty:n,onChanged:r}){let i=`/activations/${e.id}/schedules`,a=L(i,U),o=L(`/templates/${e.templateKey}/versions/${e.templateVersion}`,U),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(),d=()=>{a.mutate(),o.mutate()};if(a.error||o.error)return(0,K.jsxs)(`div`,{role:`alert`,children:[(0,K.jsx)(`p`,{children:G(a.error??o.error,t)}),(0,K.jsx)(R,{onClick:d,children:t?`重新加载`:`Reload`})]});if(!a.data||!o.data)return(0,K.jsx)(B,{className:`h-32 w-full`});let f=o.data.template.triggers.find(e=>e.type===`schedule`);if(!f)return null;let p=a.data.schedules.find(e=>e.triggerKey===f.id);return(0,K.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-edge p-4 sm:p-6`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t?`检查时间`:`Review schedule`}),p?(0,K.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.status===`active`?t?`下次检查:`:`Next check: `:t?`当前不会定时检查。已保存时间:`:`Not scheduling while inactive. Saved time: `,new Intl.DateTimeFormat(t?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`,timeZone:p.schedule.timeZone}).format(p.nextDueAt),` · `,p.schedule.timeZone]}):(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`尚未设置定时检查。只有你点“现在检查”才会执行周期复盘。`:`No recurring schedule yet. Use Check now for a manual review.`}),!!l&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:G(l,t)}),s?(0,K.jsx)(Te,{initial:s.cursor,zh:t,onCancel:()=>{c(null),n(!1)},onSave:async e=>{u(void 0);try{await W(`${i}/${encodeURIComponent(f.id)}`,`PATCH`,{expectedRevision:s.cursor?.revision??0,schedule:e}),c(null),n(!1),await a.mutate(),r?.()}catch(e){throw u(e),e}}}):(0,K.jsx)(R,{disabled:e.status!==`active`,onClick:()=>{u(void 0),c({cursor:p}),n(!0)},children:p?t?`修改时间`:`Edit schedule`:t?`设置时间`:`Set schedule`}),(0,K.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t?`没有值得关注的新变化时保持安静。暂停关注会停止定时检查。`:`Stays quiet when there is no useful change. Pause the monitor to stop scheduled checks.`})]})}function Te({initial:e,zh:t,onSave:n,onCancel:r}){let[i,a]=(0,V.useState)(e?.schedule.weekdays??[0]),[o,s]=(0,V.useState)(`${String(e?.schedule.hour??18).padStart(2,`0`)}:${String(e?.schedule.minute??0).padStart(2,`0`)}`),[c,l]=(0,V.useState)(e?.schedule.timeZone??Intl.DateTimeFormat().resolvedOptions().timeZone),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(!1),m=async e=>{e.preventDefault();try{new Intl.DateTimeFormat(`en`,{timeZone:c})}catch{p(!0);return}if(!i.length||!/^\d{2}:\d{2}$/.test(o)){p(!0);return}p(!1),d(!0);try{let[e,t]=o.split(`:`).map(Number);await n({weekdays:i,hour:e,minute:t,timeZone:c})}catch{}finally{d(!1)}};return(0,K.jsx)(`form`,{onSubmit:e=>void m(e),children:(0,K.jsxs)(`fieldset`,{disabled:u,className:`space-y-4`,children:[(0,K.jsxs)(`fieldset`,{children:[(0,K.jsx)(`legend`,{className:`mb-2 text-sm font-medium text-fg`,children:t?`每周检查日`:`Days of the week`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(t?[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`]:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`]).map((e,t)=>(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-2 rounded-md border border-edge px-3 text-sm text-fg`,children:[(0,K.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i.includes(t),onChange:e=>a(n=>e.target.checked?[...n,t].sort():n.filter(e=>e!==t))}),e]},t))})]}),(0,K.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm font-medium text-fg`,children:[t?`当地时间`:`Local time`,(0,K.jsx)(`input`,{type:`time`,required:!0,value:o,onChange:e=>s(e.target.value),className:Ce})]}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm font-medium text-fg`,children:[t?`时区(例如 Asia/Shanghai)`:`Time zone (for example Asia/Shanghai)`,(0,K.jsx)(`input`,{required:!0,maxLength:100,value:c,onChange:e=>l(e.target.value),className:Ce,spellCheck:!1})]})]}),f&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t?`请选择至少一天,并填写有效时间和时区。`:`Choose at least one day and enter a valid time and time zone.`}),(0,K.jsxs)(`div`,{className:`flex gap-3`,children:[(0,K.jsx)(R,{type:`submit`,disabled:u,children:u?t?`正在保存…`:`Saving…`:t?`保存时间`:`Save schedule`}),(0,K.jsx)(R,{type:`button`,onClick:r,children:t?`取消`:`Cancel`})]})]})})}function Ee({value:e,disabled:t,zh:n,onChange:r}){let i=L(`/sources/mail/accounts`,U),[a,o]=(0,V.useState)(``),[s,c]=(0,V.useState)(``),[l,u]=(0,V.useState)([]),[f,p]=(0,V.useState)(!1),[m,g]=(0,V.useState)(!1),[_,v]=(0,V.useState)(),y=a||i.data?.accounts[0]?.id||``;async function b(){p(!0),v(void 0),u([]),g(!0),r({id:``,accountId:``,subject:``,sender:``});try{u((await W(`/sources/mail/search`,`POST`,{accountId:y,query:s})).sources)}catch(e){v(e)}finally{p(!1)}}if(i.error)return(0,K.jsxs)(`div`,{role:`alert`,className:`space-y-2 text-sm text-danger`,children:[(0,K.jsx)(`p`,{children:G(i.error,n)}),(0,K.jsx)(R,{onClick:()=>void i.mutate(),children:n?`重新加载`:`Reload`})]});if(!i.data)return(0,K.jsx)(B,{className:`h-24 w-full`});let x=e=>`${e.subject||(n?`无主题邮件`:`Untitled mail`)} · ${e.sender||e.accountId}`;return(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`搜索会读取所选 Gmail 账号的匹配邮件;开启后只持续跟进选定线程,不发送邮件,也不需要开启后台学习。`:`Search reads matching mail in your selected Gmail account. The monitor follows only the selected thread, never sends mail, and requires no background learning.`}),(0,K.jsx)(h,{value:y,disabled:t||f,ariaLabel:n?`邮箱账号`:`Mail account`,placeholder:n?`选择账号`:`Choose account`,allowEmpty:!1,options:i.data.accounts.map(e=>({value:e.id,label:e.label})),onChange:e=>{o(e),u([]),r({id:``,accountId:``,subject:``,sender:``})}}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[n?`主题、发件人或 Gmail 搜索条件`:`Subject, sender, or Gmail query`,(0,K.jsx)(`input`,{value:s,maxLength:500,disabled:t||f,onChange:e=>c(e.target.value),className:`rounded-md border border-edge bg-surface-panel px-3 py-2`,placeholder:n?`例如 from:alice@example.com`:`e.g. from:alice@example.com`})]}),(0,K.jsx)(R,{type:`button`,disabled:t||f||!y||!s.trim(),onClick:()=>void b(),children:f?n?`正在搜索…`:`Searching…`:n?`搜索邮件`:`Search mail`}),(0,K.jsx)(h,{value:e,disabled:t||f,ariaLabel:n?`要跟进的邮件`:`Mail to follow`,placeholder:n?`选择邮件线程`:`Choose a thread`,allowEmpty:!1,options:l.map(e=>({value:e.id,label:x(e)})),onChange:e=>{let t=l.find(t=>t.id===e);t&&r(t)}}),!i.data.accounts.length&&(0,K.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[n?`请连接 Gmail,并允许读取及后台检查;要求每次确认或仅限指定 Agent 的账号暂不支持。`:`Connect Gmail and allow background reads. Accounts requiring confirmation for every read or restricted to specific agents are not supported yet.`,` `,(0,K.jsx)(d,{className:`text-accent underline`,to:`/capabilities/connectors`,children:n?`管理连接`:`Manage connections`})]}),m&&!f&&!_&&!l.length&&(0,K.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:n?`没有找到匹配线程,请调整搜索条件。`:`No matching threads. Try a different query.`}),_!=null&&(0,K.jsx)(`p`,{role:`alert`,className:`text-danger`,children:G(_,n)})]})}function De({activation:e,zh:t,onDirty:n,onChanged:r}){let i=`/activations/${e.id}/work-items`,a=L(i,U),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(),[u,d]=(0,V.useState)(!1),f=()=>{s(null),n(!1),a.mutate(),r()};if(a.error)return(0,K.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[G(a.error,t),(0,K.jsx)(R,{onClick:()=>void a.mutate(),children:t?`重新加载`:`Reload`})]});if(!a.data)return(0,K.jsx)(B,{className:`h-32 w-full`});let p=a.data.workItems[0],m=async e=>{if(p){d(!0),l(void 0);try{await W(`/work-items/${p.id}`,`PATCH`,{expectedRevision:p.revision,status:e}),f()}catch(e){l(e)}finally{d(!1)}}};return(0,K.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-edge p-4 sm:p-6`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t?`这封邮件的跟进时间`:`Follow-up deadline`}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:p?`${p.status===`watching`?t?`留意回复,到时检查`:`Watching replies; check at deadline`:p.status===`paused`?t?`已暂停跟进`:`Follow-up paused`:t?`已结束跟进`:`Follow-up ended`} · ${new Intl.DateTimeFormat(t?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}).format(p.dueAt)}`:t?`设置一个时间;此前有新回复时会重新判断是否还需要跟进。`:`Choose a deadline. New replies before then trigger a review of whether follow-up is still needed.`}),!!c&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:G(c,t)}),o?(0,K.jsx)(Oe,{initial:o.item?.dueAt,zh:t,onCancel:()=>{s(null),n(!1)},onSave:async t=>{l(void 0);try{o.item?await W(`/work-items/${o.item.id}`,`PATCH`,{expectedRevision:o.item.revision,dueAt:t,status:`watching`}):e.scope.kind===`objects`&&await W(i,`POST`,{subjectId:e.scope.ids[0],accountId:e.permissions.accountIds[0],dueAt:t}),f()}catch(e){throw l(e),e}}}):(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[p?.status!==`completed`&&(0,K.jsx)(R,{disabled:u||e.status!==`active`,onClick:()=>{s({item:p}),n(!0),l(void 0)},children:p?t?`重新设置跟进时间`:`Reschedule follow-up`:t?`设置跟进时间`:`Set deadline`}),p?.status===`watching`&&(0,K.jsx)(R,{disabled:u,onClick:()=>void m(`paused`),children:t?`暂停这次跟进`:`Pause follow-up`}),p&&p.status!==`completed`&&(0,K.jsx)(R,{disabled:u,onClick:()=>void m(`completed`),children:t?`结束这次跟进`:`End follow-up`})]}),(0,K.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t?`结束跟进只停止检查,不表示邮件已发送或事情已经解决。`:`Ending stops checks; it does not mean a message was sent or the matter resolved.`})]})}function Oe({initial:e,zh:t,onSave:n,onCancel:r}){let[i,a]=(0,V.useState)(()=>{if(!e)return``;let t=new Date(e);return new Date(e-t.getTimezoneOffset()*6e4).toISOString().slice(0,16)}),[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(!1),u=async e=>{e.preventDefault();let t=new Date(i).getTime();if(!Number.isFinite(t)||t<=Date.now()){l(!0);return}l(!1),s(!0);try{await n(t)}catch{}finally{s(!1)}};return(0,K.jsx)(`form`,{onSubmit:e=>void u(e),children:(0,K.jsxs)(`fieldset`,{disabled:o,className:`space-y-3`,children:[(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm font-medium text-fg`,children:[t?`跟进时间(当前设备时区)`:`Deadline (device time zone)`,(0,K.jsx)(`input`,{required:!0,type:`datetime-local`,value:i,onChange:e=>a(e.target.value),className:`min-h-11 w-full min-w-0 rounded-md border border-edge bg-surface-panel px-3 py-2 text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`})]}),c&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t?`请选择未来的有效时间。`:`Choose a valid future time.`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(R,{type:`submit`,disabled:o,children:o?t?`正在保存…`:`Saving…`:t?`保存跟进时间`:`Save deadline`}),(0,K.jsx)(R,{type:`button`,onClick:r,children:t?`取消`:`Cancel`})]})]})})}var ke=e(n(),1),q=`min-h-11 w-full rounded-md border border-edge bg-surface-panel px-3 py-2 text-base text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:text-sm`,J=`min-w-0 space-y-4 rounded-xl border border-edge bg-surface-panel p-4`;function Ae(e,t,n){return e===`none`?[]:[`workspace.read`,...t?[`workspace.write`]:[],...e===`worktree`&&n.trim()?[`verification.run`]:[]]}function je({template:e}){let t=D(e=>e.language)===`zh`,n=(e,n)=>t?e:n,r=s(),i=L(`/source-providers`,U),[a,o]=(0,V.useState)(``),c=a||i.data?.providers[0]?.id||``,l=L(c?`/source-providers/${encodeURIComponent(c)}/accounts`:null,U),u=L(`follow-up-projects`,()=>fe({limit:100})),[f,h]=(0,V.useState)(``),[g,_]=(0,V.useState)(``),[v,y]=(0,V.useState)(``),[b,x]=(0,V.useState)(``),[S,C]=(0,V.useState)(``),[w,T]=(0,V.useState)(`none`),[E,O]=(0,V.useState)(!1),[k,A]=(0,V.useState)(``),[j,M]=(0,V.useState)(!1),[N,P]=(0,V.useState)(``),[F,I]=(0,V.useState)(!1),ee=(0,V.useRef)(null),z=u.data?.items.filter(e=>e.workspaceRoot)??[],te=f||(l.data?.accounts.length===1?l.data.accounts[0].id:``),ne=g||(z.length===1?z[0].id:``);async function re(i){if(i.preventDefault(),!j){M(!0),P(``);try{let{source:t}=await W(`/source-providers/${encodeURIComponent(c)}/resolve-link`,`POST`,{accountId:te,url:v}),i={source:t,sourceUrl:v,goal:b,instruction:S,resource:w,...w===`worktree`?{projectId:ne}:{},capabilities:Ae(w,E,k),...w===`worktree`&&k.trim()?{verificationCommand:k.trim()}:{}},a={templateKey:e.key,templateVersion:e.version,configuration:i},o=await W(`/preflight`,`POST`,a);if(!o.ready){let e={verification_backend:n(`可选验证需要配置隔离后端;也可清空验证命令,先生成修改。`,`Optional verification needs an isolation backend. Clear the command to proceed without running tests.`),verification_backend_unavailable:n(`验证后端不可用;检查配置或清空验证命令。`,`Verification backend unavailable. Check settings or clear the command.`),clean_base_checkout:n(`项目基础工作区有未提交改动,请先整理。`,`The project base checkout has uncommitted changes.`),source_read_permission:n(`来源读取权限不足,请检查连接。`,`Source read permission is missing. Check the connection.`),model_credentials:n(`请配置模型凭据。`,`Configure model credentials.`),model_configuration:n(`请选择可用模型。`,`Choose an available model.`)};P(o.missing.map(t=>e[t]??t).join(` `));return}let s=await W(`/activations`,`POST`,a);(0,ke.flushSync)(()=>I(!0)),r(`/scenes/${s.activation.id}`,{replace:!0})}catch(e){P(G(e,t))}finally{M(!1),setTimeout(()=>ee.current?.focus(),0)}}}return i.error||l.error||u.error?(0,K.jsx)(`p`,{role:`alert`,children:G(i.error??l.error??u.error,t)}):!i.data||!u.data||c&&!l.data?(0,K.jsxs)(`div`,{"aria-busy":`true`,children:[(0,K.jsx)(B,{className:`h-12`}),(0,K.jsx)(B,{className:`mt-4 h-32`})]}):(0,K.jsxs)(`form`,{className:`space-y-5`,onSubmit:re,children:[(0,K.jsx)(ge,{dirty:!F&&!!(v||b||S),zh:t}),(0,K.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:e.title}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.description}),(0,K.jsxs)(`fieldset`,{disabled:j,className:`space-y-5`,children:[(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[n(`来源`,`Source`),(0,K.jsx)(p,{"aria-label":n(`来源`,`Source`),value:c,onChange:e=>{o(e.target.value),h(``)},required:!0,children:i.data.providers.map(e=>(0,K.jsx)(m,{value:e.id,children:e.label},e.id))})]}),!l.data?.accounts.length&&(0,K.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[n(`请先连接可读取的账号。`,`Connect an account with read access first.`),` `,(0,K.jsx)(d,{className:`text-accent-fg`,to:`/capabilities/connectors`,children:n(`连接`,`Connections`)})]}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[n(`账号`,`Account`),(0,K.jsxs)(p,{"aria-label":n(`账号`,`Account`),value:te,onChange:e=>h(e.target.value),required:!0,children:[(0,K.jsx)(m,{value:``,children:n(`选择账号`,`Choose an account`)}),l.data?.accounts.map(e=>(0,K.jsx)(m,{value:e.id,children:e.label},e.id))]})]}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[n(`来源链接`,`Source link`),(0,K.jsx)(`input`,{className:q,type:`url`,required:!0,maxLength:2e3,value:v,onChange:e=>y(e.target.value)})]}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[n(`你希望完成什么?`,`What should be accomplished?`),(0,K.jsx)(`textarea`,{className:q,required:!0,maxLength:6e3,rows:3,value:b,onChange:e=>x(e.target.value)})]}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[n(`处理指令(可选)`,`Instructions (optional)`),(0,K.jsx)(`textarea`,{className:q,rows:3,maxLength:12e3,value:S,onChange:e=>C(e.target.value),placeholder:n(`例如:持续更新决策记录;有冲突时向我确认。`,`For example: keep a decision log updated; ask me about conflicts.`)})]}),(0,K.jsxs)(`section`,{className:J,children:[(0,K.jsx)(`h3`,{className:`font-medium text-fg`,children:n(`资源与权限`,`Resources and permissions`)}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[n(`工作资源`,`Workspace resource`),(0,K.jsxs)(p,{"aria-label":n(`工作资源`,`Workspace resource`),value:w,onChange:e=>{T(e.target.value),A(``),O(!1)},children:[(0,K.jsx)(m,{value:`none`,children:n(`无文件资源 · 分析与建议`,`No files · analysis and recommendations`)}),(0,K.jsx)(m,{value:`artifacts`,children:n(`任务产物目录 · 文档等文件`,`Task artifact folder · documents and files`)}),(0,K.jsx)(m,{value:`worktree`,children:n(`Git worktree · 项目修改`,`Git worktree · project changes`)})]})]}),w===`worktree`&&(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[n(`项目`,`Project`),(0,K.jsxs)(p,{"aria-label":n(`项目`,`Project`),required:!0,value:ne,onChange:e=>_(e.target.value),children:[(0,K.jsx)(m,{value:``,children:n(`选择本地 Git 项目`,`Choose a local Git project`)}),z.map(e=>(0,K.jsx)(m,{value:e.id,children:e.name},e.id))]})]}),w!==`none`&&(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm text-fg`,children:[(0,K.jsx)(`input`,{className:`ui-checkbox`,type:`checkbox`,checked:E,onChange:e=>O(e.target.checked)}),n(`允许创建和修改此任务工作区内的文件`,`Allow creating and editing files in this task workspace`)]}),w===`worktree`&&(0,K.jsxs)(`details`,{className:`space-y-3`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm text-fg`,children:n(`可选:授权运行验证命令`,`Optional: authorize a verification command`)}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[n(`固定验证命令(留空则不执行命令)`,`Fixed verification command (blank means no commands)`),(0,K.jsx)(`input`,{className:q,maxLength:2e3,value:k,onChange:e=>A(e.target.value),placeholder:`pnpm test`})]}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n(`仅此可选工具需要已配置的隔离后端。留空也能修改文件,但结果会标记未验证。不会自动改为宿主机执行。`,`Only this optional tool needs a configured isolation backend. File edits work without it and remain unverified. No automatic host execution.`)}),(0,K.jsx)(d,{to:`/settings/agent-defaults`,className:`text-sm text-accent-fg`,children:n(`查看执行设置`,`Execution settings`)})]}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n(`不会提交、推送、部署或对外发消息。约每分钟检查一次,Gateway 需要保持在线。`,`No commits, pushes, deployment or outgoing messages. Checks about once a minute while the Gateway is online.`)})]}),N&&(0,K.jsx)(`p`,{ref:ee,tabIndex:-1,role:`alert`,className:`text-sm text-danger`,children:N}),(0,K.jsx)(R,{variant:`primary`,type:`submit`,disabled:j||!te||w===`worktree`&&!ne,children:j?n(`正在检查并开启…`,`Checking and starting…`):n(`确认范围并开始跟进`,`Confirm scope and start following`)})]})]})}function Me({id:e,initial:t}){let n=f(),[r,i]=(0,V.useState)(!1),a=D(e=>e.language)===`zh`,o=(e,t)=>a?e:t,s=`/activations/${encodeURIComponent(e)}`,c=L(s,U,{refreshInterval:5e3,fallbackData:{details:t}}),[l,u]=(0,V.useState)(!1),[p,m]=(0,V.useState)(``);async function h(e){u(!0),m(``);try{await W(s,`PATCH`,{expectedRevision:c.data.details.activation.revision,status:e}),await c.mutate()}catch(e){m(G(e,a))}finally{u(!1)}}if(c.error)return(0,K.jsx)(`p`,{role:`alert`,children:G(c.error,a)});if(!c.data)return(0,K.jsx)(`div`,{"aria-busy":`true`,children:(0,K.jsx)(B,{className:`h-48`})});let g=c.data.details,v=g.processedRevision>0&&g.processedRevision===g.observedRevision;return(0,K.jsxs)(`div`,{className:`space-y-5`,children:[(0,K.jsx)(`h2`,{className:`break-words text-lg font-semibold text-fg`,children:g.activation.goal}),(0,K.jsx)(pe,{resource:{kind:`scene`,id:g.activation.id,revision:String(g.activation.revision)},disabled:l||r}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,role:`status`,children:g.activation.status===`archived`?o(`已停止跟进,任务与产物已保留`,`Stopped following; task and artifacts retained`):g.lastError||g.activation.status===`needs_setup`||g.receipt?.needsUser?o(`需要你处理`,`Needs your attention`):g.activation.status===`paused`?o(`已暂停`,`Paused`):g.run?.status===`running`?o(`正在处理`,`Working`):v?o(`已处理当前来源版本,继续观察变化`,`Current source revision processed; watching for updates`):o(`正在跟进`,`Following updates`)}),(0,K.jsxs)(`section`,{className:J,children:[(0,K.jsx)(`h3`,{className:`font-medium text-fg`,children:o(`来源 → 任务 → 产物`,`Source → task → artifacts`)}),(0,K.jsx)(`p`,{className:`break-words text-sm text-fg-muted`,children:g.input.source.provider}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,K.jsx)(d,{className:`text-sm text-accent-fg`,to:_(`${n.pathname}${n.search}`,g.task.id),children:o(`打开关联任务`,`Open linked task`)}),g.input.sourceUrl&&(0,K.jsx)(`a`,{className:`text-sm text-accent-fg`,href:g.input.sourceUrl,target:`_blank`,rel:`noopener noreferrer`,children:o(`打开原讨论`,`Open source`)})]}),(0,K.jsxs)(`dl`,{className:`grid grid-cols-1 gap-3 text-sm sm:grid-cols-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-fg-muted`,children:o(`已观察版本`,`Observed revision`)}),(0,K.jsx)(`dd`,{children:g.observedRevision})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-fg-muted`,children:o(`已交付版本`,`Delivered revision`)}),(0,K.jsx)(`dd`,{children:g.deliveredRevision})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-fg-muted`,children:o(`已处理版本`,`Processed revision`)}),(0,K.jsx)(`dd`,{children:g.processedRevision||`—`})]})]}),(g.environment||g.artifactPath)&&(0,K.jsxs)(`div`,{className:`space-y-2 break-all text-sm text-fg-muted`,children:[g.environment?.branchRef&&(0,K.jsxs)(`p`,{children:[o(`任务分支:`,`Task branch: `),g.environment.branchRef]}),(0,K.jsxs)(`p`,{children:[o(`产物位置:`,`Artifact location: `),g.environment?.rootPath??g.artifactPath]})]}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o(`已处理不代表通过验收。验证状态以工具证据为准。`,`Processed does not mean accepted. Verification status comes from tool evidence.`)})]}),g.lastError&&(0,K.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-danger`,children:g.lastError}),g.receipt&&(0,K.jsxs)(`section`,{className:J,children:[(0,K.jsx)(`h3`,{className:`font-medium text-fg`,children:o(`最近结果`,`Latest result`)}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:g.receipt.verification.status===`passed`?o(`已授权命令通过;仍需审阅业务结果`,`Approved command passed; review the outcome`):o(`未验证:没有当前版本的通过证据`,`Unverified: no passing evidence for the current revision`)}),(0,K.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm text-fg`,children:g.receipt.summary}),g.receipt.remainingWork.map((e,t)=>(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e},t)),(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm text-fg`,children:o(`产物与验证证据`,`Artifacts and verification evidence`)}),[...g.receipt.changes,...g.receipt.evidence].map((e,t)=>(0,K.jsxs)(`pre`,{className:`mt-3 max-h-64 overflow-y-auto whitespace-pre-wrap break-words text-xs text-fg-muted`,children:[e.title,`
|
|
2
|
-
`,e.summary]},t))]})]}),g.input.resource===`worktree`&&g.input.projectId&&(0,K.jsx)(Pe,{projectId:g.input.projectId,taskId:g.task.id}),g.activation.status===`paused`&&(0,K.jsx)(Ne,{item:g,onSaved:()=>c.mutate(),onDirty:i},g.activation.id),p&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:p}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:g.activation.status!==`archived`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(R,{variant:`secondary`,disabled:l,onClick:()=>void h(g.activation.status===`active`?`paused`:`active`),children:l?o(`处理中…`,`Working…`):g.activation.status===`active`?o(`暂停跟进与执行`,`Pause observation and execution`):o(`确认后恢复`,`Resume after review`)}),(0,K.jsx)(R,{variant:`ghost`,disabled:l,onClick:()=>void h(`archived`),children:o(`停止跟进(保留产物)`,`Stop following (keep artifacts)`)})]})})]})}function Ne({item:e,onSaved:t,onDirty:n}){let r=D(e=>e.language)===`zh`,i=(e,t)=>r?e:t,[a,o]=(0,V.useState)(null),s=a??{base:e,instruction:e.input.instruction,writable:e.input.capabilities.includes(`workspace.write`),command:e.input.verificationCommand??``},{instruction:c,writable:l,command:u}=s,d=e=>o(t=>({...t??s,...e})),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(``),g=c!==e.input.instruction||l!==e.input.capabilities.includes(`workspace.write`)||u!==(e.input.verificationCommand??``);(0,V.useEffect)(()=>(n(g||f),()=>n(!1)),[g,f,n]);async function _(n){n.preventDefault(),p(!0),h(``);try{let n=s.base;await W(`/activations/${e.activation.id}`,`PATCH`,{expectedRevision:n.activation.revision,configuration:{...n.input,instruction:c,capabilities:Ae(n.input.resource,l,u),verificationCommand:u.trim()||void 0}}),await t(),o(null)}catch(e){h(G(e,r))}finally{p(!1)}}return(0,K.jsxs)(`details`,{className:J,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm text-fg`,children:i(`调整指令与授权`,`Edit instructions and permissions`)}),(0,K.jsx)(ge,{dirty:g,zh:r}),(0,K.jsxs)(`form`,{className:`space-y-3`,onSubmit:_,children:[(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i(`处理指令`,`Instructions`),(0,K.jsx)(`textarea`,{disabled:f,className:q,rows:4,maxLength:12e3,value:c,onChange:e=>d({instruction:e.target.value})})]}),s.base.input.resource!==`none`&&(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm text-fg`,children:[(0,K.jsx)(`input`,{disabled:f,type:`checkbox`,className:`ui-checkbox`,checked:l,onChange:e=>d({writable:e.target.checked})}),i(`允许修改任务工作区文件`,`Allow task workspace file edits`)]}),s.base.input.resource===`worktree`&&(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i(`验证命令(可选;留空不执行)`,`Verification command (optional; blank disables execution)`),(0,K.jsx)(`input`,{disabled:f,className:q,maxLength:2e3,value:u,onChange:e=>d({command:e.target.value})})]}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i(`保存后仍保持暂停。确认授权范围后再恢复。`,`Saving keeps the monitor paused. Review permissions before resuming.`)}),m&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:m}),(0,K.jsx)(R,{type:`submit`,disabled:f||!g,children:f?i(`正在保存…`,`Saving…`):i(`保存指令与授权`,`Save instructions and permissions`)}),a&&(0,K.jsx)(R,{type:`button`,variant:`ghost`,disabled:f,onClick:()=>{o(null),h(``)},children:i(`放弃修改`,`Discard edits`)})]})]})}function Pe({projectId:e,taskId:t}){let n=f(),r=D(e=>e.language)===`zh`,[i,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)(``),[c,l]=(0,V.useState)(!1),[u,h]=(0,V.useState)(``),g=L(i?`/resources/projects/${encodeURIComponent(e)}/branches`:null,U),v=g.data?.branches.find(e=>e.ref===o);async function y(){if(v){l(!0),h(``);try{await W(`/resources/branch-links`,`POST`,{projectId:e,taskId:t,branchRef:v.ref,expectedSha:v.sha}),await g.mutate()}catch(e){h(G(e,r))}finally{l(!1)}}}return(0,K.jsxs)(`details`,{className:J,open:i,onToggle:e=>a(e.currentTarget.open),children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm text-fg`,children:r?`已有分支与需求关联`:`Existing branches and requirements`}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r?`只读盘点。确认关联仅记录归属,不接管该分支,也不修改、重命名或清理代码。`:`Read-only inventory. Confirming records ownership only: no takeover, edits, renaming or cleanup.`}),g.error?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:G(g.error,r)}):g.data?(0,K.jsxs)(K.Fragment,{children:[g.data.checkoutDirty&&(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r?`基础工作区存在未提交改动,已保留。`:`The base checkout has uncommitted changes; they are preserved.`}),(0,K.jsxs)(p,{"aria-label":r?`选择已有分支`:`Choose an existing branch`,value:o,onChange:e=>s(e.target.value),children:[(0,K.jsx)(m,{value:``,children:r?`选择分支查看归属`:`Choose a branch to inspect`}),g.data.branches.map(e=>(0,K.jsx)(m,{value:e.ref,children:e.ref.replace(`refs/heads/`,``)},e.ref))]}),v&&(0,K.jsxs)(`div`,{className:`space-y-3 break-all text-sm text-fg`,children:[(0,K.jsx)(`p`,{children:v.subject}),(0,K.jsx)(`p`,{className:`text-fg-muted`,children:v.sha}),v.worktree&&(0,K.jsx)(`p`,{className:`text-fg-muted`,children:v.worktree}),v.taskId?(0,K.jsx)(d,{className:`text-accent-fg`,to:v.activationId?`/scenes/${v.activationId}`:_(`${n.pathname}${n.search}`,v.taskId),children:r?`查看对应事项`:`Open associated work`}):(0,K.jsx)(R,{variant:`secondary`,disabled:c,onClick:()=>void y(),children:c?r?`关联中…`:`Linking…`:r?`确认关联到当前任务`:`Confirm association with this task`}),v.changedSinceConfirmation&&(0,K.jsx)(`p`,{className:`text-fg-muted`,children:r?`该分支在确认关联后已有新提交。`:`This branch has new commits since confirmation.`})]})]}):(0,K.jsx)(B,{className:`h-24`}),u&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:u})]})}function Fe(){let{mutate:e}=I();(0,V.useEffect)(()=>{let t=0,n,r,i=()=>{r===void 0&&(r=setTimeout(()=>{r=void 0,e(()=>!0)},50))},a=ce(e=>{e.kind===`scene`&&i()}),o=async()=>{let o=++t;n?.(),n=void 0;try{let{capabilities:s}=await T(O(`/api/capabilities/operations`));if(o!==t)return;if(!s.some(e=>e.id===`xopc.scenes.list`)){r!==void 0&&clearTimeout(r),r=void 0,e(()=>!0,void 0,{revalidate:!0});return}n=z(`resources:scenes`,{onEvent:e=>{e.event===`resource.changed`&&a(e.topic,e.data)},onGap:i},0),i()}catch{}},s=()=>{o()};return window.addEventListener(`gateway-realtime-connected`,s),o(),()=>{t++,n?.(),r!==void 0&&clearTimeout(r),window.removeEventListener(`gateway-realtime-connected`,s)}},[e])}var Ie=`recurring-work-spec`,Le={draft:`recurring-work-draft`,ready:`recurring-work-ready`,configured:`recurring-work-configured`};function Re(e){let t=Object.entries(Le).filter(([,t])=>e?.includes(t));return t.length===1?t[0][0]:`needs_review`}var Y=10;function X(e,t,n,r=`continue`){let i=w(e).recurringWork.prompts,a=(t?i[r]:i.start).replace(`{noteId}`,t??``),o=new URLSearchParams({skill:`design-recurring-work`,draft:a,autoSend:`1`});return n?.trim()?o.set(`projectId`,n.trim()):o.set(`projectScope`,`none`),`/chat/new?${o.toString()}`}function ze(){let e=(0,H.c)(17),t=D(Ue),n=w(t).recurringWork,r=E(He),[i,a]=(0,V.useState)(0),o;e[0]!==i||e[1]!==r?(o=r?[`recurring-work-specs`,r,i]:null,e[0]=i,e[1]=r,e[2]=o):o=e[2];let s;e[3]===i?s=e[4]:(s=()=>b({tag:Ie,sortBy:`updatedAt`,sortOrder:`desc`,limit:Y,offset:i*Y}),e[3]=i,e[4]=s);let{data:c,error:l,isLoading:u,mutate:f}=L(o,s),p,m;e[5]!==c||e[6]!==i?(p=()=>{c&&i>0&&i*Y>=c.total&&a(Math.max(0,Math.ceil(c.total/Y)-1))},m=[c,i],e[5]=c,e[6]=i,e[7]=p,e[8]=m):(p=e[7],m=e[8]),(0,V.useEffect)(p,m);let h=i*Y+1,g=Math.min((i+1)*Y,c?.total??0),_;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,K.jsx)(se,{className:`text-accent`,size:20,"aria-hidden":`true`}),e[9]=_):_=e[9];let v;e[10]===t?v=e[11]:(v=X(t),e[10]=t,e[11]=v);let y;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,K.jsx)(ae,{size:16,"aria-hidden":`true`}),e[12]=y):y=e[12];let x;return e[13]!==c||e[14]!==u||e[15]!==r?(x=r&&u&&!c&&(0,K.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,K.jsx)(B,{className:`h-5 w-28`}),(0,K.jsx)(B,{className:`h-14 w-full`})]}),e[13]=c,e[14]=u,e[15]=r,e[16]=x):x=e[16],(0,K.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":`recurring-work-heading`,children:[(0,K.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel p-4 sm:p-6`,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`max-w-2xl space-y-2`,children:[_,(0,K.jsx)(`h2`,{id:`recurring-work-heading`,className:`text-base font-semibold text-fg`,children:n.title}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.description}),(0,K.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.designOnly})]}),(0,K.jsx)(R,{asChild:!0,children:(0,K.jsxs)(d,{to:v,children:[n.start,y]})})]})}),x,l&&(0,K.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,K.jsx)(`p`,{className:`flex-1 text-sm text-danger`,children:n.listError}),(0,K.jsx)(R,{variant:`secondary`,onClick:()=>void f(),children:n.retry})]}),c&&!l&&c.total===0&&(0,K.jsx)(`p`,{className:`rounded-xl border border-edge bg-surface-panel p-4 text-sm text-fg-muted`,children:n.empty}),c&&!l&&c.items.length>0&&(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:n.savedPlans}),(0,K.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:c.items.map(e=>{let r=Re(e.tags);return(0,K.jsxs)(`div`,{"data-plan-stage":r,className:`min-w-0 space-y-3 rounded-xl border border-edge bg-surface-panel px-4 py-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,K.jsx)(te,{size:18,className:`shrink-0 text-fg-muted`,"aria-hidden":`true`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.title||n.untitled}),e.snippet&&(0,K.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:e.snippet})]})]}),(0,K.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:n.stage[r]}),(0,K.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.nextStep[r]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(R,{asChild:!0,variant:`ghost`,children:(0,K.jsx)(d,{"data-plan-id":e.id,to:`/scenes?${new URLSearchParams({plan:e.id,...e.projects?.[0]?.id?{projectId:e.projects[0].id}:{}})}`,children:n.view})}),(0,K.jsx)(R,{asChild:!0,variant:`ghost`,children:(0,K.jsx)(d,{to:X(t,e.id,e.projects?.[0]?.id),children:n.continue})}),r===`ready`&&(0,K.jsx)(R,{asChild:!0,variant:`secondary`,children:(0,K.jsx)(d,{to:X(t,e.id,e.projects?.[0]?.id,`implement`),children:n.prepare})})]})]},e.id)})}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,K.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.showing.replace(`{start}`,String(h)).replace(`{end}`,String(g)).replace(`{total}`,String(c.total))}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(R,{variant:`secondary`,disabled:i===0,onClick:()=>a(Ve),children:n.previous}),(0,K.jsx)(R,{variant:`secondary`,disabled:g>=c.total,onClick:()=>a(Be),children:n.next})]})]})]})]})}function Be(e){return e+1}function Ve(e){return Math.max(0,e-1)}function He(e){return e.conversationId}function Ue(e){return e.language}function We(e){let t=(0,H.c)(64),{noteId:n,projectId:r}=e,i=D(Ge),a;t[0]===i?a=t[1]:(a=w(i),t[0]=i,t[1]=a);let o=a.recurringWork,s,c;t[2]===n?(s=t[3],c=t[4]):(s=[`recurring-work-spec`,n],c=()=>y(n),t[2]=n,t[3]=s,t[4]=c);let{data:l,error:u,isLoading:f,mutate:p}=L(s,c);if(f){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsxs)(`div`,{className:`space-y-3`,"aria-busy":`true`,children:[(0,K.jsx)(B,{className:`h-8 w-2/3`}),(0,K.jsx)(B,{className:`h-40 w-full`})]}),t[5]=e):e=t[5],e}if(u){let e;t[6]===o.loadError?e=t[7]:(e=(0,K.jsx)(`p`,{className:`text-sm text-danger`,children:o.loadError}),t[6]=o.loadError,t[7]=e);let n;t[8]===p?n=t[9]:(n=()=>void p(),t[8]=p,t[9]=n);let r;t[10]!==o.retry||t[11]!==n?(r=(0,K.jsx)(R,{onClick:n,children:o.retry}),t[10]=o.retry,t[11]=n,t[12]=r):r=t[12];let i;return t[13]!==e||t[14]!==r?(i=(0,K.jsxs)(`div`,{role:`alert`,className:`space-y-3`,children:[e,r]}),t[13]=e,t[14]=r,t[15]=i):i=t[15],i}if(!l||!l.tags?.includes(`recurring-work-spec`)){let e;return t[16]===o.missing?e=t[17]:(e=(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:o.missing}),t[16]=o.missing,t[17]=e),e}let m;t[18]===l.tags?m=t[19]:(m=Re(l.tags),t[18]=l.tags,t[19]=m);let h=m,g=l.title||o.untitled,_;t[20]===g?_=t[21]:(_=(0,K.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:g}),t[20]=g,t[21]=_);let b=o.stage[h],x;t[22]===b?x=t[23]:(x=(0,K.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:b}),t[22]=b,t[23]=x);let S=o.nextStep[h],C;t[24]===S?C=t[25]:(C=(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:S}),t[24]=S,t[25]=C);let T;t[26]===o.planStatus?T=t[27]:(T=(0,K.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:o.planStatus}),t[26]=o.planStatus,t[27]=T);let E;t[28]!==C||t[29]!==T||t[30]!==_||t[31]!==x?(E=(0,K.jsxs)(`div`,{className:`space-y-1`,children:[_,x,C,T]}),t[28]=C,t[29]=T,t[30]=_,t[31]=x,t[32]=E):E=t[32];let O;t[33]!==o.beforeActivation||t[34]!==h?(O=h===`ready`&&(0,K.jsx)(`p`,{className:`rounded-lg border border-edge bg-surface-subtle p-3 text-sm text-fg-muted`,children:o.beforeActivation}),t[33]=o.beforeActivation,t[34]=h,t[35]=O):O=t[35];let k;t[36]!==l.id||t[37]!==l.markdown?(k=(0,K.jsx)(v,{content:l.markdown,noteId:l.id}),t[36]=l.id,t[37]=l.markdown,t[38]=k):k=t[38];let A;t[39]!==o.prepareImplementation||t[40]!==i||t[41]!==l.id||t[42]!==r||t[43]!==h?(A=h===`ready`&&(0,K.jsx)(R,{asChild:!0,children:(0,K.jsx)(d,{to:X(i,l.id,r,`implement`),children:o.prepareImplementation})}),t[39]=o.prepareImplementation,t[40]=i,t[41]=l.id,t[42]=r,t[43]=h,t[44]=A):A=t[44];let j;t[45]!==i||t[46]!==l.id||t[47]!==r?(j=X(i,l.id,r),t[45]=i,t[46]=l.id,t[47]=r,t[48]=j):j=t[48];let M;t[49]!==o.continueDiscussion||t[50]!==j?(M=(0,K.jsx)(R,{asChild:!0,variant:`secondary`,children:(0,K.jsx)(d,{to:j,children:o.continueDiscussion})}),t[49]=o.continueDiscussion,t[50]=j,t[51]=M):M=t[51];let N=`/notes/${encodeURIComponent(l.id)}`,P;t[52]!==o.editInNotes||t[53]!==N?(P=(0,K.jsx)(R,{asChild:!0,variant:`ghost`,children:(0,K.jsx)(d,{to:N,children:o.editInNotes})}),t[52]=o.editInNotes,t[53]=N,t[54]=P):P=t[54];let F;t[55]!==A||t[56]!==M||t[57]!==P?(F=(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2 border-t border-edge pt-4`,children:[A,M,P]}),t[55]=A,t[56]=M,t[57]=P,t[58]=F):F=t[58];let I;return t[59]!==E||t[60]!==O||t[61]!==k||t[62]!==F?(I=(0,K.jsxs)(`div`,{className:`space-y-5`,children:[E,O,k,F]}),t[59]=E,t[60]=O,t[61]=k,t[62]=F,t[63]=I):I=t[63],I}function Ge(e){return e.language}var Ke=`min-h-11 w-full rounded-md border border-edge bg-surface-panel px-3 py-2 text-base text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:text-sm`,Z=`min-w-0 rounded-xl border border-edge bg-surface-panel p-4 sm:p-6`,qe=`grid gap-2 text-sm font-medium text-fg`;function Je(e,t){return{needs_setup:[`待完成设置`,`Finish setup`],active:[`已开启`,`Active`],paused:[`已暂停`,`Paused`],completed:[`已完成`,`Completed`],archived:[`已归档`,`Archived`],running:[`正在检查`,`Checking`],succeeded:[`已准备成果`,`Result ready`],skipped:[`无需新行动`,`No new action`],retry_wait:[`等待来源或预算`,`Waiting for source or budget`],failed:[`检查失败`,`Check failed`],cancelled:[`已取消`,`Cancelled`]}[e]?.[+!t]??e}function Q(){let e=(0,H.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsxs)(`div`,{className:`space-y-4`,"aria-busy":`true`,children:[(0,K.jsx)(B,{className:`h-8 w-48`}),(0,K.jsx)(B,{className:`h-40 w-full`}),(0,K.jsx)(B,{className:`h-32 w-full`})]}),e[0]=t):t=e[0],t}function $(e){let t=(0,H.c)(24),{error:n,retry:r}=e,i=D(Ye)===`zh`;if(n?.status===503){let e=i?`智能关注尚未开放`:`Monitors are not available yet`,r;t[0]===e?r=t[1]:(r=(0,K.jsx)(`h1`,{className:`text-xl font-semibold text-fg`,children:e}),t[0]=e,t[1]=r);let a;t[2]!==n||t[3]!==i?(a=G(n,i),t[2]=n,t[3]=i,t[4]=a):a=t[4];let o;t[5]===a?o=t[6]:(o=(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a}),t[5]=a,t[6]=o);let s=i?`返回对话`:`Back to chat`,c;t[7]===s?c=t[8]:(c=(0,K.jsx)(R,{asChild:!0,children:(0,K.jsx)(d,{to:`/chat`,children:s})}),t[7]=s,t[8]=c);let l;return t[9]!==r||t[10]!==o||t[11]!==c?(l=(0,K.jsxs)(`section`,{className:`${Z} space-y-3`,children:[r,o,c]}),t[9]=r,t[10]=o,t[11]=c,t[12]=l):l=t[12],l}let a;t[13]!==n||t[14]!==i?(a=G(n,i),t[13]=n,t[14]=i,t[15]=a):a=t[15];let o;t[16]===a?o=t[17]:(o=(0,K.jsx)(`p`,{className:`text-sm text-danger`,children:a}),t[16]=a,t[17]=o);let s;t[18]!==r||t[19]!==i?(s=r&&(0,K.jsxs)(R,{onClick:r,children:[(0,K.jsx)(ne,{size:16,"aria-hidden":`true`}),i?`重新加载`:`Reload`]}),t[18]=r,t[19]=i,t[20]=s):s=t[20];let c;return t[21]!==o||t[22]!==s?(c=(0,K.jsxs)(`div`,{role:`alert`,className:`space-y-3 rounded-xl border border-edge p-4`,children:[o,s]}),t[21]=o,t[22]=s,t[23]=c):c=t[23],c}function Ye(e){return e.language}function Xe(){let e=(0,H.c)(5),t=E($e);if(E(Qe)){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)($,{error:{status:401}}),e[0]=t):t=e[0],t}let n=t??`anonymous`,r,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r={provider:Ze},i=(0,K.jsx)(et,{}),e[1]=r,e[2]=i):(r=e[1],i=e[2]);let a;return e[3]===n?a=e[4]:(a=(0,K.jsx)(ee,{value:r,children:i},n),e[3]=n,e[4]=a),a}function Ze(){return new Map}function Qe(e){return e.tokenExpired}function $e(e){return e.conversationId}function et(){let e=(0,H.c)(16);Fe();let{activationId:t,templateKey:n}=u(),r=o(`/scenes/inbox`),i=D(rt),a=i===`zh`,s;e[0]===i?s=e[1]:(s=w(i),e[0]=i,e[1]=s);let l=s.recurringWork,[p,m]=(0,V.useState)(!1),h=(0,V.useRef)(null),g=f(),[_]=c(),v=_.get(`plan`),y=t&&g.state?.fromSceneInbox===!0?`/scenes/inbox${typeof g.state.inboxSearch==`string`?g.state.inboxSearch:``}`:void 0,b=re(nt),S=re(tt),C,T;e[2]!==S||e[3]!==b||e[4]!==a?(C=()=>{let e=a?`把需要持续留意的事交给 AI,把时间留给自己。`:`Let AI look after recurring needs, leaving more time for you.`,t=a?`查看全部成果`:`View all results`,n=a?`检查与提醒设置`:`Checks and reminders`;return b({startExtra:null,main:(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:a?`智能关注`:`Monitors`}),(0,K.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,title:e,children:e})]}),end:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(R,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,K.jsxs)(d,{"data-scene-inbox":!0,to:`/scenes/inbox`,"aria-label":t,title:t,children:[(0,K.jsx)(ue,{className:`size-4`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`hidden sm:inline`,children:t})]})}),(0,K.jsx)(R,{ref:h,type:`button`,variant:`ghost`,className:`size-9 p-0`,"aria-label":n,title:n,"aria-haspopup":`dialog`,onClick:()=>m(!0),children:(0,K.jsx)(x,{className:`size-4`,"aria-hidden":`true`})})]})}),()=>S()},T=[S,b,a],e[2]=S,e[3]=b,e[4]=a,e[5]=C,e[6]=T):(C=e[5],T=e[6]),(0,V.useLayoutEffect)(C,T);let E;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,K.jsx)(`main`,{className:`h-full overflow-y-auto bg-surface-panel`,children:(0,K.jsxs)(`div`,{className:`mx-auto w-full max-w-7xl space-y-6 px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`,children:[(0,K.jsx)(ze,{}),(0,K.jsx)(at,{})]})}),e[7]=E):E=e[7];let O=(v||t||n||r)&&(0,K.jsx)(it,{titleText:v?l.dialogTitle:r?_.has(`digest`)?a?`摘要中的成果`:`Results in this digest`:a?`关注成果`:`Monitor results`:t?a?`关注详情`:`Monitor details`:a?`了解并开启`:`Explore and start`,closeLabel:v?l.closeDialog:r?a?`关闭关注成果`:`Close monitor results`:t?a?`关闭关注详情`:`Close monitor details`:a?`关闭关注设置`:`Close monitor setup`,backTo:y,backLabel:a?`返回成果`:`Back to results`,restoreSelector:v?`[data-plan-id="${CSS.escape(v)}"]`:r?`[data-scene-inbox]`:t?`[data-scene-id="${CSS.escape(t)}"]`:`[data-scene-template="${CSS.escape(n)}"]`,children:v?(0,K.jsx)(We,{noteId:v,projectId:_.get(`projectId`)??void 0}):r?(0,K.jsx)(ct,{}):t?(0,K.jsx)(ft,{id:t}):(0,K.jsx)(ut,{templateKey:n})},v??t??n??`inbox`),k;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>h.current?.focus(),e[8]=k):k=e[8];let A;e[9]!==p||e[10]!==a?(A=(0,K.jsx)(ve,{zh:a,open:p,onOpenChange:m,onCloseAutoFocus:k}),e[9]=p,e[10]=a,e[11]=A):A=e[11];let j;return e[12]!==E||e[13]!==O||e[14]!==A?(j=(0,K.jsxs)(K.Fragment,{children:[E,O,A]}),e[12]=E,e[13]=O,e[14]=A,e[15]=j):j=e[15],j}function tt(e){return e.clearPageHeader}function nt(e){return e.setPageHeader}function rt(e){return e.language}function it(e){let t=(0,H.c)(29),{titleText:n,closeLabel:r,restoreSelector:i,backTo:a,backLabel:o,children:c}=e,l=s(),u=(0,V.useRef)(null),f;t[0]===l?f=t[1]:(f=()=>l(`/scenes`,{replace:!0}),t[0]=l,t[1]=f);let p=f,m;t[2]===p?m=t[3]:(m=e=>{e||p()},t[2]=p,t[3]=m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[4]=h):h=t[4];let g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{e.preventDefault(),u.current?.focus()},t[5]=g):g=t[5];let _;t[6]===i?_=t[7]:(_=e=>{e.preventDefault(),document.querySelector(i)?.focus()},t[6]=i,t[7]=_);let v;t[8]!==o||t[9]!==a?(v=a&&(0,K.jsx)(R,{asChild:!0,variant:`ghost`,className:`size-9 shrink-0 p-0`,children:(0,K.jsx)(d,{to:a,replace:!0,"aria-label":o,title:o,children:(0,K.jsx)(oe,{size:18,"aria-hidden":`true`})})}),t[8]=o,t[9]=a,t[10]=v):v=t[10];let y;t[11]===n?y=t[12]:(y=(0,K.jsx)(P,{ref:u,tabIndex:-1,className:`min-w-0 flex-1 text-base font-semibold text-fg outline-none`,children:n}),t[11]=n,t[12]=y);let b;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,K.jsx)(C,{size:18,"aria-hidden":`true`}),t[13]=b):b=t[13];let x;t[14]===r?x=t[15]:(x=(0,K.jsx)(j,{asChild:!0,children:(0,K.jsx)(R,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":r,title:r,children:b})}),t[14]=r,t[15]=x);let S;t[16]!==v||t[17]!==y||t[18]!==x?(S=(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3 sm:px-6`,children:[v,y,x]}),t[16]=v,t[17]=y,t[18]=x,t[19]=S):S=t[19];let w;t[20]===c?w=t[21]:(w=(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4 sm:p-6`,children:(0,K.jsx)(`div`,{className:`space-y-6`,children:c})}),t[20]=c,t[21]=w);let T;t[22]!==S||t[23]!==w||t[24]!==_?(T=(0,K.jsxs)(M,{children:[h,(0,K.jsxs)(N,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(52rem,calc(100dvh-2rem))] w-[min(52rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,"aria-describedby":void 0,onOpenAutoFocus:g,onCloseAutoFocus:_,children:[S,w]})]}),t[22]=S,t[23]=w,t[24]=_,t[25]=T):T=t[25];let E;return t[26]!==T||t[27]!==m?(E=(0,K.jsx)(F,{open:!0,onOpenChange:m,children:T}),t[26]=T,t[27]=m,t[28]=E):E=t[28],E}function at(){let e=(0,H.c)(48),{activationId:t}=u(),n=D(ot)===`zh`,[r,i]=c(),a;e[0]===r?a=e[1]:(a=r.get(`after`)??``,e[0]=r,e[1]=a);let o=a,s=L(`/templates`,U),l=L(`/activations?limit=20&afterId=${encodeURIComponent(o)}`,U),f=l.mutate,p,m;if(e[2]!==t||e[3]!==f?(p=()=>{t||f()},m=[t,f],e[2]=t,e[3]=f,e[4]=p,e[5]=m):(p=e[4],m=e[5]),(0,V.useEffect)(p,m),s.error||l.error){let t=s.error??l.error,n;e[6]!==l||e[7]!==s?(n=()=>{s.mutate(),l.mutate()},e[6]=l,e[7]=s,e[8]=n):n=e[8];let r;return e[9]!==t||e[10]!==n?(r=(0,K.jsx)($,{error:t,retry:n}),e[9]=t,e[10]=n,e[11]=r):r=e[11],r}if(!s.data||!l.data){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(Q,{}),e[12]=t):t=e[12],t}let h=n?`你想先轻松一点的事`:`Where could you use a little help?`,g;e[13]===h?g=e[14]:(g=(0,K.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:h}),e[13]=h,e[14]=g);let _;if(e[15]!==s.data.templates||e[16]!==n){let t;e[18]===n?t=e[19]:(t=e=>(0,K.jsxs)(`article`,{className:`${Z} space-y-3`,children:[(0,K.jsx)(S,{className:`text-fg-muted`,size:20,"aria-hidden":`true`}),(0,K.jsx)(`h3`,{className:`text-balance font-medium text-fg`,children:e.title}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.description}),(0,K.jsx)(R,{asChild:!0,children:(0,K.jsx)(d,{"data-scene-template":e.key,to:`/scenes/new/${encodeURIComponent(e.key)}?version=${encodeURIComponent(e.version)}`,children:n?`了解并开启`:`Explore and start`})})]},`${e.key}:${e.version}`),e[18]=n,e[19]=t),_=s.data.templates.map(t),e[15]=s.data.templates,e[16]=n,e[17]=_}else _=e[17];let v;e[20]===_?v=e[21]:(v=(0,K.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:_}),e[20]=_,e[21]=v);let y;e[22]!==g||e[23]!==v?(y=(0,K.jsxs)(`section`,{className:`space-y-3`,children:[g,v]}),e[22]=g,e[23]=v,e[24]=y):y=e[24];let b=n?`我的关注`:`My monitors`,x;e[25]===b?x=e[26]:(x=(0,K.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:b}),e[25]=b,e[26]=x);let C;e[27]!==l.data.activations||e[28]!==n?(C=l.data.activations.length?l.data.activations.map(e=>(0,K.jsxs)(d,{to:`/scenes/${e.id}`,"data-scene-id":e.id,className:`${Z} block space-y-2 transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,K.jsx)(`p`,{className:`break-words font-medium text-fg`,children:e.goal}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Je(e.status===`active`&&e.setupMissing?.length?`needs_setup`:e.status,n)})]},e.id)):(0,K.jsxs)(`div`,{className:`${Z} space-y-2`,children:[(0,K.jsx)(de,{"aria-hidden":`true`,className:`text-fg-muted`}),(0,K.jsx)(`p`,{className:`text-fg`,children:n?`还没有开启智能关注`:`No monitors yet`}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`从上面选择一件你希望 AI 帮忙照看的事。`:`Choose something above that you would like AI to monitor.`})]}),e[27]=l.data.activations,e[28]=n,e[29]=C):C=e[29];let w;e[30]!==o||e[31]!==i||e[32]!==n?(w=o&&(0,K.jsx)(R,{onClick:()=>i({}),children:n?`返回第一页`:`First page`}),e[30]=o,e[31]=i,e[32]=n,e[33]=w):w=e[33];let T;e[34]!==l.data.nextCursor||e[35]!==i||e[36]!==n?(T=l.data.nextCursor&&(0,K.jsx)(R,{onClick:()=>i({after:l.data.nextCursor}),children:n?`下一页`:`Next page`}),e[34]=l.data.nextCursor,e[35]=i,e[36]=n,e[37]=T):T=e[37];let E;e[38]!==w||e[39]!==T?(E=(0,K.jsxs)(`div`,{className:`flex gap-3`,children:[w,T]}),e[38]=w,e[39]=T,e[40]=E):E=e[40];let O;e[41]!==C||e[42]!==E||e[43]!==x?(O=(0,K.jsxs)(`section`,{className:`space-y-3`,children:[x,C,E]}),e[41]=C,e[42]=E,e[43]=x,e[44]=O):O=e[44];let k;return e[45]!==O||e[46]!==y?(k=(0,K.jsxs)(K.Fragment,{children:[y,O]}),e[45]=O,e[46]=y,e[47]=k):k=e[47],k}function ot(e){return e.language}function st(e){let t=(0,H.c)(20),{zh:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={refreshInterval:15e3,shouldRetryOnError:!1},t[0]=r):r=t[0];let i=L(`/metrics`,U,r),a;t[1]===n?a=t[2]:(a=n?[`有帮助的成果`,`没有帮助的成果`,`带来帮助的关注`]:[`Helpful results`,`Unhelpful results`,`Monitors that helped`],t[1]=n,t[2]=a);let o=a,s,c,l,u;if(t[3]!==o||t[4]!==i||t[5]!==n){let e=i.data?[i.data.usefulOutcomes,i.data.unhelpfulOutcomes,i.data.scenesWithUsefulOutcomes]:[],r=new Intl.NumberFormat(n?`zh-CN`:`en`);s=`${Z} space-y-3`,c=n?`反馈概览`:`Feedback overview`;let a=n?`最近 7 天的反馈`:`Feedback in the last 7 days`;t[10]===a?l=t[11]:(l=(0,K.jsx)(`h2`,{className:`text-balance text-base font-semibold text-fg`,children:a}),t[10]=a,t[11]=l),u=i.error?(0,K.jsxs)(`div`,{role:`alert`,className:`space-y-2`,children:[(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`暂时无法加载统计,仍可查看和评价成果。`:`Stats are unavailable. You can still view and rate results.`}),(0,K.jsx)(R,{disabled:i.isValidating,onClick:()=>void i.mutate(),children:n?`重新加载统计`:`Reload stats`})]}):(0,K.jsx)(`dl`,{className:`grid gap-4 sm:grid-cols-3`,"aria-busy":!i.data,children:o.map((t,n)=>(0,K.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,K.jsx)(`dt`,{className:`text-sm text-fg-muted`,children:t}),(0,K.jsx)(`dd`,{className:`text-xl font-semibold tabular-nums text-fg`,children:i.data?r.format(e[n]):(0,K.jsx)(B,{className:`h-7 w-12`})})]},t))}),t[3]=o,t[4]=i,t[5]=n,t[6]=s,t[7]=c,t[8]=l,t[9]=u}else s=t[6],c=t[7],l=t[8],u=t[9];let d=n?`按你这段时间的明确反馈统计,每份成果取最新评价。已读和检查成功不计入,也不代表已采纳或节省时间。`:`Counts your explicit feedback during this period, using the latest rating per result. Reads and successful checks do not count. This does not measure adoption or time saved.`,f;t[12]===d?f=t[13]:(f=(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d}),t[12]=d,t[13]=f);let p;return t[14]!==s||t[15]!==c||t[16]!==l||t[17]!==u||t[18]!==f?(p=(0,K.jsxs)(`section`,{className:s,"aria-label":c,children:[l,u,f]}),t[14]=s,t[15]=c,t[16]=l,t[17]=u,t[18]=f,t[19]=p):p=t[19],p}function ct(){let e=(0,H.c)(42),t=D(lt)===`zh`,[n,r]=c(),i;e[0]===n?i=e[1]:(i=n.get(`after`)??``,e[0]=n,e[1]=i);let a=i,o;e[2]===n?o=e[3]:(o=n.get(`digest`),e[2]=n,e[3]=o);let s=o,l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:15e3},e[4]=l):l=e[4];let u=L(`${s?`/digests/${encodeURIComponent(s)}`:`/outcomes`}?limit=20&afterId=${encodeURIComponent(a)}`,U,l);if(u.error){let t;e[5]===u?t=e[6]:(t=()=>void u.mutate(),e[5]=u,e[6]=t);let n;return e[7]!==u.error||e[8]!==t?(n=(0,K.jsx)($,{error:u.error,retry:t}),e[7]=u.error,e[8]=t,e[9]=n):n=e[9],n}if(!u.data){let t;return e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(Q,{}),e[10]=t):t=e[10],t}let f=t?`集中查看各项智能关注准备的成果,告诉 AI 哪些对你有帮助。`:`Review results across your monitors and tell AI what helps.`,p;e[11]===f?p=e[12]:(p=(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f}),e[11]=f,e[12]=p);let m;e[13]===t?m=e[14]:(m=(0,K.jsx)(st,{zh:t}),e[13]=t,e[14]=m);let h=t?`成果列表`:`Results list`,g;e[15]!==s||e[16]!==n||e[17]!==u||e[18]!==t?(g=u.data.outcomes.length?u.data.outcomes.map(e=>(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(Se,{item:e,zh:t,onChange:()=>void u.mutate()}),(0,K.jsx)(R,{asChild:!0,variant:`ghost`,children:(0,K.jsx)(d,{state:{fromSceneInbox:!0,inboxSearch:`?${n.toString()}`},to:`/scenes/${encodeURIComponent(e.activationId)}`,children:t?`查看所属关注`:`View monitor`})})]},e.id)):(0,K.jsxs)(`div`,{className:`${Z} space-y-3`,children:[(0,K.jsx)(ue,{size:32,"aria-hidden":`true`,className:`text-fg-muted`}),(0,K.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t?`这里还没有成果`:`No results here yet`}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s?t?`这份摘要中的成果目前不可查看,可能已被撤回。`:`Results in this digest are currently unavailable and may have been withdrawn.`:t?`回到智能关注,提供资料并检查一次;有新成果时会出现在这里。`:`Open a monitor, provide context and run a check. New results will appear here.`})]}),e[15]=s,e[16]=n,e[17]=u,e[18]=t,e[19]=g):g=e[19];let _;e[20]!==h||e[21]!==g?(_=(0,K.jsx)(`section`,{className:`space-y-4`,"aria-label":h,children:g}),e[20]=h,e[21]=g,e[22]=_):_=e[22];let v=t?`成果分页`:`Results pages`,y;e[23]!==a||e[24]!==s||e[25]!==r||e[26]!==t?(y=a&&(0,K.jsx)(R,{onClick:()=>r(s?{digest:s}:{}),children:t?`返回第一页`:`First page`}),e[23]=a,e[24]=s,e[25]=r,e[26]=t,e[27]=y):y=e[27];let b;e[28]!==s||e[29]!==u.data.nextCursor||e[30]!==r||e[31]!==t?(b=u.data.nextCursor&&(0,K.jsx)(R,{onClick:()=>r({...s?{digest:s}:{},after:u.data.nextCursor}),children:t?`下一页`:`Next page`}),e[28]=s,e[29]=u.data.nextCursor,e[30]=r,e[31]=t,e[32]=b):b=e[32];let x;e[33]!==y||e[34]!==b||e[35]!==v?(x=(0,K.jsxs)(`nav`,{className:`flex flex-wrap gap-3`,"aria-label":v,children:[y,b]}),e[33]=y,e[34]=b,e[35]=v,e[36]=x):x=e[36];let S;return e[37]!==x||e[38]!==p||e[39]!==m||e[40]!==_?(S=(0,K.jsxs)(K.Fragment,{children:[p,m,_,x]}),e[37]=x,e[38]=p,e[39]=m,e[40]=_,e[41]=S):S=e[41],S}function lt(e){return e.language}function ut(e){let t=(0,H.c)(10),{templateKey:n}=e,[r]=c(),i;t[0]===r?i=t[1]:(i=r.get(`version`)??`1.0.0`,t[0]=r,t[1]=i);let a=L(`/templates/${encodeURIComponent(n)}/versions/${encodeURIComponent(i)}`,U);if(a.error){let e;t[2]===a?e=t[3]:(e=()=>void a.mutate(),t[2]=a,t[3]=e);let n;return t[4]!==e||t[5]!==a.error?(n=(0,K.jsx)($,{error:a.error,retry:e}),t[4]=e,t[5]=a.error,t[6]=n):n=t[6],n}if(!a.data){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(Q,{}),t[7]=e):e=t[7],e}let o=a.data.template,s;return t[8]===o?s=t[9]:(s=o.execution.kind===`task`?(0,K.jsx)(je,{template:o}):(0,K.jsx)(dt,{manifest:o}),t[8]=o,t[9]=s),s}function dt({manifest:e}){let t=D(e=>e.language)===`zh`,n=s(),[r,i]=(0,V.useState)(``),[a,o]=(0,V.useState)(``),[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(),[g,_]=(0,V.useState)(!1),v=(0,V.useRef)({content:``,id:``}),y=(0,V.useRef)(``),b=!!(r||c||u)&&!g;(0,V.useEffect)(()=>{g&&n(y.current,{replace:!0})},[g,n]);let x=e.contextProviders.includes(`mail`),S=async t=>{t.preventDefault(),p(!0),h(void 0);let n={templateKey:e.key,templateVersion:e.version,goal:r,scope:x?{kind:`objects`,ids:[c.trim()]}:{kind:`personal`},permissions:{accountIds:x?[a.trim()]:[],contextProviders:e.contextProviders,effectHandlers:[]}},i=JSON.stringify(n);v.current.content!==i&&(v.current={content:i,id:crypto.randomUUID()});try{y.current=`/scenes/${(await W(`/activations`,`POST`,n,v.current.id)).activation.id}`,_(!0)}catch(e){h(e)}finally{p(!1)}};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ge,{dirty:b,zh:t}),(0,K.jsxs)(`header`,{children:[(0,K.jsx)(`h1`,{className:`text-wrap text-xl font-semibold text-fg`,children:e.title}),(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:e.description})]}),(0,K.jsx)(`form`,{onSubmit:e=>void S(e),className:`${Z} space-y-5`,children:(0,K.jsxs)(`fieldset`,{disabled:f||g,className:`space-y-5`,children:[(0,K.jsxs)(`label`,{className:qe,children:[t?`希望它持续帮你做好什么?`:`What should it keep helping you with?`,(0,K.jsx)(`textarea`,{required:!0,maxLength:4e3,rows:3,value:r,onChange:e=>i(e.target.value),className:Ke,autoComplete:`off`})]}),x&&(0,K.jsx)(Ee,{value:c,disabled:f||g,zh:t,onChange:e=>{o(e.accountId),l(e.id),d(!1)}}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`只准备草稿和建议,不发送消息、不执行外部写操作。下一步需补齐资料和检查时间;完成后才会自动检查。`:`Prepares drafts and suggestions only. No messages or external writes. Next, complete the context and timing settings for automatic checks.`}),(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm text-fg`,children:[(0,K.jsx)(`input`,{required:!0,type:`checkbox`,className:`ui-checkbox`,checked:u,onChange:e=>d(e.target.checked)}),t?`确认以上范围,允许读取我提供的资料。`:`I confirm this scope and allow reading the information I provide.`]}),!!m&&(0,K.jsx)($,{error:m}),(0,K.jsx)(R,{type:`submit`,variant:`primary`,disabled:f||g||x&&!c,children:f?t?`正在开启…`:`Starting…`:t?`继续设置`:`Continue setup`})]})})]})}function ft(e){let t=(0,H.c)(7),{id:n}=e,r=L(`/activations/${encodeURIComponent(n)}`,U);if(r.error){let e;return t[0]===r.error?e=t[1]:(e=(0,K.jsx)($,{error:r.error}),t[0]=r.error,t[1]=e),e}if(!r.data){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(Q,{}),t[2]=e):e=t[2],e}let i;return t[3]!==r.data.details||t[4]!==r.data.template.execution.kind||t[5]!==n?(i=r.data.template.execution.kind===`task`&&r.data.details?(0,K.jsx)(Me,{id:n,initial:r.data.details}):(0,K.jsx)(pt,{id:n}),t[3]=r.data.details,t[4]=r.data.template.execution.kind,t[5]=n,t[6]=i):i=t[6],i}function pt({id:e}){let t=D(e=>e.language)===`zh`,[n]=c(),r=n.get(`result`),i=`/activations/${encodeURIComponent(e)}`,[a,o]=(0,V.useState)(``),[s,l]=(0,V.useState)(``),u=L(i,U,{refreshInterval:15e3}),d=L(`${i}/runs?limit=20&afterId=${encodeURIComponent(a)}`,U,{refreshInterval:5e3}),f=L(`/outcomes?limit=20&activationId=${encodeURIComponent(e)}&afterId=${encodeURIComponent(s)}`,U,{refreshInterval:5e3}),[p,m]=(0,V.useState)(!1),[h,_]=(0,V.useState)(),[v,y]=(0,V.useState)(!1),b=(0,V.useRef)(null),[x,S]=(0,V.useState)(!1),[C,w]=(0,V.useState)(!1),[T,E]=(0,V.useState)(!1),O=x||C||T,k=async e=>{if(u.data){m(!0),_(void 0),y(!1);try{e?(b.current??=crypto.randomUUID(),await W(`${i}/checks`,`POST`,void 0,b.current),b.current=null,y(!0),o(``),l(``)):await W(i,`PATCH`,{expectedRevision:u.data.activation.revision,status:u.data.activation.status===`active`?`paused`:`active`}),await Promise.all([u.mutate(),d.mutate(),f.mutate()])}catch(e){_(e)}finally{m(!1)}}};if(u.error)return(0,K.jsx)($,{error:u.error,retry:()=>void u.mutate()});if(!u.data)return(0,K.jsx)(Q,{});let A=u.data.activation;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ge,{dirty:O,zh:t}),(0,K.jsxs)(`header`,{className:`space-y-3`,children:[(0,K.jsx)(`h1`,{className:`break-words text-wrap text-xl font-semibold text-fg`,children:A.goal}),(0,K.jsx)(pe,{resource:{kind:`scene`,id:A.id,revision:String(A.revision)},disabled:O||p}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Je(A.status===`active`&&A.setupMissing?.length?`needs_setup`:A.status,t)}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`只准备建议和成果,不自动发送或写入外部系统。`:`Prepares suggestions and results. Does not send or write to external systems.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,K.jsx)(R,{variant:`primary`,disabled:p||A.status!==`active`,onClick:()=>void k(!0),children:p?t?`处理中…`:`Working…`:t?`现在检查`:`Check now`}),[`active`,`paused`,`needs_setup`].includes(A.status)&&(0,K.jsxs)(R,{disabled:p,onClick:()=>void k(!1),children:[(0,K.jsx)(g,{size:16,"aria-hidden":`true`}),A.status===`active`?t?`暂停关注`:`Pause monitor`:t?`检查设置并恢复`:`Review setup and resume`]})]}),[`active`,`paused`].includes(A.status)&&(0,K.jsx)(R,{disabled:p,variant:`ghost`,onClick:()=>{m(!0),W(i,`PATCH`,{expectedRevision:A.revision,status:`completed`}).then(()=>Promise.all([u.mutate(),f.mutate(),d.mutate()])).catch(_).finally(()=>m(!1))},children:t?`结束关注(保留成果)`:`End monitor (keep results)`}),v&&(0,K.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:t?`检查已排队;没有新变化时不会生成新卡片。`:`Check queued. No new card is created when nothing has changed.`})]}),h&&(0,K.jsx)($,{error:h,retry:()=>{u.mutate(),_(void 0)}}),A.status===`active`&&!!A.setupMissing?.length&&(0,K.jsxs)(`section`,{role:`status`,className:Z,children:[(0,K.jsx)(`h2`,{className:`font-medium text-fg`,children:t?`完成以下设置后,这项关注才会自动检查`:`Complete setup for automatic checks`}),(0,K.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-sm text-fg-muted`,children:A.setupMissing.map(e=>(0,K.jsx)(`li`,{children:{notes:t?`填写安排和约束`:`Provide arrangements and constraints`,schedule:t?`设置周期检查时间`:`Set a recurring review time`,deadline:t?`设置邮件跟进截止时间`:`Set a mail follow-up deadline`}[e]},e))})]}),(0,K.jsx)(me,{activationId:e,zh:t}),[`active`,`paused`,`needs_setup`].includes(A.status)&&(0,K.jsx)(mt,{activation:A,zh:t,onDirty:E,onSaved:()=>{u.mutate(),f.mutate(),d.mutate()}},A.id),A.permissions.contextProviders.includes(`user_notes`)&&(0,K.jsx)(gt,{path:i,zh:t,onDirty:S,onSaved:()=>{u.mutate(),f.mutate(),d.mutate()}}),A.permissions.contextProviders.includes(`mail`)?(0,K.jsx)(De,{activation:A,zh:t,onDirty:w,onChanged:()=>{u.mutate(),f.mutate(),d.mutate()}}):(0,K.jsx)(we,{activation:A,zh:t,onDirty:w,onChanged:()=>void u.mutate()}),r&&(0,K.jsx)(ht,{activationId:e,presentationId:r,zh:t}),(0,K.jsxs)(`section`,{className:`space-y-3`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t?`最近成果`:`Recent results`}),f.error?(0,K.jsx)($,{error:f.error,retry:()=>void f.mutate()}):f.data?f.data.outcomes.filter(t=>t.activationId===e).length===0?(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`还没有新成果。提供资料后,可以先检查一次。`:`No new results yet. Provide context and try a check.`}):f.data.outcomes.map(e=>(0,K.jsx)(Se,{item:e,zh:t,onChange:()=>void f.mutate()},e.id)):(0,K.jsx)(Q,{}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[s&&(0,K.jsx)(R,{onClick:()=>l(``),children:t?`最近成果`:`Latest results`}),f.data?.nextCursor&&(0,K.jsx)(R,{onClick:()=>l(f.data.nextCursor),children:t?`更早成果`:`Earlier results`})]})]}),(0,K.jsxs)(`section`,{className:`space-y-3`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t?`检查记录`:`Check history`}),d.error?(0,K.jsx)($,{error:d.error,retry:()=>void d.mutate()}):d.data?d.data.runs.length===0?(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`尚未执行检查。`:`No checks yet.`}):(0,K.jsx)(`ul`,{className:`divide-y divide-edge`,children:d.data.runs.map(e=>(0,K.jsxs)(`li`,{className:`flex flex-wrap justify-between gap-2 py-3 text-sm`,children:[(0,K.jsxs)(`span`,{className:`text-fg`,children:[Je(e.status,t),e.reason===`empty_input`?t?`:请先提供资料`:`: provide context first`:``]}),(0,K.jsx)(`time`,{className:`text-fg-muted`,dateTime:new Date(e.createdAt).toISOString(),children:new Intl.DateTimeFormat(t?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}).format(e.createdAt)})]},e.id))}):(0,K.jsx)(Q,{}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[a&&(0,K.jsx)(R,{onClick:()=>o(``),children:t?`最近检查`:`Latest checks`}),d.data?.nextCursor&&(0,K.jsx)(R,{onClick:()=>o(d.data.nextCursor),children:t?`更早检查`:`Earlier checks`})]})]})]})}function mt(e){let t=(0,H.c)(45),{activation:n,zh:r,onDirty:i,onSaved:a}=e,[o,s]=(0,V.useState)(null),c=o?.goal??n.goal,[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(),p,m;t[0]!==n.goal||t[1]!==c||t[2]!==i?(p=()=>(i(c!==n.goal),()=>i(!1)),m=[c,n.goal,i],t[0]=n.goal,t[1]=c,t[2]=i,t[3]=p,t[4]=m):(p=t[3],m=t[4]),(0,V.useEffect)(p,m);let h=r?`修改目标`:`Edit goal`,g;t[5]===h?g=t[6]:(g=(0,K.jsx)(`summary`,{className:`cursor-pointer`,children:h}),t[5]=h,t[6]=g);let _=r?`保存后暂停检查并撤回旧建议。确认设置后恢复;邮件跟进时间需另行恢复。`:`Saving pauses checks and withdraws previous suggestions. Review settings before resuming, including mail deadlines.`,v;t[7]===_?v=t[8]:(v=(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:_}),t[7]=_,t[8]=v);let y=r?`新目标`:`New goal`,b;t[9]===n?b=t[10]:(b=e=>s(t=>({base:t?.base??n,goal:e.target.value})),t[9]=n,t[10]=b);let x;t[11]!==l||t[12]!==c||t[13]!==b?(x=(0,K.jsx)(`textarea`,{disabled:l,value:c,maxLength:4e3,onChange:b,className:Ke}),t[11]=l,t[12]=c,t[13]=b,t[14]=x):x=t[14];let S;t[15]!==y||t[16]!==x?(S=(0,K.jsxs)(`label`,{className:qe,children:[y,x]}),t[15]=y,t[16]=x,t[17]=S):S=t[17];let C;t[18]!==n.goal||t[19]!==l||t[20]!==c?(C=l||!c.trim()||c===n.goal,t[18]=n.goal,t[19]=l,t[20]=c,t[21]=C):C=t[21];let w;t[22]!==n||t[23]!==o?.base||t[24]!==c||t[25]!==a?(w=()=>{u(!0),f(void 0);let e=o?.base??n;W(`/activations/${n.id}`,`PATCH`,{expectedRevision:e.revision,goal:c,scope:e.scope,permissions:e.permissions}).then(()=>{s(null),a()}).catch(f).finally(()=>u(!1))},t[22]=n,t[23]=o?.base,t[24]=c,t[25]=a,t[26]=w):w=t[26];let T=r?`保存目标`:`Save goal`,E;t[27]!==C||t[28]!==w||t[29]!==T?(E=(0,K.jsx)(R,{disabled:C,onClick:w,children:T}),t[27]=C,t[28]=w,t[29]=T,t[30]=E):E=t[30];let D;t[31]!==l||t[32]!==o||t[33]!==r?(D=o&&(0,K.jsx)(R,{type:`button`,variant:`ghost`,disabled:l,onClick:()=>{s(null),f(void 0)},children:r?`放弃修改`:`Discard edits`}),t[31]=l,t[32]=o,t[33]=r,t[34]=D):D=t[34];let O;t[35]!==d||t[36]!==r?(O=d!=null&&(0,K.jsx)(`p`,{role:`alert`,className:`text-danger`,children:G(d,r)}),t[35]=d,t[36]=r,t[37]=O):O=t[37];let k;return t[38]!==S||t[39]!==E||t[40]!==D||t[41]!==O||t[42]!==g||t[43]!==v?(k=(0,K.jsxs)(`details`,{className:`${Z} space-y-3`,children:[g,v,S,E,D,O]}),t[38]=S,t[39]=E,t[40]=D,t[41]=O,t[42]=g,t[43]=v,t[44]=k):k=t[44],k}function ht(e){let t=(0,H.c)(15),{activationId:n,presentationId:r,zh:i}=e,a=L(`/presentations/${encodeURIComponent(r)}`,U);if(a.error){let e;return t[0]===a.error?e=t[1]:(e=(0,K.jsx)($,{error:a.error}),t[0]=a.error,t[1]=e),e}if(!a.data){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(Q,{}),t[2]=e):e=t[2],e}if(a.data.outcome.activationId!==n){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)($,{error:{status:404}}),t[3]=e):e=t[3],e}let o=i?`通知中的成果`:`Result from notification`,s;t[4]===o?s=t[5]:(s=(0,K.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o}),t[4]=o,t[5]=s);let c;t[6]===a?c=t[7]:(c=()=>void a.mutate(),t[6]=a,t[7]=c);let l;t[8]!==a.data.outcome||t[9]!==c||t[10]!==i?(l=(0,K.jsx)(Se,{item:a.data.outcome,zh:i,onChange:c},a.data.outcome.id),t[8]=a.data.outcome,t[9]=c,t[10]=i,t[11]=l):l=t[11];let u;return t[12]!==s||t[13]!==l?(u=(0,K.jsxs)(`section`,{className:`space-y-3`,children:[s,l]}),t[12]=s,t[13]=l,t[14]=u):u=t[14],u}function gt({path:e,zh:t,onSaved:n,onDirty:r}){let i=L(`${e}/notes`,U,{revalidateOnFocus:!1}),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(),d=a!==null&&a.content!==i.data?.notes.content;if((0,V.useEffect)(()=>(r(d),()=>r(!1)),[d,r]),i.error)return(0,K.jsx)($,{error:i.error,retry:()=>void i.mutate()});if(!i.data)return(0,K.jsx)(Q,{});let f=async t=>{t.preventDefault(),c(!0),u(void 0);try{let{content:t,revision:r,validUntil:s}=a??i.data.notes,c=await W(`${e}/notes`,`PATCH`,{expectedRevision:r,content:t,validUntil:s});await i.mutate({notes:{content:t.trim(),revision:c.revision,validUntil:s}},{revalidate:!1}),o(null),n()}catch(e){u(e)}finally{c(!1)}};return(0,K.jsxs)(`form`,{onSubmit:e=>void f(e),className:`${Z} space-y-3`,children:[(0,K.jsxs)(`label`,{className:qe,children:[t?`你愿意提供的安排和约束`:`Arrangements and constraints you choose to share`,(0,K.jsx)(`textarea`,{disabled:s,rows:5,maxLength:32e3,className:Ke,value:a?.content??i.data.notes.content,onChange:e=>o(t=>({...t??i.data.notes,content:e.target.value})),autoComplete:`off`})]}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`只用于这项关注,不会因此访问其他家庭成员的数据。修改资料会撤回旧计划。`:`Used only by this monitor. Does not grant access to other family members. Editing withdraws the previous plan.`}),!!l&&(0,K.jsx)($,{error:l}),(0,K.jsx)(R,{type:`submit`,disabled:s||!d,children:s?t?`正在保存…`:`Saving…`:t?`保存资料`:`Save context`}),d&&(0,K.jsx)(R,{type:`button`,disabled:s,variant:`ghost`,onClick:()=>{o(null),u(void 0),i.mutate()},children:t?`放弃修改并重新加载`:`Discard edits and reload`})]})}export{Xe as ScenesPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,i as n,n as r,t as i}from"./vendor-react-BOUWij0V.js";import{c as a,d as o,f as s,g as c,l,m as u,t as d,u as f}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{n as p,r as m,t as h}from"./popover-select-BNZZDJpO.js";import{t as g}from"./circle-pause-CN9jYH2s.js";import{y as _}from"./markdown-view-Bb6ohqHz.js";import{O as v,c as y,g as b}from"./notes-api-DYfvIxWh.js";import{t as x}from"./settings-2-D-csvaET.js";import{t as S}from"./sparkles-DHlfQFAF.js";import{t as C}from"./x-B_N4OPjy.js";import{t as w}from"./messages-D8PmAUB-.js";import{a as T,c as E,n as D,r as O}from"./locale-store-DodizOrj.js";import{a as k,i as A,n as j,o as M,r as N,s as P,t as F}from"./dist-BGTk37IG.js";import{a as I,i as L,n as ee}from"./vendor-swr-BIWyz7Rc.js";import{t as R}from"./button-CS04eWY9.js";import{a as z}from"./gateway-realtime-BDh3i8n7.js";import{t as B}from"./skeleton-BwbyijEw.js";import{$o as te,Fo as ne,Ht as re,Ki as ie,Mc as ae,Nc as oe,Po as se,bi as ce,ks as le,qt as ue,ti as de,vc as fe}from"./index-XgbDpmNc.js";import{t as pe}from"./page-context-capture-button-r0vf-oBH.js";var V=e(t(),1),H=r(),U=e=>T(O(`/api/scenes${e}`)),W=(e,t,n,r)=>T(O(`/api/scenes${e}`),{method:t,body:n===void 0?void 0:JSON.stringify(n),headers:{"Idempotency-Key":r??crypto.randomUUID()}});function G(e,t){let n=e?.status;return n===401?t?`登录已失效,请重新登录后查看智能关注。`:`Your session expired. Sign in again to view monitors.`:n===503?t?`智能关注服务暂不可用,请检查服务状态后重试。`:`The monitor service is unavailable. Check the Gateway and retry.`:n===409?t?`内容已被更新,请刷新后重新确认。`:`This content changed. Refresh and review it before trying again.`:(e?.body?.missing)?.some(e=>e.startsWith(`model_`))?t?`请先在模型设置中选择可用模型并配置凭据,然后重试。`:`Choose an available model and configure its credentials in model settings, then retry.`:n===422?t?`设置或授权不完整,请检查数据来源和范围。`:`Setup or permission is incomplete. Check the source and scope.`:n===404?t?`找不到这项关注或结果,请返回智能关注列表。`:`Monitor or result not found. Return to the monitors list.`:t?`操作未完成,请检查连接后重试。你的输入仍保留在当前页面。`:`Could not finish. Check your connection and retry. Your input is still on this page.`}var K=i();function me(e){let t=(0,H.c)(39),{activationId:n,zh:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={refreshInterval:15e3},t[0]=i):i=t[0];let a=L(`/diagnostics`,U,i),o,s,c,l,u,f,p,m,h,g,_;if(t[1]!==n||t[2]!==a.data||t[3]!==r){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=a.data?.activations.find(e=>e.id===n);if(!e){c=null;break bb0}let i;t[15]===r?i=t[16]:(i=e=>e==null?r?`未设置`:`Not scheduled`:new Date(e).toLocaleString(r?`zh-CN`:`en`),t[15]=r,t[16]=i);let v=i,y;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(y={needs_permission:[`邮件授权已失效,请重新连接账号。`,`Mail permission expired. Reconnect the account.`],source_rate_limited:[`邮件服务暂时限流,将自动重试。`,`Mail service rate limited. A retry is scheduled.`],source_timeout:[`读取邮件超时,将自动重试。`,`Mail read timed out. A retry is scheduled.`],unchanged_result:[`资料未变化,已保留原成果和反馈。`,`Context unchanged. The existing result and feedback were preserved.`],source_not_ready:[`来源暂不可用,请检查连接授权;稍后会重试。`,`Source unavailable. Check connection access; a retry is scheduled.`],daily_budget:[`已达每日模型调用上限,将在预算恢复后继续。`,`Daily model limit reached. Checks resume after the budget resets.`],execution_failed:[`检查失败,请检查模型凭据和服务连接,再点“现在检查”。`,`Check failed. Verify model credentials and connectivity, then check again.`],invalid_model_result:[`模型返回的格式不符合这项关注的要求,结果未发布;请重试或更换模型。`,`The model returned an unsupported result for this monitor. Nothing was published; retry or choose another model.`],empty_input:[`请先填写安排和约束。`,`Provide arrangements and constraints first.`],source_changed:[`来源已变化,旧草稿未发布;可重新检查。`,`Source changed. The stale draft was withheld; check again.`],execution_aborted:[`检查已中断,可在服务恢复后重新检查。`,`Check interrupted. Retry after the service resumes.`]},t[17]=y):y=t[17];let b=y,x=[e.next_schedule_at,e.next_deadline_check_at,e.retry_at].filter(he),S=e.source_reason??e.last_reason;l=`space-y-2 rounded-xl border border-edge p-4 text-sm text-fg-muted`,u=(0,K.jsxs)(`p`,{children:[r?`最近发起检查`:`Last check started`,`: `,e.last_check_at==null?r?`尚未检查`:`Not checked yet`:v(e.last_check_at)]});let C=r?`下次定时检查`:`Next scheduled check`,w=e.status!==`active`||a.data?.checksPaused?r?`当前不会自动检查`:`Automatic checks inactive`:x.length?`${Math.min(...x)<=Date.now()?r?`等待执行,原定 `:`Pending, scheduled for `:``}${v(Math.min(...x))}`:r?`暂无待执行检查`:`No check scheduled`;t[18]!==C||t[19]!==w?(f=(0,K.jsxs)(`p`,{children:[C,`: `,w]}),t[18]=C,t[19]=w,t[20]=f):f=t[20],p=e.deadline_at!=null&&(0,K.jsxs)(`p`,{children:[r?`邮件跟进截止时间`:`Mail follow-up deadline`,`: `,v(e.deadline_at)]}),m=e.source_reason&&e.source_attempt_at!=null&&(0,K.jsxs)(`p`,{children:[r?`最近尝试读取邮件`:`Last mail read attempt`,`: `,v(e.source_attempt_at),` · `,r?`连续失败`:`Consecutive failures`,`: `,e.source_failures]}),h=e.source_reason&&(0,K.jsx)(d,{to:`/capabilities/connectors`,className:`inline-block text-accent underline`,children:r?`检查连接授权`:`Check connection access`}),g=e.source_success_at!=null&&(0,K.jsxs)(`p`,{children:[r?`最近成功读取邮件`:`Last successful mail read`,`: `,v(e.source_success_at)]}),_=S&&b[S]&&(0,K.jsx)(`p`,{role:`status`,children:b[S][+!r]});let T=r?`当前关注使用的模型`:`Current monitor model`,E=a.data.currentModel??(r?`配置不可用`:`Configuration unavailable`);t[21]!==T||t[22]!==E?(o=(0,K.jsxs)(`p`,{children:[T,`: `,E]}),t[21]=T,t[22]=E,t[23]=o):o=t[23],s=e.source_reason&&e.status===`active`&&!a.data?.checksPaused&&e.source_retry_at!=null&&(0,K.jsxs)(`p`,{children:[r?`来源重试时间`:`Source retry`,`: `,v(e.source_retry_at)]})}t[1]=n,t[2]=a.data,t[3]=r,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_}else o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14];if(c!==Symbol.for(`react.early_return_sentinel`))return c;let v=r?`所有智能关注待检查`:`Pending checks across monitors`,y;t[24]!==a.data.pendingChecks||t[25]!==v?(y=(0,K.jsxs)(`p`,{children:[v,`: `,a.data.pendingChecks]}),t[24]=a.data.pendingChecks,t[25]=v,t[26]=y):y=t[26];let b;return t[27]!==o||t[28]!==s||t[29]!==y||t[30]!==l||t[31]!==u||t[32]!==f||t[33]!==p||t[34]!==m||t[35]!==h||t[36]!==g||t[37]!==_?(b=(0,K.jsxs)(`section`,{className:l,children:[u,f,p,m,h,g,_,o,s,y]}),t[27]=o,t[28]=s,t[29]=y,t[30]=l,t[31]=u,t[32]=f,t[33]=p,t[34]=m,t[35]=h,t[36]=g,t[37]=_,t[38]=b):b=t[38],b}function he(e){return e!=null}function ge(e){let t=(0,H.c)(13),{dirty:n,zh:r}=e,i;t[0]===n?i=t[1]:(i=e=>{n&&(e.preventDefault(),e.returnValue=``)},t[0]=n,t[1]=i),a(i);let o=l(n),s=o.state===`blocked`,c=r?`放弃未保存的更改?`:`Discard unsaved changes?`,u=r?`当前内容尚未保存,现在离开将丢失这些更改。`:`Your changes have not been saved. Leaving now will discard them.`,d=r?`放弃并离开`:`Discard and leave`,f=r?`继续编辑`:`Keep editing`,p,m;t[2]===o?(p=t[3],m=t[4]):(p=()=>{o.state===`blocked`&&o.proceed()},m=()=>{o.state===`blocked`&&o.reset()},t[2]=o,t[3]=p,t[4]=m);let h;return t[5]!==s||t[6]!==c||t[7]!==u||t[8]!==d||t[9]!==f||t[10]!==p||t[11]!==m?(h=(0,K.jsx)(de,{open:s,title:c,description:u,confirmLabel:d,cancelLabel:f,destructive:!0,overlayClassName:`z-[100]`,contentClassName:`z-[101]`,onConfirm:p,onCancel:m}),t[5]=s,t[6]=c,t[7]=u,t[8]=d,t[9]=f,t[10]=p,t[11]=m,t[12]=h):h=t[12],h}function _e({zh:e}){let[t,n]=(0,V.useState)(!1),[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(),[s,c]=(0,V.useState)(!1);async function l(){n(!0),o(void 0),c(!1);try{if(await Notification.requestPermission()!==`granted`){c(!0);return}let{publicKey:t}=await W(`/browser/prepare`,`POST`);await navigator.serviceWorker.register(`/notification-sw.js`);let n=await navigator.serviceWorker.ready,r=Uint8Array.from(atob(t.replace(/-/g,`+`).replace(/_/g,`/`)),e=>e.charCodeAt(0)),a=await n.pushManager.getSubscription(),o=a?.options.applicationServerKey;a&&(!o||!new Uint8Array(o).every((e,t)=>e===r[t])||o.byteLength!==r.byteLength)&&(await a.unsubscribe(),a=null),a??=await n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:r}),await W(`/browser/subscriptions`,`POST`,{...a.toJSON(),expirationTime:a.expirationTime,language:e?`zh`:`en`}),i(!0)}catch(e){o(e)}finally{n(!1)}}let u=re()&&`PushManager`in window;return(0,K.jsxs)(`div`,{className:`space-y-2 border-t border-edge pt-3`,children:[(0,K.jsx)(R,{disabled:t||!u,onClick:()=>void l(),children:r?e?`刷新此浏览器提醒订阅`:`Refresh this browser subscription`:e?`开启页面关闭后的浏览器提醒`:`Enable reminders when this page is closed`}),r&&(0,K.jsx)(`p`,{role:`status`,children:e?`此浏览器已订阅。服务需持续运行;送达取决于浏览器和系统权限。`:`Subscribed. The Gateway must remain running; delivery depends on browser and system permissions.`}),(!u||s)&&(0,K.jsx)(`p`,{className:`text-fg-muted`,children:e?`当前环境或通知权限不支持后台提醒。成果仍会保留在智能关注收件箱;可在支持推送的 HTTPS 浏览器中开启。`:`Background reminders are unavailable here. Results remain in your monitor inbox. Use a push-capable HTTPS browser and allow notifications.`}),a!=null&&(0,K.jsx)(`p`,{role:`alert`,className:`text-danger`,children:G(a,e)})]})}function ve(e){let t=(0,H.c)(23),{zh:n,open:r,onOpenChange:i,onCloseAutoFocus:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,K.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=e=>{e.preventDefault(),a()},t[1]=a,t[2]=s);let c=n?`检查与提醒设置`:`Checks and reminders`,l;t[3]===c?l=t[4]:(l=(0,K.jsx)(P,{className:`text-base font-semibold text-fg`,children:c}),t[3]=c,t[4]=l);let u=n?`适用于所有智能关注,设置更改后自动保存。`:`Applies to all monitors. Changes are saved automatically.`,d;t[5]===u?d=t[6]:(d=(0,K.jsx)(A,{className:`mt-1 text-sm text-fg-muted`,children:u}),t[5]=u,t[6]=d);let f;t[7]!==l||t[8]!==d?(f=(0,K.jsxs)(`div`,{className:`shrink-0 border-b border-edge p-4 sm:px-6`,children:[l,d]}),t[7]=l,t[8]=d,t[9]=f):f=t[9];let p;t[10]===n?p=t[11]:(p=(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4 sm:p-6`,children:(0,K.jsx)(ye,{zh:n})}),t[10]=n,t[11]=p);let m=n?`关闭`:`Close`,h;t[12]===m?h=t[13]:(h=(0,K.jsx)(`div`,{className:`flex shrink-0 justify-end border-t border-edge p-4 sm:px-6`,children:(0,K.jsx)(j,{asChild:!0,children:(0,K.jsx)(R,{type:`button`,variant:`secondary`,children:m})})}),t[12]=m,t[13]=h);let g;t[14]!==h||t[15]!==s||t[16]!==f||t[17]!==p?(g=(0,K.jsxs)(M,{children:[o,(0,K.jsxs)(N,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(40rem,calc(100dvh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,onCloseAutoFocus:s,children:[f,p,h]})]}),t[14]=h,t[15]=s,t[16]=f,t[17]=p,t[18]=g):g=t[18];let _;return t[19]!==i||t[20]!==r||t[21]!==g?(_=(0,K.jsx)(F,{open:r,onOpenChange:i,children:g}),t[19]=i,t[20]=r,t[21]=g,t[22]=_):_=t[22],_}function ye({zh:e}){let t=L(`/preferences`,U),[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)();async function o(e,i=t.data?.revision){if(!t.data||n||i===void 0)return!1;r(!0),a(void 0);try{let n=await W(`/preferences`,`PATCH`,{...e,expectedRevision:i});return await t.mutate(n,!1),!0}catch(e){return a(e),await t.mutate(),!1}finally{r(!1)}}if(!t.data)return t.error?(0,K.jsx)(`p`,{role:`alert`,children:G(t.error,e)}):(0,K.jsx)(B,{className:`h-32 w-full`});let s=t.data,c=`w-24 rounded-md border border-edge bg-surface-panel px-2 py-1 text-fg`;return(0,K.jsxs)(`div`,{className:`space-y-4 text-sm`,children:[(0,K.jsx)(`p`,{className:`text-fg-muted`,children:e?`设备休眠或服务关闭时不会检查;服务恢复后继续。草稿不会自动发送。`:`Checks require the device and Gateway to stay running. Drafts are never sent automatically.`}),[[`checksPaused`,e?`暂停所有检查`:`Pause all checks`],[`notificationsMuted`,e?`静音提醒(继续检查并保留成果)`:`Mute reminders (continue checks and keep results)`],[`suppressWhileViewing`,e?`查看成果时不重复提醒`:`Avoid reminders while viewing a result`],[`digestEnabled`,e?`汇总为每日摘要`:`Use a daily digest`]].map(([e,t])=>(0,K.jsxs)(`label`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`input`,{type:`checkbox`,checked:s[e],disabled:n,onChange:t=>void o({[e]:t.target.checked})}),t]},e)),(0,K.jsxs)(`label`,{className:`flex flex-wrap items-center gap-2`,children:[e?`时区`:`Timezone`,(0,K.jsx)(be,{value:s.timezone,revision:s.revision,disabled:n,className:`${c} w-48`,zh:e,onSave:(e,t)=>o({timezone:String(e)},t)})]}),[[`quietStartHour`,e?`免打扰开始(小时)`:`Quiet hours start`,23],[`quietEndHour`,e?`免打扰结束(小时)`:`Quiet hours end`,23],[`dailyNotificationLimit`,e?`每日提醒上限`:`Daily reminder limit`,30],...s.digestEnabled?[[`digestHour`,e?`摘要时间(小时)`:`Digest hour`,23],[`digestMinute`,e?`摘要时间(分钟)`:`Digest minute`,59]]:[]].map(([t,r,i])=>(0,K.jsxs)(`label`,{className:`flex flex-wrap items-center gap-2`,children:[r,(0,K.jsx)(be,{value:s[t],revision:s.revision,max:i,disabled:n,className:c,zh:e,onSave:(e,n)=>o({[t]:Number(e)},n)})]},t)),(0,K.jsxs)(`label`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(`input`,{type:`checkbox`,disabled:n,checked:s.preferredChannel===`browser`,onChange:e=>void o({preferredChannel:e.target.checked?`browser`:`in_app`})}),e?`允许浏览器后台提醒`:`Allow background browser reminders`]}),(0,K.jsx)(_e,{zh:e}),i!=null&&(0,K.jsx)(`p`,{role:`alert`,className:`text-danger`,children:G(i,e)}),s.checksPausedUntil&&(0,K.jsx)(R,{disabled:n,onClick:()=>void o({checksPausedUntil:null}),children:e?`取消定时暂停`:`Clear timed pause`})]})}function be(e){let t=(0,H.c)(26),{value:n,revision:r,max:i,disabled:a,className:o,zh:s,onSave:c}=e,[l,u]=(0,V.useState)(null),d;t[0]!==l||t[1]!==i||t[2]!==c||t[3]!==n?(d=async()=>{if(!l||l.value===String(n))return;let e=i===void 0?l.value:Number(l.value);!l.value||typeof e==`number`&&(!Number.isInteger(e)||e<0||e>i)||await c(e,l.revision)&&u(null)},t[0]=l,t[1]=i,t[2]=c,t[3]=n,t[4]=d):d=t[4];let f=d,p=i===void 0?`text`:`number`,m=i===void 0?void 0:0,h=l?.value??n,g;t[5]===r?g=t[6]:(g=e=>u(t=>({value:e.target.value,revision:t?.revision??r})),t[5]=r,t[6]=g);let _;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{e.key===`Escape`&&u(null)},t[7]=_):_=t[7];let v;t[8]===f?v=t[9]:(v=e=>{e.relatedTarget instanceof HTMLElement&&e.relatedTarget.hasAttribute(`data-discard-preference`)||f()},t[8]=f,t[9]=v);let y;t[10]!==o||t[11]!==a||t[12]!==i||t[13]!==p||t[14]!==m||t[15]!==h||t[16]!==g||t[17]!==v?(y=(0,K.jsx)(`input`,{type:p,min:m,max:i,value:h,disabled:a,className:o,onChange:g,onKeyDown:_,onBlur:v}),t[10]=o,t[11]=a,t[12]=i,t[13]=p,t[14]=m,t[15]=h,t[16]=g,t[17]=v,t[18]=y):y=t[18];let b;t[19]!==a||t[20]!==l||t[21]!==s?(b=l&&(0,K.jsx)(R,{"data-discard-preference":!0,type:`button`,variant:`ghost`,disabled:a,onPointerDown:xe,onClick:()=>u(null),children:s?`放弃修改`:`Discard edits`}),t[19]=a,t[20]=l,t[21]=s,t[22]=b):b=t[22];let x;return t[23]!==y||t[24]!==b?(x=(0,K.jsxs)(K.Fragment,{children:[y,b]}),t[23]=y,t[24]=b,t[25]=x):x=t[25],x}function xe(e){return e.preventDefault()}function Se({item:e,zh:t,onChange:n}){let r=(0,V.useRef)(null);(0,V.useEffect)(()=>{let t=crypto.randomUUID(),n=!1,i=()=>{W(`/presence`,`POST`,{clientId:t,surface:`web`,presentationId:e.id,visible:n&&document.visibilityState===`visible`&&document.hasFocus()}).catch(()=>void 0)},a=new IntersectionObserver(([e])=>{n=e.isIntersecting,i()},{threshold:.5});r.current&&a.observe(r.current);let o=setInterval(i,2e4);return document.addEventListener(`visibilitychange`,i),window.addEventListener(`focus`,i),window.addEventListener(`blur`,i),()=>{a.disconnect(),clearInterval(o),document.removeEventListener(`visibilitychange`,i),window.removeEventListener(`focus`,i),window.removeEventListener(`blur`,i),n=!1,i()}},[e.id]);let[i,a]=(0,V.useState)(!1),o=`/presentations/${encodeURIComponent(e.id)}`,s=L(e.readOnly?null:`${o}/feedback`,U),{mutate:c}=I(),[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(),p=async e=>{if(s.data){u(!0),f(void 0);try{let t=s.data.feedback?.note??``,n=await W(`${o}/feedback`,`POST`,{expectedRevision:s.data.feedback?.revision??0,rating:e});await s.mutate({feedback:{rating:e,note:t,revision:n.revision}},{revalidate:!1}),c(`/metrics`)}catch(e){f(e),s.mutate()}finally{u(!1)}}},m=async()=>{u(!0),f(void 0);try{await W(o,`PATCH`,{read:e.status!==`read`}),n()}catch(e){f(e)}finally{u(!1)}};return(0,K.jsxs)(`article`,{ref:r,className:`space-y-3 rounded-xl border border-edge bg-surface-panel p-4 sm:p-6`,children:[e.createdAt!=null&&(0,K.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[t?`生成于`:`Generated`,` `,new Date(e.createdAt).toLocaleString(t?`zh-CN`:`en`)]}),e.sourceHealth?.reason&&(0,K.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:t?`邮件来源暂不可用,这份成果尚未核实最新邮件,请检查连接授权后重试。`:`Mail is unavailable. This result has not been checked against the latest messages. Check connection access and retry.`}),(0,K.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-relaxed text-fg`,children:e.content.summary}),(0,K.jsx)(R,{variant:`ghost`,onClick:()=>{navigator.clipboard.writeText(e.content.summary).then(()=>a(!0)).catch(f)},children:i?t?`已复制`:`Copied`:t?`复制成果`:`Copy result`}),(0,K.jsx)(`div`,{className:`space-y-1 text-xs text-fg-muted`,children:e.sources?.length?e.sources.map(e=>(0,K.jsxs)(`p`,{children:[(0,K.jsx)(`a`,{className:`text-accent underline`,href:e.href,target:e.kind===`mail`?`_blank`:void 0,rel:`noreferrer`,children:e.kind===`notes`?t?`查看关注资料`:`View monitor notes`:e.title||(t?`查看原邮件`:`View original email`)}),e.sender&&` · ${e.sender}`]},e.href)):(0,K.jsx)(`p`,{children:t?`来源详情暂不可用`:`Source details unavailable`})}),e.readOnly?(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`这份成果已结束、过期或延后,仅供查阅。`:`This result is resolved, expired or snoozed, and is available for reference.`}):(0,K.jsxs)(K.Fragment,{children:[s.error?(0,K.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[G(s.error,t),(0,K.jsx)(R,{onClick:()=>void s.mutate(),children:t?`重新加载`:`Reload`})]}):s.data?(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`useful`,`not_useful`].map(e=>(0,K.jsx)(R,{disabled:l,"aria-pressed":s.data?.feedback?.rating===e,onClick:()=>void p(e),children:e===`useful`?t?`对我有帮助`:`Helpful`:t?`没有帮助`:`Not helpful`},e))}):(0,K.jsx)(B,{className:`h-11 w-48`}),(0,K.jsx)(R,{disabled:l,variant:`ghost`,onClick:()=>void m(),children:e.status===`read`?t?`标为未读`:`Mark unread`:t?`标为已读`:`Mark read`})]}),!!d&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:G(d,t)})]})}var Ce=`min-h-11 w-full rounded-md border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`;function we({activation:e,zh:t,onDirty:n,onChanged:r}){let i=`/activations/${e.id}/schedules`,a=L(i,U),o=L(`/templates/${e.templateKey}/versions/${e.templateVersion}`,U),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(),d=()=>{a.mutate(),o.mutate()};if(a.error||o.error)return(0,K.jsxs)(`div`,{role:`alert`,children:[(0,K.jsx)(`p`,{children:G(a.error??o.error,t)}),(0,K.jsx)(R,{onClick:d,children:t?`重新加载`:`Reload`})]});if(!a.data||!o.data)return(0,K.jsx)(B,{className:`h-32 w-full`});let f=o.data.template.triggers.find(e=>e.type===`schedule`);if(!f)return null;let p=a.data.schedules.find(e=>e.triggerKey===f.id);return(0,K.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-edge p-4 sm:p-6`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t?`检查时间`:`Review schedule`}),p?(0,K.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[e.status===`active`?t?`下次检查:`:`Next check: `:t?`当前不会定时检查。已保存时间:`:`Not scheduling while inactive. Saved time: `,new Intl.DateTimeFormat(t?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`,timeZone:p.schedule.timeZone}).format(p.nextDueAt),` · `,p.schedule.timeZone]}):(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`尚未设置定时检查。只有你点“现在检查”才会执行周期复盘。`:`No recurring schedule yet. Use Check now for a manual review.`}),!!l&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:G(l,t)}),s?(0,K.jsx)(Te,{initial:s.cursor,zh:t,onCancel:()=>{c(null),n(!1)},onSave:async e=>{u(void 0);try{await W(`${i}/${encodeURIComponent(f.id)}`,`PATCH`,{expectedRevision:s.cursor?.revision??0,schedule:e}),c(null),n(!1),await a.mutate(),r?.()}catch(e){throw u(e),e}}}):(0,K.jsx)(R,{disabled:e.status!==`active`,onClick:()=>{u(void 0),c({cursor:p}),n(!0)},children:p?t?`修改时间`:`Edit schedule`:t?`设置时间`:`Set schedule`}),(0,K.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t?`没有值得关注的新变化时保持安静。暂停关注会停止定时检查。`:`Stays quiet when there is no useful change. Pause the monitor to stop scheduled checks.`})]})}function Te({initial:e,zh:t,onSave:n,onCancel:r}){let[i,a]=(0,V.useState)(e?.schedule.weekdays??[0]),[o,s]=(0,V.useState)(`${String(e?.schedule.hour??18).padStart(2,`0`)}:${String(e?.schedule.minute??0).padStart(2,`0`)}`),[c,l]=(0,V.useState)(e?.schedule.timeZone??Intl.DateTimeFormat().resolvedOptions().timeZone),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(!1),m=async e=>{e.preventDefault();try{new Intl.DateTimeFormat(`en`,{timeZone:c})}catch{p(!0);return}if(!i.length||!/^\d{2}:\d{2}$/.test(o)){p(!0);return}p(!1),d(!0);try{let[e,t]=o.split(`:`).map(Number);await n({weekdays:i,hour:e,minute:t,timeZone:c})}catch{}finally{d(!1)}};return(0,K.jsx)(`form`,{onSubmit:e=>void m(e),children:(0,K.jsxs)(`fieldset`,{disabled:u,className:`space-y-4`,children:[(0,K.jsxs)(`fieldset`,{children:[(0,K.jsx)(`legend`,{className:`mb-2 text-sm font-medium text-fg`,children:t?`每周检查日`:`Days of the week`}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(t?[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`]:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`]).map((e,t)=>(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-2 rounded-md border border-edge px-3 text-sm text-fg`,children:[(0,K.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i.includes(t),onChange:e=>a(n=>e.target.checked?[...n,t].sort():n.filter(e=>e!==t))}),e]},t))})]}),(0,K.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm font-medium text-fg`,children:[t?`当地时间`:`Local time`,(0,K.jsx)(`input`,{type:`time`,required:!0,value:o,onChange:e=>s(e.target.value),className:Ce})]}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm font-medium text-fg`,children:[t?`时区(例如 Asia/Shanghai)`:`Time zone (for example Asia/Shanghai)`,(0,K.jsx)(`input`,{required:!0,maxLength:100,value:c,onChange:e=>l(e.target.value),className:Ce,spellCheck:!1})]})]}),f&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t?`请选择至少一天,并填写有效时间和时区。`:`Choose at least one day and enter a valid time and time zone.`}),(0,K.jsxs)(`div`,{className:`flex gap-3`,children:[(0,K.jsx)(R,{type:`submit`,disabled:u,children:u?t?`正在保存…`:`Saving…`:t?`保存时间`:`Save schedule`}),(0,K.jsx)(R,{type:`button`,onClick:r,children:t?`取消`:`Cancel`})]})]})})}function Ee({value:e,disabled:t,zh:n,onChange:r}){let i=L(`/sources/mail/accounts`,U),[a,o]=(0,V.useState)(``),[s,c]=(0,V.useState)(``),[l,u]=(0,V.useState)([]),[f,p]=(0,V.useState)(!1),[m,g]=(0,V.useState)(!1),[_,v]=(0,V.useState)(),y=a||i.data?.accounts[0]?.id||``;async function b(){p(!0),v(void 0),u([]),g(!0),r({id:``,accountId:``,subject:``,sender:``});try{u((await W(`/sources/mail/search`,`POST`,{accountId:y,query:s})).sources)}catch(e){v(e)}finally{p(!1)}}if(i.error)return(0,K.jsxs)(`div`,{role:`alert`,className:`space-y-2 text-sm text-danger`,children:[(0,K.jsx)(`p`,{children:G(i.error,n)}),(0,K.jsx)(R,{onClick:()=>void i.mutate(),children:n?`重新加载`:`Reload`})]});if(!i.data)return(0,K.jsx)(B,{className:`h-24 w-full`});let x=e=>`${e.subject||(n?`无主题邮件`:`Untitled mail`)} · ${e.sender||e.accountId}`;return(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`搜索会读取所选 Gmail 账号的匹配邮件;开启后只持续跟进选定线程,不发送邮件,也不需要开启后台学习。`:`Search reads matching mail in your selected Gmail account. The monitor follows only the selected thread, never sends mail, and requires no background learning.`}),(0,K.jsx)(h,{value:y,disabled:t||f,ariaLabel:n?`邮箱账号`:`Mail account`,placeholder:n?`选择账号`:`Choose account`,allowEmpty:!1,options:i.data.accounts.map(e=>({value:e.id,label:e.label})),onChange:e=>{o(e),u([]),r({id:``,accountId:``,subject:``,sender:``})}}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm`,children:[n?`主题、发件人或 Gmail 搜索条件`:`Subject, sender, or Gmail query`,(0,K.jsx)(`input`,{value:s,maxLength:500,disabled:t||f,onChange:e=>c(e.target.value),className:`rounded-md border border-edge bg-surface-panel px-3 py-2`,placeholder:n?`例如 from:alice@example.com`:`e.g. from:alice@example.com`})]}),(0,K.jsx)(R,{type:`button`,disabled:t||f||!y||!s.trim(),onClick:()=>void b(),children:f?n?`正在搜索…`:`Searching…`:n?`搜索邮件`:`Search mail`}),(0,K.jsx)(h,{value:e,disabled:t||f,ariaLabel:n?`要跟进的邮件`:`Mail to follow`,placeholder:n?`选择邮件线程`:`Choose a thread`,allowEmpty:!1,options:l.map(e=>({value:e.id,label:x(e)})),onChange:e=>{let t=l.find(t=>t.id===e);t&&r(t)}}),!i.data.accounts.length&&(0,K.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[n?`请连接 Gmail,并允许读取及后台检查;要求每次确认或仅限指定 Agent 的账号暂不支持。`:`Connect Gmail and allow background reads. Accounts requiring confirmation for every read or restricted to specific agents are not supported yet.`,` `,(0,K.jsx)(d,{className:`text-accent underline`,to:`/capabilities/connectors`,children:n?`管理连接`:`Manage connections`})]}),m&&!f&&!_&&!l.length&&(0,K.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:n?`没有找到匹配线程,请调整搜索条件。`:`No matching threads. Try a different query.`}),_!=null&&(0,K.jsx)(`p`,{role:`alert`,className:`text-danger`,children:G(_,n)})]})}function De({activation:e,zh:t,onDirty:n,onChanged:r}){let i=`/activations/${e.id}/work-items`,a=L(i,U),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(),[u,d]=(0,V.useState)(!1),f=()=>{s(null),n(!1),a.mutate(),r()};if(a.error)return(0,K.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[G(a.error,t),(0,K.jsx)(R,{onClick:()=>void a.mutate(),children:t?`重新加载`:`Reload`})]});if(!a.data)return(0,K.jsx)(B,{className:`h-32 w-full`});let p=a.data.workItems[0],m=async e=>{if(p){d(!0),l(void 0);try{await W(`/work-items/${p.id}`,`PATCH`,{expectedRevision:p.revision,status:e}),f()}catch(e){l(e)}finally{d(!1)}}};return(0,K.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-edge p-4 sm:p-6`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t?`这封邮件的跟进时间`:`Follow-up deadline`}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:p?`${p.status===`watching`?t?`留意回复,到时检查`:`Watching replies; check at deadline`:p.status===`paused`?t?`已暂停跟进`:`Follow-up paused`:t?`已结束跟进`:`Follow-up ended`} · ${new Intl.DateTimeFormat(t?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}).format(p.dueAt)}`:t?`设置一个时间;此前有新回复时会重新判断是否还需要跟进。`:`Choose a deadline. New replies before then trigger a review of whether follow-up is still needed.`}),!!c&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:G(c,t)}),o?(0,K.jsx)(Oe,{initial:o.item?.dueAt,zh:t,onCancel:()=>{s(null),n(!1)},onSave:async t=>{l(void 0);try{o.item?await W(`/work-items/${o.item.id}`,`PATCH`,{expectedRevision:o.item.revision,dueAt:t,status:`watching`}):e.scope.kind===`objects`&&await W(i,`POST`,{subjectId:e.scope.ids[0],accountId:e.permissions.accountIds[0],dueAt:t}),f()}catch(e){throw l(e),e}}}):(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[p?.status!==`completed`&&(0,K.jsx)(R,{disabled:u||e.status!==`active`,onClick:()=>{s({item:p}),n(!0),l(void 0)},children:p?t?`重新设置跟进时间`:`Reschedule follow-up`:t?`设置跟进时间`:`Set deadline`}),p?.status===`watching`&&(0,K.jsx)(R,{disabled:u,onClick:()=>void m(`paused`),children:t?`暂停这次跟进`:`Pause follow-up`}),p&&p.status!==`completed`&&(0,K.jsx)(R,{disabled:u,onClick:()=>void m(`completed`),children:t?`结束这次跟进`:`End follow-up`})]}),(0,K.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t?`结束跟进只停止检查,不表示邮件已发送或事情已经解决。`:`Ending stops checks; it does not mean a message was sent or the matter resolved.`})]})}function Oe({initial:e,zh:t,onSave:n,onCancel:r}){let[i,a]=(0,V.useState)(()=>{if(!e)return``;let t=new Date(e);return new Date(e-t.getTimezoneOffset()*6e4).toISOString().slice(0,16)}),[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(!1),u=async e=>{e.preventDefault();let t=new Date(i).getTime();if(!Number.isFinite(t)||t<=Date.now()){l(!0);return}l(!1),s(!0);try{await n(t)}catch{}finally{s(!1)}};return(0,K.jsx)(`form`,{onSubmit:e=>void u(e),children:(0,K.jsxs)(`fieldset`,{disabled:o,className:`space-y-3`,children:[(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm font-medium text-fg`,children:[t?`跟进时间(当前设备时区)`:`Deadline (device time zone)`,(0,K.jsx)(`input`,{required:!0,type:`datetime-local`,value:i,onChange:e=>a(e.target.value),className:`min-h-11 w-full min-w-0 rounded-md border border-edge bg-surface-panel px-3 py-2 text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`})]}),c&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:t?`请选择未来的有效时间。`:`Choose a valid future time.`}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(R,{type:`submit`,disabled:o,children:o?t?`正在保存…`:`Saving…`:t?`保存跟进时间`:`Save deadline`}),(0,K.jsx)(R,{type:`button`,onClick:r,children:t?`取消`:`Cancel`})]})]})})}var ke=e(n(),1),q=`min-h-11 w-full rounded-md border border-edge bg-surface-panel px-3 py-2 text-base text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:text-sm`,J=`min-w-0 space-y-4 rounded-xl border border-edge bg-surface-panel p-4`;function Ae(e,t,n){return e===`none`?[]:[`workspace.read`,...t?[`workspace.write`]:[],...e===`worktree`&&n.trim()?[`verification.run`]:[]]}function je({template:e}){let t=D(e=>e.language)===`zh`,n=(e,n)=>t?e:n,r=s(),i=L(`/source-providers`,U),[a,o]=(0,V.useState)(``),c=a||i.data?.providers[0]?.id||``,l=L(c?`/source-providers/${encodeURIComponent(c)}/accounts`:null,U),u=L(`follow-up-projects`,()=>ce({limit:100})),[f,h]=(0,V.useState)(``),[g,_]=(0,V.useState)(``),[v,y]=(0,V.useState)(``),[b,x]=(0,V.useState)(``),[S,C]=(0,V.useState)(``),[w,T]=(0,V.useState)(`none`),[E,O]=(0,V.useState)(!1),[k,A]=(0,V.useState)(``),[j,M]=(0,V.useState)(!1),[N,P]=(0,V.useState)(``),[F,I]=(0,V.useState)(!1),ee=(0,V.useRef)(null),z=u.data?.items.filter(e=>e.workspaceRoot)??[],te=f||(l.data?.accounts.length===1?l.data.accounts[0].id:``),ne=g||(z.length===1?z[0].id:``);async function re(i){if(i.preventDefault(),!j){M(!0),P(``);try{let{source:t}=await W(`/source-providers/${encodeURIComponent(c)}/resolve-link`,`POST`,{accountId:te,url:v}),i={source:t,sourceUrl:v,goal:b,instruction:S,resource:w,...w===`worktree`?{projectId:ne}:{},capabilities:Ae(w,E,k),...w===`worktree`&&k.trim()?{verificationCommand:k.trim()}:{}},a={templateKey:e.key,templateVersion:e.version,configuration:i},o=await W(`/preflight`,`POST`,a);if(!o.ready){let e={verification_backend:n(`可选验证需要配置隔离后端;也可清空验证命令,先生成修改。`,`Optional verification needs an isolation backend. Clear the command to proceed without running tests.`),verification_backend_unavailable:n(`验证后端不可用;检查配置或清空验证命令。`,`Verification backend unavailable. Check settings or clear the command.`),clean_base_checkout:n(`项目基础工作区有未提交改动,请先整理。`,`The project base checkout has uncommitted changes.`),source_read_permission:n(`来源读取权限不足,请检查连接。`,`Source read permission is missing. Check the connection.`),model_credentials:n(`请配置模型凭据。`,`Configure model credentials.`),model_configuration:n(`请选择可用模型。`,`Choose an available model.`)};P(o.missing.map(t=>e[t]??t).join(` `));return}let s=await W(`/activations`,`POST`,a);(0,ke.flushSync)(()=>I(!0)),r(`/scenes/${s.activation.id}`,{replace:!0})}catch(e){P(G(e,t))}finally{M(!1),setTimeout(()=>ee.current?.focus(),0)}}}return i.error||l.error||u.error?(0,K.jsx)(`p`,{role:`alert`,children:G(i.error??l.error??u.error,t)}):!i.data||!u.data||c&&!l.data?(0,K.jsxs)(`div`,{"aria-busy":`true`,children:[(0,K.jsx)(B,{className:`h-12`}),(0,K.jsx)(B,{className:`mt-4 h-32`})]}):(0,K.jsxs)(`form`,{className:`space-y-5`,onSubmit:re,children:[(0,K.jsx)(ge,{dirty:!F&&!!(v||b||S),zh:t}),(0,K.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:e.title}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.description}),(0,K.jsxs)(`fieldset`,{disabled:j,className:`space-y-5`,children:[(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[n(`来源`,`Source`),(0,K.jsx)(p,{"aria-label":n(`来源`,`Source`),value:c,onChange:e=>{o(e.target.value),h(``)},required:!0,children:i.data.providers.map(e=>(0,K.jsx)(m,{value:e.id,children:e.label},e.id))})]}),!l.data?.accounts.length&&(0,K.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[n(`请先连接可读取的账号。`,`Connect an account with read access first.`),` `,(0,K.jsx)(d,{className:`text-accent-fg`,to:`/capabilities/connectors`,children:n(`连接`,`Connections`)})]}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[n(`账号`,`Account`),(0,K.jsxs)(p,{"aria-label":n(`账号`,`Account`),value:te,onChange:e=>h(e.target.value),required:!0,children:[(0,K.jsx)(m,{value:``,children:n(`选择账号`,`Choose an account`)}),l.data?.accounts.map(e=>(0,K.jsx)(m,{value:e.id,children:e.label},e.id))]})]}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[n(`来源链接`,`Source link`),(0,K.jsx)(`input`,{className:q,type:`url`,required:!0,maxLength:2e3,value:v,onChange:e=>y(e.target.value)})]}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[n(`你希望完成什么?`,`What should be accomplished?`),(0,K.jsx)(`textarea`,{className:q,required:!0,maxLength:6e3,rows:3,value:b,onChange:e=>x(e.target.value)})]}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[n(`处理指令(可选)`,`Instructions (optional)`),(0,K.jsx)(`textarea`,{className:q,rows:3,maxLength:12e3,value:S,onChange:e=>C(e.target.value),placeholder:n(`例如:持续更新决策记录;有冲突时向我确认。`,`For example: keep a decision log updated; ask me about conflicts.`)})]}),(0,K.jsxs)(`section`,{className:J,children:[(0,K.jsx)(`h3`,{className:`font-medium text-fg`,children:n(`资源与权限`,`Resources and permissions`)}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[n(`工作资源`,`Workspace resource`),(0,K.jsxs)(p,{"aria-label":n(`工作资源`,`Workspace resource`),value:w,onChange:e=>{T(e.target.value),A(``),O(!1)},children:[(0,K.jsx)(m,{value:`none`,children:n(`无文件资源 · 分析与建议`,`No files · analysis and recommendations`)}),(0,K.jsx)(m,{value:`artifacts`,children:n(`任务产物目录 · 文档等文件`,`Task artifact folder · documents and files`)}),(0,K.jsx)(m,{value:`worktree`,children:n(`Git worktree · 项目修改`,`Git worktree · project changes`)})]})]}),w===`worktree`&&(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[n(`项目`,`Project`),(0,K.jsxs)(p,{"aria-label":n(`项目`,`Project`),required:!0,value:ne,onChange:e=>_(e.target.value),children:[(0,K.jsx)(m,{value:``,children:n(`选择本地 Git 项目`,`Choose a local Git project`)}),z.map(e=>(0,K.jsx)(m,{value:e.id,children:e.name},e.id))]})]}),w!==`none`&&(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm text-fg`,children:[(0,K.jsx)(`input`,{className:`ui-checkbox`,type:`checkbox`,checked:E,onChange:e=>O(e.target.checked)}),n(`允许创建和修改此任务工作区内的文件`,`Allow creating and editing files in this task workspace`)]}),w===`worktree`&&(0,K.jsxs)(`details`,{className:`space-y-3`,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm text-fg`,children:n(`可选:授权运行验证命令`,`Optional: authorize a verification command`)}),(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[n(`固定验证命令(留空则不执行命令)`,`Fixed verification command (blank means no commands)`),(0,K.jsx)(`input`,{className:q,maxLength:2e3,value:k,onChange:e=>A(e.target.value),placeholder:`pnpm test`})]}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n(`仅此可选工具需要已配置的隔离后端。留空也能修改文件,但结果会标记未验证。不会自动改为宿主机执行。`,`Only this optional tool needs a configured isolation backend. File edits work without it and remain unverified. No automatic host execution.`)}),(0,K.jsx)(d,{to:`/settings/agent-defaults`,className:`text-sm text-accent-fg`,children:n(`查看执行设置`,`Execution settings`)})]}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n(`不会提交、推送、部署或对外发消息。约每分钟检查一次,Gateway 需要保持在线。`,`No commits, pushes, deployment or outgoing messages. Checks about once a minute while the Gateway is online.`)})]}),N&&(0,K.jsx)(`p`,{ref:ee,tabIndex:-1,role:`alert`,className:`text-sm text-danger`,children:N}),(0,K.jsx)(R,{variant:`primary`,type:`submit`,disabled:j||!te||w===`worktree`&&!ne,children:j?n(`正在检查并开启…`,`Checking and starting…`):n(`确认范围并开始跟进`,`Confirm scope and start following`)})]})]})}function Me({id:e,initial:t}){let n=f(),[r,i]=(0,V.useState)(!1),a=D(e=>e.language)===`zh`,o=(e,t)=>a?e:t,s=`/activations/${encodeURIComponent(e)}`,c=L(s,U,{refreshInterval:5e3,fallbackData:{details:t}}),[l,u]=(0,V.useState)(!1),[p,m]=(0,V.useState)(``);async function h(e){u(!0),m(``);try{await W(s,`PATCH`,{expectedRevision:c.data.details.activation.revision,status:e}),await c.mutate()}catch(e){m(G(e,a))}finally{u(!1)}}if(c.error)return(0,K.jsx)(`p`,{role:`alert`,children:G(c.error,a)});if(!c.data)return(0,K.jsx)(`div`,{"aria-busy":`true`,children:(0,K.jsx)(B,{className:`h-48`})});let g=c.data.details,v=g.processedRevision>0&&g.processedRevision===g.observedRevision;return(0,K.jsxs)(`div`,{className:`space-y-5`,children:[(0,K.jsx)(`h2`,{className:`break-words text-lg font-semibold text-fg`,children:g.activation.goal}),(0,K.jsx)(pe,{resource:{kind:`scene`,id:g.activation.id,revision:String(g.activation.revision)},disabled:l||r}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,role:`status`,children:g.activation.status===`archived`?o(`已停止跟进,任务与产物已保留`,`Stopped following; task and artifacts retained`):g.lastError||g.activation.status===`needs_setup`||g.receipt?.needsUser?o(`需要你处理`,`Needs your attention`):g.activation.status===`paused`?o(`已暂停`,`Paused`):g.run?.status===`running`?o(`正在处理`,`Working`):v?o(`已处理当前来源版本,继续观察变化`,`Current source revision processed; watching for updates`):o(`正在跟进`,`Following updates`)}),(0,K.jsxs)(`section`,{className:J,children:[(0,K.jsx)(`h3`,{className:`font-medium text-fg`,children:o(`来源 → 任务 → 产物`,`Source → task → artifacts`)}),(0,K.jsx)(`p`,{className:`break-words text-sm text-fg-muted`,children:g.input.source.provider}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[(0,K.jsx)(d,{className:`text-sm text-accent-fg`,to:_(`${n.pathname}${n.search}`,g.task.id),children:o(`打开关联任务`,`Open linked task`)}),g.input.sourceUrl&&(0,K.jsx)(`a`,{className:`text-sm text-accent-fg`,href:g.input.sourceUrl,target:`_blank`,rel:`noopener noreferrer`,children:o(`打开原讨论`,`Open source`)})]}),(0,K.jsxs)(`dl`,{className:`grid grid-cols-1 gap-3 text-sm sm:grid-cols-3`,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-fg-muted`,children:o(`已观察版本`,`Observed revision`)}),(0,K.jsx)(`dd`,{children:g.observedRevision})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-fg-muted`,children:o(`已交付版本`,`Delivered revision`)}),(0,K.jsx)(`dd`,{children:g.deliveredRevision})]}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`dt`,{className:`text-fg-muted`,children:o(`已处理版本`,`Processed revision`)}),(0,K.jsx)(`dd`,{children:g.processedRevision||`—`})]})]}),(g.environment||g.artifactPath)&&(0,K.jsxs)(`div`,{className:`space-y-2 break-all text-sm text-fg-muted`,children:[g.environment?.branchRef&&(0,K.jsxs)(`p`,{children:[o(`任务分支:`,`Task branch: `),g.environment.branchRef]}),(0,K.jsxs)(`p`,{children:[o(`产物位置:`,`Artifact location: `),g.environment?.rootPath??g.artifactPath]})]}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o(`已处理不代表通过验收。验证状态以工具证据为准。`,`Processed does not mean accepted. Verification status comes from tool evidence.`)})]}),g.lastError&&(0,K.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-danger`,children:g.lastError}),g.receipt&&(0,K.jsxs)(`section`,{className:J,children:[(0,K.jsx)(`h3`,{className:`font-medium text-fg`,children:o(`最近结果`,`Latest result`)}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:g.receipt.verification.status===`passed`?o(`已授权命令通过;仍需审阅业务结果`,`Approved command passed; review the outcome`):o(`未验证:没有当前版本的通过证据`,`Unverified: no passing evidence for the current revision`)}),(0,K.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm text-fg`,children:g.receipt.summary}),g.receipt.remainingWork.map((e,t)=>(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e},t)),(0,K.jsxs)(`details`,{children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm text-fg`,children:o(`产物与验证证据`,`Artifacts and verification evidence`)}),[...g.receipt.changes,...g.receipt.evidence].map((e,t)=>(0,K.jsxs)(`pre`,{className:`mt-3 max-h-64 overflow-y-auto whitespace-pre-wrap break-words text-xs text-fg-muted`,children:[e.title,`
|
|
2
|
+
`,e.summary]},t))]})]}),g.input.resource===`worktree`&&g.input.projectId&&(0,K.jsx)(Pe,{projectId:g.input.projectId,taskId:g.task.id}),g.activation.status===`paused`&&(0,K.jsx)(Ne,{item:g,onSaved:()=>c.mutate(),onDirty:i},g.activation.id),p&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:p}),(0,K.jsx)(`div`,{className:`flex flex-wrap gap-3`,children:g.activation.status!==`archived`&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(R,{variant:`secondary`,disabled:l,onClick:()=>void h(g.activation.status===`active`?`paused`:`active`),children:l?o(`处理中…`,`Working…`):g.activation.status===`active`?o(`暂停跟进与执行`,`Pause observation and execution`):o(`确认后恢复`,`Resume after review`)}),(0,K.jsx)(R,{variant:`ghost`,disabled:l,onClick:()=>void h(`archived`),children:o(`停止跟进(保留产物)`,`Stop following (keep artifacts)`)})]})})]})}function Ne({item:e,onSaved:t,onDirty:n}){let r=D(e=>e.language)===`zh`,i=(e,t)=>r?e:t,[a,o]=(0,V.useState)(null),s=a??{base:e,instruction:e.input.instruction,writable:e.input.capabilities.includes(`workspace.write`),command:e.input.verificationCommand??``},{instruction:c,writable:l,command:u}=s,d=e=>o(t=>({...t??s,...e})),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(``),g=c!==e.input.instruction||l!==e.input.capabilities.includes(`workspace.write`)||u!==(e.input.verificationCommand??``);(0,V.useEffect)(()=>(n(g||f),()=>n(!1)),[g,f,n]);async function _(n){n.preventDefault(),p(!0),h(``);try{let n=s.base;await W(`/activations/${e.activation.id}`,`PATCH`,{expectedRevision:n.activation.revision,configuration:{...n.input,instruction:c,capabilities:Ae(n.input.resource,l,u),verificationCommand:u.trim()||void 0}}),await t(),o(null)}catch(e){h(G(e,r))}finally{p(!1)}}return(0,K.jsxs)(`details`,{className:J,children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm text-fg`,children:i(`调整指令与授权`,`Edit instructions and permissions`)}),(0,K.jsx)(ge,{dirty:g,zh:r}),(0,K.jsxs)(`form`,{className:`space-y-3`,onSubmit:_,children:[(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i(`处理指令`,`Instructions`),(0,K.jsx)(`textarea`,{disabled:f,className:q,rows:4,maxLength:12e3,value:c,onChange:e=>d({instruction:e.target.value})})]}),s.base.input.resource!==`none`&&(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm text-fg`,children:[(0,K.jsx)(`input`,{disabled:f,type:`checkbox`,className:`ui-checkbox`,checked:l,onChange:e=>d({writable:e.target.checked})}),i(`允许修改任务工作区文件`,`Allow task workspace file edits`)]}),s.base.input.resource===`worktree`&&(0,K.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[i(`验证命令(可选;留空不执行)`,`Verification command (optional; blank disables execution)`),(0,K.jsx)(`input`,{disabled:f,className:q,maxLength:2e3,value:u,onChange:e=>d({command:e.target.value})})]}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i(`保存后仍保持暂停。确认授权范围后再恢复。`,`Saving keeps the monitor paused. Review permissions before resuming.`)}),m&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:m}),(0,K.jsx)(R,{type:`submit`,disabled:f||!g,children:f?i(`正在保存…`,`Saving…`):i(`保存指令与授权`,`Save instructions and permissions`)}),a&&(0,K.jsx)(R,{type:`button`,variant:`ghost`,disabled:f,onClick:()=>{o(null),h(``)},children:i(`放弃修改`,`Discard edits`)})]})]})}function Pe({projectId:e,taskId:t}){let n=f(),r=D(e=>e.language)===`zh`,[i,a]=(0,V.useState)(!1),[o,s]=(0,V.useState)(``),[c,l]=(0,V.useState)(!1),[u,h]=(0,V.useState)(``),g=L(i?`/resources/projects/${encodeURIComponent(e)}/branches`:null,U),v=g.data?.branches.find(e=>e.ref===o);async function y(){if(v){l(!0),h(``);try{await W(`/resources/branch-links`,`POST`,{projectId:e,taskId:t,branchRef:v.ref,expectedSha:v.sha}),await g.mutate()}catch(e){h(G(e,r))}finally{l(!1)}}}return(0,K.jsxs)(`details`,{className:J,open:i,onToggle:e=>a(e.currentTarget.open),children:[(0,K.jsx)(`summary`,{className:`cursor-pointer text-sm text-fg`,children:r?`已有分支与需求关联`:`Existing branches and requirements`}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r?`只读盘点。确认关联仅记录归属,不接管该分支,也不修改、重命名或清理代码。`:`Read-only inventory. Confirming records ownership only: no takeover, edits, renaming or cleanup.`}),g.error?(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:G(g.error,r)}):g.data?(0,K.jsxs)(K.Fragment,{children:[g.data.checkoutDirty&&(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r?`基础工作区存在未提交改动,已保留。`:`The base checkout has uncommitted changes; they are preserved.`}),(0,K.jsxs)(p,{"aria-label":r?`选择已有分支`:`Choose an existing branch`,value:o,onChange:e=>s(e.target.value),children:[(0,K.jsx)(m,{value:``,children:r?`选择分支查看归属`:`Choose a branch to inspect`}),g.data.branches.map(e=>(0,K.jsx)(m,{value:e.ref,children:e.ref.replace(`refs/heads/`,``)},e.ref))]}),v&&(0,K.jsxs)(`div`,{className:`space-y-3 break-all text-sm text-fg`,children:[(0,K.jsx)(`p`,{children:v.subject}),(0,K.jsx)(`p`,{className:`text-fg-muted`,children:v.sha}),v.worktree&&(0,K.jsx)(`p`,{className:`text-fg-muted`,children:v.worktree}),v.taskId?(0,K.jsx)(d,{className:`text-accent-fg`,to:v.activationId?`/scenes/${v.activationId}`:_(`${n.pathname}${n.search}`,v.taskId),children:r?`查看对应事项`:`Open associated work`}):(0,K.jsx)(R,{variant:`secondary`,disabled:c,onClick:()=>void y(),children:c?r?`关联中…`:`Linking…`:r?`确认关联到当前任务`:`Confirm association with this task`}),v.changedSinceConfirmation&&(0,K.jsx)(`p`,{className:`text-fg-muted`,children:r?`该分支在确认关联后已有新提交。`:`This branch has new commits since confirmation.`})]})]}):(0,K.jsx)(B,{className:`h-24`}),u&&(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:u})]})}function Fe(){let{mutate:e}=I();(0,V.useEffect)(()=>{let t=0,n,r,i=()=>{r===void 0&&(r=setTimeout(()=>{r=void 0,e(()=>!0)},50))},a=ue(e=>{e.kind===`scene`&&i()}),o=async()=>{let o=++t;n?.(),n=void 0;try{let{capabilities:s}=await T(O(`/api/capabilities/operations`));if(o!==t)return;if(!s.some(e=>e.id===`xopc.scenes.list`)){r!==void 0&&clearTimeout(r),r=void 0,e(()=>!0,void 0,{revalidate:!0});return}n=z(`resources:scenes`,{onEvent:e=>{e.event===`resource.changed`&&a(e.topic,e.data)},onGap:i},0),i()}catch{}},s=()=>{o()};return window.addEventListener(`gateway-realtime-connected`,s),o(),()=>{t++,n?.(),r!==void 0&&clearTimeout(r),window.removeEventListener(`gateway-realtime-connected`,s)}},[e])}var Ie=`recurring-work-spec`,Le={draft:`recurring-work-draft`,ready:`recurring-work-ready`,configured:`recurring-work-configured`};function Re(e){let t=Object.entries(Le).filter(([,t])=>e?.includes(t));return t.length===1?t[0][0]:`needs_review`}var Y=10;function X(e,t,n,r=`continue`){let i=w(e).recurringWork.prompts,a=(t?i[r]:i.start).replace(`{noteId}`,t??``),o=new URLSearchParams({skill:`design-recurring-work`,draft:a,autoSend:`1`});return n?.trim()?o.set(`projectId`,n.trim()):o.set(`projectScope`,`none`),`/chat/new?${o.toString()}`}function ze(){let e=(0,H.c)(17),t=D(Ue),n=w(t).recurringWork,r=E(He),[i,a]=(0,V.useState)(0),o;e[0]!==i||e[1]!==r?(o=r?[`recurring-work-specs`,r,i]:null,e[0]=i,e[1]=r,e[2]=o):o=e[2];let s;e[3]===i?s=e[4]:(s=()=>b({tag:Ie,sortBy:`updatedAt`,sortOrder:`desc`,limit:Y,offset:i*Y}),e[3]=i,e[4]=s);let{data:c,error:l,isLoading:u,mutate:f}=L(o,s),p,m;e[5]!==c||e[6]!==i?(p=()=>{c&&i>0&&i*Y>=c.total&&a(Math.max(0,Math.ceil(c.total/Y)-1))},m=[c,i],e[5]=c,e[6]=i,e[7]=p,e[8]=m):(p=e[7],m=e[8]),(0,V.useEffect)(p,m);let h=i*Y+1,g=Math.min((i+1)*Y,c?.total??0),_;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,K.jsx)(se,{className:`text-accent`,size:20,"aria-hidden":`true`}),e[9]=_):_=e[9];let v;e[10]===t?v=e[11]:(v=X(t),e[10]=t,e[11]=v);let y;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,K.jsx)(ae,{size:16,"aria-hidden":`true`}),e[12]=y):y=e[12];let x;return e[13]!==c||e[14]!==u||e[15]!==r?(x=r&&u&&!c&&(0,K.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,K.jsx)(B,{className:`h-5 w-28`}),(0,K.jsx)(B,{className:`h-14 w-full`})]}),e[13]=c,e[14]=u,e[15]=r,e[16]=x):x=e[16],(0,K.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":`recurring-work-heading`,children:[(0,K.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel p-4 sm:p-6`,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`max-w-2xl space-y-2`,children:[_,(0,K.jsx)(`h2`,{id:`recurring-work-heading`,className:`text-base font-semibold text-fg`,children:n.title}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.description}),(0,K.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.designOnly})]}),(0,K.jsx)(R,{asChild:!0,children:(0,K.jsxs)(d,{to:v,children:[n.start,y]})})]})}),x,l&&(0,K.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-3 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,K.jsx)(`p`,{className:`flex-1 text-sm text-danger`,children:n.listError}),(0,K.jsx)(R,{variant:`secondary`,onClick:()=>void f(),children:n.retry})]}),c&&!l&&c.total===0&&(0,K.jsx)(`p`,{className:`rounded-xl border border-edge bg-surface-panel p-4 text-sm text-fg-muted`,children:n.empty}),c&&!l&&c.items.length>0&&(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:n.savedPlans}),(0,K.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:c.items.map(e=>{let r=Re(e.tags);return(0,K.jsxs)(`div`,{"data-plan-stage":r,className:`min-w-0 space-y-3 rounded-xl border border-edge bg-surface-panel px-4 py-3`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,K.jsx)(te,{size:18,className:`shrink-0 text-fg-muted`,"aria-hidden":`true`}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:e.title||n.untitled}),e.snippet&&(0,K.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:e.snippet})]})]}),(0,K.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:n.stage[r]}),(0,K.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.nextStep[r]}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(R,{asChild:!0,variant:`ghost`,children:(0,K.jsx)(d,{"data-plan-id":e.id,to:`/scenes?${new URLSearchParams({plan:e.id,...e.projects?.[0]?.id?{projectId:e.projects[0].id}:{}})}`,children:n.view})}),(0,K.jsx)(R,{asChild:!0,variant:`ghost`,children:(0,K.jsx)(d,{to:X(t,e.id,e.projects?.[0]?.id),children:n.continue})}),r===`ready`&&(0,K.jsx)(R,{asChild:!0,variant:`secondary`,children:(0,K.jsx)(d,{to:X(t,e.id,e.projects?.[0]?.id,`implement`),children:n.prepare})})]})]},e.id)})}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,K.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.showing.replace(`{start}`,String(h)).replace(`{end}`,String(g)).replace(`{total}`,String(c.total))}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(R,{variant:`secondary`,disabled:i===0,onClick:()=>a(Ve),children:n.previous}),(0,K.jsx)(R,{variant:`secondary`,disabled:g>=c.total,onClick:()=>a(Be),children:n.next})]})]})]})]})}function Be(e){return e+1}function Ve(e){return Math.max(0,e-1)}function He(e){return e.conversationId}function Ue(e){return e.language}function We(e){let t=(0,H.c)(64),{noteId:n,projectId:r}=e,i=D(Ge),a;t[0]===i?a=t[1]:(a=w(i),t[0]=i,t[1]=a);let o=a.recurringWork,s,c;t[2]===n?(s=t[3],c=t[4]):(s=[`recurring-work-spec`,n],c=()=>y(n),t[2]=n,t[3]=s,t[4]=c);let{data:l,error:u,isLoading:f,mutate:p}=L(s,c);if(f){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsxs)(`div`,{className:`space-y-3`,"aria-busy":`true`,children:[(0,K.jsx)(B,{className:`h-8 w-2/3`}),(0,K.jsx)(B,{className:`h-40 w-full`})]}),t[5]=e):e=t[5],e}if(u){let e;t[6]===o.loadError?e=t[7]:(e=(0,K.jsx)(`p`,{className:`text-sm text-danger`,children:o.loadError}),t[6]=o.loadError,t[7]=e);let n;t[8]===p?n=t[9]:(n=()=>void p(),t[8]=p,t[9]=n);let r;t[10]!==o.retry||t[11]!==n?(r=(0,K.jsx)(R,{onClick:n,children:o.retry}),t[10]=o.retry,t[11]=n,t[12]=r):r=t[12];let i;return t[13]!==e||t[14]!==r?(i=(0,K.jsxs)(`div`,{role:`alert`,className:`space-y-3`,children:[e,r]}),t[13]=e,t[14]=r,t[15]=i):i=t[15],i}if(!l||!l.tags?.includes(`recurring-work-spec`)){let e;return t[16]===o.missing?e=t[17]:(e=(0,K.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:o.missing}),t[16]=o.missing,t[17]=e),e}let m;t[18]===l.tags?m=t[19]:(m=Re(l.tags),t[18]=l.tags,t[19]=m);let h=m,g=l.title||o.untitled,_;t[20]===g?_=t[21]:(_=(0,K.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:g}),t[20]=g,t[21]=_);let b=o.stage[h],x;t[22]===b?x=t[23]:(x=(0,K.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:b}),t[22]=b,t[23]=x);let S=o.nextStep[h],C;t[24]===S?C=t[25]:(C=(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:S}),t[24]=S,t[25]=C);let T;t[26]===o.planStatus?T=t[27]:(T=(0,K.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:o.planStatus}),t[26]=o.planStatus,t[27]=T);let E;t[28]!==C||t[29]!==T||t[30]!==_||t[31]!==x?(E=(0,K.jsxs)(`div`,{className:`space-y-1`,children:[_,x,C,T]}),t[28]=C,t[29]=T,t[30]=_,t[31]=x,t[32]=E):E=t[32];let O;t[33]!==o.beforeActivation||t[34]!==h?(O=h===`ready`&&(0,K.jsx)(`p`,{className:`rounded-lg border border-edge bg-surface-subtle p-3 text-sm text-fg-muted`,children:o.beforeActivation}),t[33]=o.beforeActivation,t[34]=h,t[35]=O):O=t[35];let k;t[36]!==l.id||t[37]!==l.markdown?(k=(0,K.jsx)(v,{content:l.markdown,noteId:l.id}),t[36]=l.id,t[37]=l.markdown,t[38]=k):k=t[38];let A;t[39]!==o.prepareImplementation||t[40]!==i||t[41]!==l.id||t[42]!==r||t[43]!==h?(A=h===`ready`&&(0,K.jsx)(R,{asChild:!0,children:(0,K.jsx)(d,{to:X(i,l.id,r,`implement`),children:o.prepareImplementation})}),t[39]=o.prepareImplementation,t[40]=i,t[41]=l.id,t[42]=r,t[43]=h,t[44]=A):A=t[44];let j;t[45]!==i||t[46]!==l.id||t[47]!==r?(j=X(i,l.id,r),t[45]=i,t[46]=l.id,t[47]=r,t[48]=j):j=t[48];let M;t[49]!==o.continueDiscussion||t[50]!==j?(M=(0,K.jsx)(R,{asChild:!0,variant:`secondary`,children:(0,K.jsx)(d,{to:j,children:o.continueDiscussion})}),t[49]=o.continueDiscussion,t[50]=j,t[51]=M):M=t[51];let N=`/notes/${encodeURIComponent(l.id)}`,P;t[52]!==o.editInNotes||t[53]!==N?(P=(0,K.jsx)(R,{asChild:!0,variant:`ghost`,children:(0,K.jsx)(d,{to:N,children:o.editInNotes})}),t[52]=o.editInNotes,t[53]=N,t[54]=P):P=t[54];let F;t[55]!==A||t[56]!==M||t[57]!==P?(F=(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2 border-t border-edge pt-4`,children:[A,M,P]}),t[55]=A,t[56]=M,t[57]=P,t[58]=F):F=t[58];let I;return t[59]!==E||t[60]!==O||t[61]!==k||t[62]!==F?(I=(0,K.jsxs)(`div`,{className:`space-y-5`,children:[E,O,k,F]}),t[59]=E,t[60]=O,t[61]=k,t[62]=F,t[63]=I):I=t[63],I}function Ge(e){return e.language}var Ke=`min-h-11 w-full rounded-md border border-edge bg-surface-panel px-3 py-2 text-base text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent sm:text-sm`,Z=`min-w-0 rounded-xl border border-edge bg-surface-panel p-4 sm:p-6`,qe=`grid gap-2 text-sm font-medium text-fg`;function Je(e,t){return{needs_setup:[`待完成设置`,`Finish setup`],active:[`已开启`,`Active`],paused:[`已暂停`,`Paused`],completed:[`已完成`,`Completed`],archived:[`已归档`,`Archived`],running:[`正在检查`,`Checking`],succeeded:[`已准备成果`,`Result ready`],skipped:[`无需新行动`,`No new action`],retry_wait:[`等待来源或预算`,`Waiting for source or budget`],failed:[`检查失败`,`Check failed`],cancelled:[`已取消`,`Cancelled`]}[e]?.[+!t]??e}function Q(){let e=(0,H.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsxs)(`div`,{className:`space-y-4`,"aria-busy":`true`,children:[(0,K.jsx)(B,{className:`h-8 w-48`}),(0,K.jsx)(B,{className:`h-40 w-full`}),(0,K.jsx)(B,{className:`h-32 w-full`})]}),e[0]=t):t=e[0],t}function $(e){let t=(0,H.c)(24),{error:n,retry:r}=e,i=D(Ye)===`zh`;if(n?.status===503){let e=i?`智能关注尚未开放`:`Monitors are not available yet`,r;t[0]===e?r=t[1]:(r=(0,K.jsx)(`h1`,{className:`text-xl font-semibold text-fg`,children:e}),t[0]=e,t[1]=r);let a;t[2]!==n||t[3]!==i?(a=G(n,i),t[2]=n,t[3]=i,t[4]=a):a=t[4];let o;t[5]===a?o=t[6]:(o=(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:a}),t[5]=a,t[6]=o);let s=i?`返回对话`:`Back to chat`,c;t[7]===s?c=t[8]:(c=(0,K.jsx)(R,{asChild:!0,children:(0,K.jsx)(d,{to:`/chat`,children:s})}),t[7]=s,t[8]=c);let l;return t[9]!==r||t[10]!==o||t[11]!==c?(l=(0,K.jsxs)(`section`,{className:`${Z} space-y-3`,children:[r,o,c]}),t[9]=r,t[10]=o,t[11]=c,t[12]=l):l=t[12],l}let a;t[13]!==n||t[14]!==i?(a=G(n,i),t[13]=n,t[14]=i,t[15]=a):a=t[15];let o;t[16]===a?o=t[17]:(o=(0,K.jsx)(`p`,{className:`text-sm text-danger`,children:a}),t[16]=a,t[17]=o);let s;t[18]!==r||t[19]!==i?(s=r&&(0,K.jsxs)(R,{onClick:r,children:[(0,K.jsx)(ne,{size:16,"aria-hidden":`true`}),i?`重新加载`:`Reload`]}),t[18]=r,t[19]=i,t[20]=s):s=t[20];let c;return t[21]!==o||t[22]!==s?(c=(0,K.jsxs)(`div`,{role:`alert`,className:`space-y-3 rounded-xl border border-edge p-4`,children:[o,s]}),t[21]=o,t[22]=s,t[23]=c):c=t[23],c}function Ye(e){return e.language}function Xe(){let e=(0,H.c)(5),t=E($e);if(E(Qe)){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)($,{error:{status:401}}),e[0]=t):t=e[0],t}let n=t??`anonymous`,r,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r={provider:Ze},i=(0,K.jsx)(et,{}),e[1]=r,e[2]=i):(r=e[1],i=e[2]);let a;return e[3]===n?a=e[4]:(a=(0,K.jsx)(ee,{value:r,children:i},n),e[3]=n,e[4]=a),a}function Ze(){return new Map}function Qe(e){return e.tokenExpired}function $e(e){return e.conversationId}function et(){let e=(0,H.c)(16);Fe();let{activationId:t,templateKey:n}=u(),r=o(`/scenes/inbox`),i=D(rt),a=i===`zh`,s;e[0]===i?s=e[1]:(s=w(i),e[0]=i,e[1]=s);let l=s.recurringWork,[p,m]=(0,V.useState)(!1),h=(0,V.useRef)(null),g=f(),[_]=c(),v=_.get(`plan`),y=t&&g.state?.fromSceneInbox===!0?`/scenes/inbox${typeof g.state.inboxSearch==`string`?g.state.inboxSearch:``}`:void 0,b=ie(nt),S=ie(tt),C,T;e[2]!==S||e[3]!==b||e[4]!==a?(C=()=>{let e=a?`把需要持续留意的事交给 AI,把时间留给自己。`:`Let AI look after recurring needs, leaving more time for you.`,t=a?`查看全部成果`:`View all results`,n=a?`检查与提醒设置`:`Checks and reminders`;return b({startExtra:null,main:(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:a?`智能关注`:`Monitors`}),(0,K.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,title:e,children:e})]}),end:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(R,{asChild:!0,variant:`secondary`,className:`h-9`,children:(0,K.jsxs)(d,{"data-scene-inbox":!0,to:`/scenes/inbox`,"aria-label":t,title:t,children:[(0,K.jsx)(le,{className:`size-4`,"aria-hidden":`true`}),(0,K.jsx)(`span`,{className:`hidden sm:inline`,children:t})]})}),(0,K.jsx)(R,{ref:h,type:`button`,variant:`ghost`,className:`size-9 p-0`,"aria-label":n,title:n,"aria-haspopup":`dialog`,onClick:()=>m(!0),children:(0,K.jsx)(x,{className:`size-4`,"aria-hidden":`true`})})]})}),()=>S()},T=[S,b,a],e[2]=S,e[3]=b,e[4]=a,e[5]=C,e[6]=T):(C=e[5],T=e[6]),(0,V.useLayoutEffect)(C,T);let E;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,K.jsx)(`main`,{className:`h-full overflow-y-auto bg-surface-panel`,children:(0,K.jsxs)(`div`,{className:`mx-auto w-full max-w-7xl space-y-6 px-4 pb-7 pt-3 sm:px-6 lg:px-8 lg:pb-9 lg:pt-4`,children:[(0,K.jsx)(ze,{}),(0,K.jsx)(at,{})]})}),e[7]=E):E=e[7];let O=(v||t||n||r)&&(0,K.jsx)(it,{titleText:v?l.dialogTitle:r?_.has(`digest`)?a?`摘要中的成果`:`Results in this digest`:a?`关注成果`:`Monitor results`:t?a?`关注详情`:`Monitor details`:a?`了解并开启`:`Explore and start`,closeLabel:v?l.closeDialog:r?a?`关闭关注成果`:`Close monitor results`:t?a?`关闭关注详情`:`Close monitor details`:a?`关闭关注设置`:`Close monitor setup`,backTo:y,backLabel:a?`返回成果`:`Back to results`,restoreSelector:v?`[data-plan-id="${CSS.escape(v)}"]`:r?`[data-scene-inbox]`:t?`[data-scene-id="${CSS.escape(t)}"]`:`[data-scene-template="${CSS.escape(n)}"]`,children:v?(0,K.jsx)(We,{noteId:v,projectId:_.get(`projectId`)??void 0}):r?(0,K.jsx)(ct,{}):t?(0,K.jsx)(ft,{id:t}):(0,K.jsx)(ut,{templateKey:n})},v??t??n??`inbox`),k;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>h.current?.focus(),e[8]=k):k=e[8];let A;e[9]!==p||e[10]!==a?(A=(0,K.jsx)(ve,{zh:a,open:p,onOpenChange:m,onCloseAutoFocus:k}),e[9]=p,e[10]=a,e[11]=A):A=e[11];let j;return e[12]!==E||e[13]!==O||e[14]!==A?(j=(0,K.jsxs)(K.Fragment,{children:[E,O,A]}),e[12]=E,e[13]=O,e[14]=A,e[15]=j):j=e[15],j}function tt(e){return e.clearPageHeader}function nt(e){return e.setPageHeader}function rt(e){return e.language}function it(e){let t=(0,H.c)(29),{titleText:n,closeLabel:r,restoreSelector:i,backTo:a,backLabel:o,children:c}=e,l=s(),u=(0,V.useRef)(null),f;t[0]===l?f=t[1]:(f=()=>l(`/scenes`,{replace:!0}),t[0]=l,t[1]=f);let p=f,m;t[2]===p?m=t[3]:(m=e=>{e||p()},t[2]=p,t[3]=m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsx)(k,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[4]=h):h=t[4];let g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{e.preventDefault(),u.current?.focus()},t[5]=g):g=t[5];let _;t[6]===i?_=t[7]:(_=e=>{e.preventDefault(),document.querySelector(i)?.focus()},t[6]=i,t[7]=_);let v;t[8]!==o||t[9]!==a?(v=a&&(0,K.jsx)(R,{asChild:!0,variant:`ghost`,className:`size-9 shrink-0 p-0`,children:(0,K.jsx)(d,{to:a,replace:!0,"aria-label":o,title:o,children:(0,K.jsx)(oe,{size:18,"aria-hidden":`true`})})}),t[8]=o,t[9]=a,t[10]=v):v=t[10];let y;t[11]===n?y=t[12]:(y=(0,K.jsx)(P,{ref:u,tabIndex:-1,className:`min-w-0 flex-1 text-base font-semibold text-fg outline-none`,children:n}),t[11]=n,t[12]=y);let b;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,K.jsx)(C,{size:18,"aria-hidden":`true`}),t[13]=b):b=t[13];let x;t[14]===r?x=t[15]:(x=(0,K.jsx)(j,{asChild:!0,children:(0,K.jsx)(R,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":r,title:r,children:b})}),t[14]=r,t[15]=x);let S;t[16]!==v||t[17]!==y||t[18]!==x?(S=(0,K.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge px-4 py-3 sm:px-6`,children:[v,y,x]}),t[16]=v,t[17]=y,t[18]=x,t[19]=S):S=t[19];let w;t[20]===c?w=t[21]:(w=(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4 sm:p-6`,children:(0,K.jsx)(`div`,{className:`space-y-6`,children:c})}),t[20]=c,t[21]=w);let T;t[22]!==S||t[23]!==w||t[24]!==_?(T=(0,K.jsxs)(M,{children:[h,(0,K.jsxs)(N,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(52rem,calc(100dvh-2rem))] w-[min(52rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,"aria-describedby":void 0,onOpenAutoFocus:g,onCloseAutoFocus:_,children:[S,w]})]}),t[22]=S,t[23]=w,t[24]=_,t[25]=T):T=t[25];let E;return t[26]!==T||t[27]!==m?(E=(0,K.jsx)(F,{open:!0,onOpenChange:m,children:T}),t[26]=T,t[27]=m,t[28]=E):E=t[28],E}function at(){let e=(0,H.c)(48),{activationId:t}=u(),n=D(ot)===`zh`,[r,i]=c(),a;e[0]===r?a=e[1]:(a=r.get(`after`)??``,e[0]=r,e[1]=a);let o=a,s=L(`/templates`,U),l=L(`/activations?limit=20&afterId=${encodeURIComponent(o)}`,U),f=l.mutate,p,m;if(e[2]!==t||e[3]!==f?(p=()=>{t||f()},m=[t,f],e[2]=t,e[3]=f,e[4]=p,e[5]=m):(p=e[4],m=e[5]),(0,V.useEffect)(p,m),s.error||l.error){let t=s.error??l.error,n;e[6]!==l||e[7]!==s?(n=()=>{s.mutate(),l.mutate()},e[6]=l,e[7]=s,e[8]=n):n=e[8];let r;return e[9]!==t||e[10]!==n?(r=(0,K.jsx)($,{error:t,retry:n}),e[9]=t,e[10]=n,e[11]=r):r=e[11],r}if(!s.data||!l.data){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(Q,{}),e[12]=t):t=e[12],t}let h=n?`你想先轻松一点的事`:`Where could you use a little help?`,g;e[13]===h?g=e[14]:(g=(0,K.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:h}),e[13]=h,e[14]=g);let _;if(e[15]!==s.data.templates||e[16]!==n){let t;e[18]===n?t=e[19]:(t=e=>(0,K.jsxs)(`article`,{className:`${Z} space-y-3`,children:[(0,K.jsx)(S,{className:`text-fg-muted`,size:20,"aria-hidden":`true`}),(0,K.jsx)(`h3`,{className:`text-balance font-medium text-fg`,children:e.title}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.description}),(0,K.jsx)(R,{asChild:!0,children:(0,K.jsx)(d,{"data-scene-template":e.key,to:`/scenes/new/${encodeURIComponent(e.key)}?version=${encodeURIComponent(e.version)}`,children:n?`了解并开启`:`Explore and start`})})]},`${e.key}:${e.version}`),e[18]=n,e[19]=t),_=s.data.templates.map(t),e[15]=s.data.templates,e[16]=n,e[17]=_}else _=e[17];let v;e[20]===_?v=e[21]:(v=(0,K.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:_}),e[20]=_,e[21]=v);let y;e[22]!==g||e[23]!==v?(y=(0,K.jsxs)(`section`,{className:`space-y-3`,children:[g,v]}),e[22]=g,e[23]=v,e[24]=y):y=e[24];let b=n?`我的关注`:`My monitors`,x;e[25]===b?x=e[26]:(x=(0,K.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:b}),e[25]=b,e[26]=x);let C;e[27]!==l.data.activations||e[28]!==n?(C=l.data.activations.length?l.data.activations.map(e=>(0,K.jsxs)(d,{to:`/scenes/${e.id}`,"data-scene-id":e.id,className:`${Z} block space-y-2 transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,K.jsx)(`p`,{className:`break-words font-medium text-fg`,children:e.goal}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Je(e.status===`active`&&e.setupMissing?.length?`needs_setup`:e.status,n)})]},e.id)):(0,K.jsxs)(`div`,{className:`${Z} space-y-2`,children:[(0,K.jsx)(fe,{"aria-hidden":`true`,className:`text-fg-muted`}),(0,K.jsx)(`p`,{className:`text-fg`,children:n?`还没有开启智能关注`:`No monitors yet`}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`从上面选择一件你希望 AI 帮忙照看的事。`:`Choose something above that you would like AI to monitor.`})]}),e[27]=l.data.activations,e[28]=n,e[29]=C):C=e[29];let w;e[30]!==o||e[31]!==i||e[32]!==n?(w=o&&(0,K.jsx)(R,{onClick:()=>i({}),children:n?`返回第一页`:`First page`}),e[30]=o,e[31]=i,e[32]=n,e[33]=w):w=e[33];let T;e[34]!==l.data.nextCursor||e[35]!==i||e[36]!==n?(T=l.data.nextCursor&&(0,K.jsx)(R,{onClick:()=>i({after:l.data.nextCursor}),children:n?`下一页`:`Next page`}),e[34]=l.data.nextCursor,e[35]=i,e[36]=n,e[37]=T):T=e[37];let E;e[38]!==w||e[39]!==T?(E=(0,K.jsxs)(`div`,{className:`flex gap-3`,children:[w,T]}),e[38]=w,e[39]=T,e[40]=E):E=e[40];let O;e[41]!==C||e[42]!==E||e[43]!==x?(O=(0,K.jsxs)(`section`,{className:`space-y-3`,children:[x,C,E]}),e[41]=C,e[42]=E,e[43]=x,e[44]=O):O=e[44];let k;return e[45]!==O||e[46]!==y?(k=(0,K.jsxs)(K.Fragment,{children:[y,O]}),e[45]=O,e[46]=y,e[47]=k):k=e[47],k}function ot(e){return e.language}function st(e){let t=(0,H.c)(20),{zh:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={refreshInterval:15e3,shouldRetryOnError:!1},t[0]=r):r=t[0];let i=L(`/metrics`,U,r),a;t[1]===n?a=t[2]:(a=n?[`有帮助的成果`,`没有帮助的成果`,`带来帮助的关注`]:[`Helpful results`,`Unhelpful results`,`Monitors that helped`],t[1]=n,t[2]=a);let o=a,s,c,l,u;if(t[3]!==o||t[4]!==i||t[5]!==n){let e=i.data?[i.data.usefulOutcomes,i.data.unhelpfulOutcomes,i.data.scenesWithUsefulOutcomes]:[],r=new Intl.NumberFormat(n?`zh-CN`:`en`);s=`${Z} space-y-3`,c=n?`反馈概览`:`Feedback overview`;let a=n?`最近 7 天的反馈`:`Feedback in the last 7 days`;t[10]===a?l=t[11]:(l=(0,K.jsx)(`h2`,{className:`text-balance text-base font-semibold text-fg`,children:a}),t[10]=a,t[11]=l),u=i.error?(0,K.jsxs)(`div`,{role:`alert`,className:`space-y-2`,children:[(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`暂时无法加载统计,仍可查看和评价成果。`:`Stats are unavailable. You can still view and rate results.`}),(0,K.jsx)(R,{disabled:i.isValidating,onClick:()=>void i.mutate(),children:n?`重新加载统计`:`Reload stats`})]}):(0,K.jsx)(`dl`,{className:`grid gap-4 sm:grid-cols-3`,"aria-busy":!i.data,children:o.map((t,n)=>(0,K.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,K.jsx)(`dt`,{className:`text-sm text-fg-muted`,children:t}),(0,K.jsx)(`dd`,{className:`text-xl font-semibold tabular-nums text-fg`,children:i.data?r.format(e[n]):(0,K.jsx)(B,{className:`h-7 w-12`})})]},t))}),t[3]=o,t[4]=i,t[5]=n,t[6]=s,t[7]=c,t[8]=l,t[9]=u}else s=t[6],c=t[7],l=t[8],u=t[9];let d=n?`按你这段时间的明确反馈统计,每份成果取最新评价。已读和检查成功不计入,也不代表已采纳或节省时间。`:`Counts your explicit feedback during this period, using the latest rating per result. Reads and successful checks do not count. This does not measure adoption or time saved.`,f;t[12]===d?f=t[13]:(f=(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d}),t[12]=d,t[13]=f);let p;return t[14]!==s||t[15]!==c||t[16]!==l||t[17]!==u||t[18]!==f?(p=(0,K.jsxs)(`section`,{className:s,"aria-label":c,children:[l,u,f]}),t[14]=s,t[15]=c,t[16]=l,t[17]=u,t[18]=f,t[19]=p):p=t[19],p}function ct(){let e=(0,H.c)(42),t=D(lt)===`zh`,[n,r]=c(),i;e[0]===n?i=e[1]:(i=n.get(`after`)??``,e[0]=n,e[1]=i);let a=i,o;e[2]===n?o=e[3]:(o=n.get(`digest`),e[2]=n,e[3]=o);let s=o,l;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:15e3},e[4]=l):l=e[4];let u=L(`${s?`/digests/${encodeURIComponent(s)}`:`/outcomes`}?limit=20&afterId=${encodeURIComponent(a)}`,U,l);if(u.error){let t;e[5]===u?t=e[6]:(t=()=>void u.mutate(),e[5]=u,e[6]=t);let n;return e[7]!==u.error||e[8]!==t?(n=(0,K.jsx)($,{error:u.error,retry:t}),e[7]=u.error,e[8]=t,e[9]=n):n=e[9],n}if(!u.data){let t;return e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(Q,{}),e[10]=t):t=e[10],t}let f=t?`集中查看各项智能关注准备的成果,告诉 AI 哪些对你有帮助。`:`Review results across your monitors and tell AI what helps.`,p;e[11]===f?p=e[12]:(p=(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f}),e[11]=f,e[12]=p);let m;e[13]===t?m=e[14]:(m=(0,K.jsx)(st,{zh:t}),e[13]=t,e[14]=m);let h=t?`成果列表`:`Results list`,g;e[15]!==s||e[16]!==n||e[17]!==u||e[18]!==t?(g=u.data.outcomes.length?u.data.outcomes.map(e=>(0,K.jsxs)(`div`,{className:`space-y-2`,children:[(0,K.jsx)(Se,{item:e,zh:t,onChange:()=>void u.mutate()}),(0,K.jsx)(R,{asChild:!0,variant:`ghost`,children:(0,K.jsx)(d,{state:{fromSceneInbox:!0,inboxSearch:`?${n.toString()}`},to:`/scenes/${encodeURIComponent(e.activationId)}`,children:t?`查看所属关注`:`View monitor`})})]},e.id)):(0,K.jsxs)(`div`,{className:`${Z} space-y-3`,children:[(0,K.jsx)(le,{size:32,"aria-hidden":`true`,className:`text-fg-muted`}),(0,K.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t?`这里还没有成果`:`No results here yet`}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:s?t?`这份摘要中的成果目前不可查看,可能已被撤回。`:`Results in this digest are currently unavailable and may have been withdrawn.`:t?`回到智能关注,提供资料并检查一次;有新成果时会出现在这里。`:`Open a monitor, provide context and run a check. New results will appear here.`})]}),e[15]=s,e[16]=n,e[17]=u,e[18]=t,e[19]=g):g=e[19];let _;e[20]!==h||e[21]!==g?(_=(0,K.jsx)(`section`,{className:`space-y-4`,"aria-label":h,children:g}),e[20]=h,e[21]=g,e[22]=_):_=e[22];let v=t?`成果分页`:`Results pages`,y;e[23]!==a||e[24]!==s||e[25]!==r||e[26]!==t?(y=a&&(0,K.jsx)(R,{onClick:()=>r(s?{digest:s}:{}),children:t?`返回第一页`:`First page`}),e[23]=a,e[24]=s,e[25]=r,e[26]=t,e[27]=y):y=e[27];let b;e[28]!==s||e[29]!==u.data.nextCursor||e[30]!==r||e[31]!==t?(b=u.data.nextCursor&&(0,K.jsx)(R,{onClick:()=>r({...s?{digest:s}:{},after:u.data.nextCursor}),children:t?`下一页`:`Next page`}),e[28]=s,e[29]=u.data.nextCursor,e[30]=r,e[31]=t,e[32]=b):b=e[32];let x;e[33]!==y||e[34]!==b||e[35]!==v?(x=(0,K.jsxs)(`nav`,{className:`flex flex-wrap gap-3`,"aria-label":v,children:[y,b]}),e[33]=y,e[34]=b,e[35]=v,e[36]=x):x=e[36];let S;return e[37]!==x||e[38]!==p||e[39]!==m||e[40]!==_?(S=(0,K.jsxs)(K.Fragment,{children:[p,m,_,x]}),e[37]=x,e[38]=p,e[39]=m,e[40]=_,e[41]=S):S=e[41],S}function lt(e){return e.language}function ut(e){let t=(0,H.c)(10),{templateKey:n}=e,[r]=c(),i;t[0]===r?i=t[1]:(i=r.get(`version`)??`1.0.0`,t[0]=r,t[1]=i);let a=L(`/templates/${encodeURIComponent(n)}/versions/${encodeURIComponent(i)}`,U);if(a.error){let e;t[2]===a?e=t[3]:(e=()=>void a.mutate(),t[2]=a,t[3]=e);let n;return t[4]!==e||t[5]!==a.error?(n=(0,K.jsx)($,{error:a.error,retry:e}),t[4]=e,t[5]=a.error,t[6]=n):n=t[6],n}if(!a.data){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(Q,{}),t[7]=e):e=t[7],e}let o=a.data.template,s;return t[8]===o?s=t[9]:(s=o.execution.kind===`task`?(0,K.jsx)(je,{template:o}):(0,K.jsx)(dt,{manifest:o}),t[8]=o,t[9]=s),s}function dt({manifest:e}){let t=D(e=>e.language)===`zh`,n=s(),[r,i]=(0,V.useState)(``),[a,o]=(0,V.useState)(``),[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(!1),[m,h]=(0,V.useState)(),[g,_]=(0,V.useState)(!1),v=(0,V.useRef)({content:``,id:``}),y=(0,V.useRef)(``),b=!!(r||c||u)&&!g;(0,V.useEffect)(()=>{g&&n(y.current,{replace:!0})},[g,n]);let x=e.contextProviders.includes(`mail`),S=async t=>{t.preventDefault(),p(!0),h(void 0);let n={templateKey:e.key,templateVersion:e.version,goal:r,scope:x?{kind:`objects`,ids:[c.trim()]}:{kind:`personal`},permissions:{accountIds:x?[a.trim()]:[],contextProviders:e.contextProviders,effectHandlers:[]}},i=JSON.stringify(n);v.current.content!==i&&(v.current={content:i,id:crypto.randomUUID()});try{y.current=`/scenes/${(await W(`/activations`,`POST`,n,v.current.id)).activation.id}`,_(!0)}catch(e){h(e)}finally{p(!1)}};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ge,{dirty:b,zh:t}),(0,K.jsxs)(`header`,{children:[(0,K.jsx)(`h1`,{className:`text-wrap text-xl font-semibold text-fg`,children:e.title}),(0,K.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:e.description})]}),(0,K.jsx)(`form`,{onSubmit:e=>void S(e),className:`${Z} space-y-5`,children:(0,K.jsxs)(`fieldset`,{disabled:f||g,className:`space-y-5`,children:[(0,K.jsxs)(`label`,{className:qe,children:[t?`希望它持续帮你做好什么?`:`What should it keep helping you with?`,(0,K.jsx)(`textarea`,{required:!0,maxLength:4e3,rows:3,value:r,onChange:e=>i(e.target.value),className:Ke,autoComplete:`off`})]}),x&&(0,K.jsx)(Ee,{value:c,disabled:f||g,zh:t,onChange:e=>{o(e.accountId),l(e.id),d(!1)}}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`只准备草稿和建议,不发送消息、不执行外部写操作。下一步需补齐资料和检查时间;完成后才会自动检查。`:`Prepares drafts and suggestions only. No messages or external writes. Next, complete the context and timing settings for automatic checks.`}),(0,K.jsxs)(`label`,{className:`flex min-h-11 items-center gap-3 text-sm text-fg`,children:[(0,K.jsx)(`input`,{required:!0,type:`checkbox`,className:`ui-checkbox`,checked:u,onChange:e=>d(e.target.checked)}),t?`确认以上范围,允许读取我提供的资料。`:`I confirm this scope and allow reading the information I provide.`]}),!!m&&(0,K.jsx)($,{error:m}),(0,K.jsx)(R,{type:`submit`,variant:`primary`,disabled:f||g||x&&!c,children:f?t?`正在开启…`:`Starting…`:t?`继续设置`:`Continue setup`})]})})]})}function ft(e){let t=(0,H.c)(7),{id:n}=e,r=L(`/activations/${encodeURIComponent(n)}`,U);if(r.error){let e;return t[0]===r.error?e=t[1]:(e=(0,K.jsx)($,{error:r.error}),t[0]=r.error,t[1]=e),e}if(!r.data){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(Q,{}),t[2]=e):e=t[2],e}let i;return t[3]!==r.data.details||t[4]!==r.data.template.execution.kind||t[5]!==n?(i=r.data.template.execution.kind===`task`&&r.data.details?(0,K.jsx)(Me,{id:n,initial:r.data.details}):(0,K.jsx)(pt,{id:n}),t[3]=r.data.details,t[4]=r.data.template.execution.kind,t[5]=n,t[6]=i):i=t[6],i}function pt({id:e}){let t=D(e=>e.language)===`zh`,[n]=c(),r=n.get(`result`),i=`/activations/${encodeURIComponent(e)}`,[a,o]=(0,V.useState)(``),[s,l]=(0,V.useState)(``),u=L(i,U,{refreshInterval:15e3}),d=L(`${i}/runs?limit=20&afterId=${encodeURIComponent(a)}`,U,{refreshInterval:5e3}),f=L(`/outcomes?limit=20&activationId=${encodeURIComponent(e)}&afterId=${encodeURIComponent(s)}`,U,{refreshInterval:5e3}),[p,m]=(0,V.useState)(!1),[h,_]=(0,V.useState)(),[v,y]=(0,V.useState)(!1),b=(0,V.useRef)(null),[x,S]=(0,V.useState)(!1),[C,w]=(0,V.useState)(!1),[T,E]=(0,V.useState)(!1),O=x||C||T,k=async e=>{if(u.data){m(!0),_(void 0),y(!1);try{e?(b.current??=crypto.randomUUID(),await W(`${i}/checks`,`POST`,void 0,b.current),b.current=null,y(!0),o(``),l(``)):await W(i,`PATCH`,{expectedRevision:u.data.activation.revision,status:u.data.activation.status===`active`?`paused`:`active`}),await Promise.all([u.mutate(),d.mutate(),f.mutate()])}catch(e){_(e)}finally{m(!1)}}};if(u.error)return(0,K.jsx)($,{error:u.error,retry:()=>void u.mutate()});if(!u.data)return(0,K.jsx)(Q,{});let A=u.data.activation;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(ge,{dirty:O,zh:t}),(0,K.jsxs)(`header`,{className:`space-y-3`,children:[(0,K.jsx)(`h1`,{className:`break-words text-wrap text-xl font-semibold text-fg`,children:A.goal}),(0,K.jsx)(pe,{resource:{kind:`scene`,id:A.id,revision:String(A.revision)},disabled:O||p}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Je(A.status===`active`&&A.setupMissing?.length?`needs_setup`:A.status,t)}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`只准备建议和成果,不自动发送或写入外部系统。`:`Prepares suggestions and results. Does not send or write to external systems.`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,K.jsx)(R,{variant:`primary`,disabled:p||A.status!==`active`,onClick:()=>void k(!0),children:p?t?`处理中…`:`Working…`:t?`现在检查`:`Check now`}),[`active`,`paused`,`needs_setup`].includes(A.status)&&(0,K.jsxs)(R,{disabled:p,onClick:()=>void k(!1),children:[(0,K.jsx)(g,{size:16,"aria-hidden":`true`}),A.status===`active`?t?`暂停关注`:`Pause monitor`:t?`检查设置并恢复`:`Review setup and resume`]})]}),[`active`,`paused`].includes(A.status)&&(0,K.jsx)(R,{disabled:p,variant:`ghost`,onClick:()=>{m(!0),W(i,`PATCH`,{expectedRevision:A.revision,status:`completed`}).then(()=>Promise.all([u.mutate(),f.mutate(),d.mutate()])).catch(_).finally(()=>m(!1))},children:t?`结束关注(保留成果)`:`End monitor (keep results)`}),v&&(0,K.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:t?`检查已排队;没有新变化时不会生成新卡片。`:`Check queued. No new card is created when nothing has changed.`})]}),h&&(0,K.jsx)($,{error:h,retry:()=>{u.mutate(),_(void 0)}}),A.status===`active`&&!!A.setupMissing?.length&&(0,K.jsxs)(`section`,{role:`status`,className:Z,children:[(0,K.jsx)(`h2`,{className:`font-medium text-fg`,children:t?`完成以下设置后,这项关注才会自动检查`:`Complete setup for automatic checks`}),(0,K.jsx)(`ul`,{className:`mt-2 list-inside list-disc text-sm text-fg-muted`,children:A.setupMissing.map(e=>(0,K.jsx)(`li`,{children:{notes:t?`填写安排和约束`:`Provide arrangements and constraints`,schedule:t?`设置周期检查时间`:`Set a recurring review time`,deadline:t?`设置邮件跟进截止时间`:`Set a mail follow-up deadline`}[e]},e))})]}),(0,K.jsx)(me,{activationId:e,zh:t}),[`active`,`paused`,`needs_setup`].includes(A.status)&&(0,K.jsx)(mt,{activation:A,zh:t,onDirty:E,onSaved:()=>{u.mutate(),f.mutate(),d.mutate()}},A.id),A.permissions.contextProviders.includes(`user_notes`)&&(0,K.jsx)(gt,{path:i,zh:t,onDirty:S,onSaved:()=>{u.mutate(),f.mutate(),d.mutate()}}),A.permissions.contextProviders.includes(`mail`)?(0,K.jsx)(De,{activation:A,zh:t,onDirty:w,onChanged:()=>{u.mutate(),f.mutate(),d.mutate()}}):(0,K.jsx)(we,{activation:A,zh:t,onDirty:w,onChanged:()=>void u.mutate()}),r&&(0,K.jsx)(ht,{activationId:e,presentationId:r,zh:t}),(0,K.jsxs)(`section`,{className:`space-y-3`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t?`最近成果`:`Recent results`}),f.error?(0,K.jsx)($,{error:f.error,retry:()=>void f.mutate()}):f.data?f.data.outcomes.filter(t=>t.activationId===e).length===0?(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`还没有新成果。提供资料后,可以先检查一次。`:`No new results yet. Provide context and try a check.`}):f.data.outcomes.map(e=>(0,K.jsx)(Se,{item:e,zh:t,onChange:()=>void f.mutate()},e.id)):(0,K.jsx)(Q,{}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[s&&(0,K.jsx)(R,{onClick:()=>l(``),children:t?`最近成果`:`Latest results`}),f.data?.nextCursor&&(0,K.jsx)(R,{onClick:()=>l(f.data.nextCursor),children:t?`更早成果`:`Earlier results`})]})]}),(0,K.jsxs)(`section`,{className:`space-y-3`,children:[(0,K.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t?`检查记录`:`Check history`}),d.error?(0,K.jsx)($,{error:d.error,retry:()=>void d.mutate()}):d.data?d.data.runs.length===0?(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`尚未执行检查。`:`No checks yet.`}):(0,K.jsx)(`ul`,{className:`divide-y divide-edge`,children:d.data.runs.map(e=>(0,K.jsxs)(`li`,{className:`flex flex-wrap justify-between gap-2 py-3 text-sm`,children:[(0,K.jsxs)(`span`,{className:`text-fg`,children:[Je(e.status,t),e.reason===`empty_input`?t?`:请先提供资料`:`: provide context first`:``]}),(0,K.jsx)(`time`,{className:`text-fg-muted`,dateTime:new Date(e.createdAt).toISOString(),children:new Intl.DateTimeFormat(t?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}).format(e.createdAt)})]},e.id))}):(0,K.jsx)(Q,{}),(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[a&&(0,K.jsx)(R,{onClick:()=>o(``),children:t?`最近检查`:`Latest checks`}),d.data?.nextCursor&&(0,K.jsx)(R,{onClick:()=>o(d.data.nextCursor),children:t?`更早检查`:`Earlier checks`})]})]})]})}function mt(e){let t=(0,H.c)(45),{activation:n,zh:r,onDirty:i,onSaved:a}=e,[o,s]=(0,V.useState)(null),c=o?.goal??n.goal,[l,u]=(0,V.useState)(!1),[d,f]=(0,V.useState)(),p,m;t[0]!==n.goal||t[1]!==c||t[2]!==i?(p=()=>(i(c!==n.goal),()=>i(!1)),m=[c,n.goal,i],t[0]=n.goal,t[1]=c,t[2]=i,t[3]=p,t[4]=m):(p=t[3],m=t[4]),(0,V.useEffect)(p,m);let h=r?`修改目标`:`Edit goal`,g;t[5]===h?g=t[6]:(g=(0,K.jsx)(`summary`,{className:`cursor-pointer`,children:h}),t[5]=h,t[6]=g);let _=r?`保存后暂停检查并撤回旧建议。确认设置后恢复;邮件跟进时间需另行恢复。`:`Saving pauses checks and withdraws previous suggestions. Review settings before resuming, including mail deadlines.`,v;t[7]===_?v=t[8]:(v=(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:_}),t[7]=_,t[8]=v);let y=r?`新目标`:`New goal`,b;t[9]===n?b=t[10]:(b=e=>s(t=>({base:t?.base??n,goal:e.target.value})),t[9]=n,t[10]=b);let x;t[11]!==l||t[12]!==c||t[13]!==b?(x=(0,K.jsx)(`textarea`,{disabled:l,value:c,maxLength:4e3,onChange:b,className:Ke}),t[11]=l,t[12]=c,t[13]=b,t[14]=x):x=t[14];let S;t[15]!==y||t[16]!==x?(S=(0,K.jsxs)(`label`,{className:qe,children:[y,x]}),t[15]=y,t[16]=x,t[17]=S):S=t[17];let C;t[18]!==n.goal||t[19]!==l||t[20]!==c?(C=l||!c.trim()||c===n.goal,t[18]=n.goal,t[19]=l,t[20]=c,t[21]=C):C=t[21];let w;t[22]!==n||t[23]!==o?.base||t[24]!==c||t[25]!==a?(w=()=>{u(!0),f(void 0);let e=o?.base??n;W(`/activations/${n.id}`,`PATCH`,{expectedRevision:e.revision,goal:c,scope:e.scope,permissions:e.permissions}).then(()=>{s(null),a()}).catch(f).finally(()=>u(!1))},t[22]=n,t[23]=o?.base,t[24]=c,t[25]=a,t[26]=w):w=t[26];let T=r?`保存目标`:`Save goal`,E;t[27]!==C||t[28]!==w||t[29]!==T?(E=(0,K.jsx)(R,{disabled:C,onClick:w,children:T}),t[27]=C,t[28]=w,t[29]=T,t[30]=E):E=t[30];let D;t[31]!==l||t[32]!==o||t[33]!==r?(D=o&&(0,K.jsx)(R,{type:`button`,variant:`ghost`,disabled:l,onClick:()=>{s(null),f(void 0)},children:r?`放弃修改`:`Discard edits`}),t[31]=l,t[32]=o,t[33]=r,t[34]=D):D=t[34];let O;t[35]!==d||t[36]!==r?(O=d!=null&&(0,K.jsx)(`p`,{role:`alert`,className:`text-danger`,children:G(d,r)}),t[35]=d,t[36]=r,t[37]=O):O=t[37];let k;return t[38]!==S||t[39]!==E||t[40]!==D||t[41]!==O||t[42]!==g||t[43]!==v?(k=(0,K.jsxs)(`details`,{className:`${Z} space-y-3`,children:[g,v,S,E,D,O]}),t[38]=S,t[39]=E,t[40]=D,t[41]=O,t[42]=g,t[43]=v,t[44]=k):k=t[44],k}function ht(e){let t=(0,H.c)(15),{activationId:n,presentationId:r,zh:i}=e,a=L(`/presentations/${encodeURIComponent(r)}`,U);if(a.error){let e;return t[0]===a.error?e=t[1]:(e=(0,K.jsx)($,{error:a.error}),t[0]=a.error,t[1]=e),e}if(!a.data){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(Q,{}),t[2]=e):e=t[2],e}if(a.data.outcome.activationId!==n){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)($,{error:{status:404}}),t[3]=e):e=t[3],e}let o=i?`通知中的成果`:`Result from notification`,s;t[4]===o?s=t[5]:(s=(0,K.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o}),t[4]=o,t[5]=s);let c;t[6]===a?c=t[7]:(c=()=>void a.mutate(),t[6]=a,t[7]=c);let l;t[8]!==a.data.outcome||t[9]!==c||t[10]!==i?(l=(0,K.jsx)(Se,{item:a.data.outcome,zh:i,onChange:c},a.data.outcome.id),t[8]=a.data.outcome,t[9]=c,t[10]=i,t[11]=l):l=t[11];let u;return t[12]!==s||t[13]!==l?(u=(0,K.jsxs)(`section`,{className:`space-y-3`,children:[s,l]}),t[12]=s,t[13]=l,t[14]=u):u=t[14],u}function gt({path:e,zh:t,onSaved:n,onDirty:r}){let i=L(`${e}/notes`,U,{revalidateOnFocus:!1}),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(!1),[l,u]=(0,V.useState)(),d=a!==null&&a.content!==i.data?.notes.content;if((0,V.useEffect)(()=>(r(d),()=>r(!1)),[d,r]),i.error)return(0,K.jsx)($,{error:i.error,retry:()=>void i.mutate()});if(!i.data)return(0,K.jsx)(Q,{});let f=async t=>{t.preventDefault(),c(!0),u(void 0);try{let{content:t,revision:r,validUntil:s}=a??i.data.notes,c=await W(`${e}/notes`,`PATCH`,{expectedRevision:r,content:t,validUntil:s});await i.mutate({notes:{content:t.trim(),revision:c.revision,validUntil:s}},{revalidate:!1}),o(null),n()}catch(e){u(e)}finally{c(!1)}};return(0,K.jsxs)(`form`,{onSubmit:e=>void f(e),className:`${Z} space-y-3`,children:[(0,K.jsxs)(`label`,{className:qe,children:[t?`你愿意提供的安排和约束`:`Arrangements and constraints you choose to share`,(0,K.jsx)(`textarea`,{disabled:s,rows:5,maxLength:32e3,className:Ke,value:a?.content??i.data.notes.content,onChange:e=>o(t=>({...t??i.data.notes,content:e.target.value})),autoComplete:`off`})]}),(0,K.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t?`只用于这项关注,不会因此访问其他家庭成员的数据。修改资料会撤回旧计划。`:`Used only by this monitor. Does not grant access to other family members. Editing withdraws the previous plan.`}),!!l&&(0,K.jsx)($,{error:l}),(0,K.jsx)(R,{type:`submit`,disabled:s||!d,children:s?t?`正在保存…`:`Saving…`:t?`保存资料`:`Save context`}),d&&(0,K.jsx)(R,{type:`button`,disabled:s,variant:`ghost`,onClick:()=>{o(null),u(void 0),i.mutate()},children:t?`放弃修改并重新加载`:`Discard edits and reload`})]})}export{Xe as ScenesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r,r as i}from"./popover-select-DcsFzD_i.js";import{t as a}from"./secret-input-DPl3VYM8.js";import{t as o}from"./cn-JdwAhgNB.js";import{Qi as s}from"./index-ByFXhQ-T.js";var c=t();e();var l=n();function u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function d(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function f(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function p(e){return e[`x-hidden`]===!0}function m(e){let t=e.properties;if(!u(t))return[];let n=[];for(let[e,r]of Object.entries(t))u(r)&&(p(r)||n.push({key:e,sub:r,order:d(r),group:f(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function h(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function g(e){let t=(0,c.c)(38),{name:n,s:i,value:o,onChange:u,disabled:d}=e,f=typeof i.description==`string`?i.description:void 0,p=(typeof i[`x-placeholder`]==`string`?i[`x-placeholder`]:null)||f,m=i.format;if(Array.isArray(i.enum)&&i.enum.every(v)){let e;t[0]===f?e=t[1]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let a;t[2]===u?a=t[3]:(a=e=>u(e.target.value),t[2]=u,t[3]=a);let s;t[4]===i.enum?s=t[5]:(s=i.enum.map(_),t[4]=i.enum,t[5]=s);let c;t[6]!==d||t[7]!==n||t[8]!==a||t[9]!==s||t[10]!==o?(c=(0,l.jsx)(r,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:o,disabled:d,onChange:a,children:s}),t[6]=d,t[7]=n,t[8]=a,t[9]=s,t[10]=o,t[11]=c):c=t[11];let p;return t[12]!==e||t[13]!==c?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,c]}),t[12]=e,t[13]=c,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==u||t[19]!==p||t[20]!==o?(n=(0,l.jsx)(a,{value:o,onChange:u,placeholder:p,labels:s,disabled:d,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=d,t[18]=u,t[19]=p,t[20]=o,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=r):r=t[24],r}let h;t[25]===f?h=t[26]:(h=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===u?g=t[28]:(g=e=>u(e.target.value),t[27]=u,t[28]=g);let y;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==o?(y=(0,l.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:o,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=o,t[34]=y):y=t[34];let b;return t[35]!==h||t[36]!==y?(b=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,y]}),t[35]=h,t[36]=y,t[37]=b):b=t[37],b}function _(e){return(0,l.jsx)(i,{value:e,children:e},e)}function v(e){return typeof e==`string`}function y(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,o=typeof n.description==`string`?n.description:void 0,s;t[0]===o?s=t[1]:(s=o?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let u=Number.isFinite(r)?r:0,d;t[2]===i?d=t[3]:(d=e=>i(Number(e.target.value)),t[2]=i,t[3]=d);let f;t[4]!==a||t[5]!==u||t[6]!==d?(f=(0,l.jsx)(`input`,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:u,disabled:a,onChange:d}),t[4]=a,t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==s||t[9]!==f?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,f]}),t[8]=s,t[9]=f,t[10]=p):p=t[10],p}function b(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:o?.defaultBooleanLabel??`Enable`),u;t[0]===i?u=t[1]:(u=e=>i(e.target.checked),t[0]=i,t[1]=u);let d;t[2]!==a||t[3]!==u||t[4]!==r?(d=(0,l.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:u}),t[2]=a,t[3]=u,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,l.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,l.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function x(e){let t=(0,c.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,d=n.items,f=u(d)?d.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=o?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==s||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===s?_=t[12]:(_=s?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:s}):null,t[11]=s,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,l.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=s,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,l.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=o?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,l.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,l.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function S(e){let t=(0,c.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,d=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(d===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,c;t[2]===a?c=t[3]:(c=e=>a(e),t[2]=a,t[3]=c);let u;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(u=(0,l.jsx)(b,{s:r,value:n,disabled:o,onChange:c,labels:s}),t[4]=o,t[5]=s,t[6]=r,t[7]=n,t[8]=c,t[9]=u):u=t[9];let d;return t[10]!==e||t[11]!==u?(d=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,u]}),t[10]=e,t[11]=u,t[12]=d):d=t[12],d}if(d===`number`||d===`integer`){let e;t[13]===f?e=t[14]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,s;t[15]!==o||t[16]!==a||t[17]!==r||t[18]!==n?(s=(0,l.jsx)(y,{s:r,value:n,disabled:o,onChange:a}),t[15]=o,t[16]=a,t[17]=r,t[18]=n,t[19]=s):s=t[19];let c;return t[20]!==e||t[21]!==s?(c=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(d===`string`){let e;t[23]===f?e=t[24]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let s=typeof i==`string`?i:``,c;t[25]!==o||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==s?(c=(0,l.jsx)(g,{name:n,s:r,value:s,disabled:o,onChange:a}),t[25]=o,t[26]=n,t[27]=a,t[28]=r,t[29]=s,t[30]=c):c=t[30];let u;return t[31]!==e||t[32]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=u):u=t[33],u}if(d===`array`){let e=r.items,n=u(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(C)?i.map(String):[],t[36]=i,t[37]=n);let c;t[38]!==o||t[39]!==s||t[40]!==a||t[41]!==r||t[42]!==n?(c=(0,l.jsx)(x,{s:r,value:n,disabled:o,onChange:a,labels:s}),t[38]=o,t[39]=s,t[40]=a,t[41]=r,t[42]=n,t[43]=c):c=t[43];let u;return t[44]!==e||t[45]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=u):u=t[46],u}}if(d===`object`){let e;t[47]===i?e=t[48]:(e=u(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=c);let d;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(d=(0,l.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,l.jsx)(w,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[51]=o,t[52]=s,t[53]=n,t[54]=a,t[55]=r,t[56]=d):d=t[56];let p;return t[57]!==c||t[58]!==d?(p=(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,d]}),t[57]=c,t[58]=d,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==d||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof d==`string`?d:void 0)??`${f}: unsupported field type${typeof d==`string`?` (${d})`:``}`,t[60]=s,t[61]=d,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function C(e){return typeof e==`string`||typeof e==`number`}function w(e){let t=(0,c.c)(28),{schema:n,values:r,onChange:i,disabled:a,className:s,labels:d}=e,f=a===void 0?!1:a,p;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],p=e;break bb0}let e;t[1]===n?e=t[2]:(e=m(n),t[1]=n,t[2]=e),p=e}let g=p,_;bb1:{if(g.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===g?e=t[5]:(e=h(g),t[4]=g,t[5]=e),_=e}let v=_,y;t[6]!==i||t[7]!==r?(y=(e,t)=>{i({...r,[e]:t})},t[6]=i,t[7]=r,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!u(n.properties)||g.length===0)return null;let x,C;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==d||t[13]!==b||t[14]!==r){let e=Array.from(v.keys()).sort(T);t[17]===s?x=t[18]:(x=o(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==d||t[22]!==b||t[23]!==r?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,l.jsx)(S,{k:e.key,sub:e.sub,value:r[e.key],onValue:t=>b(e.key,t),disabled:f,labels:d},e.key));return e===``?(0,l.jsx)(`div`,{children:t},`default`):(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,l.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=d,t[22]=b,t[23]=r,t[24]=n):n=t[24],C=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=d,t[13]=b,t[14]=r,t[15]=x,t[16]=C}else x=t[15],C=t[16];let w;return t[25]!==x||t[26]!==C?(w=(0,l.jsx)(`div`,{className:x,children:C}),t[25]=x,t[26]=C,t[27]=w):w=t[27],w}function T(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{w as t};
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{n as r,r as i}from"./popover-select-BNZZDJpO.js";import{t as a}from"./secret-input-DPl3VYM8.js";import{t as o}from"./cn-JdwAhgNB.js";import{Qi as s}from"./index-XgbDpmNc.js";var c=t();e();var l=n();function u(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function d(e){let t=e[`x-order`];return typeof t==`number`&&!Number.isNaN(t)?t:999}function f(e){let t=e[`x-group`];return typeof t==`string`&&t.length>0?t:``}function p(e){return e[`x-hidden`]===!0}function m(e){let t=e.properties;if(!u(t))return[];let n=[];for(let[e,r]of Object.entries(t))u(r)&&(p(r)||n.push({key:e,sub:r,order:d(r),group:f(r),hidden:!1}));return n.sort((e,t)=>e.order-t.order||e.key.localeCompare(t.key)),n}function h(e){let t=new Map;for(let n of e){let e=n.group;t.has(e)||t.set(e,[]),t.get(e).push(n)}return t}function g(e){let t=(0,c.c)(38),{name:n,s:i,value:o,onChange:u,disabled:d}=e,f=typeof i.description==`string`?i.description:void 0,p=(typeof i[`x-placeholder`]==`string`?i[`x-placeholder`]:null)||f,m=i.format;if(Array.isArray(i.enum)&&i.enum.every(v)){let e;t[0]===f?e=t[1]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[0]=f,t[1]=e);let a;t[2]===u?a=t[3]:(a=e=>u(e.target.value),t[2]=u,t[3]=a);let s;t[4]===i.enum?s=t[5]:(s=i.enum.map(_),t[4]=i.enum,t[5]=s);let c;t[6]!==d||t[7]!==n||t[8]!==a||t[9]!==s||t[10]!==o?(c=(0,l.jsx)(r,{name:n,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2 text-sm text-fg`,value:o,disabled:d,onChange:a,children:s}),t[6]=d,t[7]=n,t[8]=a,t[9]=s,t[10]=o,t[11]=c):c=t[11];let p;return t[12]!==e||t[13]!==c?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,c]}),t[12]=e,t[13]=c,t[14]=p):p=t[14],p}if(m===`password`){let e;t[15]===f?e=t[16]:(e=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[15]=f,t[16]=e);let n;t[17]!==d||t[18]!==u||t[19]!==p||t[20]!==o?(n=(0,l.jsx)(a,{value:o,onChange:u,placeholder:p,labels:s,disabled:d,inputClassName:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`}),t[17]=d,t[18]=u,t[19]=p,t[20]=o,t[21]=n):n=t[21];let r;return t[22]!==e||t[23]!==n?(r=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e,n]}),t[22]=e,t[23]=n,t[24]=r):r=t[24],r}let h;t[25]===f?h=t[26]:(h=f?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:f}):null,t[25]=f,t[26]=h);let g;t[27]===u?g=t[28]:(g=e=>u(e.target.value),t[27]=u,t[28]=g);let y;t[29]!==d||t[30]!==n||t[31]!==p||t[32]!==g||t[33]!==o?(y=(0,l.jsx)(`input`,{name:n,type:`text`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg placeholder:text-fg-muted/70`,value:o,placeholder:p,disabled:d,onChange:g}),t[29]=d,t[30]=n,t[31]=p,t[32]=g,t[33]=o,t[34]=y):y=t[34];let b;return t[35]!==h||t[36]!==y?(b=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[h,y]}),t[35]=h,t[36]=y,t[37]=b):b=t[37],b}function _(e){return(0,l.jsx)(i,{value:e,children:e},e)}function v(e){return typeof e==`string`}function y(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a}=e,o=typeof n.description==`string`?n.description:void 0,s;t[0]===o?s=t[1]:(s=o?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:o}):null,t[0]=o,t[1]=s);let u=Number.isFinite(r)?r:0,d;t[2]===i?d=t[3]:(d=e=>i(Number(e.target.value)),t[2]=i,t[3]=d);let f;t[4]!==a||t[5]!==u||t[6]!==d?(f=(0,l.jsx)(`input`,{type:`number`,className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm text-fg`,value:u,disabled:a,onChange:d}),t[4]=a,t[5]=u,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==s||t[9]!==f?(p=(0,l.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[s,f]}),t[8]=s,t[9]=f,t[10]=p):p=t[10],p}function b(e){let t=(0,c.c)(11),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=(typeof n.description==`string`?n.description:void 0)??(typeof n.title==`string`&&n.title.length>0?n.title:o?.defaultBooleanLabel??`Enable`),u;t[0]===i?u=t[1]:(u=e=>i(e.target.checked),t[0]=i,t[1]=u);let d;t[2]!==a||t[3]!==u||t[4]!==r?(d=(0,l.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border border-edge`,checked:r,disabled:a,onChange:u}),t[2]=a,t[3]=u,t[4]=r,t[5]=d):d=t[5];let f;t[6]===s?f=t[7]:(f=(0,l.jsx)(`span`,{children:s}),t[6]=s,t[7]=f);let p;return t[8]!==d||t[9]!==f?(p=(0,l.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg`,children:[d,f]}),t[8]=d,t[9]=f,t[10]=p):p=t[10],p}function x(e){let t=(0,c.c)(27),{s:n,value:r,onChange:i,disabled:a,labels:o}=e,s=typeof n.description==`string`?n.description:void 0,d=n.items,f=u(d)?d.type:void 0;if(!(f===`string`||Array.isArray(f)&&f.includes(`string`))){let e=o?.unsupportedArrayType??`Unsupported array type`,n;return t[0]===e?n=t[1]:(n=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e}),t[0]=e,t[1]=n),n}let p,m,h,g,_;if(t[2]!==s||t[3]!==a||t[4]!==i||t[5]!==r){let e=r.map(String);p=t=>{let n=t.trim();!n||e.includes(n)||i([...e,n])},g=`flex flex-col gap-1.5`,t[11]===s?_=t[12]:(_=s?(0,l.jsx)(`label`,{className:`text-xs text-fg-muted`,children:s}):null,t[11]=s,t[12]=_),m=`flex flex-wrap gap-1`,h=e.map(t=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-sm`,children:[t,(0,l.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,disabled:a,onClick:()=>i(e.filter(e=>e!==t)),children:`×`})]},t)),t[2]=s,t[3]=a,t[4]=i,t[5]=r,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_}else p=t[6],m=t[7],h=t[8],g=t[9],_=t[10];let v;t[13]!==m||t[14]!==h?(v=(0,l.jsx)(`div`,{className:m,children:h}),t[13]=m,t[14]=h,t[15]=v):v=t[15];let y=o?.arrayAddPlaceholder??`Add and press Enter`,b;t[16]===p?b=t[17]:(b=e=>{e.key===`Enter`&&(e.preventDefault(),p(e.target.value),e.target.value=``)},t[16]=p,t[17]=b);let x;t[18]!==a||t[19]!==y||t[20]!==b?(x=(0,l.jsx)(`input`,{className:`ui-input h-9 rounded-md border border-edge bg-surface-base px-2.5 text-sm`,disabled:a,placeholder:y,onKeyDown:b}),t[18]=a,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;return t[22]!==g||t[23]!==_||t[24]!==v||t[25]!==x?(S=(0,l.jsxs)(`div`,{className:g,children:[_,v,x]}),t[22]=g,t[23]=_,t[24]=v,t[25]=x,t[26]=S):S=t[26],S}function S(e){let t=(0,c.c)(66),{k:n,sub:r,value:i,onValue:a,disabled:o,labels:s}=e,d=r.type,f=(typeof r.title==`string`&&r.title.length>0?r.title:null)??n;if(d===`boolean`){let e;t[0]===f?e=t[1]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[0]=f,t[1]=e);let n=i===!0,c;t[2]===a?c=t[3]:(c=e=>a(e),t[2]=a,t[3]=c);let u;t[4]!==o||t[5]!==s||t[6]!==r||t[7]!==n||t[8]!==c?(u=(0,l.jsx)(b,{s:r,value:n,disabled:o,onChange:c,labels:s}),t[4]=o,t[5]=s,t[6]=r,t[7]=n,t[8]=c,t[9]=u):u=t[9];let d;return t[10]!==e||t[11]!==u?(d=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,u]}),t[10]=e,t[11]=u,t[12]=d):d=t[12],d}if(d===`number`||d===`integer`){let e;t[13]===f?e=t[14]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[13]=f,t[14]=e);let n=typeof i==`number`?i:0,s;t[15]!==o||t[16]!==a||t[17]!==r||t[18]!==n?(s=(0,l.jsx)(y,{s:r,value:n,disabled:o,onChange:a}),t[15]=o,t[16]=a,t[17]=r,t[18]=n,t[19]=s):s=t[19];let c;return t[20]!==e||t[21]!==s?(c=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,s]}),t[20]=e,t[21]=s,t[22]=c):c=t[22],c}if(d===`string`){let e;t[23]===f?e=t[24]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[23]=f,t[24]=e);let s=typeof i==`string`?i:``,c;t[25]!==o||t[26]!==n||t[27]!==a||t[28]!==r||t[29]!==s?(c=(0,l.jsx)(g,{name:n,s:r,value:s,disabled:o,onChange:a}),t[25]=o,t[26]=n,t[27]=a,t[28]=r,t[29]=s,t[30]=c):c=t[30];let u;return t[31]!==e||t[32]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[31]=e,t[32]=c,t[33]=u):u=t[33],u}if(d===`array`){let e=r.items,n=u(e)?e.type:void 0;if(n===`string`||Array.isArray(n)&&n.includes(`string`)){let e;t[34]===f?e=t[35]:(e=(0,l.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:f}),t[34]=f,t[35]=e);let n;t[36]===i?n=t[37]:(n=Array.isArray(i)&&i.every(C)?i.map(String):[],t[36]=i,t[37]=n);let c;t[38]!==o||t[39]!==s||t[40]!==a||t[41]!==r||t[42]!==n?(c=(0,l.jsx)(x,{s:r,value:n,disabled:o,onChange:a,labels:s}),t[38]=o,t[39]=s,t[40]=a,t[41]=r,t[42]=n,t[43]=c):c=t[43];let u;return t[44]!==e||t[45]!==c?(u=(0,l.jsxs)(`div`,{className:`space-y-1.5`,children:[e,c]}),t[44]=e,t[45]=c,t[46]=u):u=t[46],u}}if(d===`object`){let e;t[47]===i?e=t[48]:(e=u(i)?i:{},t[47]=i,t[48]=e);let n=e,c;t[49]===f?c=t[50]:(c=(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:f}),t[49]=f,t[50]=c);let d;t[51]!==o||t[52]!==s||t[53]!==n||t[54]!==a||t[55]!==r?(d=(0,l.jsx)(`div`,{className:`border-t border-edge p-3`,children:(0,l.jsx)(w,{schema:r,values:n,onChange:a,disabled:o,labels:s})}),t[51]=o,t[52]=s,t[53]=n,t[54]=a,t[55]=r,t[56]=d):d=t[56];let p;return t[57]!==c||t[58]!==d?(p=(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[c,d]}),t[57]=c,t[58]=d,t[59]=p):p=t[59],p}let p;t[60]!==s||t[61]!==d||t[62]!==f?(p=s?.unsupportedFieldType?.(f,typeof d==`string`?d:void 0)??`${f}: unsupported field type${typeof d==`string`?` (${d})`:``}`,t[60]=s,t[61]=d,t[62]=f,t[63]=p):p=t[63];let m;return t[64]===p?m=t[65]:(m=(0,l.jsx)(`p`,{className:`text-xs text-fg-muted`,children:p}),t[64]=p,t[65]=m),m}function C(e){return typeof e==`string`||typeof e==`number`}function w(e){let t=(0,c.c)(28),{schema:n,values:r,onChange:i,disabled:a,className:s,labels:d}=e,f=a===void 0?!1:a,p;bb0:{if(n.type!==`object`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],p=e;break bb0}let e;t[1]===n?e=t[2]:(e=m(n),t[1]=n,t[2]=e),p=e}let g=p,_;bb1:{if(g.length===0){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=new Map,t[3]=e):e=t[3],_=e;break bb1}let e;t[4]===g?e=t[5]:(e=h(g),t[4]=g,t[5]=e),_=e}let v=_,y;t[6]!==i||t[7]!==r?(y=(e,t)=>{i({...r,[e]:t})},t[6]=i,t[7]=r,t[8]=y):y=t[8];let b=y;if(n.type!==`object`||!u(n.properties)||g.length===0)return null;let x,C;if(t[9]!==s||t[10]!==f||t[11]!==v||t[12]!==d||t[13]!==b||t[14]!==r){let e=Array.from(v.keys()).sort(T);t[17]===s?x=t[18]:(x=o(`flex flex-col gap-4`,s),t[17]=s,t[18]=x);let n;t[19]!==f||t[20]!==v||t[21]!==d||t[22]!==b||t[23]!==r?(n=e=>{let t=(v.get(e)??[]).map(e=>(0,l.jsx)(S,{k:e.key,sub:e.sub,value:r[e.key],onValue:t=>b(e.key,t),disabled:f,labels:d},e.key));return e===``?(0,l.jsx)(`div`,{children:t},`default`):(0,l.jsxs)(`details`,{className:`group rounded-lg border border-edge bg-surface-panel/40 open:bg-surface-base`,open:!0,children:[(0,l.jsx)(`summary`,{className:`cursor-pointer select-none px-3 py-2 text-sm font-medium text-fg group-open:rounded-b-none`,children:e}),(0,l.jsx)(`div`,{className:`space-y-4 border-t border-edge p-3`,children:t})]},e)},t[19]=f,t[20]=v,t[21]=d,t[22]=b,t[23]=r,t[24]=n):n=t[24],C=e.map(n),t[9]=s,t[10]=f,t[11]=v,t[12]=d,t[13]=b,t[14]=r,t[15]=x,t[16]=C}else x=t[15],C=t[16];let w;return t[25]!==x||t[26]!==C?(w=(0,l.jsx)(`div`,{className:x,children:C}),t[25]=x,t[26]=C,t[27]=w):w=t[27],w}function T(e,t){return e===``?-1:t===``?1:e.localeCompare(t)}export{w as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,t,u as n}from"./session-manager-
|
|
1
|
+
import{i as e,t,u as n}from"./session-manager-CFqOuGy-.js";async function r(r,i,a){let o=new t,s=await o.loadSessionAgentConfig(r);await o.loadSession(r),n(r,s),await new e().send(i,r,a,s.thinkingLevel)}export{r as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,r as t}from"./locale-store-
|
|
1
|
+
import{a as e,r as t}from"./locale-store-DodizOrj.js";import{d as n,g as r,h as i,i as a,l as o,p as s,r as c,s as l,t as u,u as d,v as f}from"./schemas-CObaziC7.js";import{t as p}from"./gateway-startup-retry-BEj_bcbm.js";var m=f().transform(e=>e.toLowerCase()).brand(),h=s().trim().regex(/^[a-z0-9][a-z0-9._-]{0,127}$/i).brand(),g=u([`active`,`idle`,`archived`,`pinned`]),_=d({agentId:s().optional(),source:s().optional(),accountId:s().optional(),peerKind:s().optional(),peerId:s().optional(),threadId:s().optional(),scopeId:s().optional()}).passthrough();d({agentId:s().optional(),projectId:s().optional(),key:s(),transcriptId:h.optional(),name:s().optional(),title:s().optional(),displayName:s().optional(),messageCount:o(),updatedAt:s(),sourceChannel:s().optional(),status:g.optional(),usage:d({calls:o().int().nonnegative(),unknownCostCalls:o().int().nonnegative(),totalTokens:o().int().nonnegative(),knownCostUsd:s(),costCompleteness:u([`complete`,`partial`,`unknown`])}).optional(),routing:_.optional()}).passthrough();var v=d({items:c(r()),total:o(),limit:o(),offset:o(),hasMore:a()}),y=d({role:s(),content:r(),timestamp:i([s(),o()]).optional()}).passthrough(),b=d({key:s(),messages:c(y)}).passthrough(),x=d({session:b}),ee=d({session:d({key:s(),transcriptId:h.optional(),messages:c(y),name:s().optional(),status:g.optional(),sourceChannel:s().optional(),sourceChatId:s().optional(),projectId:s().optional(),customData:n(s(),r()).optional(),routing:_.optional()}).passthrough(),pagination:d({total:o(),limit:o(),offset:o(),hasMore:a(),before:s().optional(),nextBeforeCursor:s().optional(),revision:o().int().nonnegative().optional()}).passthrough()}).passthrough(),S=d({ok:l(!0),conversationId:f(),rowCount:o().int().nonnegative(),lastTurnId:s().min(1),session:b}).passthrough(),C=d({ok:a().optional(),payload:d({active:a(),runId:s().optional()}).passthrough().optional()}).passthrough(),w=d({ok:a().optional(),error:s().optional()}).passthrough(),T=w.extend({renamed:a().optional()}),E=w.extend({reset:a().optional(),transcriptId:h.optional(),previousTranscriptId:s().optional(),session:r().optional()}),D=d({totalSessions:o(),activeSessions:o(),archivedSessions:o(),pinnedSessions:o(),totalMessages:o(),totalTokens:o(),oldestSession:s().optional(),newestSession:s().optional(),byChannel:n(s(),o())}).passthrough();d({ok:a(),payload:d({conversationId:f(),transcriptId:h,session:r()}).passthrough().optional(),error:s().optional()}).passthrough();var O=d({ok:l(!0),projects:d({items:c(d({project:r(),sessions:c(r()),sessionTotal:o(),sessionHasMore:a()}).passthrough()),total:o(),limit:o(),offset:o(),hasMore:a()}),inbox:v,pinned:c(r()).default([]),layouts:n(s(),d({itemIds:c(s()),revision:o().int().nonnegative()})).default({}),childrenByConversationId:n(s(),d({total:o(),activeCount:o(),items:c(d({taskId:s(),title:s(),phase:s(),runStatus:s().optional(),activeConversationId:s().optional()}))})).default({})}).passthrough();function k(e){return x.parse(e)}function A(e){return ee.parse(e)}function j(e){return S.parse(e)}function M(e){return C.parse(e)}function N(e){return w.parse(e)}function P(e){return T.parse(e)}function F(e){return E.parse(e)}function I(e){return D.parse(e)}function L(e){return O.parse(e)}function R(e){let t=M(e).payload,n=typeof t?.runId==`string`?t.runId.trim():``;return!t?.active||!n?{active:!1}:{active:!0,runId:n}}function z(e){let t=new URLSearchParams;if(!e)return``;e.status&&t.set(`status`,e.status),e.search&&t.set(`search`,e.search),e.channel&&t.set(`channel`,e.channel),e.sources?.length&&t.set(`sources`,e.sources.join(`,`)),e.purposes?.length&&t.set(`purposes`,e.purposes.join(`,`)),e.activity&&t.set(`activity`,e.activity),e.agentId&&t.set(`agentId`,e.agentId),e.excludeArchived&&t.set(`excludeArchived`,`true`),e.projectId&&t.set(`projectId`,e.projectId),e.unassigned&&t.set(`unassigned`,`true`),e.updatedAfter!=null&&t.set(`updatedAfter`,String(e.updatedAfter)),e.includePinned&&t.set(`includePinned`,`true`),e.includeConversationId&&t.set(`includeConversationId`,e.includeConversationId),e.rootConversationsOnly&&t.set(`rootConversationsOnly`,`true`),e.sessionTypes?.length&&t.set(`types`,e.sessionTypes.join(`,`)),e.sortBy&&t.set(`sortBy`,e.sortBy),e.sortOrder&&t.set(`sortOrder`,e.sortOrder),e.limit!=null&&t.set(`limit`,String(e.limit)),e.offset!=null&&t.set(`offset`,String(e.offset));let n=t.toString();return n?`?${n}`:``}function B(e,t){let n=[];t?.includeTranscript&&n.push(`transcript`),t?.includeTranscriptRows&&n.push(`transcriptRows`);let r=n.length?`?include=${n.join(`,`)}`:``;return`/api/sessions/${encodeURIComponent(e)}${r}`}function V(e){return`/api/sessions/${encodeURIComponent(e)}/fork-at-turn`}function te(e,t){let n=new URLSearchParams;n.set(`limit`,String(t?.limit??50));let r=t?.before?.trim();return r?n.set(`before`,r):t?.offset!=null&&n.set(`offset`,String(t.offset)),`/api/sessions/${encodeURIComponent(e)}/history?${n.toString()}`}function H(e){return`/api/sessions/${encodeURIComponent(e)}/run`}function U(){return`/api/sessions/stats`}function W(e){let t=new URLSearchParams;e?.projectLimit!=null&&t.set(`projectLimit`,String(e.projectLimit)),e?.projectOffset!=null&&t.set(`projectOffset`,String(e.projectOffset)),e?.sessionPreviewLimit!=null&&t.set(`sessionPreviewLimit`,String(e.sessionPreviewLimit)),e?.inboxLimit!=null&&t.set(`inboxLimit`,String(e.inboxLimit)),e?.inboxOffset!=null&&t.set(`inboxOffset`,String(e.inboxOffset)),e?.staleDays!=null&&t.set(`staleDays`,String(e.staleDays)),e?.includeConversationId&&t.set(`includeConversationId`,e.includeConversationId);let n=t.toString();return`/api/sidebar/chat-list${n?`?${n}`:``}`}function G(e){return`/api/sidebar/layouts/${encodeURIComponent(e)}`}function K(e,t){let n=encodeURIComponent(e);return t===`delete`?`/api/sessions/${n}`:`/api/sessions/${n}/${t}`}function q(e){return e?JSON.stringify({status:e.status,search:e.search,channel:e.channel,sources:e.sources,purposes:e.purposes,activity:e.activity,agentId:e.agentId,excludeArchived:e.excludeArchived,projectId:e.projectId,unassigned:e.unassigned,updatedAfter:e.updatedAfter,includePinned:e.includePinned,includeConversationId:e.includeConversationId,sessionTypes:e.sessionTypes,sortBy:e.sortBy,sortOrder:e.sortOrder,limit:e.limit,offset:e.offset}):`default`}var J=new Map;async function Y(e){let n=q(e),r=J.get(n);if(r)return r;let i=t(`/api/sessions${z(e)}`),a=(async()=>{let e=await p(i);if(!e.ok){let t=await e.json().catch(()=>({})),n=typeof t.error==`string`?t.error:t.error?.message;throw Error(n??`HTTP ${e.status}`)}return await e.json()})().finally(()=>{J.delete(n)});return J.set(n,a),a}async function X(n){return L(await e(t(W(n))))}async function Z(n){let r=await e(t(G(n.containerId)),{method:`PUT`,body:JSON.stringify({itemIds:n.itemIds,expectedRevision:n.expectedRevision})});if(!r.ok||!r.layout)throw Error(r.error??`Failed to save sidebar order`);return r.layout}async function Q(){return I(await e(t(U())))}async function ne(n,r){let i=k(await e(t(B(n,r))));if(!i.session)throw Error(`Session not found`);return i.session}async function re(n){let r=await e(t(`/api/sessions/resolve`),{method:`POST`,body:JSON.stringify(n)});if(!r.ok||!r.payload)throw Error(r.error??`Session not found`);return r.payload}async function ie(n){N(await e(t(K(n,`delete`)),{method:`DELETE`}))}async function ae(n,r){return{renamed:P(await e(t(K(n,`rename`)),{method:`POST`,body:JSON.stringify({name:r})})).renamed===!0}}async function oe(n){N(await e(t(K(n,`archive`)),{method:`POST`}))}async function $(n){N(await e(t(K(n,`unarchive`)),{method:`POST`}))}async function se(n){N(await e(t(K(n,`pin`)),{method:`POST`}))}async function ce(n){N(await e(t(K(n,`unpin`)),{method:`POST`}))}async function le(n){return(await e(t(`/api/sessions/${encodeURIComponent(n)}/export?format=json`))).content}export{R as _,ne as a,F as b,se as c,Z as d,$ as f,H as g,te as h,X as i,ae as l,V as m,ie as n,Q as o,ce as p,le as r,Y as s,oe as t,re as u,j as v,m as x,A as y};
|
package/dist/gateway/static/root/assets/{session-manager-DsH1DZI_.js → session-manager-CFqOuGy-.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{c as t,i as n,p as r,r as i,u as a}from"./locale-store-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-aKtaBQYM.js";import{c as t,i as n,p as r,r as i,u as a}from"./locale-store-DodizOrj.js";import{r as o}from"./constants-Co2_smKQ.js";import{_ as s,b as c,g as l,h as u,m as d,s as f,v as ee,y as p}from"./session-api-qy4gMa5t.js";import{a as m,c as h,d as g,f as _,g as te,i as v,l as y,o as ne,r as re,s as ie,t as ae,u as oe}from"./local-session-drafts-jOqfUlwj.js";import{t as b}from"./tool-activity-BtJkgjFf.js";import{a as x}from"./attachment-utils-core-BIOUBrpT.js";import{a as S}from"./gateway-realtime-BDh3i8n7.js";import{t as C}from"./gateway-startup-retry-BEj_bcbm.js";import{n as w}from"./registry-api-D0eYNizR.js";import{a as T}from"./agents-admin-api-CYqmO7gb.js";var E=[0,500,1500],D=1e4;function se(e){let t=[e.content,e.thinking??null,e.attachments??null,e.contextRefs??null,e.browserContexts??null];e.appContext!==void 0&&t.push(e.appContext);let n=JSON.stringify(t),r=2166136261,i=5381;for(let e=0;e<n.length;e++){let t=n.charCodeAt(e);r^=t,r=Math.imul(r,16777619),i=Math.imul(i,33)^t}return`${n.length.toString(36)}:${(r>>>0).toString(36)}:${(i>>>0).toString(36)}`}function O(e){return e===408||e===429||e>=500}var k=/^\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}[^\]]*\]\s*/u,ce=[`user-profile`,`active-focuses`,`collaboration-contract`,`user-context`];function le(e,t){let n=`<${t}>`;if(!e.startsWith(n))return null;let r=`</${t}>`,i=e.indexOf(r,n.length);return i<0?null:e.slice(i+r.length).trimStart()}function ue(e){return k.test(e)||e.startsWith(`<source_contexts>`)||ce.some(t=>e.startsWith(`<${t}>`))}function de(e){if(!e.includes(`<source_contexts>`))return e;let t=e.replace(/^\s*<source_contexts>[\s\S]*?<\/source_contexts>\s*/u,``).trimStart();return t.match(/^<user_message>\r?\n([\s\S]*)\r?\n<\/user_message>\s*$/u)?.[1]??t}function fe(e){let t=e,n=le(t.trimStart(),`xopc_task_execution`);n!==null&&ue(n)&&(t=n),t=de(t);let r=t,i=!1;for(t=t.trimStart();;){let e=ce.find(e=>t.startsWith(`<${e}>`));if(!e)break;let n=le(t,e);if(n===null){t=r,i=!1;break}t=n,i=!0}return i&&!k.test(t)&&(t=r),t.replace(k,``)}function pe(e){return!e.includes(`[media attached:`)&&!e.includes(`xopc-media-uri:`)?e:e.replace(/\s*\[media attached:[^\]]+\]\s*\r?\nxopc-media-uri:[^\r\n]+\r?\n\s*xopc-media-path:[^\r\n]+(?:\r?\n\s*Use the read_media tool[^\r\n]*)?/g,``).replace(/\s*\[media attached:[^\]]+\]\s*/g,` `).replace(/\s*xopc-media-uri:[^\r\n]+/g,``).replace(/\s*xopc-media-path:[^\r\n]+/g,``).replace(/\s*Use the read_media tool[^\r\n]*/g,``).replace(/\n{3,}/g,`
|
|
2
2
|
|
|
3
3
|
`).trim()}var me=`@xopc-ref:`,he=`[A-Za-z0-9_-]{1,64}`,ge=RegExp(`${me}(${he})`,`g`);function _e(e){if(!RegExp(`^${he}$`).test(e))throw Error(`Invalid context reference id`);return`${me}${e}`}function ve(){return new RegExp(ge.source,`g`)}function ye(e){let t=[],n=ve(),r=0,i;for(;(i=n.exec(e))!==null;)i.index>r&&t.push({type:`text`,text:e.slice(r,i.index)}),t.push({type:`context_ref`,refId:i[1]??``}),r=i.index+i[0].length;return t.length===0?null:(r<e.length&&t.push({type:`text`,text:e.slice(r)}),{version:1,parts:t})}function be(e){return e.parts.flatMap(e=>e.type===`context_ref`?[e.refId]:[])}function xe(e,t){return e.parts.map(e=>{if(e.type===`text`)return e.text;let n=t(e.refId)?.trim();return n?`@${n}`:``}).join(``)}function Se(e){return e.parts.map(e=>e.type===`text`?e.text:_e(e.refId)).join(``)}function Ce(e){if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return t.version!==1||!Array.isArray(t.parts)?!1:t.parts.every(e=>{if(!e||typeof e!=`object`||Array.isArray(e))return!1;let t=e;return t.type===`text`?typeof t.text==`string`:t.type===`context_ref`&&typeof t.refId==`string`&&RegExp(`^${he}$`).test(t.refId)})}function we(e){return typeof e==`object`&&!!e&&`role`in e}function Te(e){if(!e||typeof e!=`object`)return!1;let t=e.type;return t===`tool_use`||t===`tool_call`||t===`toolCall`}function Ee(e){return typeof e==`object`&&!!e}function De(e){return typeof e.id==`string`&&e.id.length>0?e.id:crypto.randomUUID()}function Oe(e){if(typeof e!=`string`)return e;try{return JSON.parse(e)}catch{return e}}function ke(e){return Oe(e.args??e.arguments??e.input??e.function?.arguments)??{}}function Ae(e){if(typeof e==`string`){let t=Date.parse(e);return Number.isNaN(t)?Date.now():t}return Date.now()}function je(e){if(typeof e==`number`&&Number.isFinite(e))return e;if(typeof e!=`string`)return;let t=Date.parse(e);return Number.isNaN(t)?void 0:t}function Me(e){if(Array.isArray(e))return e.map(e=>Ne(e))}function Ne(e){if(!e||typeof e!=`object`)return{name:`file`,mimeType:`application/octet-stream`};let t=e,n=Pe(t.uri),r=Fe(t.name),i=Ie(t.mimeType,r),a=typeof t.type==`string`?t.type:void 0,o=a===`photo`||a===`image`||i.startsWith(`image/`)?`image`:a===`voice`||a===`audio`||i.startsWith(`audio/`)?`voice`:a;return{id:typeof t.id==`string`?t.id:void 0,name:r,mimeType:i,type:o,size:typeof t.size==`number`?t.size:void 0,uri:n,bucket:typeof t.bucket==`string`?t.bucket:void 0,path:typeof t.path==`string`?t.path:void 0}}function Pe(e){return typeof e==`string`&&e.trim().startsWith(`media://`)?e.trim():void 0}function Fe(e){return typeof e==`string`&&e.trim().length>0?e.trim():`file`}function Ie(e,t){if(typeof e==`string`&&e.trim().length>0){let t=e.trim();if(t.toLowerCase().split(`;`)[0]?.trim()!==`application/octet-stream`)return t}return x(t)??`application/octet-stream`}function Le(e){let t=e.uri?.trim();return t?`uri:${t}`:e.id?`id:${e.id}`:`name:${e.name??`file`}|${e.mimeType??``}`}function Re(e){if(!e?.length)return;let t=[],n=new Set;for(let r of e){let e=Le(r);n.has(e)||(n.add(e),t.push(r))}return t.length?t:void 0}var ze=`[Startup context loaded by runtime]`,Be=`...[additional startup memory truncated]...`,Ve=`END_QUOTED_NOTES`;function He(...e){return e.filter(e=>e.length>0).join(`
|
|
4
4
|
|