@xopcai/xopc 0.0.411 → 0.0.413
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/{agent-avatar-dicebear-sGJnq-SA.js → agent-avatar-dicebear-BT6oqCMD.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BFmRRD_4.js +1 -0
- package/dist/gateway/static/root/assets/agents-Clwskw2J.js +77 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-uGDeJR1f.js → agents-admin-api-CeBkHnl8.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-BdCgtTfT.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-C3-hCFlF.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-DJbKg3va.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-CGdU_E5B.js → archive-plugin-BviFGCy4.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BAPZY56r.js → automations-page-CfzazXE5.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-D_X0_1X3.js +8 -0
- package/dist/gateway/static/root/assets/{binary-plugins-B0ispXo2.js → binary-plugins-Dp-gtJEk.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-B9Ci-prO.js → block-editor-D-DEPdpi.js} +4 -4
- package/dist/gateway/static/root/assets/{browser-automation-inputs-D4-vQc4g.js → browser-automation-inputs-D1pDgMJu.js} +1 -1
- package/dist/gateway/static/root/assets/browser-automations-page-BI-ep6uM.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-BTyQ4-vN.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-Bpeh6E22.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-GNS95mG9.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DBiv1HN-.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-Cic05oWh.js → capability-header-actions-CP2fI9Fe.js} +1 -1
- package/dist/gateway/static/root/assets/channels-DWlrUKBr.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Bm-IGeDe.js → chat-terminal-dock-BL3tFntQ.js} +2 -2
- package/dist/gateway/static/root/assets/computer-settings-page-DEQ5GYfC.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-DcdASUU9.js → connector-service-page-CecwMnC5.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-BcpUvrtl.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-gVLWu9R0.js → date-picker-N5jnlvPs.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-C0LARyok.js → dependency-picker-C4jddxFl.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-v_le3sCs.js → desktop-pet-BCbiUNQG.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-CkKU0JMY.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard--E2GQoY1.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-CBefVUPR.js → directory-picker-path-field-CbMbPimD.js} +1 -1
- package/dist/gateway/static/root/assets/extension-debug-page-OE1nJMQ8.js +1 -0
- package/dist/gateway/static/root/assets/{extension-page-C0-oP7S_.js → extension-page-BEomiKhy.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BFOjQeSX.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-BVqYVaGy.js → gateway-config-swr-DF_HV6NP.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-CY1LBGBS.js → gateway-realtime-DMAzNlm-.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-CoIgC1Al.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-CR4CsfNN.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CPKGkr6D.js → gateway-startup-retry-B91CBTzO.js} +1 -1
- package/dist/gateway/static/root/assets/highlight-code-6ONPRH5r.js +1 -0
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-CN5PNRN3.js → highlighted-body-KQOG7T2V-EJ9Kg4iQ.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-B9w3a6r2.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-DRLXG9Ws.js → image-generation-api-D0HNic89.js} +1 -1
- package/dist/gateway/static/root/assets/imports-page-bxTINe-2.js +1 -0
- package/dist/gateway/static/root/assets/index-D1oivYvN.js +710 -0
- package/dist/gateway/static/root/assets/index-D_7q1UkI.css +1 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-Cmi-2SIh.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-NGCmXpa_.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-BChE6nUD.js → local-apps-page-jgaogH9Z.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-BCaC-1rH.js → local-session-drafts-DvmwiLUx.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DAgpZxAS.js → locale-store-JogcXC4J.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-drrr-c2W.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-Dc1opXVr.js +1 -0
- package/dist/gateway/static/root/assets/{media-plugins-BmLuWkkZ.js → media-plugins-BRS9puQV.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-B--edI1I.js +1 -0
- package/dist/gateway/static/root/assets/{messages-DMXSIJUO.js → messages-RzwPiQNL.js} +2 -2
- package/dist/gateway/static/root/assets/note-detail-panel-C3s4-ytB.js +5 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-D7q5-KuS.js +1 -0
- package/dist/gateway/static/root/assets/notes-page-qVxoErUS.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-B7rDRlS7.js → page-context-capture-button-D_VOB2_C.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-B-T8NzQo.js +1 -0
- package/dist/gateway/static/root/assets/personal-settings-panel-BKA4fbYH.js +1 -0
- package/dist/gateway/static/root/assets/phone-dependencies-card-DhEsfEUN.js +1 -0
- package/dist/gateway/static/root/assets/phone-model-picker-J4mFDk21.js +1 -0
- package/dist/gateway/static/root/assets/phone-settings-page-BLflz8CQ.js +1 -0
- package/dist/gateway/static/root/assets/plugin-details-dialog-1BwvmKZi.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Z4NM7_Dn.js → preview-open-alternatives-DaTaSKox.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-C5TcIaJj.js → product-open-page-wYlC0IVZ.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-5xID6jIj.js → product-preview-content-Bxur-p6S.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DwowzxzD.js +7 -0
- package/dist/gateway/static/root/assets/projects-page-Bwvn4i_e.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-B6kqbuw8.js → registry-api-BGqSwITi.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DrHisOUe.js +1 -0
- package/dist/gateway/static/root/assets/runtime-tools-api-CSm5SpnR.js +5 -0
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-DXNidliV.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-DtPkiYwm.js → schema-form-DeSZ7SiO.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-D6-Vz8xK.js → session-api-DTxZyMta.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-DWbcMHcj.js → session-manager-B2HDomj4.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-seP7t0kv.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-VqBu7gHu.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DD3iD5t5.js → settings-form-section-BNYQjZU4.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-iLY3LRDq.js → settings-page-29Ix0jSQ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-Dx5S-Msc.js → settings-page-header-CYpuTXUW.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-layout-B20AfmFG.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-COQZgKX9.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-B8h9lqDL.js → share-preview-page-CwMRULXc.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BWaykw9E.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-C9RsrvOp.js → skill-api-xfB5fUAh.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Bq-3_MCt.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-C3LfWsAZ.js +2 -0
- package/dist/gateway/static/root/assets/system-settings-panel-DRJu1ehM.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-XCJFP-Aa.js +2 -0
- package/dist/gateway/static/root/assets/{task-result-evidence-DjNWPpn_.js → task-result-evidence-C4o_Yue_.js} +1 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-CYslh-Pu.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-C6XfsSWy.js → tunnel-api-Bi_kw6bv.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-CTTmklCs.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-DO-Twmbm.js → use-autosave-BkB9uD93.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-BDqguzRE.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-MGe3HkS_.js → voice-api-key-field-bt8_Agih.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-CPKzUb4R.js → voice-config-api-D7xsWrdh.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DptHqYh5.js → work-discovery-overlay-D3NG14dX.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Y_UIryBH.js → xopc-cloud-account-card-B2OUKOQi.js} +1 -1
- package/dist/gateway/static/root/index.html +14 -14
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/capabilities.js +1 -0
- package/dist/src/agent/agent-manager.js +1 -1
- package/dist/src/agent/background-review/prompts.js +4 -3
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/run-turn.js +1 -1
- package/dist/src/agent/embedded/xopc-stream-bridge.js +7 -3
- package/dist/src/agent/external-tools/cliProvider.js +2 -2
- package/dist/src/agent/external-tools/composio-provider.js +2 -2
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/prompt/system-prompt.js +1 -1
- package/dist/src/agent/service.js +1 -1
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/tool-manuals/index.js +7 -0
- package/dist/src/agent/tool-manuals/phone.d.ts +1 -0
- package/dist/src/agent/tool-manuals/phone.js +16 -0
- package/dist/src/agent/tools/factory.js +15 -0
- package/dist/src/agent/tools/knowledge-memory-tool.js +1 -1
- package/dist/src/agent/tools/personal-read-tool.js +1 -1
- package/dist/src/agent/tools/personal-task-tool.d.ts +2 -1
- package/dist/src/agent/tools/personal-task-tool.js +43 -20
- package/dist/src/agent/tools/phone-use-tool.d.ts +8 -0
- package/dist/src/agent/tools/phone-use-tool.js +49 -0
- package/dist/src/agent/tools/session-recall-tool.js +2 -1
- package/dist/src/agent/tools/session-search-tool.js +11 -5
- package/dist/src/agent/tools/user-context-tool.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/agent-catalog/repository.js +5 -1
- package/dist/src/agent-config/index.js +2 -2
- package/dist/src/agent-config/resolver.js +5 -0
- package/dist/src/agent-config/schema.d.ts +24 -0
- package/dist/src/agent-config/schema.js +5 -2
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/cli/command-manifest.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/runtime.js +32 -4
- package/dist/src/cli/utils/init-workspace-core.js +6 -4
- package/dist/src/computer/diagnostics.d.ts +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/config-file.d.ts +6 -0
- package/dist/src/config/config-file.js +35 -0
- package/dist/src/config/loader.js +5 -4
- package/dist/src/config/models-json.d.ts +36 -0
- package/dist/src/config/models-json.js +9 -0
- package/dist/src/config/schema.d.ts +12 -0
- package/dist/src/config/schema.js +6 -2
- package/dist/src/execution-environments/local-worktree-manager.js +1 -1
- package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +7 -1
- package/dist/src/gateway/agent-builtin-tools.js +7 -0
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/global-defaults-admin.js +2 -0
- package/dist/src/gateway/hono/lib/config-payload.d.ts +8 -0
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/models.js +3 -0
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/phone-dependencies.d.ts +3 -0
- package/dist/src/gateway/hono/routes/phone-dependencies.js +137 -0
- package/dist/src/gateway/hono/routes/phone.d.ts +4 -0
- package/dist/src/gateway/hono/routes/phone.js +445 -0
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/runtime-tools.js +2 -0
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +1 -1
- package/dist/src/gateway/server.js +1 -0
- package/dist/src/gateway/service/config-coordinator.d.ts +8 -0
- package/dist/src/gateway/service.d.ts +2 -0
- package/dist/src/gateway/service.js +17 -12
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/imports/importService.js +1 -1
- package/dist/src/knowledge-memory/repository.js +5 -0
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/memory-learning/forget-capture.js +12 -3
- package/dist/src/memory-learning/forgotten-history.d.ts +4 -0
- package/dist/src/memory-learning/forgotten-history.js +71 -4
- package/dist/src/memory-learning/work-capture.d.ts +1 -0
- package/dist/src/memory-learning/work-capture.js +28 -17
- package/dist/src/personal-agent/prompts.js +3 -2
- package/dist/src/personal-agent/service.js +1 -1
- package/dist/src/phone/adb-driver.d.ts +35 -0
- package/dist/src/phone/adb-driver.js +368 -0
- package/dist/src/phone/cloud-adb.d.ts +34 -0
- package/dist/src/phone/cloud-adb.js +223 -0
- package/dist/src/phone/cloud-phones.d.ts +29 -0
- package/dist/src/phone/cloud-phones.js +141 -0
- package/dist/src/phone/cloud-scrcpy.d.ts +20 -0
- package/dist/src/phone/cloud-scrcpy.js +122 -0
- package/dist/src/phone/contracts.d.ts +204 -0
- package/dist/src/phone/contracts.js +115 -0
- package/dist/src/phone/interactive-session.d.ts +34 -0
- package/dist/src/phone/interactive-session.js +164 -0
- package/dist/src/phone/live-provider.d.ts +57 -0
- package/dist/src/phone/live-provider.js +18 -0
- package/dist/src/phone/live-state.d.ts +28 -0
- package/dist/src/phone/live-state.js +71 -0
- package/dist/src/phone/model-adapter.d.ts +25 -0
- package/dist/src/phone/model-adapter.js +340 -0
- package/dist/src/phone/repository.d.ts +19 -0
- package/dist/src/phone/repository.js +100 -0
- package/dist/src/phone/runtime.d.ts +83 -0
- package/dist/src/phone/runtime.js +896 -0
- package/dist/src/phone/scrcpy.d.ts +62 -0
- package/dist/src/phone/scrcpy.js +345 -0
- package/dist/src/phone/stream-gateway.d.ts +26 -0
- package/dist/src/phone/stream-gateway.js +210 -0
- package/dist/src/process/phone-process.d.ts +4 -0
- package/dist/src/process/phone-process.js +38 -0
- package/dist/src/providers/extension-stream-bridge.js +8 -1
- package/dist/src/providers/model-call.js +6 -2
- package/dist/src/providers/model-catalog-persistence.js +3 -0
- package/dist/src/providers/model-catalog-types.d.ts +3 -0
- package/dist/src/providers/model-reference-auditor.js +5 -1
- package/dist/src/providers/model-registry.js +3 -0
- package/dist/src/runtime-tools/archive.d.ts +2 -2
- package/dist/src/runtime-tools/archive.js +1 -1
- package/dist/src/runtime-tools/downloader.d.ts +2 -2
- package/dist/src/runtime-tools/errors.d.ts +3 -3
- package/dist/src/runtime-tools/phone-dependencies.d.ts +40 -0
- package/dist/src/runtime-tools/phone-dependencies.js +188 -0
- package/dist/src/runtime-tools/phone-dependency-catalog.d.ts +16 -0
- package/dist/src/runtime-tools/phone-dependency-catalog.js +51 -0
- package/dist/src/runtime-tools/types.d.ts +1 -0
- package/dist/src/storage/sqlite/context-extraction-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/context-extraction-repository.js +12 -2
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.js +1 -1
- package/dist/src/tasks/task-research-result.js +19 -2
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/usage/cloud-receipts.d.ts +5 -1
- package/dist/src/usage/cloud-receipts.js +10 -4
- package/dist/src/usage/cloud-wire.d.ts +37 -0
- package/dist/src/usage/cloud-wire.js +181 -0
- package/dist/src/usage/recorder.js +5 -4
- package/dist/src/user-model/capture/semantic.js +2 -2
- package/dist/src/voice/platform-catalog.d.ts +3 -0
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/package.json +9 -4
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BI7OTo-T.js +0 -1
- package/dist/gateway/static/root/assets/agents-RIXL0p7_.js +0 -77
- package/dist/gateway/static/root/assets/app-management-settings-panel-BGzhSS6H.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-DtEZq4b2.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-DZqBof2D.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CI-yQnSj.js +0 -8
- package/dist/gateway/static/root/assets/browser-automations-page-Xzdif447.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-Bhu-83eC.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-B9b5KCBb.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-BIc0Zlsw.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CQEfpLdj.js +0 -8
- package/dist/gateway/static/root/assets/channels-DQbEoo_o.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-C9xMfwXK.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-eh-xpMPK.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-B_-j-D4W.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-CxG_FcQ6.js +0 -1
- package/dist/gateway/static/root/assets/extension-debug-page-CTe7Molh.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-DYJmgMUg.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-Dafw95ol.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-C13P4lQd.js +0 -1
- package/dist/gateway/static/root/assets/highlight-code-CslBKXdS.js +0 -1
- package/dist/gateway/static/root/assets/home-page-B_XrkGmA.js +0 -2
- package/dist/gateway/static/root/assets/imports-page--cuF5vwU.js +0 -1
- package/dist/gateway/static/root/assets/index-6YjAt50A.js +0 -710
- package/dist/gateway/static/root/assets/index-caRW34rg.css +0 -1
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-5g2PxgBs.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-B6U1HQpp.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-B9mq03SK.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-2W_qJsha.js +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-61Il2HQR.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-C4gZsNBL.js +0 -5
- package/dist/gateway/static/root/assets/note-image-lightbox-XqJIaaRV.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-Chdwrjni.js +0 -8
- package/dist/gateway/static/root/assets/personal-page-mQl9BftY.js +0 -1
- package/dist/gateway/static/root/assets/personal-settings-panel-BgcJLmZN.js +0 -1
- package/dist/gateway/static/root/assets/plugin-details-dialog-FvwSxZPB.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-CGOyx7zX.js +0 -7
- package/dist/gateway/static/root/assets/projects-page-Dd11tbRX.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Bintk9nL.js +0 -1
- package/dist/gateway/static/root/assets/runtime-tools-api-CY3R7unQ.js +0 -5
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-CbmiiLsq.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BBlEP7y3.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BCQUth4g.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-v4P0IAkG.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DMzej6z2.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-B20x7EE9.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-C_ulsnv7.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-PTRGMKkq.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-DEPwo4vf.js +0 -2
- package/dist/gateway/static/root/assets/tracing-settings-page-CVJt7IXC.js +0 -1
- package/dist/gateway/static/root/assets/usage-page-DgqLD8Y5.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-BwK37aob.js +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./messages-RzwPiQNL.js";import{n as i}from"./locale-store-JogcXC4J.js";import{Qa as a}from"./index-D1oivYvN.js";import{n as o,t as s}from"./settings-page-header-CYpuTXUW.js";import"./settings-page-layout-B20AfmFG.js";var c=t();e();var l=n();function u(){let e=(0,c.c)(40),t=i(p),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let u=n.extensionDebug,m=a(),h;e[2]===m?h=e[3]:(h=m.toSorted(f),e[2]=m,e[3]=h);let g=h,_;e[4]!==u.subtitle||e[5]!==u.title?(_=(0,l.jsx)(s,{title:u.title,subtitle:u.subtitle}),e[4]=u.subtitle,e[5]=u.title,e[6]=_):_=e[6];let v;e[7]===u.listHeading?v=e[8]:(v=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:u.listHeading}),e[7]=u.listHeading,e[8]=v);let y;e[9]===u.colId?y=e[10]:(y=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colId}),e[9]=u.colId,e[10]=y);let b;e[11]===u.colName?b=e[12]:(b=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colName}),e[11]=u.colName,e[12]=b);let x;e[13]===u.colPermissions?x=e[14]:(x=(0,l.jsx)(`th`,{className:`px-3 py-2`,children:u.colPermissions}),e[13]=u.colPermissions,e[14]=x);let S;e[15]!==y||e[16]!==b||e[17]!==x?(S=(0,l.jsx)(`thead`,{children:(0,l.jsxs)(`tr`,{className:`text-xs uppercase text-fg-muted`,children:[y,b,x]})}),e[15]=y,e[16]=b,e[17]=x,e[18]=S):S=e[18];let C;e[19]===g?C=e[20]:(C=g.map(d),e[19]=g,e[20]=C);let w;e[21]===C?w=e[22]:(w=(0,l.jsx)(`tbody`,{children:C}),e[21]=C,e[22]=w);let T;e[23]!==S||e[24]!==w?(T=(0,l.jsx)(`div`,{className:`mt-3 overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full min-w-[32rem] border-separate border-spacing-y-1 text-left text-sm`,children:[S,w]})}),e[23]=S,e[24]=w,e[25]=T):T=e[25];let E;e[26]!==T||e[27]!==v?(E=(0,l.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4`,children:[v,T]}),e[26]=T,e[27]=v,e[28]=E):E=e[28];let D;e[29]===u.futureHeading?D=e[30]:(D=(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:u.futureHeading}),e[29]=u.futureHeading,e[30]=D);let O;e[31]===u.futureBody?O=e[32]:(O=(0,l.jsx)(`p`,{className:`mt-2`,children:u.futureBody}),e[31]=u.futureBody,e[32]=O);let k;e[33]!==D||e[34]!==O?(k=(0,l.jsxs)(`section`,{className:`rounded-xl bg-surface-hover/20 p-4 text-sm text-fg-muted`,children:[D,O]}),e[33]=D,e[34]=O,e[35]=k):k=e[35];let A;return e[36]!==E||e[37]!==k||e[38]!==_?(A=(0,l.jsxs)(o,{gap:`gap-5`,children:[_,E,k]}),e[36]=E,e[37]=k,e[38]=_,e[39]=A):A=e[39],A}function d(e){return(0,l.jsxs)(`tr`,{className:`bg-surface-base/55`,children:[(0,l.jsx)(`td`,{className:`rounded-l-lg px-3 py-2 font-mono text-xs text-fg`,children:e.id}),(0,l.jsx)(`td`,{className:`px-3 py-2 text-fg`,children:e.name}),(0,l.jsx)(`td`,{className:`rounded-r-lg px-3 py-2 font-mono text-xs text-fg-muted`,children:(e.ui?.permissions??[]).join(`, `)||`—`})]},e.id)}function f(e,t){return e.id.localeCompare(t.id)}function p(e){return e.language}export{u as ExtensionDebugPage};
|
package/dist/gateway/static/root/assets/{extension-page-C0-oP7S_.js → extension-page-BEomiKhy.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{f as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{Kr as a,
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{Kr as a,Qa as o,io as s,to as c}from"./index-D1oivYvN.js";var l=n(),u=e(t(),1),d=r();function f(){let e=(0,l.c)(26),{extensionId:t,pageId:n}=i(),r=o(),f=s(m),g=s(p),_,v,y;e[0]!==t||e[1]!==r||e[2]!==n?(_=t?r.find(e=>e.id===t&&c(e)):void 0,v=_?.ui?.contributions?.pages,y=t&&v?.length?n?v.find(e=>e.id===n||e.id===`${t}.${n}`):v[0]:void 0,e[0]=t,e[1]=r,e[2]=n,e[3]=_,e[4]=v,e[5]=y):(_=e[3],v=e[4],y=e[5]);let b=y,x,S;if(e[6]!==g||e[7]!==_||e[8]!==t||e[9]!==b||e[10]!==f?(x=()=>{if(!t||!_||!b)return g(),()=>g();let e=b.title?.trim()||_.name||t;return f({startExtra:null,main:(0,d.jsx)(`div`,{className:`w-full min-w-0 px-3 sm:px-5 xl:px-6`,children:(0,d.jsx)(`h1`,{className:`min-w-0 truncate text-base font-semibold tracking-tight text-fg`,title:e,children:e})}),end:null}),()=>g()},S=[g,_,t,b,f],e[6]=g,e[7]=_,e[8]=t,e[9]=b,e[10]=f,e[11]=x,e[12]=S):(x=e[11],S=e[12]),(0,u.useLayoutEffect)(x,S),!t){let t;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,d.jsx)(h,{message:`No plugin ID provided.`}),e[13]=t):t=e[13],t}if(!_){let n=`Plugin "${t}" not found or has no UI.`,r;return e[14]===n?r=e[15]:(r=(0,d.jsx)(h,{message:n}),e[14]=n,e[15]=r),r}if(!v?.length){let n=`Plugin "${t}" has no page contributions.`,r;return e[16]===n?r=e[17]:(r=(0,d.jsx)(h,{message:n}),e[16]=n,e[17]=r),r}if(!b){let r=`Page "${n}" not found in plugin "${t}".`,i;return e[18]===r?i=e[19]:(i=(0,d.jsx)(h,{message:r}),e[18]=r,e[19]=i),i}let C=_.ui?.permissions,w;return e[20]!==_.name||e[21]!==t||e[22]!==b.entrypoint||e[23]!==b.title||e[24]!==C?(w=(0,d.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:(0,d.jsx)(a,{extensionId:t,extensionName:_.name,entrypoint:b.entrypoint,permissions:C,title:b.title,className:`min-h-0 flex-1`,fixedHeight:void 0,maxHeight:99999})}),e[20]=_.name,e[21]=t,e[22]=b.entrypoint,e[23]=b.title,e[24]=C,e[25]=w):w=e[25],w}function p(e){return e.clearPageHeader}function m(e){return e.setPageHeader}function h(e){let t=(0,l.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,d.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-1 items-center justify-center`,children:(0,d.jsx)(`div`,{className:`text-center`,children:(0,d.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})})}),t[0]=n,t[1]=r),r}export{f as ExtensionPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{f as i,t as a}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{n as o,r as s}from"./popover-select-DGKUpVsz.js";import{t as c}from"./messages-RzwPiQNL.js";import{t as l}from"./cn-0WouolD0.js";import{a as u,i as d,l as f,n as p,o as m}from"./locale-store-JogcXC4J.js";import{i as h}from"./vendor-swr-BIWyz7Rc.js";import{t as g}from"./button-aIC072nz.js";import{Ao as _,Kr as v,Qa as y,jo as b,ko as x,yn as S}from"./index-D1oivYvN.js";import{n as C,t as w}from"./settings-page-header-CYpuTXUW.js";import"./settings-page-layout-B20AfmFG.js";import{n as T,t as E}from"./use-autosave-BkB9uD93.js";import{a as D,c as O,o as k}from"./voice-config-api-D7xsWrdh.js";import{t as A}from"./voice-api-key-field-bt8_Agih.js";import{t as j}from"./schema-form-DeSZ7SiO.js";var M=e(t(),1),N=n(),P=r();function F(e){let t=(0,N.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=r),r}function I(e){let t=e?.manifest?.mediaUnderstandingProviders?.[0];if(typeof t==`string`&&t.trim())return t.trim();let n=e?.manifest?.contracts?.mediaUnderstandingProviders?.[0];if(typeof n==`string`&&n.trim())return n.trim()}function L(){return l(_,x)}function R(){return l(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,b,`dark:border-edge`)}function z(e,t,n){if(!e||!t)return{apiKey:``,model:n};let r=e.stt.providers?.[t];return{apiKey:typeof r?.apiKey==`string`?r.apiKey:``,model:typeof r?.model==`string`?r.model:n}}function B({providerId:e,voiceSettings:t,mutateVoice:n}){let r=c(p(e=>e.language)),i=r.voiceSettings,a=r.extensionSttMedia,u={maskedHelp:i.apiKeyMaskedHelp,copy:i.apiKeyCopy,copied:i.apiKeyCopied,show:i.apiKeyShow,hide:i.apiKeyHide,notInConfigFile:i.apiKeyNotInConfigFile,loadFailed:i.apiKeyRevealFailed},{data:f}=h(d(`/api/voice/stt-providers`),k,{revalidateOnFocus:!1}),m=(0,M.useMemo)(()=>f?.providers.find(t=>t.id===e),[e,f]),g=m?.configured??!1,_=m?.models??[],v=_[0]?.id??m?.fields.find(e=>e.key===`model`)?.defaultValue??``,y=(0,M.useMemo)(()=>z(t,e,v),[v,e,t]),b=(0,M.useRef)(!1),[S,C]=(0,M.useState)(null),w=S??y,D=(0,M.useRef)(w);D.current=w;let j=y,N=E({value:w,dirty:w.apiKey!==j.apiKey||w.model!==j.model,onSave:(0,M.useCallback)(async r=>{let i=structuredClone(t);i.stt.enabled=!0,i.stt.provider=e,i.stt.providers={...i.stt.providers??{},[e]:{...i.stt.providers?.[e]??{},apiKey:r.apiKey,model:r.model}},await O(i,`transcription`),await n(i,!1),b.current=JSON.stringify(D.current)!==JSON.stringify(r),C(e=>e&&JSON.stringify(e)===JSON.stringify(r)?null:e)},[n,e,t])}),I=_.length>0?_:w.model?[{id:w.model,name:w.model}]:[];return(0,P.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl bg-surface-base p-4`,onBlurCapture:N.onBlurCapture,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:a.credentialsTitle}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:a.credentialsHint.replace(`{providerId}`,e)})]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(T,{status:N.status,error:N.error}),(0,P.jsx)(`span`,{className:l(`rounded-full px-2 py-0.5 text-xs font-medium`,g?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:g?a.configured:a.notConfigured})]})]}),(0,P.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,P.jsxs)(`div`,{className:l(`flex flex-col gap-1.5`,x),children:[(0,P.jsx)(F,{children:i.stt.apiKey}),(0,P.jsx)(A,{kind:`stt`,providerId:e,fieldId:`ext-stt-${e}-api-key`,value:w.apiKey,onChange:e=>{b.current=!0,C(t=>({...t??y,apiKey:e}))},labels:u,placeholder:e===`groq`?`gsk_...`:`sk-...`}),(0,P.jsxs)(`p`,{className:`text-xs text-fg-subtle`,children:[i.stt.apiKeyDesc,e===`groq`?` (GROQ_API_KEY)`:``]})]}),(0,P.jsxs)(`div`,{className:l(`flex flex-col gap-1.5`,x),children:[(0,P.jsx)(F,{children:i.stt.model}),I.length>0?(0,P.jsx)(o,{className:L(),value:w.model,onChange:e=>{b.current=!0,C(t=>({...t??y,model:e.target.value})),N.saveNow({...w,model:e.target.value})},children:I.map(e=>(0,P.jsx)(s,{value:e.id,children:e.name},e.id))}):(0,P.jsx)(`input`,{className:R(),value:w.model,onChange:e=>{b.current=!0,C(t=>({...t??y,model:e.target.value}))}})]})]})]})}function V(e){let t=(0,N.c)(13),{extensionId:n}=e,r=p(U),i=f(H),a;t[0]===n?a=t[1]:(a=()=>m(d(`/api/extensions/${encodeURIComponent(n)}`)),t[0]=n,t[1]=a);let{data:o,isLoading:s}=h(i&&n?`ext-stt-detail-${n}`:null,a),c;t[2]===o?c=t[3]:(c=I(o),t[2]=o,t[3]=c);let l=c,u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u={revalidateOnFocus:!1},t[4]=u):u=t[4];let{data:g,mutate:_,isLoading:v}=h(i?`voice-settings-ext-stt`:null,D,u);if(!i)return null;if(s||v){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,P.jsx)(S,{rows:2}),t[5]=e):e=t[5],e}if(!l){let e=r===`zh`?`该插件未声明 mediaUnderstandingProviders。`:`This plugin does not declare mediaUnderstandingProviders.`,n;return t[6]===e?n=t[7]:(n=(0,P.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e}),t[6]=e,t[7]=n),n}if(!g)return null;let y=`${n}:${l}`,b;return t[8]!==_||t[9]!==l||t[10]!==y||t[11]!==g?(b=(0,P.jsx)(B,{providerId:l,voiceSettings:g,mutateVoice:_},y),t[8]=_,t[9]=l,t[10]=y,t[11]=g,t[12]=b):b=t[12],b}function H(e){return!!e.conversationId}function U(e){return e.language}function W(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function G(e){let t={};if(e.type!==`object`||!W(e.properties))return t;for(let[n,r]of Object.entries(e.properties))W(r)&&Object.prototype.hasOwnProperty.call(r,`default`)&&(t[n]=r.default);return t}function K(e,t){switch(t.type){case`sync`:return{localValues:t.value,isDirty:!1};case`change`:return{localValues:t.value,isDirty:!0};case`reset-defaults`:return{localValues:t.value,isDirty:!0};case`saved`:return JSON.stringify(e.localValues)===JSON.stringify(t.value)?{localValues:e.localValues,isDirty:!1}:e}}function q({extensionId:e}){let t=f(e=>!!e.conversationId),{data:n,error:r}=h(t&&e?`ext-detail-${e}`:null,()=>m(d(`/api/extensions/${encodeURIComponent(e)}`))),{data:i,mutate:a,error:o}=h(t&&e?`ext-cfg-${e}`:null,()=>m(d(`/api/extensions/${encodeURIComponent(e)}/config`))),s=n?.manifest?.configSchema,c=(0,M.useMemo)(()=>s&&s.type===`object`?G(s):{},[s]),l=(0,M.useMemo)(()=>({...c,...i??{}}),[c,i]),[p,_]=(0,M.useReducer)(K,{localValues:{},isDirty:!1}),v=(0,M.useRef)(!1),y=(0,M.useRef)(p.localValues);y.current=p.localValues;let b=(0,M.useRef)(l);!v.current&&b.current!==l&&(b.current=l,_({type:`sync`,value:l}));let x=(0,M.useCallback)(e=>{v.current=!0,_({type:`change`,value:e})},[]),S=(0,M.useCallback)(()=>{!s||s.type!==`object`||(v.current=!0,_({type:`reset-defaults`,value:{...G(s)}}))},[s]),C=(0,M.useCallback)(async t=>{if(!e)return;let n=await u(d(`/api/extensions/${encodeURIComponent(e)}/config`),{method:`PATCH`,body:JSON.stringify(t)});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error?.message??n.statusText)}await a(t,!1),_({type:`saved`,value:t}),v.current=JSON.stringify(y.current)!==JSON.stringify(t)},[e,a]),w=E({value:p.localValues,dirty:p.isDirty,onSave:C});if(!t)return null;if(r||o){let e=r??o;return(0,P.jsxs)(`p`,{className:`text-sm text-fg-muted`,children:[`Could not load extension settings: `,e instanceof Error?e.message:String(e)]})}return!s||s.type!==`object`?null:(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-surface-hover/20 p-4`,onBlurCapture:w.onBlurCapture,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,P.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:`Configuration`}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(T,{status:w.status,error:w.error}),(0,P.jsx)(g,{type:`button`,variant:`ghost`,className:`h-8 text-xs`,onClick:S,children:`Reset to defaults`})]})]}),(0,P.jsx)(j,{schema:s,values:p.localValues,onChange:x})]})}function J(){let e=(0,N.c)(38),t=p(Y),n;e[0]===t?n=e[1]:(n=c(t),e[0]=t,e[1]=n);let r=n.extensionSttMedia,{extensionId:o,panelId:s}=i(),l=y();if(!o){let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,P.jsx)(X,{message:`No plugin ID provided.`}),e[2]=t):t=e[2],t}let u,d,f;if(e[3]!==o||e[4]!==l||e[5]!==s){f=Symbol.for(`react.early_return_sentinel`);bb0:{let t;if(e[9]===o?t=e[10]:(t=e=>e.id===o,e[9]=o,e[10]=t),u=l.find(t),!u){let t=`Plugin "${o}" not found or is not available in this workspace.`,n;e[11]===t?n=e[12]:(n=(0,P.jsx)(X,{message:t}),e[11]=t,e[12]=n),f=n;break bb0}let n=u.ui?.contributions?.settingsPanels;d=s?n?.find(e=>e.id===s||e.id===`${o}.${s}`):n?.[0]}e[3]=o,e[4]=l,e[5]=s,e[6]=u,e[7]=d,e[8]=f}else u=e[6],d=e[7],f=e[8];if(f!==Symbol.for(`react.early_return_sentinel`))return f;let m=d,h=!!(m&&u.ui),g=!!u.hasConfigSchema,_=u.kind===`media-provider`;if(!g&&!h&&!_){let t=`Plugin "${o}" has no settings panels or config schema.`,n;return e[13]===t?n=e[14]:(n=(0,P.jsx)(X,{message:t}),e[13]=t,e[14]=n),n}let b=m?.title??`${u.name} Settings`,x;e[15]===b?x=e[16]:(x=(0,P.jsx)(w,{title:b}),e[15]=b,e[16]=x);let S;e[17]!==_||e[18]!==r?(S=_?(0,P.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-base px-4 py-3 text-sm`,children:[(0,P.jsx)(`p`,{className:`leading-relaxed text-fg-muted`,children:r.banner}),(0,P.jsx)(a,{to:`/settings/capabilities/models?configure=transcription`,className:`w-fit font-medium text-accent hover:underline`,children:r.openVoice})]}):null,e[17]=_,e[18]=r,e[19]=S):S=e[19];let T;e[20]!==o||e[21]!==_?(T=_?(0,P.jsx)(V,{extensionId:o}):null,e[20]=o,e[21]=_,e[22]=T):T=e[22];let E;e[23]!==o||e[24]!==g?(E=g?(0,P.jsx)(q,{extensionId:o}):null,e[23]=o,e[24]=g,e[25]=E):E=e[25];let D;e[26]!==u.name||e[27]!==u.ui||e[28]!==o||e[29]!==h||e[30]!==m?(D=h&&m&&u.ui?(0,P.jsx)(`div`,{className:`overflow-hidden rounded-xl bg-surface-base shadow-surface`,children:(0,P.jsx)(v,{extensionId:o,extensionName:u.name,entrypoint:m.entrypoint,permissions:u.ui?.permissions,title:m.title,className:`w-full`,minHeight:120,maxHeight:2e3})}):null,e[26]=u.name,e[27]=u.ui,e[28]=o,e[29]=h,e[30]=m,e[31]=D):D=e[31];let O;return e[32]!==x||e[33]!==S||e[34]!==T||e[35]!==E||e[36]!==D?(O=(0,P.jsxs)(C,{gap:`gap-5`,children:[x,S,T,E,D]}),e[32]=x,e[33]=S,e[34]=T,e[35]=E,e[36]=D,e[37]=O):O=e[37],O}function Y(e){return e.language}function X(e){let t=(0,N.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,P.jsx)(C,{gap:`gap-3`,children:(0,P.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{J as ExtensionSettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n}from"./vendor-react-BOUWij0V.js";import{i as r,o as i}from"./locale-store-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n}from"./vendor-react-BOUWij0V.js";import{i as r,o as i}from"./locale-store-JogcXC4J.js";import{i as a,o}from"./vendor-swr-BIWyz7Rc.js";var s=e(t(),1),c=n();function l(e){if(!(!e||typeof e!=`object`||!(`section`in e)))return e.section}function u(e){return l(e)===`skills`}function d(){return r(`/api/config`)}var f=null;async function p(){return f||(f=i(d()).finally(()=>{f=null}),f)}function m(e){let t=(0,c.c)(6),n;t[0]===e?n=t[1]:(n=e?d():null,t[0]=e,t[1]=n);let r=n,i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i={revalidateOnFocus:!1},t[2]=i):i=t[2];let l=a(r,p,i),f,m;return t[3]===e?(f=t[4],m=t[5]):(f=()=>{if(!e)return;let t=d(),n=e=>{u(e.detail)||o(t)};return window.addEventListener(`config-reload`,n),()=>window.removeEventListener(`config-reload`,n)},m=[e],t[3]=e,t[4]=f,t[5]=m),(0,s.useEffect)(f,m),l}function h(){return o(d())}export{u as a,l as i,h as n,m as r,p as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./locale-store-DAgpZxAS.js";import{a as t,d as n,f as r,g as i,i as a,l as o,p as s,r as c,s as l,t as u,u as d,v as f}from"./schemas-CObaziC7.js";import{t as p}from"./gateway-realtime-store-Dafw95ol.js";var ee={type:`array`,minItems:1,maxItems:20,items:{type:`object`,additionalProperties:!1,required:[`type`,`fileId`,`name`,`mimeType`,`size`,`sha256`],properties:{type:{const:`file`},fileId:{type:`string`,minLength:1,maxLength:160},name:{type:`string`,minLength:1,maxLength:255},mimeType:{type:`string`,minLength:1,maxLength:255},size:{type:`integer`,minimum:0},sha256:{type:`string`,pattern:`^[a-f0-9]{64}$`}}}},te={type:`object`,properties:{},additionalProperties:!1},m=d({purpose:u([`weather`,`nearby`]),precision:u([`approximate`,`precise`]),category:u([`restaurant`,`cafe`,`pharmacy`,`park`]).optional()}).strict().superRefine((e,t)=>{e.purpose===`nearby`!=(e.category!==void 0)&&t.addIssue({code:`custom`,message:`Category is required only for nearby queries`})}),h={type:`object`,additionalProperties:!1,required:[`purpose`,`precision`],properties:{purpose:{enum:[`weather`,`nearby`]},precision:{enum:[`approximate`,`precise`]},category:{enum:[`restaurant`,`cafe`,`pharmacy`,`park`]}},allOf:[{if:{properties:{purpose:{const:`nearby`}},required:[`purpose`]},then:{properties:{category:{}},required:[`category`]},else:{not:{properties:{category:{}},required:[`category`]}}}]};d({latitude:o().min(-90).max(90),longitude:o().min(-180).max(180),accuracyMeters:o().min(0).max(1e5),capturedAt:o().int().nonnegative(),precision:u([`approximate`,`precise`]),coordinateSystem:l(`WGS84`)}).strict();var g={type:`array`,minItems:1,maxItems:1,items:{type:`object`,additionalProperties:!1,required:[`type`,`value`],properties:{type:{const:`json`},value:{type:`object`,additionalProperties:!1,required:[`latitude`,`longitude`,`accuracyMeters`,`capturedAt`,`precision`,`coordinateSystem`],properties:{latitude:{type:`number`,minimum:-90,maximum:90},longitude:{type:`number`,minimum:-180,maximum:180},accuracyMeters:{type:`number`,minimum:0,maximum:1e5},capturedAt:{type:`integer`,minimum:0},precision:{enum:[`approximate`,`precise`]},coordinateSystem:{const:`WGS84`}}}}}};function ne(e){return{name:`${e}.device.get_location`,title:`Use location once`,description:`With on-device consent, use one fresh WGS84 location for current weather (Open-Meteo) or nearby places (OpenStreetMap). Raw coordinates are consumed transiently by Gateway, never returned to the Agent or saved in history. Select approximate or precise; nearby requires a category. Each call requires new consent.`,inputSchema:h,outputSchema:g,policyId:`personal.foreground-read`,sensitivity:`personal`,effect:`read`,confirmation:`always`,requiresForeground:!0,requiredPermissions:[`location-read-once`],timeoutMs:9e4,maxConcurrency:1,supportsCancellation:!0,idempotent:!0,resultKinds:[`json`]}}var re=25*1024*1024,_=u([`web`,`desktop`,`mobile`,`browser`]),v=u([`foreground`,`background`]),ie=u([`read`,`write`,`destructive`]),y=u([`never`,`always`]),ae=u([`text`,`json`,`file`]),oe=u([`public`,`personal`]),b=s().min(1).max(160),se=s().min(32).max(160).regex(/^[A-Za-z0-9_-]+$/);t(`type`,[r({type:l(`endpoint`),endpointId:b}),r({type:l(`channel`),channel:s().min(1).max(64)}),r({type:l(`system`),source:u([`cli`,`automation`,`heartbeat`,`task`,`internal`,`task_update`])})]).options[0].extend({token:se});var ce=f(),x=o().int().nonnegative(),S=n(s(),i()),C=r({name:s().regex(/^[a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*)+$/).max(120),title:s().min(1).max(120),description:s().min(1).max(2e3),inputSchema:S,outputSchema:S,policyId:s().regex(/^[a-z][a-z0-9_.-]+$/).max(120),sensitivity:oe,effect:ie,confirmation:y,requiresForeground:a(),requiredPermissions:c(s().min(1).max(120)).max(20),timeoutMs:o().int().min(1e3).max(3e5),maxConcurrency:o().int().min(1).max(4),supportsCancellation:a(),idempotent:a(),resultKinds:c(ae).min(1).max(3)});r({principalId:b,displayName:s().min(1).max(120),kind:_,platform:s().min(1).max(80),publicKey:s().min(32).max(2048)}),r({endpointId:b});var w=s().regex(/^[a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*)+$/).max(120);r({jobId:f(),endpointId:b,capability:w,input:S,idempotencyKey:b,consentGrantId:b,createdAt:x,expiresAt:x}),r({jobId:f(),status:u([`queued`,`running`,`succeeded`,`failed`,`cancelled`]),updatedAt:x,output:S.optional(),error:r({code:b,message:s().min(1).max(2e3)}).optional()}),r({eventId:f(),endpointId:b,subscriptionId:b,eventType:w,data:S,occurredAt:x});var le=r({principalId:b,endpointId:b,connectionInstanceId:f(),displayName:s().min(1).max(120),kind:_,platform:s().min(1).max(80),appVersion:s().min(1).max(80),availability:v,nonce:b,signedAt:x,signature:s().min(16).max(1024),tools:c(C).max(100)}),ue=r({invocationId:f(),toolCallId:b,toolName:C.shape.name,arguments:S,descriptorRevision:s().min(1).max(128),confirmationRequired:a(),deadlineAt:x,uploadGrant:r({path:s().startsWith(`/`).max(500),token:b,maxBytes:o().int().positive(),maxFiles:o().int().min(1).max(20),expiresAt:x}).optional()}),de=r({invocationId:f(),reason:s().min(1).max(500)}),T=r({invocationId:f()}),E=t(`type`,[r({type:l(`text`),text:s().max(256*1024)}),r({type:l(`json`),value:i()}),r({type:l(`file`),fileId:b,name:s().min(1).max(255),mimeType:s().min(1).max(255),size:o().int().nonnegative(),sha256:s().regex(/^[a-f0-9]{64}$/)})]),fe=u([`ENDPOINT_OFFLINE`,`ENDPOINT_NOT_FOREGROUND`,`ENDPOINT_DISCONNECTED`,`TOOL_NOT_FOUND`,`TOOL_REVISION_MISMATCH`,`INVALID_ARGUMENTS`,`PERMISSION_DENIED`,`USER_DENIED`,`TOOL_BUSY`,`TOOL_TIMEOUT`,`TOOL_CANCELLED`,`RESULT_TOO_LARGE`,`PROTOCOL_ERROR`]),D=(e,t)=>r({protocolVersion:l(2),messageId:ce,type:l(e),sentAt:x,payload:t}),O=t(`type`,[D(`endpoint.availability_changed`,r({availability:v})),D(`tool.received`,T),D(`tool.progress`,r({invocationId:f(),message:s().max(500).optional(),percent:o().min(0).max(100).optional()})),D(`tool.result`,r({invocationId:f(),content:c(E).min(1).max(20),details:S.optional()})),D(`tool.error`,r({invocationId:f(),code:fe,message:s().min(1).max(2e3)})),D(`tool.cancelled`,T)]),k=t(`type`,[D(`tool.invoke`,ue),D(`tool.cancel`,de)]),A={type:`array`,minItems:1,maxItems:20,items:{type:`object`,additionalProperties:!1,required:[`type`,`text`],properties:{type:{const:`text`},text:{type:`string`,maxLength:256*1024}}}};function j(e){if(e===null)return`null`;if(typeof e==`string`||typeof e==`boolean`)return JSON.stringify(e);if(typeof e==`number`){if(!Number.isFinite(e))throw Error(`Canonical JSON only supports finite numbers`);return JSON.stringify(e)}if(typeof e!=`object`)throw Error(`Canonical JSON does not support ${typeof e}`);if(Array.isArray(e))return`[${e.map(j).join(`,`)}]`;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw Error(`Canonical JSON only supports plain objects`);let n=e;return`{${Object.keys(n).sort().map(e=>`${JSON.stringify(e)}:${j(n[e])}`).join(`,`)}}`}function M(e){let{signature:t,...n}=e;return j(n)}var N={type:`array`,minItems:1,maxItems:1,items:{type:`object`,additionalProperties:!1,required:[`type`,`value`],properties:{type:{const:`json`},value:{type:`object`,additionalProperties:!1,required:[`capturedAt`,`platform`,`systemVersion`,`locale`,`timezone`],properties:{capturedAt:{type:`integer`,minimum:0},platform:{type:`string`,minLength:1,maxLength:40},systemVersion:{type:`string`,maxLength:80},locale:{type:`string`,maxLength:80},timezone:{type:`string`,maxLength:80},online:{type:`boolean`}}}}}},P={type:`array`,minItems:1,maxItems:1,items:{type:`object`,additionalProperties:!1,required:[`type`,`value`],properties:{type:{const:`json`},value:{type:`object`,additionalProperties:!1,required:[`capturedAt`,`levelPercent`,`charging`],properties:{capturedAt:{type:`integer`,minimum:0},levelPercent:{type:[`number`,`null`],minimum:0,maximum:100},charging:{type:[`boolean`,`null`]}}}}}};function F(e,t){return{name:`${e}.device.get_${t}`,title:t===`power`?`Read this device’s battery`:`Read this device’s environment`,description:t===`power`?`Read a fresh battery sample from the device that sent this user message. Unknown readings are null.`:`Read bounded platform, system version, language and timezone from the device that sent this user message. No files, page content, network addresses or identifiers are collected.`,inputSchema:te,outputSchema:t===`power`?P:N,policyId:`public.background-read`,sensitivity:`public`,effect:`read`,confirmation:`never`,requiresForeground:!1,requiredPermissions:[],timeoutMs:1e4,maxConcurrency:1,supportsCancellation:!0,idempotent:!0,resultKinds:[`json`]}}var I=256*1024,L=15e3,R=45e3,z=[`realtime.capability-negotiation.v1`],B=u([`web`,`desktop`,`mobile`,`browser_extension`,`tui`,`mcp`]),V=s().min(1).max(512),pe=s().regex(/^[a-z][a-z0-9_.-]*$/).max(160),me=f(),he=o().int().nonnegative(),H=o().int().positive(),U=s().min(1).max(160),W=(e,t)=>d({protocolVersion:l(2),messageId:me,kind:l(e),sentAt:he,payload:t}),G=d({topic:V,afterSeq:o().int().nonnegative().optional(),view:l(`compact`).optional()});t(`kind`,[W(`realtime.hello`,d({ticket:s().min(32).max(512),clientId:s().min(1).max(160),clientKind:B,subscriptions:c(G).max(100).default([]),capabilities:c(U).max(64).optional(),endpoint:le.optional()})),W(`realtime.subscribe`,d({subscriptions:c(G).min(1).max(100)})),W(`realtime.unsubscribe`,d({topics:c(V).min(1).max(100)})),W(`realtime.ping`,d({})),W(`endpoint.message`,O)]);var ge=d({topic:V,seq:H,event:pe,data:i()}),_e=t(`kind`,[W(`realtime.ready`,d({connectionId:f(),heartbeatIntervalMs:l(L),heartbeatTimeoutMs:l(R),negotiatedCapabilities:c(U).max(64).optional(),endpoint:d({endpointId:s().min(1).max(160),turnToken:s().min(32).max(160)}).optional()})),W(`realtime.event`,ge),W(`realtime.subscribed`,d({topic:V,cursor:o().int().nonnegative()})),W(`realtime.gap`,d({topic:V,requestedSeq:o().int().nonnegative(),earliestSeq:H,recoverable:a()})),W(`realtime.pong`,d({})),W(`realtime.error`,d({code:s().min(1).max(80),message:s().min(1).max(500)})),W(`endpoint.message`,k)]);function ve(e){return _e.parse(e)}var K=class extends Error{retryable;constructor(e,t){super(e),this.retryable=t,this.name=`RealtimeConnectionError`}},ye=class extends Error{bytes;maxBytes;constructor(e,t){super(`Realtime client frame is ${e} bytes; maximum is ${t} bytes`),this.bytes=e,this.maxBytes=t,this.name=`RealtimeFrameTooLargeError`}};function be(e){if(typeof e==`string`)return e;if(e instanceof ArrayBuffer)return new TextDecoder().decode(e);if(ArrayBuffer.isView(e)){let t=Uint8Array.from(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));return new TextDecoder().decode(t)}throw Error(`Realtime server sent a non-text frame`)}function xe(e){return e===1009||e===4400||e===4401||e===4409||e===4413}var Se=class{options;desiredSubscriptions=new Map;cursors=new Map;socket;reconnectTimer;heartbeatTimer;connectionTimer;ticketAbort;generation=0;reconnectAttempts=0;shouldReconnect=!1;ready=!1;lastServerMessageAt=0;endpointBinding;reconnectWhenSocketOpens=!1;offeredCapabilities=new Set;constructor(e){this.options=e}connect(){this.shouldReconnect||(this.shouldReconnect=!0,this.open(!1))}disconnect(){this.shouldReconnect=!1,this.reconnectWhenSocketOpens=!1,this.generation+=1,this.clearTimers(),this.ready=!1,this.offeredCapabilities.clear(),this.endpointBinding?.onDisconnected?.(),this.socket?.close(1e3,`Client disconnected`),this.socket=void 0,this.options.onStateChange?.(`disconnected`)}reconnect(){this.reconnectWhenSocketOpens=!1,this.generation+=1,this.clearTimers(),this.ready=!1,this.endpointBinding?.onDisconnected?.(),this.socket?.close(1e3,`Client reconnecting`),this.socket=void 0,this.reconnectAttempts=0,this.shouldReconnect=!0,this.open(!0)}subscribe(e,t){this.desiredSubscriptions.set(e,t),t!==void 0&&this.cursors.set(e,t),this.ready&&this.sendSubscriptions([{topic:e,afterSeq:this.cursors.get(e)??t}])}unsubscribe(e){this.desiredSubscriptions.delete(e),this.ready&&this.send(this.clientMessage(`realtime.unsubscribe`,{topics:[e]}))}sendEndpointMessage(e){if(!this.ready)throw Error(`Realtime connection is not ready`);this.send(this.clientMessage(`endpoint.message`,e))}setEndpoint(e){this.endpointBinding=e,this.refreshEndpointConnection()}clearEndpoint(e){if(e&&this.endpointBinding!==e)return;let t=this.endpointBinding;this.endpointBinding=void 0,t?.onDisconnected?.(),this.refreshEndpointConnection()}refreshEndpointConnection(){if(this.shouldReconnect){if(this.socket?.readyState===0){this.reconnectWhenSocketOpens=!0;return}this.reconnect()}}async open(e){let t=++this.generation,n=this.options.connectionTimeoutMs??15e3,r=new AbortController;this.ticketAbort?.abort(),this.ticketAbort=r;let i,a=!1,o,s=(e,n=!0)=>{a||t!==this.generation||(a=!0,this.clearConnectionTimer(),r.abort(),this.ticketAbort===r&&(this.ticketAbort=void 0),this.ready=!1,this.offeredCapabilities.clear(),this.endpointBinding?.onDisconnected?.(),this.clearHeartbeat(),this.socket===i&&(this.socket=void 0),i&&(i.onopen=null,i.onmessage=null,i.onerror=null,i.onclose=null,i.close(4e3,e.slice(0,120))),this.shouldReconnect&&n?this.scheduleReconnect(e):this.shouldReconnect?(this.shouldReconnect=!1,this.options.onStateChange?.(`error`,e)):this.options.onStateChange?.(`disconnected`))};this.connectionTimer=setTimeout(()=>s(`Realtime connection timed out`),n),this.options.onStateChange?.(e?`reconnecting`:`connecting`);try{let[e,n]=await Promise.all([this.options.issueTicket(r.signal),this.endpointBinding?.createHello()]),c=e.ticket;if(2<e.realtime.minVersion)throw new K(`CLIENT_UPDATE_REQUIRED`,!1);if(2>e.realtime.maxVersion)throw new K(`GATEWAY_UPDATE_REQUIRED`,!1);let l=z.filter(t=>e.realtime.capabilities.includes(t));if(a||!this.shouldReconnect||t!==this.generation)return;this.offeredCapabilities=new Set(l??[]),i=this.options.createWebSocket(this.options.getWebSocketUrl()),this.socket=i,i.onopen=()=>{if(t!==this.generation)return;if(this.reconnectWhenSocketOpens){this.reconnect();return}let e=[...this.desiredSubscriptions].map(([e,t])=>({topic:e,afterSeq:this.cursors.get(e)??t}));this.send(this.clientMessage(`realtime.hello`,{ticket:c,clientId:this.options.clientId,clientKind:this.options.clientKind,subscriptions:e,...l?.length?{capabilities:l}:{},...n?{endpoint:n}:{}}))},i.onmessage=e=>{if(t!==this.generation)return;let n=()=>{if(!(a||t!==this.generation))return this.handleServerMessage(be(e.data))};if(!o){try{let e=n();if(!e)return;let t=e.catch(e=>s(e instanceof Error?e.message:`Invalid realtime server message`)).then(()=>void 0);o=t,t.finally(()=>{o===t&&(o=void 0)})}catch(e){s(e instanceof Error?e.message:`Invalid realtime server message`)}return}let r=o.then(n).catch(e=>s(e instanceof Error?e.message:`Invalid realtime server message`)).then(()=>void 0);o=r,r.finally(()=>{o===r&&(o=void 0)})},i.onerror=()=>{},i.onclose=e=>{s(e.reason||`WebSocket closed (${e.code??0})`,!xe(e.code))}}catch(e){s(e instanceof Error?e.message:`Realtime connection failed`,!(e instanceof K)||e.retryable)}}handleServerMessage(e){let t=ve(JSON.parse(e));if(this.lastServerMessageAt=Date.now(),t.kind===`realtime.ready`){let e=t.payload.negotiatedCapabilities??[];if(e.some(e=>!this.offeredCapabilities.has(e)))throw Error(`Realtime server negotiated a capability the client did not offer`);this.ready=!0,this.reconnectAttempts=0,this.clearConnectionTimer(),this.ticketAbort=void 0,this.options.onStateChange?.(`connected`),this.options.onCapabilities?.(e),t.payload.endpoint&&this.endpointBinding?.onReady(t.payload.endpoint),this.clearHeartbeat(),this.heartbeatTimer=setInterval(()=>{if(this.ready){if(Date.now()-this.lastServerMessageAt>=t.payload.heartbeatTimeoutMs){this.reconnect();return}this.send(this.clientMessage(`realtime.ping`,{}))}},t.payload.heartbeatIntervalMs)}else if(t.kind===`realtime.event`){let e=this.cursors.get(t.payload.topic);if(e!==void 0&&t.payload.seq<=e)return;this.options.onEvent?.(t.payload),this.cursors.set(t.payload.topic,t.payload.seq)}else if(t.kind===`realtime.subscribed`)this.cursors.set(t.payload.topic,t.payload.cursor),this.options.onSubscribed?.(t.payload);else if(t.kind===`realtime.gap`)return this.cursors.set(t.payload.topic,t.payload.earliestSeq-1),this.options.onGap?.(t.payload);else t.kind===`realtime.error`?this.options.onStateChange?.(`error`,t.payload.message):t.kind===`endpoint.message`&&(this.endpointBinding?.onMessage(t.payload),this.options.onEndpointMessage?.(t.payload))}sendSubscriptions(e){this.send(this.clientMessage(`realtime.subscribe`,{subscriptions:e}))}clientMessage(e,t){let n=this.options.createMessageId?.()??globalThis.crypto?.randomUUID?.();if(!n)throw Error(`RealtimeClient requires createMessageId when crypto.randomUUID is unavailable`);return{protocolVersion:2,messageId:n,kind:e,sentAt:Date.now(),payload:t}}send(e){if(!this.socket||this.socket.readyState!==1)return;let t=JSON.stringify(e),n=new TextEncoder().encode(t).byteLength;if(n>262144)throw new ye(n,I);this.socket.send(t)}scheduleReconnect(e){if(!this.shouldReconnect)return;this.reconnectAttempts+=1;let t=this.options.maxReconnectAttempts;if(t!==void 0&&this.reconnectAttempts>t){this.shouldReconnect=!1,this.options.onStateChange?.(`error`,e);return}this.options.onStateChange?.(`reconnecting`,e);let n=Math.min(3e4,1e3*2**Math.min(this.reconnectAttempts-1,5)),r=Math.round(n*(.5+Math.random()*.5));this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=void 0,this.open(!0)},r)}clearHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0}clearTimers(){this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0,this.clearConnectionTimer(),this.ticketAbort?.abort(),this.ticketAbort=void 0,this.clearHeartbeat()}clearConnectionTimer(){this.connectionTimer&&clearTimeout(this.connectionTimer),this.connectionTimer=void 0}},Ce=500,q=null,J;function Y(e){J=e,q!==null&&clearTimeout(q),q=setTimeout(()=>{q=null;let e=J;J=void 0,window.dispatchEvent(new CustomEvent(`config-reload`,{detail:e}))},Ce)}function we(e,t){if(e===`config.reload`){Y(t);return}window.dispatchEvent(new CustomEvent(e.replace(/[._]/g,`-`),{detail:t}))}var X=new Map,Z=new Map,Q,$;function Te(){let e=`xopc:realtime-client-id`,t=sessionStorage.getItem(e);if(t)return t;let n=crypto.randomUUID();return sessionStorage.setItem(e,n),n}function Ee(){let t=new URL(e(`/api/realtime/v1/ws`));return t.protocol=t.protocol===`https:`?`wss:`:`ws:`,t.toString()}function De(){let t=Te(),n=window.electronAPI?`desktop`:`web`,r=new Se({clientId:t,clientKind:n,getWebSocketUrl:Ee,issueTicket:async r=>{let i=await fetch(e(`/api/realtime/tickets`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({clientId:t,clientKind:n,protocolVersion:2}),signal:r}),a=await i.json().catch(()=>null);if(!i.ok||!a?.payload?.ticket||!a.payload.realtime)throw Error(a?.error?.message??`Realtime ticket failed (${i.status})`);return{ticket:a.payload.ticket,realtime:a.payload.realtime}},createWebSocket:e=>new WebSocket(e),onStateChange:(e,t)=>{p({connectionState:e,error:t??null}),e===`connected`&&window.dispatchEvent(new CustomEvent(`gateway-realtime-connected`))},onEvent:e=>{(e.topic===`gateway`||e.topic===`sessions`)&&we(e.event,e.data);let t=Z.get(e.topic);(t===void 0||e.seq>t)&&Z.set(e.topic,e.seq);for(let t of X.get(e.topic)??[])if(!(t.cursor!==void 0&&e.seq<=t.cursor))try{t.listener.onEvent(e)}catch(e){console.error(`[realtime] topic listener failed:`,e)}finally{t.cursor=Math.max(t.cursor??0,e.seq)}},onGap:async e=>{window.dispatchEvent(new CustomEvent(`realtime-gap`,{detail:e}));let t=[...X.get(e.topic)??[]].filter(t=>!e.recoverable||t.cursor===void 0||t.cursor<e.earliestSeq-1),n=await Promise.allSettled(t.map(t=>t.listener.onGap?.(e)));for(let e of n)e.status===`rejected`&&console.error(`[realtime] topic gap handler failed:`,e.reason)}});Q?.disconnect(),Q=r,$&&r.setEndpoint($),r.subscribe(`gateway`,Z.get(`gateway`)),r.subscribe(`sessions`,Z.get(`sessions`));for(let e of X.keys())r.subscribe(e,Z.get(e));return p({connectionState:`connecting`,error:null}),r.connect(),()=>{Q===r&&(r.disconnect(),Q=void 0)}}function Oe(e){return $=e,Q?.setEndpoint(e),()=>{$===e&&($=void 0,Q?.clearEndpoint(e))}}function ke(e){Q?.sendEndpointMessage(e)}function Ae(){Q?.reconnect()}function je(e,t,n){let r=X.get(e)??new Set,i=r.size===0,a=Z.get(e),o={listener:t,cursor:n??a};if(r.add(o),X.set(e,r),i){let t=n??a;Z.set(e,t),Q?.subscribe(e,t)}else n!==void 0&&(a===void 0||n<a)&&Q?.subscribe(e,n);return()=>{let t=X.get(e);t?.delete(o),(!t||t.size===0)&&(X.delete(e),Z.delete(e),Q?.unsubscribe(e))}}export{je as a,A as c,M as d,E as f,ee as h,De as i,j as l,m,Ae as n,Y as o,ne as p,ke as r,re as s,Oe as t,F as u};
|
|
1
|
+
import{i as e}from"./locale-store-JogcXC4J.js";import{a as t,d as n,f as r,g as i,i as a,l as o,p as s,r as c,s as l,t as u,u as d,v as f}from"./schemas-CObaziC7.js";import{t as p}from"./gateway-realtime-store-CoIgC1Al.js";var ee={type:`array`,minItems:1,maxItems:20,items:{type:`object`,additionalProperties:!1,required:[`type`,`fileId`,`name`,`mimeType`,`size`,`sha256`],properties:{type:{const:`file`},fileId:{type:`string`,minLength:1,maxLength:160},name:{type:`string`,minLength:1,maxLength:255},mimeType:{type:`string`,minLength:1,maxLength:255},size:{type:`integer`,minimum:0},sha256:{type:`string`,pattern:`^[a-f0-9]{64}$`}}}},te={type:`object`,properties:{},additionalProperties:!1},m=d({purpose:u([`weather`,`nearby`]),precision:u([`approximate`,`precise`]),category:u([`restaurant`,`cafe`,`pharmacy`,`park`]).optional()}).strict().superRefine((e,t)=>{e.purpose===`nearby`!=(e.category!==void 0)&&t.addIssue({code:`custom`,message:`Category is required only for nearby queries`})}),h={type:`object`,additionalProperties:!1,required:[`purpose`,`precision`],properties:{purpose:{enum:[`weather`,`nearby`]},precision:{enum:[`approximate`,`precise`]},category:{enum:[`restaurant`,`cafe`,`pharmacy`,`park`]}},allOf:[{if:{properties:{purpose:{const:`nearby`}},required:[`purpose`]},then:{properties:{category:{}},required:[`category`]},else:{not:{properties:{category:{}},required:[`category`]}}}]};d({latitude:o().min(-90).max(90),longitude:o().min(-180).max(180),accuracyMeters:o().min(0).max(1e5),capturedAt:o().int().nonnegative(),precision:u([`approximate`,`precise`]),coordinateSystem:l(`WGS84`)}).strict();var g={type:`array`,minItems:1,maxItems:1,items:{type:`object`,additionalProperties:!1,required:[`type`,`value`],properties:{type:{const:`json`},value:{type:`object`,additionalProperties:!1,required:[`latitude`,`longitude`,`accuracyMeters`,`capturedAt`,`precision`,`coordinateSystem`],properties:{latitude:{type:`number`,minimum:-90,maximum:90},longitude:{type:`number`,minimum:-180,maximum:180},accuracyMeters:{type:`number`,minimum:0,maximum:1e5},capturedAt:{type:`integer`,minimum:0},precision:{enum:[`approximate`,`precise`]},coordinateSystem:{const:`WGS84`}}}}}};function ne(e){return{name:`${e}.device.get_location`,title:`Use location once`,description:`With on-device consent, use one fresh WGS84 location for current weather (Open-Meteo) or nearby places (OpenStreetMap). Raw coordinates are consumed transiently by Gateway, never returned to the Agent or saved in history. Select approximate or precise; nearby requires a category. Each call requires new consent.`,inputSchema:h,outputSchema:g,policyId:`personal.foreground-read`,sensitivity:`personal`,effect:`read`,confirmation:`always`,requiresForeground:!0,requiredPermissions:[`location-read-once`],timeoutMs:9e4,maxConcurrency:1,supportsCancellation:!0,idempotent:!0,resultKinds:[`json`]}}var re=25*1024*1024,_=u([`web`,`desktop`,`mobile`,`browser`]),v=u([`foreground`,`background`]),ie=u([`read`,`write`,`destructive`]),y=u([`never`,`always`]),ae=u([`text`,`json`,`file`]),oe=u([`public`,`personal`]),b=s().min(1).max(160),se=s().min(32).max(160).regex(/^[A-Za-z0-9_-]+$/);t(`type`,[r({type:l(`endpoint`),endpointId:b}),r({type:l(`channel`),channel:s().min(1).max(64)}),r({type:l(`system`),source:u([`cli`,`automation`,`heartbeat`,`task`,`internal`,`task_update`])})]).options[0].extend({token:se});var ce=f(),x=o().int().nonnegative(),S=n(s(),i()),C=r({name:s().regex(/^[a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*)+$/).max(120),title:s().min(1).max(120),description:s().min(1).max(2e3),inputSchema:S,outputSchema:S,policyId:s().regex(/^[a-z][a-z0-9_.-]+$/).max(120),sensitivity:oe,effect:ie,confirmation:y,requiresForeground:a(),requiredPermissions:c(s().min(1).max(120)).max(20),timeoutMs:o().int().min(1e3).max(3e5),maxConcurrency:o().int().min(1).max(4),supportsCancellation:a(),idempotent:a(),resultKinds:c(ae).min(1).max(3)});r({principalId:b,displayName:s().min(1).max(120),kind:_,platform:s().min(1).max(80),publicKey:s().min(32).max(2048)}),r({endpointId:b});var w=s().regex(/^[a-z][a-z0-9_]*(?:\.[a-z][a-z0-9_]*)+$/).max(120);r({jobId:f(),endpointId:b,capability:w,input:S,idempotencyKey:b,consentGrantId:b,createdAt:x,expiresAt:x}),r({jobId:f(),status:u([`queued`,`running`,`succeeded`,`failed`,`cancelled`]),updatedAt:x,output:S.optional(),error:r({code:b,message:s().min(1).max(2e3)}).optional()}),r({eventId:f(),endpointId:b,subscriptionId:b,eventType:w,data:S,occurredAt:x});var le=r({principalId:b,endpointId:b,connectionInstanceId:f(),displayName:s().min(1).max(120),kind:_,platform:s().min(1).max(80),appVersion:s().min(1).max(80),availability:v,nonce:b,signedAt:x,signature:s().min(16).max(1024),tools:c(C).max(100)}),ue=r({invocationId:f(),toolCallId:b,toolName:C.shape.name,arguments:S,descriptorRevision:s().min(1).max(128),confirmationRequired:a(),deadlineAt:x,uploadGrant:r({path:s().startsWith(`/`).max(500),token:b,maxBytes:o().int().positive(),maxFiles:o().int().min(1).max(20),expiresAt:x}).optional()}),de=r({invocationId:f(),reason:s().min(1).max(500)}),T=r({invocationId:f()}),E=t(`type`,[r({type:l(`text`),text:s().max(256*1024)}),r({type:l(`json`),value:i()}),r({type:l(`file`),fileId:b,name:s().min(1).max(255),mimeType:s().min(1).max(255),size:o().int().nonnegative(),sha256:s().regex(/^[a-f0-9]{64}$/)})]),fe=u([`ENDPOINT_OFFLINE`,`ENDPOINT_NOT_FOREGROUND`,`ENDPOINT_DISCONNECTED`,`TOOL_NOT_FOUND`,`TOOL_REVISION_MISMATCH`,`INVALID_ARGUMENTS`,`PERMISSION_DENIED`,`USER_DENIED`,`TOOL_BUSY`,`TOOL_TIMEOUT`,`TOOL_CANCELLED`,`RESULT_TOO_LARGE`,`PROTOCOL_ERROR`]),D=(e,t)=>r({protocolVersion:l(2),messageId:ce,type:l(e),sentAt:x,payload:t}),O=t(`type`,[D(`endpoint.availability_changed`,r({availability:v})),D(`tool.received`,T),D(`tool.progress`,r({invocationId:f(),message:s().max(500).optional(),percent:o().min(0).max(100).optional()})),D(`tool.result`,r({invocationId:f(),content:c(E).min(1).max(20),details:S.optional()})),D(`tool.error`,r({invocationId:f(),code:fe,message:s().min(1).max(2e3)})),D(`tool.cancelled`,T)]),k=t(`type`,[D(`tool.invoke`,ue),D(`tool.cancel`,de)]),A={type:`array`,minItems:1,maxItems:20,items:{type:`object`,additionalProperties:!1,required:[`type`,`text`],properties:{type:{const:`text`},text:{type:`string`,maxLength:256*1024}}}};function j(e){if(e===null)return`null`;if(typeof e==`string`||typeof e==`boolean`)return JSON.stringify(e);if(typeof e==`number`){if(!Number.isFinite(e))throw Error(`Canonical JSON only supports finite numbers`);return JSON.stringify(e)}if(typeof e!=`object`)throw Error(`Canonical JSON does not support ${typeof e}`);if(Array.isArray(e))return`[${e.map(j).join(`,`)}]`;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)throw Error(`Canonical JSON only supports plain objects`);let n=e;return`{${Object.keys(n).sort().map(e=>`${JSON.stringify(e)}:${j(n[e])}`).join(`,`)}}`}function M(e){let{signature:t,...n}=e;return j(n)}var N={type:`array`,minItems:1,maxItems:1,items:{type:`object`,additionalProperties:!1,required:[`type`,`value`],properties:{type:{const:`json`},value:{type:`object`,additionalProperties:!1,required:[`capturedAt`,`platform`,`systemVersion`,`locale`,`timezone`],properties:{capturedAt:{type:`integer`,minimum:0},platform:{type:`string`,minLength:1,maxLength:40},systemVersion:{type:`string`,maxLength:80},locale:{type:`string`,maxLength:80},timezone:{type:`string`,maxLength:80},online:{type:`boolean`}}}}}},P={type:`array`,minItems:1,maxItems:1,items:{type:`object`,additionalProperties:!1,required:[`type`,`value`],properties:{type:{const:`json`},value:{type:`object`,additionalProperties:!1,required:[`capturedAt`,`levelPercent`,`charging`],properties:{capturedAt:{type:`integer`,minimum:0},levelPercent:{type:[`number`,`null`],minimum:0,maximum:100},charging:{type:[`boolean`,`null`]}}}}}};function F(e,t){return{name:`${e}.device.get_${t}`,title:t===`power`?`Read this device’s battery`:`Read this device’s environment`,description:t===`power`?`Read a fresh battery sample from the device that sent this user message. Unknown readings are null.`:`Read bounded platform, system version, language and timezone from the device that sent this user message. No files, page content, network addresses or identifiers are collected.`,inputSchema:te,outputSchema:t===`power`?P:N,policyId:`public.background-read`,sensitivity:`public`,effect:`read`,confirmation:`never`,requiresForeground:!1,requiredPermissions:[],timeoutMs:1e4,maxConcurrency:1,supportsCancellation:!0,idempotent:!0,resultKinds:[`json`]}}var I=256*1024,L=15e3,R=45e3,z=[`realtime.capability-negotiation.v1`],B=u([`web`,`desktop`,`mobile`,`browser_extension`,`tui`,`mcp`]),V=s().min(1).max(512),pe=s().regex(/^[a-z][a-z0-9_.-]*$/).max(160),me=f(),he=o().int().nonnegative(),H=o().int().positive(),U=s().min(1).max(160),W=(e,t)=>d({protocolVersion:l(2),messageId:me,kind:l(e),sentAt:he,payload:t}),G=d({topic:V,afterSeq:o().int().nonnegative().optional(),view:l(`compact`).optional()});t(`kind`,[W(`realtime.hello`,d({ticket:s().min(32).max(512),clientId:s().min(1).max(160),clientKind:B,subscriptions:c(G).max(100).default([]),capabilities:c(U).max(64).optional(),endpoint:le.optional()})),W(`realtime.subscribe`,d({subscriptions:c(G).min(1).max(100)})),W(`realtime.unsubscribe`,d({topics:c(V).min(1).max(100)})),W(`realtime.ping`,d({})),W(`endpoint.message`,O)]);var ge=d({topic:V,seq:H,event:pe,data:i()}),_e=t(`kind`,[W(`realtime.ready`,d({connectionId:f(),heartbeatIntervalMs:l(L),heartbeatTimeoutMs:l(R),negotiatedCapabilities:c(U).max(64).optional(),endpoint:d({endpointId:s().min(1).max(160),turnToken:s().min(32).max(160)}).optional()})),W(`realtime.event`,ge),W(`realtime.subscribed`,d({topic:V,cursor:o().int().nonnegative()})),W(`realtime.gap`,d({topic:V,requestedSeq:o().int().nonnegative(),earliestSeq:H,recoverable:a()})),W(`realtime.pong`,d({})),W(`realtime.error`,d({code:s().min(1).max(80),message:s().min(1).max(500)})),W(`endpoint.message`,k)]);function ve(e){return _e.parse(e)}var K=class extends Error{retryable;constructor(e,t){super(e),this.retryable=t,this.name=`RealtimeConnectionError`}},ye=class extends Error{bytes;maxBytes;constructor(e,t){super(`Realtime client frame is ${e} bytes; maximum is ${t} bytes`),this.bytes=e,this.maxBytes=t,this.name=`RealtimeFrameTooLargeError`}};function be(e){if(typeof e==`string`)return e;if(e instanceof ArrayBuffer)return new TextDecoder().decode(e);if(ArrayBuffer.isView(e)){let t=Uint8Array.from(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));return new TextDecoder().decode(t)}throw Error(`Realtime server sent a non-text frame`)}function xe(e){return e===1009||e===4400||e===4401||e===4409||e===4413}var Se=class{options;desiredSubscriptions=new Map;cursors=new Map;socket;reconnectTimer;heartbeatTimer;connectionTimer;ticketAbort;generation=0;reconnectAttempts=0;shouldReconnect=!1;ready=!1;lastServerMessageAt=0;endpointBinding;reconnectWhenSocketOpens=!1;offeredCapabilities=new Set;constructor(e){this.options=e}connect(){this.shouldReconnect||(this.shouldReconnect=!0,this.open(!1))}disconnect(){this.shouldReconnect=!1,this.reconnectWhenSocketOpens=!1,this.generation+=1,this.clearTimers(),this.ready=!1,this.offeredCapabilities.clear(),this.endpointBinding?.onDisconnected?.(),this.socket?.close(1e3,`Client disconnected`),this.socket=void 0,this.options.onStateChange?.(`disconnected`)}reconnect(){this.reconnectWhenSocketOpens=!1,this.generation+=1,this.clearTimers(),this.ready=!1,this.endpointBinding?.onDisconnected?.(),this.socket?.close(1e3,`Client reconnecting`),this.socket=void 0,this.reconnectAttempts=0,this.shouldReconnect=!0,this.open(!0)}subscribe(e,t){this.desiredSubscriptions.set(e,t),t!==void 0&&this.cursors.set(e,t),this.ready&&this.sendSubscriptions([{topic:e,afterSeq:this.cursors.get(e)??t}])}unsubscribe(e){this.desiredSubscriptions.delete(e),this.ready&&this.send(this.clientMessage(`realtime.unsubscribe`,{topics:[e]}))}sendEndpointMessage(e){if(!this.ready)throw Error(`Realtime connection is not ready`);this.send(this.clientMessage(`endpoint.message`,e))}setEndpoint(e){this.endpointBinding=e,this.refreshEndpointConnection()}clearEndpoint(e){if(e&&this.endpointBinding!==e)return;let t=this.endpointBinding;this.endpointBinding=void 0,t?.onDisconnected?.(),this.refreshEndpointConnection()}refreshEndpointConnection(){if(this.shouldReconnect){if(this.socket?.readyState===0){this.reconnectWhenSocketOpens=!0;return}this.reconnect()}}async open(e){let t=++this.generation,n=this.options.connectionTimeoutMs??15e3,r=new AbortController;this.ticketAbort?.abort(),this.ticketAbort=r;let i,a=!1,o,s=(e,n=!0)=>{a||t!==this.generation||(a=!0,this.clearConnectionTimer(),r.abort(),this.ticketAbort===r&&(this.ticketAbort=void 0),this.ready=!1,this.offeredCapabilities.clear(),this.endpointBinding?.onDisconnected?.(),this.clearHeartbeat(),this.socket===i&&(this.socket=void 0),i&&(i.onopen=null,i.onmessage=null,i.onerror=null,i.onclose=null,i.close(4e3,e.slice(0,120))),this.shouldReconnect&&n?this.scheduleReconnect(e):this.shouldReconnect?(this.shouldReconnect=!1,this.options.onStateChange?.(`error`,e)):this.options.onStateChange?.(`disconnected`))};this.connectionTimer=setTimeout(()=>s(`Realtime connection timed out`),n),this.options.onStateChange?.(e?`reconnecting`:`connecting`);try{let[e,n]=await Promise.all([this.options.issueTicket(r.signal),this.endpointBinding?.createHello()]),c=e.ticket;if(2<e.realtime.minVersion)throw new K(`CLIENT_UPDATE_REQUIRED`,!1);if(2>e.realtime.maxVersion)throw new K(`GATEWAY_UPDATE_REQUIRED`,!1);let l=z.filter(t=>e.realtime.capabilities.includes(t));if(a||!this.shouldReconnect||t!==this.generation)return;this.offeredCapabilities=new Set(l??[]),i=this.options.createWebSocket(this.options.getWebSocketUrl()),this.socket=i,i.onopen=()=>{if(t!==this.generation)return;if(this.reconnectWhenSocketOpens){this.reconnect();return}let e=[...this.desiredSubscriptions].map(([e,t])=>({topic:e,afterSeq:this.cursors.get(e)??t}));this.send(this.clientMessage(`realtime.hello`,{ticket:c,clientId:this.options.clientId,clientKind:this.options.clientKind,subscriptions:e,...l?.length?{capabilities:l}:{},...n?{endpoint:n}:{}}))},i.onmessage=e=>{if(t!==this.generation)return;let n=()=>{if(!(a||t!==this.generation))return this.handleServerMessage(be(e.data))};if(!o){try{let e=n();if(!e)return;let t=e.catch(e=>s(e instanceof Error?e.message:`Invalid realtime server message`)).then(()=>void 0);o=t,t.finally(()=>{o===t&&(o=void 0)})}catch(e){s(e instanceof Error?e.message:`Invalid realtime server message`)}return}let r=o.then(n).catch(e=>s(e instanceof Error?e.message:`Invalid realtime server message`)).then(()=>void 0);o=r,r.finally(()=>{o===r&&(o=void 0)})},i.onerror=()=>{},i.onclose=e=>{s(e.reason||`WebSocket closed (${e.code??0})`,!xe(e.code))}}catch(e){s(e instanceof Error?e.message:`Realtime connection failed`,!(e instanceof K)||e.retryable)}}handleServerMessage(e){let t=ve(JSON.parse(e));if(this.lastServerMessageAt=Date.now(),t.kind===`realtime.ready`){let e=t.payload.negotiatedCapabilities??[];if(e.some(e=>!this.offeredCapabilities.has(e)))throw Error(`Realtime server negotiated a capability the client did not offer`);this.ready=!0,this.reconnectAttempts=0,this.clearConnectionTimer(),this.ticketAbort=void 0,this.options.onStateChange?.(`connected`),this.options.onCapabilities?.(e),t.payload.endpoint&&this.endpointBinding?.onReady(t.payload.endpoint),this.clearHeartbeat(),this.heartbeatTimer=setInterval(()=>{if(this.ready){if(Date.now()-this.lastServerMessageAt>=t.payload.heartbeatTimeoutMs){this.reconnect();return}this.send(this.clientMessage(`realtime.ping`,{}))}},t.payload.heartbeatIntervalMs)}else if(t.kind===`realtime.event`){let e=this.cursors.get(t.payload.topic);if(e!==void 0&&t.payload.seq<=e)return;this.options.onEvent?.(t.payload),this.cursors.set(t.payload.topic,t.payload.seq)}else if(t.kind===`realtime.subscribed`)this.cursors.set(t.payload.topic,t.payload.cursor),this.options.onSubscribed?.(t.payload);else if(t.kind===`realtime.gap`)return this.cursors.set(t.payload.topic,t.payload.earliestSeq-1),this.options.onGap?.(t.payload);else t.kind===`realtime.error`?this.options.onStateChange?.(`error`,t.payload.message):t.kind===`endpoint.message`&&(this.endpointBinding?.onMessage(t.payload),this.options.onEndpointMessage?.(t.payload))}sendSubscriptions(e){this.send(this.clientMessage(`realtime.subscribe`,{subscriptions:e}))}clientMessage(e,t){let n=this.options.createMessageId?.()??globalThis.crypto?.randomUUID?.();if(!n)throw Error(`RealtimeClient requires createMessageId when crypto.randomUUID is unavailable`);return{protocolVersion:2,messageId:n,kind:e,sentAt:Date.now(),payload:t}}send(e){if(!this.socket||this.socket.readyState!==1)return;let t=JSON.stringify(e),n=new TextEncoder().encode(t).byteLength;if(n>262144)throw new ye(n,I);this.socket.send(t)}scheduleReconnect(e){if(!this.shouldReconnect)return;this.reconnectAttempts+=1;let t=this.options.maxReconnectAttempts;if(t!==void 0&&this.reconnectAttempts>t){this.shouldReconnect=!1,this.options.onStateChange?.(`error`,e);return}this.options.onStateChange?.(`reconnecting`,e);let n=Math.min(3e4,1e3*2**Math.min(this.reconnectAttempts-1,5)),r=Math.round(n*(.5+Math.random()*.5));this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=void 0,this.open(!0)},r)}clearHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0}clearTimers(){this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=void 0,this.clearConnectionTimer(),this.ticketAbort?.abort(),this.ticketAbort=void 0,this.clearHeartbeat()}clearConnectionTimer(){this.connectionTimer&&clearTimeout(this.connectionTimer),this.connectionTimer=void 0}},Ce=500,q=null,J;function Y(e){J=e,q!==null&&clearTimeout(q),q=setTimeout(()=>{q=null;let e=J;J=void 0,window.dispatchEvent(new CustomEvent(`config-reload`,{detail:e}))},Ce)}function we(e,t){if(e===`config.reload`){Y(t);return}window.dispatchEvent(new CustomEvent(e.replace(/[._]/g,`-`),{detail:t}))}var X=new Map,Z=new Map,Q,$;function Te(){let e=`xopc:realtime-client-id`,t=sessionStorage.getItem(e);if(t)return t;let n=crypto.randomUUID();return sessionStorage.setItem(e,n),n}function Ee(){let t=new URL(e(`/api/realtime/v1/ws`));return t.protocol=t.protocol===`https:`?`wss:`:`ws:`,t.toString()}function De(){let t=Te(),n=window.electronAPI?`desktop`:`web`,r=new Se({clientId:t,clientKind:n,getWebSocketUrl:Ee,issueTicket:async r=>{let i=await fetch(e(`/api/realtime/tickets`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({clientId:t,clientKind:n,protocolVersion:2}),signal:r}),a=await i.json().catch(()=>null);if(!i.ok||!a?.payload?.ticket||!a.payload.realtime)throw Error(a?.error?.message??`Realtime ticket failed (${i.status})`);return{ticket:a.payload.ticket,realtime:a.payload.realtime}},createWebSocket:e=>new WebSocket(e),onStateChange:(e,t)=>{p({connectionState:e,error:t??null}),e===`connected`&&window.dispatchEvent(new CustomEvent(`gateway-realtime-connected`))},onEvent:e=>{(e.topic===`gateway`||e.topic===`sessions`)&&we(e.event,e.data);let t=Z.get(e.topic);(t===void 0||e.seq>t)&&Z.set(e.topic,e.seq);for(let t of X.get(e.topic)??[])if(!(t.cursor!==void 0&&e.seq<=t.cursor))try{t.listener.onEvent(e)}catch(e){console.error(`[realtime] topic listener failed:`,e)}finally{t.cursor=Math.max(t.cursor??0,e.seq)}},onGap:async e=>{window.dispatchEvent(new CustomEvent(`realtime-gap`,{detail:e}));let t=[...X.get(e.topic)??[]].filter(t=>!e.recoverable||t.cursor===void 0||t.cursor<e.earliestSeq-1),n=await Promise.allSettled(t.map(t=>t.listener.onGap?.(e)));for(let e of n)e.status===`rejected`&&console.error(`[realtime] topic gap handler failed:`,e.reason)}});Q?.disconnect(),Q=r,$&&r.setEndpoint($),r.subscribe(`gateway`,Z.get(`gateway`)),r.subscribe(`sessions`,Z.get(`sessions`));for(let e of X.keys())r.subscribe(e,Z.get(e));return p({connectionState:`connecting`,error:null}),r.connect(),()=>{Q===r&&(r.disconnect(),Q=void 0)}}function Oe(e){return $=e,Q?.setEndpoint(e),()=>{$===e&&($=void 0,Q?.clearEndpoint(e))}}function ke(e){Q?.sendEndpointMessage(e)}function Ae(){Q?.reconnect()}function je(e,t,n){let r=X.get(e)??new Set,i=r.size===0,a=Z.get(e),o={listener:t,cursor:n??a};if(r.add(o),X.set(e,r),i){let t=n??a;Z.set(e,t),Q?.subscribe(e,t)}else n!==void 0&&(a===void 0||n<a)&&Q?.subscribe(e,n);return()=>{let t=X.get(e);t?.delete(o),(!t||t.size===0)&&(X.delete(e),Z.delete(e),Q?.unsubscribe(e))}}export{je as a,A as c,M as d,E as f,ee as h,De as i,j as l,m,Ae as n,Y as o,ne as p,ke as r,re as s,Oe as t,F as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as e}from"./locale-store-JogcXC4J.js";var t=e(()=>({connectionState:`idle`,error:null}));function n(e){t.setState(e)}export{t as n,n as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{n as a,r as o}from"./popover-select-DGKUpVsz.js";import{t as s}from"./loader-circle-CifKLtgG.js";import{t as c}from"./messages-RzwPiQNL.js";import{t as l}from"./cn-0WouolD0.js";import{i as u,l as d,n as f,o as p}from"./locale-store-JogcXC4J.js";import{i as m,o as h}from"./vendor-swr-BIWyz7Rc.js";import{t as g}from"./button-aIC072nz.js";import{t as _}from"./skeleton-BI5TyibZ.js";import{n as v,r as y}from"./gateway-config-swr-DF_HV6NP.js";import{Cl as b,Do as x,Eo as S,Fl as C,Fu as w,Lu as T,Ml as E,Nd as D,Nl as O,Nn as k,S as A,To as j,Wn as M,bl as N,bn as P,iu as F,jo as I,ks as L,ma as ee,na as te,rl as ne,vo as R,xl as z,yo as re}from"./index-D1oivYvN.js";import{t as B}from"./number-input-DDeqHK-G.js";import{n as ie,t as ae}from"./settings-page-header-CYpuTXUW.js";import{t as oe}from"./settings-page-layout-B20AfmFG.js";import{n as se,t as ce}from"./settings-form-section-BNYQjZU4.js";import{t as le}from"./settings-advanced-gate-VqBu7gHu.js";var V=e(t(),1),H=n(),U=18790,W={enabled:!0,maxAttempts:5,windowMs:9e5,blockDurationMs:3e5,exemptLoopback:!0};function G(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function K(e){return x(e)}async function ue(e){let t=await p(u(`/api/gateway/reveal-auth-secret/${encodeURIComponent(e)}`),{method:`POST`,body:`{}`});if(!t.ok||!t.payload)throw Error(t.error?.message??`Reveal failed`);return t.payload}function q(e){return K(e)?``:e.trim()}function de(e){return[...e].map(e=>e.trim()).sort()}function fe(e){return JSON.stringify({outboundProxy:e.outboundProxy,bind:e.bind,customBindHost:e.customBindHost.trim(),port:e.port,auth:{mode:e.auth.mode,token:q(e.auth.token),password:q(e.auth.password),rateLimit:e.auth.rateLimit,trustedProxy:{userHeader:e.auth.trustedProxy.userHeader.trim(),requiredHeaders:de(e.auth.trustedProxy.requiredHeaders),allowUsers:de(e.auth.trustedProxy.allowUsers),allowLoopback:e.auth.trustedProxy.allowLoopback}},trustedProxies:de(e.trustedProxies),allowRealIpFallback:e.allowRealIpFallback,dangerouslyAllowHostHeaderOriginFallback:e.dangerouslyAllowHostHeaderOriginFallback})}function pe(e,t){return fe(e)!==fe(t)}async function me(e){return(await p(u(`/api/gateway/cors-origin-candidates?port=${encodeURIComponent(String(e))}`))).payload?.candidates??[]}function he(e){return e===`none`||e===`token`||e===`password`||e===`trusted-proxy`?e:`token`}function J(e){let t=G(e)?e:{};return{enabled:t.enabled!==!1,maxAttempts:typeof t.maxAttempts==`number`&&Number.isFinite(t.maxAttempts)?Math.max(1,Math.floor(t.maxAttempts)):W.maxAttempts,windowMs:typeof t.windowMs==`number`&&Number.isFinite(t.windowMs)&&t.windowMs>0?Math.floor(t.windowMs):W.windowMs,blockDurationMs:typeof t.blockDurationMs==`number`&&Number.isFinite(t.blockDurationMs)&&t.blockDurationMs>0?Math.floor(t.blockDurationMs):typeof t.lockoutMs==`number`&&Number.isFinite(t.lockoutMs)&&t.lockoutMs>0?Math.floor(t.lockoutMs):W.blockDurationMs,exemptLoopback:t.exemptLoopback!==!1}}function ge(e){let t=G(e)?e:{};return{userHeader:typeof t.userHeader==`string`?t.userHeader:``,requiredHeaders:Y(t.requiredHeaders,32),allowUsers:Y(t.allowUsers,128),allowLoopback:t.allowLoopback===!0}}function _e(e){return e===`auto`||e===`off`||e===`explicit`?e:`auto`}function Y(e,t=24){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()).slice(0,t):[]}function ve(e){return e===`auto`||e===`loopback`||e===`lan`||e===`tailnet`||e===`custom`?e:`loopback`}function ye(e){if(e.bind===`loopback`)return!1;if(e.bind===`lan`)return!0;if(e.bind===`custom`){let t=e.customBindHost.trim().toLowerCase();return t?t!==`127.0.0.1`&&t!==`localhost`&&t!==`::1`:!0}return!0}function be(e){try{let t=new URL(e.trim());return[`http:`,`https:`].includes(t.protocol)&&!!t.hostname&&!t.username&&!t.password&&!t.search&&!t.hash&&(!t.pathname||t.pathname===`/`)}catch{return!1}}function xe(e){let t=e.outboundProxy;if((t.mode===`custom`||t.url.trim())&&!be(t.url))return`Use an HTTP or HTTPS proxy origin without credentials, path, query or fragment.`;let n=ye(e);return n&&e.auth.mode===`none`?`Network-accessible gateway requires authentication (token, password, or trusted-proxy).`:n&&e.auth.mode===`trusted-proxy`&&e.trustedProxies.length===0?`Trusted-proxy auth on a network bind requires at least one gateway.trustedProxies entry.`:e.auth.mode===`trusted-proxy`&&!e.auth.trustedProxy.userHeader.trim()?`Trusted-proxy auth requires gateway.auth.trustedProxy.userHeader.`:n&&e.corsOrigins.includes(`*`)?`CORS wildcard "*" is not allowed on network-accessible binds.`:e.bind===`custom`&&!e.customBindHost.trim()?`Custom bind mode requires a bind address.`:null}function Se(e){let t=G(e)?e:{},n=G(t.gateway)?t.gateway:{},r=G(n.auth)?n.auth:{},i=G(n.security)?n.security:{},a=G(t.update)?t.update:{},o=G(a.auto)?a.auto:{},s=a.channel,c=s===`beta`||s===`dev`||s===`stable`?s:`stable`,l=Array.isArray(n.corsOrigins)?n.corsOrigins.filter(e=>typeof e==`string`&&e.trim().length>0):[],u=ve(n.bind),d=typeof n.customBindHost==`string`&&n.customBindHost.trim()?n.customBindHost.trim():``,f=G(n.outboundProxy)?n.outboundProxy:{};return{outboundProxy:{mode:f.mode===`custom`||f.mode===`direct`?f.mode:`environment`,url:typeof f.url==`string`?f.url:``,noProxy:typeof f.noProxy==`string`?f.noProxy:``},bind:u,customBindHost:d,port:typeof n.port==`number`&&Number.isFinite(n.port)?Math.floor(n.port):U,auth:{mode:he(r.mode),token:typeof r.token==`string`?r.token:``,password:typeof r.password==`string`?r.password:``,rateLimit:J(r.rateLimit),trustedProxy:ge(r.trustedProxy)},corsOrigins:l,trustedProxies:Y(n.trustedProxies,64),allowRealIpFallback:n.allowRealIpFallback===!0,dangerouslyAllowHostHeaderOriginFallback:n.dangerouslyAllowHostHeaderOriginFallback===!0,securityStrict:i.strict===!0,channelConnectDeferMode:_e(n.channelConnectDeferMode),channelConnectDeferIds:Y(n.channelConnectDeferIds),channelConnectDeferSkipIds:Y(n.channelConnectDeferSkipIds),updateChannel:c,updateCheckOnStart:a.checkOnStart!==!1,updateAutoEnabled:o.enabled===!0,updateAutoStableDelayHours:typeof o.stableDelayHours==`number`&&Number.isFinite(o.stableDelayHours)?Math.max(0,Math.floor(o.stableDelayHours)):6,updateAutoStableJitterHours:typeof o.stableJitterHours==`number`&&Number.isFinite(o.stableJitterHours)?Math.max(0,Math.floor(o.stableJitterHours)):12,updateAutoBetaCheckIntervalHours:typeof o.betaCheckIntervalHours==`number`&&Number.isFinite(o.betaCheckIntervalHours)?Math.max(.25,o.betaCheckIntervalHours):1}}function Ce(e){let t={mode:e.auth.mode,rateLimit:e.auth.rateLimit};if(e.auth.mode===`token`){let n=e.auth.token.trim();n.length>0&&!K(n)&&(t.token=e.auth.token),t.password=null,t.trustedProxy=null}else if(e.auth.mode===`password`){let n=e.auth.password.trim();n.length>0&&!K(n)&&(t.password=e.auth.password),t.token=null,t.trustedProxy=null}else if(e.auth.mode===`trusted-proxy`){t.token=null,t.password=null;let n=e.auth.trustedProxy;t.trustedProxy={userHeader:n.userHeader.trim(),...n.requiredHeaders.length>0?{requiredHeaders:n.requiredHeaders}:{},...n.allowUsers.length>0?{allowUsers:n.allowUsers}:{},...n.allowLoopback?{allowLoopback:!0}:{}}}else t.token=null,t.password=null,t.trustedProxy=null;return t}async function we(e){let t=xe(e);if(t)throw Error(t);await p(u(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{outboundProxy:e.outboundProxy,bind:e.bind,...e.bind===`custom`?{customBindHost:e.customBindHost.trim()}:{},port:e.port,auth:Ce(e),corsOrigins:e.corsOrigins,trustedProxies:e.trustedProxies,allowRealIpFallback:e.allowRealIpFallback,dangerouslyAllowHostHeaderOriginFallback:e.dangerouslyAllowHostHeaderOriginFallback,security:{strict:e.securityStrict},channelConnectDeferMode:e.channelConnectDeferMode,channelConnectDeferIds:e.channelConnectDeferIds,channelConnectDeferSkipIds:e.channelConnectDeferSkipIds},update:{channel:e.updateChannel,checkOnStart:e.updateCheckOnStart,auto:{enabled:e.updateAutoEnabled,stableDelayHours:e.updateAutoStableDelayHours,stableJitterHours:e.updateAutoStableJitterHours,betaCheckIntervalHours:e.updateAutoBetaCheckIntervalHours}}})}),v()}var X=r();function Te(e){let t=(0,H.c)(46),{value:n,onChange:r,g:i}=e,[s,c]=(0,V.useState)(!1),u;t[0]!==s||t[1]!==n.mode||t[2]!==n.url?(u=s&&n.mode===`custom`&&!be(n.url),t[0]=s,t[1]=n.mode,t[2]=n.url,t[3]=u):u=t[3];let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=l(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle`,I),t[4]=f):f=t[4];let p=f,m;t[5]===i.outboundProxyTitle?m=t[6]:(m=(0,X.jsx)(`h2`,{id:`outbound-proxy-title`,className:`text-sm font-semibold text-fg`,children:i.outboundProxyTitle}),t[5]=i.outboundProxyTitle,t[6]=m);let h;t[7]===i.outboundProxyHint?h=t[8]:(h=(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i.outboundProxyHint}),t[7]=i.outboundProxyHint,t[8]=h);let g;t[9]===i.outboundProxyMode?g=t[10]:(g=(0,X.jsx)(`label`,{htmlFor:`outbound-proxy-mode`,className:`block text-sm font-medium text-fg`,children:i.outboundProxyMode}),t[9]=i.outboundProxyMode,t[10]=g);let _;t[11]!==r||t[12]!==n?(_=e=>r({...n,mode:e.target.value}),t[11]=r,t[12]=n,t[13]=_):_=t[13];let v;t[14]===i.outboundProxyEnvironment?v=t[15]:(v=(0,X.jsx)(o,{value:`environment`,children:i.outboundProxyEnvironment}),t[14]=i.outboundProxyEnvironment,t[15]=v);let y;t[16]===i.outboundProxyCustom?y=t[17]:(y=(0,X.jsx)(o,{value:`custom`,children:i.outboundProxyCustom}),t[16]=i.outboundProxyCustom,t[17]=y);let b;t[18]===i.outboundProxyDirect?b=t[19]:(b=(0,X.jsx)(o,{value:`direct`,children:i.outboundProxyDirect}),t[18]=i.outboundProxyDirect,t[19]=b);let x;t[20]!==_||t[21]!==v||t[22]!==y||t[23]!==b||t[24]!==n.mode?(x=(0,X.jsxs)(a,{id:`outbound-proxy-mode`,value:n.mode,onChange:_,children:[v,y,b]}),t[20]=_,t[21]=v,t[22]=y,t[23]=b,t[24]=n.mode,t[25]=x):x=t[25];let S;t[26]!==x||t[27]!==g?(S=(0,X.jsxs)(`div`,{className:`space-y-1`,children:[g,x]}),t[26]=x,t[27]=g,t[28]=S):S=t[28];let C;t[29]!==i.outboundProxyInvalid||t[30]!==i.outboundProxyUrl||t[31]!==d||t[32]!==r||t[33]!==n?(C=n.mode===`custom`&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`label`,{htmlFor:`outbound-proxy-url`,className:`block text-sm font-medium text-fg`,children:i.outboundProxyUrl}),(0,X.jsx)(`input`,{id:`outbound-proxy-url`,className:p,value:n.url,placeholder:`http://127.0.0.1:7897`,autoComplete:`off`,spellCheck:!1,"aria-invalid":d,"aria-describedby":d?`outbound-proxy-error`:void 0,onChange:e=>r({...n,url:e.target.value}),onBlur:()=>c(!0)}),d&&(0,X.jsx)(`p`,{id:`outbound-proxy-error`,role:`alert`,className:`text-xs text-danger`,children:i.outboundProxyInvalid})]}),t[29]=i.outboundProxyInvalid,t[30]=i.outboundProxyUrl,t[31]=d,t[32]=r,t[33]=n,t[34]=C):C=t[34];let w;t[35]!==i.outboundProxyBypass||t[36]!==i.outboundProxyBypassHint||t[37]!==r||t[38]!==n?(w=n.mode!==`direct`&&(0,X.jsxs)(`div`,{className:`space-y-1`,children:[(0,X.jsx)(`label`,{htmlFor:`outbound-proxy-bypass`,className:`block text-sm font-medium text-fg`,children:i.outboundProxyBypass}),(0,X.jsx)(`input`,{id:`outbound-proxy-bypass`,className:p,value:n.noProxy,placeholder:`.example.com,192.168.1.10`,autoComplete:`off`,spellCheck:!1,"aria-describedby":`outbound-proxy-bypass-hint`,onChange:e=>r({...n,noProxy:e.target.value})}),(0,X.jsx)(`p`,{id:`outbound-proxy-bypass-hint`,className:`text-xs text-fg-muted`,children:i.outboundProxyBypassHint})]}),t[35]=i.outboundProxyBypass,t[36]=i.outboundProxyBypassHint,t[37]=r,t[38]=n,t[39]=w):w=t[39];let T;return t[40]!==S||t[41]!==C||t[42]!==w||t[43]!==m||t[44]!==h?(T=(0,X.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-edge p-4`,"aria-labelledby":`outbound-proxy-title`,children:[m,h,S,C,w]}),t[40]=S,t[41]=C,t[42]=w,t[43]=m,t[44]=h,t[45]=T):T=t[45],T}var Ee={critical:3,warn:2,info:1};function De(){return u(`/api/doctor?security=true`)}function Oe(e){return e.toSorted((e,t)=>Ee[t.severity]-Ee[e.severity]||e.checkId.localeCompare(t.checkId))}function ke(e){let t=e?.checks?.find(e=>e.id===`security-audit`);if(!t)return{status:`skip`,message:`Security audit unavailable.`,hints:[],findings:[]};let n=Oe((t.findings??[]).filter(e=>typeof e.checkId==`string`&&(e.severity===`critical`||e.severity===`warn`||e.severity===`info`)&&typeof e.title==`string`&&typeof e.detail==`string`));return{status:t.status,message:t.message,hints:Array.isArray(t.hints)?t.hints.filter(e=>typeof e==`string`):[],findings:n}}async function Ae(){return ke(await p(De()))}function je(e){let t=(0,H.c)(39),{enabled:n,refreshToken:r}=e,i=r===void 0?0:r,a=f(Ne),o;t[0]===a?o=t[1]:(o=c(a),t[0]=a,t[1]=o);let l=o.gatewaySettings,u;t[2]!==n||t[3]!==i?(u=n?[De(),i]:null,t[2]=n,t[3]=i,t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d={revalidateOnFocus:!1},t[5]=d):d=t[5];let{data:p,error:v,isLoading:y,isValidating:x,mutate:S}=m(u,Me,d),w=p??null,T=v instanceof Error?v.message:v?String(v):null,E=y||x,D;t[6]===S?D=t[7]:(D=()=>{S(),h(De())},t[6]=S,t[7]=D);let O=D,k=!n||E,A;t[8]===E?A=t[9]:(A=E?(0,X.jsx)(s,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,X.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),t[8]=E,t[9]=A);let j;t[10]===l.securityAuditRefresh?j=t[11]:(j=(0,X.jsx)(`span`,{className:`ml-1.5`,children:l.securityAuditRefresh}),t[10]=l.securityAuditRefresh,t[11]=j);let M;t[12]!==O||t[13]!==k||t[14]!==A||t[15]!==j?(M=(0,X.jsxs)(g,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:k,onClick:O,children:[A,j]}),t[12]=O,t[13]=k,t[14]=A,t[15]=j,t[16]=M):M=t[16];let N;t[17]!==l.securityAuditSubtitle||t[18]!==l.securityAuditTitle||t[19]!==M?(N=(0,X.jsx)(se,{icon:b,title:l.securityAuditTitle,subtitle:l.securityAuditSubtitle,trailing:M}),t[17]=l.securityAuditSubtitle,t[18]=l.securityAuditTitle,t[19]=M,t[20]=N):N=t[20];let P;t[21]===l.securityAuditSavedConfigHint?P=t[22]:(P=(0,X.jsx)(`p`,{className:`mb-4 text-xs text-fg-subtle`,children:l.securityAuditSavedConfigHint}),t[21]=l.securityAuditSavedConfigHint,t[22]=P);let F;t[23]!==T||t[24]!==l.securityAuditLoadError?(F=T?(0,X.jsxs)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,role:`alert`,children:[l.securityAuditLoadError,`: `,T]}):null,t[23]=T,t[24]=l.securityAuditLoadError,t[25]=F):F=t[25];let I;t[26]!==w||t[27]!==T||t[28]!==E?(I=!T&&E&&!w?(0,X.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,X.jsx)(_,{className:`h-11 w-full rounded-lg`}),(0,X.jsx)(_,{className:`h-10 w-full rounded-lg`})]}):null,t[26]=w,t[27]=T,t[28]=E,t[29]=I):I=t[29];let L;t[30]!==w||t[31]!==l?(L=w?(0,X.jsx)(Pe,{g:l,audit:w}):null,t[30]=w,t[31]=l,t[32]=L):L=t[32];let ee;return t[33]!==N||t[34]!==P||t[35]!==F||t[36]!==I||t[37]!==L?(ee=(0,X.jsxs)(ce,{children:[N,P,F,I,L]}),t[33]=N,t[34]=P,t[35]=F,t[36]=I,t[37]=L,t[38]=ee):ee=t[38],ee}function Me(){return Ae()}function Ne(e){return e.language}function Pe(e){let t=(0,H.c)(40),{g:n,audit:r}=e,i,a,o,s,c,u,d;t[0]!==r.findings||t[1]!==r.status||t[2]!==n?(a=Re(n,r.status,r.findings),d=`space-y-4`,c=l(`rounded-lg px-3 py-2.5 text-sm`,a.bannerClass),u=`status`,s=`flex items-start gap-2`,i=a.icon,o=l(`mt-0.5 size-4 shrink-0`,a.iconClass),t[0]=r.findings,t[1]=r.status,t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c,t[8]=u,t[9]=d):(i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],u=t[8],d=t[9]);let f;t[10]!==i||t[11]!==o?(f=(0,X.jsx)(i,{className:o,"aria-hidden":!0}),t[10]=i,t[11]=o,t[12]=f):f=t[12];let p;t[13]===a.title?p=t[14]:(p=(0,X.jsx)(`p`,{className:`font-medium`,children:a.title}),t[13]=a.title,t[14]=p);let m;t[15]===r.message?m=t[16]:(m=(0,X.jsx)(`p`,{className:`mt-0.5 text-xs opacity-90`,children:r.message}),t[15]=r.message,t[16]=m);let h;t[17]!==p||t[18]!==m?(h=(0,X.jsxs)(`div`,{children:[p,m]}),t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;t[20]!==s||t[21]!==f||t[22]!==h?(g=(0,X.jsxs)(`div`,{className:s,children:[f,h]}),t[20]=s,t[21]=f,t[22]=h,t[23]=g):g=t[23];let _;t[24]!==g||t[25]!==c||t[26]!==u?(_=(0,X.jsx)(`div`,{className:c,role:u,children:g}),t[24]=g,t[25]=c,t[26]=u,t[27]=_):_=t[27];let v;t[28]!==r.findings||t[29]!==r.status||t[30]!==n?(v=r.findings.length>0?(0,X.jsx)(`ul`,{className:`space-y-2`,children:r.findings.map(e=>(0,X.jsx)(Ie,{g:n,finding:e},e.checkId))}):r.status===`pass`||r.status===`skip`?(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.securityAuditNoFindings}):null,t[28]=r.findings,t[29]=r.status,t[30]=n,t[31]=v):v=t[31];let y;t[32]!==r.hints||t[33]!==n?(y=r.hints.length>0?(0,X.jsxs)(`div`,{className:`space-y-1 rounded-lg bg-surface-panel/50 px-3 py-2.5`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n.securityAuditHintsTitle}),(0,X.jsx)(`ul`,{className:`space-y-1 text-xs text-fg-subtle`,children:r.hints.map(Fe)})]}):null,t[32]=r.hints,t[33]=n,t[34]=y):y=t[34];let b;return t[35]!==_||t[36]!==v||t[37]!==y||t[38]!==d?(b=(0,X.jsxs)(`div`,{className:d,children:[_,v,y]}),t[35]=_,t[36]=v,t[37]=y,t[38]=d,t[39]=b):b=t[39],b}function Fe(e){return(0,X.jsx)(`li`,{className:`font-mono`,children:e},e)}function Ie(e){let t=(0,H.c)(31),{g:n,finding:r}=e,i,a,o,s;if(t[0]!==r.severity){let e=Le(r.severity);s=`rounded-lg bg-surface-panel/70 px-3 py-2.5 shadow-surface`,o=`flex items-start gap-2`,i=e.icon,a=l(`mt-0.5 size-4 shrink-0`,e.iconClass),t[0]=r.severity,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else i=t[1],a=t[2],o=t[3],s=t[4];let c;t[5]!==i||t[6]!==a?(c=(0,X.jsx)(i,{className:a,"aria-hidden":!0}),t[5]=i,t[6]=a,t[7]=c):c=t[7];let u;t[8]===r.title?u=t[9]:(u=(0,X.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:r.title}),t[8]=r.title,t[9]=u);let d;t[10]===r.checkId?d=t[11]:(d=(0,X.jsx)(`span`,{className:`font-mono text-[0.65rem] text-fg-subtle`,children:r.checkId}),t[10]=r.checkId,t[11]=d);let f;t[12]!==u||t[13]!==d?(f=(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[u,d]}),t[12]=u,t[13]=d,t[14]=f):f=t[14];let p;t[15]===r.detail?p=t[16]:(p=(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.detail}),t[15]=r.detail,t[16]=p);let m;t[17]!==r.remediation||t[18]!==n?(m=r.remediation?(0,X.jsxs)(`p`,{className:`mt-1.5 text-xs text-fg-subtle`,children:[(0,X.jsx)(`span`,{className:`text-fg-muted`,children:n.securityAuditRemediation}),` `,r.remediation]}):null,t[17]=r.remediation,t[18]=n,t[19]=m):m=t[19];let h;t[20]!==f||t[21]!==p||t[22]!==m?(h=(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[f,p,m]}),t[20]=f,t[21]=p,t[22]=m,t[23]=h):h=t[23];let g;t[24]!==h||t[25]!==o||t[26]!==c?(g=(0,X.jsxs)(`div`,{className:o,children:[c,h]}),t[24]=h,t[25]=o,t[26]=c,t[27]=g):g=t[27];let _;return t[28]!==g||t[29]!==s?(_=(0,X.jsx)(`li`,{className:s,children:g}),t[28]=g,t[29]=s,t[30]=_):_=t[30],_}function Le(e){switch(e){case`critical`:return{icon:D,iconClass:`text-red-600 dark:text-red-400`};case`warn`:return{icon:ne,iconClass:`text-amber-600 dark:text-amber-400`};default:return{icon:T,iconClass:`text-fg-muted`}}}function Re(e,t,n){let r=n.filter(e=>e.severity===`critical`).length,i=n.filter(e=>e.severity===`warn`).length;return t===`fail`||r>0?{icon:D,iconClass:`text-red-600 dark:text-red-400`,title:e.securityAuditStatusFail,bannerClass:`bg-red-50 text-red-950 dark:bg-red-950/40 dark:text-red-100`}:t===`warn`||i>0?{icon:ne,iconClass:`text-amber-600 dark:text-amber-400`,title:e.securityAuditStatusWarn,bannerClass:`bg-amber-50 text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`}:t===`skip`?{icon:T,iconClass:`text-fg-muted`,title:e.securityAuditStatusSkip,bannerClass:`bg-surface-base/55 text-fg`}:{icon:b,iconClass:`text-emerald-600 dark:text-emerald-400`,title:e.securityAuditStatusPass,bannerClass:`bg-emerald-50 text-emerald-950 dark:bg-emerald-950/40 dark:text-emerald-100`}}var ze=new Set([`security`,`advanced`]);function Be(e,t){return t===`advanced`?!0:!ze.has(e)}function Ve(e,t){return e.filter(e=>Be(e,t))}function He(){return`network`}function Ue(e,t){let n=(0,H.c)(5),r=k(We),i,a;n[0]!==e||n[1]!==r||n[2]!==t?(i=()=>{Be(e,r)||t(He())},a=[e,r,t],n[0]=e,n[1]=r,n[2]=t,n[3]=i,n[4]=a):(i=n[3],a=n[4]),(0,V.useEffect)(i,a)}function We(e){return e.mode}function Z(){return l(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,I,`dark:border-edge`)}var Ge=[`network`,`access`,`updates`,`security`,`proxy`,`advanced`],Ke={network:F,access:w,updates:C,security:z,proxy:E,advanced:N};function qe(e){return e&&Ge.includes(e)?e:`network`}function Je(e,t){return t===`network`?e.tabNetwork:t===`access`?e.tabAccess:t===`updates`?e.tabUpdates:t===`security`?e.tabSecurity:t===`proxy`?e.outboundProxyTitle:e.tabAdvanced}function Ye(e,t){return t===`network`?e.networkTabHint:t===`access`?e.accessTabHint:t===`updates`?e.updatesTabHint:t===`security`?e.securitySectionHint:t===`proxy`?e.outboundProxyHint:e.advancedSectionHint}function Xe(e,t){switch(t.type){case`reset`:return{form:null,baseline:null,appliedBaseline:null};case`init-applied`:return{...e,appliedBaseline:structuredClone(t.value)};case`sync`:{let n=structuredClone(t.value);return{form:n,baseline:structuredClone(n),appliedBaseline:e.appliedBaseline}}case`set-form`:return e.form?{...e,form:t.updater(e.form)}:e;case`discard`:return e.baseline?{...e,form:structuredClone(e.baseline)}:e;case`saved`:{let n=structuredClone(t.value);return{form:n,baseline:structuredClone(n),appliedBaseline:e.appliedBaseline}}}}var Ze={saving:!1,error:null,saveOk:!1,auditRefreshToken:0,restarting:!1,restartConfirmOpen:!1};function Qe(){let e=d(e=>e.baseUrl),t=f(e=>e.language),n=c(t),r=n.gatewaySettings,[u,p]=i(),h=k(e=>e.mode),_=h===`advanced`,v=qe(u.get(`tab`)),b=(0,V.useMemo)(()=>Ve(Ge,h),[h]),x=(0,V.useCallback)(e=>{p(t=>{let n=new URLSearchParams(t);return e===`network`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},[p]);Ue(v,x);let S=d(e=>e.conversationId),C=d(e=>e.tokenExpired),w=d(e=>e.openTokenDialog),T=!!S,[E,N]=(0,V.useReducer)(Xe,{form:null,baseline:null,appliedBaseline:null}),F=E.form,I=E.baseline,L=E.appliedBaseline,[ne,R]=(0,V.useReducer)(ee,Ze),{saving:z,error:oe,auditRefreshToken:se,restarting:ce,restartConfirmOpen:H}=ne,U=(0,V.useRef)(!1),W=(0,V.useRef)(null),G=(0,V.useRef)(!1),{data:K,error:q,isLoading:de,mutate:fe}=y(T),he=m(T&&F?[`gateway-cors-origin-candidates`,F.port]:null,([,e])=>me(e),{revalidateOnFocus:!1}),J=(0,V.useMemo)(()=>K?.payload?.config===void 0?null:structuredClone(Se(K.payload.config)),[K]);T?J!==null&&(G.current||(G.current=!0,N({type:`init-applied`,value:J})),!U.current&&W.current!==J&&(W.current=J,N({type:`sync`,value:J}),R({type:`patch`,patch:{saveOk:!1}}))):(W.current!==null||G.current)&&(W.current=null,G.current=!1,N({type:`reset`}),U.current=!1);let ge=!!(T&&de&&K===void 0&&!q),_e=q instanceof Error?q.message:q?String(q):null,Y=(0,V.useMemo)(()=>!F||!I?!1:JSON.stringify(F)!==JSON.stringify(I),[F,I]),ve=(0,V.useMemo)(()=>!I||!L?!1:pe(L,I),[L,I]),ye=(0,V.useCallback)(e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,auth:{...t.auth,...e}})})},[]),be=(0,V.useCallback)(e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,updateChannel:e})})},[]),Ce=(0,V.useCallback)(e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,corsOrigins:e})})},[]),Ee=(0,V.useCallback)(e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,bind:e})})},[]),De=(0,V.useCallback)(e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,customBindHost:e,bind:`custom`})})},[]),Oe=(0,V.useCallback)(e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,port:e})})},[]),ke=(0,V.useCallback)(e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,auth:{...t.auth,rateLimit:{...t.auth.rateLimit,...e}}})})},[]),Ae=(0,V.useCallback)(e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,channelConnectDeferMode:e})})},[]),Me=(0,V.useCallback)(e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,channelConnectDeferIds:e})})},[]),Ne=(0,V.useCallback)(e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,channelConnectDeferSkipIds:e})})},[]),Pe=(0,V.useCallback)(e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,trustedProxies:e})})},[]),Fe=(0,V.useCallback)(e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,auth:{...t.auth,trustedProxy:{...t.auth.trustedProxy,...e}}})})},[]),Ie=(0,V.useCallback)(e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,securityStrict:e})})},[]),Le=(0,V.useCallback)(e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,allowRealIpFallback:e})})},[]),Re=(0,V.useCallback)(e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,dangerouslyAllowHostHeaderOriginFallback:e})})},[]),ze=(0,V.useCallback)(async()=>{if(!F||z)return;let e=xe(F);if(e){R({type:`patch`,patch:{error:e}});return}R({type:`patch`,patch:{saving:!0,error:null,saveOk:!1}});try{await we(F),U.current=!1,N({type:`saved`,value:F}),R({type:`patch`,patch:{saveOk:!0,auditRefreshToken:se+1}})}catch(e){R({type:`patch`,patch:{error:e instanceof Error?e.message:r.saveError}})}finally{R({type:`patch`,patch:{saving:!1}})}},[F,z,r.saveError]),Be=(0,V.useCallback)(()=>{I&&(U.current=!1,N({type:`discard`}),R({type:`patch`,patch:{error:null,saveOk:!1}}))},[I]),He=j(r),We=(0,V.useCallback)(async()=>{if(!ce){R({type:`patch`,patch:{restarting:!0,restartConfirmOpen:!1}});try{let e=await M();e.ok?window.dispatchEvent(new Event(`gateway-restart-initiated`)):R({type:`patch`,patch:{error:e.message||r.restartGatewayFailed}})}catch(e){R({type:`patch`,patch:{error:e instanceof Error?e.message:String(e)}})}finally{R({type:`patch`,patch:{restarting:!1}})}}},[ce,r.restartGatewayFailed]);return T?ge?(0,X.jsx)(ie,{gap:`gap-6`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,X.jsx)(P,{sections:3})}):F?(0,X.jsxs)(ie,{gap:`gap-6`,children:[(0,X.jsx)(ae,{title:n.settingsSections.gateway,docsLink:re(t,`gateway`),docsLabel:r.docsLink,actions:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(g,{type:`button`,variant:`secondary`,disabled:!Y||z,onClick:Be,children:r.discard}),(0,X.jsx)(g,{type:`button`,variant:`primary`,disabled:!Y||z,onClick:()=>void ze(),children:z?r.saving:r.save})]})}),C?(0,X.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-lg bg-red-50 px-4 py-3 dark:bg-red-950/40`,role:`alert`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,X.jsx)(D,{className:`mt-0.5 size-4 shrink-0 text-red-600 dark:text-red-400`}),(0,X.jsx)(`p`,{className:`text-sm text-red-900 dark:text-red-100`,children:r.tokenExpired})]}),(0,X.jsx)(`div`,{children:(0,X.jsx)(g,{type:`button`,variant:`secondary`,className:`text-sm`,onClick:()=>w(),children:r.updateToken})})]}):null,oe?(0,X.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:oe}):null,ve?(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg bg-amber-50 px-3 py-2 dark:bg-amber-950/40`,children:[(0,X.jsx)(`p`,{className:`text-xs text-amber-950 dark:text-amber-100`,children:r.restartHint}),(0,X.jsxs)(g,{type:`button`,variant:`secondary`,className:`shrink-0 gap-1.5 border-red-300 bg-red-50 text-xs text-red-700 hover:bg-red-100 dark:border-red-800 dark:bg-red-950/50 dark:text-red-300 dark:hover:bg-red-900/60`,disabled:ce,onClick:()=>R({type:`patch`,patch:{restartConfirmOpen:!0}}),children:[ce?(0,X.jsx)(s,{className:`size-3.5 animate-spin`}):(0,X.jsx)(O,{className:`size-3.5`}),r.restartGatewayButton]})]}):null,(0,X.jsx)(te,{open:H,title:r.restartGatewayButton,description:r.restartGatewayConfirm,confirmLabel:r.restartGatewayButton,cancelLabel:r.discard,destructive:!0,onConfirm:()=>void We(),onCancel:()=>R({type:`patch`,patch:{restartConfirmOpen:!1}})}),(0,X.jsx)(je,{enabled:T,refreshToken:se}),(0,X.jsx)($e,{g:r,activeTab:v,visibleTabs:b,onChange:x}),(0,X.jsxs)(Q,{g:r,id:`network`,activeTab:v,children:[(0,X.jsxs)(`section`,{className:`space-y-3 rounded-xl bg-surface-hover/20 p-4`,children:[(0,X.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t===`zh`?`当前服务连接`:`Current service connection`}),(0,X.jsx)(`p`,{className:`break-all text-sm text-fg-muted`,children:e}),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsx)(g,{type:`button`,variant:`secondary`,onClick:()=>void fe(),children:r.retry}),(0,X.jsx)(g,{type:`button`,variant:`secondary`,onClick:()=>w(),children:r.updateToken}),(0,X.jsx)(g,{type:`button`,variant:`secondary`,onClick:()=>R({type:`patch`,patch:{restartConfirmOpen:!0}}),children:r.restartGatewayButton})]})]}),(0,X.jsxs)(A,{title:t===`zh`?`服务监听配置`:`Service listener configuration`,summary:`${F.bind} · ${F.port}`,children:[(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`gateway-bind-mode`,children:r.bindMode}),(0,X.jsxs)(a,{id:`gateway-bind-mode`,className:Z(),value:F.bind,onChange:e=>Ee(e.target.value),children:[(0,X.jsx)(o,{value:`loopback`,children:r.bindLoopback}),_?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{value:`lan`,children:r.bindLan}),(0,X.jsx)(o,{value:`auto`,children:r.bindAuto}),(0,X.jsx)(o,{value:`custom`,children:r.bindCustom}),(0,X.jsx)(o,{value:`tailnet`,children:r.bindTailnet})]}):null]})]}),F.bind===`custom`?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`gateway-custom-bind-host`,children:r.customBindHost}),(0,X.jsx)(`input`,{id:`gateway-custom-bind-host`,className:l(Z(),`font-mono text-xs`),value:F.customBindHost,onChange:e=>De(e.target.value),placeholder:r.customBindHostPlaceholder,autoComplete:`off`})]}):null,(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`gateway-listen-port`,children:r.listenPort}),(0,X.jsx)(B,{id:`gateway-listen-port`,type:`number`,min:1,max:65535,className:l(Z(),`font-mono text-xs`),value:F.port,onChange:e=>{let t=Number(e.target.value);Oe(Number.isFinite(t)?Math.max(1,Math.min(65535,Math.floor(t))):F.port)}})]})]}),(0,X.jsx)(le,{children:(0,X.jsx)(rt,{g:r,origins:F.corsOrigins,candidates:he.data??[],onChange:Ce})})]})]}),(0,X.jsxs)(Q,{g:r,id:`access`,activeTab:v,children:[F.auth.mode===`none`?(0,X.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:r.authModeNone}):null,(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`gateway-auth-mode`,children:r.authMode}),(0,X.jsxs)(a,{id:`gateway-auth-mode`,value:F.auth.mode,onChange:e=>ye({mode:e.target.value}),className:Z(),children:[(0,X.jsx)(o,{value:`token`,children:r.authModeToken}),(0,X.jsx)(o,{value:`password`,children:r.authModePassword}),_||F.auth.mode===`trusted-proxy`||F.auth.mode===`none`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(o,{value:`trusted-proxy`,children:r.authModeTrustedProxy}),(0,X.jsx)(o,{value:`none`,children:r.authModeNoneLabel})]}):null]})]}),(0,X.jsx)(le,{children:F.auth.mode===`trusted-proxy`?(0,X.jsx)(tt,{g:r,form:F,onTrustedProxyChange:Fe,onTrustedProxiesChange:Pe,onAllowRealIpFallbackChange:Le}):null}),F.auth.mode===`token`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(st,{id:`gateway-access-token`,label:r.accessToken,help:r.tokenHelp,placeholder:r.tokenPlaceholder,value:F.auth.token,labels:He,reveal:()=>ue(`token`).then(e=>e.secret),loadFailedLabel:r.saveError,onChange:e=>ye({token:e})}),(0,X.jsx)(g,{type:`button`,variant:`secondary`,className:`w-full sm:w-auto`,onClick:()=>w(),children:r.changeToken})]}):null,F.auth.mode===`password`?(0,X.jsx)(st,{id:`gateway-auth-password`,label:r.authPassword,help:r.authPasswordHelp,placeholder:r.authPasswordPlaceholder,value:F.auth.password,labels:He,reveal:()=>ue(`password`).then(e=>e.secret),loadFailedLabel:r.saveError,onChange:e=>ye({password:e})}):null,(0,X.jsx)(le,{children:F.auth.mode===`none`?null:(0,X.jsx)(ot,{g:r,rateLimit:F.auth.rateLimit,onChange:ke})})]}),(0,X.jsxs)(Q,{g:r,id:`updates`,activeTab:v,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`gateway-update-channel`,children:r.updateChannel}),(0,X.jsxs)(a,{id:`gateway-update-channel`,value:F.updateChannel,onChange:e=>be(e.target.value),className:Z(),children:[(0,X.jsx)(o,{value:`stable`,children:r.channelStable}),_||F.updateChannel===`beta`?(0,X.jsx)(o,{value:`beta`,children:r.channelBeta}):null,_||F.updateChannel===`dev`?(0,X.jsx)(o,{value:`dev`,children:r.channelDev}):null]})]}),(0,X.jsxs)(`div`,{className:`space-y-4 rounded-xl bg-surface-base/45 p-4`,children:[(0,X.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.updateAutoSection}),(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:F.updateCheckOnStart,onChange:e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,updateCheckOnStart:e.target.checked})})}}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`font-medium`,children:r.updateCheckOnStart}),(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:r.updateCheckOnStartHint})]})]}),(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:F.updateAutoEnabled,onChange:e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,updateAutoEnabled:e.target.checked})})}}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`font-medium`,children:r.updateAutoEnabled}),(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:r.updateAutoEnabledHint})]})]}),(0,X.jsx)(le,{children:(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`update-auto-stable-delay`,children:r.updateAutoStableDelayHours}),(0,X.jsx)(B,{id:`update-auto-stable-delay`,type:`number`,min:0,disabled:!F.updateAutoEnabled,className:Z(),value:F.updateAutoStableDelayHours,onChange:e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,updateAutoStableDelayHours:Math.max(0,Math.floor(Number(e.target.value)||0))})})}}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:r.updateAutoStableDelayHoursHint})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`update-auto-stable-jitter`,children:r.updateAutoStableJitterHours}),(0,X.jsx)(B,{id:`update-auto-stable-jitter`,type:`number`,min:0,disabled:!F.updateAutoEnabled,className:Z(),value:F.updateAutoStableJitterHours,onChange:e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,updateAutoStableJitterHours:Math.max(0,Math.floor(Number(e.target.value)||0))})})}}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:r.updateAutoStableJitterHoursHint})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`update-auto-beta-interval`,children:r.updateAutoBetaCheckIntervalHours}),(0,X.jsx)(B,{id:`update-auto-beta-interval`,type:`number`,min:.25,step:.25,disabled:!F.updateAutoEnabled,className:Z(),value:F.updateAutoBetaCheckIntervalHours,onChange:e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,updateAutoBetaCheckIntervalHours:Math.max(.25,Number(e.target.value)||1)})})}}),(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:r.updateAutoBetaCheckIntervalHoursHint})]})]})})]})]}),(0,X.jsx)(Q,{g:r,id:`security`,activeTab:v,children:(0,X.jsx)(et,{g:r,form:F,onSecurityStrictChange:Ie,onDangerouslyAllowHostHeaderOriginFallbackChange:Re})}),(0,X.jsx)(Q,{g:r,id:`proxy`,activeTab:v,children:(0,X.jsx)(Te,{value:F.outboundProxy,g:r,onChange:e=>{U.current=!0,N({type:`set-form`,updater:t=>({...t,outboundProxy:e})})}})}),(0,X.jsx)(Q,{g:r,id:`advanced`,activeTab:v,children:(0,X.jsx)(nt,{g:r,form:F,onDeferModeChange:Ae,onDeferIdsChange:Me,onSkipIdsChange:Ne})})]}):(0,X.jsxs)(ie,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:[(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:oe??_e??r.loadError}),(0,X.jsx)(g,{type:`button`,variant:`secondary`,onClick:()=>void fe(),children:r.retry})]}):(0,X.jsxs)(ie,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:[(0,X.jsx)(ae,{title:n.settingsSections.gateway}),(0,X.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.needToken})]})}function $e(e){let t=(0,H.c)(10),{g:n,activeTab:r,visibleTabs:i,onChange:a}=e,o;if(t[0]!==n||t[1]!==i){let e;t[3]===n?e=t[4]:(e=e=>({id:e,label:Je(n,e),icon:Ke[e]}),t[3]=n,t[4]=e),o=i.map(e),t[0]=n,t[1]=i,t[2]=o}else o=t[2];let s=o,c;return t[5]!==r||t[6]!==n.tabsAriaLabel||t[7]!==s||t[8]!==a?(c=(0,X.jsx)(R,{items:s,activeTab:r,onChange:a,ariaLabel:n.tabsAriaLabel,tabIdPrefix:`gateway-settings-tab`,panelIdPrefix:`gateway-settings-panel`}),t[5]=r,t[6]=n.tabsAriaLabel,t[7]=s,t[8]=a,t[9]=c):c=t[9],c}function Q(e){let t=(0,H.c)(14),{g:n,id:r,activeTab:i,children:a}=e,o;t[0]!==n||t[1]!==r?(o=Je(n,r),t[0]=n,t[1]=r,t[2]=o):o=t[2];let s;t[3]!==n||t[4]!==r?(s=Ye(n,r),t[3]=n,t[4]=r,t[5]=s):s=t[5];let c;t[6]===a?c=t[7]:(c=(0,X.jsx)(`div`,{className:`space-y-4`,children:a}),t[6]=a,t[7]=c);let l;return t[8]!==i||t[9]!==r||t[10]!==o||t[11]!==s||t[12]!==c?(l=(0,X.jsx)(oe,{id:r,activeTab:i,tabIdPrefix:`gateway-settings-tab`,panelIdPrefix:`gateway-settings-panel`,title:o,hint:s,showHeading:!1,children:c}),t[8]=i,t[9]=r,t[10]=o,t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function et(e){let t=(0,H.c)(37),{g:n,form:r,onSecurityStrictChange:i,onDangerouslyAllowHostHeaderOriginFallbackChange:a}=e,o;t[0]===i?o=t[1]:(o=e=>i(e.target.checked),t[0]=i,t[1]=o);let s;t[2]!==r.securityStrict||t[3]!==o?(s=(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:r.securityStrict,onChange:o}),t[2]=r.securityStrict,t[3]=o,t[4]=s):s=t[4];let c;t[5]===n.securityStrict?c=t[6]:(c=(0,X.jsx)(`span`,{className:`font-medium`,children:n.securityStrict}),t[5]=n.securityStrict,t[6]=c);let l;t[7]===n.securityStrictHint?l=t[8]:(l=(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:n.securityStrictHint}),t[7]=n.securityStrictHint,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,X.jsxs)(`span`,{children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;t[12]!==s||t[13]!==u?(d=(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[s,u]}),t[12]=s,t[13]=u,t[14]=d):d=t[14];let f;t[15]===a?f=t[16]:(f=e=>a(e.target.checked),t[15]=a,t[16]=f);let p;t[17]!==r.dangerouslyAllowHostHeaderOriginFallback||t[18]!==f?(p=(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:r.dangerouslyAllowHostHeaderOriginFallback,onChange:f}),t[17]=r.dangerouslyAllowHostHeaderOriginFallback,t[18]=f,t[19]=p):p=t[19];let m;t[20]===n.dangerouslyAllowHostHeaderOriginFallback?m=t[21]:(m=(0,X.jsx)(`span`,{className:`font-medium`,children:n.dangerouslyAllowHostHeaderOriginFallback}),t[20]=n.dangerouslyAllowHostHeaderOriginFallback,t[21]=m);let h;t[22]===n.dangerouslyAllowHostHeaderOriginFallbackHint?h=t[23]:(h=(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:n.dangerouslyAllowHostHeaderOriginFallbackHint}),t[22]=n.dangerouslyAllowHostHeaderOriginFallbackHint,t[23]=h);let g;t[24]!==h||t[25]!==m?(g=(0,X.jsxs)(`span`,{children:[m,h]}),t[24]=h,t[25]=m,t[26]=g):g=t[26];let _;t[27]!==g||t[28]!==p?(_=(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[p,g]}),t[27]=g,t[28]=p,t[29]=_):_=t[29];let v;t[30]!==r.dangerouslyAllowHostHeaderOriginFallback||t[31]!==n.dangerouslyAllowHostHeaderOriginFallbackWarning?(v=r.dangerouslyAllowHostHeaderOriginFallback?(0,X.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:n.dangerouslyAllowHostHeaderOriginFallbackWarning}):null,t[30]=r.dangerouslyAllowHostHeaderOriginFallback,t[31]=n.dangerouslyAllowHostHeaderOriginFallbackWarning,t[32]=v):v=t[32];let y;return t[33]!==_||t[34]!==v||t[35]!==d?(y=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[d,_,v]}),t[33]=_,t[34]=v,t[35]=d,t[36]=y):y=t[36],y}function tt(e){let t=(0,H.c)(80),{g:n,form:r,onTrustedProxyChange:i,onTrustedProxiesChange:a,onAllowRealIpFallbackChange:o}=e,s=r.auth.trustedProxy,c;t[0]===n.authModeTrustedProxyHint?c=t[1]:(c=(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.authModeTrustedProxyHint}),t[0]=n.authModeTrustedProxyHint,t[1]=c);let u;t[2]===n.trustedProxyUserHeader?u=t[3]:(u=(0,X.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:`gateway-trusted-proxy-user-header`,children:n.trustedProxyUserHeader}),t[2]=n.trustedProxyUserHeader,t[3]=u);let d;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(d=l(Z(),`font-mono text-xs`),t[4]=d):d=t[4];let f;t[5]===i?f=t[6]:(f=e=>i({userHeader:e.target.value}),t[5]=i,t[6]=f);let p;t[7]!==n.trustedProxyUserHeaderPlaceholder||t[8]!==f||t[9]!==s.userHeader?(p=(0,X.jsx)(`input`,{id:`gateway-trusted-proxy-user-header`,className:d,value:s.userHeader,onChange:f,placeholder:n.trustedProxyUserHeaderPlaceholder,autoComplete:`off`}),t[7]=n.trustedProxyUserHeaderPlaceholder,t[8]=f,t[9]=s.userHeader,t[10]=p):p=t[10];let m;t[11]===n.trustedProxyUserHeaderHint?m=t[12]:(m=(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:n.trustedProxyUserHeaderHint}),t[11]=n.trustedProxyUserHeaderHint,t[12]=m);let h;t[13]!==u||t[14]!==p||t[15]!==m?(h=(0,X.jsxs)(`div`,{children:[u,p,m]}),t[13]=u,t[14]=p,t[15]=m,t[16]=h):h=t[16];let g;t[17]===i?g=t[18]:(g=e=>i({requiredHeaders:e}),t[17]=i,t[18]=g);let _;t[19]!==n.channelIdListEmpty||t[20]!==n.trustedProxyRequiredHeaders||t[21]!==n.trustedProxyRequiredHeadersHint||t[22]!==n.trustedProxyUserHeaderPlaceholder||t[23]!==g||t[24]!==s.requiredHeaders?(_=(0,X.jsx)($,{title:n.trustedProxyRequiredHeaders,hint:n.trustedProxyRequiredHeadersHint,emptyText:n.channelIdListEmpty,placeholder:n.trustedProxyUserHeaderPlaceholder,values:s.requiredHeaders,maxItems:32,onChange:g}),t[19]=n.channelIdListEmpty,t[20]=n.trustedProxyRequiredHeaders,t[21]=n.trustedProxyRequiredHeadersHint,t[22]=n.trustedProxyUserHeaderPlaceholder,t[23]=g,t[24]=s.requiredHeaders,t[25]=_):_=t[25];let v;t[26]===i?v=t[27]:(v=e=>i({allowUsers:e}),t[26]=i,t[27]=v);let y;t[28]!==n.channelIdListEmpty||t[29]!==n.trustedProxyAllowUsers||t[30]!==n.trustedProxyAllowUsersHint||t[31]!==n.trustedProxyUserHeaderPlaceholder||t[32]!==v||t[33]!==s.allowUsers?(y=(0,X.jsx)($,{title:n.trustedProxyAllowUsers,hint:n.trustedProxyAllowUsersHint,emptyText:n.channelIdListEmpty,placeholder:n.trustedProxyUserHeaderPlaceholder,values:s.allowUsers,maxItems:128,onChange:v}),t[28]=n.channelIdListEmpty,t[29]=n.trustedProxyAllowUsers,t[30]=n.trustedProxyAllowUsersHint,t[31]=n.trustedProxyUserHeaderPlaceholder,t[32]=v,t[33]=s.allowUsers,t[34]=y):y=t[34];let b;t[35]===i?b=t[36]:(b=e=>i({allowLoopback:e.target.checked}),t[35]=i,t[36]=b);let x;t[37]!==b||t[38]!==s.allowLoopback?(x=(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:s.allowLoopback,onChange:b}),t[37]=b,t[38]=s.allowLoopback,t[39]=x):x=t[39];let S;t[40]===n.trustedProxyAllowLoopback?S=t[41]:(S=(0,X.jsx)(`span`,{className:`font-medium`,children:n.trustedProxyAllowLoopback}),t[40]=n.trustedProxyAllowLoopback,t[41]=S);let C;t[42]===n.trustedProxyAllowLoopbackHint?C=t[43]:(C=(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:n.trustedProxyAllowLoopbackHint}),t[42]=n.trustedProxyAllowLoopbackHint,t[43]=C);let w;t[44]!==S||t[45]!==C?(w=(0,X.jsxs)(`span`,{children:[S,C]}),t[44]=S,t[45]=C,t[46]=w):w=t[46];let T;t[47]!==x||t[48]!==w?(T=(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[x,w]}),t[47]=x,t[48]=w,t[49]=T):T=t[49];let E;t[50]!==r.trustedProxies||t[51]!==n.trustedProxies||t[52]!==n.trustedProxiesEmpty||t[53]!==n.trustedProxiesHint||t[54]!==n.trustedProxiesPlaceholder||t[55]!==a?(E=(0,X.jsx)($,{title:n.trustedProxies,hint:n.trustedProxiesHint,emptyText:n.trustedProxiesEmpty,placeholder:n.trustedProxiesPlaceholder,values:r.trustedProxies,maxItems:64,onChange:a}),t[50]=r.trustedProxies,t[51]=n.trustedProxies,t[52]=n.trustedProxiesEmpty,t[53]=n.trustedProxiesHint,t[54]=n.trustedProxiesPlaceholder,t[55]=a,t[56]=E):E=t[56];let D;t[57]===o?D=t[58]:(D=e=>o(e.target.checked),t[57]=o,t[58]=D);let O;t[59]!==r.allowRealIpFallback||t[60]!==D?(O=(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:r.allowRealIpFallback,onChange:D}),t[59]=r.allowRealIpFallback,t[60]=D,t[61]=O):O=t[61];let k;t[62]===n.allowRealIpFallback?k=t[63]:(k=(0,X.jsx)(`span`,{className:`font-medium`,children:n.allowRealIpFallback}),t[62]=n.allowRealIpFallback,t[63]=k);let A;t[64]===n.allowRealIpFallbackHint?A=t[65]:(A=(0,X.jsx)(`span`,{className:`mt-0.5 block text-xs text-fg-subtle`,children:n.allowRealIpFallbackHint}),t[64]=n.allowRealIpFallbackHint,t[65]=A);let j;t[66]!==k||t[67]!==A?(j=(0,X.jsxs)(`span`,{children:[k,A]}),t[66]=k,t[67]=A,t[68]=j):j=t[68];let M;t[69]!==O||t[70]!==j?(M=(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[O,j]}),t[69]=O,t[70]=j,t[71]=M):M=t[71];let N;return t[72]!==c||t[73]!==y||t[74]!==T||t[75]!==E||t[76]!==M||t[77]!==h||t[78]!==_?(N=(0,X.jsxs)(`div`,{className:`space-y-4 rounded-xl bg-surface-base/45 p-4`,children:[c,h,_,y,T,E,M]}),t[72]=c,t[73]=y,t[74]=T,t[75]=E,t[76]=M,t[77]=h,t[78]=_,t[79]=N):N=t[79],N}function nt(e){let t=(0,H.c)(43),{g:n,form:r,onDeferModeChange:i,onDeferIdsChange:s,onSkipIdsChange:c}=e,l;t[0]===n.channelConnectDeferMode?l=t[1]:(l=(0,X.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`gateway-channel-defer-mode`,children:n.channelConnectDeferMode}),t[0]=n.channelConnectDeferMode,t[1]=l);let u=r.channelConnectDeferMode,d;t[2]===i?d=t[3]:(d=e=>i(e.target.value),t[2]=i,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=Z(),t[4]=f):f=t[4];let p;t[5]===n.channelConnectDeferModeAuto?p=t[6]:(p=(0,X.jsx)(o,{value:`auto`,children:n.channelConnectDeferModeAuto}),t[5]=n.channelConnectDeferModeAuto,t[6]=p);let m;t[7]===n.channelConnectDeferModeOff?m=t[8]:(m=(0,X.jsx)(o,{value:`off`,children:n.channelConnectDeferModeOff}),t[7]=n.channelConnectDeferModeOff,t[8]=m);let h;t[9]===n.channelConnectDeferModeExplicit?h=t[10]:(h=(0,X.jsx)(o,{value:`explicit`,children:n.channelConnectDeferModeExplicit}),t[9]=n.channelConnectDeferModeExplicit,t[10]=h);let g;t[11]!==r.channelConnectDeferMode||t[12]!==d||t[13]!==p||t[14]!==m||t[15]!==h?(g=(0,X.jsxs)(a,{id:`gateway-channel-defer-mode`,value:u,onChange:d,className:f,children:[p,m,h]}),t[11]=r.channelConnectDeferMode,t[12]=d,t[13]=p,t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;t[17]===n.channelConnectDeferModeHint?_=t[18]:(_=(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.channelConnectDeferModeHint}),t[17]=n.channelConnectDeferModeHint,t[18]=_);let v;t[19]!==l||t[20]!==g||t[21]!==_?(v=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-surface-base/45 p-4`,children:[l,g,_]}),t[19]=l,t[20]=g,t[21]=_,t[22]=v):v=t[22];let y;t[23]!==r.channelConnectDeferIds||t[24]!==r.channelConnectDeferMode||t[25]!==n.channelConnectDeferIds||t[26]!==n.channelConnectDeferIdsHint||t[27]!==n.channelIdListEmpty||t[28]!==n.channelIdListPlaceholder||t[29]!==s?(y=r.channelConnectDeferMode===`explicit`?(0,X.jsx)($,{title:n.channelConnectDeferIds,hint:n.channelConnectDeferIdsHint,emptyText:n.channelIdListEmpty,placeholder:n.channelIdListPlaceholder,values:r.channelConnectDeferIds,maxItems:24,onChange:s}):null,t[23]=r.channelConnectDeferIds,t[24]=r.channelConnectDeferMode,t[25]=n.channelConnectDeferIds,t[26]=n.channelConnectDeferIdsHint,t[27]=n.channelIdListEmpty,t[28]=n.channelIdListPlaceholder,t[29]=s,t[30]=y):y=t[30];let b;t[31]!==r.channelConnectDeferMode||t[32]!==r.channelConnectDeferSkipIds||t[33]!==n.channelConnectDeferSkipIds||t[34]!==n.channelConnectDeferSkipIdsHint||t[35]!==n.channelIdListEmpty||t[36]!==n.channelIdListPlaceholder||t[37]!==c?(b=r.channelConnectDeferMode===`off`?null:(0,X.jsx)($,{title:n.channelConnectDeferSkipIds,hint:n.channelConnectDeferSkipIdsHint,emptyText:n.channelIdListEmpty,placeholder:n.channelIdListPlaceholder,values:r.channelConnectDeferSkipIds,maxItems:24,onChange:c}),t[31]=r.channelConnectDeferMode,t[32]=r.channelConnectDeferSkipIds,t[33]=n.channelConnectDeferSkipIds,t[34]=n.channelConnectDeferSkipIdsHint,t[35]=n.channelIdListEmpty,t[36]=n.channelIdListPlaceholder,t[37]=c,t[38]=b):b=t[38];let x;return t[39]!==v||t[40]!==y||t[41]!==b?(x=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[v,y,b]}),t[39]=v,t[40]=y,t[41]=b,t[42]=x):x=t[42],x}function $(e){let t=(0,H.c)(25),{title:n,hint:r,emptyText:i,placeholder:a,values:o,maxItems:s,onChange:c,children:u}=e,d;t[0]!==s||t[1]!==c||t[2]!==o?(d=e=>{let t=e.trim();!t||o.includes(t)||o.length>=s||c([...o,t])},t[0]=s,t[1]=c,t[2]=o,t[3]=d):d=t[3];let f=d,p;t[4]===n?p=t[5]:(p=(0,X.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n}),t[4]=n,t[5]=p);let m;t[6]===r?m=t[7]:(m=(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:r}),t[6]=r,t[7]=m);let h;t[8]!==i||t[9]!==c||t[10]!==o?(h=o.length===0?(0,X.jsx)(`p`,{className:`text-xs text-fg-muted`,children:i}):(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:o.map(e=>(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 font-mono text-xs text-fg`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:l(`text-fg-muted hover:text-fg`,L.press),"aria-label":`Remove ${e}`,onClick:()=>c(o.filter(t=>t!==e)),children:`×`})]},e))}),t[8]=i,t[9]=c,t[10]=o,t[11]=h):h=t[11];let g;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(g=l(Z(),`font-mono text-xs`),t[12]=g):g=t[12];let _=o.length>=s,v;t[13]===f?v=t[14]:(v=e=>{e.key===`Enter`&&(e.preventDefault(),f(e.target.value),e.target.value=``)},t[13]=f,t[14]=v);let y;t[15]!==a||t[16]!==_||t[17]!==v?(y=(0,X.jsx)(`input`,{className:g,placeholder:a,disabled:_,onKeyDown:v}),t[15]=a,t[16]=_,t[17]=v,t[18]=y):y=t[18];let b;return t[19]!==u||t[20]!==p||t[21]!==m||t[22]!==h||t[23]!==y?(b=(0,X.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-surface-base/45 p-4`,children:[p,m,h,y,u]}),t[19]=u,t[20]=p,t[21]=m,t[22]=h,t[23]=y,t[24]=b):b=t[24],b}function rt(e){let t=(0,H.c)(36),{g:n,origins:r,candidates:i,onChange:a}=e,o;t[0]===r?o=t[1]:(o=r.includes(`*`),t[0]=r,t[1]=o);let s=o,c,l,u,d,f,p,m,h,_;if(t[2]!==i||t[3]!==n.corsAddDetectedOrigins||t[4]!==n.corsDetectedOrigins||t[5]!==n.corsOrigins||t[6]!==n.corsOriginsEmpty||t[7]!==n.corsOriginsHint||t[8]!==n.corsOriginsPlaceholder||t[9]!==a||t[10]!==r){let e;t[20]===r?e=t[21]:(e=e=>!r.includes(e.url),t[20]=r,t[21]=e);let o=i.filter(e);c=$,l=n.corsOrigins,u=n.corsOriginsHint,d=n.corsOriginsEmpty,f=n.corsOriginsPlaceholder,p=r,m=128,h=a,_=o.length>0?(0,X.jsxs)(`div`,{className:`rounded-lg bg-surface-base/55 px-3 py-2`,children:[(0,X.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:n.corsDetectedOrigins}),(0,X.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:o.map(at)}),(0,X.jsx)(g,{type:`button`,variant:`secondary`,className:`mt-2 text-xs`,onClick:()=>a([...r,...o.map(it)]),children:n.corsAddDetectedOrigins})]}):null,t[2]=i,t[3]=n.corsAddDetectedOrigins,t[4]=n.corsDetectedOrigins,t[5]=n.corsOrigins,t[6]=n.corsOriginsEmpty,t[7]=n.corsOriginsHint,t[8]=n.corsOriginsPlaceholder,t[9]=a,t[10]=r,t[11]=c,t[12]=l,t[13]=u,t[14]=d,t[15]=f,t[16]=p,t[17]=m,t[18]=h,t[19]=_}else c=t[11],l=t[12],u=t[13],d=t[14],f=t[15],p=t[16],m=t[17],h=t[18],_=t[19];let v;t[22]!==n.corsOriginsWildcardWarning||t[23]!==s?(v=s?(0,X.jsx)(`p`,{className:`rounded-lg bg-amber-50 px-3 py-2 text-xs text-amber-950 dark:bg-amber-950/40 dark:text-amber-100`,children:n.corsOriginsWildcardWarning}):null,t[22]=n.corsOriginsWildcardWarning,t[23]=s,t[24]=v):v=t[24];let y;return t[25]!==c||t[26]!==v||t[27]!==l||t[28]!==u||t[29]!==d||t[30]!==f||t[31]!==p||t[32]!==m||t[33]!==h||t[34]!==_?(y=(0,X.jsxs)(c,{title:l,hint:u,emptyText:d,placeholder:f,values:p,maxItems:m,onChange:h,children:[_,v]}),t[25]=c,t[26]=v,t[27]=l,t[28]=u,t[29]=d,t[30]=f,t[31]=p,t[32]=m,t[33]=h,t[34]=_,t[35]=y):y=t[35],y}function it(e){return e.url}function at(e){return(0,X.jsxs)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 font-mono text-xs text-fg`,children:[e.url,` · `,e.interfaceName]},e.url)}function ot(e){let t=(0,H.c)(73),{g:n,rateLimit:r,onChange:i}=e,a;t[0]===n.rateLimitTitle?a=t[1]:(a=(0,X.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.rateLimitTitle}),t[0]=n.rateLimitTitle,t[1]=a);let o;t[2]===n.rateLimitHint?o=t[3]:(o=(0,X.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:n.rateLimitHint}),t[2]=n.rateLimitHint,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,X.jsxs)(`div`,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=e=>i({enabled:e.target.checked}),t[7]=i,t[8]=c);let l;t[9]!==r.enabled||t[10]!==c?(l=(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,onChange:c}),t[9]=r.enabled,t[10]=c,t[11]=l):l=t[11];let u;t[12]!==n.rateLimitEnabled||t[13]!==l?(u=(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[l,n.rateLimitEnabled]}),t[12]=n.rateLimitEnabled,t[13]=l,t[14]=u):u=t[14];let d=!r.enabled,f;t[15]===i?f=t[16]:(f=e=>i({exemptLoopback:e.target.checked}),t[15]=i,t[16]=f);let p;t[17]!==r.exemptLoopback||t[18]!==d||t[19]!==f?(p=(0,X.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.exemptLoopback,disabled:d,onChange:f}),t[17]=r.exemptLoopback,t[18]=d,t[19]=f,t[20]=p):p=t[20];let m;t[21]!==n.rateLimitExemptLoopback||t[22]!==p?(m=(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[p,n.rateLimitExemptLoopback]}),t[21]=n.rateLimitExemptLoopback,t[22]=p,t[23]=m):m=t[23];let h;t[24]===n.rateLimitMaxAttempts?h=t[25]:(h=(0,X.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,htmlFor:`gateway-rate-max`,children:n.rateLimitMaxAttempts}),t[24]=n.rateLimitMaxAttempts,t[25]=h);let g;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(g=Z(),t[26]=g):g=t[26];let _=!r.enabled,v;t[27]===i?v=t[28]:(v=e=>{let t=Number(e.target.value);Number.isFinite(t)&&i({maxAttempts:Math.max(1,Math.floor(t))})},t[27]=i,t[28]=v);let y;t[29]!==r.maxAttempts||t[30]!==_||t[31]!==v?(y=(0,X.jsx)(B,{id:`gateway-rate-max`,type:`number`,min:1,className:g,value:r.maxAttempts,disabled:_,onChange:v}),t[29]=r.maxAttempts,t[30]=_,t[31]=v,t[32]=y):y=t[32];let b;t[33]!==h||t[34]!==y?(b=(0,X.jsxs)(`div`,{children:[h,y]}),t[33]=h,t[34]=y,t[35]=b):b=t[35];let x;t[36]===n.rateLimitWindowMinutes?x=t[37]:(x=(0,X.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,htmlFor:`gateway-rate-window`,children:n.rateLimitWindowMinutes}),t[36]=n.rateLimitWindowMinutes,t[37]=x);let S;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(S=Z(),t[38]=S):S=t[38];let C;t[39]===r.windowMs?C=t[40]:(C=Math.round(r.windowMs/6e4),t[39]=r.windowMs,t[40]=C);let w=!r.enabled,T;t[41]===i?T=t[42]:(T=e=>{let t=Number(e.target.value);Number.isFinite(t)&&t>0&&i({windowMs:Math.floor(t)*6e4})},t[41]=i,t[42]=T);let E;t[43]!==C||t[44]!==w||t[45]!==T?(E=(0,X.jsx)(B,{id:`gateway-rate-window`,type:`number`,min:1,className:S,value:C,disabled:w,onChange:T}),t[43]=C,t[44]=w,t[45]=T,t[46]=E):E=t[46];let D;t[47]!==x||t[48]!==E?(D=(0,X.jsxs)(`div`,{children:[x,E]}),t[47]=x,t[48]=E,t[49]=D):D=t[49];let O;t[50]===n.rateLimitBlockMinutes?O=t[51]:(O=(0,X.jsx)(`label`,{className:`mb-1 block text-xs font-medium text-fg-muted`,htmlFor:`gateway-rate-block`,children:n.rateLimitBlockMinutes}),t[50]=n.rateLimitBlockMinutes,t[51]=O);let k;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(k=Z(),t[52]=k):k=t[52];let A;t[53]===r.blockDurationMs?A=t[54]:(A=Math.round(r.blockDurationMs/6e4),t[53]=r.blockDurationMs,t[54]=A);let j=!r.enabled,M;t[55]===i?M=t[56]:(M=e=>{let t=Number(e.target.value);Number.isFinite(t)&&t>0&&i({blockDurationMs:Math.floor(t)*6e4})},t[55]=i,t[56]=M);let N;t[57]!==A||t[58]!==j||t[59]!==M?(N=(0,X.jsx)(B,{id:`gateway-rate-block`,type:`number`,min:1,className:k,value:A,disabled:j,onChange:M}),t[57]=A,t[58]=j,t[59]=M,t[60]=N):N=t[60];let P;t[61]!==O||t[62]!==N?(P=(0,X.jsxs)(`div`,{children:[O,N]}),t[61]=O,t[62]=N,t[63]=P):P=t[63];let F;t[64]!==b||t[65]!==D||t[66]!==P?(F=(0,X.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[b,D,P]}),t[64]=b,t[65]=D,t[66]=P,t[67]=F):F=t[67];let I;return t[68]!==m||t[69]!==s||t[70]!==F||t[71]!==u?(I=(0,X.jsxs)(`div`,{className:`space-y-3 rounded-xl bg-surface-base/45 p-4`,children:[s,u,m,F]}),t[68]=m,t[69]=s,t[70]=F,t[71]=u,t[72]=I):I=t[72],I}function st(e){let t=(0,H.c)(17),{id:n,label:r,help:i,placeholder:a,value:o,labels:s,reveal:c,loadFailedLabel:l,onChange:u}=e,d;t[0]!==n||t[1]!==r?(d=(0,X.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=d):d=t[2];let f;t[3]!==n||t[4]!==s||t[5]!==l||t[6]!==u||t[7]!==a||t[8]!==c||t[9]!==o?(f=(0,X.jsx)(S,{id:n,value:o,onChange:u,placeholder:a,labels:s,reveal:c,loadFailedLabel:l,inputClassName:`text-xs`}),t[3]=n,t[4]=s,t[5]=l,t[6]=u,t[7]=a,t[8]=c,t[9]=o,t[10]=f):f=t[10];let p;t[11]===i?p=t[12]:(p=(0,X.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:i}),t[11]=i,t[12]=p);let m;return t[13]!==d||t[14]!==f||t[15]!==p?(m=(0,X.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[d,f,p]}),t[13]=d,t[14]=f,t[15]=p,t[16]=m):m=t[16],m}export{Qe as GatewaySettingsPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./locale-store-
|
|
1
|
+
import{a as e}from"./locale-store-JogcXC4J.js";var t=6e4,n=500,r=5e3;function i(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.code===`STARTUP_UNAVAILABLE`&&t.retryable===!0&&typeof t.retryAfterMs==`number`}function a(e){return new Promise(t=>setTimeout(t,e))}function o(e){let t=typeof e.retryAfterMs==`number`?e.retryAfterMs:n;return Math.min(Math.max(t,100),r)}async function s(n,r,s){let c=Date.now(),l=s?.timeoutMs??t;for(;;){let t=await e(n,r);if(t.status!==503)return t;let s=await t.clone().json().catch(()=>null);if(!i(s)||Date.now()-c>=l)return t;await a(o(s))}}export{s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_c as e,dc as t,fc as n,gc as r,hc as i,mc as a,pc as o,uc as s,vc as c}from"./index-D1oivYvN.js";for(let[l,u]of Object.entries({bash:e,css:r,javascript:i,json:a,markdown:o,plaintext:n,typescript:t,xml:s}))c.registerLanguage(l,u);c.registerAliases([`html`],{languageName:`xml`}),c.registerAliases([`js`,`jsx`],{languageName:`javascript`}),c.registerAliases([`ts`,`tsx`],{languageName:`typescript`}),c.registerAliases([`sh`,`shell`,`zsh`],{languageName:`bash`}),c.registerAliases([`md`],{languageName:`markdown`});function l(e,t){return c.highlight(e,{language:c.getLanguage(t)?t:`plaintext`}).value}export{l as highlightCode};
|
|
@@ -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{Fs as r,
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{Fs as r,Is as i,Ps as a}from"./index-D1oivYvN.js";var o=e(t(),1),s=n(),c=({code:e,isIncomplete:t=!1,language:n,maxHeight:c,raw:l,className:u,startLine:d,lineNumbers:f,...p})=>{let{shikiTheme:m}=(0,o.useContext)(r),h=a(),[g,_]=(0,o.useState)(l);return(0,o.useEffect)(()=>{if(!h){_(l);return}let r=!0,i=h.highlight({code:e,isIncomplete:t,language:n,themes:m},e=>{r&&_(e)});return i&&_(i),()=>{r=!1}},[e,t,n,m,h,l]),(0,s.jsx)(i,{className:u,language:n,lineNumbers:f,maxHeight:c,result:g,startLine:d,...p})};export{c as HighlightedCodeBlockBody};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D1oivYvN.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-zJ_50EbN.js","assets/es2015-DBLcMg5B.js","assets/vendor-react-BOUWij0V.js","assets/dist-CxGUk8J-.js","assets/middleware-Pd0e8Igk.js","assets/locale-store-JogcXC4J.js","assets/messages-RzwPiQNL.js","assets/dist-CI_fqRk-.js","assets/floating-ui.dom-B7uQOZZW.js","assets/chunk-KS7C4IRE-BvcCCgTW.js","assets/vendor-swr-BIWyz7Rc.js","assets/createLucideIcon-DPHK1VkS.js","assets/check-DUBLcKHA.js","assets/popover-select-DGKUpVsz.js","assets/dist-C3DSFZCi.js","assets/skeleton-BI5TyibZ.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/settings-shell-dialog-layer-BU3UuiJr.js","assets/circle-check-C23XjkUj.js","assets/copy-Dv6d4Dvw.js","assets/download-Dk-ZjtO6.js","assets/external-link-DjqjBmc3.js","assets/file-image-CDUPkZvG.js","assets/globe-DSSGFWFn.js","assets/loader-circle-CifKLtgG.js","assets/session-manager-B2HDomj4.js","assets/schemas-CObaziC7.js","assets/gateway-realtime-DMAzNlm-.js","assets/gateway-realtime-store-CoIgC1Al.js","assets/local-session-drafts-DvmwiLUx.js","assets/session-api-DTxZyMta.js","assets/gateway-startup-retry-B91CBTzO.js","assets/personal-proactivity-BJcZ3Yhi.js","assets/constants-DeXt1mV-.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-BGqSwITi.js","assets/attachment-utils-core-BIOUBrpT.js","assets/agents-admin-api-CeBkHnl8.js","assets/gateway-config-swr-DF_HV6NP.js","assets/capabilities-Bpeh6E22.js","assets/local-apps-yys1VChX.js","assets/tasks-TVRjEggr.js","assets/specialists-4bkS5rZ4.js","assets/product-delivery-BqNm-8S5.js","assets/files-Bw4SBGdM.js","assets/button-aIC072nz.js","assets/sliding-indicator-hwz0sx3h.js","assets/copy-to-clipboard-HOJ79TWv.js","assets/electron-env-Dit0bHgy.js","assets/index-D_7q1UkI.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-zJ_50EbN.js";import{l as a,m as o,t as s,u as c}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as l}from"./circle-check-C23XjkUj.js";import{t as u}from"./external-link-DjqjBmc3.js";import{t as d}from"./messages-RzwPiQNL.js";import{t as f}from"./cn-0WouolD0.js";import{n as p}from"./locale-store-JogcXC4J.js";import{s as m}from"./tasks-TVRjEggr.js";import{t as h}from"./button-aIC072nz.js";import{t as g}from"./skeleton-BI5TyibZ.js";import{a as _,i as v,o as y,s as b}from"./dist-C3DSFZCi.js";import{$s as x,Ac as S,Bc as C,Bs as w,Cd as T,Cn as E,Dc as D,El as O,Fc as k,Fl as A,Ha as j,Hl as M,Hs as N,Ic as P,Id as F,Io as I,Jr as L,Js as R,Ks as z,Lc as B,Nd as V,Pd as H,Ql as U,Qs as W,Rc as G,Rd as K,Sn as ee,Tn as te,Uu as q,Vc as ne,Xs as re,Yr as ie,Zs as ae,_a as oe,di as se,ec as ce,hu as J,io as le,nc as ue,oi as de,qc as fe,qs as pe,r as me,sc as he,vl as Y,wn as ge,zc as _e,zs as ve}from"./index-D1oivYvN.js";import{n as ye}from"./date-formatters-DukWSVwc.js";import{n as be}from"./tab-completion-input-CxtEp0aP.js";import{i as xe,n as Se,r as X,t as Ce}from"./task-result-evidence-C4o_Yue_.js";var Z=n(),Q=e(t(),1);function we(e,t,n=!1){let[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!0),[s,c]=(0,Q.useState)(null),l=(0,Q.useRef)(0),u=(0,Q.useCallback)(async()=>{let t=++l.current;c(null);try{let r=await(n?z(e,!0):z(e));t===l.current&&i(r)}catch(e){t===l.current&&c(e instanceof Error?e.message:String(e))}finally{t===l.current&&o(!1)}},[e,n]);return(0,Q.useEffect)(()=>(u(),()=>{l.current++}),[u,t]),(0,Q.useEffect)(()=>{let e,t=1/0,n=n=>{let r=Date.now()+n;r>=t||(window.clearTimeout(e),t=r,e=window.setTimeout(()=>{e=void 0,t=1/0,u()},n))},r=()=>n(100),i=()=>n(750),a=()=>{document.visibilityState===`visible`&&r()},o=[`task-changed-v2`,`task-updated`,`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`home-advisor-updated`,`gateway-realtime-connected`,`realtime-gap`,`focus`],s=[`session-updated`,`session-transcript-updated`];return o.forEach(e=>window.addEventListener(e,r)),s.forEach(e=>window.addEventListener(e,i)),document.addEventListener(`visibilitychange`,a),()=>{o.forEach(e=>window.removeEventListener(e,r)),s.forEach(e=>window.removeEventListener(e,i)),document.removeEventListener(`visibilitychange`,a),window.clearTimeout(e)}},[u]),{home:r,loading:a,loadError:s,setLoadError:c,load:u}}var $=r(),Te=12e3;function Ee(e){let t=(0,Z.c)(107),{variant:n,inputId:r,inputRef:i,intent:a,labels:o,attachments:s,isDragging:c,attachmentBusy:l,attachmentsFull:u,voice:d,chat:p,cancelAction:m,onIntentChange:g,onPickFiles:_,onRemoveAttachment:v,onPaste:y,onDragOver:b,onDragLeave:x,onDrop:S,onSubmit:C}=e,w=n===`inline`,T;t[0]!==s||t[1]!==a?(T=!!a.trim()||s.length>0,t[0]=s,t[1]=a,t[2]=T):T=t[2];let E=T,D=d.voiceActive&&d.phase!==`error`,O;t[3]!==C||t[4]!==d.voiceActive?(O=e=>{if(d.voiceActive){e.preventDefault();return}C(e)},t[3]=C,t[4]=d.voiceActive,t[5]=O):O=t[5];let k=w?`mx-auto mt-6 w-full overflow-hidden rounded-xl border border-edge bg-surface-base p-2 text-left shadow-surface transition-colors focus-within:border-accent focus-within:ring-2 focus-within:ring-accent/15 sm:mt-8`:`flex min-h-0 flex-1 flex-col`,A;t[6]===k?A=t[7]:(A=f(`relative`,k),t[6]=k,t[7]=A);let j;t[8]!==w||t[9]!==c||t[10]!==o.dropFiles?(j=c?(0,$.jsx)(`div`,{className:f(`pointer-events-none absolute inset-0 z-10 flex items-center justify-center bg-accent-soft/90 text-sm font-medium text-accent-fg backdrop-blur-[1px]`,w&&`rounded-2xl`),children:o.dropFiles}):null,t[8]=w,t[9]=c,t[10]=o.dropFiles,t[11]=j):j=t[11];let M=!w&&`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,N;t[12]===M?N=t[13]:(N=f(M),t[12]=M,t[13]=N);let P=w?`sr-only`:`mb-2 shrink-0 text-sm font-medium text-fg`,F;t[14]!==r||t[15]!==o.intentLabel||t[16]!==P?(F=(0,$.jsx)(`label`,{htmlFor:r,className:P,children:o.intentLabel}),t[14]=r,t[15]=o.intentLabel,t[16]=P,t[17]=F):F=t[17];let I;t[18]!==l||t[19]!==p||t[20]!==d.audioLevel||t[21]!==d.cancelVoiceInput||t[22]!==d.confirmVoiceInput||t[23]!==d.elapsedLabel||t[24]!==d.error||t[25]!==d.finalTranscript||t[26]!==d.partialTranscript||t[27]!==d.phase||t[28]!==d.recordedDictation||t[29]!==d.retryVoiceInput||t[30]!==d.settingsRequired||t[31]!==d.voiceActive?(I=d.voiceActive?(0,$.jsx)(ge,{phase:d.phase,elapsedLabel:d.elapsedLabel,recordedDictation:d.recordedDictation,audioLevel:d.audioLevel,partialTranscript:d.partialTranscript,finalTranscript:d.finalTranscript,error:d.error,settingsRequired:d.settingsRequired,disabled:l,chat:p,onCancel:d.cancelVoiceInput,onConfirm:d.confirmVoiceInput,onRetry:d.retryVoiceInput}):null,t[18]=l,t[19]=p,t[20]=d.audioLevel,t[21]=d.cancelVoiceInput,t[22]=d.confirmVoiceInput,t[23]=d.elapsedLabel,t[24]=d.error,t[25]=d.finalTranscript,t[26]=d.partialTranscript,t[27]=d.phase,t[28]=d.recordedDictation,t[29]=d.retryVoiceInput,t[30]=d.settingsRequired,t[31]=d.voiceActive,t[32]=I):I=t[32];let L=D&&`hidden`,R=w?`min-h-24 bg-transparent px-3 py-2`:`min-h-32 flex-1 rounded-xl border border-edge bg-surface-base p-3 focus:border-accent focus:ring-2 focus:ring-accent/20`,z;t[33]!==L||t[34]!==R?(z=f(`w-full resize-none text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle`,L,R),t[33]=L,t[34]=R,t[35]=z):z=t[35];let B;t[36]===g?B=t[37]:(B=e=>g(e.target.value),t[36]=g,t[37]=B);let V=!w,H;t[38]!==r||t[39]!==i||t[40]!==a||t[41]!==o.intentPlaceholder||t[42]!==o.intentSuggestion||t[43]!==g||t[44]!==y||t[45]!==z||t[46]!==B||t[47]!==V?(H=(0,$.jsx)(be,{ref:i,id:r,className:z,value:a,onChange:B,onPaste:y,suggestion:o.intentSuggestion,onAcceptSuggestion:g,onKeyDown:De,placeholder:o.intentPlaceholder,maxLength:Te,autoFocus:V}),t[38]=r,t[39]=i,t[40]=a,t[41]=o.intentPlaceholder,t[42]=o.intentSuggestion,t[43]=g,t[44]=y,t[45]=z,t[46]=B,t[47]=V,t[48]=H):H=t[48];let W=w?`border-b-0 bg-transparent px-3 pb-2 pt-0`:`mt-3 border-b-0 bg-transparent px-0 pb-0`,G;t[49]!==s||t[50]!==v||t[51]!==W?(G=(0,$.jsx)(de,{attachments:s,topPadded:!1,onRemove:v,className:W}),t[49]=s,t[50]=v,t[51]=W,t[52]=G):G=t[52];let K;t[53]!==w||t[54]!==a.length||t[55]!==o.shortcut?(K=w?null:(0,$.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:o.shortcut}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[a.length.toLocaleString(),` / `,Te.toLocaleString()]})]}),t[53]=w,t[54]=a.length,t[55]=o.shortcut,t[56]=K):K=t[56];let ee;t[57]!==I||t[58]!==H||t[59]!==G||t[60]!==K||t[61]!==N||t[62]!==F?(ee=(0,$.jsxs)(`div`,{className:N,children:[F,I,H,G,K]}),t[57]=I,t[58]=H,t[59]=G,t[60]=K,t[61]=N,t[62]=F,t[63]=ee):ee=t[63];let te=w?`border-edge-subtle px-1 pt-2`:`border-edge px-5 py-4`,q;t[64]===te?q=t[65]:(q=f(`flex shrink-0 items-center gap-2 border-t`,te),t[64]=te,t[65]=q);let ne=!w&&`mr-auto`,re;t[66]===ne?re=t[67]:(re=f(`flex items-center gap-1`,ne),t[66]=ne,t[67]=re);let ae=l||u,oe;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,$.jsx)(U,{className:`size-4`,"aria-hidden":!0}),t[68]=oe):oe=t[68];let se;t[69]!==o.attachTitle||t[70]!==_||t[71]!==ae?(se=(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`size-9 rounded-lg p-0`,disabled:ae,title:o.attachTitle,"aria-label":o.attachTitle,onClick:_,children:oe}),t[69]=o.attachTitle,t[70]=_,t[71]=ae,t[72]=se):se=t[72];let ce;t[73]!==l||t[74]!==p||t[75]!==d.startVoiceInput||t[76]!==d.voiceActive?(ce=d.voiceActive?null:(0,$.jsx)(ie,{disabled:l,chat:p,onStart:d.startVoiceInput}),t[73]=l,t[74]=p,t[75]=d.startVoiceInput,t[76]=d.voiceActive,t[77]=ce):ce=t[77];let J;t[78]!==re||t[79]!==se||t[80]!==ce?(J=(0,$.jsxs)(`div`,{className:re,children:[se,ce]}),t[78]=re,t[79]=se,t[80]=ce,t[81]=J):J=t[81];let le;t[82]!==m||t[83]!==w||t[84]!==o.shortcut?(le=w?(0,$.jsx)(`span`,{className:`hidden text-[11px] text-fg-subtle sm:inline`,children:o.shortcut}):m,t[82]=m,t[83]=w,t[84]=o.shortcut,t[85]=le):le=t[85];let ue=w?`ml-auto h-9 rounded-lg px-3.5 text-xs`:`min-w-32`,fe=!E||l||d.voiceActive,pe=w?`size-3.5`:`size-4`,me;t[86]===pe?me=t[87]:(me=(0,$.jsx)(Y,{className:pe,"aria-hidden":!0}),t[86]=pe,t[87]=me);let he;t[88]!==o.submit||t[89]!==ue||t[90]!==fe||t[91]!==me?(he=(0,$.jsxs)(h,{type:`submit`,variant:`primary`,className:ue,disabled:fe,children:[me,o.submit]}),t[88]=o.submit,t[89]=ue,t[90]=fe,t[91]=me,t[92]=he):he=t[92];let _e;t[93]!==q||t[94]!==J||t[95]!==le||t[96]!==he?(_e=(0,$.jsxs)(`div`,{className:q,children:[J,le,he]}),t[93]=q,t[94]=J,t[95]=le,t[96]=he,t[97]=_e):_e=t[97];let ve;return t[98]!==x||t[99]!==b||t[100]!==S||t[101]!==O||t[102]!==ee||t[103]!==_e||t[104]!==A||t[105]!==j?(ve=(0,$.jsxs)(`form`,{onSubmit:O,onDragOver:b,onDragLeave:x,onDrop:S,className:A,children:[j,ee,_e]}),t[98]=x,t[99]=b,t[100]=S,t[101]=O,t[102]=ee,t[103]=_e,t[104]=A,t[105]=j,t[106]=ve):ve=t[106],ve}function De(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())}function Oe(e){let t=(0,Z.c)(12),{href:n,children:r,onOpen:i}=e,o=a();if(n&&/^https?:\/\//i.test(n)){let e;return t[0]!==r||t[1]!==n?(e=(0,$.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`rounded-sm text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r}),t[0]=r,t[1]=n,t[2]=e):e=t[2],e}if(n?.startsWith(`/`)&&!n.startsWith(`//`)){let e=`${o.pathname}${o.search}`,a;t[3]!==n||t[4]!==e?(a=D(e,n),t[3]=n,t[4]=e,t[5]=a):a=t[5];let c;return t[6]!==r||t[7]!==i||t[8]!==a?(c=(0,$.jsx)(s,{to:a,className:`rounded-sm text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:i,children:r}),t[6]=r,t[7]=i,t[8]=a,t[9]=c):c=t[9],c}let c;return t[10]===r?c=t[11]:(c=(0,$.jsx)(`span`,{children:r}),t[10]=r,t[11]=c),c}function ke(e){let t=(0,Z.c)(4),{label:n,onClick:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(q,{className:`size-3.5`,"aria-hidden":!0}),t[0]=i):i=t[0];let a;return t[1]!==n||t[2]!==r?(a=(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg px-2 text-xs font-medium text-fg-muted transition-colors duration-150 hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:r,children:[i,n]}),t[1]=n,t[2]=r,t[3]=a):a=t[3],a}function Ae(e){let t=(0,Z.c)(65),{opportunity:n,copy:r,onOpenHistory:i}=e,a,o,s,c,l,u;if(t[0]!==r.aiLabel||t[1]!==r.automationAction||t[2]!==r.automationHint||t[3]!==r.history||t[4]!==r.minutes||t[5]!==r.needsSetup||t[6]!==r.why||t[7]!==i||t[8]!==n.capabilities||t[9]!==n.continuation||t[10]!==n.estimatedMinutes||t[11]!==n.outcome||t[12]!==n.rationale||t[13]!==n.title){let e=n.capabilities.filter(Me),d;t[20]===r.aiLabel?d=t[21]:(d=(0,$.jsx)(`span`,{children:r.aiLabel}),t[20]=r.aiLabel,t[21]=d);let f;t[22]!==r.minutes||t[23]!==n.estimatedMinutes?(f=n.estimatedMinutes?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}),n.estimatedMinutes,` `,r.minutes]}):null,t[22]=r.minutes,t[23]=n.estimatedMinutes,t[24]=f):f=t[24];let p;t[25]!==d||t[26]!==f?(p=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[d,f]}),t[25]=d,t[26]=f,t[27]=p):p=t[27];let m;t[28]!==r.history||t[29]!==i?(m=(0,$.jsx)(ke,{label:r.history,onClick:i}),t[28]=r.history,t[29]=i,t[30]=m):m=t[30],t[31]!==m||t[32]!==p?(a=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[p,m]}),t[31]=m,t[32]=p,t[33]=a):a=t[33],t[34]===n.title?o=t[35]:(o=(0,$.jsx)(`h3`,{className:`mt-3 text-xl font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[34]=n.title,t[35]=o),t[36]===n.outcome?s=t[37]:(s=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.outcome}),t[36]=n.outcome,t[37]=s);let h;t[38]===r.why?h=t[39]:(h=(0,$.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.why,`:`]}),t[38]=r.why,t[39]=h),t[40]!==n.rationale||t[41]!==h?(c=(0,$.jsxs)(`p`,{className:`mt-4 text-sm leading-6 text-fg-muted`,children:[h,n.rationale]}),t[40]=n.rationale,t[41]=h,t[42]=c):c=t[42],t[43]!==r.automationAction||t[44]!==r.automationHint||t[45]!==n.continuation?(l=n.continuation?.kind===`automation`?(0,$.jsxs)(`div`,{className:`mt-4 flex flex-col gap-3 rounded-xl border border-edge bg-surface-subtle p-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:r.automationHint}),(0,$.jsx)(`a`,{href:`#${n.continuation.href}`,className:`inline-flex min-h-11 shrink-0 items-center rounded-lg px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.automationAction})]}):null,t[43]=r.automationAction,t[44]=r.automationHint,t[45]=n.continuation,t[46]=l):l=t[46],u=e.length>0?(0,$.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,"aria-label":r.needsSetup,children:e.map(e=>(0,$.jsxs)(`a`,{href:`#${e.recoveryPath??`/settings`}`,className:`rounded-full border border-accent/25 bg-accent-soft px-2.5 py-1 text-xs text-accent hover:border-accent/50`,children:[r.needsSetup,` · `,e.capability]},`${e.kind}:${e.capability}`))}):null,t[0]=r.aiLabel,t[1]=r.automationAction,t[2]=r.automationHint,t[3]=r.history,t[4]=r.minutes,t[5]=r.needsSetup,t[6]=r.why,t[7]=i,t[8]=n.capabilities,t[9]=n.continuation,t[10]=n.estimatedMinutes,t[11]=n.outcome,t[12]=n.rationale,t[13]=n.title,t[14]=a,t[15]=o,t[16]=s,t[17]=c,t[18]=l,t[19]=u}else a=t[14],o=t[15],s=t[16],c=t[17],l=t[18],u=t[19];let d;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(F,{className:`size-3.5 transition-transform group-open:rotate-180`,"aria-hidden":!0}),t[47]=d):d=t[47];let f;t[48]===r.evidence?f=t[49]:(f=(0,$.jsxs)(`summary`,{className:`flex min-h-9 cursor-pointer list-none items-center gap-1.5 text-xs font-medium text-fg-muted hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.evidence,d]}),t[48]=r.evidence,t[49]=f);let p;t[50]===n.evidence?p=t[51]:(p=n.evidence.map(je),t[50]=n.evidence,t[51]=p);let m;t[52]===p?m=t[53]:(m=(0,$.jsx)(`ul`,{className:`mt-2 space-y-2 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:p}),t[52]=p,t[53]=m);let h;t[54]!==m||t[55]!==f?(h=(0,$.jsxs)(`details`,{open:!0,className:`mt-4 group`,children:[f,m]}),t[54]=m,t[55]=f,t[56]=h):h=t[56];let g;return t[57]!==a||t[58]!==h||t[59]!==o||t[60]!==s||t[61]!==c||t[62]!==l||t[63]!==u?(g=(0,$.jsxs)($.Fragment,{children:[a,o,s,c,l,u,h]}),t[57]=a,t[58]=h,t[59]=o,t[60]=s,t[61]=c,t[62]=l,t[63]=u,t[64]=g):g=t[64],g}function je(e){return(0,$.jsx)(`li`,{children:(0,$.jsx)(Oe,{href:e.href,children:e.observation})},e.id)}function Me(e){return e.readiness!==`ready`}function Ne(e){let t=(0,Z.c)(134),{advisor:n,copy:r,busy:i,onRefresh:a,onAction:o,onFeedback:s,onClarification:c,onOpenHistory:u,preflight:d,receipt:f}=e,[p,m]=(0,Q.useState)(),g;t[0]!==n.alternatives||t[1]!==n.primary||t[2]!==n.state?(g=n.state===`ready`?[n.primary,...n.alternatives]:[],t[0]=n.alternatives,t[1]=n.primary,t[2]=n.state,t[3]=g):g=t[3];let _=g,v;t[4]!==_||t[5]!==p?(v=_.find(e=>e.id===p)??_[0],t[4]=_,t[5]=p,t[6]=v):v=t[6];let y=v,b;t[7]===_[0]?.id?b=t[8]:(b=()=>m(_[0]?.id),t[7]=_[0]?.id,t[8]=b);let x=_[0]?.id,S;if(t[9]!==n.state||t[10]!==x?(S=[n.state,x],t[9]=n.state,t[10]=x,t[11]=S):S=t[11],(0,Q.useEffect)(b,S),n.state===`disabled`)return null;if(f){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(l,{className:`size-5 shrink-0 text-success`,"aria-hidden":!0}),t[12]=e):e=t[12];let n;t[13]===f.title?n=t[14]:(n=(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:f.title}),t[13]=f.title,t[14]=n);let i;t[15]===f.detail?i=t[16]:(i=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:f.detail}),t[15]=f.detail,t[16]=i);let a;t[17]!==n||t[18]!==i?(a=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[n,i]}),t[17]=n,t[18]=i,t[19]=a):a=t[19];let o;t[20]!==r.history||t[21]!==u?(o=(0,$.jsx)(ke,{label:r.history,onClick:u}),t[20]=r.history,t[21]=u,t[22]=o):o=t[22];let s=`#${f.href}`,c;t[23]!==r.viewProgress||t[24]!==s?(c=(0,$.jsx)(h,{asChild:!0,variant:`secondary`,className:`min-h-10 text-xs`,children:(0,$.jsx)(`a`,{href:s,children:r.viewProgress})}),t[23]=r.viewProgress,t[24]=s,t[25]=c):c=t[25];let d;t[26]!==o||t[27]!==c?(d=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[o,c]}),t[26]=o,t[27]=c,t[28]=d):d=t[28];let p;return t[29]!==d||t[30]!==a?(p=(0,$.jsx)(`section`,{className:`mt-7 rounded-2xl border border-success/25 bg-success-soft px-5 py-4`,role:`status`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center`,children:[e,a,d]})}),t[29]=d,t[30]=a,t[31]=p):p=t[31],p}if(n.state===`quiet`||n.state===`refreshing`)return null;if(n.state===`clarification`){let e;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Y,{className:`size-4`,"aria-hidden":!0}),t[32]=e):e=t[32];let a;t[33]===r.aiLabel?a=t[34]:(a=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-accent`,children:[e,r.aiLabel]}),t[33]=r.aiLabel,t[34]=a);let o;t[35]!==r.history||t[36]!==u?(o=(0,$.jsx)(ke,{label:r.history,onClick:u}),t[35]=r.history,t[36]=u,t[37]=o):o=t[37];let s;t[38]!==a||t[39]!==o?(s=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[a,o]}),t[38]=a,t[39]=o,t[40]=s):s=t[40];let l;t[41]===n.question.question?l=t[42]:(l=(0,$.jsx)(`h3`,{id:`home-advisor-question`,className:`mt-3 text-lg font-semibold text-fg`,children:n.question.question}),t[41]=n.question.question,t[42]=l);let d;if(t[43]!==n.question.options||t[44]!==n.question.question||t[45]!==i||t[46]!==c){let e;t[48]!==n.question.question||t[49]!==i||t[50]!==c?(e=e=>(0,$.jsx)(h,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>c(n.question.question,e.label),children:e.label},e.id),t[48]=n.question.question,t[49]=i,t[50]=c,t[51]=e):e=t[51],d=n.question.options.map(e),t[43]=n.question.options,t[44]=n.question.question,t[45]=i,t[46]=c,t[47]=d}else d=t[47];let f;t[52]===d?f=t[53]:(f=(0,$.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:d}),t[52]=d,t[53]=f);let p;return t[54]!==l||t[55]!==f||t[56]!==s?(p=(0,$.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base px-5 py-5`,"aria-labelledby":`home-advisor-question`,children:[s,l,f]}),t[54]=l,t[55]=f,t[56]=s,t[57]=p):p=t[57],p}if(!y)return null;let C=d?.opportunityId===y.id?d.value:void 0,w;t[58]!==n.stale||t[59]!==r.refreshing?(w=n.stale?(0,$.jsxs)(`p`,{className:`mb-3 inline-flex items-center gap-2 text-xs text-accent`,children:[(0,$.jsx)(A,{className:`size-3.5 animate-spin`,"aria-hidden":!0}),r.refreshing]}):null,t[58]=n.stale,t[59]=r.refreshing,t[60]=w):w=t[60];let T;t[61]!==r||t[62]!==u||t[63]!==y?(T=(0,$.jsx)(Ae,{opportunity:y,copy:r,onOpenHistory:u}),t[61]=r,t[62]=u,t[63]=y,t[64]=T):T=t[64];let E;t[65]!==i||t[66]!==r.configure||t[67]!==r.degradedStart||t[68]!==r.setupHint||t[69]!==r.setupTitle||t[70]!==o||t[71]!==y||t[72]!==C?(E=C?.state===`needs_setup`?(0,$.jsx)(`div`,{className:`mt-5 rounded-xl border border-accent/25 bg-accent-soft/40 p-4`,role:`alert`,"aria-live":`polite`,children:(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[(0,$.jsx)(O,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:r.setupTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:r.setupHint}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:C.blockers.map(Pe)}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[C.recoveryActions.map(e=>(0,$.jsxs)(`a`,{href:`#${e.href}`,className:`inline-flex min-h-11 items-center rounded-lg border border-accent/30 px-3 text-xs font-medium text-accent hover:bg-accent-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[r.configure,` · `,e.capability]},e.capability)),C.degradedAction?(0,$.jsx)(h,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(y,`degraded_start`),children:r.degradedStart}):null]})]})]})}):null,t[65]=i,t[66]=r.configure,t[67]=r.degradedStart,t[68]=r.setupHint,t[69]=r.setupTitle,t[70]=o,t[71]=y,t[72]=C,t[73]=E):E=t[73];let D;t[74]!==i||t[75]!==r.start||t[76]!==o||t[77]!==y?(D=y.actions.canStart?(0,$.jsxs)(h,{type:`button`,variant:`primary`,className:`min-h-11`,disabled:i,onClick:()=>o(y,`start`),children:[(0,$.jsx)(Y,{className:`size-4`,"aria-hidden":!0}),r.start]}):null,t[74]=i,t[75]=r.start,t[76]=o,t[77]=y,t[78]=D):D=t[78];let k;t[79]!==i||t[80]!==r.discuss||t[81]!==o||t[82]!==y?(k=y.actions.canDiscuss?(0,$.jsxs)(h,{type:`button`,variant:`secondary`,className:`min-h-11`,disabled:i,onClick:()=>o(y,`discuss`),children:[(0,$.jsx)(J,{className:`size-4`,"aria-hidden":!0}),r.discuss]}):null,t[79]=i,t[80]=r.discuss,t[81]=o,t[82]=y,t[83]=k):k=t[83];let j;t[84]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(A,{className:`size-4`,"aria-hidden":!0}),t[84]=j):j=t[84];let M;t[85]!==i||t[86]!==r.refresh||t[87]!==a?(M=(0,$.jsxs)(h,{type:`button`,variant:`ghost`,className:`min-h-11`,disabled:i,onClick:a,title:r.refresh,children:[j,r.refresh]}),t[85]=i,t[86]=r.refresh,t[87]=a,t[88]=M):M=t[88];let N;t[89]===r.feedback?N=t[90]:(N=(0,$.jsx)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center rounded-lg px-3 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.feedback}),t[89]=r.feedback,t[90]=N);let P;t[91]===r.alreadyDone?P=t[92]:(P=[`already_done`,r.alreadyDone],t[91]=r.alreadyDone,t[92]=P);let F;t[93]===r.irrelevant?F=t[94]:(F=[`irrelevant`,r.irrelevant],t[93]=r.irrelevant,t[94]=F);let I;t[95]===r.later?I=t[96]:(I=[`too_early`,r.later],t[95]=r.later,t[96]=I);let L;t[97]===r.sourceIncorrect?L=t[98]:(L=[`source_incorrect`,r.sourceIncorrect],t[97]=r.sourceIncorrect,t[98]=L);let R;t[99]===r.lessLikeThis?R=t[100]:(R=[`less_like_this`,r.lessLikeThis],t[99]=r.lessLikeThis,t[100]=R);let z;t[101]!==P||t[102]!==F||t[103]!==I||t[104]!==L||t[105]!==R?(z=[P,F,I,L,R],t[101]=P,t[102]=F,t[103]=I,t[104]=L,t[105]=R,t[106]=z):z=t[106];let B=z,V;t[107]!==i||t[108]!==s||t[109]!==y||t[110]!==B?(V=(0,$.jsx)(`div`,{className:`absolute right-0 z-20 mt-1 w-44 rounded-xl border border-edge bg-surface-overlay p-1 shadow-float`,children:B.map(e=>{let[t,n]=e;return(0,$.jsx)(`button`,{type:`button`,disabled:i,className:`min-h-10 w-full rounded-lg px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>s(y,t),children:n},t)})}),t[107]=i,t[108]=s,t[109]=y,t[110]=B,t[111]=V):V=t[111];let H;t[112]!==N||t[113]!==V?(H=(0,$.jsxs)(`details`,{className:`relative ml-auto`,children:[N,V]}),t[112]=N,t[113]=V,t[114]=H):H=t[114];let U;t[115]!==k||t[116]!==M||t[117]!==H||t[118]!==D?(U=(0,$.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-2`,children:[D,k,M,H]}),t[115]=k,t[116]=M,t[117]=H,t[118]=D,t[119]=U):U=t[119];let W;t[120]!==U||t[121]!==w||t[122]!==T||t[123]!==E?(W=(0,$.jsxs)(`div`,{className:`px-5 py-5 sm:px-6`,children:[w,T,E,U]}),t[120]=U,t[121]=w,t[122]=T,t[123]=E,t[124]=W):W=t[124];let G;t[125]!==i||t[126]!==r.alternatives||t[127]!==_||t[128]!==y.id?(G=_.length>1?(0,$.jsxs)(`div`,{className:`border-t border-edge-subtle px-5 py-4 sm:px-6`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:r.alternatives}),(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:_.filter(e=>e.id!==y.id).map(e=>(0,$.jsx)(`button`,{type:`button`,disabled:i,className:`min-h-10 rounded-lg border border-edge px-3 text-left text-sm text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>m(e.id),children:e.title},e.id))})]}):null,t[125]=i,t[126]=r.alternatives,t[127]=_,t[128]=y.id,t[129]=G):G=t[129];let K;return t[130]!==r.aiLabel||t[131]!==W||t[132]!==G?(K=(0,$.jsxs)(`section`,{className:`mt-7 rounded-2xl border border-accent/25 bg-surface-base`,"aria-label":r.aiLabel,children:[W,G]}),t[130]=r.aiLabel,t[131]=W,t[132]=G,t[133]=K):K=t[133],K}function Pe(e){return(0,$.jsx)(`li`,{children:e.message},`${e.kind}:${e.capability}`)}var Fe=new Set([`started`,`discussing`,`completed`]);function Ie(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[0,1,2].map(Le)}),e[0]=t):t=e[0],t}function Le(e){return(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl border border-edge-subtle p-4`,children:[(0,$.jsx)(g,{className:`h-4 w-24 rounded`}),(0,$.jsx)(g,{className:`h-5 w-4/5 rounded`}),(0,$.jsx)(g,{className:`h-4 w-3/5 rounded`})]},e)}function Re(e){let t=(0,Z.c)(11),{open:n,refreshKey:r,onOpenChange:i,onReevaluate:a}=e,o=p(ze),s=d(o).projectsPage.home,l=c(),[f,m]=(0,Q.useState)(`all`),g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=[],t[0]=g):g=t[0];let[_,v]=(0,Q.useState)(g),[y,b]=(0,Q.useState)(!1),[x,S]=(0,Q.useState)(),w;t[1]===n?w=t[2]:(w=()=>{if(!n)return;let e=!0;return b(!0),S(void 0),pe().then(t=>{e&&v(t.items)}).catch(t=>{e&&S(t instanceof Error?t.message:String(t))}).finally(()=>{e&&b(!1)}),()=>{e=!1}},t[1]=n,t[2]=w);let E;t[3]!==n||t[4]!==r?(E=[n,r],t[3]=n,t[4]=r,t[5]=E):E=t[5],(0,Q.useEffect)(w,E);let O=_.filter(e=>f===`all`||(f===`adopted`?Fe.has(e.status):!Fe.has(e.status))),M=new Intl.DateTimeFormat(o===`zh`?`zh-CN`:`en`,{dateStyle:`medium`}),N=new Intl.DateTimeFormat(o===`zh`?`zh-CN`:`en`,{dateStyle:`medium`,timeStyle:`short`}),I=new Map;for(let e of O){let t=M.format(new Date(e.updatedAt));I.set(t,[...I.get(t)??[],e])}let L=[...I.entries()],R=e=>e.feedbackKind===`already_done`?s.advisorHistoryStatusCompleted:e.feedbackKind===`irrelevant`?s.advisorHistoryStatusIrrelevant:e.feedbackKind===`source_incorrect`?s.advisorHistoryStatusSourceIncorrect:e.feedbackKind===`less_like_this`?s.advisorHistoryStatusLessLikeThis:{available:s.advisorHistoryStatusAvailable,started:s.advisorHistoryStatusStarted,discussing:s.advisorHistoryStatusDiscussing,completed:s.advisorHistoryStatusCompleted,snoozed:s.advisorHistoryStatusSnoozed,dismissed:s.advisorHistoryStatusDismissed,expired:s.advisorHistoryStatusExpired,superseded:s.advisorHistoryStatusSuperseded}[e.status],z=e=>{if(e.href){i(!1),l(D(`/`,e.href));return}e.status===`discussing`&&(i(!1),l(`/chat/new?${new URLSearchParams({draft:e.opportunity.actionPrompt}).toString()}`))},V;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(_e,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[6]=V):V=t[6];let H;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(q,{className:`mt-0.5 size-5 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=H):H=t[7];let U;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0}),t[8]=U):U=t[8];let W=y?(0,$.jsx)(Ie,{}):x?(0,$.jsxs)(`div`,{className:`rounded-xl border border-danger/25 bg-danger-soft p-4 text-sm text-danger`,children:[(0,$.jsx)(`p`,{children:s.advisorHistoryLoadFailed}),(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`mt-2`,onClick:()=>i(!1),children:s.advisorHistoryClose})]}):L.length===0?(0,$.jsxs)(`div`,{className:`py-16 text-center`,children:[(0,$.jsx)(q,{className:`mx-auto size-6 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:s.advisorHistoryEmpty}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.advisorHistoryEmptyHint})]}):(0,$.jsx)(`div`,{className:`space-y-6`,children:L.map(e=>{let[t,n]=e;return(0,$.jsxs)(`section`,{"aria-label":t,children:[(0,$.jsx)(`h3`,{className:`mb-2 text-xs font-medium text-fg-subtle`,children:t}),(0,$.jsx)(`div`,{className:`space-y-2`,children:n.map(e=>{let t=!!e.href||e.status===`discussing`,n=[`snoozed`,`dismissed`,`expired`,`superseded`].includes(e.status);return(0,$.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-accent`,children:R(e)}),(0,$.jsx)(`h4`,{className:`mt-1.5 text-sm font-semibold leading-5 text-fg`,children:e.opportunity.title}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.opportunity.outcome})]}),(0,$.jsx)(`time`,{className:`shrink-0 text-[11px] text-fg-subtle`,dateTime:new Date(e.updatedAt).toISOString(),children:N.format(new Date(e.updatedAt))})]}),e.snoozedUntil?(0,$.jsxs)(`p`,{className:`mt-2 inline-flex items-center gap-1 text-xs text-fg-muted`,children:[(0,$.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}),s.advisorHistoryReturnsAt,` `,N.format(new Date(e.snoozedUntil))]}):null,(0,$.jsxs)(`details`,{className:`group mt-3`,children:[(0,$.jsxs)(`summary`,{className:`flex min-h-8 cursor-pointer list-none items-center gap-1 text-xs font-medium text-fg-muted hover:text-fg`,children:[s.advisorHistoryEvidence,(0,$.jsx)(F,{className:`size-3.5 transition-transform duration-200 group-open:rotate-180 motion-reduce:transition-none`,"aria-hidden":!0})]}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1.5 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:e.opportunity.evidence.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsx)(Oe,{href:e.href,onOpen:()=>i(!1),children:e.observation})},e.id))})]}),t||n?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[t?(0,$.jsxs)(h,{type:`button`,variant:`secondary`,className:`min-h-9 text-xs`,onClick:()=>z(e),children:[(0,$.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}),e.status===`discussing`?s.advisorHistoryContinueDiscussion:s.advisorHistoryViewProgress]}):null,n?(0,$.jsxs)(h,{type:`button`,variant:`ghost`,className:`min-h-9 text-xs`,onClick:()=>{i(!1),a()},children:[(0,$.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),s.advisorHistoryReevaluate]}):null]}):null]},e.opportunity.id)})})]},t)})}),K;return t[9]===W?K=t[10]:(K=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:W}),t[9]=W,t[10]=K),(0,$.jsx)(k,{open:n,onOpenChange:i,children:(0,$.jsxs)(C,{children:[V,(0,$.jsxs)(B,{className:`xopc-drawer-right fixed right-0 top-0 z-[90] flex size-full max-w-lg flex-col overflow-hidden border-l border-edge bg-surface-overlay shadow-popover outline-none`,"aria-describedby":`home-advisor-history-description`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-3 border-b border-edge px-5 py-4`,children:[H,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(ne,{className:`text-base font-semibold text-fg`,children:s.advisorHistoryTitle}),(0,$.jsx)(G,{id:`home-advisor-history-description`,className:`mt-1 text-xs leading-5 text-fg-muted`,children:s.advisorHistoryDescription})]}),(0,$.jsx)(P,{asChild:!0,children:(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`-mr-2 size-9 shrink-0 p-0`,"aria-label":s.advisorHistoryClose,children:U})})]}),(0,$.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-5 py-3`,children:(0,$.jsx)(j,{className:`inline-flex rounded-lg bg-surface-inset p-1`,role:`group`,"aria-label":s.advisorHistoryFilterLabel,indicatorClassName:`rounded-md bg-surface-panel shadow-surface`,children:[[`all`,s.advisorHistoryFilterAll],[`adopted`,s.advisorHistoryFilterAdopted],[`other`,s.advisorHistoryFilterOther]].map(e=>{let[t,n]=e;return(0,$.jsx)(`button`,{type:`button`,className:`min-h-9 rounded-md px-3 text-xs font-medium transition-colors duration-150 ${f===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`}`,"aria-pressed":f===t,onClick:()=>m(t),children:n},t)})})}),K]})]})})}function ze(e){return e.language}function Be(e,t){return e.replace(`{{count}}`,String(t))}function Ve(e,t){if(e.state===`disabled`)return null;if(e.state===`ready`){let n=1+e.alternatives.length;return{label:Be(t.ready,n),detail:e.primary.title,tone:`accent`,refreshing:!!e.stale}}return e.state===`clarification`?{label:t.clarification,detail:e.question.question,tone:`accent`,refreshing:!1}:e.state===`refreshing`?{label:t.refreshing,detail:e.previous?.title??t.refreshingDetail,tone:`accent`,refreshing:!0}:e.reason===`generation_failed`?{label:t.generationFailed,detail:t.generationFailedDetail,tone:`danger`,refreshing:!1}:e.reason===`budget_exhausted`?{label:t.budgetExhausted,detail:t.budgetExhaustedDetail,tone:`warning`,refreshing:!1}:e.reason===`model_unavailable`?{label:t.modelUnavailable,detail:t.modelUnavailableDetail,tone:`warning`,refreshing:!1}:{label:t.idle,detail:t.idleDetail,tone:`neutral`,refreshing:!1}}var He={accent:`bg-accent`,danger:`bg-danger`,neutral:`bg-fg-subtle`,warning:`bg-warning`};function Ue(e){let t=(0,Z.c)(50),{advisor:n,busy:r,copy:i,onOpenHistory:a,onRefresh:o}=e,[s,c]=(0,Q.useState)(!1),l;t[0]!==n||t[1]!==i?(l=Ve(n,i),t[0]=n,t[1]=i,t[2]=l):l=t[2];let u=l;if(!u)return null;let d=n.state!==`refreshing`,p=n.state===`ready`?i.findAnother:i.retry,m=`${i.label}:${u.label}`,g;t[3]===u.refreshing?g=t[4]:(g=u.refreshing?(0,$.jsx)(A,{className:`size-3.5 shrink-0 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,$.jsx)(Y,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),t[3]=u.refreshing,t[4]=g);let x=He[u.tone],S;t[5]===x?S=t[6]:(S=f(`size-1.5 shrink-0 rounded-full`,x),t[5]=x,t[6]=S);let C;t[7]===S?C=t[8]:(C=(0,$.jsx)(`span`,{className:S,"aria-hidden":!0}),t[7]=S,t[8]=C);let w;t[9]!==i.label||t[10]!==u.label?(w=(0,$.jsxs)(`span`,{className:`truncate`,children:[i.label,` · `,u.label]}),t[9]=i.label,t[10]=u.label,t[11]=w):w=t[11];let T;t[12]!==m||t[13]!==g||t[14]!==C||t[15]!==w?(T=(0,$.jsx)(b,{asChild:!0,children:(0,$.jsxs)(h,{type:`button`,variant:`ghost`,className:`h-9 max-w-56 rounded-lg px-2.5`,"aria-label":m,children:[g,C,w]})}),t[12]=m,t[13]=g,t[14]=C,t[15]=w,t[16]=T):T=t[16];let E;t[17]===u.refreshing?E=t[18]:(E=(0,$.jsx)(`span`,{className:`mt-1 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent`,children:u.refreshing?(0,$.jsx)(A,{className:`size-4 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,$.jsx)(Y,{className:`size-4`,"aria-hidden":!0})}),t[17]=u.refreshing,t[18]=E);let D;t[19]===u.label?D=t[20]:(D=(0,$.jsx)(`p`,{className:`font-semibold text-fg`,children:u.label}),t[19]=u.label,t[20]=D);let O;t[21]===u.detail?O=t[22]:(O=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.detail}),t[21]=u.detail,t[22]=O);let k;t[23]!==D||t[24]!==O?(k=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[D,O]}),t[23]=D,t[24]=O,t[25]=k):k=t[25];let j;t[26]!==k||t[27]!==E?(j=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[E,k]}),t[26]=k,t[27]=E,t[28]=j):j=t[28];let M;t[29]===a?M=t[30]:(M=()=>{c(!1),a()},t[29]=a,t[30]=M);let N;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(q,{className:`size-3.5`,"aria-hidden":!0}),t[31]=N):N=t[31];let P;t[32]!==i.history||t[33]!==M?(P=(0,$.jsxs)(h,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:M,children:[N,i.history]}),t[32]=i.history,t[33]=M,t[34]=P):P=t[34];let F;t[35]!==r||t[36]!==d||t[37]!==o||t[38]!==p?(F=d?(0,$.jsxs)(h,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg text-xs`,disabled:r,onClick:()=>{c(!1),o()},children:[(0,$.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),p]}):null,t[35]=r,t[36]=d,t[37]=o,t[38]=p,t[39]=F):F=t[39];let I;t[40]!==P||t[41]!==F?(I=(0,$.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:[P,F]}),t[40]=P,t[41]=F,t[42]=I):I=t[42];let L;t[43]!==j||t[44]!==I?(L=(0,$.jsx)(_,{children:(0,$.jsxs)(v,{side:`bottom`,align:`end`,sideOffset:6,className:`z-[70] w-[min(21rem,calc(100vw-1.5rem))] rounded-xl border border-edge bg-surface-overlay p-4 text-sm text-fg shadow-popover outline-none`,onOpenAutoFocus:We,children:[j,I]})}),t[43]=j,t[44]=I,t[45]=L):L=t[45];let R;return t[46]!==s||t[47]!==L||t[48]!==T?(R=(0,$.jsxs)(y,{open:s,onOpenChange:c,children:[T,L]}),t[46]=s,t[47]=L,t[48]=T,t[49]=R):R=t[49],R}function We(e){return e.preventDefault()}async function Ge(e,t=`en`){let n=await R(e),r=n.runs.filter(e=>!e.parentRunId).sort((e,t)=>t.queuedAt-e.queuedAt)[0];if(!n.allowedCommands.includes(`start`)||r?.status!==`failed`)throw Error(t===`zh`?`任务状态已变化,暂时无法重试。请刷新并查看当前状态。`:`Task is no longer available for retry. Refresh and review its current state.`);await N(e,{type:`start`,executor:m.parse({...r.executorRef,kind:r.executorKind})},n.task.version)}function Ke(e){let t=e.runs.filter(e=>!e.parentRunId).sort((e,t)=>t.queuedAt-e.queuedAt)[0],n=e.conversation?.currentExecutorAgentId??e.task.delegateAgentId,r=n?{kind:`agent`,agentId:n}:t?{...t.executorRef,kind:t.executorKind}:void 0,i=m.safeParse(r);return i.success?i.data:void 0}var qe=(0,Q.lazy)(()=>i(()=>import(`./index-D1oivYvN.js`).then(e=>e.Xn).then(e=>({default:e.WorkspaceFilePreviewPanel})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52])));function Je({taskId:e,language:t,onComplete:n,onUpdated:r}){let i=t===`zh`,o=a(),c=`${o.pathname}${o.search}`,[l,u]=(0,Q.useState)(),[d,f]=(0,Q.useState)(),[p,m]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(),[y,b]=(0,Q.useState)(!1),w=(0,Q.useRef)(!1),T=(0,Q.useRef)(0),[E,D]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{u(void 0),v(void 0)},[e]),(0,Q.useEffect)(()=>{let t=!0,n=++T.current;return f(void 0),R(e).then(e=>{t&&n===T.current&&!w.current&&u(e)}).catch(e=>{t&&n===T.current&&f(e instanceof Error?e.message:String(e))}),()=>{t=!1}},[e,E]),(0,Q.useEffect)(()=>{let t=()=>{w.current||D(e=>e+1)},n=n=>{n.detail?.taskId===e&&t()};return window.addEventListener(`task-changed-v2`,n),window.addEventListener(`focus`,t),window.addEventListener(`realtime-gap`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.removeEventListener(`task-changed-v2`,n),window.removeEventListener(`focus`,t),window.removeEventListener(`realtime-gap`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[e]);let O=l?xe(l):[],A=l?.task.phase===`review`&&l.allowedCommands.includes(`close`)&&l.waits.length===0&&O.length>0&&O.every(e=>e.status===`passed`),j=l?Ke(l):void 0,M=l?.allowedCommands.includes(`start`)&&l.waits.length===0&&j,P=e=>{T.current++,u(e),r?.(e)};async function F(e,t,r=!1){if(!w.current){w.current=!0,T.current++,b(!0),f(void 0);try{P(await e()),v(t),r&&n()}catch(e){f(e instanceof Error?e.message:String(e))}finally{w.current=!1,b(!1)}}}let I=l?.receipts.filter(e=>l.runs.some(t=>t.id===e.runId&&t.contractVersion===l.task.latestContractVersion)).sort((e,t)=>t.finalizedAt-e.finalizedAt)[0],L=O.filter(e=>e.status===`passed`).length,z=O.filter(e=>e.status===`failed`).length,V=O.length-L-z,H=l?.task.contract?.acceptancePolicy===`verified_auto`,U=S(c,e);return(0,$.jsxs)(`section`,{className:`mt-4 space-y-4 rounded-xl border border-edge bg-surface-panel p-4`,"aria-label":i?`任务结果与处理`:`Task result and actions`,"aria-busy":y,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i?`执行结果`:`Result`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(h,{variant:`ghost`,disabled:y,onClick:()=>D(e=>e+1),children:i?`刷新状态`:`Refresh status`}),(0,$.jsx)(s,{to:U,className:`inline-flex min-h-9 items-center text-xs font-medium text-accent-fg hover:underline`,children:i?`查看任务详情`:`Task details`})]})]}),d?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:d}):null,y?(0,$.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:i?`正在处理…`:`Processing…`}):null,_?(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-success`,children:_}):null,!l&&!d?(0,$.jsxs)(`div`,{className:`space-y-3`,"aria-busy":!0,children:[(0,$.jsx)(g,{className:`h-5 w-1/3`}),(0,$.jsx)(g,{className:`h-24 w-full`})]}):null,l?(0,$.jsxs)($.Fragment,{children:[I?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:I.completionVerdict===`achieved`?i?`执行报告已达成目标,请结合依据逐项验收。`:`The run reports the goal achieved. Review the evidence before accepting.`:i?`当前为阶段性结果,尚有工作需要推进。`:`This is a partial result. More work is needed.`}),(0,$.jsx)(X,{content:I.summary,contentKey:`home:${e}:result:${I.runId}`,language:t,previewHeight:180}),I.remainingWork.length>0?(0,$.jsxs)(`div`,{className:`text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i?`尚待完成`:`Remaining work`}),(0,$.jsx)(`ul`,{className:`mt-1 list-disc space-y-1 pl-5`,children:I.remainingWork.map((e,t)=>(0,$.jsx)(`li`,{children:e},t))})]}):null,I.nextAction?(0,$.jsxs)(`p`,{className:`whitespace-pre-wrap text-sm text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i?`下一步:`:`Next step: `}),I.nextAction]}):null,I.judgment?(0,$.jsxs)(`div`,{className:`space-y-1 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:i?`判断依据`:`Assessment`}),(0,$.jsx)(`p`,{children:I.judgment.recommendation}),(0,$.jsx)(`ul`,{className:`list-disc space-y-1 pl-5`,children:I.judgment.reasons.map((e,t)=>(0,$.jsx)(`li`,{children:e},t))}),I.judgment.uncertainty?(0,$.jsxs)(`p`,{children:[i?`待确认:`:`Uncertainty: `,I.judgment.uncertainty]}):null]}):null,(0,$.jsx)(Ce,{evidence:I.evidence,projectId:l.task.projectId,conversationId:l.conversation?.activeConversationId,language:t,onOpenFile:m})]}):(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:i?`当前任务版本暂无执行结果,可先处理等待事项或查看执行进度。`:`No result for the current task version. Resolve pending items or view progress.`}),O.length>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`h3`,{className:`text-sm font-semibold text-fg`,children:[i?`验收条件`:`Acceptance criteria`,` `,(0,$.jsxs)(`span`,{className:`font-normal text-fg-muted`,children:[L,`/`,O.length]})]}),O.map((n,r)=>(0,$.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1 text-sm text-fg`,children:[(0,$.jsx)(`p`,{className:`break-words`,children:n.text}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:i?{passed:`已通过`,failed:`未通过`,unverified:`待判定`}[n.status]:{passed:`Passed`,failed:`Failed`,unverified:`Not reviewed`}[n.status]})]}),l.task.phase===`review`&&!H?(0,$.jsx)(`div`,{className:`flex gap-2`,children:[`passed`,`failed`].map(t=>(0,$.jsx)(h,{variant:`secondary`,disabled:y||n.status===t,onClick:()=>void F(()=>x(e,r,t,l.task.version,l.task.latestContractVersion),i?`判定已保存。`:`Review saved.`),children:i?t===`passed`?`确认通过`:`未通过`:t===`passed`?`Mark passed`:`Mark failed`},t))}):null]}),n.note?(0,$.jsx)(`p`,{className:`whitespace-pre-wrap text-xs leading-5 text-fg-muted`,children:n.note}):null,n.review?.note?(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.review.note}):null,(0,$.jsx)(Ce,{evidence:n.evidence,projectId:l.task.projectId,conversationId:l.conversation?.activeConversationId,language:t,onOpenFile:m})]},r))]}):null,l.waits.length>0?(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i?`等待处理`:`Pending items`}),l.waits.map(t=>(0,$.jsx)(`div`,{children:l.allowedCommands.includes(`resolve_wait`)&&(t.kind===`user_input`||t.kind===`approval`&&typeof t.condition.capability==`string`)&&t.condition.type!==`connection`?(0,$.jsx)(Se,{wait:t,detail:l,zh:i,onUpdated:P}):(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3 text-sm text-fg-muted`,children:[(0,$.jsx)(`p`,{children:t.reason}),t.kind===`paused`&&l.allowedCommands.includes(`resolve_wait`)?(0,$.jsx)(h,{className:`mt-2`,disabled:y,onClick:()=>void F(()=>N(e,{type:`resolve_wait`,waitId:t.id},l.task.version),i?`已解除暂停,任务状态已更新。`:`Pause resolved. Task status updated.`),children:i?`恢复任务`:`Resume task`}):(0,$.jsx)(s,{to:typeof t.condition.dependsOnTaskId==`string`?S(c,t.condition.dependsOnTaskId):U,className:`mt-2 inline-flex min-h-9 items-center text-accent-fg hover:underline`,children:i?`查看并处理`:`View and resolve`})]})},t.id))]}):null,l.task.phase===`review`&&!A?(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:i?`尚有 ${V} 项待判定、${z} 项未通过、${l.waits.length} 项等待处理。${H?`此任务需要执行验证;请继续执行以补齐依据和未完成项。`:`查看依据后逐项判定;未通过时可继续执行修正。`}`:`${V} unreviewed, ${z} failed, ${l.waits.length} pending items. ${H?`This task requires execution verification. Continue execution to supply missing evidence.`:`Review the evidence and mark each criterion; continue execution to fix failures.`}`}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[l.task.phase===`review`?(0,$.jsx)(h,{variant:`primary`,disabled:y||!A,onClick:()=>void F(()=>N(e,{type:`close`,resolution:`done`},l.task.version),i?`任务已验收完成。`:`Task accepted.`,!0),children:i?`验收完成`:`Accept task`}):null,M?(0,$.jsx)(h,{variant:A?`secondary`:`primary`,disabled:y,onClick:()=>void F(()=>N(e,{type:`start`,executor:j},l.task.version),i?`已开始执行,结果将自动更新。`:`Execution started. Results will update automatically.`),children:i?I?`继续执行并验证`:`开始执行`:I?`Continue and verify`:`Start execution`}):null]})]}):null,l&&p?(0,$.jsx)(k,{open:!0,onOpenChange:e=>{e||m(null)},children:(0,$.jsxs)(C,{children:[(0,$.jsx)(_e,{className:`fixed inset-0 z-[80] bg-scrim`}),(0,$.jsxs)(B,{className:`app-main-surface fixed left-1/2 top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] w-[min(72rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel outline-none`,"aria-describedby":void 0,children:[(0,$.jsxs)(ne,{className:`sr-only`,children:[i?`交付物预览`:`Artifact preview`,` · `,p]}),(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsxs)(`div`,{className:`flex-1 space-y-3 p-4`,"aria-busy":!0,children:[(0,$.jsx)(g,{className:`h-9 w-full`}),(0,$.jsx)(g,{className:`h-64 w-full`})]}),children:(0,$.jsx)(qe,{filePath:p,projectId:l.task.projectId,conversationId:l.conversation?.activeConversationId,onClose:()=>m(null)})})]})]})}):null]})}function Ye(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Xe(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`space-y-8`,"aria-busy":!0,children:[(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(g,{className:`h-10 w-3/5 rounded-xl`}),(0,$.jsx)(g,{className:`h-5 w-4/5 rounded-lg`})]}),(0,$.jsx)(g,{className:`h-64 rounded-2xl`}),(0,$.jsx)(g,{className:`h-32 rounded-xl`})]}),e[0]=t):t=e[0],t}function Ze(e){let t=(0,Z.c)(61),{item:n,busy:r,recommendationLabel:i,dueLabel:a,failureLabel:s,locale:c,onAction:l,onComplete:u,onUpdated:d}=e,[f,p]=o(),m;t[0]===n.openAction?m=t[1]:(m=n.openAction?.type===`open`?/^\/tasks\/([^/?#]+)/.exec(n.openAction.href):null,t[0]=n.openAction,t[1]=m);let g=m,_=n.primaryAction?.type===`task_review`?n.primaryAction.taskId:g?decodeURIComponent(g[1]):void 0,v;t[2]!==_||t[3]!==f?(v=_&&f.get(`reviewTask`)===_,t[2]=_,t[3]=f,t[4]=v):v=t[4];let y=!!v,b;t[5]!==_||t[6]!==f||t[7]!==p?(b=e=>{let t=new URLSearchParams(f);e&&_?t.set(`reviewTask`,_):t.delete(`reviewTask`),p(t)},t[5]=_,t[6]=f,t[7]=p,t[8]=b):b=t[8];let x=b,S;t[9]!==a||t[10]!==n.dueAt||t[11]!==c?(S=n.dueAt?`${a} ${ye(new Date(n.dueAt),c)}`:null,t[9]=a,t[10]=n.dueAt,t[11]=c,t[12]=S):S=t[12];let C=S,w=n.kind===`failure`?s:C,T;t[13]===w?T=t[14]:(T=w?(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-warning`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-warning`,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:w})]}):null,t[13]=w,t[14]=T);let E=!n.openAction,D;t[15]!==n.id||t[16]!==n.openAction||t[17]!==l?(D=()=>n.openAction&&l(n.openAction,n.id),t[15]=n.id,t[16]=n.openAction,t[17]=l,t[18]=D):D=t[18];let O;t[19]===n.title?O=t[20]:(O=(0,$.jsx)(`span`,{className:`block text-lg font-semibold leading-7 tracking-tight text-fg`,children:n.title}),t[19]=n.title,t[20]=O);let k;t[21]===n.summary?k=t[22]:(k=(0,$.jsx)(`span`,{className:`mt-1.5 block text-sm leading-6 text-fg-muted`,children:n.summary}),t[21]=n.summary,t[22]=k);let A;t[23]!==E||t[24]!==D||t[25]!==O||t[26]!==k?(A=(0,$.jsxs)(`button`,{type:`button`,className:`block w-full text-left outline-none focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:E,onClick:D,children:[O,k]}),t[23]=E,t[24]=D,t[25]=O,t[26]=k,t[27]=A):A=t[27];let j;t[28]!==n.recommendation||t[29]!==i?(j=n.recommendation?(0,$.jsxs)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:[(0,$.jsxs)(`span`,{className:`font-semibold text-fg`,children:[i,`:`]}),n.recommendation]}):null,t[28]=n.recommendation,t[29]=i,t[30]=j):j=t[30];let M;t[31]!==r||t[32]!==n.id||t[33]!==n.primaryAction||t[34]!==n.secondaryActions||t[35]!==l||t[36]!==y||t[37]!==_||t[38]!==x?(M=n.primaryAction||n.secondaryActions.length>0?(0,$.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[n.primaryAction?(0,$.jsx)(h,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3.5 text-xs`,disabled:r,"aria-expanded":_&&[`task_review`,`open`].includes(n.primaryAction.type)?y:void 0,onClick:()=>_&&[`task_review`,`open`].includes(n.primaryAction.type)?x(!y):l(n.primaryAction,n.id),children:n.primaryAction.label}):null,n.secondaryActions.map(e=>(0,$.jsx)(h,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3.5 text-xs shadow-none`,disabled:r,onClick:()=>l(e,n.id),children:e.label},`${e.type}:${e.label}`))]}):null,t[31]=r,t[32]=n.id,t[33]=n.primaryAction,t[34]=n.secondaryActions,t[35]=l,t[36]=y,t[37]=_,t[38]=x,t[39]=M):M=t[39];let N;t[40]!==n.primaryAction?.type||t[41]!==c||t[42]!==y||t[43]!==_||t[44]!==x?(N=_&&n.primaryAction?.type===`retry_task`?(0,$.jsx)(h,{variant:`ghost`,className:`mt-2`,"aria-expanded":y,onClick:()=>x(!y),children:c===`zh`?`查看结果与依据`:`View result and evidence`}):null,t[40]=n.primaryAction?.type,t[41]=c,t[42]=y,t[43]=_,t[44]=x,t[45]=N):N=t[45];let P;t[46]!==c||t[47]!==u||t[48]!==d||t[49]!==y||t[50]!==_||t[51]!==x?(P=y&&_?(0,$.jsx)(Je,{taskId:_,language:c,onUpdated:d,onComplete:()=>{x(!1),u()}},_):null,t[46]=c,t[47]=u,t[48]=d,t[49]=y,t[50]=_,t[51]=x,t[52]=P):P=t[52];let F;return t[53]!==r||t[54]!==A||t[55]!==j||t[56]!==M||t[57]!==N||t[58]!==P||t[59]!==T?(F=(0,$.jsxs)(`article`,{className:`px-5 py-5 sm:px-6 sm:py-6`,"aria-busy":r,children:[T,A,j,M,N,P]}),t[53]=r,t[54]=A,t[55]=j,t[56]=M,t[57]=N,t[58]=P,t[59]=T,t[60]=F):F=t[60],F}function Qe(e){let t=(0,Z.c)(38),{item:n,onAction:r,language:i,onUpdated:a}=e,[o,s]=(0,Q.useState)(!1),c;t[0]===n.openAction?c=t[1]:(c=n.openAction?.type===`open`?/^\/tasks\/([^/?#]+)/.exec(n.openAction.href):null,t[0]=n.openAction,t[1]=c);let l=c,u=l?decodeURIComponent(l[1]):void 0,d;t[2]===n.kind?d=t[3]:(d=n.kind===`scheduled`?(0,$.jsx)(K,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-fg-subtle`,"aria-hidden":!0}),t[2]=n.kind,t[3]=d);let f=d,p=!n.openAction,m=u?o:void 0,h;t[4]!==n.id||t[5]!==n.openAction||t[6]!==r||t[7]!==u?(h=()=>u?s($e):n.openAction&&r(n.openAction,n.id),t[4]=n.id,t[5]=n.openAction,t[6]=r,t[7]=u,t[8]=h):h=t[8];let g;t[9]===f?g=t[10]:(g=(0,$.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center text-fg-subtle`,children:f}),t[9]=f,t[10]=g);let _;t[11]===n.title?_=t[12]:(_=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:n.title}),t[11]=n.title,t[12]=_);let v;t[13]===n.summary?v=t[14]:(v=(0,$.jsx)(`span`,{className:`mt-0.5 block truncate text-xs text-fg-muted`,children:n.summary}),t[13]=n.summary,t[14]=v);let y;t[15]!==_||t[16]!==v?(y=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[_,v]}),t[15]=_,t[16]=v,t[17]=y):y=t[17];let b;t[18]===n.statusLabel?b=t[19]:(b=n.statusLabel?(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.statusLabel}):null,t[18]=n.statusLabel,t[19]=b);let x;t[20]===n.openAction?x=t[21]:(x=n.openAction?(0,$.jsx)(H,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}):null,t[20]=n.openAction,t[21]=x);let S;t[22]!==b||t[23]!==x||t[24]!==p||t[25]!==m||t[26]!==h||t[27]!==g||t[28]!==y?(S=(0,$.jsxs)(`button`,{type:`button`,className:`flex min-h-16 w-full items-center gap-3 py-3 text-left outline-none hover:text-fg focus-visible:rounded-md focus-visible:ring-2 focus-visible:ring-accent`,disabled:p,"aria-expanded":m,onClick:h,children:[g,y,b,x]}),t[22]=b,t[23]=x,t[24]=p,t[25]=m,t[26]=h,t[27]=g,t[28]=y,t[29]=S):S=t[29];let C;t[30]!==o||t[31]!==i||t[32]!==a||t[33]!==u?(C=u&&o?(0,$.jsx)(Je,{taskId:u,language:i,onUpdated:a,onComplete:()=>s(!1)}):null,t[30]=o,t[31]=i,t[32]=a,t[33]=u,t[34]=C):C=t[34];let w;return t[35]!==S||t[36]!==C?(w=(0,$.jsxs)(`div`,{children:[S,C]}),t[35]=S,t[36]=C,t[37]=w):w=t[37],w}function $e(e){return!e}function et(){let e=p(e=>e.language),t=d(e),n=t.projectsPage,r=he(e),i=c(),o=a(),s=le(e=>e.setPageHeader),l=le(e=>e.clearPageHeader),[u,f]=(0,Q.useState)(!1),{home:m,loading:g,loadError:_,setLoadError:v,load:y}=we(e,o.key,u),[b,x]=(0,Q.useState)(!1),[S,T]=(0,Q.useState)(``),O=(0,Q.useRef)(!1),[A,j]=(0,Q.useState)(),[N,F]=(0,Q.useState)(!1),[R,z]=(0,Q.useState)(null),[H,U]=(0,Q.useState)(!1),[K,q]=(0,Q.useState)(),[ie,J]=(0,Q.useState)(!1),[de,pe]=(0,Q.useState)(0),[Y,ge]=(0,Q.useState)(),[ye,be]=(0,Q.useState)(),[xe,Se]=(0,Q.useState)(!1),X=L({chat:t.chat}),Ce=(0,Q.useRef)(null),Z=I({disabled:xe,chat:t.chat,onTranscript:e=>{T(t=>te(t,e)),window.setTimeout(()=>Ce.current?.focus(),0)}}),{phase:Te,voiceActive:De,startVoiceInput:Oe,cancelVoiceInput:ke,confirmVoiceInput:Ae,retryVoiceInput:je}=Z;(0,Q.useEffect)(()=>{if(!Y)return;let e=window.setTimeout(()=>ge(void 0),8e3);return()=>window.clearTimeout(e)},[Y]);let Me=(0,Q.useCallback)(async e=>{if(!(e.length===0||xe)){Se(!0);try{await X.processFiles(e)}finally{Se(!1)}}},[xe,X.processFiles]),Pe=(0,Q.useCallback)(async e=>{let t=se(e.clipboardData);t.length!==0&&(e.preventDefault(),await Me(t))},[Me]),Fe=(0,Q.useCallback)(e=>{e.dataTransfer.types.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`,X.setIsDragging(!0))},[X.setIsDragging]),Ie=(0,Q.useCallback)(e=>{let t=e.relatedTarget;(!(t instanceof Node)||!e.currentTarget.contains(t))&&X.setIsDragging(!1)},[X.setIsDragging]),Le=(0,Q.useCallback)(async e=>{e.preventDefault(),X.setIsDragging(!1),await Me(Array.from(e.dataTransfer.files))},[X.setIsDragging,Me]),ze=(0,Q.useCallback)(e=>{e.preventDefault();let t=X.wireAttachmentsPayload(),n=oe(S,t.length>0?me(t):void 0,{projectScope:`none`});n&&(x(!1),T(``),X.clearAttachments(),i(n))},[X.clearAttachments,X.wireAttachmentsPayload,S,i]),Be=X.attachments.length>=10,Ve={attachTitle:Be?Ye(t.chat.maxAttachmentsReached,{max:10}):`${t.chat.attachFile} (${X.attachments.length}/10)`,dropFiles:t.chat.dropFiles,intentLabel:r.intentLabel,intentPlaceholder:r.intentPlaceholder,intentSuggestion:r.intentSuggestion,shortcut:n.home.submitShortcut,submit:r.newWork},He=(0,Q.useMemo)(()=>({label:n.home.advisorStatusLabel,ready:n.home.advisorStatusReady,clarification:n.home.advisorStatusClarification,refreshing:n.home.advisorStatusRefreshing,refreshingDetail:n.home.advisorRefreshing,idle:n.home.advisorStatusIdle,idleDetail:n.home.advisorUnavailableTitle,generationFailed:n.home.advisorStatusGenerationFailed,budgetExhausted:n.home.advisorStatusBudgetExhausted,modelUnavailable:n.home.advisorStatusModelUnavailable,generationFailedDetail:n.home.advisorGenerationFailed,budgetExhaustedDetail:n.home.advisorBudgetExhausted,modelUnavailableDetail:n.home.advisorModelUnavailable,history:n.home.advisorHistory,retry:n.home.retry,findAnother:n.home.advisorRefresh}),[n.home]),We=!!(m&&m.needsUser.length===0&&m.backgroundCount===0),Ke=!!(m&&m.needsUser.length===0),qe=Ke||b;(0,Q.useEffect)(()=>{!qe&&De&&ke()},[ke,qe,De]),(0,Q.useEffect)(()=>{let e=e=>{let t=e.detail?.target;t&&t!==`chat`||!qe||xe||(e.preventDefault(),Te===`recording`?Ae():Te===`idle`?(Ce.current?.focus(),Oe()):Te===`error`&&je())},t=e=>{let t=e.detail?.target;t&&t!==`chat`||!qe||!De||(e.preventDefault(),ke(),Ce.current?.focus())};return window.addEventListener(E,e),window.addEventListener(ee,t),()=>{window.removeEventListener(E,e),window.removeEventListener(ee,t)}},[xe,ke,qe,Ae,je,Oe,De,Te]);let Je=(0,Q.useCallback)(e=>{e||ke(),x(e)},[ke]),$e=(0,Q.useCallback)((t,n)=>{if(t.type===`open`){i(D(`/`,t.href));return}t.type===`task_review`||O.current||(O.current=!0,z(n),j(void 0),v(null),(async()=>{try{if(t.type===`retry_task`)await Ge(t.taskId,e),j({message:e===`zh`?`任务已重新开始,可查看执行进度。`:`Task restarted. View progress.`,href:D(`/`,`/tasks/${encodeURIComponent(t.taskId)}`)});else if(t.type===`connector_decision`)await ae({kind:`connector_approval`,approvalId:t.approvalId},t.decision),j({message:e===`zh`?t.decision===`approve`?`已批准授权,任务状态将自动更新。`:`已拒绝授权。`:t.decision===`approve`?`Permission approved. Task status will update.`:`Permission denied.`});else if(t.type===`retry_run`){let n=await W({kind:t.subjectKind,runId:t.runId});j({message:e===`zh`?`已发起重试,可查看新的执行结果。`:`Retry started. Follow the new execution.`,href:n.conversationId?`/chat/${encodeURIComponent(n.conversationId)}`:`/automations?run=${encodeURIComponent(n.runId)}`})}else t.type===`acknowledge_run`&&(await ve({kind:t.subjectKind,runId:t.runId}),j({message:e===`zh`?`已确认此异常,已从待处理事项移除。`:`Issue acknowledged and removed from pending items.`}));await y()}catch(e){v(e instanceof Error?e.message:String(e))}finally{O.current=!1,z(null)}})())},[e,y,i]),et=(0,Q.useCallback)(t=>{j({message:e===`zh`?t.task.phase===`closed`?`任务已验收完成。`:`操作已保存,任务状态已更新。`:t.task.phase===`closed`?`Task accepted.`:`Action saved. Task status updated.`,href:D(`/`,`/tasks/${encodeURIComponent(t.task.id)}`)}),y()},[e,y]),tt=(0,Q.useCallback)(()=>{U(!0),q(void 0),be(void 0),v(null),re(e).then(()=>y()).catch(e=>v(e instanceof Error?e.message:String(e))).finally(()=>U(!1))},[e,y]),nt=(0,Q.useCallback)((e,t)=>{U(!0),v(null),w(e,t).then(async t=>{if(t.outcome===`needs_setup`){be({opportunityId:e.id,value:t.preflight});return}if(be(void 0),pe(e=>e+1),t.outcome===`task`){q({title:n.home.advisorStartedTitle,detail:Ye(n.home.advisorStartedDetail,{title:e.title}),href:D(`/`,t.href)}),await y();return}i(t.href)}).catch(e=>v(e instanceof Error?e.message:String(e))).finally(()=>U(!1))},[y,i,n.home.advisorStartedDetail,n.home.advisorStartedTitle]),rt=(0,Q.useCallback)((e,t)=>{U(!0),q(void 0),be(void 0),v(null),ce(e,{kind:t,snoozedUntil:t===`too_early`?Date.now()+4320*6e4:void 0}).then(({idempotencyKey:t})=>(ge({opportunityId:e.id,idempotencyKey:t}),pe(e=>e+1),y())).catch(e=>v(e instanceof Error?e.message:String(e))).finally(()=>U(!1))},[y]),it=(0,Q.useCallback)(()=>{if(!Y)return;let e=Y;ge(void 0),U(!0),v(null),ue(e.opportunityId,e.idempotencyKey).then(()=>(pe(e=>e+1),y())).catch(t=>{ge(e),v(t instanceof Error?t.message:String(t))}).finally(()=>U(!1))},[Y,y]),at=(0,Q.useCallback)((e,t)=>{i(`/chat/new?${new URLSearchParams({draft:`${e}\n\n${t}`}).toString()}`)},[i]),ot=(0,Q.useMemo)(()=>(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[m?(0,$.jsx)(Ue,{advisor:m.advisor,busy:H,copy:He,onOpenHistory:()=>J(!0),onRefresh:tt}):null,Ke?null:(0,$.jsxs)(h,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>x(!0),children:[(0,$.jsx)(M,{className:`size-4`,"aria-hidden":!0}),r.newWork]})]}),[H,He,r.newWork,m,tt,Ke]);(0,Q.useLayoutEffect)(()=>(s({startExtra:null,main:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),end:ot}),()=>l()),[l,ot,s,n.title]);let st=m?.needsUser.length??0,ct=m?.backgroundCount??0,lt=st>0?Ye(n.home.attentionTitle,{count:st}):ct>0?n.home.clearTitle:n.home.idleTitle,ut=st>0?ct>0?Ye(n.home.attentionIntroWithBackground,{count:ct}):n.home.attentionIntro:ct>0?Ye(n.home.clearIntro,{count:ct}):n.home.idleIntro;return(0,$.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[920px] flex-1 flex-col px-4 pb-8 pt-3 sm:px-6 lg:px-8 lg:pb-12 lg:pt-4`,children:[(0,$.jsx)(`input`,{ref:X.fileInputRef,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&Me(Array.from(t)),e.target.value=``}}),(0,$.jsx)(k,{open:b,onOpenChange:Je,children:(0,$.jsxs)(C,{children:[(0,$.jsx)(_e,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(B,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-overlay shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(ne,{className:`text-base font-semibold text-fg`,children:r.dialogTitle}),(0,$.jsx)(G,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r.dialogDescription})]}),(0,$.jsx)(P,{asChild:!0,children:(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,$.jsx)(fe,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsx)(Ee,{variant:`dialog`,inputId:`new-conversation-intent`,inputRef:Ce,intent:S,labels:{...Ve,submit:r.submit},attachments:X.attachments,isDragging:X.isDragging,attachmentBusy:xe,attachmentsFull:Be,voice:Z,chat:t.chat,cancelAction:(0,$.jsx)(P,{asChild:!0,children:(0,$.jsx)(h,{type:`button`,variant:`ghost`,children:n.cancel})}),onIntentChange:T,onPickFiles:()=>X.fileInputRef.current?.click(),onRemoveAttachment:X.removeAttachment,onPaste:e=>void Pe(e),onDragOver:Fe,onDragLeave:Ie,onDrop:e=>void Le(e),onSubmit:ze})]})]})}),(0,$.jsx)(Re,{open:ie,refreshKey:de,onOpenChange:J,onReevaluate:tt}),_?(0,$.jsxs)(`div`,{role:`alert`,className:`mb-6 flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,$.jsx)(`span`,{children:_}),(0,$.jsx)(h,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void y(),children:n.home.retry})]}):null,A?(0,$.jsxs)(`div`,{role:`status`,className:`mb-5 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-success/25 bg-success-soft px-4 py-3 text-sm text-fg`,children:[(0,$.jsx)(`span`,{children:A.message}),A.href?(0,$.jsx)(h,{variant:`ghost`,onClick:()=>i(A.href),children:e===`zh`?`查看进展与结果`:`View progress and result`}):null]}):null,g?(0,$.jsx)(Xe,{}):m?(0,$.jsxs)(`div`,{className:We?`mx-auto my-auto w-full max-w-[640px]`:`w-full`,children:[(0,$.jsxs)(`section`,{className:We?`w-full text-center`:`max-w-3xl`,children:[(0,$.jsx)(`h2`,{className:`text-3xl font-semibold leading-tight tracking-[-0.035em] text-fg sm:text-4xl`,children:lt}),(0,$.jsx)(`p`,{className:We?`mx-auto mt-3 max-w-xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`:`mt-3 max-w-2xl text-sm leading-6 text-fg-muted sm:text-base sm:leading-7`,children:ut})]}),Ke?(0,$.jsx)(Ee,{variant:`inline`,inputId:`home-conversation-intent`,inputRef:Ce,intent:S,labels:Ve,attachments:X.attachments,isDragging:X.isDragging,attachmentBusy:xe,attachmentsFull:Be,voice:Z,chat:t.chat,onIntentChange:T,onPickFiles:()=>X.fileInputRef.current?.click(),onRemoveAttachment:X.removeAttachment,onPaste:e=>void Pe(e),onDragOver:Fe,onDragLeave:Ie,onDrop:e=>void Le(e),onSubmit:ze}):null,(0,$.jsx)(Ne,{advisor:m.advisor,busy:H,copy:{aiLabel:n.home.advisorAiLabel,why:n.home.advisorWhy,evidence:n.home.advisorEvidence,needsSetup:n.home.advisorNeedsSetup,start:n.home.advisorStart,discuss:n.home.advisorDiscuss,refresh:n.home.advisorRefresh,refreshing:n.home.advisorRefreshing,history:n.home.advisorHistory,viewProgress:n.home.advisorViewProgress,alternatives:n.home.advisorAlternatives,feedback:n.home.advisorFeedback,alreadyDone:n.home.advisorAlreadyDone,irrelevant:n.home.advisorIrrelevant,later:n.home.advisorLater,lessLikeThis:n.home.advisorLessLikeThis,sourceIncorrect:n.home.advisorSourceIncorrect,minutes:n.home.advisorMinutes,setupTitle:n.home.advisorSetupTitle,setupHint:n.home.advisorSetupHint,configure:n.home.advisorConfigure,degradedStart:n.home.advisorDegradedStart,automationHint:n.home.advisorAutomationHint,automationAction:n.home.advisorAutomationAction},onRefresh:tt,onAction:nt,onFeedback:rt,onClarification:at,onOpenHistory:()=>J(!0),preflight:ye,receipt:K}),m.needsUser.length>0?(0,$.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-needs-user-title`,children:[(0,$.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 px-1`,children:[(0,$.jsx)(V,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{id:`home-needs-user-title`,className:`text-sm font-semibold text-fg`,children:n.home.needsUserTitle})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:m.needsUser.map(t=>(0,$.jsx)(Ze,{item:t,busy:R!==null,recommendationLabel:n.home.recommendationLabel,dueLabel:n.home.dueLabel,failureLabel:r.runAttention,locale:e,onAction:$e,onComplete:()=>void y(),onUpdated:et},t.id))}),u||(m.attentionPolicy?.suppressedDecisionCount??0)+(m.attentionPolicy?.suppressedAttentionCount??0)>0?(0,$.jsx)(h,{variant:`ghost`,className:`mt-2`,"aria-expanded":u,onClick:()=>f(e=>!e),children:e===`zh`?u?`收起待处理事项`:`查看其余 ${(m.attentionPolicy?.suppressedDecisionCount??0)+(m.attentionPolicy?.suppressedAttentionCount??0)} 项待处理事项`:u?`Show fewer pending items`:`View ${(m.attentionPolicy?.suppressedDecisionCount??0)+(m.attentionPolicy?.suppressedAttentionCount??0)} more pending items`}):null]}):null,m.background.length>0?(0,$.jsxs)(`section`,{className:`mt-10`,"aria-labelledby":`home-background-title`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,$.jsx)(`h2`,{id:`home-background-title`,className:`text-sm font-semibold text-fg`,children:n.home.backgroundTitle}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Ye(n.home.backgroundCount,{count:m.backgroundCount})})]}),(0,$.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle border-y border-edge-subtle`,children:(N?m.background:m.background.slice(0,3)).map(t=>(0,$.jsx)(Qe,{item:t,language:e,onAction:$e,onUpdated:et},t.id))}),m.background.length>3?(0,$.jsx)(h,{variant:`ghost`,className:`mt-2`,"aria-expanded":N,onClick:()=>F(e=>!e),children:e===`zh`?N?`收起`:`查看全部 ${m.backgroundCount} 项`:N?`Show less`:`View all ${m.backgroundCount} items`}):null]}):null]}):null,Y?(0,$.jsxs)(`div`,{role:`status`,className:`fixed bottom-5 left-1/2 z-[100] flex -translate-x-1/2 items-center gap-4 rounded-lg border border-edge bg-surface-overlay px-4 py-3 text-sm text-fg shadow-float`,children:[(0,$.jsx)(`span`,{children:n.home.advisorFeedbackSaved}),(0,$.jsx)(`button`,{type:`button`,className:`font-medium text-accent-fg hover:underline`,onClick:it,children:n.home.advisorUndo})]}):null]})}export{et as HomePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{i as r,o as i}from"./locale-store-
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{i as r,o as i}from"./locale-store-JogcXC4J.js";import{t as a}from"./skeleton-BI5TyibZ.js";import{ii as o,qc as s}from"./index-D1oivYvN.js";var c=t();e();var l=n();function u(e){let t=(0,c.c)(30),{primary:n,value:r,models:i,loading:u,error:d,zh:f,onChange:p}=e,m;if(t[0]!==i||t[1]!==n||t[2]!==r){let e;t[4]!==n||t[5]!==r?(e=e=>e.id!==n&&!r.includes(e.id),t[4]=n,t[5]=r,t[6]=e):e=t[6],m=i.filter(e),t[0]=i,t[1]=n,t[2]=r,t[3]=m}else m=t[3];let h=m,g=f?`回退顺序`:`Fallback order`,_;t[7]===g?_=t[8]:(_=(0,l.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:g}),t[7]=g,t[8]=_);let v=f?`主模型不可用时,按从左到右的顺序尝试。`:`Tried from left to right when the primary model is unavailable.`,y;t[9]===v?y=t[10]:(y=(0,l.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:v}),t[9]=v,t[10]=y);let b;t[11]!==_||t[12]!==y?(b=(0,l.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,l.jsxs)(`div`,{children:[_,y]})}),t[11]=_,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==i||t[15]!==p||t[16]!==r||t[17]!==f?(x=r.length>0?(0,l.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:r.map((e,t)=>(0,l.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full bg-surface-base/70 py-1 pl-2.5 pr-1 text-xs text-fg`,children:[(0,l.jsx)(`span`,{className:`text-fg-subtle`,children:t+1}),(0,l.jsx)(`span`,{children:i.find(t=>t.id===e)?.name??e}),(0,l.jsx)(`button`,{type:`button`,"aria-label":f?`移除 ${e}`:`Remove ${e}`,className:`rounded-full p-1 text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>p(r.filter(t=>t!==e)),children:(0,l.jsx)(s,{className:`size-3`})})]},e))}):(0,l.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:f?`未设置回退模型。`:`No fallback models configured.`}),t[14]=i,t[15]=p,t[16]=r,t[17]=f,t[18]=x):x=t[18];let S;t[19]!==h||t[20]!==d||t[21]!==u||t[22]!==p||t[23]!==r||t[24]!==f?(S=u?(0,l.jsx)(a,{className:`mt-3 h-11 w-full max-w-md rounded-lg`}):(0,l.jsx)(o,{value:``,models:h,modelsLoading:u,modelsError:d,placeholder:f?`添加回退模型`:`Add fallback model`,searchPlaceholder:f?`搜索模型或服务商`:`Search models or providers`,noMatches:f?`没有可添加的模型`:`No models available to add`,showProviderInTrigger:!1,contentAlign:`start`,className:`mt-3 w-full max-w-md`,ariaLabel:f?`添加回退模型`:`Add fallback model`,onChange:e=>{e&&p([...r,e])}}),t[19]=h,t[20]=d,t[21]=u,t[22]=p,t[23]=r,t[24]=f,t[25]=S):S=t[25];let C;return t[26]!==b||t[27]!==x||t[28]!==S?(C=(0,l.jsxs)(`div`,{children:[b,x,S]}),t[26]=b,t[27]=x,t[28]=S,t[29]=C):C=t[29],C}async function d(){let e=await i(r(`/api/image-generation/catalog`));if(!Array.isArray(e.payload?.providers))throw Error(`Invalid image provider catalog`);return e.payload.providers}async function f(){let e=await i(r(`/api/image-generation/custom-providers`));if(!Array.isArray(e.payload?.providers))throw Error(`Invalid custom image provider list`);return e.payload.providers}async function p(e,t){await i(r(`/api/image-generation/custom-providers/${encodeURIComponent(e)}`),{method:`PUT`,body:JSON.stringify(t)})}async function m(e){await i(r(`/api/image-generation/custom-providers/${encodeURIComponent(e)}`),{method:`DELETE`})}async function h(e,t){await i(r(`/api/image-generation/providers/${encodeURIComponent(e)}/credential`),{method:`PUT`,body:JSON.stringify({apiKey:t})})}async function g(e,t){let n=await i(r(`/api/image-generation/providers/${encodeURIComponent(e)}/test`),{method:`POST`,body:JSON.stringify({modelId:t})});if(!Array.isArray(n.payload?.images))throw Error(`Invalid image generation test response`);return{images:n.payload.images}}export{h as a,p as i,f as n,g as o,d as r,u as s,m as t};
|