@xopcai/xopc 0.0.389 → 0.0.391
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/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-dvik6t7Z.js → activity-store-DWQCDi8M.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-bWMd5TDC.js → agent-avatar-dicebear-CzS0TUv9.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DE910MyU.js +1 -0
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-UunIxc1q.js → agent-plugin-dialog-0SlvsYl7.js} +1 -1
- package/dist/gateway/static/root/assets/agents-BZh28Qn1.js +77 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-BlNGyXpm.js → agents-admin-api-Bb3Kvz3X.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-9A7JN5V5.js +1 -0
- package/dist/gateway/static/root/assets/{appearance-settings-CUAdx44v.js → appearance-settings-BPdLEo6L.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-D5zDB6gp.js → apps-page-Cz7LypV9.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-Du6dJNcl.js → archive-plugin-DFnHPNie.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BO8Ig5Z4.js → automations-page-CnBLPVNh.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BBjS-sk-.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-D7VJjwnr.js → binary-plugins-BQC0Tzoi.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CaJlWTAn.js → block-editor-DSh5019z.js} +4 -4
- package/dist/gateway/static/root/assets/{browser-automation-inputs-iyMBJmQX.js → browser-automation-inputs-C5tIrIRL.js} +1 -1
- package/dist/gateway/static/root/assets/browser-automations-page-CFCMNfJN.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-C__tyPwu.js +3 -0
- package/dist/gateway/static/root/assets/{capabilities-CEH1AnXc.js → capabilities-D6RJG4QY.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-MCKRMZDK.js → capabilities-DGEmBQnF.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-B5AZa7ir.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Dskz2_bh.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-BIA0Lwt5.js → capability-header-actions-xzjWZVbg.js} +1 -1
- package/dist/gateway/static/root/assets/channels-DRse_dD3.js +1 -0
- package/dist/gateway/static/root/assets/chat-terminal-dock-CQF0M4kE.js +36 -0
- package/dist/gateway/static/root/assets/{computer-settings-page-DvY3zgyY.js → computer-settings-page-ZfzCTS0N.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-St2-Fj3y.js → connector-service-page-CwAeWVLK.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-CanakKaj.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-C0-D80ny.js → date-picker-hmJlEAQZ.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-CNd7mwMU.js → dependency-picker-Us_Juz6I.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-C-2wDANn.js → desktop-pet-CvOTI4uw.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DyhxLrdJ.js → desktop-pet-settings-DYg-Gb8t.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-B1FbZ8C1.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CNivVIPT.js → directory-picker-path-field-DZN9EDvM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CGYO3JPw.js → extension-debug-page-YIibp6Kk.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Dc51ALAg.js → extension-page-DkcGyb28.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-BXPILdlw.js → extension-provider-B1PQGTtY.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-C_rJiSKo.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-Bc2MytsF.js → gateway-config-swr-Dv_A5FMu.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-BFK-vlME.js → gateway-realtime-DghCGfY_.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-CMJVSnvi.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-CjCWPHNJ.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BDPMttPx.js → gateway-startup-retry-CkTVSESs.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-DAlRGMge.js → highlighted-body-KQOG7T2V-DV2wNqBn.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-fAYsd7kG.js +2 -0
- package/dist/gateway/static/root/assets/image-generation-api-B98iXt6A.js +1 -0
- package/dist/gateway/static/root/assets/imports-page-DoBCBN8G.js +1 -0
- package/dist/gateway/static/root/assets/index-DFgXwLsv.js +260 -0
- package/dist/gateway/static/root/assets/index-a6ZvhclR.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BYYC9Qmw.js → keyboard-shortcuts-settings-DXVu4lqV.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-B3fz6uRi.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BU8pUsVM.js → local-apps-page-BC6xhmUh.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-kFc_MAA9.js → local-session-drafts-DFnZQu9A.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Dr43FCty.js → locale-store-BpK9AiDq.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CSqSFDRU.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-gq5L0THs.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-CdKlPjJM.js → markdown-view-IsYTotu6.js} +18 -18
- package/dist/gateway/static/root/assets/{media-plugins-DE9zt88i.js → media-plugins-oSChWbcP.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-C_QKwqDN.js +1 -0
- package/dist/gateway/static/root/assets/messages-CKTo_sIF.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-cache-TjpL7hZ5.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-CdpNXre-.js +5 -0
- package/dist/gateway/static/root/assets/{notes-api-BHouNL6-.js → notes-api-CBb944yw.js} +1 -1
- package/dist/gateway/static/root/assets/notes-page-EGvGw8MN.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-TQr8NnSc.js → page-context-capture-button-CoWb7BYP.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-DYzbNTyN.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-BEl6syFp.js → product-open-page-CTyy7H7-.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-BxSHnbqz.js → product-preview-content-D4xqTaEy.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DIVCw0QQ.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-B4L9VnBN.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BD5IgDOA.js → registry-api-Dsa2LvRt.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-B8PvgLVz.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-CjTRoQWT.js → runtime-tools-api-C2Uw89eY.js} +1 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-Bqnp3tyt.js +1 -0
- package/dist/gateway/static/root/assets/scenes-page-D50g4GM2.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-ByG-R6N2.js → schema-form-h_RCNfiO.js} +1 -1
- package/dist/gateway/static/root/assets/{send-session-input-UAVStisp.js → send-session-input-DypbVTT7.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-DvgEiNRS.js → session-api-ga-SUOq_.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-BOb1tC_Z.js → session-manager-C_OiKblh.js} +8 -8
- package/dist/gateway/static/root/assets/sessions-page-BsqDIbIr.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-D3zJAW4p.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-C1e9m23j.js → settings-page-DPCgrICd.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-jjSYJpDd.js +1 -0
- package/dist/gateway/static/root/assets/{share-link-dialog-kE_6v5Dp.js → share-link-dialog-BGicglAS.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BT-_yR1h.js → share-preview-page-BORe9rLB.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-Dg_SqHQE.js → shares-api-Dbx3z6-1.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-C13FgfWk.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-BslUYMnX.js → skill-api-Cq6O1DZK.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-BQ2rTOP1.js → skill-reload-api-Cq7QDjMA.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-BM1ShEjx.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-GpbPfWwo.js → system-settings-panel-BNCGFO1e.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-4VG82wcF.js +2 -0
- package/dist/gateway/static/root/assets/{task-expandable-content-DJrrEBB4.js → task-expandable-content-DAZGz5YC.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BKpYnggg.js → theme-store-Db7hDESt.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-D71w7dwV.js → tracing-settings-page-C6p2Mu92.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-BV46CvS8.js → tunnel-api-Dw15EJp0.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-DDrIqgGe.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-CzyqRffr.js → use-autosave-DDjIdW4U.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-Dviq-1f6.js → use-composer-attachments-DNl7O3Vb.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-D5Kk7Hon.js → use-file-preview-expanded-DMHehhwG.js} +2 -2
- package/dist/gateway/static/root/assets/user-model-page-CaS9dOIr.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-DWtbmacd.js → voice-api-key-field-ByAxHE4P.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DnIjZm_9.js → voice-config-api-Dl39b27p.js} +1 -1
- package/dist/gateway/static/root/assets/voice-transcribe-api-CVaU83Jc.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-ChEG71hz.js → work-discovery-overlay-BvVvPA1T.js} +1 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-BcFm9QcC.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-DMec_XZB.js +6 -0
- package/dist/gateway/static/root/assets/{workspace-api-CZDvu7uA.js → workspace-api-BpfKsrtP.js} +2 -2
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-CbUgg1SK.js → xopc-cloud-account-card-CU5lzzE9.js} +1 -1
- package/dist/gateway/static/root/index.html +28 -35
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/discussions.js +3 -2
- package/dist/packages/gateway-contract/src/index.js +4 -0
- package/dist/packages/gateway-contract/src/provider-setup.js +6 -0
- package/dist/packages/gateway-contract/src/recording-outcome.js +6 -0
- package/dist/packages/image-providers/src/catalog.js +10 -0
- package/dist/packages/image-providers/src/execute.js +5 -1
- package/dist/packages/image-providers/src/validation.js +19 -1
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +4 -1
- package/dist/src/agent/background-review/run-background-review.d.ts +0 -1
- package/dist/src/agent/background-review/run-background-review.js +10 -2
- package/dist/src/agent/context/execution-scope.js +1 -1
- package/dist/src/agent/embedded/execution-tool-policy.d.ts +2 -0
- package/dist/src/agent/embedded/execution-tool-policy.js +8 -3
- package/dist/src/agent/embedded/run-for-session.js +26 -3
- package/dist/src/agent/embedded/run-turn.js +14 -1
- package/dist/src/agent/embedded/session-runner.js +1 -1
- package/dist/src/agent/embedded/xopc-stream-bridge.js +3 -0
- package/dist/src/agent/image/generation/runtime.js +12 -14
- package/dist/src/agent/image/understanding/runtime.js +5 -0
- package/dist/src/agent/inbound/inbound-loop.d.ts +1 -15
- package/dist/src/agent/inbound/inbound-loop.js +5 -0
- package/dist/src/agent/mcp/connection-errors.d.ts +3 -0
- package/dist/src/agent/mcp/connection-errors.js +32 -0
- package/dist/src/agent/mcp/connection-setup.d.ts +2 -0
- package/dist/src/agent/mcp/connection-setup.js +38 -18
- package/dist/src/agent/memory/compaction.js +5 -1
- package/dist/src/agent/memory/idle-compaction-scheduler.js +3 -1
- package/dist/src/agent/models/manager.d.ts +1 -0
- package/dist/src/agent/models/manager.js +4 -2
- package/dist/src/agent/orchestration/agent-orchestrator.d.ts +1 -6
- package/dist/src/agent/orchestration/agent-orchestrator.js +5 -0
- package/dist/src/agent/service/process-direct-one-shot.js +5 -0
- package/dist/src/agent/service/process-direct-streaming.d.ts +1 -0
- package/dist/src/agent/service/process-direct-streaming.js +17 -1
- package/dist/src/agent/tools/factory.js +14 -12
- package/dist/src/agent/tools/image-generate-tool.js +5 -1
- package/dist/src/agent/tools/personal-read-tool.js +4 -0
- package/dist/src/agent/tools/task-collaboration-tool.js +1 -1
- package/dist/src/agent-config/resolver.js +5 -0
- package/dist/src/agent-config/schema.d.ts +26 -6
- package/dist/src/agent-config/schema.js +2 -0
- package/dist/src/ai-assist/text-assist.js +5 -16
- package/dist/src/automations/service/action-executor.js +3 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/agent-model-intents.js +4 -1
- package/dist/src/config/schema.d.ts +11 -5
- package/dist/src/config/schema.js +11 -3
- package/dist/src/discussions/analyzer.d.ts +2 -0
- package/dist/src/discussions/analyzer.js +38 -9
- package/dist/src/discussions/audio-clip.d.ts +3 -0
- package/dist/src/discussions/audio-clip.js +72 -0
- package/dist/src/discussions/live-worker.js +3 -1
- package/dist/src/discussions/long-review.d.ts +17 -0
- package/dist/src/discussions/long-review.js +278 -0
- package/dist/src/discussions/media-timeline.d.ts +21 -0
- package/dist/src/discussions/media-timeline.js +134 -0
- package/dist/src/discussions/organizer-worker.d.ts +4 -1
- package/dist/src/discussions/organizer-worker.js +17 -12
- package/dist/src/discussions/organizer.js +2 -0
- package/dist/src/discussions/processing.d.ts +43 -0
- package/dist/src/discussions/processing.js +125 -0
- package/dist/src/discussions/recording.js +202 -42
- package/dist/src/discussions/recordingJobs.js +2 -0
- package/dist/src/discussions/repository.js +4 -2
- package/dist/src/discussions/review.d.ts +8 -0
- package/dist/src/discussions/review.js +183 -0
- package/dist/src/discussions/sealer.d.ts +7 -1
- package/dist/src/discussions/sealer.js +163 -87
- package/dist/src/discussions/service.d.ts +7 -1
- package/dist/src/discussions/service.js +51 -15
- package/dist/src/discussions/types.d.ts +2 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/global-defaults-admin.d.ts +3 -1
- package/dist/src/gateway/global-defaults-admin.js +14 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +11 -2
- package/dist/src/gateway/hono/lib/config-payload.js +2 -0
- package/dist/src/gateway/hono/lib/voice-settings-revisions.d.ts +5 -0
- package/dist/src/gateway/hono/lib/voice-settings-revisions.js +24 -0
- package/dist/src/gateway/hono/routes/commands-skills.js +15 -0
- package/dist/src/gateway/hono/routes/config-patch/misc.js +8 -1
- package/dist/src/gateway/hono/routes/config.js +12 -0
- package/dist/src/gateway/hono/routes/discussions.js +63 -1
- package/dist/src/gateway/hono/routes/global-defaults.js +8 -1
- package/dist/src/gateway/hono/routes/models.js +12 -4
- package/dist/src/gateway/hono/routes/provider-setup.d.ts +3 -0
- package/dist/src/gateway/hono/routes/provider-setup.js +106 -0
- package/dist/src/gateway/hono/routes/status.js +2 -0
- package/dist/src/gateway/hono/routes/voice.js +23 -10
- package/dist/src/gateway/provider-model-setup.d.ts +4 -0
- package/dist/src/gateway/provider-model-setup.js +56 -0
- package/dist/src/gateway/service/config-coordinator.d.ts +2 -2
- package/dist/src/gateway/service.js +2 -0
- package/dist/src/media-shared/http/provider-http.d.ts +0 -6
- package/dist/src/media-shared/http/provider-http.js +5 -4
- package/dist/src/media-understanding/runner.d.ts +0 -28
- package/dist/src/media-understanding/runner.js +4 -0
- package/dist/src/platform/client.d.ts +1 -1
- package/dist/src/platform/contracts.d.ts +1 -1
- package/dist/src/providers/env-keys.js +3 -0
- package/dist/src/providers/extension-stream-bridge.js +3 -0
- package/dist/src/providers/index.js +15 -0
- package/dist/src/providers/model-call.d.ts +5 -2
- package/dist/src/providers/model-call.js +13 -2
- package/dist/src/providers/model-reference-auditor.js +1 -0
- package/dist/src/providers/model-response.js +1 -1
- package/dist/src/providers/model-usage.d.ts +15 -0
- package/dist/src/providers/model-usage.js +50 -0
- package/dist/src/providers/presentation.js +8 -0
- package/dist/src/providers/setup/engine.d.ts +37 -0
- package/dist/src/providers/setup/engine.js +177 -0
- package/dist/src/providers/setup/profiles.d.ts +4 -0
- package/dist/src/providers/setup/profiles.js +78 -0
- package/dist/src/providers/setup/voice.d.ts +23 -0
- package/dist/src/providers/setup/voice.js +234 -0
- package/dist/src/scenes/agentExecutor.d.ts +1 -0
- package/dist/src/scenes/agentExecutor.js +5 -0
- package/dist/src/storage/sqlite/migrations/253_discussion_processing_recovery.sql +20 -0
- package/dist/src/storage/sqlite/migrations/254_discussion_annotations.sql +17 -0
- package/dist/src/storage/sqlite/migrations/255_discussion_chapter_progress.sql +10 -0
- package/dist/src/storage/sqlite/migrations/256_task_main_update_retries.sql +21 -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/task-collaboration-repository.d.ts +2 -0
- package/dist/src/tasks/task-collaboration-repository.js +7 -1
- package/dist/src/tasks/task-main-update-delivery.js +11 -4
- package/dist/src/tasks/task-main-update-input.js +2 -1
- package/dist/src/tasks/task-main-update-retry.d.ts +5 -0
- package/dist/src/tasks/task-main-update-retry.js +15 -0
- package/dist/src/usage/recorder.js +2 -1
- package/dist/src/usage/scenario-registry.js +128 -123
- package/dist/src/voice/dashscope/streaming-stt-session.js +3 -0
- package/dist/src/voice/dashscope/streaming-tts-stream.js +3 -0
- package/dist/src/voice/dictation.d.ts +12 -0
- package/dist/src/voice/dictation.js +22 -0
- package/dist/src/voice/metadata/builtin.js +54 -0
- package/dist/src/voice/platform-streams.js +3 -0
- package/dist/src/voice/realtime/omniEngine.js +3 -0
- package/dist/src/voice/realtime/omniRoute.js +3 -2
- package/dist/src/voice/realtime/runtime.js +4 -2
- package/dist/src/voice/stt/factory.js +9 -3
- package/dist/src/voice/stt/providers/bailian-plan-transcription.d.ts +2 -0
- package/dist/src/voice/stt/providers/bailian-plan-transcription.js +32 -0
- package/dist/src/voice/stt/providers/index.d.ts +1 -0
- package/dist/src/voice/stt/providers/index.js +2 -1
- package/dist/src/voice/token-plan.d.ts +8 -0
- package/dist/src/voice/token-plan.js +11 -0
- package/dist/src/voice/tts/factory.js +4 -1
- package/dist/src/voice/tts/providers/bailian-plan-speech.d.ts +2 -0
- package/dist/src/voice/tts/providers/bailian-plan-speech.js +84 -0
- package/dist/src/voice/tts/providers/index.d.ts +1 -0
- package/dist/src/voice/tts/providers/index.js +2 -1
- package/dist/src/voice/tts/speak-core.js +10 -1
- package/package.json +2 -2
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-Ds0Ue2FB.js +0 -1
- package/dist/gateway/static/root/assets/agents-BLRM4o-U.js +0 -77
- package/dist/gateway/static/root/assets/app-management-settings-panel-Dmy828Pe.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-UcCneEs3.js +0 -6
- package/dist/gateway/static/root/assets/bot-DjLkhyZL.js +0 -1
- package/dist/gateway/static/root/assets/browser-automations-page-BjvQnYfO.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-D5ZghI28.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-MC8qIrXo.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Blz3hEzp.js +0 -8
- package/dist/gateway/static/root/assets/channels-DSg_iCVC.js +0 -1
- package/dist/gateway/static/root/assets/chat-terminal-dock-C97SJEwd.js +0 -36
- package/dist/gateway/static/root/assets/circle-pause-CN9jYH2s.js +0 -1
- package/dist/gateway/static/root/assets/clock-3-DnrAnuyZ.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DXk-GAsd.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-BeSuq__I.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-jYu6qpY2.js +0 -1
- package/dist/gateway/static/root/assets/fallback-models-CoyzvDo7.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-C3vH-Iup.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-JlT1dlSj.js +0 -1
- package/dist/gateway/static/root/assets/git-branch-Dh9uxTot.js +0 -1
- package/dist/gateway/static/root/assets/home-page-DOVl8s-1.js +0 -2
- package/dist/gateway/static/root/assets/image-generation-api-BZBiYDmV.js +0 -1
- package/dist/gateway/static/root/assets/imports-page-DgdBTp_0.js +0 -1
- package/dist/gateway/static/root/assets/index-CmC8JkSM.js +0 -260
- package/dist/gateway/static/root/assets/index-Dgzc0oBu.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BKZfn-MS.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-BSepiACn.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-dE_ykPNY.js +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-65SE6j-_.js +0 -1
- package/dist/gateway/static/root/assets/message-square-fVE7Ghj1.js +0 -1
- package/dist/gateway/static/root/assets/messages-DlTNQI92.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-cache-C7FAsEe_.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-D9oqhdyk.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-Bd4_7ph8.js +0 -8
- package/dist/gateway/static/root/assets/pause-DuPxgSxk.js +0 -1
- package/dist/gateway/static/root/assets/personal-page-BvWzq4Wp.js +0 -1
- package/dist/gateway/static/root/assets/play-kxZvpBg8.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-D-qkIXVT.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BQtw1Dfn.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CYFNz0Jc.js +0 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-Qq_NyYx_.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-hGr-ppYk.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-CpX1Rluw.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-D2s_MlxR.js +0 -1
- package/dist/gateway/static/root/assets/settings-loading-skeleton-BTqvr_Fw.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BiHRYDHq.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DfcAu08T.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-CvKc5nBN.js +0 -2
- package/dist/gateway/static/root/assets/sparkles-DHlfQFAF.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-5B5ZVAu0.js +0 -2
- package/dist/gateway/static/root/assets/usage-page-rMuwNpJi.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-Dhqw3v_u.js +0 -2
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-pdiRKLxP.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-D9LMxINt.js +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./external-link-DjqjBmc3.js";import{t as i}from"./messages-DlTNQI92.js";import{t as a}from"./cn-0WouolD0.js";import{n as o}from"./locale-store-Dr43FCty.js";import{n as s}from"./interaction-BdhHBbYa.js";import{n as c}from"./electron-env-Dit0bHgy.js";import{r as l}from"./settings-form-draft-Dy10ldo8.js";import{$t as u,Bo as d,Qt as f,Vc as p,Xo as m,Zt as h,en as g}from"./index-CmC8JkSM.js";import{n as _,r as v}from"./settings-page-layout-Dx5S-Msc.js";import{r as y,t as b}from"./settings-form-section-num14vSv.js";var x=e(t(),1);async function S(e,t){let n=window.electronAPI?.system;if(!c()||!n?.requestNotifications)return`unsupported`;let r=await n.requestNotifications();if(r.status!==`granted`)return r.outcome===`opened-settings`||r.status===`denied`?`denied`:`default`;await n.setBehavior({notifyEnabled:!0});let i=await n.showEndpointNotification({title:e,body:t});return i.ok||await n.setBehavior({notifyEnabled:!1}),i.ok?`enabled`:`default`}var C=n();function w(){let e=i(o(e=>e.language)).systemSettings.browserNotify,[t,n]=(0,x.useState)(u),[r,a]=(0,x.useState)(null),[s,c]=(0,x.useState)(!1),l=async t=>{if(!t){n(g({enabled:!1})),a(null);return}c(!0);try{let t=await h();if(t!==`granted`){a(t===`unsupported`?e.unsupported:e.denied);return}n(g({enabled:!0})),a(await f(e.testTitle,e.testBody)?e.testShown:e.failed)}finally{c(!1)}},d=e=>{n(g(e))};return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:e.pageTitle}),(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(p,{className:`size-4 text-accent`,strokeWidth:1.75}),e.title]}),(0,C.jsx)(`p`,{className:`mb-4 text-sm text-fg-muted`,children:e.description}),(0,C.jsx)(`div`,{className:`space-y-2`,children:[[`enabled`,e.enabled,e.enabledDesc],[`completed`,e.completed,e.completedDesc],[`failed`,e.failedRuns,e.failedRunsDesc],[`needsInput`,e.needsInput,e.needsInputDesc]].map(([e,n,r])=>(0,C.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),(0,C.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:r})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:s||e!==`enabled`&&!t.enabled,checked:t[e],onChange:t=>{e===`enabled`?l(t.target.checked):d({[e]:t.target.checked})}})]},e))}),r?(0,C.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,role:`status`,children:r}):null,(0,C.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:e.limitation})]})]})}async function T(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function E(e,t,n){return e.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function D(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function O(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function k(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var A=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function j(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||A.has(e)?t===`unknown`:!1}function M(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:A.has(e)?t===`denied`:!0}var N=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function P(e){return e===`linux`?N:N.filter(t=>!t.platforms||t.platforms.includes(e))}function F(e,t){let n=i(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function I(e,t,n){let r=i(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var L={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function R(){let e=o(e=>e.language),t=i(e),n=t.systemSettings,[u,f]=(0,x.useReducer)(l,L),{behavior:p,perms:h,loadError:g,permFeedback:A,permBusy:N,refreshing:R}=u,z=typeof window<`u`?window.electronAPI?.system:void 0,B=(0,x.useCallback)(async e=>{if(z){f({type:`patch`,patch:{loadError:null}});try{f({type:`patch`,patch:{behavior:await z.getBehavior(),perms:await z.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:n.refreshDone}:{}}})}catch(t){f({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[z,n.refreshDone]),V=(0,x.useCallback)(async()=>{if(!(R||N)){f({type:`patch`,patch:{refreshing:!0}});try{await B({showRefreshFeedback:!0})}finally{f({type:`patch`,patch:{refreshing:!1}})}}},[B,N,R]);if((0,x.useEffect)(()=>{let e=new Set([n.refreshDone,n.openSettingsDone,n.openSettingsFailed,n.desktopNotify.testShown]);if(!A||!e.has(A))return;let t=window.setTimeout(()=>{f({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(t)},[A,n.openSettingsDone,n.openSettingsFailed,n.refreshDone,n.desktopNotify.testShown]),(0,x.useEffect)(()=>{c()&&z&&B()},[z,B]),!c()||!z)return(0,C.jsx)(w,{});let H=async e=>{try{let{behavior:t}=await z.setBehavior(e);f({type:`patch`,patch:{behavior:t}})}catch(e){f({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},U=async e=>{if(!e){await H({notifyEnabled:!1});return}f({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await S(n.desktopNotify.testTitle,n.desktopNotify.testBody);if(e===`unsupported`){f({type:`patch`,patch:{permFeedback:n.notificationsFeedback.unsupported}});return}if(e===`denied`){f({type:`patch`,patch:{permFeedback:n.desktopNotify.denied}});return}if(e==="default"){f({type:`patch`,patch:{permFeedback:n.notificationsFeedback.default}});return}await H({notifyEnabled:!0}),f({type:`patch`,patch:{perms:await z.getPermissions()}}),f({type:`patch`,patch:{permFeedback:n.desktopNotify.testShown}})}catch(e){f({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{f({type:`patch`,patch:{permBusy:!1}})}},W=async e=>{f({type:`patch`,patch:{permFeedback:null}}),f({type:`patch`,patch:{loadError:null}});try{(await z.openPrivacy(e)).ok?f({type:`patch`,patch:{permFeedback:n.openSettingsDone}}):f({type:`patch`,patch:{permFeedback:n.openSettingsFailed}})}catch(e){f({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},G=async()=>{f({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),f({type:`patch`,patch:{loadError:null}});try{let e=await z.requestMicrophone(),t=e.outcome===`opened-settings`||e.status===`denied`?!1:await T();f({type:`patch`,patch:{perms:await z.getPermissions()}}),f({type:`patch`,patch:{permFeedback:E(e,t,n.permFeedback)}})}catch(e){f({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{f({type:`patch`,patch:{permBusy:!1}})}},K=async()=>{if(z.requestAccessibility){f({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),f({type:`patch`,patch:{loadError:null}});try{let e=await z.requestAccessibility();f({type:`patch`,patch:{perms:await z.getPermissions()}}),f({type:`patch`,patch:{permFeedback:D(e,n.accessibilityFeedback)}})}catch(e){f({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{f({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(z.requestNotifications){f({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),f({type:`patch`,patch:{loadError:null}});try{let e=await z.requestNotifications();f({type:`patch`,patch:{perms:await z.getPermissions()}}),f({type:`patch`,patch:{permFeedback:O(e,n.notificationsFeedback)}})}catch(e){f({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{f({type:`patch`,patch:{permBusy:!1}})}}},J=async()=>{if(z.requestScreen){f({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),f({type:`patch`,patch:{loadError:null}});try{let e=await z.requestScreen();f({type:`patch`,patch:{perms:await z.getPermissions()}}),f({type:`patch`,patch:{permFeedback:k(e,n.screenFeedback)}})}catch(e){f({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{f({type:`patch`,patch:{permBusy:!1}})}}},Y=p?p.platform===`win32`?n.permissionsHintWin:p.platform===`linux`?n.permissionsHintLinux:p.platform===`darwin`?n.permissionsHintDarwin:n.permissionsHint:n.permissionsHint;return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:n.title}),g?(0,C.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:g}):null,A?(0,C.jsx)(`p`,{className:a(`text-sm`,A===n.refreshDone||A===n.openSettingsDone||A===n.permFeedback.granted||A===n.permFeedback.alreadyGranted||A===n.accessibilityFeedback.granted||A===n.accessibilityFeedback.alreadyGranted||A===n.notificationsFeedback.granted||A===n.notificationsFeedback.alreadyGranted||A===n.screenFeedback.granted||A===n.screenFeedback.alreadyGranted||A===n.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:A}):null,(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(d,{className:`size-4 text-accent`,strokeWidth:1.75}),n.behaviorGroup]}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.endpointToolsSettings.deviceAccess.background}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.endpointToolsSettings.deviceAccess.sleep})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!p?.backgroundSupported,checked:!!p?.runInBackground,onChange:e=>void H({runInBackground:e.target.checked})})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.openAtLogin}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.openAtLoginDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!p,checked:!!p?.openAtLogin,onChange:e=>{H({openAtLogin:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.keepAwake}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.keepAwakeDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!p,checked:!!p?.keepAwakePreferred,onChange:e=>{H({keepAwakePreferred:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.notifyDesktop}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.notifyDesktopDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!p||N,checked:!!p?.notifyEnabled,onChange:e=>{U(e.target.checked)}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.notifySound}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.notifySoundDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!p,checked:!!p?.notifySoundEnabled,onChange:e=>{H({notifySoundEnabled:e.target.checked})}})]})]})]}),p&&h?(0,C.jsxs)(`section`,{className:y(),children:[(0,C.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.permissionsTitle}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:Y}),p.platform===`darwin`&&!p.packaged?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:n.permissionsHintDevDarwin}):null]}),(0,C.jsxs)(`button`,{type:`button`,disabled:R||N,"aria-busy":R,className:a(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,s.press),onClick:()=>void V(),children:[(0,C.jsx)(m,{className:a(`size-3.5`,R&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),R?n.refreshing:n.refresh]})]}),(0,C.jsx)(`ul`,{className:`space-y-3`,children:P(p.platform).map(({key:t,pane:i})=>{let o=F(e,h[t]),c=n.perm[t],l=h[t]===`unknown`?I(e,t,p.platform):null;return c?(0,C.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:c.title}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:c.desc}),(0,C.jsx)(`p`,{className:`mt-1 text-xs font-medium ${o.className}`,children:o.label}),l?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:l}):null]}),(0,C.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[t===`notifications`&&j(t,h[t],p.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:a(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,s.press),onClick:()=>void q(),children:n.requestAccess}):null,t===`microphone`&&j(t,h[t],p.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:a(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,s.press),onClick:()=>void G(),children:n.requestAccess}):null,t===`accessibility`&&j(t,h[t],p.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:a(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,s.press),onClick:()=>void K(),children:n.requestAccess}):null,t===`screen`&&j(t,h[t],p.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:a(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,s.press),onClick:()=>void J(),children:n.requestAccess}):null,M(t,h[t],p.platform)?(0,C.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,s.press),onClick:()=>void W(i),children:[n.openSettings,(0,C.jsx)(r,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},t):null})})]}):null]})}export{R as SystemSettingsPanel};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./external-link-DjqjBmc3.js";import{t as i}from"./messages-CKTo_sIF.js";import{t as a}from"./cn-0WouolD0.js";import{n as o}from"./locale-store-BpK9AiDq.js";import{n as s}from"./interaction-BdhHBbYa.js";import{n as c}from"./electron-env-Dit0bHgy.js";import{r as l}from"./settings-form-draft-Dy10ldo8.js";import{Qo as u,an as d,cs as f,in as p,nn as m,ol as h,rn as g}from"./index-DFgXwLsv.js";import{n as _,r as v}from"./settings-page-layout-Dx5S-Msc.js";import{r as y,t as b}from"./settings-form-section-num14vSv.js";var x=e(t(),1);async function S(e,t){let n=window.electronAPI?.system;if(!c()||!n?.requestNotifications)return`unsupported`;let r=await n.requestNotifications();if(r.status!==`granted`)return r.outcome===`opened-settings`||r.status===`denied`?`denied`:`default`;await n.setBehavior({notifyEnabled:!0});let i=await n.showEndpointNotification({title:e,body:t});return i.ok||await n.setBehavior({notifyEnabled:!1}),i.ok?`enabled`:`default`}var C=n();function w(){let e=i(o(e=>e.language)).systemSettings.browserNotify,[t,n]=(0,x.useState)(p),[r,a]=(0,x.useState)(null),[s,c]=(0,x.useState)(!1),l=async t=>{if(!t){n(d({enabled:!1})),a(null);return}c(!0);try{let t=await m();if(t!==`granted`){a(t===`unsupported`?e.unsupported:e.denied);return}n(d({enabled:!0})),a(await g(e.testTitle,e.testBody)?e.testShown:e.failed)}finally{c(!1)}},u=e=>{n(d(e))};return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:e.pageTitle}),(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(h,{className:`size-4 text-accent`,strokeWidth:1.75}),e.title]}),(0,C.jsx)(`p`,{className:`mb-4 text-sm text-fg-muted`,children:e.description}),(0,C.jsx)(`div`,{className:`space-y-2`,children:[[`enabled`,e.enabled,e.enabledDesc],[`completed`,e.completed,e.completedDesc],[`failed`,e.failedRuns,e.failedRunsDesc],[`needsInput`,e.needsInput,e.needsInputDesc]].map(([e,n,r])=>(0,C.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),(0,C.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:r})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:s||e!==`enabled`&&!t.enabled,checked:t[e],onChange:t=>{e===`enabled`?l(t.target.checked):u({[e]:t.target.checked})}})]},e))}),r?(0,C.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,role:`status`,children:r}):null,(0,C.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:e.limitation})]})]})}async function T(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function E(e,t,n){return e.outcome===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.outcome===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function D(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:t.denied}function O(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function k(e,t){return e.outcome===`opened-settings`?t.openedSettings:e.status===`granted`?e.outcome===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var A=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function j(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||A.has(e)?t===`unknown`:!1}function M(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:A.has(e)?t===`denied`:!0}var N=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function P(e){return e===`linux`?N:N.filter(t=>!t.platforms||t.platforms.includes(e))}function F(e,t){let n=i(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function I(e,t,n){let r=i(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var L={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function R(){let e=o(e=>e.language),t=i(e),n=t.systemSettings,[d,p]=(0,x.useReducer)(l,L),{behavior:m,perms:h,loadError:g,permFeedback:A,permBusy:N,refreshing:R}=d,z=typeof window<`u`?window.electronAPI?.system:void 0,B=(0,x.useCallback)(async e=>{if(z){p({type:`patch`,patch:{loadError:null}});try{p({type:`patch`,patch:{behavior:await z.getBehavior(),perms:await z.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:n.refreshDone}:{}}})}catch(t){p({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[z,n.refreshDone]),V=(0,x.useCallback)(async()=>{if(!(R||N)){p({type:`patch`,patch:{refreshing:!0}});try{await B({showRefreshFeedback:!0})}finally{p({type:`patch`,patch:{refreshing:!1}})}}},[B,N,R]);if((0,x.useEffect)(()=>{let e=new Set([n.refreshDone,n.openSettingsDone,n.openSettingsFailed,n.desktopNotify.testShown]);if(!A||!e.has(A))return;let t=window.setTimeout(()=>{p({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(t)},[A,n.openSettingsDone,n.openSettingsFailed,n.refreshDone,n.desktopNotify.testShown]),(0,x.useEffect)(()=>{c()&&z&&B()},[z,B]),!c()||!z)return(0,C.jsx)(w,{});let H=async e=>{try{let{behavior:t}=await z.setBehavior(e);p({type:`patch`,patch:{behavior:t}})}catch(e){p({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},U=async e=>{if(!e){await H({notifyEnabled:!1});return}p({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await S(n.desktopNotify.testTitle,n.desktopNotify.testBody);if(e===`unsupported`){p({type:`patch`,patch:{permFeedback:n.notificationsFeedback.unsupported}});return}if(e===`denied`){p({type:`patch`,patch:{permFeedback:n.desktopNotify.denied}});return}if(e==="default"){p({type:`patch`,patch:{permFeedback:n.notificationsFeedback.default}});return}await H({notifyEnabled:!0}),p({type:`patch`,patch:{perms:await z.getPermissions()}}),p({type:`patch`,patch:{permFeedback:n.desktopNotify.testShown}})}catch(e){p({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{p({type:`patch`,patch:{permBusy:!1}})}},W=async e=>{p({type:`patch`,patch:{permFeedback:null}}),p({type:`patch`,patch:{loadError:null}});try{(await z.openPrivacy(e)).ok?p({type:`patch`,patch:{permFeedback:n.openSettingsDone}}):p({type:`patch`,patch:{permFeedback:n.openSettingsFailed}})}catch(e){p({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},G=async()=>{p({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),p({type:`patch`,patch:{loadError:null}});try{let e=await z.requestMicrophone(),t=e.outcome===`opened-settings`||e.status===`denied`?!1:await T();p({type:`patch`,patch:{perms:await z.getPermissions()}}),p({type:`patch`,patch:{permFeedback:E(e,t,n.permFeedback)}})}catch(e){p({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{p({type:`patch`,patch:{permBusy:!1}})}},K=async()=>{if(z.requestAccessibility){p({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),p({type:`patch`,patch:{loadError:null}});try{let e=await z.requestAccessibility();p({type:`patch`,patch:{perms:await z.getPermissions()}}),p({type:`patch`,patch:{permFeedback:D(e,n.accessibilityFeedback)}})}catch(e){p({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{p({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(z.requestNotifications){p({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),p({type:`patch`,patch:{loadError:null}});try{let e=await z.requestNotifications();p({type:`patch`,patch:{perms:await z.getPermissions()}}),p({type:`patch`,patch:{permFeedback:O(e,n.notificationsFeedback)}})}catch(e){p({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{p({type:`patch`,patch:{permBusy:!1}})}}},J=async()=>{if(z.requestScreen){p({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),p({type:`patch`,patch:{loadError:null}});try{let e=await z.requestScreen();p({type:`patch`,patch:{perms:await z.getPermissions()}}),p({type:`patch`,patch:{permFeedback:k(e,n.screenFeedback)}})}catch(e){p({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{p({type:`patch`,patch:{permBusy:!1}})}}},Y=m?m.platform===`win32`?n.permissionsHintWin:m.platform===`linux`?n.permissionsHintLinux:m.platform===`darwin`?n.permissionsHintDarwin:n.permissionsHint:n.permissionsHint;return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:n.title}),g?(0,C.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:g}):null,A?(0,C.jsx)(`p`,{className:a(`text-sm`,A===n.refreshDone||A===n.openSettingsDone||A===n.permFeedback.granted||A===n.permFeedback.alreadyGranted||A===n.accessibilityFeedback.granted||A===n.accessibilityFeedback.alreadyGranted||A===n.notificationsFeedback.granted||A===n.notificationsFeedback.alreadyGranted||A===n.screenFeedback.granted||A===n.screenFeedback.alreadyGranted||A===n.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:A}):null,(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(u,{className:`size-4 text-accent`,strokeWidth:1.75}),n.behaviorGroup]}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.endpointToolsSettings.deviceAccess.background}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.endpointToolsSettings.deviceAccess.sleep})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!m?.backgroundSupported,checked:!!m?.runInBackground,onChange:e=>void H({runInBackground:e.target.checked})})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.openAtLogin}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.openAtLoginDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!m,checked:!!m?.openAtLogin,onChange:e=>{H({openAtLogin:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.keepAwake}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.keepAwakeDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!m,checked:!!m?.keepAwakePreferred,onChange:e=>{H({keepAwakePreferred:e.target.checked})}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.notifyDesktop}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.notifyDesktopDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!m||N,checked:!!m?.notifyEnabled,onChange:e=>{U(e.target.checked)}})]}),(0,C.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.toggles.notifySound}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.toggles.notifySoundDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!m,checked:!!m?.notifySoundEnabled,onChange:e=>{H({notifySoundEnabled:e.target.checked})}})]})]})]}),m&&h?(0,C.jsxs)(`section`,{className:y(),children:[(0,C.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.permissionsTitle}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:Y}),m.platform===`darwin`&&!m.packaged?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:n.permissionsHintDevDarwin}):null]}),(0,C.jsxs)(`button`,{type:`button`,disabled:R||N,"aria-busy":R,className:a(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,s.press),onClick:()=>void V(),children:[(0,C.jsx)(f,{className:a(`size-3.5`,R&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),R?n.refreshing:n.refresh]})]}),(0,C.jsx)(`ul`,{className:`space-y-3`,children:P(m.platform).map(({key:t,pane:i})=>{let o=F(e,h[t]),c=n.perm[t],l=h[t]===`unknown`?I(e,t,m.platform):null;return c?(0,C.jsxs)(`li`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:c.title}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:c.desc}),(0,C.jsx)(`p`,{className:`mt-1 text-xs font-medium ${o.className}`,children:o.label}),l?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:l}):null]}),(0,C.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[t===`notifications`&&j(t,h[t],m.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:a(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,s.press),onClick:()=>void q(),children:n.requestAccess}):null,t===`microphone`&&j(t,h[t],m.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:a(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,s.press),onClick:()=>void G(),children:n.requestAccess}):null,t===`accessibility`&&j(t,h[t],m.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:a(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,s.press),onClick:()=>void K(),children:n.requestAccess}):null,t===`screen`&&j(t,h[t],m.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:N,className:a(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,s.press),onClick:()=>void J(),children:n.requestAccess}):null,M(t,h[t],m.platform)?(0,C.jsxs)(`button`,{type:`button`,className:a(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,s.press),onClick:()=>void W(i),children:[n.openSettings,(0,C.jsx)(r,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},t):null})})]}):null]})}export{R as SystemSettingsPanel};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i,h as a,p as o,t as s}from"./chunk-KS7C4IRE--EKdQGRF.js";import{n as c,r as l}from"./popover-select-DHC7J4lG.js";import{t as u}from"./circle-check-C23XjkUj.js";import{t as d}from"./ellipsis-0k4rZLoy.js";import{t as f}from"./external-link-DjqjBmc3.js";import{C as p,D as m,N as h,g,h as _,j as v,k as y,v as ee}from"./use-composer-attachments-DNl7O3Vb.js";import{F as te,N as b,V as ne,z as x}from"./markdown-view-IsYTotu6.js";import{t as re}from"./folder-open-CyzJ19I9.js";import{t as ie}from"./x-B_N4OPjy.js";import{t as S}from"./cn-0WouolD0.js";import{a as C,c as w,n as ae,r as T}from"./locale-store-BpK9AiDq.js";import{i as oe,n as se,o as ce,r as le,s as ue,t as E}from"./dist-BGTk37IG.js";import{i as D}from"./vendor-swr-BIWyz7Rc.js";import{t as O}from"./button-aIC072nz.js";import{t as k}from"./activity-store-DWQCDi8M.js";import{t as A}from"./skeleton-BI5TyibZ.js";import{m as j,o as de}from"./shares-api-Dbx3z6-1.js";import{n as fe}from"./date-formatters-CUZAyDEg.js";import{$t as pe,Ca as me,Ci as he,Fi as ge,Hc as _e,Ps as ve,Sc as ye,Ss as be,Uc as xe,Xc as Se,_a as Ce,ar as we,cr as Te,dl as Ee,gs as De,ir as Oe,ji as ke,l as Ae,n as je,nr as Me,or as Ne,qi as Pe,rr as Fe,sr as Ie,vo as Le,wi as Re,yc as ze,yo as Be}from"./index-DFgXwLsv.js";import{t as Ve}from"./page-context-capture-button-CoWb7BYP.js";import{t as M}from"./date-picker-hmJlEAQZ.js";import{n as He,t as N}from"./task-expandable-content-DAZGz5YC.js";import{t as P}from"./dependency-picker-Us_Juz6I.js";var F=n(),I=e(t(),1),L=r();function Ue({wait:e,detail:t,zh:n,onUpdated:r}){let[i,a]=(0,I.useState)(``),[o,s]=(0,I.useState)(!1),[c,l]=(0,I.useState)(``),[u,d]=(0,I.useState)(!1),f=(0,I.useRef)(null),p=e.kind===`approval`,m=Array.isArray(e.condition.choices)?e.condition.choices.filter(e=>typeof e==`string`):[];async function h(a){if(!p&&!i.trim()||p&&!a||o)return;let c=JSON.stringify([t.task.version,i.trim(),a]);f.current?.signature!==c&&(f.current={signature:c,key:crypto.randomUUID()}),s(!0),l(``);try{let o=await g(t.task.id,{type:`resolve_wait`,waitId:e.id,resolution:p?{kind:`task_approval`,decision:a}:{kind:`user_answer`,answer:i.trim()}},t.task.version,f.current.key);d(!0),r(o),k({tone:`success`,title:p?n?`决定已保存`:`Decision saved`:n?`补充信息已保存`:`Answer saved`,message:o.waits.length?n?`仍有其他等待条件,任务尚未恢复执行。`:`Other waiting conditions remain.`:n?`等待已解除,请在任务状态中查看后续执行进展。`:`The wait is resolved. Follow progress in the task status.`,source:n?`任务`:`Task`})}catch{l(n?`提交未确认,内容已保留。可重试;若问题已变化,请刷新。`:`Submission not confirmed. Your answer is saved here; retry or refresh if the question changed.`)}finally{s(!1)}}return(0,L.jsxs)(`form`,{className:`mt-3 space-y-3 rounded-lg border border-edge p-3`,onSubmit:e=>{e.preventDefault(),h()},children:[p?(0,L.jsxs)(`div`,{className:`text-sm text-fg`,children:[(0,L.jsx)(`p`,{children:e.reason}),(0,L.jsxs)(`p`,{className:`mt-2`,children:[n?`授权范围:`:`Permission: `,String(e.condition.capability)]}),(0,L.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,L.jsx)(O,{type:`button`,variant:`primary`,disabled:o||u,onClick:()=>void h(`approve`),children:n?`批准`:`Approve`}),(0,L.jsx)(O,{type:`button`,disabled:o||u,onClick:()=>void h(`deny`),children:n?`拒绝并暂停`:`Deny and pause`})]})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`label`,{className:`block text-sm text-fg`,children:[typeof e.condition.question==`string`?e.condition.question:e.reason,(0,L.jsx)(`textarea`,{className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel p-3`,rows:3,maxLength:12e3,value:i,disabled:o||u,onChange:e=>a(e.target.value)})]}),m.length>0&&(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:m.map(e=>(0,L.jsx)(O,{type:`button`,disabled:o||u,variant:`secondary`,"aria-pressed":i===e,onClick:()=>a(e),children:e},e))}),(0,L.jsx)(O,{type:`submit`,variant:`primary`,disabled:o||u||!i.trim(),children:o?n?`正在提交`:`Submitting`:n?`提交补充信息`:`Submit answer`})]}),(0,L.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`保存到任务上下文;其他等待条件满足后继续执行。`:`Saved to task context. Work continues once all waiting conditions are met.`}),c&&(0,L.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:c})]})}function We(e){let t=(0,F.c)(17),{children:n,contentKey:r,language:a,className:o}=e,s=(0,I.useId)(),c=I.Children.toArray(n),[l,u]=i(),d;t[0]!==r||t[1]!==l?(d=l.getAll(`taskExpanded`).includes(r),t[0]=r,t[1]=l,t[2]=d):d=t[2];let f=d,p=f?c:c.slice(0,3),m;t[3]!==s||t[4]!==p?(m=(0,L.jsx)(`ul`,{id:s,className:`space-y-1.5`,children:p}),t[3]=s,t[4]=p,t[5]=m):m=t[5];let h;t[6]!==r||t[7]!==f||t[8]!==s||t[9]!==c.length||t[10]!==a||t[11]!==u?(h=c.length>3?(0,L.jsx)(`button`,{type:`button`,"aria-expanded":f,"aria-controls":s,className:`mt-2 min-h-9 rounded-sm text-xs font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,onClick:()=>u(e=>{let t=new URLSearchParams(e),n=t.getAll(`taskExpanded`).filter(e=>e!==r);return t.delete(`taskExpanded`),n.forEach(e=>t.append(`taskExpanded`,e)),f||t.append(`taskExpanded`,r),t},{preventScrollReset:!0}),children:a===`zh`?f?`收起`:`查看全部(${c.length})`:f?`Show less`:`Show all (${c.length})`}):null,t[6]=r,t[7]=f,t[8]=s,t[9]=c.length,t[10]=a,t[11]=u,t[12]=h):h=t[12];let g;return t[13]!==o||t[14]!==m||t[15]!==h?(g=(0,L.jsxs)(`div`,{className:o,children:[m,h]}),t[13]=o,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}function Ge(e,t){let n;try{n=new URL(e)}catch{return}return t.find(e=>[e.shareUrl,e.lanUrl].some(e=>{if(!e)return!1;try{let t=new URL(e);return t.origin===n.origin&&t.pathname.replace(/\/$/,``)===n.pathname.replace(/\/$/,``)}catch{return!1}}))}function Ke({uri:e,zh:t}){let[n,r]=(0,I.useState)(),[i,a]=(0,I.useState)(!1),[o,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(``),[d,f]=(0,I.useState)(``);async function p(){a(!0),u(``);try{let n=Ge(e,(await j()).payload.shares);r(n),c(!0),n?n.kind!==`file`&&n.kind!==`directory`?u(t?`这是文档快照,请从原笔记或对话的分享面板重新发布。`:`This is a document snapshot. Republish it from the original note or conversation.`):n.revoked?u(t?`分享已被撤销,不能自动恢复。请从原任务重新生成并分享。`:`This share was revoked. Generate and share a new artifact from the task.`):n.maxViews!==null&&n.downloadCount>=n.maxViews?u(t?`已达到访问次数上限,请在分享设置中调整后重试。`:`The access limit was reached. Adjust it in share settings.`):n.expired||(f(n.shareUrl),u(t?`链接仍在有效期内;若打不开,请检查网关连接。`:`The link has not expired. If it cannot open, check gateway connectivity.`)):u(t?`未找到本机管理的分享记录。外部链接或已清理的记录无法在这里续期,请从原任务重新生成产物。`:`No locally managed share matches this link. Regenerate the artifact from its task.`)}catch{u(t?`检查失败,请重试。`:`Check failed. Please retry.`)}finally{a(!1)}}async function m(){if(!(!n||i)){a(!0),u(``);try{let e=await de(n.id,864e5);f(e.payload.shareUrl),r({...n,expired:!1,expiresAt:e.payload.expiresAt}),u(t?`已续期 24 小时,访问范围与次数限制保持不变。`:`Renewed for 24 hours. Access scope and view limits are unchanged.`)}catch(e){u(`${t?`恢复失败:`:`Recovery failed: `}${e instanceof Error?e.message:String(e)}`)}finally{a(!1)}}}return(0,L.jsxs)(`details`,{className:`mt-2 text-xs text-fg-muted`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer py-2`,children:t?`链接打不开?`:`Trouble opening the link?`}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(O,{type:`button`,variant:`ghost`,disabled:i,onClick:()=>void p(),children:t?`检查链接状态`:`Check link`}),o&&n?.expired&&(n.kind===`file`||n.kind===`directory`)&&!n.revoked&&(n.maxViews===null||n.downloadCount<n.maxViews)&&(0,L.jsx)(O,{type:`button`,disabled:i,onClick:()=>void m(),children:t?`恢复链接 · 续期 24 小时`:`Restore link for 24 hours`}),l&&(0,L.jsx)(`p`,{role:`status`,className:`break-words leading-5`,children:l}),d&&(0,L.jsx)(`a`,{className:`block py-2 text-accent`,href:d,target:`_blank`,rel:`noopener noreferrer`,children:t?`打开产物`:`Open artifact`}),o&&(0,L.jsx)(s,{className:`block py-2 text-accent`,to:`/settings/shares`,children:t?`管理分享记录`:`Manage shares`})]})]})}function qe(e){let t=(0,F.c)(14),{evidence:n,projectId:r,conversationId:i,language:a}=e,o=he(R);if(!n.length)return null;let s=a===`zh`?`交付物与验证依据`:`Deliverables and evidence`,c;if(t[0]!==i||t[1]!==n||t[2]!==a||t[3]!==r||t[4]!==o){let e;t[6]!==i||t[7]!==a||t[8]!==r||t[9]!==o?(e=(e,t)=>{let n=e.uri?.trim(),s=n&&/^https?:\/\//i.test(n),c=n&&!s&&e.kind===`artifact`&&!/^[a-z][a-z0-9+.-]*:/i.test(n)&&!n.startsWith(`//`),l=e.title||(a===`zh`?`查看产物`:`Open artifact`);return(0,L.jsxs)(`div`,{className:`min-w-0 rounded-lg border border-edge-subtle p-3`,children:[(0,L.jsx)(N,{content:l,contentKey:`${i??r}:evidence-title:${t}:${e.title}`,language:a,previewHeight:60,children:s?(0,L.jsxs)(`a`,{className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline [overflow-wrap:anywhere]`,href:n,target:`_blank`,rel:`noopener noreferrer`,children:[(0,L.jsx)(f,{className:`size-4 shrink-0`}),(0,L.jsx)(`span`,{className:`min-w-0 break-words`,children:l})]}):c&&(r||i)?(0,L.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-11 items-center gap-2 text-sm font-medium text-accent hover:underline [overflow-wrap:anywhere]`,onClick:()=>o(n,null,r,i),children:[(0,L.jsx)(ye,{className:`size-4 shrink-0`}),l]}):(0,L.jsx)(`p`,{className:`break-words [overflow-wrap:anywhere] text-sm font-medium text-fg`,children:l})}),s&&e.kind===`artifact`&&(0,L.jsx)(Ke,{uri:n,zh:a===`zh`},n),e.summary?(0,L.jsx)(N,{content:e.summary,contentKey:`${i??r}:evidence:${t}:${e.title}`,language:a,markdown:!1,previewHeight:80,className:`mt-1 text-xs leading-5 text-fg-muted`}):null,(0,L.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:e.provenance===`judge`?e.strength===`verified`?a===`zh`?`模型审阅通过`:`Model reviewed`:a===`zh`?`模型未确认,待核验`:`Not confirmed by review`:e.strength===`verified`?a===`zh`?`已验证`:`Verified`:a===`zh`?`已记录,待验证`:`Observed, not verified`})]},`${e.title}-${t}`)},t[6]=i,t[7]=a,t[8]=r,t[9]=o,t[10]=e):e=t[10],c=n.map(e),t[0]=i,t[1]=n,t[2]=a,t[3]=r,t[4]=o,t[5]=c}else c=t[5];let l;return t[11]!==s||t[12]!==c?(l=(0,L.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,"aria-label":s,children:c}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function R(e){return e.setPath}function Je({taskId:e}){let t=w(e=>e.conversationId),n=ae(e=>e.language),[r,i]=(0,I.useState)(``),[a,o]=(0,I.useState)(null),[s,c]=(0,I.useState)(!1),[l,u]=(0,I.useState)(!1),[d,f]=(0,I.useState)([]),[p,m]=(0,I.useState)(null),h=T(`/api/tasks/${encodeURIComponent(e)}/collaboration`),{data:g,error:_,mutate:v}=D([`task-collaboration`,e,t],()=>C(`${h}?recent=1`),{revalidateOnFocus:!0}),y=[...new Map([...d,...g?.items??[]].map(e=>[e.id,e])).values()].sort((e,t)=>e.sequence-t.sequence),ee=async()=>{let e=y[0];if(!(!e||l)){u(!0);try{let t=await C(`${h}?recent=1&beforeSequence=${e.sequence}`);f(e=>[...t.items,...e])}catch(e){m(e instanceof Error?e.message:String(e))}finally{u(!1)}}};(0,I.useEffect)(()=>{let t=t=>{let n=t.detail;(!n?.taskId||n.taskId===e)&&v()};return window.addEventListener(`task-collaboration-entry-added`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.removeEventListener(`task-collaboration-entry-added`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[v,e]);let te=async()=>{if(!(!r.trim()||s)){c(!0),m(null);try{await C(h,{method:`POST`,headers:{"idempotency-key":crypto.randomUUID()},body:JSON.stringify({kind:a?`answer`:`instruction`,body:r.trim(),...a?{causationId:a}:{}})}),i(``),o(null),await v()}catch(e){m(e instanceof Error?e.message:String(e))}finally{c(!1)}}};return(0,L.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n===`zh`?`任务留言`:`Task updates`}),(0,L.jsxs)(`div`,{className:`mt-3 max-h-64 space-y-2 overflow-y-auto`,children:[!g&&!_?(0,L.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-2`,children:[(0,L.jsx)(A,{className:`h-14 w-full`}),(0,L.jsx)(A,{className:`h-14 w-4/5`})]}):null,_?(0,L.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:n===`zh`?`暂时无法读取留言`:`Updates unavailable`}):null,y[0]&&y[0].sequence>1?(0,L.jsx)(`button`,{type:`button`,disabled:l,onClick:()=>void ee(),className:`text-xs text-accent hover:underline disabled:opacity-50`,children:n===`zh`?`查看更早留言`:`Earlier updates`}):null,y.map(t=>(0,L.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2 text-sm`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-subtle`,children:[(0,L.jsx)(`span`,{children:t.authorKind===`worker_agent`?n===`zh`?`执行 Agent`:`Worker`:t.authorKind===`main_agent`?n===`zh`?`主 Agent`:`Main Agent`:t.authorKind===`system`?n===`zh`?`系统`:`System`:n===`zh`?`用户`:`You`}),(0,L.jsxs)(`span`,{children:[`· `,t.kind]}),t.deliveryStatus?(0,L.jsxs)(`span`,{children:[`· `,t.deliveryStatus]}):null]}),(0,L.jsx)(`div`,{className:`mt-1 min-w-0 text-fg`,"data-task-collaboration-body":!0,children:(0,L.jsx)(N,{content:t.body,contentKey:`${e}:update:${t.id}`,language:n,breaks:!0,previewHeight:120})}),t.kind===`question`&&t.authorKind===`worker_agent`?(0,L.jsx)(`button`,{type:`button`,className:`mt-2 text-xs text-accent hover:underline`,onClick:()=>o(t.id),children:n===`zh`?`回复问题`:`Reply`}):null]},t.id)),g&&!y.length?(0,L.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n===`zh`?`暂无进展留言`:`No updates yet`}):null]}),a?(0,L.jsxs)(`p`,{className:`mt-3 text-xs text-accent`,children:[n===`zh`?`正在回复执行 Agent 的问题`:`Replying to the worker`,(0,L.jsx)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>o(null),children:n===`zh`?`取消`:`Cancel`})]}):null,(0,L.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),rows:2,"aria-label":n===`zh`?`任务留言`:`Task message`,placeholder:n===`zh`?`给执行 Agent 留言`:`Message the worker`,className:`mt-3 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),p?(0,L.jsx)(`p`,{role:`alert`,className:`mt-1 text-xs text-danger`,children:p}):null,(0,L.jsx)(`button`,{type:`button`,disabled:!r.trim()||s,onClick:()=>void te(),className:`mt-2 rounded-lg bg-accent px-3 py-2 text-xs font-medium text-white disabled:opacity-50`,children:s?n===`zh`?`发送中`:`Sending`:n===`zh`?`发送`:`Send`})]})}function Ye(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Xe(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}function Ze(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function Qe(){let e=(0,F.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,L.jsx)(A,{className:`h-32 rounded-2xl`}),(0,L.jsx)(A,{className:`h-52 rounded-2xl`}),(0,L.jsx)(A,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function $e(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function et(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var tt=[`backlog`,`ready`,`active`,`review`,`closed`],nt=[`low`,`normal`,`high`,`critical`],rt=(0,I.memo)(function(e){let t=(0,F.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:u,onChange:d}=e,f;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(f=e=>e!==n&&(e===`closed`?!a:n===`closed`?!o:!i),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=f):f=t[4];let p=f,m;t[5]===u?m=t[6]:(m=(0,L.jsx)(`span`,{children:u}),t[5]=u,t[6]=m);let h;t[7]===d?h=t[8]:(h=e=>d(e.target.value),t[7]=d,t[8]=h);let g;t[9]!==s||t[10]!==p?(g=tt.map(e=>(0,L.jsx)(l,{value:e,disabled:p(e),children:Ze(e,s)},e)),t[9]=s,t[10]=p,t[11]=g):g=t[11];let _;t[12]!==r||t[13]!==h||t[14]!==g||t[15]!==n?(_=(0,L.jsx)(c,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:h,children:g}),t[12]=r,t[13]=h,t[14]=g,t[15]=n,t[16]=_):_=t[16];let v;return t[17]!==m||t[18]!==_?(v=(0,L.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19],v}),it=(0,I.memo)(function(e){let t=(0,F.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,L.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let u;t[2]===o?u=t[3]:(u=e=>o(e.target.value),t[2]=o,t[3]=u);let d;t[4]===a?d=t[5]:(d=nt.map(e=>(0,L.jsx)(l,{value:e,children:a[e]},e)),t[4]=a,t[5]=d);let f;t[6]!==r||t[7]!==u||t[8]!==d||t[9]!==n?(f=(0,L.jsx)(c,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:u,children:d}),t[6]=r,t[7]=u,t[8]=d,t[9]=n,t[10]=f):f=t[10];let p;return t[11]!==s||t[12]!==f?(p=(0,L.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[s,f]}),t[11]=s,t[12]=f,t[13]=p):p=t[13],p}),at=(0,I.memo)(function(e){let t=(0,F.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,L.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,L.jsx)(M,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,L.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),ot=(0,I.memo)(function(e){let t=(0,F.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:s}=e,u;t[0]===i?u=t[1]:(u=(0,L.jsx)(`span`,{children:i}),t[0]=i,t[1]=u);let d;t[2]===s?d=t[3]:(d=e=>s(e.target.value),t[2]=s,t[3]=d);let f;t[4]===a?f=t[5]:(f=(0,L.jsx)(l,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=f);let p;t[6]===o?p=t[7]:(p=o.map(Et),t[6]=o,t[7]=p);let m;t[8]!==r||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==n?(m=(0,L.jsxs)(c,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:d,children:[f,p]}),t[8]=r,t[9]=d,t[10]=f,t[11]=p,t[12]=n,t[13]=m):m=t[13];let h;return t[14]!==u||t[15]!==m?(h=(0,L.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[u,m]}),t[14]=u,t[15]=m,t[16]=h):h=t[16],h}),st=(0,I.memo)(function(e){let t=(0,F.c)(9),{candidates:n,selected:r,disabled:i,labels:a,getTaskHref:o,onChange:s}=e,c;t[0]===r?c=t[1]:(c=r.map(Dt),t[0]=r,t[1]=c);let l;return t[2]!==n||t[3]!==i||t[4]!==o||t[5]!==a||t[6]!==s||t[7]!==c?(l=(0,L.jsx)(P,{borderless:!0,candidates:n,selectedIds:c,disabled:i,getTaskHref:o,onChange:s,labels:a}),t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=c,t[8]=l):l=t[8],l},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.getTaskHref===t.getTaskHref&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),ct=`xopc.taskDetail.chatPanelPercent`,lt=42;function ut(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?lt:Math.min(r,Math.max(n,e))}function dt(){try{let e=Number(window.localStorage.getItem(ct));return Number.isFinite(e)&&e>=30&&e<=60?e:lt}catch{return lt}}function ft(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.waits.some(e=>e.kind===`paused`)?`paused`:e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`)?`needsUser`:e.operationalState===`idle`?e.task.phase===`backlog`?`captured`:e.task.phase===`ready`?`ready`:e.task.phase===`review`?`review`:`ready`:e.operationalState}function pt(e){return e===`failed`?`bg-danger/10 text-danger`:e===`needsUser`||e===`blocked`?`bg-warning/10 text-warning`:e===`completed`?`bg-success-soft text-success`:e===`running`||e===`verifying`||e===`review`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-muted`}function mt(e){let t=(0,F.c)(13),{items:n,empty:r,contentKey:i}=e,a=ae(gt);if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,L.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let o;t[2]===n?o=t[3]:(o=n.join(`
|
|
2
|
+
`),t[2]=n,t[3]=o);let s;t[4]===n?s=t[5]:(s=n.map(ht),t[4]=n,t[5]=s);let c;t[6]===s?c=t[7]:(c=(0,L.jsx)(`ul`,{className:`space-y-2`,children:s}),t[6]=s,t[7]=c);let l;return t[8]!==i||t[9]!==a||t[10]!==o||t[11]!==c?(l=(0,L.jsx)(N,{content:o,contentKey:i,language:a,previewHeight:144,children:c}),t[8]=i,t[9]=a,t[10]=o,t[11]=c,t[12]=l):l=t[12],l}function ht(e){return(0,L.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,L.jsx)(_e,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,L.jsx)(`span`,{className:`min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:e})]},e)}function gt(e){return e.language}function _t({taskId:e,presentation:t,backgroundPath:n,onDeleted:r}){let[a]=i(),c=o(),l=ae(e=>e.language),ie=w(e=>e.conversationId),C=(0,I.useMemo)(()=>Be(l),[l]),T=me(e=>e.setPageHeader),oe=me(e=>e.clearPageHeader),se=Re(e=>e.open),ce=Re(e=>e.conversationIdOverride),le=Re(e=>e.openForSession),ue=Te(e=>e.setOpen),{data:E,error:k,mutate:A,lastChange:j,conversationLoading:de,conversationError:pe}=Le(e),{data:he}=D(e?`task-detail-automations`:null,()=>Ae.list()),[ye,M]=(0,I.useState)(null),[P,F]=(0,I.useState)(()=>new Set),[Ge,Ke]=(0,I.useState)([]),[R,Ze]=(0,I.useState)(null),[tt,nt]=(0,I.useState)([]),[ht,gt]=(0,I.useState)(!1),[_t,vt]=(0,I.useState)(``),[yt,z]=(0,I.useState)(!1),[bt,xt]=(0,I.useState)(``),[B,St]=(0,I.useState)(dt),[Ct,wt]=(0,I.useState)(!1),Tt=(0,I.useRef)(null),Et=(0,I.useRef)(!1),Dt=(0,I.useRef)(!1),Ot=(0,I.useRef)(``),V=(0,I.useRef)(null),kt=(0,I.useRef)(null),At=(0,I.useRef)(null),H=(0,I.useRef)(E),[jt,U]=(0,I.useState)(null),[Mt,Nt]=(0,I.useState)(null),[Pt,Ft]=(0,I.useState)(!1),It=(0,I.useMemo)(()=>({link:C.linkDependencies,linked:C.linkedDependencies,searchPlaceholder:C.dependencySearchPlaceholder,noMatches:C.noDependencyMatches,noCandidates:C.noDependencyCandidates,remove:C.removeDependency}),[C.dependencySearchPlaceholder,C.linkDependencies,C.linkedDependencies,C.noDependencyCandidates,C.noDependencyMatches,C.removeDependency]),Lt=E?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,W=(0,I.useMemo)(()=>x(a.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[a]),Rt=(0,I.useCallback)(e=>t===`modal`&&n?te(n,e):ne(`/tasks/${encodeURIComponent(e)}`,W),[n,t,W]);H.current=E;let G=(0,I.useCallback)((e,t)=>{F(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,I.useEffect)(()=>{M(null),U(null),gt(!1),V.current=null,z(!1),Nt(null),Ft(!1)},[e]),(0,I.useEffect)(()=>{let e=!0;return ge().then(t=>{e&&nt(t.items)}).catch(()=>void 0),()=>{e=!1}},[ie]),(0,I.useEffect)(()=>{if(!j||j.source===`user`)return;Nt(j);let e=window.setTimeout(()=>Nt(null),3500);return()=>window.clearTimeout(e)},[j]),(0,I.useEffect)(()=>{let t=E?.task.projectId,n=E?.dependencies??[];if(!t){At.current=null,Ze(null),Ke(n);return}At.current!==t&&(At.current=t,Ze(null));let r=!0;return Pe(t).then(t=>{if(!r)return;Ze(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});Ke([...i.values()])}).catch(()=>{r&&Ke(n)}),()=>{r=!1}},[Lt,E?.task.projectId,e]);let K=(0,I.useCallback)(async(t,n=`command`)=>{let r=H.current;if(r){G(n,!0),M(null);try{await A(await g(e,t,r.task.version),{revalidate:!1})}catch{M(C.actionFailed)}finally{G(n,!1)}}},[C.actionFailed,A,G,e]),q=(0,I.useCallback)(async(t,n)=>{let r=H.current;if(!r)return!1;n&&G(n,!0),M(null);try{return await A(v(e,t,r.task.version),{optimisticData:Xe(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return M(C.actionFailed),!1}finally{n&&G(n,!1)}},[C.actionFailed,A,G,e]),zt=()=>{E&&(V.current={value:E.task.title,version:E.task.version},U(null),vt(E.task.title),gt(!0))},Bt=()=>{Et.current=!0,vt(H.current?.task.title??``),V.current=null,U(null),gt(!1),queueMicrotask(()=>{Et.current=!1})},Vt=async(e=!1)=>{if(Et.current){Et.current=!1;return}let t=H.current;if(!t||P.has(`title`))return;let n=_t.trim();if(!n){Bt();return}let r=V.current;if(!e&&Ye(r,t.task.version,t.task.title,n)){U(`title`);return}if(n===t.task.title){Bt();return}await q({title:n},`title`)&&(V.current=null,U(null),gt(!1))},Ht=async()=>{if(!E)return;if(Dt.current){Dt.current=!1;return}let e=bt.trim(),t=kt.current;if(Ye(t,E.task.version,E.task.body??``,e)){U(`description`);return}if(bt===Ot.current||e===(E.task.body??``).trim()){z(!1);return}await q({body:e||null})&&(U(null),z(!1))},Ut=(0,I.useCallback)(async e=>{let t=H.current;if(!(!t||e===t.task.phase)){if(t.task.phase===`closed`){await K({type:`reopen`,phase:e===`closed`?`ready`:e},`phase`);return}if(e===`closed`){await K({type:`close`,resolution:`done`},`phase`);return}await K({type:`move`,phase:e},`phase`)}},[K]),Wt=(0,I.useCallback)(e=>{q({priority:e},`priority`)},[q]),Gt=(0,I.useCallback)(e=>{q({dueAt:et(e)},`dueAt`)},[q]),Kt=(0,I.useCallback)(e=>{St(e);try{window.localStorage.setItem(ct,String(e))}catch{}},[]),qt=(0,I.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=Tt.current?.clientWidth??0;Kt(ut(e.key===`Home`?lt:B+(e.key===`ArrowLeft`?2:-2),t))},[B,Kt]),Jt=(0,I.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=Tt.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),wt(!0);let i=B,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=ut((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}wt(!1),Kt(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[B,Kt]),Yt=(0,I.useCallback)(async t=>{let n=H.current;if(n){G(`dependencies`,!0),M(null);try{await A(await h(e,t,n.task.version),{revalidate:!1})}catch{M(C.dependencyUpdateFailed)}finally{G(`dependencies`,!1)}}},[C.dependencyUpdateFailed,A,G,e]),Xt=(0,I.useCallback)(async t=>{let n=H.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){G(`delegateAgentId`,!0),M(null);try{await A(await p(e,t,n.task.version),{revalidate:!1})}catch{M(C.actionFailed)}finally{G(`delegateAgentId`,!1)}}},[C.actionFailed,A,G,e]),Zt=(0,I.useCallback)(async()=>{G(`delete`,!0),M(null);try{await ee(e),r?r():c(W,{replace:!0})}catch(e){M(e instanceof Error?e.message:C.actionFailed)}finally{G(`delete`,!1)}},[C.actionFailed,c,r,W,G,e]),Qt=(0,I.useCallback)(async(t,n)=>{let r=H.current;if(r){G(`acceptance`,!0),M(null);try{await A(await m(e,t,n,r.task.version,r.task.latestContractVersion),{revalidate:!1})}catch{M(C.actionFailed),await A()}finally{G(`acceptance`,!1)}}},[C.actionFailed,A,G,e]);if((0,I.useLayoutEffect)(()=>{if(t!==`modal`)return T({startExtra:(0,L.jsx)(s,{to:W,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":C.backToWork,children:(0,L.jsx)(Ee,{className:`size-4`})}),main:E?(0,L.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:R?`${R} / ${C.taskLabel}`:C.taskLabel}):null,end:null}),oe},[oe,C.backToWork,C.taskLabel,E,t,R,W,T]),k&&!E)return(0,L.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:C.taskNotFound});if(!E)return(0,L.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,L.jsx)(Qe,{})});let $t=E.waits[0],J=He(E),en=J.length>0&&J.every(e=>e.status===`passed`),tn=E.waits.find(e=>e.kind===`paused`),Y=E.receipts[0],nn=ft(E),rn=C.detailStatuses[nn],an=E.task.body?.trim()||E.task.contract?.objective.trim(),on=E.allowedCommands.includes(`mark_ready`),sn=E.allowedCommands.includes(`start`),cn=E.allowedCommands.includes(`add_wait`),ln=!$t&&en&&E.task.phase===`review`&&E.allowedCommands.includes(`close`),un=E.allowedCommands.includes(`reopen`),X=E.conversation.activeConversationId,dn=E.conversation.currentExecutorAgentId??E.task.delegateAgentId??E.task.ownerId,fn=tt.find(e=>e.id===dn),pn=!!(X&&se&&ce===X),mn=E.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),hn=J.filter(e=>e.status===`passed`).length,gn=E.context.filter(e=>e.role===`deliverable`),_n=new Set(E.runs.filter(e=>e.contractVersion===E.task.latestContractVersion).map(e=>e.id)),vn=[...new Map(E.receipts.filter(e=>_n.has(e.runId)).flatMap(e=>e.evidence.filter(e=>e.kind===`artifact`)).map(e=>[e.uri??e.title,e])).values()],yn=E.context.filter(e=>e.role!==`deliverable`),bn=E.runs.filter(e=>e.executorKind===`workflow`&&!e.parentRunId),xn=[...new Set(bn.map(e=>e.executorRef.workflowId).filter(e=>typeof e==`string`))],Sn=he?.automations.filter(t=>t.action.kind===`task_command`&&t.action.taskId===e)??[],Z=E.sessions.filter((e,t,n)=>n.findIndex(t=>t.conversationId===e.conversationId)===t),Cn=E.task.contract?.expectedOutputs??[],wn=E.task.contract?.constraints??[],Tn=E.task.contract?.approvalRequired??[],En=E.task.contract?.assumptions??[],Dn=E.task.contract?.risks??[],On=wn.length>0||Tn.length>0||En.length>0||Dn.length>0,Q=(...e)=>!!Mt?.changedFields.some(t=>e.includes(t)),kn=E.allowedCommands.includes(`move`),$=P.has(`command`),An=P.has(`delete`),jn=E.runs.find(e=>!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),Mn=jn!==void 0,Nn=`/automations?action=create&taskId=${encodeURIComponent(E.task.id)}${E.task.projectId?`&projectId=${encodeURIComponent(E.task.projectId)}`:``}`,Pn=(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[on?(0,L.jsxs)(O,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:$,onClick:()=>void K({type:`mark_ready`}),children:[(0,L.jsx)(De,{className:`size-4`}),C.scheduleTask]}):null,tn&&E.allowedCommands.includes(`resolve_wait`)?(0,L.jsxs)(O,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:$,onClick:()=>void K({type:`resolve_wait`,waitId:tn.id}),children:[(0,L.jsx)(De,{className:`size-4`}),C.resumeTask]}):null,!$t&&sn&&dn?(0,L.jsxs)(O,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:$,onClick:()=>void K({type:`start`,executor:{kind:`agent`,agentId:dn}}),children:[(0,L.jsx)(De,{className:`size-4`}),C.runTask]}):null,ln?(0,L.jsxs)(O,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:$,onClick:()=>void K({type:`close`,resolution:`done`}),children:[(0,L.jsx)(u,{className:`size-4`}),C.approveTask]}):null,un?(0,L.jsxs)(O,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:$,onClick:()=>void K({type:`reopen`,phase:`ready`}),children:[(0,L.jsx)(De,{className:`size-4`}),C.reopenTask]}):null,!tn&&cn?(0,L.jsxs)(O,{variant:`ghost`,className:`min-h-9 px-3 py-1.5 text-xs`,disabled:$,onClick:()=>void K({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,L.jsx)(be,{className:`size-4`}),C.pauseTask]}):null,E.task.phase===`closed`?null:(0,L.jsx)(O,{asChild:!0,variant:`ghost`,className:`min-h-9 px-3 py-1.5 text-xs`,children:(0,L.jsxs)(s,{to:Nn,children:[(0,L.jsx)(Se,{className:`size-4`}),C.scheduleRecurringTask]})}),(0,L.jsxs)(we,{children:[(0,L.jsx)(Ie,{asChild:!0,children:(0,L.jsx)(O,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:$||An,"aria-label":C.moreActions,children:(0,L.jsx)(d,{className:`size-4`,"aria-hidden":!0})})}),(0,L.jsx)(Oe,{children:(0,L.jsxs)(Me,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[jn?(0,L.jsx)(Fe,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{G(`command`,!0),M(null),A(_(e,jn.id,jn.version),{revalidate:!1}).catch(()=>M(C.actionFailed)).finally(()=>G(`command`,!1))},children:C.cancelActiveRun}):null,jn?(0,L.jsx)(Ne,{className:`my-1 h-px bg-edge`}):null,E.task.phase===`closed`?null:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Fe,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void K({type:`close`,resolution:`cancelled`}),children:C.cancelTask}),(0,L.jsx)(Ne,{className:`my-1 h-px bg-edge`})]}),(0,L.jsx)(Fe,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{if(Mn){M(C.deleteActiveTaskBlocked);return}Ft(!0)},children:C.deleteTask})]})})]})]});return(0,L.jsxs)(`div`,{ref:Tt,className:`flex h-full min-h-0 flex-col overflow-hidden ${Ct?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${B}%`},children:[(0,L.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto lg:flex-row lg:overflow-hidden`,children:[(0,L.jsxs)(`div`,{className:`task-detail-scroll flex min-w-0 shrink-0 flex-col lg:min-h-0 lg:flex-1 lg:shrink lg:overflow-y-auto lg:overscroll-contain`,children:[(0,L.jsxs)(`header`,{className:S(`shrink-0 border-b border-edge-subtle bg-surface-panel px-5 py-4 sm:px-6`,Q(`title`)&&`task-detail-live-update`),children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-3`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[R?(0,L.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,L.jsx)(ze,{className:`size-3.5`,"aria-hidden":!0}),R]}):null,R?(0,L.jsx)(`span`,{"aria-hidden":`true`,children:`/`}):null,(0,L.jsx)(`span`,{children:C.taskLabel}),Mt?(0,L.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:Mt.source===`agent`?l===`zh`?`Agent 刚刚更新`:`Updated by Agent`:l===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),ht?(0,L.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,"aria-label":l===`zh`?`任务标题`:`Task title`,rows:2,value:_t,onFocus:e=>{V.current?.value===_t&&(e.currentTarget.setSelectionRange(0,0),e.currentTarget.scrollTop=0)},onChange:e=>vt(e.target.value),onBlur:()=>void Vt(),onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),Bt()):e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),e.currentTarget.blur()))},className:`mt-2 block max-h-56 min-h-14 w-full max-w-3xl resize-none overflow-y-auto bg-transparent p-0 text-xl font-semibold leading-7 text-fg outline-none [field-sizing:content]`}):(0,L.jsx)(N,{content:E.task.title,contentKey:`${e}:title`,language:l,previewHeight:56,className:`mt-2 max-w-3xl`,children:(0,L.jsx)(`h1`,{className:`break-words text-xl font-semibold leading-7 text-fg`,children:(0,L.jsx)(`button`,{type:`button`,className:`max-w-full whitespace-pre-wrap break-words [overflow-wrap:anywhere] rounded-sm text-left outline-none hover:bg-surface-hover/60 focus-visible:ring-2 focus-visible:ring-accent/40`,title:E.task.title,onClick:zt,children:E.task.title})})}),jt===`title`?(0,L.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,L.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,L.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:Bt,children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,L.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,disabled:P.has(`title`),onClick:()=>void Vt(!0),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),(0,L.jsx)(`span`,{className:S(`shrink-0 rounded-full px-2.5 py-1 text-xs font-medium`,pt(nn)),children:rn})]}),(0,L.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-fg-muted`,children:[(0,L.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2`,children:[dn?(0,L.jsx)(Ce,{agentId:dn,avatar:fn?.avatar,size:20,className:`shrink-0`}):null,(0,L.jsxs)(`span`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:[C.executorLabel,` · `,fn?.name??dn??C.unassigned]})]}),(0,L.jsx)(`span`,{className:`text-fg-subtle`,children:C.updatedAt.replace(`{{date}}`,fe(E.task.updatedAt,l))})]}),(0,L.jsx)(`div`,{className:`mt-4 border-t border-edge-subtle pt-3`,children:Pn}),ye?(0,L.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:ye}):null]}),(0,L.jsxs)(`section`,{className:`min-w-0 p-5 sm:p-6`,children:[(0,L.jsxs)(`section`,{className:`mb-4 overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel shadow-surface`,children:[(0,L.jsxs)(`div`,{className:`border-b border-edge-subtle p-5`,children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:l===`zh`?`目标与验收`:`Goal and acceptance`}),J.length>0?(0,L.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:C.criteriaProgress.replace(`{{verified}}`,String(hn)).replace(`{{total}}`,String(J.length))}):null]}),(0,L.jsx)(N,{content:E.task.contract?.objective||E.task.title,contentKey:`${e}:goal`,language:l,markdown:!1,previewHeight:72,className:`mt-3 text-sm leading-6 text-fg`})]}),(0,L.jsxs)(`div`,{className:`p-5`,children:[(0,L.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:C.successDefinition}),J.length>0?(0,L.jsx)(`ul`,{className:`mt-3 space-y-3`,children:J.map((t,n)=>(0,L.jsxs)(`li`,{className:`flex items-start gap-2.5 text-sm leading-5 text-fg`,children:[(0,L.jsx)(t.status===`passed`?u:t.status===`failed`?xe:_e,{className:S(`mt-0.5 size-4 shrink-0`,t.status===`passed`?`text-success`:t.status===`failed`?`text-danger`:`text-fg-subtle`),"aria-hidden":!0}),(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(N,{content:t.text,contentKey:`${e}:criterion:${n}`,language:l,markdown:!1,previewHeight:60}),t.evidence.length>0?(0,L.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-x-2 text-xs leading-5 text-fg-muted`,children:[(0,L.jsx)(`span`,{children:l===`zh`?`依据:`:`Evidence:`}),t.evidence.map(e=>e.uri&&/^https?:\/\//.test(e.uri)?(0,L.jsx)(`a`,{className:`text-accent hover:underline`,href:e.uri,target:`_blank`,rel:`noreferrer`,children:e.title},e.title):(0,L.jsx)(`span`,{children:e.title},e.title))]}):null,t.review?(0,L.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[l===`zh`?`人工判定`:`Reviewed by user`,` · `,fe(t.review.reviewedAt,l)]}):null,t.method===`model_reviewed`?(0,L.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:l===`zh`?`模型审阅:${t.verificationStatus===`passed`?`通过`:t.verificationStatus===`failed`?`未通过`:`未核验`}`:`Model review: ${t.verificationStatus===`passed`?`passed`:t.verificationStatus===`failed`?`failed`:`unverified`}`}):null,t.note?(0,L.jsx)(N,{content:t.note,contentKey:`${e}:criterion-note:${n}`,language:l,markdown:!1,previewHeight:60,className:`mt-1 text-xs text-fg-muted`}):null]}),E.task.phase!==`closed`&&E.task.contract?.acceptancePolicy!==`verified_auto`?(0,L.jsxs)(we,{children:[(0,L.jsx)(Ie,{asChild:!0,children:(0,L.jsx)(O,{type:`button`,variant:`ghost`,className:`h-7 shrink-0 px-2 text-xs`,disabled:P.has(`acceptance`),children:l===`zh`?`判定`:`Review`})}),(0,L.jsx)(Oe,{children:(0,L.jsxs)(Me,{align:`end`,sideOffset:4,className:`z-[100] min-w-32 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,L.jsx)(Fe,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void Qt(n,`passed`),children:l===`zh`?`确认通过`:`Mark passed`}),(0,L.jsx)(Fe,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void Qt(n,`failed`),children:l===`zh`?`标记未通过`:`Mark failed`})]})})]}):null]},`${n}-${t.text}`))}):(0,L.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:C.noDefinition})]})]}),E.attention.length>0?(0,L.jsxs)(`section`,{className:S(`mb-4 rounded-xl border border-warning/20 bg-warning/10 p-4`,Q(`attention`)&&`task-detail-live-update`),children:[(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:mn?C.needsAttention:C.waitingStatus}),(0,L.jsx)(`ul`,{className:`mt-2 space-y-1.5 text-sm leading-6 text-fg-muted`,children:E.attention.map((t,n)=>(0,L.jsxs)(`li`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,L.jsx)(N,{content:t.summary,contentKey:`${e}:attention:${t.kind}:${n}`,language:l,markdown:!1,previewHeight:72,className:`min-w-0 flex-1`}),t.kind===`input_required`||t.kind===`approval_required`?(0,L.jsx)(s,{className:`inline-flex min-h-11 items-center rounded-lg bg-surface-panel px-3 text-sm font-medium text-accent`,to:b(e),children:l===`zh`?t.kind===`approval_required`?`查看并决定`:`补充信息`:t.kind===`approval_required`?`Review decision`:`Provide information`}):null]},`${t.kind}-${n}`))})]}):null,E.task.phase!==`closed`&&!tn&&E.waits.filter(e=>(e.kind===`user_input`||e.kind===`approval`&&typeof e.condition.capability==`string`)&&e.condition.type!==`connection`).map(e=>(0,L.jsx)(Ue,{wait:e,detail:E,zh:l===`zh`,onUpdated:e=>{A(e,{revalidate:!1})}},e.id)),(0,L.jsx)(`div`,{className:`mb-4`,children:(0,L.jsx)(Je,{taskId:e},e)}),gn.length>0||vn.length>0||Cn.length>0?(0,L.jsxs)(`section`,{className:`mb-4 rounded-xl border border-edge-subtle bg-surface-panel p-5 shadow-surface`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:l===`zh`?`交付物`:`Deliverables`}),gn.length>0||vn.length>0?(0,L.jsxs)(`ul`,{className:`mt-3 space-y-2`,children:[gn.map(t=>(0,L.jsxs)(`li`,{className:`rounded-lg bg-surface-hover p-3 text-sm`,children:[(0,L.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:C.contextKindLabels[t.targetKind]}),t.targetKind===`url`&&/^https?:\/\//.test(t.targetId)?(0,L.jsx)(N,{content:t.title??t.targetId,contentKey:`${e}:deliverable:${t.id}`,language:l,previewHeight:60,className:`mt-1`,children:(0,L.jsx)(`a`,{className:`block break-all text-accent hover:underline`,href:t.targetId,target:`_blank`,rel:`noreferrer`,children:t.title??t.targetId})}):(0,L.jsx)(N,{content:t.title??t.targetId,contentKey:`${e}:deliverable:${t.id}`,language:l,markdown:!1,previewHeight:60,className:`mt-1 text-fg`})]},t.id)),vn.map(t=>(0,L.jsxs)(`li`,{className:`rounded-lg bg-surface-hover p-3 text-sm`,children:[(0,L.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:l===`zh`?`执行产物`:`Run artifact`}),t.uri&&/^https?:\/\//.test(t.uri)?(0,L.jsx)(N,{content:t.title,contentKey:`${e}:artifact:${t.uri??t.title}`,language:l,previewHeight:60,className:`mt-1`,children:(0,L.jsx)(`a`,{className:`block break-all text-accent hover:underline`,href:t.uri,target:`_blank`,rel:`noreferrer`,children:t.title})}):(0,L.jsx)(N,{content:t.title,contentKey:`${e}:artifact:${t.uri??t.title}`,language:l,markdown:!1,previewHeight:60,className:`mt-1 text-fg`})]},t.uri??t.title))]}):(0,L.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:l===`zh`?`尚未关联交付物`:`No deliverables linked yet`}),Cn.length>0?(0,L.jsxs)(`div`,{className:`mt-4 border-t border-edge-subtle pt-3`,children:[(0,L.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:C.expectedOutputs}),(0,L.jsx)(`div`,{className:`mt-2`,children:(0,L.jsx)(mt,{contentKey:`${e}:expectedOutputs`,items:Cn,empty:C.noDefinition})})]}):null]}):null,(0,L.jsxs)(`section`,{className:`mb-4 rounded-xl border border-edge-subtle bg-surface-panel p-5 shadow-surface`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:l===`zh`?`关联内容`:`Related work`}),Z.length>0||E.runs.length>0||Sn.length>0||E.dependencies.length>0||E.dependents.length>0?(0,L.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[Z.length>0?(0,L.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,L.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:l===`zh`?`对话 · ${Z.length}`:`Conversations · ${Z.length}`}),(0,L.jsx)(We,{contentKey:`${e}:sessions`,language:l,className:`mt-2`,children:Z.map(t=>(0,L.jsx)(`li`,{children:(0,L.jsx)(s,{className:`block break-words [overflow-wrap:anywhere] text-sm text-accent hover:underline`,to:t.conversationId===X?b(e):`/chat/${encodeURIComponent(t.conversationId)}`,children:t.conversationId===X?l===`zh`?`当前执行对话`:`Current execution chat`:t.role===`discussion`?l===`zh`?`关联讨论`:`Linked discussion`:l===`zh`?`历史执行对话`:`Earlier execution chat`})},t.id))})]}):null,E.runs.length>0?(0,L.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,L.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:l===`zh`?`执行 · ${E.runs.length}`:`Runs · ${E.runs.length}`}),(0,L.jsxs)(`p`,{className:`mt-2 text-sm text-fg`,children:[l===`zh`?`最近执行:`:`Latest run: `,Y?C.receiptStatuses[Y.status]:rn]}),bn.length>0?(0,L.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:l===`zh`?`含 ${bn.length} 次工作流执行`:`${bn.length} workflow runs`}):null,xn.map(e=>(0,L.jsxs)(s,{className:`mt-1 block break-words [overflow-wrap:anywhere] text-xs text-accent hover:underline`,to:`/workflows/${encodeURIComponent(e)}`,children:[l===`zh`?`工作流:`:`Workflow: `,e]},e))]}):null,Sn.length>0?(0,L.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,L.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:l===`zh`?`自动化 · ${Sn.length}`:`Automations · ${Sn.length}`}),(0,L.jsx)(We,{contentKey:`${e}:automations`,language:l,className:`mt-2`,children:Sn.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsx)(s,{className:`block break-words [overflow-wrap:anywhere] text-sm text-accent hover:underline`,to:`/automations?automation=${encodeURIComponent(e.id)}`,children:e.name})},e.id))})]}):null,E.dependencies.length>0||E.dependents.length>0?(0,L.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,L.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:C.taskRelations}),(0,L.jsx)(`p`,{className:`mt-2 text-sm text-fg`,children:l===`zh`?`${E.dependencies.length} 个前置任务 · ${E.dependents.length} 个后续任务`:`${E.dependencies.length} prerequisites · ${E.dependents.length} dependents`})]}):null]}):(0,L.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:l===`zh`?`还没有关联内容`:`No related work yet`}),(0,L.jsx)(`div`,{className:`mt-4 border-t border-edge-subtle pt-3`,children:(0,L.jsx)(Ve,{resource:{kind:`task`,id:E.task.id,revision:String(E.task.version)},disabled:ht||yt||P.size>0})})]}),(0,L.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,L.jsxs)(`main`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface divide-y divide-edge-subtle`,children:[(0,L.jsxs)(`section`,{className:S(`p-5`,Q(`body`)&&`task-detail-live-update`),children:[(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:C.taskDescription}),yt?(0,L.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:bt,onChange:e=>xt(e.target.value),onBlur:()=>void Ht(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),Dt.current=!0,xt(E.task.body??E.task.contract?.objective??``),z(!1),queueMicrotask(()=>{Dt.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,L.jsxs)(`div`,{className:`mt-2`,children:[an&&an!==E.task.title?(0,L.jsx)(N,{content:an,contentKey:`${e}:description`,language:l}):(0,L.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:C.noTaskDescription}),(0,L.jsx)(`button`,{type:`button`,className:`mt-2 rounded-md px-2 py-1 text-xs text-accent hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=E.task.body??E.task.contract?.objective??``;Ot.current=e,kt.current={value:E.task.body??``,version:E.task.version},U(null),xt(e),z(!0)},children:l===`zh`?`编辑说明`:`Edit description`})]}),jt===`description`?(0,L.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,L.jsx)(`span`,{children:l===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,L.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{xt(E.task.body??``),U(null),z(!1)},children:l===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,L.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void q({body:bt.trim()||null}).then(e=>{e&&(U(null),z(!1))}),children:l===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),On?(0,L.jsxs)(`section`,{className:S(`p-5`,Q(`contract`)&&`task-detail-live-update`),children:[(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:C.taskDefinition}),(0,L.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:l===`zh`?`执行边界及补充背景`:`Execution boundaries and supporting context`}),wn.length>0?(0,L.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:C.constraints}),(0,L.jsx)(`div`,{className:`mt-3`,children:(0,L.jsx)(mt,{contentKey:`${e}:constraints`,items:wn,empty:C.noDefinition})})]}):null,Tn.length>0?(0,L.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:C.approvalRequired}),(0,L.jsx)(`div`,{className:`mt-3`,children:(0,L.jsx)(mt,{contentKey:`${e}:approvalRequired`,items:Tn,empty:C.noDefinition})})]}):null,En.length>0?(0,L.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:C.contextAssumptions}),(0,L.jsx)(`div`,{className:`mt-3`,children:(0,L.jsx)(mt,{contentKey:`${e}:assumptions`,items:En,empty:C.noDefinition})})]}):null,Dn.length>0?(0,L.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:C.contextRisks}),(0,L.jsx)(`div`,{className:`mt-3`,children:(0,L.jsx)(mt,{contentKey:`${e}:risks`,items:Dn,empty:C.noDefinition})})]}):null]}):null,Y?(0,L.jsxs)(`section`,{className:S(`p-5`,Q(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,L.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,L.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:C.latestResult}),(0,L.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:l===`zh`?Y.completionVerdict===`achieved`?`本次执行报告目标已达成,请结合下方验证依据验收。`:`这是阶段性结果,尚不能代表任务全部完成。`:Y.completionVerdict===`achieved`?`The run reports the goal achieved. Review the evidence below.`:`This is a partial result; the task is not yet fully complete.`})]}),(0,L.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[C.receiptStatuses[Y.status],` · `,C.verificationStatuses[Y.verification.status]]})]}),(0,L.jsx)(N,{content:Y.summary,contentKey:`${e}:result:${Y.runId}`,language:l,className:`mt-3`}),Y.remainingWork.length>0?(0,L.jsxs)(`div`,{className:`mt-4`,children:[(0,L.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:C.remainingWork}),(0,L.jsx)(`div`,{className:`mt-2`,children:(0,L.jsx)(mt,{contentKey:`${e}:remaining:${Y.runId}`,items:Y.remainingWork,empty:C.noRemainingWork})})]}):null,Y.nextAction?(0,L.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,L.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:C.nextAction}),(0,L.jsx)(N,{content:Y.nextAction,contentKey:`${e}:next:${Y.runId}`,language:l,markdown:!1,previewHeight:72,className:`mt-1 text-sm text-fg`})]}):null,(0,L.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,L.jsx)(O,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void y(Y.runId,`helpful`),children:C.doneWell}),(0,L.jsx)(O,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void y(Y.runId,`not_helpful`),children:C.needsFix})]}),(0,L.jsx)(qe,{evidence:Y.evidence,projectId:E.task.projectId,conversationId:X??void 0,language:l}),E.receipts.length>1?(0,L.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,L.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:C.executionHistory.replace(`{{count}}`,String(E.receipts.length-1))}),(0,L.jsx)(`div`,{className:`mt-3 space-y-3`,children:E.receipts.slice(1).map(t=>(0,L.jsx)(`article`,{className:`rounded-lg bg-surface-hover p-3`,children:(0,L.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,L.jsx)(N,{content:t.summary,contentKey:`${e}:result:${t.runId}`,language:l,className:`min-w-0 flex-1`}),(0,L.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:C.receiptStatuses[t.status]})]})},t.runId))})]}):null]}):null,yn.length>0?(0,L.jsxs)(`section`,{className:S(`p-5`,Q(`context`)&&`task-detail-live-update`),children:[(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:C.contextUsed}),(0,L.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:yn.map(e=>(0,L.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,L.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[C.contextRoleLabels[e.role],` · `,C.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,L.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,L.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,L.jsxs)(`aside`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface divide-y divide-edge-subtle`,children:[(0,L.jsxs)(`section`,{className:S(`p-5`,Q(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:C.taskProperties}),(0,L.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,L.jsx)(rt,{value:E.task.phase,disabled:P.has(`phase`),canMove:kn,canApprove:ln,canReopen:un,language:l,label:C.taskPhase,onChange:Ut}),(0,L.jsx)(it,{value:E.task.priority,disabled:P.has(`priority`),label:C.priority,labels:C.priorityLabels,onChange:Wt}),(0,L.jsx)(at,{value:$e(E.task.dueAt),disabled:P.has(`dueAt`),label:C.dueDate,onChange:Gt}),(0,L.jsx)(ot,{value:E.conversation.currentExecutorAgentId??``,disabled:P.has(`delegateAgentId`),label:C.executorLabel,unassignedLabel:C.unassigned,agents:tt,onChange:Xt})]})]}),(0,L.jsxs)(`section`,{className:S(`p-5`,Q(`dependencies`)&&`task-detail-live-update`),children:[(0,L.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:C.taskRelations}),(0,L.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:C.dependencies}),(0,L.jsx)(st,{candidates:Ge,selected:E.dependencies,disabled:P.has(`dependencies`),labels:It,getTaskHref:Rt,onChange:Yt})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:C.dependents}),E.dependents.length>0?(0,L.jsx)(`div`,{className:`space-y-1.5`,children:E.dependents.map(t=>(0,L.jsx)(N,{content:t.title,contentKey:`${e}:dependent:${t.id}`,language:l,previewHeight:72,className:`rounded-lg bg-surface-hover p-2.5`,children:(0,L.jsx)(s,{to:Rt(t.id),className:`block break-words [overflow-wrap:anywhere] text-sm text-fg-muted transition-colors hover:text-fg`,children:t.title})},t.id))}):(0,L.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:C.noDependents})]})]})]})]})]})]})]}),(0,L.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":l===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(B),tabIndex:0,onPointerDown:Jt,onKeyDown:qt,onDoubleClick:()=>Kt(lt),className:`group hidden w-2 shrink-0 cursor-col-resize touch-none items-stretch justify-center bg-surface-panel outline-none transition-colors hover:bg-surface-hover focus-visible:bg-surface-hover lg:flex ${Ct?`bg-surface-hover`:``}`,children:(0,L.jsx)(`div`,{className:`w-px bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,L.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 shrink-0 flex-col border-t border-edge-subtle bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:border-t-0`,children:[(0,L.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge-subtle px-4 py-3`,children:[(0,L.jsx)(`h2`,{className:`text-sm font-medium text-fg-muted`,children:l===`zh`?`执行对话`:`Execution chat`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[Z.length>1?(0,L.jsxs)(we,{children:[(0,L.jsx)(Ie,{asChild:!0,children:(0,L.jsx)(O,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,children:l===`zh`?`${Z.length} 段对话`:`${Z.length} conversations`})}),(0,L.jsx)(Oe,{children:(0,L.jsx)(Me,{align:`end`,sideOffset:6,className:`z-[100] min-w-52 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:Z.map(t=>(0,L.jsx)(Fe,{asChild:!0,children:(0,L.jsx)(s,{className:`block rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,to:t.conversationId===X?b(e):`/chat/${encodeURIComponent(t.conversationId)}`,children:t.conversationId===X?l===`zh`?`当前执行对话`:`Current execution chat`:t.role===`discussion`?l===`zh`?`关联讨论`:`Linked discussion`:l===`zh`?`历史执行对话`:`Earlier execution chat`})},t.id))})})]}):null,X?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(O,{type:`button`,variant:`ghost`,className:S(`size-8 p-0`,pn&&`bg-surface-hover text-fg`),"aria-label":l===`zh`?`项目文件`:`Project files`,"aria-pressed":pn,onClick:()=>{ue(X,!1),le(X)},children:(0,L.jsx)(re,{className:`size-4`,"aria-hidden":!0})}),(0,L.jsx)(O,{asChild:!0,variant:`ghost`,className:`size-8 p-0`,children:(0,L.jsx)(s,{to:b(e),"aria-label":l===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,L.jsx)(f,{className:`size-4`,"aria-hidden":!0})})})]}):null]})]}),X?(0,L.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,L.jsx)(je,{embedded:!0,conversationId:X,taskId:e})}):de?(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,L.jsxs)(`div`,{className:`max-w-xs`,children:[(0,L.jsx)(ve,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,L.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):pe?(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,L.jsxs)(`div`,{className:`max-w-xs`,children:[(0,L.jsx)(ve,{className:`mx-auto size-8 text-danger`}),(0,L.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,L.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:pe instanceof Error?pe.message:String(pe)})]})}):(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,L.jsxs)(`div`,{className:`max-w-xs`,children:[(0,L.jsx)(ve,{className:`mx-auto size-8 text-fg-subtle`}),(0,L.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:l===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,L.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:l===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]})]}),(0,L.jsx)(ke,{open:Pt,title:C.deleteTaskTitle,description:C.deleteTaskDescription.replace(`{{title}}`,E.task.title),confirmLabel:C.confirmDeleteTask,cancelLabel:C.keepTask,destructive:!0,onConfirm:()=>{Ft(!1),Zt()},onCancel:()=>Ft(!1)})]})}function vt(){let e=(0,F.c)(2),{taskId:t}=a(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,L.jsx)(_t,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function yt(e){let t=(0,F.c)(47),{taskId:n,backgroundPath:r,onClose:i}=e,a=ae(Tt),o=Re(wt),s=Re(Ct),c=Re(St),l=he(B),u=he(xt),d=o?s:0,f;t[0]!==i||t[1]!==u?(f=e=>{e||(u(null),i())},t[0]=i,t[1]=u,t[2]=f):f=t[2];let p=a===`zh`?`关闭任务详情`:`Close task details`,m;t[3]!==i||t[4]!==u?(m=()=>{u(null),i()},t[3]=i,t[4]=u,t[5]=m):m=t[5];let h;t[6]!==p||t[7]!==m?(h=(0,L.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45`,"aria-label":p,onClick:m}),t[6]=p,t[7]=m,t[8]=h):h=t[8];let g=o?`true`:`false`,_=`${d/2}px`,v=`${d}px`,y;t[9]!==_||t[10]!==v?(y={"--task-detail-workspace-offset":_,"--task-detail-workspace-width":v},t[9]=_,t[10]=v,t[11]=y):y=t[11];let ee=y,te=a===`zh`?`任务详情`:`Task details`,b;t[12]===te?b=t[13]:(b=(0,L.jsx)(ue,{className:`font-medium text-fg`,children:te}),t[12]=te,t[13]=b);let ne=a===`zh`?`查看并操作任务详情`:`View and manage task details`,x;t[14]===ne?x=t[15]:(x=(0,L.jsx)(oe,{className:`sr-only`,children:ne}),t[14]=ne,t[15]=x);let re=a===`zh`?`关闭任务详情`:`Close task details`,S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,L.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),t[16]=S):S=t[16];let C;t[17]===re?C=t[18]:(C=(0,L.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:(0,L.jsx)(se,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":re,children:S})}),t[17]=re,t[18]=C);let w;t[19]!==b||t[20]!==x||t[21]!==C?(w=(0,L.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[b,x,C]}),t[19]=b,t[20]=x,t[21]=C,t[22]=w):w=t[22];let T;t[23]!==i||t[24]!==u?(T=()=>{u(null),i()},t[23]=i,t[24]=u,t[25]=T):T=t[25];let D;t[26]!==r||t[27]!==T||t[28]!==n?(D=(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,L.jsx)(_t,{taskId:n,presentation:`modal`,backgroundPath:r,onDeleted:T})}),t[26]=r,t[27]=T,t[28]=n,t[29]=D):D=t[29];let O;t[30]!==w||t[31]!==D||t[32]!==g||t[33]!==ee?(O=(0,L.jsxs)(le,{className:`xopc-dialog-content task-detail-modal-content fixed top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay focus:outline-none`,"data-workspace-panel-open":g,style:ee,onEscapeKeyDown:bt,onInteractOutside:z,children:[w,D]}),t[30]=w,t[31]=D,t[32]=g,t[33]=ee,t[34]=O):O=t[34];let k;t[35]!==l||t[36]!==c||t[37]!==o||t[38]!==s?(k=l?(0,L.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-[100] flex min-h-0 min-w-0 overflow-hidden bg-surface-panel transition-[right] duration-200 ease-out motion-reduce:transition-none`,style:{right:o?s:0},children:(0,L.jsx)(pe,{allowOutsideChat:!0,conversationId:c??void 0})}):null,t[35]=l,t[36]=c,t[37]=o,t[38]=s,t[39]=k):k=t[39];let A;t[40]!==O||t[41]!==k||t[42]!==h?(A=(0,L.jsxs)(ce,{children:[h,O,k]}),t[40]=O,t[41]=k,t[42]=h,t[43]=A):A=t[43];let j;return t[44]!==f||t[45]!==A?(j=(0,L.jsx)(E,{modal:!1,open:!0,onOpenChange:f,children:A}),t[44]=f,t[45]=A,t[46]=j):j=t[46],j}function z(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function bt(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function xt(e){return e.setPath}function B(e){return e.path}function St(e){return e.conversationIdOverride}function Ct(e){return e.widthPx}function wt(e){return e.open}function Tt(e){return e.language}function Et(e){return(0,L.jsx)(l,{value:e.id,children:e.name||e.id},e.id)}function Dt(e){return e.id}export{yt as TaskDetailModal,vt as TaskDetailPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i}from"./chunk-KS7C4IRE--EKdQGRF.js";import{t as a}from"./markdown-view-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as i}from"./chunk-KS7C4IRE--EKdQGRF.js";import{t as a}from"./markdown-view-IsYTotu6.js";import{t as o}from"./cn-0WouolD0.js";import{d as s}from"./tasks-PuIUgF9L.js";function c(e){let t=e.task.contract?.acceptanceCriteria??[],n=new Map(e.runs.map(e=>[e.id,e])),r=e.receipts.filter(t=>n.get(t.runId)?.contractVersion===e.task.latestContractVersion).sort((e,t)=>t.finalizedAt-e.finalizedAt);return t.map((t,n)=>{let i=e.criterionReviews.find(r=>r.criterionIndex===n&&r.contractVersion===e.task.latestContractVersion&&r.criterionText===t),a={text:t,status:`unverified`,evidence:[]};for(let e of r){let n=e.verification.checks.find(e=>e.criterion===t);if(!n)continue;let r=e.evidence.filter(e=>n.evidenceTitles.includes(e.title)),i=n.status===`passed`&&s(e).has(t)?`passed`:n.status===`failed`?`failed`:`unverified`;a={text:t,status:i,evidence:r,runId:e.runId,verificationStatus:i,method:n.method,note:n.note};break}return i&&e.task.contract?.acceptancePolicy!==`verified_auto`?{...a,status:i.status,review:i}:e.task.contract?.acceptancePolicy===`manual`?{...a,status:`unverified`}:a})}var l=n(),u=e(t(),1),d=r();function f(e){let t=(0,l.c)(36),{content:n,contentKey:r,language:s,markdown:c,breaks:f,previewHeight:p,className:m,children:h}=e,g=c===void 0?!0:c,_=f===void 0?!1:f,v=p===void 0?240:p,y=(0,u.useId)(),b=(0,u.useRef)(null),[x,S]=(0,u.useState)(!1),[C,w]=i(),T;t[0]!==r||t[1]!==C?(T=C.getAll(`taskExpanded`).includes(r),t[0]=r,t[1]=C,t[2]=T):T=t[2];let E=T,D;t[3]===v?D=t[4]:(D=()=>{let e=b.current;if(!e)return;let t=()=>S(e.scrollHeight>v);if(t(),typeof ResizeObserver>`u`)return;let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},t[3]=v,t[4]=D);let O;t[5]!==n||t[6]!==v?(O=[n,v],t[5]=n,t[6]=v,t[7]=O):O=t[7],(0,u.useLayoutEffect)(D,O);let k=x&&!E,A;t[8]===m?A=t[9]:(A=o(`min-w-0`,m),t[8]=m,t[9]=A);let j;t[10]!==k||t[11]!==v?(j=k?{maxHeight:v,overflow:`hidden`,maskImage:`linear-gradient(to bottom, black calc(100% - ${Math.min(24,v/3)}px), transparent)`}:void 0,t[10]=k,t[11]=v,t[12]=j):j=t[12];let M;t[13]!==_||t[14]!==h||t[15]!==n||t[16]!==g?(M=h??(g?(0,d.jsx)(a,{content:n,compact:!0,breaks:_,className:`text-sm leading-6 text-fg`}):(0,d.jsx)(`p`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:n})),t[13]=_,t[14]=h,t[15]=n,t[16]=g,t[17]=M):M=t[17];let N;t[18]!==k||t[19]!==M?(N=(0,d.jsx)(`div`,{ref:b,inert:k,children:M}),t[18]=k,t[19]=M,t[20]=N):N=t[20];let P;t[21]!==y||t[22]!==N||t[23]!==j?(P=(0,d.jsx)(`div`,{id:y,style:j,children:N}),t[21]=y,t[22]=N,t[23]=j,t[24]=P):P=t[24];let F;t[25]!==r||t[26]!==E||t[27]!==y||t[28]!==s||t[29]!==x||t[30]!==w?(F=x?(0,d.jsx)(`button`,{type:`button`,"aria-expanded":E,"aria-controls":y,className:`mt-2 min-h-9 rounded-sm text-xs font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,onClick:()=>w(e=>{let t=new URLSearchParams(e),n=t.getAll(`taskExpanded`).filter(e=>e!==r);t.delete(`taskExpanded`);for(let e of n)t.append(`taskExpanded`,e);return E||t.append(`taskExpanded`,r),t},{preventScrollReset:!0}),children:s===`zh`?E?`收起`:`查看更多`:E?`Show less`:`Show more`}):null,t[25]=r,t[26]=E,t[27]=y,t[28]=s,t[29]=x,t[30]=w,t[31]=F):F=t[31];let I;return t[32]!==P||t[33]!==F||t[34]!==A?(I=(0,d.jsxs)(`div`,{className:A,children:[P,F]}),t[32]=P,t[33]=F,t[34]=A,t[35]=I):I=t[35],I}export{c as n,f as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e}from"./locale-store-
|
|
1
|
+
import{p as e}from"./locale-store-BpK9AiDq.js";import{t}from"./middleware-Pd0e8Igk.js";var n=`default`,r={light:{default:`#f7f8fa`,emerald:`#f0fdf4`,clay:`#fffaf0`,dawn:`#accdec`,porcelain:`#f6f0e7`},dark:{default:`#14171c`,emerald:`#000000`,clay:`#0a1a1a`,dawn:`#172433`,porcelain:`#211c19`}};function i(e,t){let n=document.head;if(!n)return;let i=n.querySelector(`meta[name="theme-color"][data-xopc-theme-color="true"]`);i||(i=document.createElement(`meta`),i.setAttribute(`name`,`theme-color`),i.setAttribute(`data-xopc-theme-color`,`true`),n.appendChild(i)),i.setAttribute(`content`,r[e][t])}function a(){return globalThis.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}function o(e){return e===`system`?a()?`dark`:`light`:e}function s(){return globalThis.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1}function c(e){return e==="default"||e===`emerald`||e===`clay`||e===`dawn`||e===`porcelain`?e:n}function l(e){window.electronAPI?.theme?.setPreference(e).catch(()=>{})}function u(e,t,n){let r=document.documentElement,a=()=>{r.classList.toggle(`dark`,e===`dark`),r.dataset.theme=e,r.dataset.colorScheme=t,i(e,t)},o=document;n&&!s()&&typeof o.startViewTransition==`function`?o.startViewTransition(a):a()}function d(){try{let e=localStorage.getItem(`xopc-web-theme`),t=`system`,r=n;if(e){let n=JSON.parse(e);n.state?.preference&&(t=n.state.preference),n.state&&`colorScheme`in n.state&&(r=c(n.state.colorScheme))}u(o(t),r,!1),l(t)}catch{u(o(`system`),`default`,!1)}}var f=e(t((e,t)=>({preference:`system`,colorScheme:n,resolved:o(`system`),setPreference:n=>{let r=o(n),{resolved:i,colorScheme:a}=t();u(r,a,r!==i),e({preference:n,resolved:r}),l(n)},setColorScheme:n=>{let{resolved:r}=t();u(r,n,!0),e({colorScheme:n})}}),{name:`xopc-web-theme`,merge:(e,t)=>{let n=e??{};return{...t,...n,colorScheme:c(n.colorScheme)}}}));function p(){let{preference:e,colorScheme:t}=f.getState(),n=o(e);u(n,t,!1),f.setState({resolved:n}),l(e)}function m(){let e=globalThis.matchMedia?.(`(prefers-color-scheme: dark)`);if(!e)return()=>{};let t=()=>{let{preference:e,colorScheme:t}=f.getState();if(e!==`system`)return;let n=o(`system`),r=f.getState().resolved;u(n,t,n!==r),f.setState({resolved:n})};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)}export{f as i,m as n,p as r,d as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./popover-select-DHC7J4lG.js";import{t as ee}from"./secret-input-BxWHx6J6.js";import{a,n as te,r as o}from"./locale-store-Dr43FCty.js";import{a as ne,i as re,n as ie,o as ae,r as oe,s as se,t as ce}from"./dist-BGTk37IG.js";import{i as s}from"./vendor-swr-BIWyz7Rc.js";import{t as c}from"./button-aIC072nz.js";import{t as l}from"./skeleton-BI5TyibZ.js";import{t as u}from"./number-input-DDeqHK-G.js";import{n as le,r as ue}from"./settings-page-layout-Dx5S-Msc.js";import{n as d,t as f}from"./use-autosave-CzyqRffr.js";var p=e(t(),1),m=n(),h=e=>o(`/api/observability/${e}`);async function g(e,t=`GET`,n){return a(h(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}})}var _=r(),v=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,y=`space-y-4 rounded-xl border border-edge bg-surface-panel p-4`,b=(e=0)=>`${(e/1048576).toFixed(1)} MiB`;function x(){let e=(0,m.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,_.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-4`,children:[(0,_.jsx)(l,{className:`h-48 rounded-xl`}),(0,_.jsx)(l,{className:`h-64 rounded-xl`})]}),e[0]=t):t=e[0],t}function de(e,t){let n=0,r=e,i=new Set;for(;r.parentSpanId&&n<12&&!i.has(r.spanId);){i.add(r.spanId);let e=t.find(e=>e.spanId===r.parentSpanId);if(!e)break;r=e,n++}return n}function fe(e){let t=[],n=new Set;function r(i){n.has(i.spanId)||(n.add(i.spanId),t.push(i),e.filter(e=>e.parentSpanId===i.spanId).forEach(r))}return e.filter(t=>!t.parentSpanId||!e.some(e=>e.spanId===t.parentSpanId)).forEach(r),e.forEach(r),t}function pe(){let e=te(e=>e.language)===`zh`,t=(t,n)=>e?n:t,n=s(h(`tracing/settings`),()=>g(`tracing/settings`)),r=s(h(`tracing/status`),()=>g(`tracing/status`),{refreshInterval:1e4}),[a,o]=(0,p.useState)(),[m,pe]=(0,p.useState)(),S=a??m??n.data?.config,[C,w]=(0,p.useState)(``),[T,E]=(0,p.useState)(``),[me,he]=(0,p.useState)(0),[D,ge]=(0,p.useState)(!1),[O,k]=(0,p.useState)(``),[_e,A]=(0,p.useState)(!1),[j,ve]=(0,p.useState)(``),[M,ye]=(0,p.useState)(`7`),[N,be]=(0,p.useState)({conversationId:``,runId:``,agentId:``}),[P,F]=(0,p.useState)(`records`),[I,xe]=(0,p.useState)(`10`),[Se,L]=(0,p.useState)([``]),[R,z]=(0,p.useState)(0),[Ce,we]=(0,p.useState)(()=>Date.now()+1),B=Se[R],[V,H]=(0,p.useState)();function U(){L([``]),z(0),we(Date.now()+1)}let[Te,W]=(0,p.useState)(!1),G=new URLSearchParams({limit:I,from:String(Ce-Number(M)*864e5),to:String(Ce)});j&&G.set(`status`,j),B&&G.set(`cursor`,B);for(let[e,t]of Object.entries(N))t&&G.set(e,t);let Ee=`traces?${G}`,K=s(h(Ee),()=>g(Ee),{refreshInterval:B?0:1e4}),q=s(V?h(`traces/${V}`):null,()=>g(`traces/${V}`));function J(e){if(!S)return;let t=structuredClone(S);e(t),o(t)}async function Y(e,i=t(`Saved`,`已保存`)){ge(!0),k(``),A(!1);try{await e(),k(i),await Promise.all([n.mutate(),r.mutate(),K.mutate()])}catch(e){A(!0),k(e instanceof Error?e.message:t(`Request failed`,`操作失败`))}finally{ge(!1)}}let X=f({value:S??null,dirty:!!(a&&JSON.stringify(a)!==JSON.stringify(m??n.data?.config)),validate:e=>{if([[`retentionDays`,1,90],[`maxStoreMiB`,16,4096],[`maxTraces`,10,1e5],[`maxSpans`,100,1e6],[`maxTraceKiB`,16,4096],[`maxWriteMiBPerMinute`,1,100]].some(([t,n,r])=>!Number.isInteger(e.local[t])||e.local[t]<n||e.local[t]>r))return t(`Enter valid storage limits before continuing.`,`请填写有效的存储限额。`);try{let t=new URL(e.langfuse.baseUrl);if(![`http:`,`https:`].includes(t.protocol)||e.langfuse.baseUrl.length>2048)throw Error()}catch{return t(`Enter a valid HTTP(S) Base URL.`,`请填写有效的 HTTP(S) Base URL。`)}return null},onSave:async e=>{pe((await g(`tracing/settings`,`PATCH`,e)).config),o(t=>t&&JSON.stringify(t)===JSON.stringify(e)?void 0:t),await r.mutate().catch(()=>{})}}),Z=(0,p.useMemo)(()=>({publicKey:C.trim(),secretKey:T.trim()}),[C,T]),Q=f({value:Z,dirty:!!(Z.publicKey||Z.secretKey),delayMs:1e3,validate:e=>e.publicKey.length>512||e.secretKey.length>512?t(`Credentials must be at most 512 characters.`,`凭证长度不能超过 512 个字符。`):null,onSave:async e=>{await g(`tracing/langfuse/credentials`,`PUT`,{...e.publicKey?{publicKey:e.publicKey}:{},...e.secretKey?{secretKey:e.secretKey}:{}}),w(t=>t.trim()===e.publicKey?``:t),E(t=>t.trim()===e.secretKey?``:t),he(e=>e+1),await Promise.allSettled([n.mutate(),r.mutate()])}}),$=[X.status,Q.status].some(e=>e===`dirty`||e===`saving`);async function De(){V&&await Y(async()=>{let e=await g(`traces/${V}/export`),t=URL.createObjectURL(new Blob([JSON.stringify(e,null,2)],{type:`application/json`})),n=document.createElement(`a`);n.href=t,n.download=`trace-${V}.json`,n.click(),URL.revokeObjectURL(t)},t(`Exported`,`已导出`))}return(0,_.jsxs)(ue,{className:`space-y-6`,children:[(0,_.jsx)(le,{title:t(`Runtime tracing`,`运行追踪`),subtitle:t(`Local diagnostics with bounded retention. Enable Langfuse to also export new traces.`,`默认保留有界本地记录;启用 Langfuse 后同时导出新采集的追踪。`),actions:P===`settings`?(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,_.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t(`Changes save automatically`,`修改后自动保存`)}),(0,_.jsx)(d,{status:X.status,error:X.error})]}):(0,_.jsx)(c,{disabled:K.isValidating,onClick:U,children:t(`Refresh records`,`刷新记录`)})}),O&&(0,_.jsx)(`p`,{role:_e?`alert`:`status`,className:`text-sm text-fg-muted`,children:O}),n.error&&(0,_.jsx)(`p`,{role:`alert`,children:String(n.error.message)}),(0,_.jsxs)(`nav`,{"aria-label":t(`Tracing sections`,`追踪页面分区`),className:`flex gap-2 border-b border-edge pb-3`,children:[(0,_.jsx)(c,{"aria-pressed":P===`records`,variant:P===`records`?`primary`:`ghost`,onClick:()=>F(`records`),children:t(`Execution records`,`执行记录`)}),(0,_.jsx)(c,{"aria-pressed":P===`settings`,variant:P===`settings`?`primary`:`ghost`,onClick:()=>F(`settings`),children:t(`Capture settings`,`采集设置`)})]}),P===`settings`&&(S?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`section`,{className:y,onBlurCapture:X.onBlurCapture,children:[(0,_.jsx)(`h2`,{className:`font-medium`,children:t(`Local recording`,`本地记录`)}),X.error&&(0,_.jsx)(c,{variant:`ghost`,onClick:X.retry,children:t(`Retry autosave`,`重试自动保存`)}),(0,_.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(`input`,{type:`checkbox`,checked:S.enabled,onChange:e=>J(t=>{t.enabled=e.target.checked})}),t(`Record traces`,`记录运行追踪`)]}),(0,_.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,_.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Retention (days)`,`保留天数`),(0,_.jsx)(u,{className:v,type:`number`,min:1,max:90,value:S.local.retentionDays,onChange:e=>J(t=>{t.local.retentionDays=Number(e.target.value)})})]}),(0,_.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Storage budget (MiB)`,`存储上限(MiB)`),(0,_.jsx)(u,{className:v,type:`number`,min:16,max:4096,value:S.local.maxStoreMiB,onChange:e=>J(t=>{t.local.maxStoreMiB=Number(e.target.value)})})]}),(0,_.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Capture`,`采集内容`),(0,_.jsx)(i,{placeholder:t(`Choose`,`请选择`),allowEmpty:!1,value:S.capture,onChange:e=>J(t=>{t.capture=e}),options:[{value:`metadata`,label:t(`Metadata only`,`仅元数据`)},{value:`redacted`,label:t(`Redacted previews`,`脱敏摘要`)},{value:`detailed`,label:t(`Detailed · 30 minutes`,`详细记录 · 30 分钟`)}]})]})]}),(0,_.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t(`Previews may contain personal content. Secrets and media are filtered; large values are truncated.`,`摘要可能包含个人内容。过滤凭证和媒体,超长内容会截断。`)}),S.detailedUntil&&(0,_.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[t(`Detailed capture expires: `,`详细采集截止:`),new Date(S.detailedUntil).toLocaleString()]}),(0,_.jsxs)(`details`,{children:[(0,_.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:t(`Advanced limits`,`高级限制`)}),(0,_.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[[`maxTraces`,t(`Trace count`,`Trace 条数`)],[`maxSpans`,t(`Span count`,`Span 条数`)],[`maxTraceKiB`,t(`Per trace (KiB)`,`单 Trace 上限(KiB)`)],[`maxWriteMiBPerMinute`,t(`Write budget (MiB/minute)`,`写入额度(MiB/分钟)`)]].map(([e,t])=>(0,_.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t,(0,_.jsx)(u,{type:`number`,min:1,className:v,value:S.local[e],onChange:t=>J(n=>{n.local[e]=Number(t.target.value)})})]},e))})]}),r.data?(0,_.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[t(`Disk / payload`,`磁盘 / 数据`),`:`,b(r.data.local.physicalBytes),` / `,b(r.data.local.bytes),` · `,r.data.local.traces??0,` traces · `,r.data.local.spans??0,` spans · `,t(`Dropped`,`丢弃`),` `,Number(r.data.local.dropped??0)+Number(r.data.local.queueDropped??0),(r.data.local.paused||r.data.local.unavailable)&&` · ${t(`Recording paused`,`存储暂停`)}`]}):(0,_.jsx)(l,{className:`h-10`}),(r.error||r.data?.local.lastError)&&(0,_.jsx)(`p`,{role:`alert`,className:`text-sm`,children:r.data?.local.lastError||String(r.error.message)}),(0,_.jsxs)(`div`,{className:`flex gap-2`,children:[(0,_.jsx)(c,{disabled:D||$,onClick:()=>void Y(async()=>{await g(`traces/prune`,`POST`)}),children:t(`Clean expired`,`清理过期记录`)}),(0,_.jsx)(c,{disabled:D,onClick:()=>W(!0),children:t(`Clear local traces`,`清空本地追踪`)})]})]}),(0,_.jsxs)(`section`,{className:y,children:[(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,_.jsx)(`h2`,{className:`font-medium`,children:`Langfuse`}),(0,_.jsx)(d,{status:Q.status,error:Q.error})]}),Q.error&&(0,_.jsx)(c,{variant:`ghost`,onClick:Q.retry,children:t(`Retry autosave`,`重试自动保存`)}),(0,_.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(`input`,{type:`checkbox`,checked:S.langfuse.enabled,onBlur:X.onBlurCapture,onChange:e=>J(t=>{t.langfuse.enabled=e.target.checked})}),t(`Also export new traces to Langfuse`,`同时导出新采集的追踪到 Langfuse`)]}),(0,_.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,_.jsxs)(`label`,{className:`space-y-1 text-sm sm:col-span-2`,children:[`Base URL`,(0,_.jsx)(`input`,{className:v,type:`url`,value:S.langfuse.baseUrl,onBlur:X.onBlurCapture,onChange:e=>J(t=>{t.langfuse.baseUrl=e.target.value})})]}),[`publicKey`,`secretKey`].map(e=>{let r=e===`publicKey`?`Public Key`:`Secret Key`,i=e===`publicKey`?C:T,a=n.data?.credentials[e===`publicKey`?`publicKeyConfigured`:`secretKeyConfigured`];return(0,_.jsxs)(`div`,{className:`space-y-1 text-sm`,onBlurCapture:Q.onBlurCapture,children:[(0,_.jsx)(`label`,{htmlFor:`langfuse-${e}`,children:r}),(0,_.jsx)(ee,{id:`langfuse-${e}`,value:i||(a?`••••••••••••`:``),allowUnrevealedCopy:!0,onChange:t=>(e===`publicKey`?w:E)(t.replace(/^•+/,``)),placeholder:e===`publicKey`?`pk-lf-…`:`sk-lf-…`,labels:{show:t(`Show ${r}`,`查看 ${r}`),hide:t(`Hide ${r}`,`隐藏 ${r}`),copy:t(`Copy ${r}`,`复制 ${r}`),copied:t(`Copied`,`已复制`)},reveal:()=>g(`tracing/langfuse/credentials/${e}/reveal`,`POST`).then(e=>e.key),loadFailedLabel:t(`Unable to load the configured key.`,`无法读取已配置的 Key。`),notInConfigFile:t(`No configured key is available.`,`暂无已配置的 Key。`)},me)]},e)})]}),(0,_.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[t(`Credential sources`,`凭证来源`),`:`,n.data?.credentials.publicKeySource,` / `,n.data?.credentials.secretKeySource,` · URL: `,n.data?.credentials.baseUrlSource]}),r.data&&(0,_.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[r.data.langfuse.state,` · `,t(`Pending`,`待发送`),` `,r.data.langfuse.pending,` · `,t(`Dropped`,`丢弃`),` `,r.data.langfuse.dropped,r.data.langfuse.lastSuccess?` · ${new Date(r.data.langfuse.lastSuccess).toLocaleString()}`:``]}),r.data?.langfuse.lastError&&(0,_.jsx)(`p`,{role:`alert`,className:`text-sm`,children:r.data.langfuse.lastError}),(0,_.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t(`Changes save automatically. Historical traces are not uploaded. Offline exports may be dropped.`,`修改后自动保存。不会上传历史记录;断网或队列满时可能丢弃远端导出。`)}),(0,_.jsxs)(`div`,{className:`flex gap-2`,children:[(0,_.jsx)(c,{disabled:D||$,onClick:()=>void Y(async()=>{if(!(await g(`tracing/langfuse/test`,`POST`)).ok)throw Error(t(`Connection test failed. Check saved configuration and credentials.`,`连接测试失败,请检查已保存的配置和凭证。`))},t(`Diagnostic trace accepted by the ingestion endpoint`,`采集端已接受诊断追踪`)),children:t(`Test connection`,`测试连接`)}),(0,_.jsx)(c,{disabled:D||$,onClick:()=>void Y(async()=>{await g(`tracing/langfuse/credentials`,`DELETE`),w(``),E(``),he(e=>e+1)}),children:t(`Remove saved credentials`,`移除已保存凭证`)})]})]})]}):(0,_.jsx)(x,{})),P===`records`&&(0,_.jsxs)(`section`,{className:y,children:[(0,_.jsx)(`h2`,{className:`font-medium`,children:t(`Recent runs`,`最近执行`)}),(0,_.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,_.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Status`,`执行状态`),(0,_.jsx)(i,{placeholder:t(`All statuses`,`全部状态`),allowEmpty:!1,value:j,onChange:e=>{ve(e),U()},options:[{value:``,label:t(`All statuses`,`全部状态`)},...[`running`,`success`,`error`,`cancelled`,`suspended`,`interrupted`].map(e=>({value:e,label:t(e,{running:`运行中`,success:`成功`,error:`失败`,cancelled:`已取消`,suspended:`已暂停`,interrupted:`已中断`}[e])}))]})]}),(0,_.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Time range`,`时间范围`),(0,_.jsx)(i,{placeholder:t(`Choose`,`请选择`),value:M,allowEmpty:!1,onChange:e=>{ye(e),U()},options:[`1`,`7`,`30`,`90`].map(e=>({value:e,label:`${e} ${t(`days`,`天`)}`}))})]}),(0,_.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Page size`,`每页条数`),(0,_.jsx)(i,{placeholder:t(`Choose`,`请选择`),value:I,allowEmpty:!1,onChange:e=>{xe(e),U()},options:[`10`,`20`].map(e=>({value:e,label:`${e} ${t(`records`,`条`)}`}))})]})]}),(0,_.jsxs)(`details`,{children:[(0,_.jsxs)(`summary`,{className:`cursor-pointer text-sm text-fg-muted`,children:[t(`Advanced filters`,`高级筛选`),Object.values(N).some(Boolean)?` · ${t(`Active`,`已启用`)}`:``]}),(0,_.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-3`,children:[`conversationId`,`runId`,`agentId`].map(e=>(0,_.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[{conversationId:t(`Conversation ID`,`会话 ID`),runId:t(`Run ID`,`执行 ID`),agentId:t(`Agent ID`,`Agent ID`)}[e],(0,_.jsx)(`input`,{"aria-label":e,placeholder:t(`Exact ID`,`输入完整 ID`),className:v,value:N[e],onChange:t=>{be({...N,[e]:t.target.value}),U()}})]},e))})]}),(0,_.jsxs)(`div`,{role:`region`,"aria-label":t(`Execution results`,`执行结果`),"aria-busy":K.isValidating,className:`h-[24rem] min-h-0 overflow-y-auto overscroll-contain rounded-lg border border-edge sm:h-[28rem]`,children:[K.error&&(0,_.jsx)(`p`,{role:`alert`,className:`p-4 text-sm`,children:K.error.message}),!K.data&&!K.error?(0,_.jsx)(`div`,{className:`space-y-3 p-3`,children:[0,1,2,3,4].map(e=>(0,_.jsx)(l,{className:`h-16`},e))}):(0,_.jsxs)(`div`,{className:`divide-y divide-edge`,children:[K.data?.traces.length===0&&(0,_.jsx)(`p`,{className:`flex h-48 items-center justify-center px-4 text-sm text-fg-muted`,children:t(`No traces in this range`,`此时间范围内暂无记录`)}),K.data?.traces.map(n=>(0,_.jsxs)(`button`,{onClick:()=>H(n.traceId),className:`flex w-full flex-col gap-2 px-3 py-3 text-left text-sm hover:bg-surface-hover sm:flex-row sm:items-center sm:justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`p`,{className:`truncate font-medium`,children:[n.name,n.attributes[`xopc.agentId`]?` · ${n.attributes[`xopc.agentId`]}`:``]}),(0,_.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[new Date(n.startedAt).toLocaleString(e?`zh-CN`:`en-US`),` · `,n.traceId]}),n.stats&&(0,_.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[n.stats.generations,` `,t(`model calls`,`次模型调用`),` · `,n.stats.tokens,` tokens · $`,n.stats.knownCostUsd.toFixed(4),n.stats.unknownCostCalls>0?` · ${t(`partial cost`,`部分成本未知`)}`:``]})]}),(0,_.jsxs)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:[t(n.status,{running:`运行中`,success:`成功`,error:`失败`,cancelled:`已取消`,suspended:`已暂停`,interrupted:`已中断`}[n.status]??n.status),` · `,n.endedAt?`${Math.round(n.endedAt-n.startedAt)} ms`:`—`,n.partialReason?` · ${t(`Partial`,`部分记录`)}`:``]})]},n.traceId))]})]}),(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,_.jsx)(`p`,{"aria-live":`polite`,className:`text-xs text-fg-muted`,children:t(`Page ${R+1} · ${K.data?.traces.length??0} records`,`第 ${R+1} 页 · ${K.data?.traces.length??0} 条`)}),(0,_.jsxs)(`div`,{className:`flex gap-2`,children:[(0,_.jsx)(c,{disabled:R===0||K.isValidating,onClick:()=>z(e=>Math.max(0,e-1)),children:t(`Previous page`,`上一页`)}),(0,_.jsx)(c,{disabled:!K.data?.nextCursor||K.isValidating,onClick:()=>{let e=K.data?.nextCursor;e&&(L(t=>[...t.slice(0,R+1),e]),z(e=>e+1))},children:t(`Next page`,`下一页`)})]})]})]}),(0,_.jsx)(ce,{open:!!V,onOpenChange:e=>{e||H(void 0)},children:(0,_.jsxs)(ae,{children:[(0,_.jsx)(ne,{className:`fixed inset-0 z-[90] bg-black/40`}),(0,_.jsxs)(oe,{className:`fixed left-1/2 top-1/2 z-[91] flex h-[min(44rem,calc(100vh-2rem))] w-[min(64rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-4`,children:[(0,_.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3`,children:[(0,_.jsx)(se,{className:`font-medium`,children:t(`Trace details`,`追踪详情`)}),(0,_.jsx)(ie,{asChild:!0,children:(0,_.jsx)(c,{children:t(`Close`,`关闭`)})})]}),(0,_.jsx)(re,{className:`shrink-0 truncate text-xs text-fg-muted`,children:V}),(0,_.jsx)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto py-4`,children:q.error?(0,_.jsx)(`p`,{role:`alert`,children:q.error.message}):q.data?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`p`,{className:`text-sm`,children:[q.data.trace.status,` `,q.data.trace.partialReason&&` · ${q.data.trace.partialReason}`]}),fe(q.data.spans).map(e=>(0,_.jsxs)(`details`,{style:{marginLeft:de(e,q.data.spans)*12},className:`rounded-lg border border-edge p-3 text-sm`,children:[(0,_.jsxs)(`summary`,{className:`cursor-pointer`,children:[e.name,` · `,e.status,` · `,e.endedAt?`${Math.round(e.endedAt-e.startedAt)} ms`:`—`]}),(0,_.jsx)(`pre`,{className:`mt-3 whitespace-pre-wrap break-all text-xs text-fg-muted`,children:JSON.stringify(e.attributes,null,2)})]},e.spanId))]}):(0,_.jsx)(x,{})}),(0,_.jsx)(`div`,{className:`shrink-0 border-t border-edge pt-3`,children:(0,_.jsx)(c,{disabled:!q.data||D,onClick:()=>void De(),children:t(`Export JSON`,`导出 JSON`)})})]})]})}),(0,_.jsx)(ce,{open:Te,onOpenChange:W,children:(0,_.jsxs)(ae,{children:[(0,_.jsx)(ne,{className:`fixed inset-0 z-[90] bg-black/40`}),(0,_.jsxs)(oe,{className:`fixed left-1/2 top-1/2 z-[91] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 space-y-4 rounded-xl border border-edge bg-surface-overlay p-5`,children:[(0,_.jsx)(se,{children:t(`Clear local traces?`,`清空本地追踪?`)}),(0,_.jsx)(re,{className:`text-sm text-fg-muted`,children:t(`Removes retained local traces. Conversations, usage records and Langfuse data remain available.`,`删除已保留的本地追踪。会话、用量记录及 Langfuse 数据仍保留。`)}),(0,_.jsxs)(`div`,{className:`flex gap-2`,children:[(0,_.jsx)(c,{disabled:D||$,onClick:()=>void Y(async()=>{await g(`traces`,`DELETE`),W(!1),H(void 0)}),children:t(`Clear`,`清空`)}),(0,_.jsx)(ie,{asChild:!0,children:(0,_.jsx)(c,{children:t(`Cancel`,`取消`)})})]})]})]})})]})}export{pe as TracingSettingsPage};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./popover-select-DHC7J4lG.js";import{t as ee}from"./secret-input-BxWHx6J6.js";import{a,n as te,r as o}from"./locale-store-BpK9AiDq.js";import{a as ne,i as re,n as ie,o as ae,r as oe,s as se,t as ce}from"./dist-BGTk37IG.js";import{i as s}from"./vendor-swr-BIWyz7Rc.js";import{t as c}from"./button-aIC072nz.js";import{t as l}from"./skeleton-BI5TyibZ.js";import{t as u}from"./number-input-DDeqHK-G.js";import{n as le,r as ue}from"./settings-page-layout-Dx5S-Msc.js";import{n as d,t as f}from"./use-autosave-DDjIdW4U.js";var p=e(t(),1),m=n(),h=e=>o(`/api/observability/${e}`);async function g(e,t=`GET`,n){return a(h(e),{method:t,...n===void 0?{}:{body:JSON.stringify(n)}})}var _=r(),v=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,y=`space-y-4 rounded-xl border border-edge bg-surface-panel p-4`,b=(e=0)=>`${(e/1048576).toFixed(1)} MiB`;function x(){let e=(0,m.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,_.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-4`,children:[(0,_.jsx)(l,{className:`h-48 rounded-xl`}),(0,_.jsx)(l,{className:`h-64 rounded-xl`})]}),e[0]=t):t=e[0],t}function de(e,t){let n=0,r=e,i=new Set;for(;r.parentSpanId&&n<12&&!i.has(r.spanId);){i.add(r.spanId);let e=t.find(e=>e.spanId===r.parentSpanId);if(!e)break;r=e,n++}return n}function fe(e){let t=[],n=new Set;function r(i){n.has(i.spanId)||(n.add(i.spanId),t.push(i),e.filter(e=>e.parentSpanId===i.spanId).forEach(r))}return e.filter(t=>!t.parentSpanId||!e.some(e=>e.spanId===t.parentSpanId)).forEach(r),e.forEach(r),t}function pe(){let e=te(e=>e.language)===`zh`,t=(t,n)=>e?n:t,n=s(h(`tracing/settings`),()=>g(`tracing/settings`)),r=s(h(`tracing/status`),()=>g(`tracing/status`),{refreshInterval:1e4}),[a,o]=(0,p.useState)(),[m,pe]=(0,p.useState)(),S=a??m??n.data?.config,[C,w]=(0,p.useState)(``),[T,E]=(0,p.useState)(``),[me,he]=(0,p.useState)(0),[D,ge]=(0,p.useState)(!1),[O,k]=(0,p.useState)(``),[_e,A]=(0,p.useState)(!1),[j,ve]=(0,p.useState)(``),[M,ye]=(0,p.useState)(`7`),[N,be]=(0,p.useState)({conversationId:``,runId:``,agentId:``}),[P,F]=(0,p.useState)(`records`),[I,xe]=(0,p.useState)(`10`),[Se,L]=(0,p.useState)([``]),[R,z]=(0,p.useState)(0),[Ce,we]=(0,p.useState)(()=>Date.now()+1),B=Se[R],[V,H]=(0,p.useState)();function U(){L([``]),z(0),we(Date.now()+1)}let[Te,W]=(0,p.useState)(!1),G=new URLSearchParams({limit:I,from:String(Ce-Number(M)*864e5),to:String(Ce)});j&&G.set(`status`,j),B&&G.set(`cursor`,B);for(let[e,t]of Object.entries(N))t&&G.set(e,t);let Ee=`traces?${G}`,K=s(h(Ee),()=>g(Ee),{refreshInterval:B?0:1e4}),q=s(V?h(`traces/${V}`):null,()=>g(`traces/${V}`));function J(e){if(!S)return;let t=structuredClone(S);e(t),o(t)}async function Y(e,i=t(`Saved`,`已保存`)){ge(!0),k(``),A(!1);try{await e(),k(i),await Promise.all([n.mutate(),r.mutate(),K.mutate()])}catch(e){A(!0),k(e instanceof Error?e.message:t(`Request failed`,`操作失败`))}finally{ge(!1)}}let X=f({value:S??null,dirty:!!(a&&JSON.stringify(a)!==JSON.stringify(m??n.data?.config)),validate:e=>{if([[`retentionDays`,1,90],[`maxStoreMiB`,16,4096],[`maxTraces`,10,1e5],[`maxSpans`,100,1e6],[`maxTraceKiB`,16,4096],[`maxWriteMiBPerMinute`,1,100]].some(([t,n,r])=>!Number.isInteger(e.local[t])||e.local[t]<n||e.local[t]>r))return t(`Enter valid storage limits before continuing.`,`请填写有效的存储限额。`);try{let t=new URL(e.langfuse.baseUrl);if(![`http:`,`https:`].includes(t.protocol)||e.langfuse.baseUrl.length>2048)throw Error()}catch{return t(`Enter a valid HTTP(S) Base URL.`,`请填写有效的 HTTP(S) Base URL。`)}return null},onSave:async e=>{pe((await g(`tracing/settings`,`PATCH`,e)).config),o(t=>t&&JSON.stringify(t)===JSON.stringify(e)?void 0:t),await r.mutate().catch(()=>{})}}),Z=(0,p.useMemo)(()=>({publicKey:C.trim(),secretKey:T.trim()}),[C,T]),Q=f({value:Z,dirty:!!(Z.publicKey||Z.secretKey),delayMs:1e3,validate:e=>e.publicKey.length>512||e.secretKey.length>512?t(`Credentials must be at most 512 characters.`,`凭证长度不能超过 512 个字符。`):null,onSave:async e=>{await g(`tracing/langfuse/credentials`,`PUT`,{...e.publicKey?{publicKey:e.publicKey}:{},...e.secretKey?{secretKey:e.secretKey}:{}}),w(t=>t.trim()===e.publicKey?``:t),E(t=>t.trim()===e.secretKey?``:t),he(e=>e+1),await Promise.allSettled([n.mutate(),r.mutate()])}}),$=[X.status,Q.status].some(e=>e===`dirty`||e===`saving`);async function De(){V&&await Y(async()=>{let e=await g(`traces/${V}/export`),t=URL.createObjectURL(new Blob([JSON.stringify(e,null,2)],{type:`application/json`})),n=document.createElement(`a`);n.href=t,n.download=`trace-${V}.json`,n.click(),URL.revokeObjectURL(t)},t(`Exported`,`已导出`))}return(0,_.jsxs)(ue,{className:`space-y-6`,children:[(0,_.jsx)(le,{title:t(`Runtime tracing`,`运行追踪`),subtitle:t(`Local diagnostics with bounded retention. Enable Langfuse to also export new traces.`,`默认保留有界本地记录;启用 Langfuse 后同时导出新采集的追踪。`),actions:P===`settings`?(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,_.jsx)(`span`,{className:`text-xs text-fg-muted`,children:t(`Changes save automatically`,`修改后自动保存`)}),(0,_.jsx)(d,{status:X.status,error:X.error})]}):(0,_.jsx)(c,{disabled:K.isValidating,onClick:U,children:t(`Refresh records`,`刷新记录`)})}),O&&(0,_.jsx)(`p`,{role:_e?`alert`:`status`,className:`text-sm text-fg-muted`,children:O}),n.error&&(0,_.jsx)(`p`,{role:`alert`,children:String(n.error.message)}),(0,_.jsxs)(`nav`,{"aria-label":t(`Tracing sections`,`追踪页面分区`),className:`flex gap-2 border-b border-edge pb-3`,children:[(0,_.jsx)(c,{"aria-pressed":P===`records`,variant:P===`records`?`primary`:`ghost`,onClick:()=>F(`records`),children:t(`Execution records`,`执行记录`)}),(0,_.jsx)(c,{"aria-pressed":P===`settings`,variant:P===`settings`?`primary`:`ghost`,onClick:()=>F(`settings`),children:t(`Capture settings`,`采集设置`)})]}),P===`settings`&&(S?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`section`,{className:y,onBlurCapture:X.onBlurCapture,children:[(0,_.jsx)(`h2`,{className:`font-medium`,children:t(`Local recording`,`本地记录`)}),X.error&&(0,_.jsx)(c,{variant:`ghost`,onClick:X.retry,children:t(`Retry autosave`,`重试自动保存`)}),(0,_.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(`input`,{type:`checkbox`,checked:S.enabled,onChange:e=>J(t=>{t.enabled=e.target.checked})}),t(`Record traces`,`记录运行追踪`)]}),(0,_.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[(0,_.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Retention (days)`,`保留天数`),(0,_.jsx)(u,{className:v,type:`number`,min:1,max:90,value:S.local.retentionDays,onChange:e=>J(t=>{t.local.retentionDays=Number(e.target.value)})})]}),(0,_.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Storage budget (MiB)`,`存储上限(MiB)`),(0,_.jsx)(u,{className:v,type:`number`,min:16,max:4096,value:S.local.maxStoreMiB,onChange:e=>J(t=>{t.local.maxStoreMiB=Number(e.target.value)})})]}),(0,_.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Capture`,`采集内容`),(0,_.jsx)(i,{placeholder:t(`Choose`,`请选择`),allowEmpty:!1,value:S.capture,onChange:e=>J(t=>{t.capture=e}),options:[{value:`metadata`,label:t(`Metadata only`,`仅元数据`)},{value:`redacted`,label:t(`Redacted previews`,`脱敏摘要`)},{value:`detailed`,label:t(`Detailed · 30 minutes`,`详细记录 · 30 分钟`)}]})]})]}),(0,_.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t(`Previews may contain personal content. Secrets and media are filtered; large values are truncated.`,`摘要可能包含个人内容。过滤凭证和媒体,超长内容会截断。`)}),S.detailedUntil&&(0,_.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[t(`Detailed capture expires: `,`详细采集截止:`),new Date(S.detailedUntil).toLocaleString()]}),(0,_.jsxs)(`details`,{children:[(0,_.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:t(`Advanced limits`,`高级限制`)}),(0,_.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[[`maxTraces`,t(`Trace count`,`Trace 条数`)],[`maxSpans`,t(`Span count`,`Span 条数`)],[`maxTraceKiB`,t(`Per trace (KiB)`,`单 Trace 上限(KiB)`)],[`maxWriteMiBPerMinute`,t(`Write budget (MiB/minute)`,`写入额度(MiB/分钟)`)]].map(([e,t])=>(0,_.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t,(0,_.jsx)(u,{type:`number`,min:1,className:v,value:S.local[e],onChange:t=>J(n=>{n.local[e]=Number(t.target.value)})})]},e))})]}),r.data?(0,_.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[t(`Disk / payload`,`磁盘 / 数据`),`:`,b(r.data.local.physicalBytes),` / `,b(r.data.local.bytes),` · `,r.data.local.traces??0,` traces · `,r.data.local.spans??0,` spans · `,t(`Dropped`,`丢弃`),` `,Number(r.data.local.dropped??0)+Number(r.data.local.queueDropped??0),(r.data.local.paused||r.data.local.unavailable)&&` · ${t(`Recording paused`,`存储暂停`)}`]}):(0,_.jsx)(l,{className:`h-10`}),(r.error||r.data?.local.lastError)&&(0,_.jsx)(`p`,{role:`alert`,className:`text-sm`,children:r.data?.local.lastError||String(r.error.message)}),(0,_.jsxs)(`div`,{className:`flex gap-2`,children:[(0,_.jsx)(c,{disabled:D||$,onClick:()=>void Y(async()=>{await g(`traces/prune`,`POST`)}),children:t(`Clean expired`,`清理过期记录`)}),(0,_.jsx)(c,{disabled:D,onClick:()=>W(!0),children:t(`Clear local traces`,`清空本地追踪`)})]})]}),(0,_.jsxs)(`section`,{className:y,children:[(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,_.jsx)(`h2`,{className:`font-medium`,children:`Langfuse`}),(0,_.jsx)(d,{status:Q.status,error:Q.error})]}),Q.error&&(0,_.jsx)(c,{variant:`ghost`,onClick:Q.retry,children:t(`Retry autosave`,`重试自动保存`)}),(0,_.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,_.jsx)(`input`,{type:`checkbox`,checked:S.langfuse.enabled,onBlur:X.onBlurCapture,onChange:e=>J(t=>{t.langfuse.enabled=e.target.checked})}),t(`Also export new traces to Langfuse`,`同时导出新采集的追踪到 Langfuse`)]}),(0,_.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,_.jsxs)(`label`,{className:`space-y-1 text-sm sm:col-span-2`,children:[`Base URL`,(0,_.jsx)(`input`,{className:v,type:`url`,value:S.langfuse.baseUrl,onBlur:X.onBlurCapture,onChange:e=>J(t=>{t.langfuse.baseUrl=e.target.value})})]}),[`publicKey`,`secretKey`].map(e=>{let r=e===`publicKey`?`Public Key`:`Secret Key`,i=e===`publicKey`?C:T,a=n.data?.credentials[e===`publicKey`?`publicKeyConfigured`:`secretKeyConfigured`];return(0,_.jsxs)(`div`,{className:`space-y-1 text-sm`,onBlurCapture:Q.onBlurCapture,children:[(0,_.jsx)(`label`,{htmlFor:`langfuse-${e}`,children:r}),(0,_.jsx)(ee,{id:`langfuse-${e}`,value:i||(a?`••••••••••••`:``),allowUnrevealedCopy:!0,onChange:t=>(e===`publicKey`?w:E)(t.replace(/^•+/,``)),placeholder:e===`publicKey`?`pk-lf-…`:`sk-lf-…`,labels:{show:t(`Show ${r}`,`查看 ${r}`),hide:t(`Hide ${r}`,`隐藏 ${r}`),copy:t(`Copy ${r}`,`复制 ${r}`),copied:t(`Copied`,`已复制`)},reveal:()=>g(`tracing/langfuse/credentials/${e}/reveal`,`POST`).then(e=>e.key),loadFailedLabel:t(`Unable to load the configured key.`,`无法读取已配置的 Key。`),notInConfigFile:t(`No configured key is available.`,`暂无已配置的 Key。`)},me)]},e)})]}),(0,_.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[t(`Credential sources`,`凭证来源`),`:`,n.data?.credentials.publicKeySource,` / `,n.data?.credentials.secretKeySource,` · URL: `,n.data?.credentials.baseUrlSource]}),r.data&&(0,_.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[r.data.langfuse.state,` · `,t(`Pending`,`待发送`),` `,r.data.langfuse.pending,` · `,t(`Dropped`,`丢弃`),` `,r.data.langfuse.dropped,r.data.langfuse.lastSuccess?` · ${new Date(r.data.langfuse.lastSuccess).toLocaleString()}`:``]}),r.data?.langfuse.lastError&&(0,_.jsx)(`p`,{role:`alert`,className:`text-sm`,children:r.data.langfuse.lastError}),(0,_.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t(`Changes save automatically. Historical traces are not uploaded. Offline exports may be dropped.`,`修改后自动保存。不会上传历史记录;断网或队列满时可能丢弃远端导出。`)}),(0,_.jsxs)(`div`,{className:`flex gap-2`,children:[(0,_.jsx)(c,{disabled:D||$,onClick:()=>void Y(async()=>{if(!(await g(`tracing/langfuse/test`,`POST`)).ok)throw Error(t(`Connection test failed. Check saved configuration and credentials.`,`连接测试失败,请检查已保存的配置和凭证。`))},t(`Diagnostic trace accepted by the ingestion endpoint`,`采集端已接受诊断追踪`)),children:t(`Test connection`,`测试连接`)}),(0,_.jsx)(c,{disabled:D||$,onClick:()=>void Y(async()=>{await g(`tracing/langfuse/credentials`,`DELETE`),w(``),E(``),he(e=>e+1)}),children:t(`Remove saved credentials`,`移除已保存凭证`)})]})]})]}):(0,_.jsx)(x,{})),P===`records`&&(0,_.jsxs)(`section`,{className:y,children:[(0,_.jsx)(`h2`,{className:`font-medium`,children:t(`Recent runs`,`最近执行`)}),(0,_.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,_.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Status`,`执行状态`),(0,_.jsx)(i,{placeholder:t(`All statuses`,`全部状态`),allowEmpty:!1,value:j,onChange:e=>{ve(e),U()},options:[{value:``,label:t(`All statuses`,`全部状态`)},...[`running`,`success`,`error`,`cancelled`,`suspended`,`interrupted`].map(e=>({value:e,label:t(e,{running:`运行中`,success:`成功`,error:`失败`,cancelled:`已取消`,suspended:`已暂停`,interrupted:`已中断`}[e])}))]})]}),(0,_.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Time range`,`时间范围`),(0,_.jsx)(i,{placeholder:t(`Choose`,`请选择`),value:M,allowEmpty:!1,onChange:e=>{ye(e),U()},options:[`1`,`7`,`30`,`90`].map(e=>({value:e,label:`${e} ${t(`days`,`天`)}`}))})]}),(0,_.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[t(`Page size`,`每页条数`),(0,_.jsx)(i,{placeholder:t(`Choose`,`请选择`),value:I,allowEmpty:!1,onChange:e=>{xe(e),U()},options:[`10`,`20`].map(e=>({value:e,label:`${e} ${t(`records`,`条`)}`}))})]})]}),(0,_.jsxs)(`details`,{children:[(0,_.jsxs)(`summary`,{className:`cursor-pointer text-sm text-fg-muted`,children:[t(`Advanced filters`,`高级筛选`),Object.values(N).some(Boolean)?` · ${t(`Active`,`已启用`)}`:``]}),(0,_.jsx)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-3`,children:[`conversationId`,`runId`,`agentId`].map(e=>(0,_.jsxs)(`label`,{className:`space-y-1 text-sm`,children:[{conversationId:t(`Conversation ID`,`会话 ID`),runId:t(`Run ID`,`执行 ID`),agentId:t(`Agent ID`,`Agent ID`)}[e],(0,_.jsx)(`input`,{"aria-label":e,placeholder:t(`Exact ID`,`输入完整 ID`),className:v,value:N[e],onChange:t=>{be({...N,[e]:t.target.value}),U()}})]},e))})]}),(0,_.jsxs)(`div`,{role:`region`,"aria-label":t(`Execution results`,`执行结果`),"aria-busy":K.isValidating,className:`h-[24rem] min-h-0 overflow-y-auto overscroll-contain rounded-lg border border-edge sm:h-[28rem]`,children:[K.error&&(0,_.jsx)(`p`,{role:`alert`,className:`p-4 text-sm`,children:K.error.message}),!K.data&&!K.error?(0,_.jsx)(`div`,{className:`space-y-3 p-3`,children:[0,1,2,3,4].map(e=>(0,_.jsx)(l,{className:`h-16`},e))}):(0,_.jsxs)(`div`,{className:`divide-y divide-edge`,children:[K.data?.traces.length===0&&(0,_.jsx)(`p`,{className:`flex h-48 items-center justify-center px-4 text-sm text-fg-muted`,children:t(`No traces in this range`,`此时间范围内暂无记录`)}),K.data?.traces.map(n=>(0,_.jsxs)(`button`,{onClick:()=>H(n.traceId),className:`flex w-full flex-col gap-2 px-3 py-3 text-left text-sm hover:bg-surface-hover sm:flex-row sm:items-center sm:justify-between`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsxs)(`p`,{className:`truncate font-medium`,children:[n.name,n.attributes[`xopc.agentId`]?` · ${n.attributes[`xopc.agentId`]}`:``]}),(0,_.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[new Date(n.startedAt).toLocaleString(e?`zh-CN`:`en-US`),` · `,n.traceId]}),n.stats&&(0,_.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[n.stats.generations,` `,t(`model calls`,`次模型调用`),` · `,n.stats.tokens,` tokens · $`,n.stats.knownCostUsd.toFixed(4),n.stats.unknownCostCalls>0?` · ${t(`partial cost`,`部分成本未知`)}`:``]})]}),(0,_.jsxs)(`span`,{className:`shrink-0 text-xs text-fg-muted`,children:[t(n.status,{running:`运行中`,success:`成功`,error:`失败`,cancelled:`已取消`,suspended:`已暂停`,interrupted:`已中断`}[n.status]??n.status),` · `,n.endedAt?`${Math.round(n.endedAt-n.startedAt)} ms`:`—`,n.partialReason?` · ${t(`Partial`,`部分记录`)}`:``]})]},n.traceId))]})]}),(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,_.jsx)(`p`,{"aria-live":`polite`,className:`text-xs text-fg-muted`,children:t(`Page ${R+1} · ${K.data?.traces.length??0} records`,`第 ${R+1} 页 · ${K.data?.traces.length??0} 条`)}),(0,_.jsxs)(`div`,{className:`flex gap-2`,children:[(0,_.jsx)(c,{disabled:R===0||K.isValidating,onClick:()=>z(e=>Math.max(0,e-1)),children:t(`Previous page`,`上一页`)}),(0,_.jsx)(c,{disabled:!K.data?.nextCursor||K.isValidating,onClick:()=>{let e=K.data?.nextCursor;e&&(L(t=>[...t.slice(0,R+1),e]),z(e=>e+1))},children:t(`Next page`,`下一页`)})]})]})]}),(0,_.jsx)(ce,{open:!!V,onOpenChange:e=>{e||H(void 0)},children:(0,_.jsxs)(ae,{children:[(0,_.jsx)(ne,{className:`fixed inset-0 z-[90] bg-black/40`}),(0,_.jsxs)(oe,{className:`fixed left-1/2 top-1/2 z-[91] flex h-[min(44rem,calc(100vh-2rem))] w-[min(64rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay p-4`,children:[(0,_.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3`,children:[(0,_.jsx)(se,{className:`font-medium`,children:t(`Trace details`,`追踪详情`)}),(0,_.jsx)(ie,{asChild:!0,children:(0,_.jsx)(c,{children:t(`Close`,`关闭`)})})]}),(0,_.jsx)(re,{className:`shrink-0 truncate text-xs text-fg-muted`,children:V}),(0,_.jsx)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto py-4`,children:q.error?(0,_.jsx)(`p`,{role:`alert`,children:q.error.message}):q.data?(0,_.jsxs)(_.Fragment,{children:[(0,_.jsxs)(`p`,{className:`text-sm`,children:[q.data.trace.status,` `,q.data.trace.partialReason&&` · ${q.data.trace.partialReason}`]}),fe(q.data.spans).map(e=>(0,_.jsxs)(`details`,{style:{marginLeft:de(e,q.data.spans)*12},className:`rounded-lg border border-edge p-3 text-sm`,children:[(0,_.jsxs)(`summary`,{className:`cursor-pointer`,children:[e.name,` · `,e.status,` · `,e.endedAt?`${Math.round(e.endedAt-e.startedAt)} ms`:`—`]}),(0,_.jsx)(`pre`,{className:`mt-3 whitespace-pre-wrap break-all text-xs text-fg-muted`,children:JSON.stringify(e.attributes,null,2)})]},e.spanId))]}):(0,_.jsx)(x,{})}),(0,_.jsx)(`div`,{className:`shrink-0 border-t border-edge pt-3`,children:(0,_.jsx)(c,{disabled:!q.data||D,onClick:()=>void De(),children:t(`Export JSON`,`导出 JSON`)})})]})]})}),(0,_.jsx)(ce,{open:Te,onOpenChange:W,children:(0,_.jsxs)(ae,{children:[(0,_.jsx)(ne,{className:`fixed inset-0 z-[90] bg-black/40`}),(0,_.jsxs)(oe,{className:`fixed left-1/2 top-1/2 z-[91] w-[min(28rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 space-y-4 rounded-xl border border-edge bg-surface-overlay p-5`,children:[(0,_.jsx)(se,{children:t(`Clear local traces?`,`清空本地追踪?`)}),(0,_.jsx)(re,{className:`text-sm text-fg-muted`,children:t(`Removes retained local traces. Conversations, usage records and Langfuse data remain available.`,`删除已保留的本地追踪。会话、用量记录及 Langfuse 数据仍保留。`)}),(0,_.jsxs)(`div`,{className:`flex gap-2`,children:[(0,_.jsx)(c,{disabled:D||$,onClick:()=>void Y(async()=>{await g(`traces`,`DELETE`),W(!1),H(void 0)}),children:t(`Clear`,`清空`)}),(0,_.jsx)(ie,{asChild:!0,children:(0,_.jsx)(c,{children:t(`Cancel`,`取消`)})})]})]})]})})]})}export{pe as TracingSettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./external-link-DjqjBmc3.js";import{t as a}from"./globe-DSSGFWFn.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./messages-DlTNQI92.js";import{t as c}from"./cn-0WouolD0.js";import{a as l,c as u,i as d,n as ee,r as f}from"./locale-store-Dr43FCty.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{t as m}from"./button-aIC072nz.js";import{n as h,r as g}from"./gateway-config-swr-Bc2MytsF.js";import{s as _}from"./form-field-width-DJw_jULe.js";import{t as v}from"./skeleton-BI5TyibZ.js";import{t as y}from"./copy-text-row-C7egVuKr.js";import{oa as b,ts as x}from"./index-CmC8JkSM.js";import{n as te,t as ne}from"./settings-form-section-num14vSv.js";var S=e(t(),1),C=n(),w=r();function T(e){let t=(0,C.c)(10),{language:n,label:r,section:a,className:o}=e,s;t[0]!==n||t[1]!==a?(s=b(n,a),t[0]=n,t[1]=a,t[2]=s):s=t[2];let l;t[3]===o?l=t[4]:(l=c(`inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,o),t[3]=o,t[4]=l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,w.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[5]=u):u=t[5];let d;return t[6]!==r||t[7]!==s||t[8]!==l?(d=(0,w.jsxs)(`a`,{href:s,target:`_blank`,rel:`noreferrer`,className:l,children:[r,u]}),t[6]=r,t[7]=s,t[8]=l,t[9]=d):d=t[9],d}async function E(){let e=await d(`/api/exposure/status`);if(!e.ok)throw Error(`Failed to load exposure status (${e.status})`);return await e.json()}async function D(e=`serve`){let t=await d(`/api/exposure/tailscale/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`Start failed (${t.status})`)}return await t.json()}async function O(){let e=await d(`/api/exposure/tailscale/stop`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`Stop failed (${e.status})`)}return await e.json()}var k=`https://tailscale.com/download`;function A(e){let t=(0,C.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,w.jsx)(`a`,{href:k,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent hover:underline`,children:n}),t[0]=n,t[1]=r),r}function j({embedded:e=!1}){let t=ee(e=>e.language),n=s(t).remoteAccess.tailscale,r=(0,S.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:s(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]),i=!!u(e=>e.conversationId),[c,l]=(0,S.useState)(!1),[d,f]=(0,S.useState)(null),{data:h,mutate:g,isLoading:_}=p(i?`exposure-status`:null,E,{refreshInterval:3e4}),b=h?.tailscale.hostname,C=h?.tailscale.active===!0,k=h?.tailscale.cliAvailable!==!1,j=b?`https://${b}/`:null,re=(0,S.useCallback)(async()=>{l(!0),f(null);try{await D(`serve`),await g()}catch(e){f(e instanceof Error?e.message:String(e))}finally{l(!1)}},[g]),ie=(0,S.useCallback)(async()=>{l(!0),f(null);try{await O(),await g()}catch(e){f(e instanceof Error?e.message:String(e))}finally{l(!1)}},[g]);if(!i)return null;let M=(0,w.jsxs)(`div`,{className:e?`space-y-4`:`mt-4 space-y-3`,children:[e?(0,w.jsxs)(`ol`,{className:`space-y-3 text-sm text-fg-muted`,children:[(0,w.jsxs)(`li`,{className:`flex gap-2`,children:[(0,w.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`1`}),(0,w.jsxs)(`span`,{children:[n.stepInstallBefore,(0,w.jsx)(A,{label:n.stepInstallLink}),n.stepInstallAfter]})]}),(0,w.jsxs)(`li`,{className:`flex gap-2`,children:[(0,w.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`2`}),(0,w.jsx)(`span`,{children:n.stepEnable})]}),(0,w.jsxs)(`li`,{className:`flex gap-2`,children:[(0,w.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`3`}),(0,w.jsx)(`span`,{children:n.stepCopy})]})]}):null,e&&h?.tailscale.cliAvailable===!1?(0,w.jsxs)(`p`,{className:`rounded-lg bg-amber-500/10 px-3 py-2 text-sm text-fg-muted`,children:[n.cliMissingIntro,` `,(0,w.jsx)(A,{label:n.cliMissingDownloadLink}),n.cliMissingSuffix]}):null,_&&!h?(0,w.jsxs)(`div`,{className:`grid gap-3`,"aria-busy":`true`,children:[(0,w.jsx)(v,{className:`h-20 rounded-lg`}),(0,w.jsx)(v,{className:`h-20 rounded-lg`})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(ne,{children:[(0,w.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.statusLabel}),(0,w.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:C?n.statusActive:n.statusOff}),j?(0,w.jsx)(`div`,{className:`mt-3`,children:(0,w.jsx)(y,{text:j,labels:r})}):null,d?(0,w.jsx)(`p`,{className:`mt-2 text-sm text-red-600 dark:text-red-400`,children:d}):null,(0,w.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:C?(0,w.jsxs)(m,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>void ie(),children:[c?(0,w.jsx)(o,{className:`mr-1 size-4 animate-spin`}):null,n.disableServe]}):(0,w.jsxs)(m,{type:`button`,disabled:c||!k,onClick:()=>void re(),children:[c?(0,w.jsx)(o,{className:`mr-1 size-4 animate-spin`}):(0,w.jsx)(x,{className:`mr-1 size-4`}),n.enableServe]})})]}),(0,w.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.hint}),(0,w.jsx)(T,{language:t,label:n.docsLink,section:`tailscale-serve`,className:`mt-2`})]})]});return e?M:(0,w.jsxs)(ne,{children:[(0,w.jsx)(te,{icon:a,title:n.title,subtitle:n.subtitle}),M]})}async function re(e){let t=await d(f(`/api/tunnel/probe-public`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e})});if(!t.ok&&t.status!==400)throw Error(`Probe failed (${t.status})`);return await t.json()}async function ie(e){await l(f(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{publicUrl:e??null}})})}function M(e){let t=e.split(`.`).map(e=>Number.parseInt(e,10));if(t.length!==4||t.some(e=>!Number.isFinite(e)))return!1;let[n,r]=t;return n===10||n===127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===100&&r>=64&&r<=127}function ae(){return(0,S.useMemo)(()=>{if(typeof window>`u`)return null;let{protocol:e,hostname:t,origin:n}=window.location;if(e!==`https:`&&e!==`http:`)return null;let r=t.toLowerCase();return!r||r===`localhost`||r===`127.0.0.1`||r===`::1`||r===`[::1]`||r.endsWith(`.local`)||r.endsWith(`.localhost`)||M(r)?null:n.toLowerCase().replace(/\/+$/,``)},[])}function oe(){return c(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_,`dark:border-edge`)}function se(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.gateway;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.publicUrl;return typeof n==`string`&&n.trim()?n.trim():null}function N(){let e=(0,C.c)(85),t=ee(le),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n.remoteAccess.reverseProxy,i=!!u(ce),l=ae(),d=g(i).data?.payload?.config,f;e[2]===d?f=e[3]:(f=se(d),e[2]=d,e[3]=f);let p=f,[_,v]=(0,S.useState)(``),y;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(y={busy:!1,result:null},e[4]=y):y=e[4];let[b,x]=(0,S.useState)(y),T;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(T={busy:!1,error:null},e[5]=T):T=e[5];let[E,D]=(0,S.useState)(T),O,k;e[6]!==p||e[7]!==l||e[8]!==_?(O=()=>{_||(p?v(p):l&&v(l))},k=[p,l,_],e[6]=p,e[7]=l,e[8]=_,e[9]=O,e[10]=k):(O=e[9],k=e[10]),(0,S.useEffect)(O,k);let A;bb0:{let t;e[11]===_?t=e[12]:(t=_.trim(),e[11]=_,e[12]=t);let n=t;if(n){A=n;break bb0}A=p??l??``}let j=A,M=!p&&!!l&&j===l,N;e[13]!==_||e[14]!==j?(N=async()=>{let e=_.trim()||j;if(e){x({busy:!0,result:null});try{x({busy:!1,result:await re(e)})}catch(e){let t=e;x({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:t instanceof Error?t.message:String(t)}})}}},e[13]=_,e[14]=j,e[15]=N):N=e[15];let de=N,fe;e[16]===j?fe=e[17]:(fe=async()=>{let e=j.trim();if(e){D({busy:!0,error:null});try{await ie(e),await h(),D({busy:!1,error:null})}catch(e){let t=e;D({busy:!1,error:t instanceof Error?t.message:String(t)})}}},e[16]=j,e[17]=fe);let pe=fe,P;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(P=async()=>{D({busy:!0,error:null});try{await ie(null),await h(),v(``),x({busy:!1,result:null}),D({busy:!1,error:null})}catch(e){let t=e;D({busy:!1,error:t instanceof Error?t.message:String(t)})}},e[18]=P):P=e[18];let me=P;if(!i)return null;let F;e[19]!==r.subtitle||e[20]!==r.title?(F=(0,w.jsx)(te,{icon:a,title:r.title,subtitle:r.subtitle}),e[19]=r.subtitle,e[20]=r.title,e[21]=F):F=e[21];let I;e[22]===r.urlLabel?I=e[23]:(I=(0,w.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`reverse-proxy-url`,children:r.urlLabel}),e[22]=r.urlLabel,e[23]=I);let L;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(L=c(oe(),`font-mono text-xs sm:flex-1 sm:min-w-0 sm:w-auto`),e[24]=L):L=e[24];let R;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{v(e.target.value),x({busy:!1,result:null})},e[25]=R):R=e[25];let z;e[26]!==_||e[27]!==r.urlPlaceholder||e[28]!==L?(z=(0,w.jsx)(`input`,{id:`reverse-proxy-url`,className:L,type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:r.urlPlaceholder,value:_,onChange:R}),e[26]=_,e[27]=r.urlPlaceholder,e[28]=L,e[29]=z):z=e[29];let B;e[30]===de?B=e[31]:(B=()=>void de(),e[30]=de,e[31]=B);let V;e[32]!==_||e[33]!==b.busy?(V=b.busy||!_.trim(),e[32]=_,e[33]=b.busy,e[34]=V):V=e[34];let H;e[35]===b.busy?H=e[36]:(H=b.busy?(0,w.jsx)(o,{className:`size-3.5 animate-spin`}):null,e[35]=b.busy,e[36]=H);let he=b.busy?r.probing:r.probeButton,U;e[37]!==B||e[38]!==V||e[39]!==H||e[40]!==he?(U=(0,w.jsxs)(m,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:B,disabled:V,children:[H,he]}),e[37]=B,e[38]=V,e[39]=H,e[40]=he,e[41]=U):U=e[41];let W;e[42]!==z||e[43]!==U?(W=(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch`,children:[z,U]}),e[42]=z,e[43]=U,e[44]=W):W=e[44];let G;e[45]===r.urlHint?G=e[46]:(G=(0,w.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.urlHint}),e[45]=r.urlHint,e[46]=G);let K;e[47]!==l||e[48]!==M||e[49]!==r.autoDetectedHint||e[50]!==r.autoDetectedTitle?(K=M&&l?(0,w.jsxs)(`div`,{className:`rounded-lg bg-accent-soft/60 px-3 py-2 text-xs leading-relaxed text-accent-fg`,children:[(0,w.jsx)(`div`,{className:`font-medium`,children:r.autoDetectedTitle}),(0,w.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px]`,children:l}),(0,w.jsx)(`p`,{className:`mt-1`,children:r.autoDetectedHint})]}):null,e[47]=l,e[48]=M,e[49]=r.autoDetectedHint,e[50]=r.autoDetectedTitle,e[51]=K):K=e[51];let q;e[52]!==b.result||e[53]!==r.probeStatus?(q=b.result?(0,w.jsx)(ue,{result:b.result,labels:r.probeStatus}):null,e[52]=b.result,e[53]=r.probeStatus,e[54]=q):q=e[54];let J;e[55]!==p||e[56]!==j||e[57]!==pe||e[58]!==r.saveAsDefault||e[59]!==r.saving||e[60]!==E.busy?(J=j&&p!==j?(0,w.jsxs)(m,{type:`button`,onClick:()=>void pe(),disabled:E.busy,children:[E.busy?(0,w.jsx)(o,{className:`size-3.5 animate-spin`}):null,E.busy?r.saving:r.saveAsDefault]}):null,e[55]=p,e[56]=j,e[57]=pe,e[58]=r.saveAsDefault,e[59]=r.saving,e[60]=E.busy,e[61]=J):J=e[61];let Y;e[62]!==p||e[63]!==r.clear||e[64]!==E.busy?(Y=p?(0,w.jsx)(m,{type:`button`,variant:`ghost`,onClick:()=>void me(),disabled:E.busy,children:r.clear}):null,e[62]=p,e[63]=r.clear,e[64]=E.busy,e[65]=Y):Y=e[65];let X;e[66]!==J||e[67]!==Y?(X=(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[J,Y]}),e[66]=J,e[67]=Y,e[68]=X):X=e[68];let Z;e[69]===E.error?Z=e[70]:(Z=E.error?(0,w.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:E.error}):null,e[69]=E.error,e[70]=Z);let Q;e[71]===r.certWarning?Q=e[72]:(Q=(0,w.jsx)(`div`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs leading-relaxed text-amber-950 dark:bg-amber-950/30 dark:text-amber-100`,children:r.certWarning}),e[71]=r.certWarning,e[72]=Q);let $;e[73]!==I||e[74]!==W||e[75]!==G||e[76]!==K||e[77]!==q||e[78]!==X||e[79]!==Z||e[80]!==Q?($=(0,w.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[I,W,G,K,q,X,Z,Q]}),e[73]=I,e[74]=W,e[75]=G,e[76]=K,e[77]=q,e[78]=X,e[79]=Z,e[80]=Q,e[81]=$):$=e[81];let ge;return e[82]!==F||e[83]!==$?(ge=(0,w.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,w.jsxs)(ne,{children:[F,$]})}),e[82]=F,e[83]=$,e[84]=ge):ge=e[84],ge}function ce(e){return e.conversationId}function le(e){return e.language}function ue(e){let t=(0,C.c)(18),{result:n,labels:r}=e;if(n.ok){let e;t[0]===r.ok?e=t[1]:(e=(0,w.jsx)(`span`,{className:`font-medium`,children:r.ok}),t[0]=r.ok,t[1]=e);let i;t[2]===n.latencyMs?i=t[3]:(i=(0,w.jsxs)(`span`,{className:`font-mono`,children:[n.latencyMs,`ms`]}),t[2]=n.latencyMs,t[3]=i);let a;t[4]!==r.gatewayReady||t[5]!==n.gatewayReady?(a=n.gatewayReady?(0,w.jsxs)(w.Fragment,{children:[` · `,(0,w.jsx)(`span`,{children:r.gatewayReady})]}):null,t[4]=r.gatewayReady,t[5]=n.gatewayReady,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==i||t[9]!==a?(o=(0,w.jsxs)(`div`,{className:`rounded-lg bg-emerald-50 px-3 py-2 text-xs text-emerald-900 dark:bg-emerald-950/30 dark:text-emerald-100`,children:[e,` · `,i,a]}),t[7]=e,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}let i=r[`code_${n.code}`]??r.codeUnknown,a;t[11]===i?a=t[12]:(a=(0,w.jsx)(`span`,{className:`font-medium`,children:i}),t[11]=i,t[12]=a);let o;t[13]===n.message?o=t[14]:(o=n.message?(0,w.jsxs)(w.Fragment,{children:[` — `,(0,w.jsx)(`span`,{className:`font-mono break-all`,children:n.message})]}):null,t[13]=n.message,t[14]=o);let s;return t[15]!==a||t[16]!==o?(s=(0,w.jsxs)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-xs text-red-900 dark:bg-red-950/30 dark:text-red-100`,children:[a,o]}),t[15]=a,t[16]=o,t[17]=s):s=t[17],s}async function de(){let e=await l(f(`/api/device-pairing/readiness`));return{ready:e.ready,routes:e.routes,protocolVersion:e.protocolVersion}}async function fe(e){try{return{kind:`ready`,setup:(await l(f(`/api/device-pairing/setups`),{method:`POST`,body:JSON.stringify({targetKind:e})})).setup}}catch(e){if(e.body?.error?.code===`NO_SECURE_ROUTE`)return{kind:`needs-secure-route`};throw e}}async function pe(e){return l(f(`/api/device-pairing/setups/${encodeURIComponent(e)}`))}async function P(e){await l(f(`/api/device-pairing/setups/${encodeURIComponent(e)}`),{method:`DELETE`})}async function me(e,t){await l(f(`/api/device-pairing/requests/${encodeURIComponent(e.requestId)}/decision`),{method:`POST`,body:JSON.stringify({decision:t,expectedRevision:e.revision})})}async function F(){let e=await d(f(`/api/browser/extension/archive`));if(!e.ok)throw Error(`Browser extension download failed (${e.status})`);let t=e.headers.get(`Content-Disposition`)??``,n=/filename="([^"]+)"/.exec(t)?.[1]??`xopc-browser-extension.zip`,r=URL.createObjectURL(await e.blob());try{let e=document.createElement(`a`);e.href=r,e.download=n,e.click()}finally{URL.revokeObjectURL(r)}}var I=`https://console.xopc.ai/access/client`;function L(e){if(!e||typeof e!=`object`)return;let t=e.body;if(!t||typeof t!=`object`)return;let n=t.error;if(!n||typeof n!=`object`)return;let r=n.code;return typeof r==`string`?r:void 0}function R(e){return[`tunnel_oauth_required`,`invalid_token`,`insufficient_scope`].includes(L(e)??``)}async function z(){return l(f(`/api/tunnel/status`))}async function B(){await l(f(`/api/tunnel/consent`),{method:`POST`,body:JSON.stringify({})})}async function V(){await l(f(`/api/tunnel/registration-key`),{method:`POST`,body:JSON.stringify({})})}async function H(){return l(f(`/api/tunnel/start`),{method:`POST`,body:JSON.stringify({})})}async function he(e){return l(f(`/api/tunnel/stop`),{method:`POST`,body:JSON.stringify({release:e?.release===!0})})}async function U(){let e=(await l(f(`/api/tunnel/reveal-registration-secret`),{method:`POST`,body:JSON.stringify({})})).payload;if(!e)throw Error(`Missing reveal payload`);return{registrationSecret:e.registrationSecret??null,source:e.source===`config`?`config`:`none`}}async function W(e){await l(f(`/api/config`),{method:`PATCH`,body:JSON.stringify({tunnel:e})})}export{N as _,B as a,T as b,he as c,P as d,fe as f,pe as g,de as h,V as i,L as l,F as m,z as n,U as o,me as p,W as r,H as s,I as t,R as u,j as v,E as y};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./external-link-DjqjBmc3.js";import{t as a}from"./globe-DSSGFWFn.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./messages-CKTo_sIF.js";import{t as c}from"./cn-0WouolD0.js";import{a as l,c as u,i as d,n as ee,r as f}from"./locale-store-BpK9AiDq.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{t as m}from"./button-aIC072nz.js";import{n as h,r as g}from"./gateway-config-swr-Dv_A5FMu.js";import{s as _}from"./form-field-width-DJw_jULe.js";import{t as v}from"./skeleton-BI5TyibZ.js";import{t as y}from"./copy-text-row-C7egVuKr.js";import{Ta as b,ps as x}from"./index-DFgXwLsv.js";import{n as te,t as ne}from"./settings-form-section-num14vSv.js";var S=e(t(),1),C=n(),w=r();function T(e){let t=(0,C.c)(10),{language:n,label:r,section:a,className:o}=e,s;t[0]!==n||t[1]!==a?(s=b(n,a),t[0]=n,t[1]=a,t[2]=s):s=t[2];let l;t[3]===o?l=t[4]:(l=c(`inline-flex items-center gap-1 text-sm font-medium text-accent hover:underline`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,o),t[3]=o,t[4]=l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,w.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[5]=u):u=t[5];let d;return t[6]!==r||t[7]!==s||t[8]!==l?(d=(0,w.jsxs)(`a`,{href:s,target:`_blank`,rel:`noreferrer`,className:l,children:[r,u]}),t[6]=r,t[7]=s,t[8]=l,t[9]=d):d=t[9],d}async function E(){let e=await d(`/api/exposure/status`);if(!e.ok)throw Error(`Failed to load exposure status (${e.status})`);return await e.json()}async function D(e=`serve`){let t=await d(`/api/exposure/tailscale/start`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error??`Start failed (${t.status})`)}return await t.json()}async function O(){let e=await d(`/api/exposure/tailscale/stop`,{method:`POST`});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`Stop failed (${e.status})`)}return await e.json()}var k=`https://tailscale.com/download`;function A(e){let t=(0,C.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,w.jsx)(`a`,{href:k,target:`_blank`,rel:`noreferrer`,className:`font-medium text-accent hover:underline`,children:n}),t[0]=n,t[1]=r),r}function j({embedded:e=!1}){let t=ee(e=>e.language),n=s(t).remoteAccess.tailscale,r=(0,S.useMemo)(()=>({copy:n.copyUrl,copied:n.copied,copyFailed:s(t).clipboard.copyFailed}),[t,n.copyUrl,n.copied]),i=!!u(e=>e.conversationId),[c,l]=(0,S.useState)(!1),[d,f]=(0,S.useState)(null),{data:h,mutate:g,isLoading:_}=p(i?`exposure-status`:null,E,{refreshInterval:3e4}),b=h?.tailscale.hostname,C=h?.tailscale.active===!0,k=h?.tailscale.cliAvailable!==!1,j=b?`https://${b}/`:null,re=(0,S.useCallback)(async()=>{l(!0),f(null);try{await D(`serve`),await g()}catch(e){f(e instanceof Error?e.message:String(e))}finally{l(!1)}},[g]),ie=(0,S.useCallback)(async()=>{l(!0),f(null);try{await O(),await g()}catch(e){f(e instanceof Error?e.message:String(e))}finally{l(!1)}},[g]);if(!i)return null;let M=(0,w.jsxs)(`div`,{className:e?`space-y-4`:`mt-4 space-y-3`,children:[e?(0,w.jsxs)(`ol`,{className:`space-y-3 text-sm text-fg-muted`,children:[(0,w.jsxs)(`li`,{className:`flex gap-2`,children:[(0,w.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`1`}),(0,w.jsxs)(`span`,{children:[n.stepInstallBefore,(0,w.jsx)(A,{label:n.stepInstallLink}),n.stepInstallAfter]})]}),(0,w.jsxs)(`li`,{className:`flex gap-2`,children:[(0,w.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`2`}),(0,w.jsx)(`span`,{children:n.stepEnable})]}),(0,w.jsxs)(`li`,{className:`flex gap-2`,children:[(0,w.jsx)(`span`,{className:`flex size-5 shrink-0 items-center justify-center rounded-full bg-surface-hover text-xs font-semibold text-fg`,children:`3`}),(0,w.jsx)(`span`,{children:n.stepCopy})]})]}):null,e&&h?.tailscale.cliAvailable===!1?(0,w.jsxs)(`p`,{className:`rounded-lg bg-amber-500/10 px-3 py-2 text-sm text-fg-muted`,children:[n.cliMissingIntro,` `,(0,w.jsx)(A,{label:n.cliMissingDownloadLink}),n.cliMissingSuffix]}):null,_&&!h?(0,w.jsxs)(`div`,{className:`grid gap-3`,"aria-busy":`true`,children:[(0,w.jsx)(v,{className:`h-20 rounded-lg`}),(0,w.jsx)(v,{className:`h-20 rounded-lg`})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsxs)(ne,{children:[(0,w.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.statusLabel}),(0,w.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:C?n.statusActive:n.statusOff}),j?(0,w.jsx)(`div`,{className:`mt-3`,children:(0,w.jsx)(y,{text:j,labels:r})}):null,d?(0,w.jsx)(`p`,{className:`mt-2 text-sm text-red-600 dark:text-red-400`,children:d}):null,(0,w.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:C?(0,w.jsxs)(m,{type:`button`,variant:`secondary`,disabled:c,onClick:()=>void ie(),children:[c?(0,w.jsx)(o,{className:`mr-1 size-4 animate-spin`}):null,n.disableServe]}):(0,w.jsxs)(m,{type:`button`,disabled:c||!k,onClick:()=>void re(),children:[c?(0,w.jsx)(o,{className:`mr-1 size-4 animate-spin`}):(0,w.jsx)(x,{className:`mr-1 size-4`}),n.enableServe]})})]}),(0,w.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.hint}),(0,w.jsx)(T,{language:t,label:n.docsLink,section:`tailscale-serve`,className:`mt-2`})]})]});return e?M:(0,w.jsxs)(ne,{children:[(0,w.jsx)(te,{icon:a,title:n.title,subtitle:n.subtitle}),M]})}async function re(e){let t=await d(f(`/api/tunnel/probe-public`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:e})});if(!t.ok&&t.status!==400)throw Error(`Probe failed (${t.status})`);return await t.json()}async function ie(e){await l(f(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{publicUrl:e??null}})})}function M(e){let t=e.split(`.`).map(e=>Number.parseInt(e,10));if(t.length!==4||t.some(e=>!Number.isFinite(e)))return!1;let[n,r]=t;return n===10||n===127||n===169&&r===254||n===172&&r>=16&&r<=31||n===192&&r===168||n===100&&r>=64&&r<=127}function ae(){return(0,S.useMemo)(()=>{if(typeof window>`u`)return null;let{protocol:e,hostname:t,origin:n}=window.location;if(e!==`https:`&&e!==`http:`)return null;let r=t.toLowerCase();return!r||r===`localhost`||r===`127.0.0.1`||r===`::1`||r===`[::1]`||r.endsWith(`.local`)||r.endsWith(`.localhost`)||M(r)?null:n.toLowerCase().replace(/\/+$/,``)},[])}function oe(){return c(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,_,`dark:border-edge`)}function se(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e.gateway;if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t.publicUrl;return typeof n==`string`&&n.trim()?n.trim():null}function N(){let e=(0,C.c)(85),t=ee(le),n;e[0]===t?n=e[1]:(n=s(t),e[0]=t,e[1]=n);let r=n.remoteAccess.reverseProxy,i=!!u(ce),l=ae(),d=g(i).data?.payload?.config,f;e[2]===d?f=e[3]:(f=se(d),e[2]=d,e[3]=f);let p=f,[_,v]=(0,S.useState)(``),y;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(y={busy:!1,result:null},e[4]=y):y=e[4];let[b,x]=(0,S.useState)(y),T;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(T={busy:!1,error:null},e[5]=T):T=e[5];let[E,D]=(0,S.useState)(T),O,k;e[6]!==p||e[7]!==l||e[8]!==_?(O=()=>{_||(p?v(p):l&&v(l))},k=[p,l,_],e[6]=p,e[7]=l,e[8]=_,e[9]=O,e[10]=k):(O=e[9],k=e[10]),(0,S.useEffect)(O,k);let A;bb0:{let t;e[11]===_?t=e[12]:(t=_.trim(),e[11]=_,e[12]=t);let n=t;if(n){A=n;break bb0}A=p??l??``}let j=A,M=!p&&!!l&&j===l,N;e[13]!==_||e[14]!==j?(N=async()=>{let e=_.trim()||j;if(e){x({busy:!0,result:null});try{x({busy:!1,result:await re(e)})}catch(e){let t=e;x({busy:!1,result:{ok:!1,code:`NETWORK_ERROR`,message:t instanceof Error?t.message:String(t)}})}}},e[13]=_,e[14]=j,e[15]=N):N=e[15];let de=N,fe;e[16]===j?fe=e[17]:(fe=async()=>{let e=j.trim();if(e){D({busy:!0,error:null});try{await ie(e),await h(),D({busy:!1,error:null})}catch(e){let t=e;D({busy:!1,error:t instanceof Error?t.message:String(t)})}}},e[16]=j,e[17]=fe);let pe=fe,P;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(P=async()=>{D({busy:!0,error:null});try{await ie(null),await h(),v(``),x({busy:!1,result:null}),D({busy:!1,error:null})}catch(e){let t=e;D({busy:!1,error:t instanceof Error?t.message:String(t)})}},e[18]=P):P=e[18];let me=P;if(!i)return null;let F;e[19]!==r.subtitle||e[20]!==r.title?(F=(0,w.jsx)(te,{icon:a,title:r.title,subtitle:r.subtitle}),e[19]=r.subtitle,e[20]=r.title,e[21]=F):F=e[21];let I;e[22]===r.urlLabel?I=e[23]:(I=(0,w.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`reverse-proxy-url`,children:r.urlLabel}),e[22]=r.urlLabel,e[23]=I);let L;e[24]===Symbol.for(`react.memo_cache_sentinel`)?(L=c(oe(),`font-mono text-xs sm:flex-1 sm:min-w-0 sm:w-auto`),e[24]=L):L=e[24];let R;e[25]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>{v(e.target.value),x({busy:!1,result:null})},e[25]=R):R=e[25];let z;e[26]!==_||e[27]!==r.urlPlaceholder||e[28]!==L?(z=(0,w.jsx)(`input`,{id:`reverse-proxy-url`,className:L,type:`text`,autoComplete:`off`,spellCheck:!1,placeholder:r.urlPlaceholder,value:_,onChange:R}),e[26]=_,e[27]=r.urlPlaceholder,e[28]=L,e[29]=z):z=e[29];let B;e[30]===de?B=e[31]:(B=()=>void de(),e[30]=de,e[31]=B);let V;e[32]!==_||e[33]!==b.busy?(V=b.busy||!_.trim(),e[32]=_,e[33]=b.busy,e[34]=V):V=e[34];let H;e[35]===b.busy?H=e[36]:(H=b.busy?(0,w.jsx)(o,{className:`size-3.5 animate-spin`}):null,e[35]=b.busy,e[36]=H);let he=b.busy?r.probing:r.probeButton,U;e[37]!==B||e[38]!==V||e[39]!==H||e[40]!==he?(U=(0,w.jsxs)(m,{type:`button`,variant:`secondary`,className:`shrink-0 whitespace-nowrap`,onClick:B,disabled:V,children:[H,he]}),e[37]=B,e[38]=V,e[39]=H,e[40]=he,e[41]=U):U=e[41];let W;e[42]!==z||e[43]!==U?(W=(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch`,children:[z,U]}),e[42]=z,e[43]=U,e[44]=W):W=e[44];let G;e[45]===r.urlHint?G=e[46]:(G=(0,w.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r.urlHint}),e[45]=r.urlHint,e[46]=G);let K;e[47]!==l||e[48]!==M||e[49]!==r.autoDetectedHint||e[50]!==r.autoDetectedTitle?(K=M&&l?(0,w.jsxs)(`div`,{className:`rounded-lg bg-accent-soft/60 px-3 py-2 text-xs leading-relaxed text-accent-fg`,children:[(0,w.jsx)(`div`,{className:`font-medium`,children:r.autoDetectedTitle}),(0,w.jsx)(`div`,{className:`mt-1 break-all font-mono text-[11px]`,children:l}),(0,w.jsx)(`p`,{className:`mt-1`,children:r.autoDetectedHint})]}):null,e[47]=l,e[48]=M,e[49]=r.autoDetectedHint,e[50]=r.autoDetectedTitle,e[51]=K):K=e[51];let q;e[52]!==b.result||e[53]!==r.probeStatus?(q=b.result?(0,w.jsx)(ue,{result:b.result,labels:r.probeStatus}):null,e[52]=b.result,e[53]=r.probeStatus,e[54]=q):q=e[54];let J;e[55]!==p||e[56]!==j||e[57]!==pe||e[58]!==r.saveAsDefault||e[59]!==r.saving||e[60]!==E.busy?(J=j&&p!==j?(0,w.jsxs)(m,{type:`button`,onClick:()=>void pe(),disabled:E.busy,children:[E.busy?(0,w.jsx)(o,{className:`size-3.5 animate-spin`}):null,E.busy?r.saving:r.saveAsDefault]}):null,e[55]=p,e[56]=j,e[57]=pe,e[58]=r.saveAsDefault,e[59]=r.saving,e[60]=E.busy,e[61]=J):J=e[61];let Y;e[62]!==p||e[63]!==r.clear||e[64]!==E.busy?(Y=p?(0,w.jsx)(m,{type:`button`,variant:`ghost`,onClick:()=>void me(),disabled:E.busy,children:r.clear}):null,e[62]=p,e[63]=r.clear,e[64]=E.busy,e[65]=Y):Y=e[65];let X;e[66]!==J||e[67]!==Y?(X=(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:flex-wrap`,children:[J,Y]}),e[66]=J,e[67]=Y,e[68]=X):X=e[68];let Z;e[69]===E.error?Z=e[70]:(Z=E.error?(0,w.jsx)(`p`,{className:`text-xs text-red-800 dark:text-red-200`,children:E.error}):null,e[69]=E.error,e[70]=Z);let Q;e[71]===r.certWarning?Q=e[72]:(Q=(0,w.jsx)(`div`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs leading-relaxed text-amber-950 dark:bg-amber-950/30 dark:text-amber-100`,children:r.certWarning}),e[71]=r.certWarning,e[72]=Q);let $;e[73]!==I||e[74]!==W||e[75]!==G||e[76]!==K||e[77]!==q||e[78]!==X||e[79]!==Z||e[80]!==Q?($=(0,w.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[I,W,G,K,q,X,Z,Q]}),e[73]=I,e[74]=W,e[75]=G,e[76]=K,e[77]=q,e[78]=X,e[79]=Z,e[80]=Q,e[81]=$):$=e[81];let ge;return e[82]!==F||e[83]!==$?(ge=(0,w.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,w.jsxs)(ne,{children:[F,$]})}),e[82]=F,e[83]=$,e[84]=ge):ge=e[84],ge}function ce(e){return e.conversationId}function le(e){return e.language}function ue(e){let t=(0,C.c)(18),{result:n,labels:r}=e;if(n.ok){let e;t[0]===r.ok?e=t[1]:(e=(0,w.jsx)(`span`,{className:`font-medium`,children:r.ok}),t[0]=r.ok,t[1]=e);let i;t[2]===n.latencyMs?i=t[3]:(i=(0,w.jsxs)(`span`,{className:`font-mono`,children:[n.latencyMs,`ms`]}),t[2]=n.latencyMs,t[3]=i);let a;t[4]!==r.gatewayReady||t[5]!==n.gatewayReady?(a=n.gatewayReady?(0,w.jsxs)(w.Fragment,{children:[` · `,(0,w.jsx)(`span`,{children:r.gatewayReady})]}):null,t[4]=r.gatewayReady,t[5]=n.gatewayReady,t[6]=a):a=t[6];let o;return t[7]!==e||t[8]!==i||t[9]!==a?(o=(0,w.jsxs)(`div`,{className:`rounded-lg bg-emerald-50 px-3 py-2 text-xs text-emerald-900 dark:bg-emerald-950/30 dark:text-emerald-100`,children:[e,` · `,i,a]}),t[7]=e,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}let i=r[`code_${n.code}`]??r.codeUnknown,a;t[11]===i?a=t[12]:(a=(0,w.jsx)(`span`,{className:`font-medium`,children:i}),t[11]=i,t[12]=a);let o;t[13]===n.message?o=t[14]:(o=n.message?(0,w.jsxs)(w.Fragment,{children:[` — `,(0,w.jsx)(`span`,{className:`font-mono break-all`,children:n.message})]}):null,t[13]=n.message,t[14]=o);let s;return t[15]!==a||t[16]!==o?(s=(0,w.jsxs)(`div`,{className:`rounded-lg bg-red-50 px-3 py-2 text-xs text-red-900 dark:bg-red-950/30 dark:text-red-100`,children:[a,o]}),t[15]=a,t[16]=o,t[17]=s):s=t[17],s}async function de(){let e=await l(f(`/api/device-pairing/readiness`));return{ready:e.ready,routes:e.routes,protocolVersion:e.protocolVersion}}async function fe(e){try{return{kind:`ready`,setup:(await l(f(`/api/device-pairing/setups`),{method:`POST`,body:JSON.stringify({targetKind:e})})).setup}}catch(e){if(e.body?.error?.code===`NO_SECURE_ROUTE`)return{kind:`needs-secure-route`};throw e}}async function pe(e){return l(f(`/api/device-pairing/setups/${encodeURIComponent(e)}`))}async function P(e){await l(f(`/api/device-pairing/setups/${encodeURIComponent(e)}`),{method:`DELETE`})}async function me(e,t){await l(f(`/api/device-pairing/requests/${encodeURIComponent(e.requestId)}/decision`),{method:`POST`,body:JSON.stringify({decision:t,expectedRevision:e.revision})})}async function F(){let e=await d(f(`/api/browser/extension/archive`));if(!e.ok)throw Error(`Browser extension download failed (${e.status})`);let t=e.headers.get(`Content-Disposition`)??``,n=/filename="([^"]+)"/.exec(t)?.[1]??`xopc-browser-extension.zip`,r=URL.createObjectURL(await e.blob());try{let e=document.createElement(`a`);e.href=r,e.download=n,e.click()}finally{URL.revokeObjectURL(r)}}var I=`https://console.xopc.ai/access/client`;function L(e){if(!e||typeof e!=`object`)return;let t=e.body;if(!t||typeof t!=`object`)return;let n=t.error;if(!n||typeof n!=`object`)return;let r=n.code;return typeof r==`string`?r:void 0}function R(e){return[`tunnel_oauth_required`,`invalid_token`,`insufficient_scope`].includes(L(e)??``)}async function z(){return l(f(`/api/tunnel/status`))}async function B(){await l(f(`/api/tunnel/consent`),{method:`POST`,body:JSON.stringify({})})}async function V(){await l(f(`/api/tunnel/registration-key`),{method:`POST`,body:JSON.stringify({})})}async function H(){return l(f(`/api/tunnel/start`),{method:`POST`,body:JSON.stringify({})})}async function he(e){return l(f(`/api/tunnel/stop`),{method:`POST`,body:JSON.stringify({release:e?.release===!0})})}async function U(){let e=(await l(f(`/api/tunnel/reveal-registration-secret`),{method:`POST`,body:JSON.stringify({})})).payload;if(!e)throw Error(`Missing reveal payload`);return{registrationSecret:e.registrationSecret??null,source:e.source===`config`?`config`:`none`}}async function W(e){await l(f(`/api/config`),{method:`PATCH`,body:JSON.stringify({tunnel:e})})}export{N as _,B as a,T as b,he as c,P as d,fe as f,pe as g,de as h,V as i,L as l,F as m,z as n,U as o,me as p,W as r,H as s,I as t,R as u,j as v,E as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{_ as ee}from"./chunk-KS7C4IRE--EKdQGRF.js";import{t as i}from"./popover-select-DHC7J4lG.js";import{t as a}from"./circle-alert-BEjgurr2.js";import{t as o}from"./messages-CKTo_sIF.js";import{a as s,n as c,r as l}from"./locale-store-BpK9AiDq.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{t as d}from"./button-aIC072nz.js";import{t as f}from"./skeleton-BI5TyibZ.js";import{Fo as p,Pc as m,cs as h,gc as g,kc as _,tl as te}from"./index-DFgXwLsv.js";import{n as v,r as y}from"./settings-page-layout-Dx5S-Msc.js";import{t as b}from"./xopc-cloud-account-card-CU5lzzE9.js";var x=e(t(),1),S=n();function C(e,t=Date.now()+1){let n=t-e*24*60*60*1e3;return new URLSearchParams({from:String(n),to:String(t)}).toString()}function w(e){return s(l(`/api/usage/summary?${e}`))}function T(e,t,n=20){let r=new URLSearchParams(e);return r.set(`limit`,String(n)),t&&r.set(`cursor`,t),s(l(`/api/usage/events?${r}`))}var E=r();function D(e,t){return new Intl.NumberFormat(t===`zh`?`zh-CN`:`en-US`,{notation:`compact`,maximumFractionDigits:1}).format(e)}function O(e){return`$${Number(e).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:6})}`}function k(e){let t=BigInt(e),n=String(t%10000n).padStart(4,`0`).replace(/0+$/,``);return`${t/10000n}${n?`.${n}`:``}`}function A(e,t){return new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}).format(e)}function j(){let e=(0,S.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,E.jsxs)(`div`,{className:`space-y-4`,"aria-busy":`true`,children:[(0,E.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[0,1,2,3].map(M)}),(0,E.jsx)(f,{className:`h-52 rounded-xl`}),(0,E.jsx)(f,{className:`h-72 rounded-xl`})]}),e[0]=t):t=e[0],t}function M(e){return(0,E.jsx)(f,{className:`h-24 rounded-xl`},e)}function N(){let e=c(e=>e.language),t=o(e).usage,[n,r]=ee(),s=[`7`,`30`,`90`].includes(n.get(`days`)??``)?n.get(`days`):`7`,l=n.get(`size`)===`50`?50:20,S=n.getAll(`cursor`),M=S.at(-1),[N]=(0,x.useState)(()=>Date.now()+1),P=Number(n.get(`to`)),F=Number.isSafeInteger(P)&&P>Number(s)*864e5?P:N,I=(0,x.useMemo)(()=>C(Number(s),F),[s,F]),L=u([`usage-summary`,I],()=>w(I),{refreshInterval:15e3}),R=u([`usage-events`,I,M,l],()=>T(I,M,l),{refreshInterval:15e3}),z=!L.data&&!L.error,B=L.error,V=e=>{let t=new URLSearchParams(n);t.set(`to`,String(F)),e(t),r(t)},H=e=>V(t=>{t.set(`days`,e),t.set(`to`,String(Date.now()+1)),t.delete(`cursor`),t.delete(`groupPage`)}),U=n.get(`group`)===`model`?`model`:`scenario`,W=[...U===`model`?L.data?.byModel??[]:L.data?.byCategory??[]].sort((e,t)=>t.totals.calls-e.totals.calls||e.key.localeCompare(t.key)),G=Math.max(1,Math.ceil((W?.length??0)/6)),K=Number(n.get(`groupPage`)),q=Math.min(G,Number.isSafeInteger(K)&&K>0?K:1),J=W?.slice((q-1)*6,q*6),Y=S.length+1,X=L.data?.totals,Z=(X?.billing?.cloud.calls??0)>0,Q=e=>{let n=e.billing?.cloud;return n?.calls?n.chargedCreditMicro===null?t.cloudUnconfirmed:`${n.pendingCalls+n.unavailableCalls>0?`≥ `:``}${k(n.chargedCreditMicro)} Credits`:t.noCloudCalls},$=e=>{let n=e.billing?.external;return n?.calls?n.unknownCostCalls===n.calls?t.costUnknown:`${n.unknownCostCalls>0?`≥ `:`≈ `}${O(n.estimatedCostUsd)}`:t.noExternalCalls},ne=e=>e.billing?.source===`local`||e.provider!==`xopc-cloud`&&e.costSource===`local`?t.localSource:e.billing?.source===`xopc_cloud`||e.provider===`xopc-cloud`?t.cloudSource:t.externalSource,re=e=>{let n=e.billing;return n?.source===`local`?t.localNoCharge:n?.source===`xopc_cloud`?n.state===`settled`&&n.chargedCreditMicro!==null?`${k(n.chargedCreditMicro)} Credits`:n.state===`released`?t.cloudReleased:n.state===`pending`?n.reservedCreditMicro===null?t.cloudPending:t.cloudPendingReserved.replace(`{{credits}}`,k(n.reservedCreditMicro)):t.cloudUnconfirmed:e.provider===`xopc-cloud`?t.cloudUnconfirmed:e.costSource===`local`?t.localNoCharge:e.estimatedCostUsd===void 0?t.costUnknown:`≈ ${O(e.estimatedCostUsd)}`},ie=e=>(0,E.jsxs)(`span`,{className:`flex flex-col items-end gap-1 text-xs`,children:[e.billing?.cloud.calls?(0,E.jsxs)(`span`,{children:[t.cloudSource,`: `,Q(e)]}):null,e.billing?.external.calls?(0,E.jsxs)(`span`,{children:[t.externalSource,`: `,$(e)]}):null,e.billing?.localCalls?(0,E.jsx)(`span`,{children:t.localNoCharge}):null,(0,E.jsxs)(`span`,{children:[e.calls,` `,t.callUnit]})]}),ae={"usage.reason.imageGeneration":t.reasons.imageGeneration,"usage.reason.audioTranscription":t.reasons.audioTranscription,"usage.reason.audioSpeech":t.reasons.audioSpeech,"usage.reason.agentAnswer":t.reasons.agentAnswer,"usage.reason.continueAfterTool":t.reasons.continueAfterTool,"usage.reason.backgroundReview":t.reasons.backgroundReview,"usage.reason.sessionCompaction":t.reasons.sessionCompaction,"usage.reason.sessionTitle":t.reasons.sessionTitle,"usage.reason.imageUnderstanding":t.reasons.imageUnderstanding,"usage.reason.webExtract":t.reasons.webExtract,"usage.reason.sessionSearch":t.reasons.sessionSearch,"usage.reason.noteGeneration":t.reasons.noteGeneration,"usage.reason.automationDraft":t.reasons.automationDraft,"usage.reason.sceneExecution":t.reasons.sceneExecution,"usage.reason.taskPlanning":t.reasons.taskPlanning,"usage.reason.taskJudging":t.reasons.taskJudging,"usage.reason.voiceSummary":t.reasons.voiceSummary,"usage.reason.voiceSelection":t.reasons.voiceSelection,"usage.reason.homeAdvice":t.reasons.homeAdvice,"usage.reason.workDiscovery":t.reasons.workDiscovery,"usage.reason.workInvestigation":t.reasons.workInvestigation,"usage.reason.discussionAnalysis":t.reasons.discussionAnalysis,"usage.reason.textAssist":t.reasons.textAssist,"usage.reason.userModelInterpretation":t.reasons.userModelInterpretation,"usage.reason.other":t.reasons.other};return(0,E.jsxs)(y,{children:[(0,E.jsx)(v,{title:t.title,subtitle:t.subtitle,actions:(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(`div`,{className:`w-36`,children:(0,E.jsx)(i,{value:s,allowEmpty:!1,ariaLabel:t.periodLabel,placeholder:t.periodLabel,options:[{value:`7`,label:t.last7Days},{value:`30`,label:t.last30Days},{value:`90`,label:t.last90Days}],onChange:H})}),(0,E.jsx)(d,{variant:`ghost`,"aria-label":t.refresh,title:t.refresh,onClick:()=>H(s),children:(0,E.jsx)(h,{className:`size-4`,"aria-hidden":!0})})]})}),z?(0,E.jsx)(j,{}):B?(0,E.jsxs)(`div`,{role:`alert`,className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-inset p-4 text-sm text-fg-muted`,children:[(0,E.jsx)(a,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),(0,E.jsxs)(`div`,{className:`space-y-2`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`p`,{className:`font-medium text-fg`,children:t.loadError}),(0,E.jsx)(`p`,{className:`mt-1`,children:String(B.message??B)})]}),(0,E.jsx)(d,{variant:`secondary`,onClick:()=>void Promise.all([L.mutate(),R.mutate()]),children:t.retry})]})]}):X?(0,E.jsxs)(`div`,{className:`space-y-5`,children:[(0,E.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.summaryLabel}),(0,E.jsx)(`section`,{"aria-label":t.summaryLabel,className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[{label:t.cloudCharged,value:Q(X),icon:m},{label:t.knownCost,value:$(X),icon:m},{label:t.calls,value:X.calls.toLocaleString(),icon:g},{label:t.tokens,value:D(X.totalTokens,e),icon:_}].map(e=>(0,E.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,E.jsx)(e.icon,{className:`size-4`,"aria-hidden":!0}),e.label]}),(0,E.jsx)(`div`,{className:`mt-2 text-xl font-semibold tabular-nums text-fg`,children:e.value})]},e.label))}),(X.billing?.external.unknownCostCalls??0)>0?(0,E.jsx)(`p`,{className:`rounded-lg border border-edge bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-muted`,children:X.billing?.external.unknownCostCalls===X.billing?.external.calls?t.allCostsUnknown:t.someCostsUnknown}):null,X.billing?.cloud.calls?(0,E.jsxs)(`p`,{className:`rounded-lg border border-edge bg-surface-inset px-3 py-2 text-xs leading-5 text-fg-muted`,children:[t.cloudCoverage.replace(`{{pending}}`,String(X.billing.cloud.pendingCalls)).replace(`{{unknown}}`,String(X.billing.cloud.unavailableCalls)),X.billing.cloud.reservedCreditMicro===null?``:` ${t.cloudReserved.replace(`{{credits}}`,k(X.billing.cloud.reservedCreditMicro))}`]}):null,(0,E.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.distribution}),(0,E.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.distributionHint})]}),(0,E.jsx)(`div`,{className:`flex gap-1`,role:`group`,"aria-label":t.distribution,children:[`scenario`,`model`].map(e=>(0,E.jsx)(d,{variant:U===e?`secondary`:`ghost`,"aria-pressed":U===e,onClick:()=>V(t=>{t.set(`group`,e),t.delete(`groupPage`)}),children:e===`scenario`?t.byScenario:t.byModel},e))})]}),(0,E.jsx)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:J?.length?J.map(e=>{let n=U===`scenario`?t.categories[e.key]??e.key:e.key;return(0,E.jsxs)(`div`,{className:`flex flex-col gap-3 py-3 text-sm sm:flex-row sm:items-center sm:justify-between`,children:[(0,E.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,E.jsx)(`p`,{className:`truncate font-medium text-fg`,title:n,children:n}),(0,E.jsx)(`div`,{className:`mt-2 h-1 max-w-64 overflow-hidden rounded-full bg-surface-inset`,"aria-hidden":!0,children:(0,E.jsx)(`div`,{className:`h-full rounded-full bg-accent`,style:{width:`${X.calls?e.totals.calls/X.calls*100:0}%`}})})]}),(0,E.jsx)(`div`,{className:`shrink-0 self-end tabular-nums text-fg-muted sm:self-auto`,children:ie(e.totals)})]},e.key)}):(0,E.jsx)(`p`,{className:`py-5 text-sm text-fg-subtle`,children:t.empty})}),G>1?(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-edge px-4 py-3`,children:[(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,"aria-live":`polite`,children:t.groupPage.replace(`{{page}}`,String(q)).replace(`{{pages}}`,String(G)).replace(`{{count}}`,String(W?.length??0))}),(0,E.jsxs)(`div`,{className:`flex gap-2`,children:[(0,E.jsx)(d,{disabled:q===1,"aria-label":t.previousDistribution,onClick:()=>V(e=>e.set(`groupPage`,String(q-1))),children:t.previousPage}),(0,E.jsx)(d,{disabled:q===G,"aria-label":t.nextDistribution,onClick:()=>V(e=>e.set(`groupPage`,String(q+1))),children:t.nextPage})]})]}):null]}),(0,E.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.recentCalls}),(0,E.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:t.recentCallsHint})]}),(0,E.jsx)(`div`,{className:`w-36`,children:(0,E.jsx)(i,{value:String(l),allowEmpty:!1,ariaLabel:t.pageSize,placeholder:t.pageSize,options:[20,50].map(e=>({value:String(e),label:t.rowsPerPage.replace(`{{count}}`,String(e))})),onChange:e=>V(t=>{t.set(`size`,e),t.delete(`cursor`)})})})]}),(0,E.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:R.error?(0,E.jsxs)(`div`,{role:`alert`,className:`space-y-3 p-4 text-sm text-fg-muted`,children:[(0,E.jsx)(`p`,{children:t.loadError}),(0,E.jsx)(d,{onClick:()=>void R.mutate(),children:t.retry})]}):R.data?R.data.items.length?R.data.items.map(n=>(0,E.jsxs)(`article`,{className:`grid gap-2 px-4 py-3 text-sm sm:grid-cols-[minmax(0,1fr)_auto] sm:items-center`,children:[(0,E.jsxs)(`div`,{className:`min-w-0`,children:[(0,E.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,E.jsx)(te,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),(0,E.jsx)(`span`,{className:`truncate font-medium text-fg`,children:ae[n.reasonKey]??t.reasons.other})]}),(0,E.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-subtle`,children:[(0,E.jsxs)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[n.provider,`/`,n.model]}),(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,E.jsx)(p,{className:`size-3`,"aria-hidden":!0}),A(n.startedAt,e)]}),(0,E.jsx)(`span`,{className:`rounded border border-edge px-1.5 py-0.5`,children:ne(n)}),(0,E.jsx)(`span`,{children:n.totalTokens===void 0?t.tokensUnknown:`${D(n.totalTokens,e)} tokens`})]})]}),(0,E.jsxs)(`div`,{className:`text-left tabular-nums text-fg sm:text-right`,children:[re(n),(0,E.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-subtle`,children:t.status[n.status]??n.status})]})]},n.id)):(0,E.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-subtle`,children:t.empty}):(0,E.jsx)(`div`,{"aria-busy":`true`,className:`space-y-3 p-4`,children:[0,1,2,3].map(e=>(0,E.jsx)(f,{className:`h-16`},e))})}),(0,E.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 border-t border-edge px-4 py-3`,children:[(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,"aria-live":`polite`,children:t.eventPage.replace(`{{page}}`,String(Y)).replace(`{{count}}`,String(R.data?.items.length??0))}),(0,E.jsxs)(`nav`,{className:`flex gap-2`,"aria-label":t.pagination,children:[Y>1?(0,E.jsx)(d,{variant:`ghost`,onClick:()=>V(e=>e.delete(`cursor`)),children:t.firstPage}):null,(0,E.jsx)(d,{disabled:Y===1,onClick:()=>V(e=>{e.delete(`cursor`),S.slice(0,-1).forEach(t=>e.append(`cursor`,t))}),children:t.previousPage}),(0,E.jsx)(d,{disabled:!R.data?.nextCursor||!!R.error,onClick:()=>V(e=>{R.data?.nextCursor&&e.append(`cursor`,R.data.nextCursor)}),children:t.nextPage})]})]})]}),(0,E.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,E.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg focus-visible:outline-accent`,children:t.billingDetails}),(0,E.jsx)(`p`,{className:`mt-3 text-xs leading-5 text-fg-muted`,children:t.cloudBillingHint}),(0,E.jsx)(`a`,{className:`mt-2 inline-block text-xs text-accent-fg hover:underline`,href:`https://console.xopc.ai/models/billing`,target:`_blank`,rel:`noreferrer`,children:t.cloudCreditsLabel}),Z?(0,E.jsx)(`div`,{className:`mt-4`,children:(0,E.jsx)(b,{labels:o(e).capabilitiesSettings.xopcCloudAccount})}):null]})]}):null]})}export{N as UsageSettingsPage};
|
package/dist/gateway/static/root/assets/{use-autosave-CzyqRffr.js → use-autosave-DDjIdW4U.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./check-DUBLcKHA.js";import{t as a}from"./circle-alert-BEjgurr2.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./cn-0WouolD0.js";import{n as c}from"./locale-store-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./check-DUBLcKHA.js";import{t as a}from"./circle-alert-BEjgurr2.js";import{t as o}from"./loader-circle-CifKLtgG.js";import{t as s}from"./cn-0WouolD0.js";import{n as c}from"./locale-store-BpK9AiDq.js";var l=n(),u=r();function d(e){let t=(0,l.c)(21),{status:n,error:r,className:d}=e,p=c(f)===`zh`;if(n===`idle`)return null;let m=n===`saving`?p?`正在保存…`:`Saving…`:n===`saved`?p?`已自动保存`:`Saved automatically`:n===`error`?r||(p?`自动保存失败`:`Autosave failed`):n===`dirty`?p?`编辑中,将自动保存`:`Editing — autosave pending`:``,h=n===`error`?`text-danger`:n===`saved`?`text-success`:`text-fg-subtle`,g;t[0]!==d||t[1]!==h?(g=s(`inline-flex min-w-0 items-center gap-1.5 text-xs`,h,d),t[0]=d,t[1]=h,t[2]=g):g=t[2];let _;t[3]===n?_=t[4]:(_=n===`saving`?(0,u.jsx)(o,{className:`size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}):null,t[3]=n,t[4]=_);let v;t[5]===n?v=t[6]:(v=n===`saved`?(0,u.jsx)(i,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[5]=n,t[6]=v);let y;t[7]===n?y=t[8]:(y=n===`error`?(0,u.jsx)(a,{className:`size-3.5 shrink-0`,"aria-hidden":!0}):null,t[7]=n,t[8]=y);let b;t[9]===n?b=t[10]:(b=n===`dirty`?(0,u.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-current`,"aria-hidden":!0}):null,t[9]=n,t[10]=b);let x;t[11]===m?x=t[12]:(x=(0,u.jsx)(`span`,{className:`truncate`,children:m}),t[11]=m,t[12]=x);let S;return t[13]!==m||t[14]!==g||t[15]!==_||t[16]!==v||t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,u.jsxs)(`span`,{className:g,role:`status`,"aria-live":`polite`,title:m,children:[_,v,y,b,x]}),t[13]=m,t[14]=g,t[15]=_,t[16]=v,t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20],S}function f(e){return e.language}var p=e(t(),1);function m({value:e,dirty:t,onSave:n,enabled:r=!0,delayMs:i=700,validate:a,serialize:o=JSON.stringify}){let[s,c]=(0,p.useState)(`idle`),[l,u]=(0,p.useState)(null),d=(0,p.useRef)(e),f=(0,p.useRef)(n),m=(0,p.useRef)(a),h=(0,p.useRef)(o),g=(0,p.useRef)(null),_=(0,p.useRef)(!1),v=(0,p.useRef)(null),y=(0,p.useRef)(null),b=(0,p.useRef)(null),x=(0,p.useRef)(!0);d.current=e,f.current=n,m.current=a,h.current=o;let S=(0,p.useCallback)(()=>{g.current!==null&&(window.clearTimeout(g.current),g.current=null)},[]),C=(0,p.useCallback)(async e=>{S();let t=h.current(e);b.current=t;let n=m.current?.(e)??null;if(n){u(n),c(`error`);return}if(_.current){v.current=e;return}_.current=!0,u(null),c(`saving`);try{await f.current(e),y.current=t,x.current&&c(`saved`)}catch(e){x.current&&(u(e instanceof Error?e.message:String(e)),c(`error`))}finally{_.current=!1;let e=v.current;v.current=null,e&&h.current(e)!==y.current&&C(e)}},[S]),w=(0,p.useCallback)(()=>{let e=d.current;!r||!t||e===null||C(e)},[t,r,C]),T=(0,p.useCallback)(e=>{let t=e??d.current;!r||t===null||C(t)},[r,C]);return(0,p.useEffect)(()=>{if(!r||!t||e===null){S(),!t&&s===`dirty`&&c(`idle`);return}let n=o(e);if(n!==y.current&&!(s===`error`&&n===b.current))return c(e=>e===`saving`?e:`dirty`),S(),g.current=window.setTimeout(()=>void C(e),i),S},[S,i,t,r,C,o,s,e]),(0,p.useEffect)(()=>(x.current=!0,()=>{x.current=!1,S()}),[S]),(0,p.useEffect)(()=>{if(s!==`saved`)return;let e=window.setTimeout(()=>c(`idle`),1600);return()=>window.clearTimeout(e)},[s]),{status:s,error:l,flush:w,saveNow:T,retry:w,onBlurCapture:w}}export{d as n,m as t};
|