@xopcai/xopc 0.0.414 → 0.0.416
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/_locales/en/messages.json +4 -1
- package/dist/browser-ext/_locales/zh_CN/messages.json +4 -1
- package/dist/browser-ext/dist/assets/{page-context-MuzjMBlJ.js → page-context-CVvmTWZb.js} +33 -9
- package/dist/browser-ext/dist/background.js +39 -10
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +22 -3
- 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-ClobpdW3.js → agent-avatar-dicebear-CufU7cqe.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DHDAcss8.js +1 -0
- package/dist/gateway/static/root/assets/agents-BV3dAoa0.js +77 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-CeBkHnl8.js → agents-admin-api-B1p-ghg9.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CLunLNGp.js → app-management-settings-panel-D4-n1uBg.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DBEgoE9g.js → appearance-settings-Cgn4eNsX.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BOYzD7Zz.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-JElK4Goq.js → archive-plugin-B4btCsiV.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CZ0UqwyU.js → automations-page-yb1EL_3N.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-J7LJ4RuV.js +8 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CXFawow6.js → binary-plugins-DQT9e258.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BoduwSYI.js → block-editor-B50rU9tL.js} +30 -30
- package/dist/gateway/static/root/assets/{browser-automation-inputs-D1pDgMJu.js → browser-automation-inputs-D6AccXaA.js} +1 -1
- package/dist/gateway/static/root/assets/browser-automations-page-BiQz6lJA.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-W9kuxBbE.js +3 -0
- package/dist/gateway/static/root/assets/{capabilities-Bpeh6E22.js → capabilities-BlxF36t-.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-iXe87MdG.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CRLSXe7Z.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-BasrAWA0.js → capability-header-actions-BMnbzHms.js} +1 -1
- package/dist/gateway/static/root/assets/channels-CrRJkOKX.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CwQbzcZ_.js → chat-terminal-dock-Bd3af4gL.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-DNWeJKfF.js → computer-settings-page-DXfqy7xh.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-CxHgC5RM.js → connector-service-page-B-cw0CPU.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-DbFxc0Fd.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-CXxLbLJb.js → date-picker-CqzXevH6.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-DVuWMrSj.js → dependency-picker-pgT4Gyaf.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BDlg9g4s.js → desktop-pet-settings-Dy_-i2L8.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-KbVLtAlO.js → desktop-pet-zICeqw9c.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-ByGbxqkg.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-a7xEodzo.js → directory-picker-path-field-C-aQ7qoM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CHelH5u_.js → extension-debug-page-2NwpYkS5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CrVHmS9-.js → extension-page-y9J0z7_Q.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CiMybi0r.js → extension-settings-page-BtowusUh.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-DF_HV6NP.js → gateway-config-swr-fQKBHBi1.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-C52ghnBK.js +1 -0
- package/dist/gateway/static/root/assets/gateway-realtime-store-Bx9KCID-.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-BYSKzUMR.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B91CBTzO.js → gateway-startup-retry-Cfwxof4k.js} +1 -1
- package/dist/gateway/static/root/assets/highlight-code-Cz6eeDH5.js +1 -0
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-8ACAVktj.js → highlighted-body-KQOG7T2V-BiAa8HKC.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-Cd1BjYHj.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-CVBaWmrV.js → image-generation-api-gBFro48x.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-C5IP3e6d.js → imports-page-BZQpXgjj.js} +1 -1
- package/dist/gateway/static/root/assets/index-Cy16gQST.css +1 -0
- package/dist/gateway/static/root/assets/index-DRyGCING.js +710 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BhU6VYvd.js → keyboard-shortcuts-settings-CYunR34k.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-B_Ac1lly.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DcP1Bdlk.js → local-apps-page-w-J5bY02.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-DvmwiLUx.js → local-session-drafts-iGX_6O0O.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-JogcXC4J.js → locale-store-B7s2Hb35.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-Dnjvvx2i.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-w1EDwgLW.js +1 -0
- package/dist/gateway/static/root/assets/{media-plugins-BnPpcJ2J.js → media-plugins-CIx1koXw.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DISkHmEC.js +1 -0
- package/dist/gateway/static/root/assets/{messages-RzwPiQNL.js → messages-BYq0cPbn.js} +2 -2
- package/dist/gateway/static/root/assets/note-detail-panel-CNkxMTFU.js +5 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-D5GH2wuC.js +1 -0
- package/dist/gateway/static/root/assets/notes-page-DZgKqFBG.js +8 -0
- package/dist/gateway/static/root/assets/page-context-capture-button-DusR2Itk.js +1 -0
- package/dist/gateway/static/root/assets/personal-page-CR5JFkQ9.js +1 -0
- package/dist/gateway/static/root/assets/personal-settings-panel-B7undvlr.js +1 -0
- package/dist/gateway/static/root/assets/phone-model-picker-fWDltRUJ.js +1 -0
- package/dist/gateway/static/root/assets/phone-settings-page-CsOirAiy.js +1 -0
- package/dist/gateway/static/root/assets/plugin-details-dialog-BOBVIB3j.js +1 -0
- package/dist/gateway/static/root/assets/{preview-open-alternatives-FGqN-mQx.js → preview-open-alternatives-CMxjsKSw.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CwnHLfdL.js → product-open-page-CrlyJx5M.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-BD6k5hF9.js → product-preview-content-B-Jhzi7W.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DoYUbtcI.js +7 -0
- package/dist/gateway/static/root/assets/projects-page-xGQd9oAZ.js +1 -0
- package/dist/gateway/static/root/assets/refresh-cw-BRlGaq2w.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BGqSwITi.js → registry-api-BcfoLEna.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Gs0Xkws9.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-CSm5SpnR.js → runtime-tools-api-DesqGCnE.js} +1 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-Bwg7U7TR.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-DoVn5jJK.js → schema-form-ByzTNR_C.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-DTxZyMta.js → session-api-DdQnMwkl.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-B2HDomj4.js → session-manager-B_h0jlLb.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-XzK1ftbR.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-D_8Mvnog.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-Ce8vVv-9.js → settings-form-section-Brgd8IOV.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DP2w3ejC.js → settings-page-B6Mv02eg.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-header-BWyxJKOG.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-B20AfmFG.js → settings-page-layout-DLHcS-0T.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DSCj5yis.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-DV4dKrmG.js → share-preview-page-DF8Of0aZ.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DXNPe4Tl.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-DTdejInH.js → skill-api-CKCDCHLq.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BH0WF6Br.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DFWMVRW4.js +2 -0
- package/dist/gateway/static/root/assets/system-settings-panel-DB-ttubV.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-BJY7c8wb.js +2 -0
- package/dist/gateway/static/root/assets/{task-result-evidence-DIGSC4qF.js → task-result-evidence-B-vt1BgK.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-BaU8frtc.js → tracing-settings-page-Dt51Z_ws.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-BCcOUsqu.js → tunnel-api-Dok3t7Qe.js} +1 -1
- package/dist/gateway/static/root/assets/usage-page-lJym5G7F.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-C1X47WVb.js → use-autosave-D4EMIB-V.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-BXdNkITp.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-Bk4DQMTw.js → voice-api-key-field-CO3KuanA.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-D7xsWrdh.js → voice-config-api-BkUlN7GH.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-B7_NmTB5.js → work-discovery-overlay-BJRtgQM3.js} +1 -1
- package/dist/gateway/static/root/assets/wrench-DFb4r8bH.js +1 -0
- package/dist/gateway/static/root/assets/xopc-cloud-account-card-CS-_GxHV.js +1 -0
- package/dist/gateway/static/root/browser-setup-test.html +5 -0
- package/dist/gateway/static/root/browser-setup-test.js +7 -0
- package/dist/gateway/static/root/index.html +17 -14
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/browser-setup.js +6 -0
- package/dist/packages/gateway-contract/src/index.js +4 -0
- package/dist/packages/gateway-contract/src/phone-setup.js +6 -0
- package/dist/packages/realtime-client/src/index.js +1 -0
- package/dist/packages/realtime-protocol/src/index.js +1 -0
- package/dist/src/agent/agent-manager.d.ts +4 -0
- package/dist/src/agent/agent-manager.js +12 -1
- package/dist/src/agent/coding/workspace-revision.js +1 -1
- package/dist/src/agent/commands/command-registry.js +1 -1
- package/dist/src/agent/embedded/tool-search-extension.js +14 -1
- package/dist/src/agent/memory/context-recovery.d.ts +1 -1
- package/dist/src/agent/service.d.ts +1 -0
- package/dist/src/agent/service.js +5 -0
- package/dist/src/agent/service.types.d.ts +2 -0
- package/dist/src/agent/skills/installer.js +3 -3
- package/dist/src/agent/tool-manuals/phone.d.ts +1 -1
- package/dist/src/agent/tool-manuals/phone.js +4 -2
- package/dist/src/agent/tool-manuals/xopc-configuration.d.ts +2 -0
- package/dist/src/agent/tool-manuals/xopc-configuration.js +25 -0
- package/dist/src/agent/tools/browser/tool/browser-use-tool.d.ts +2 -0
- package/dist/src/agent/tools/browser/tool/browser-use-tool.js +6 -2
- package/dist/src/agent/tools/factory.d.ts +3 -0
- package/dist/src/agent/tools/factory.js +11 -1
- package/dist/src/agent/tools/personal-task-tool.d.ts +1 -1
- package/dist/src/agent/tools/personal-task-tool.js +23 -21
- package/dist/src/agent/tools/phone-use-tool.d.ts +1 -0
- package/dist/src/agent/tools/phone-use-tool.js +29 -1
- package/dist/src/agent/tools/tool-manual-tool.d.ts +1 -1
- package/dist/src/agent/tools/tool-manual-tool.js +3 -1
- package/dist/src/agent/tools/toolExposure.js +3 -0
- package/dist/src/agent/tools/xopc-use-tool.d.ts +4 -2
- package/dist/src/agent/tools/xopc-use-tool.js +40 -2
- package/dist/src/backup/archive.js +2 -1
- package/dist/src/browser/drivers/browser-driver.d.ts +2 -2
- package/dist/src/browser/drivers/extension-driver.d.ts +2 -2
- package/dist/src/browser/drivers/extension-driver.js +6 -3
- package/dist/src/browser/providers/browser-ext-install.js +3 -2
- package/dist/src/browser/runtime/browser-runtime.d.ts +4 -1
- package/dist/src/browser/runtime/browser-runtime.js +29 -17
- package/dist/src/browser/setup/repository.d.ts +5 -0
- package/dist/src/browser/setup/repository.js +42 -0
- package/dist/src/browser/setup/service.d.ts +152 -0
- package/dist/src/browser/setup/service.js +404 -0
- package/dist/src/browser/setup/types.d.ts +38 -0
- package/dist/src/browser/setup/types.js +1 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +3 -3
- package/dist/src/cli/commands/extension-pack.js +1 -1
- package/dist/src/cli/commands/extension.js +2 -2
- package/dist/src/config/schema.d.ts +2 -0
- package/dist/src/extensions/install.js +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/browser-setup.d.ts +3 -0
- package/dist/src/gateway/hono/routes/browser-setup.js +114 -0
- package/dist/src/gateway/hono/routes/browser.d.ts +2 -1
- package/dist/src/gateway/hono/routes/browser.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/phone-dependencies.js +1 -1
- package/dist/src/gateway/hono/routes/phone-setup.d.ts +7 -0
- package/dist/src/gateway/hono/routes/phone-setup.js +162 -0
- package/dist/src/gateway/hono/routes/phone.js +11 -7
- package/dist/src/gateway/hono/routes/public-gateway.js +2 -0
- package/dist/src/gateway/provider-model-setup.js +1 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +2 -0
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/session-input-coordinator.js +1 -1
- package/dist/src/gateway/service.d.ts +5 -0
- package/dist/src/gateway/service.js +52 -7
- package/dist/src/gateway/xopc-cloud-capability-setup.js +7 -1
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/infra/unhandled-rejections.js +2 -2
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/personal-agent/prompts.js +1 -1
- package/dist/src/phone/adb-driver.d.ts +8 -2
- package/dist/src/phone/adb-driver.js +124 -54
- package/dist/src/phone/cloud-adb.js +8 -0
- package/dist/src/phone/cloud-scrcpy.d.ts +3 -1
- package/dist/src/phone/cloud-scrcpy.js +17 -3
- package/dist/src/phone/contracts.d.ts +85 -0
- package/dist/src/phone/contracts.js +31 -5
- package/dist/src/phone/model-adapter.d.ts +141 -2
- package/dist/src/phone/model-adapter.js +176 -24
- package/dist/src/phone/numeric-entry.d.ts +31 -0
- package/dist/src/phone/numeric-entry.js +126 -0
- package/dist/src/phone/planning.d.ts +27 -0
- package/dist/src/phone/planning.js +79 -0
- package/dist/src/phone/recovery.d.ts +37 -0
- package/dist/src/phone/recovery.js +81 -0
- package/dist/src/phone/reliability.d.ts +7 -0
- package/dist/src/phone/reliability.js +66 -0
- package/dist/src/phone/repository.d.ts +1 -0
- package/dist/src/phone/repository.js +3 -0
- package/dist/src/phone/runtime.d.ts +8 -0
- package/dist/src/phone/runtime.js +387 -41
- package/dist/src/phone/scrcpy-text.d.ts +11 -0
- package/dist/src/phone/scrcpy-text.js +72 -0
- package/dist/src/phone/scrcpy.d.ts +5 -1
- package/dist/src/phone/scrcpy.js +48 -3
- package/dist/src/phone/semantic-controls.d.ts +13 -0
- package/dist/src/phone/semantic-controls.js +76 -0
- package/dist/src/phone/setup/service.d.ts +148 -0
- package/dist/src/phone/setup/service.js +251 -0
- package/dist/src/providers/presentation.js +2 -2
- package/dist/src/providers/xopc-cloud-model-source.js +6 -2
- package/dist/src/realtime/runtime.js +1 -1
- package/dist/src/storage/sqlite/connection.js +2 -2
- package/dist/src/storage/sqlite/offline-access.js +13 -7
- package/dist/src/storage/sqlite/schema-errors.d.ts +12 -0
- package/dist/src/storage/sqlite/schema-errors.js +21 -3
- package/dist/src/storage/sqlite/schema-upgrade.d.ts +4 -0
- package/dist/src/storage/sqlite/schema-upgrade.js +78 -0
- package/dist/src/storage/sqlite/schema.d.ts +4 -3
- package/dist/src/storage/sqlite/schema.js +14 -8
- package/dist/src/storage/sqlite/schema.sql +10 -0
- package/dist/src/storage/sqlite/upgrades/203_remove_retired_proactive_contracts.sql +70 -0
- package/dist/src/storage/sqlite/upgrades/204_home_intelligence.sql +78 -0
- package/dist/src/storage/sqlite/upgrades/205_agent_catalog.sql +66 -0
- package/dist/src/storage/sqlite/upgrades/206_home_advice_strategy_version.sql +2 -0
- package/dist/src/storage/sqlite/upgrades/207_user_model_policy_contract.sql +121 -0
- package/dist/src/storage/sqlite/upgrades/208_automation_management.sql +2 -0
- package/dist/src/storage/sqlite/upgrades/209_automation_event_hub.sql +48 -0
- package/dist/src/storage/sqlite/upgrades/210_remove_legacy_automation_timeout.sql +14 -0
- package/dist/src/storage/sqlite/upgrades/211_automation_result_deliveries.sql +16 -0
- package/dist/src/storage/sqlite/upgrades/212_automation_delivery_policy.sql +30 -0
- package/dist/src/storage/sqlite/upgrades/213_automation_reliability_contract.sql +188 -0
- package/dist/src/storage/sqlite/upgrades/214_ai_usage_ledger.sql +41 -0
- package/dist/src/storage/sqlite/upgrades/215_scene_execution_adapters.sql +6 -0
- package/dist/src/storage/sqlite/upgrades/216_remove_scene_model_usage.sql +1 -0
- package/dist/src/storage/sqlite/upgrades/217_remove_legacy_memory_tables.sql +4 -0
- package/dist/src/storage/sqlite/upgrades/218_core_relation_indexes.sql +26 -0
- package/dist/src/storage/sqlite/upgrades/219_json_contracts.sql +123 -0
- package/dist/src/storage/sqlite/upgrades/220_normalize_timestamps.sql +339 -0
- package/dist/src/storage/sqlite/upgrades/221_ai_usage_retention_index.sql +2 -0
- package/dist/src/storage/sqlite/upgrades/222_session_config_authority.sql +13 -0
- package/dist/src/storage/sqlite/upgrades/223_session_creation_receipts.sql +59 -0
- package/dist/src/storage/sqlite/upgrades/224_task_origin_links.sql +8 -0
- package/dist/src/storage/sqlite/upgrades/225_task_collaboration.sql +32 -0
- package/dist/src/storage/sqlite/upgrades/226_task_main_updates.sql +9 -0
- package/dist/src/storage/sqlite/upgrades/227_task_main_update_decisions.sql +8 -0
- package/dist/src/storage/sqlite/upgrades/228_task_main_agent_links.sql +14 -0
- package/dist/src/storage/sqlite/upgrades/229_task_criterion_reviews.sql +12 -0
- package/dist/src/storage/sqlite/upgrades/230_personal_agent_onboarding.sql +8 -0
- package/dist/src/storage/sqlite/upgrades/231_task_result_deliveries.sql +32 -0
- package/dist/src/storage/sqlite/upgrades/232_personal_requests.sql +28 -0
- package/dist/src/storage/sqlite/upgrades/233_observability_usage_links.sql +3 -0
- package/dist/src/storage/sqlite/upgrades/234_task_result_reply.sql +14 -0
- package/dist/src/storage/sqlite/upgrades/235_personal_conversation_priority.sql +3 -0
- package/dist/src/storage/sqlite/upgrades/236_personal_proactivity.sql +53 -0
- package/dist/src/storage/sqlite/upgrades/237_personal_strategy_versions.sql +18 -0
- package/dist/src/storage/sqlite/upgrades/238_browser_record_replay.sql +45 -0
- package/dist/src/storage/sqlite/upgrades/239_clarification_notifications.sql +26 -0
- package/dist/src/storage/sqlite/upgrades/240_device_settings.sql +5 -0
- package/dist/src/storage/sqlite/upgrades/241_device_grant_audit.sql +13 -0
- package/dist/src/storage/sqlite/upgrades/242_cloud_usage_receipts.sql +5 -0
- package/dist/src/storage/sqlite/upgrades/243_voice_opening_greetings.sql +12 -0
- package/dist/src/storage/sqlite/upgrades/244_device_request_proofs.sql +8 -0
- package/dist/src/storage/sqlite/upgrades/245_memory_learning.sql +125 -0
- package/dist/src/storage/sqlite/upgrades/246_personal_session_thinking.sql +22 -0
- package/dist/src/storage/sqlite/upgrades/247_agent_selection_records.sql +32 -0
- package/dist/src/storage/sqlite/upgrades/248_next_turn_suggestions.sql +20 -0
- package/dist/src/storage/sqlite/upgrades/249_task_allocations.sql +17 -0
- package/dist/src/storage/sqlite/upgrades/250_research_checkpoints.sql +15 -0
- package/dist/src/storage/sqlite/upgrades/251_personal_result_reads.sql +40 -0
- package/dist/src/storage/sqlite/upgrades/252_task_work_revisions.sql +15 -0
- package/dist/src/storage/sqlite/upgrades/253_discussion_processing_recovery.sql +20 -0
- package/dist/src/storage/sqlite/upgrades/254_discussion_annotations.sql +17 -0
- package/dist/src/storage/sqlite/upgrades/255_discussion_chapter_progress.sql +10 -0
- package/dist/src/storage/sqlite/upgrades/256_task_main_update_retries.sql +21 -0
- package/dist/src/storage/sqlite/upgrades/257_session_composer_history.sql +11 -0
- package/dist/src/storage/sqlite/upgrades/258_task_phase_changes.sql +20 -0
- package/dist/src/storage/sqlite/upgrades/259_personal_default_style.sql +10 -0
- package/dist/src/storage/sqlite/upgrades/260_browser_setup.sql +9 -0
- package/dist/src/storage/sqlite/windows-database-owners.js +33 -28
- package/dist/src/tasks/capabilities/relations.d.ts +2 -2
- package/dist/src/tui/clipboard-image.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/utils/index.js +1 -1
- package/dist/src/utils/logger/index.js +1 -1
- package/dist/src/utils/logger.js +1 -1
- package/dist/src/work-discovery/probe.js +1 -1
- package/package.json +3 -3
- package/skills/tools/configure-xopc/SKILL.md +47 -0
- package/skills/tools/configure-xopc/references/browser/acceptance.md +31 -0
- package/skills/tools/configure-xopc/references/browser/chrome-extension.md +19 -0
- package/skills/tools/configure-xopc/references/browser/overview.md +22 -0
- package/skills/tools/configure-xopc/references/browser/permissions.md +25 -0
- package/skills/tools/configure-xopc/references/browser/troubleshooting.md +24 -0
- package/skills/tools/configure-xopc/references/phone/acceptance.md +25 -0
- package/skills/tools/configure-xopc/references/phone/aliyun.md +29 -0
- package/skills/tools/configure-xopc/references/phone/dependencies.md +18 -0
- package/skills/tools/configure-xopc/references/phone/local.md +19 -0
- package/skills/tools/configure-xopc/references/phone/models.md +18 -0
- package/skills/tools/configure-xopc/references/phone/overview.md +30 -0
- package/skills/tools/configure-xopc/references/phone/troubleshooting.md +24 -0
- package/skills/tools/configure-xopc/references/scene-index.md +12 -0
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-mf0jgEPE.js +0 -1
- package/dist/gateway/static/root/assets/agents-CKhZ4UYQ.js +0 -77
- package/dist/gateway/static/root/assets/apps-page-BZ_MaQJf.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CHUDHNVL.js +0 -8
- package/dist/gateway/static/root/assets/browser-automations-page-DStDm9y1.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-6I4oetKt.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-C-EecWbS.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BQoCPk3x.js +0 -8
- package/dist/gateway/static/root/assets/channels-BKf_-Mdt.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-CUBg8spT.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-PmP_vGem.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-DMAzNlm-.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-CoIgC1Al.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DnrQ28E2.js +0 -1
- package/dist/gateway/static/root/assets/highlight-code-AMjU04kR.js +0 -1
- package/dist/gateway/static/root/assets/home-page-pTwVME-g.js +0 -2
- package/dist/gateway/static/root/assets/index-BLL0wKRZ.css +0 -1
- package/dist/gateway/static/root/assets/index-ygkHNYyo.js +0 -710
- package/dist/gateway/static/root/assets/local-app-workbench-page-Cwl6EvuX.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-CS3hcTOq.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-DC-Y_-GP.js +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-vckgHpON.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-C7u4dxEk.js +0 -5
- package/dist/gateway/static/root/assets/note-image-lightbox-jvqYtySx.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-Bs7F5Hpf.js +0 -8
- package/dist/gateway/static/root/assets/page-context-capture-button-DO_yhXS1.js +0 -1
- package/dist/gateway/static/root/assets/personal-page-BexL2-PQ.js +0 -1
- package/dist/gateway/static/root/assets/personal-settings-panel-BKA4fbYH.js +0 -1
- package/dist/gateway/static/root/assets/phone-dependencies-card-ChFtdFhA.js +0 -1
- package/dist/gateway/static/root/assets/phone-model-picker-CZoIAQ1j.js +0 -1
- package/dist/gateway/static/root/assets/phone-settings-page-DRyK0nHH.js +0 -1
- package/dist/gateway/static/root/assets/plugin-details-dialog-B-N61jJH.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-DtKmFBml.js +0 -7
- package/dist/gateway/static/root/assets/projects-page-CFZIz9mc.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CWEc7W0m.js +0 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-q_oswAdV.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BuPqNxpd.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-QTVDCGJG.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-header-CYpuTXUW.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-ZmlE8jIE.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-CtNxWqW-.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Egaf8PqZ.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-C6FKxf4J.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-Baxkhov7.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-C77-rpkt.js +0 -2
- package/dist/gateway/static/root/assets/usage-page-BFeIbpbi.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-u8zY5jea.js +0 -2
- package/dist/gateway/static/root/assets/xopc-cloud-account-card-CJ_akAvc.js +0 -1
|
@@ -1,8 +0,0 @@
|
|
|
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,l as a,m as o,u as s}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as c}from"./chevron-down-ccbiQQz_.js";import{t as l}from"./popover-select-DGKUpVsz.js";import{t as u}from"./ellipsis-0k4rZLoy.js";import{t as d}from"./loader-circle-CifKLtgG.js";import{t as f}from"./messages-RzwPiQNL.js";import{t as p}from"./cn-0WouolD0.js";import{f as m,l as ee,n as h}from"./locale-store-JogcXC4J.js";import{i as g}from"./vendor-swr-BIWyz7Rc.js";import{t as _}from"./skeleton-BI5TyibZ.js";import{$n as v,Al as y,Bd as b,Gd as x,Gn as S,Ha as te,Hl as ne,Jd as C,Nd as w,No as re,Ql as T,Ru as ie,Wd as E,Xd as ae,Xt as D,Zt as O,Zu as oe,aa as k,an as A,br as j,ca as se,dr as M,du as ce,el as N,id as le,il as ue,in as P,io as de,jc as fe,kl as pe,na as me,oa as he,on as ge,pl as _e,qc as F,qd as ve,rn as ye,ru as be,sa as xe,sn as Se,sr as Ce,tr as we,ua as Te,ur as Ee,vl as De,wa as Oe,wr as ke,xr as I}from"./index-ygkHNYyo.js";import{i as Ae,t as L}from"./note-detail-panel-C7u4dxEk.js";var R=n(),z=e(t(),1),B=r();function V({projectId:e}){let t=h(e=>e.language)===`zh`,n=s(),r=(0,z.useRef)(null),i=(0,z.useRef)(null),[a,o]=(0,z.useState)(null),[c,l]=(0,z.useState)(null),[u,d]=(0,z.useState)(null);async function f(){let t=i.current;if(!(!t||a!==null)){o(0),l(null);try{let r=await Se();if(r.consentAcknowledgedAt==null){d(r.consentPolicyVersion);return}let a=await D(t.file,t.requestId),s=await ge({clientRequestId:t.requestId,contextProjectId:e,source:`web`,consentPolicyVersion:r.consentPolicyVersion});t.discussionId=s.discussion.id,await P({...a,serverDiscussionId:s.discussion.id,projectId:e}),s.discussion.audioAttachmentId||await O(a,s.discussion.id,o),await ye(t.requestId),i.current=null,n(`/notes/${encodeURIComponent(s.note.id)}`)}catch(e){l(e instanceof Error?e.message:String(e))}finally{o(null)}}}return(0,B.jsxs)(`div`,{className:`inline-flex flex-wrap items-center gap-2 text-xs`,children:[(0,B.jsx)(`input`,{ref:r,hidden:!0,type:`file`,accept:`audio/*,.m4a,.wav,.mp3,.webm,.ogg`,onChange:e=>{let n=e.target.files?.[0];if(e.target.value=``,n){if(!n.size||n.size>1073741824){l(t?`音频须为 1 字节至 1 GiB`:`Audio must be between 1 byte and 1 GiB`);return}i.current={file:n,requestId:crypto.randomUUID()},f()}}}),(0,B.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md p-2 hover:bg-surface-hover`,disabled:a!==null,onClick:()=>c&&i.current?void f():r.current?.click(),children:[(0,B.jsx)(N,{className:`size-3.5`}),a===null?c&&i.current?t?`重试导入`:`Retry import`:t?`导入录音`:`Import recording`:`${a}%`]}),u===null?null:(0,B.jsxs)(`span`,{children:[t?`请确认你有权上传此录音,并允许配置的语音服务处理。`:`Confirm permission to upload this recording and process it with your configured speech service.`,(0,B.jsx)(`button`,{type:`button`,className:`p-2 text-accent`,onClick:()=>void A(u).then(()=>(d(null),f())).catch(e=>l(String(e))),children:t?`确认导入`:`Confirm import`})]}),c?(0,B.jsx)(`span`,{role:`alert`,className:`text-danger`,children:c}):null]})}async function je(e){e.note??=await v({title:e.title,markdown:e.markdown,projectId:e.projectId,channel:`web`},e.requestId);let t=e.note.id;for(let n=e.attachments.length;n<e.files.length;n++)e.attachments.push(await I(t,e.files[n],`${e.requestId}:file:${n}`));if(e.attachments.length){let n=e.attachments.map(e=>`[${e.fileName.replace(/[\\[\]]/g,`\\$&`).replace(/[\r\n]/g,` `)}](${ke(t,e.id)})`);e.note=await j(t,{markdown:`${e.markdown}\n\n## ${e.materialHeading}\n\n${n.join(`
|
|
2
|
-
|
|
3
|
-
`)}`})}return{noteId:t,conversationId:(await M(t,{projectId:e.projectId})).conversationId}}function Me(e,t,n){let r=new URLSearchParams({draft:n.replace(`{{id}}`,t),autoSend:`1`});return`/chat/${encodeURIComponent(e)}?${r}`}var H={meeting:E,requirements:le,research:y,weekly:w};function Ne({projects:e,projectId:t,onProjectChange:n,onCreated:r,labels:i,projectsLoading:a,projectsError:o}){let u=i.home,f=s(),[m,ee]=(0,z.useState)(``),[h,g]=(0,z.useState)(null),[_,v]=(0,z.useState)(!1),[y,b]=(0,z.useState)([]),[S,ne]=(0,z.useState)(!1),[C,w]=(0,z.useState)(null),[re,ie]=(0,z.useState)(``),E=(0,z.useRef)(null),ae=(0,z.useRef)(!1),D=(0,z.useRef)(null),O=(0,z.useRef)(null),k=S||!!E.current,A=h?u.templateOptions[h]:null,j=!!(m.trim()||y.length);async function se(){if(!(ae.current||!j&&!E.current)){ae.current=!0,ne(!0),w(null),E.current??={requestId:crypto.randomUUID(),title:m.trim().split(`
|
|
4
|
-
`)[0]?.slice(0,80)||A?.label||i.titlePlaceholder,markdown:`## ${u.requestHeading}\n\n${A?`${A.prompt}\n`:``}${m.trim()}`,projectId:t||void 0,files:[...y],attachments:[],materialHeading:u.materialsHeading};try{let e=await je(E.current);r(),f(Me(e.conversationId,e.noteId,u.agentPrompt))}catch(e){E.current.note&&r(),w(e instanceof Error?e.message:i.quickCaptureFailedHint)}finally{ae.current=!1,ne(!1)}}}function M(){E.current=null,w(null),ee(``),b([]),g(null),v(!1),O.current?.focus()}return(0,B.jsxs)(`section`,{"aria-label":u.askLabel,children:[(0,B.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),se()},className:`relative rounded-xl border border-edge bg-surface-panel p-4 focus-within:border-accent/60 sm:p-5`,children:[(0,B.jsxs)(`fieldset`,{disabled:k,className:`min-w-0`,children:[(0,B.jsxs)(`label`,{htmlFor:`notes-home-prompt`,className:`flex items-center gap-2 text-xs font-medium text-accent-fg`,children:[(0,B.jsx)(De,{className:`size-4`,"aria-hidden":!0}),u.askLabel]}),(0,B.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u.agentResultHint}),A?(0,B.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-lg bg-accent-soft px-3 py-2 text-xs leading-5 text-accent-fg`,children:[(0,B.jsxs)(`p`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`span`,{className:`font-medium`,children:[A.label,` · `]}),A.prompt.split(`
|
|
5
|
-
|
|
6
|
-
`)[0]]}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>g(null),"aria-label":i.searchClear,className:`shrink-0 rounded p-1 hover:bg-surface-hover`,children:(0,B.jsx)(F,{className:`size-3.5`})})]}):null,(0,B.jsx)(`textarea`,{ref:O,id:`notes-home-prompt`,value:m,onChange:e=>ee(e.target.value),placeholder:A?A.prompt.split(`
|
|
7
|
-
|
|
8
|
-
`).at(-1):u.askPlaceholder,rows:2,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&!e.nativeEvent.isComposing&&(e.preventDefault(),se())},className:`mt-2 min-h-16 w-full resize-y bg-transparent py-2 text-base leading-6 text-fg outline-none placeholder:text-fg-muted sm:text-sm`}),y.length?(0,B.jsx)(`ul`,{className:`mb-3 flex flex-wrap gap-2`,children:y.map((e,t)=>(0,B.jsxs)(`li`,{className:`flex max-w-full items-center gap-2 rounded-md border border-edge px-2 py-1 text-xs text-fg-muted`,children:[(0,B.jsx)(T,{className:`size-3 shrink-0`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name}),(0,B.jsx)(`button`,{type:`button`,"aria-label":`${u.removeMaterial}: ${e.name}`,onClick:()=>b(e=>e.filter((e,n)=>n!==t)),className:`rounded p-1 hover:bg-surface-hover`,children:(0,B.jsx)(F,{className:`size-3`})})]},`${e.name}-${t}`))}):null,(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 sm:pr-40`,children:[(0,B.jsx)(`div`,{className:`w-44 max-w-full`,children:(0,B.jsx)(l,{value:t,options:e.filter(e=>e.name.toLowerCase().includes(re.toLowerCase())).map(e=>({value:e.id,label:e.name})),selectedLabel:t?e.find(e=>e.id===t)?.name:u.unassigned,placeholder:u.unassigned,emptyLabel:u.unassigned,ariaLabel:u.assignProject,triggerIcon:(0,B.jsx)(oe,{className:`size-4 shrink-0`,"aria-hidden":!0}),triggerClassName:`h-8 border-transparent bg-transparent px-2 text-xs text-fg-muted hover:bg-surface-hover`,onChange:n,disabled:k,loading:a,statusMessage:o?u.projectsLoadFailed:void 0,searchPlaceholder:u.projectSearch,searchValue:re,onSearchChange:ie})}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>D.current?.click(),className:`inline-flex h-8 items-center gap-1.5 rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover`,children:[(0,B.jsx)(T,{className:`size-4`,"aria-hidden":!0}),u.addMaterials]}),(0,B.jsx)(`input`,{ref:D,type:`file`,multiple:!0,className:`hidden`,"aria-label":u.addMaterials,onChange:e=>{let t=Array.from(e.target.files??[]);b(e=>[...e,...t]),e.target.value=``}})]})]}),(0,B.jsx)(`div`,{className:`mt-2 flex justify-end sm:absolute sm:bottom-5 sm:right-5 sm:mt-0`,children:(0,B.jsxs)(`button`,{type:`submit`,disabled:S||!E.current&&!j,className:`inline-flex h-9 items-center gap-2 rounded-lg bg-accent px-4 text-sm font-medium text-on-accent hover:bg-accent-hover focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,children:[S?(0,B.jsx)(d,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,B.jsx)(x,{className:`size-4`,"aria-hidden":!0}),S?u.creating:C?u.retry:u.agentCreate]})})]}),C?(0,B.jsxs)(`div`,{className:`mt-3 rounded-lg border border-danger/25 bg-danger-soft px-3 py-3 text-xs text-danger`,role:`alert`,children:[(0,B.jsx)(`p`,{children:C}),E.current?.note?(0,B.jsx)(`p`,{className:`mt-1`,children:u.partialFailure}):null,(0,B.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-3`,children:[E.current?.note?(0,B.jsx)(`button`,{type:`button`,onClick:()=>f(`/notes/${encodeURIComponent(E.current.note.id)}?edit=1`),className:`underline`,children:u.openSavedDraft}):null,(0,B.jsx)(`button`,{type:`button`,onClick:M,className:`underline`,children:u.newRequest})]})]}):null,(0,B.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:(0,B.jsxs)(`button`,{type:`button`,disabled:k,"aria-expanded":_,"aria-controls":`notes-home-templates`,onClick:()=>v(e=>!e),className:`touch-target inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[u.templates,(0,B.jsx)(c,{className:p(`size-3.5 transition-transform`,_&&`rotate-180`),"aria-hidden":!0})]})}),(0,B.jsxs)(te,{id:`notes-home-templates`,hidden:!_,className:p(`mt-1 flex-wrap items-center gap-1 text-xs text-fg-muted`,_?`flex`:`hidden`),role:`group`,"aria-label":u.templates,indicatorClassName:`rounded-md bg-accent-soft`,children:[Object.keys(H).map(e=>{let t=H[e];return(0,B.jsxs)(`button`,{type:`button`,disabled:k,"aria-pressed":h===e,onClick:()=>{g(h===e?null:e),O.current?.focus()},className:p(`inline-flex items-center gap-1.5 rounded-md px-2 py-2 hover:bg-surface-hover disabled:opacity-50`,h===e&&`bg-accent-soft text-accent-fg`),children:[(0,B.jsx)(t,{className:`size-3.5`,"aria-hidden":!0}),u.templateOptions[e].label]},e)}),(0,B.jsx)(`button`,{type:`button`,className:`text-xs text-fg-muted`,onClick:()=>window.dispatchEvent(new CustomEvent(`open-recording-recoveries`)),children:i.discussionCapture.recoveredTitle}),(0,B.jsx)(V,{})]})]})}function Pe(e,t){let n=Number(e.get(`page`)??0),r=Number.isSafeInteger(n)&&n>=0?n:0,i=e.get(`view`);return{projectId:e.get(`projectId`)||void 0,unassigned:e.get(`unassigned`)===`true`||i===`unassigned`||void 0,pinned:i===`favorites`?!0:void 0,agentEdited:i===`agent`||void 0,status:i===`archived`?`archived`:void 0,search:t.trim()||void 0,sortBy:`updatedAt`,sortOrder:`desc`,limit:12,offset:r*12}}function Fe(e){let t=e.snippet?.trim()??``,n=e.title?.trim();return n&&t.startsWith(n)?t.slice(n.length).replace(/^[\s::·—-]+/,``):t}function Ie(e,t,n){return e.kind===`voice`&&/^Discussion · \d{4}-\d{2}-\d{2} \d{2}:\d{2}$/.test(e.title??``)?n:e.title?.trim()||Fe(e).slice(0,48)||t}var U=`touch-target inline-flex min-h-9 items-center justify-center gap-2 rounded-lg px-3 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-50`;function W(){let e=h(e=>e.language),t=f(e).notes,n=t.home,r=ee(e=>e.conversationId),i=de(e=>e.setPageHeader),y=de(e=>e.clearPageHeader),x=s(),{pathname:w,search:T}=a(),[D,O]=o(),A=D.get(`projectId`)||``,M=D.get(`view`)||`all`,N=D.get(`unassigned`)===`true`||M===`unassigned`,P=D.get(`search`)||``,[fe]=Oe(P,250),[ge,F]=(0,z.useState)(A),[ye,Se]=(0,z.useState)(``),[ke,I]=(0,z.useState)(null),[L,R]=(0,z.useState)(!1),[V,je]=(0,z.useState)(!1),[Me,H]=(0,z.useState)(new Set),[W,G]=(0,z.useState)(null),[K,Le]=(0,z.useState)(null),q=(0,z.useRef)(new Set),J=(0,z.useRef)(null),Re=(0,z.useRef)(!1),ze=(0,z.useRef)(null),Be=Pe(D,fe),Y=(Be.offset??0)/12,{data:Ve,error:He,isLoading:Ue,mutate:We}=g(r?[`notes-home`,r,Be]:null,()=>Ee(Be)),{data:Ge,error:Ke,isLoading:X,mutate:qe}=g(r?[`notes-home-projects`,r]:null,Ce),Z=Ge?.items??[],Je=Z.filter(e=>e.noteCount>0).slice(0,2),Ye=Z.find(e=>e.id===A)?.name??n.projectNotes,Xe=Ve?.items??[],Q=Ve?.total??0,Ze=Ue||P!==fe,Qe=(0,z.useMemo)(()=>({justNow:t.justNow,minutesAgo:t.minutesAgo,today:t.today,yesterday:t.yesterday,daysAgo:t.daysAgo,locale:m(e)}),[e,t.justNow,t.minutesAgo,t.today,t.yesterday,t.daysAgo]),[$e,et]=(0,z.useState)(()=>Date.now());(0,z.useEffect)(()=>{F(A)},[A]),(0,z.useEffect)(()=>{let e=window.setInterval(()=>et(Date.now()),6e4);return()=>window.clearInterval(e)},[]);let $=(0,z.useCallback)(()=>{We().catch(()=>void 0),qe().catch(()=>void 0)},[We,qe]);(0,z.useEffect)(()=>{let e=[`note-updated`,`note-created`,`note-deleted`,`project-updated`,`project-created`,`project-deleted`];return e.forEach(e=>window.addEventListener(e,$)),()=>e.forEach(e=>window.removeEventListener(e,$))},[$]);let tt=(0,z.useCallback)((e,t=!1)=>{let n=`${w}${T}`,r=new URLSearchParams({returnTo:n});t&&r.set(`edit`,`1`),x(`/notes/${encodeURIComponent(e)}?${r}`)},[w,T,x]),nt=(0,z.useCallback)(async()=>{if(!(Re.current||!r)){Re.current=!0,R(!0),I(null),J.current??={key:crypto.randomUUID(),projectId:A||void 0};try{let e=await v({markdown:``,kind:`thought`,projectId:J.current.projectId},J.current.key);J.current=null,$(),tt(e.id,!0)}catch(e){I(`${t.createBlankFailed}: ${e instanceof Error?e.message:t.createBlankFailedHint}`)}finally{Re.current=!1,R(!1)}}},[A,t.createBlankFailed,t.createBlankFailedHint,tt,$,r]),rt=(0,z.useCallback)(e=>{O(t=>{let n=new URLSearchParams(t);return e?n.set(`search`,e):n.delete(`search`),n.delete(`page`),n},{replace:!0})},[O]);function it(e,t=`all`){let n=new URLSearchParams;e&&n.set(`projectId`,e),t===`unassigned`?n.set(`unassigned`,`true`):t!==`all`&&n.set(`view`,t),F(e),O(n)}function at(e){O(t=>{let n=new URLSearchParams(t);return N&&n.set(`unassigned`,`true`),e===`all`?n.delete(`view`):n.set(`view`,e),n.delete(`page`),n})}async function ot(e,n){if(!q.current.has(e)){q.current.add(e),H(new Set(q.current)),I(null);try{await j(e,{pinned:n}),$()}catch(e){I(`${t.actionFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{q.current.delete(e),H(new Set(q.current))}}}async function st(){let e=W;if(!(!e||K)){G(null),Le(e.id),I(null);try{await we(e.id),window.dispatchEvent(new CustomEvent(`note-deleted`,{detail:{noteId:e.id}})),$()}catch(e){I(`${t.deleteFailed}: ${e instanceof Error?e.message:t.quickCaptureFailedHint}`)}finally{Le(null)}}}if((0,z.useLayoutEffect)(()=>{if(!r){y();return}return i({startExtra:null,main:(0,B.jsx)(`h1`,{className:`truncate text-base font-semibold text-fg`,children:t.title}),end:(0,B.jsx)(`div`,{className:p(`flex min-w-0 items-center gap-2`,re),children:(0,B.jsxs)(`label`,{className:`flex h-9 w-32 min-w-0 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-2 sm:w-48`,children:[(0,B.jsx)(pe,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,B.jsx)(`input`,{ref:ze,type:`search`,value:P,onChange:e=>rt(e.target.value),"aria-label":t.searchDialogTitle,placeholder:t.searchPlaceholder,className:`min-w-0 flex-1 bg-transparent text-sm text-fg outline-none placeholder:text-fg-muted`})]})})}),()=>y()},[y,nt,L,n.blankNote,t.searchDialogTitle,t.searchPlaceholder,t.title,P,i,rt,r]),(0,z.useEffect)(()=>{let e=e=>{!(e.metaKey||e.ctrlKey)||e.altKey||e.isComposing||e.target?.closest(`input, textarea, [contenteditable="true"], [role="dialog"]`)||(e.key.toLowerCase()===`n`&&(e.preventDefault(),nt()),e.key.toLowerCase()===`f`&&(e.preventDefault(),ze.current?.focus()))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[nt]),!r)return(0,B.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-sm text-fg-muted`,children:t.needToken});let ct=[{id:`all`,label:n.homeNav,Icon:be},{id:`favorites`,label:n.favorites,Icon:_e},{id:`unassigned`,label:n.unassigned,Icon:ie},{id:`archived`,label:t.filterArchived,Icon:ae}],lt=A?`project:${A}`:N?`unassigned`:`all`,ut=!Ze&&!He&&Q===0&&!A&&!N&&!P&&M===`all`;return(0,B.jsxs)(`div`,{className:`flex h-full min-h-0 w-full flex-1 overflow-hidden bg-surface-panel`,children:[(0,B.jsxs)(`aside`,{className:`hidden w-44 shrink-0 flex-col gap-1 overflow-y-auto px-3 py-6 xl:flex`,"aria-label":n.homeNav,children:[ct.map(({id:e,label:t,Icon:n})=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>it(``,e),"aria-current":!A&&(e===`unassigned`?N:!N&&M===e)?`page`:void 0,className:p(U,`justify-start px-2 text-left text-xs`,!A&&(e===`unassigned`?N:!N&&M===e)&&`bg-surface-hover font-medium text-fg`),children:[(0,B.jsx)(n,{className:`size-4 shrink-0`,"aria-hidden":!0}),t]},e)),(0,B.jsx)(`span`,{className:`mb-1 mt-7 px-2 text-xs text-fg-muted`,children:n.projects}),X?[0,1,2].map(e=>(0,B.jsx)(_,{className:`mb-2 h-8 w-full`},e)):Z.slice(0,8).map(e=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>it(e.id),"aria-current":A===e.id?`page`:void 0,className:p(U,`justify-start px-2 text-left text-xs`,A===e.id&&`bg-surface-hover font-medium text-fg`),children:[(0,B.jsx)(oe,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>x(`/projects`),className:p(U,`mt-2 justify-start px-2 text-xs`),children:[n.allProjects,(0,B.jsx)(ve,{className:`ml-auto size-3`,"aria-hidden":!0})]})]}),(0,B.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,B.jsxs)(`div`,{className:`mx-auto flex w-full max-w-7xl flex-col px-4 pb-4 pt-3 sm:px-6 sm:pb-7 lg:px-8 lg:pb-9 lg:pt-4`,children:[(0,B.jsxs)(`div`,{className:`mb-5 flex flex-wrap items-start justify-between gap-4`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h2`,{className:`min-w-0 break-words text-2xl font-semibold tracking-tight text-fg`,children:A?Ye:N?n.unassigned:ut?n.firstNoteTitle:n.continueTitle}),(0,B.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:A?n.projectDescription:ut?n.firstNoteDescription:n.continueDescription})]}),A?(0,B.jsxs)(`button`,{type:`button`,onClick:()=>x(`/projects/${encodeURIComponent(A)}`),className:p(U,`text-xs`),children:[n.openProject,(0,B.jsx)(ve,{className:`size-3.5`,"aria-hidden":!0})]}):null]}),ke?(0,B.jsx)(`p`,{className:`mb-4 rounded-lg border border-danger/25 bg-danger-soft px-3 py-2 text-sm text-danger`,role:`alert`,children:ke}):null,(0,B.jsxs)(`section`,{"aria-label":n.startAction,children:[(0,B.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>void nt(),disabled:L,className:`touch-target flex min-h-20 items-center gap-3 rounded-xl border border-edge bg-surface-panel p-4 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[L?(0,B.jsx)(d,{className:`size-5 shrink-0 animate-spin text-fg-muted`,"aria-hidden":!0}):(0,B.jsx)(ne,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:n.blankNote}),(0,B.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:n.blankActionHint})]})]}),(0,B.jsxs)(`button`,{type:`button`,"aria-label":n.recordAction,onClick:()=>S(A||void 0),className:`touch-target flex min-h-20 items-center gap-3 rounded-xl border border-edge bg-surface-panel p-4 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,B.jsx)(ce,{className:`size-5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:n.recordAction}),(0,B.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:n.recordActionHint})]})]})]}),(0,B.jsxs)(`button`,{type:`button`,onClick:()=>{je(e=>!e),V||window.requestAnimationFrame(()=>document.getElementById(`notes-home-prompt`)?.focus())},"aria-expanded":V,"aria-controls":`notes-home-agent-composer`,title:n.agentActionHint,className:`touch-target mt-2 inline-flex min-h-11 items-center gap-2 rounded-lg px-2 text-sm text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,B.jsx)(De,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),n.agentAction,(0,B.jsx)(c,{className:p(`size-4 transition-transform`,V&&`rotate-180`),"aria-hidden":!0})]}),(0,B.jsx)(`div`,{id:`notes-home-agent-composer`,hidden:!V,className:p(`mt-3`,!V&&`hidden`),children:(0,B.jsx)(Ne,{projects:Z,projectId:ge,onProjectChange:F,onCreated:$,labels:t,projectsLoading:X,projectsError:!!Ke})})]}),Ke?(0,B.jsxs)(`div`,{role:`alert`,className:`mt-4 flex items-center gap-3 text-xs text-danger`,children:[(0,B.jsx)(`span`,{children:n.projectsLoadFailed}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void qe().catch(()=>void 0),className:`underline`,children:n.retry})]}):null,ut?null:(0,B.jsxs)(`section`,{className:`mt-8 pb-6`,"aria-label":n.recentNotes,children:[(0,B.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:M===`favorites`?n.favorites:M===`archived`?t.filterArchived:A?n.projectNotes:n.recentNotes}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-pressed":M===`agent`,onClick:()=>at(M===`agent`?`all`:`agent`),className:p(`touch-target rounded-md px-2 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,M===`agent`&&`bg-accent-soft text-accent-fg`),children:n.agentEdited}),(0,B.jsx)(`span`,{className:`hidden text-xs text-fg-muted xl:inline`,children:n.sortUpdated}),(0,B.jsx)(`div`,{className:`w-48 max-w-full xl:hidden`,children:(0,B.jsx)(l,{value:lt,allowEmpty:!1,ariaLabel:n.projects,placeholder:n.allNotes,options:[{value:`all`,label:n.allNotes},{value:`unassigned`,label:n.unassigned},...Z.filter(e=>e.name.toLowerCase().includes(ye.toLowerCase())).map(e=>({value:`project:${e.id}`,label:e.name}))],selectedLabel:A?Ye:N?n.unassigned:n.allNotes,triggerClassName:`h-8 bg-surface-panel text-xs`,loading:X,searchPlaceholder:n.projectSearch,searchValue:ye,onSearchChange:Se,onChange:e=>it(e.startsWith(`project:`)?e.slice(8):``,e===`unassigned`?e:`all`)})})]})]}),(0,B.jsxs)(te,{className:`flex flex-wrap items-center gap-x-5 border-b border-edge xl:hidden`,"aria-label":t.libraryTitle,role:`group`,children:[[{id:`all`,label:t.filterAll},{id:`favorites`,label:n.favorites},{id:`archived`,label:t.filterArchived}].map(({id:e,label:t})=>(0,B.jsx)(`button`,{type:`button`,"aria-pressed":M===e||e===`all`&&M===`unassigned`,onClick:()=>at(e),className:p(`touch-target border-b-2 border-transparent py-3 text-xs text-fg-muted hover:text-fg`,(M===e||e===`all`&&M===`unassigned`)&&`border-fg font-medium text-fg`),children:t},e)),(0,B.jsx)(`span`,{className:`ml-auto py-3 text-xs text-fg-muted`,children:n.sortUpdated})]}),He?(0,B.jsxs)(`div`,{className:`py-10 text-center`,role:`alert`,children:[(0,B.jsx)(`p`,{className:`text-sm text-danger`,children:n.loadFailed}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void We().catch(()=>void 0),className:p(U,`mt-2`),children:n.retry})]}):Ze?(0,B.jsx)(`div`,{"aria-busy":`true`,className:`divide-y divide-edge`,children:[0,1,2,3].map(e=>(0,B.jsxs)(`div`,{className:`flex items-center gap-3 py-4`,children:[(0,B.jsx)(_,{className:`h-10 w-8 shrink-0`}),(0,B.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,B.jsx)(_,{className:`h-4 w-2/3`}),(0,B.jsx)(_,{className:`h-3 w-1/2`})]})]},e))}):Xe.length===0?(0,B.jsxs)(`div`,{className:`flex flex-col items-center px-4 py-12 text-center`,children:[(0,B.jsx)(be,{className:`mb-4 size-8 text-fg-muted`,strokeWidth:1.3,"aria-hidden":!0}),(0,B.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:P||M!==`all`&&M!==`unassigned`?n.noMatches:A?n.projectEmpty:n.emptyTitle}),(0,B.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:P||M!==`all`&&M!==`unassigned`?n.noMatchesHint:A?n.projectEmptyHint:n.emptyDescription})]}):(0,B.jsx)(`ul`,{className:`divide-y divide-edge`,children:Xe.map(e=>{let r=e.voiceAttachmentId||e.kind===`voice`?E:e.kind===`bookmark`?b:le,i=Ie(e,t.titlePlaceholder,n.voiceNote),a=Fe(e)||(e.coverAttachmentId?t.imageNote:t.noText);return(0,B.jsxs)(`li`,{className:`group flex min-w-0 items-center gap-3 py-4`,children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>tt(e.id),className:`touch-target flex min-w-0 flex-1 items-center gap-3 rounded-md text-left focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,B.jsx)(`span`,{className:`flex h-10 w-8 shrink-0 items-center justify-center rounded-md border border-edge text-fg-muted`,children:(0,B.jsx)(r,{className:`size-4`,"aria-hidden":!0})}),(0,B.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,B.jsx)(`span`,{className:`block truncate text-base font-medium text-fg sm:text-sm group-hover:text-accent-fg`,children:i}),(0,B.jsxs)(`span`,{className:`mt-1 flex min-w-0 items-center gap-1.5 text-xs text-fg-muted`,children:[e.lastEditTrigger===`ai_edit`?(0,B.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-accent-fg`,children:[(0,B.jsx)(De,{className:`size-3`,"aria-hidden":!0}),n.agentEditLabel,(0,B.jsx)(`span`,{"aria-hidden":!0,children:`·`})]}):null,(0,B.jsx)(`span`,{className:`truncate`,children:a})]}),(0,B.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`mt-1.5 block text-xs text-fg-muted sm:hidden`,children:Ae(e.updatedAt,$e,Qe)})]})]}),(0,B.jsx)(`span`,{className:`hidden max-w-32 truncate text-xs text-fg-muted md:block`,title:e.projects?.map(e=>e.name).join(` · `),children:e.projects?.map(e=>e.name).join(` · `)||n.unassigned}),(0,B.jsx)(`time`,{dateTime:new Date(e.updatedAt).toISOString(),className:`hidden w-24 shrink-0 text-right text-xs text-fg-muted sm:block`,children:Ae(e.updatedAt,$e,Qe)}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>void ot(e.id,!e.pinned),disabled:Me.has(e.id),"aria-label":`${e.pinned?n.unfavorite:n.favorite}: ${i}`,"aria-pressed":!!e.pinned,className:`touch-target inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-accent`,children:(0,B.jsx)(_e,{className:p(`size-4`,e.pinned&&`fill-current text-fg`),"aria-hidden":!0})}),(0,B.jsxs)(se,{children:[(0,B.jsx)(Te,{asChild:!0,children:(0,B.jsx)(`button`,{type:`button`,disabled:K===e.id,"aria-label":`${t.noteActions}: ${i}`,className:`touch-target inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50 focus-visible:ring-2 focus-visible:ring-accent`,children:K===e.id?(0,B.jsx)(d,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,B.jsx)(u,{className:`size-4`,"aria-hidden":!0})})}),(0,B.jsx)(xe,{children:(0,B.jsx)(k,{align:`end`,sideOffset:4,className:`z-50 min-w-36 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:(0,B.jsxs)(he,{className:`touch-target flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-danger-soft focus:bg-danger-soft`,onSelect:()=>G(e),children:[(0,B.jsx)(ue,{className:`size-4`,"aria-hidden":!0}),t.delete]})})})]})]},e.id)})}),!Ze&&!He&&Q>0?(0,B.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-between gap-3 text-xs text-fg-muted`,"aria-live":`polite`,children:[(0,B.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(Q))}),Q>12||Y>0?(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`button`,{type:`button`,"aria-label":n.previousPage,disabled:Y===0,className:U,onClick:()=>O(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(Y-1)),t}),children:(0,B.jsx)(C,{className:`size-4`,"aria-hidden":!0})}),(0,B.jsxs)(`span`,{children:[Y+1,` / `,Math.max(1,Math.ceil(Q/12))]}),(0,B.jsx)(`button`,{type:`button`,"aria-label":n.nextPage,disabled:(Y+1)*12>=Q,className:U,onClick:()=>O(e=>{let t=new URLSearchParams(e);return t.set(`page`,String(Y+1)),t}),children:(0,B.jsx)(ve,{className:`size-4`,"aria-hidden":!0})})]}):null]}):null]}),!A&&!N&&(X||Je.length>0)?(0,B.jsxs)(`section`,{className:`mt-8`,"aria-label":n.continueProjects,children:[(0,B.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,B.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.continueProjects}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>x(`/projects`),className:`text-xs text-fg-muted hover:text-fg`,children:n.allProjects})]}),(0,B.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:X?[0,1].map(e=>(0,B.jsx)(_,{className:`h-28 w-full`},e)):Je.map(e=>(0,B.jsxs)(`button`,{type:`button`,onClick:()=>it(e.id),className:`min-w-0 rounded-lg border border-edge bg-surface-panel p-3 text-left transition-colors sm:p-4 hover:bg-surface-base focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,B.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium text-fg`,children:[(0,B.jsx)(oe,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`truncate`,children:e.name})]}),e.description?(0,B.jsx)(`p`,{className:`mt-2 hidden line-clamp-1 text-xs text-fg-muted sm:block`,children:e.description}):null,(0,B.jsxs)(`span`,{className:`mt-2 flex flex-wrap items-center justify-between gap-1 text-xs text-fg-muted sm:mt-3`,children:[(0,B.jsx)(`span`,{children:t.noteCount.replace(`{{count}}`,String(e.noteCount))}),(0,B.jsx)(`span`,{children:e.updatedAt?Ae(e.updatedAt,$e,Qe):n.emptyProject})]})]},e.id))})]}):null]})}),(0,B.jsx)(me,{open:W!==null,title:t.deleteConfirmTitle,description:t.deleteConfirmDescription.replace(`{{title}}`,W?.title||t.titlePlaceholder),confirmLabel:t.deleteConfirmLabel,cancelLabel:t.deleteCancelLabel,destructive:!0,onConfirm:()=>void st(),onCancel:()=>G(null)})]})}function G(){let e=(0,R.c)(12),{noteId:t}=i(),n=s(),[r]=o(),a;e[0]===r?a=e[1]:(a=fe(r.get(`returnTo`),`/notes`,[`/chat`,`/personal`,`/projects`,`/notes`,`/tasks`]),e[0]=r,e[1]=a);let c=a,l;e[2]!==n||e[3]!==c?(l=()=>{n(c)},e[2]=n,e[3]=c,e[4]=l):l=e[4];let u=l;if(!t)return null;let d=r.get(`edit`)===`1`?`wysiwyg`:`preview`,f;e[5]===r?f=e[6]:(f=r.get(`edit`),e[5]=r,e[6]=f);let p=f===`1`,m;return e[7]!==u||e[8]!==t||e[9]!==d||e[10]!==p?(m=(0,B.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-6xl flex-1 flex-col`,children:(0,B.jsx)(L,{noteId:t,onBack:u,initialMode:d,autoFocus:p},t)}),e[7]=u,e[8]=t,e[9]=d,e[10]=p,e[11]=m):m=e[11],m}function K(){let e=(0,R.c)(2),{noteId:t}=i(),n;return e[0]===t?n=e[1]:(n=t?(0,B.jsx)(G,{}):(0,B.jsx)(W,{}),e[0]=t,e[1]=n),n}export{K as NotesPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{l as r,u as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as a}from"./loader-circle-CifKLtgG.js";import{t as o}from"./messages-RzwPiQNL.js";import{l as s,n as c}from"./locale-store-JogcXC4J.js";import{t as l}from"./session-manager-B2HDomj4.js";import{d as u,id as d,oc as f,u as p}from"./index-ygkHNYyo.js";var m=e(t(),1),h=n();function g({resource:e,selection:t,label:n,disabled:g=!1}){let _=o(c(e=>e.language)).chat.pageContext,v=i(),y=r().key,[b,x]=(0,m.useState)(!1),[S,C]=(0,m.useState)(!1),w=(0,m.useRef)(!1),T=(0,m.useRef)(0),E=s(e=>e.baseUrl),D=s(e=>e.conversationId);(0,m.useEffect)(()=>(w.current=!1,x(!1),C(!1),()=>{T.current+=1}),[y,e.kind,e.id,e.revision,t?.text,t?.draft,g,E,D]);async function O(){if(g||w.current)return;w.current=!0,x(!0),C(!1);let n=T.current,r=()=>T.current===n&&s.getState().baseUrl===E&&s.getState().conversationId===D;try{let n=u.capture({title:``,text:``,resourceRefs:[e],selection:t}),i=await f(`xopc.context.resolve`,n.envelope);if(!r())return;let a=i.resources[0];if(i.resources.length!==1||JSON.stringify(i.snapshot)!==JSON.stringify(n.envelope)||a.reference.kind!==e.kind||a.reference.id!==e.id||a.reference.revision!==e.revision)throw Error(`Context mismatch`);n.title=a.title,n.preview=a.text,n.truncated=a.truncated;let o=await new l().createSession();if(!r())return;if(!u.put(p(E,D,o.key),n))throw Error(`Context draft limit reached`);v(`/chat/${encodeURIComponent(o.key)}`)}catch{r()&&C(!0)}finally{T.current===n&&(w.current=!1,x(!1))}}return(0,h.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-1`,children:[(0,h.jsxs)(`button`,{type:`button`,disabled:g||b,onClick:()=>void O(),"aria-busy":b,title:g?_.unavailable:n??_.capture,className:`inline-flex min-h-9 items-center gap-1.5 rounded-lg border border-edge px-2.5 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:[b?(0,h.jsx)(a,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,h.jsx)(d,{className:`size-3.5`,"aria-hidden":!0}),n??_.capture]}),S?(0,h.jsx)(`p`,{role:`alert`,className:`max-w-72 text-xs text-danger`,children:_.unavailable}):null]})}export{g as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./popover-select-DGKUpVsz.js";import{t as s}from"./messages-RzwPiQNL.js";import{i as c,n as l,o as u}from"./locale-store-JogcXC4J.js";import{T as d,d as f,t as p}from"./session-manager-B2HDomj4.js";import{t as m}from"./skeleton-BI5TyibZ.js";import{a as h,i as g,o as _,r as v,s as y,t as b}from"./dist-C3DSFZCi.js";import{Ac as x,B as S,Bo as ee,El as C,Fo as w,Jd as T,Jl as E,K as D,Kd as O,Qo as te,Su as k,V as A,Wa as j,Wl as M,Xo as N,Za as P,el as ne,io as re,ml as F,n as ie,qc as ae,qd as oe,ri as I}from"./index-ygkHNYyo.js";import{l as L,n as se,t as ce}from"./voice-config-api-D7xsWrdh.js";import{t as R}from"./date-formatters-DukWSVwc.js";var z=n(),B=e(t(),1),V=r(),H=[`intro`,`identity`,`voice`,`connections`],le=[{id:`loopi`,zh:`Loopi`,en:`Loopi`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`},{id:`loopi-care`,zh:`温和`,en:`Gentle`}];function U(e){return!!(e?.enabled&&(e.status===`connected`||e.connectionStatus===`connected`||e.authStatus===`connected`))}async function W(e,t){let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(t)});await u(c(`/api/agents/${encodeURIComponent(e)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:n.slice(n.indexOf(`,`)+1),mimeType:t.type})}),P(e)}function ue({modelsAvailable:e,onCreated:t}){let n=l(e=>e.language)===`zh`,r=l(e=>e.language),[o,d]=(0,B.useState)(`intro`),[f,p]=(0,B.useState)({displayName:`Ada`,appearance:`loopi`,voice:null}),[h,g]=(0,B.useState)(!1),[_,v]=(0,B.useState)(!1),[y,b]=(0,B.useState)(null),[x,C]=(0,B.useState)(null),[w,E]=(0,B.useState)(null),[O,k]=(0,B.useState)(null),[P,re]=(0,B.useState)(!0),[F,ie]=(0,B.useState)([]),[ae,I]=(0,B.useState)(null),R=(0,B.useRef)(null),z=(0,B.useRef)(null),[ue,de]=(0,B.useState)([]),[G,fe]=(0,B.useState)(!0),[pe,K]=(0,B.useState)([]),[q,J]=(0,B.useState)(null);(0,B.useEffect)(()=>{let e=!1;return u(c(`/api/personal-agent/onboarding`)).then(t=>{e||(d(t.payload.step),p(t.payload.draft))}).catch(t=>{e||b(t instanceof Error?t.message:String(t))}).finally(()=>{e||g(!0)}),()=>{e=!0}},[]),(0,B.useEffect)(()=>{if(!h)return;let e=window.setTimeout(()=>{u(c(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:o,draft:f})}).catch(()=>{})},350);return()=>window.clearTimeout(e)},[f,h,o]),(0,B.useEffect)(()=>{let e=!1;return ce().then(t=>{e||(t.tts&&t.enabled?k({provider:t.tts.provider,model:t.tts.model,enabled:!0}):re(!1))}).catch(()=>{e||re(!1)}),()=>{e=!0}},[]),(0,B.useEffect)(()=>{if(!O?.enabled)return;let e=!1;return se(O.provider,O.model,`realtime`).then(t=>{e||ie(t.slice(0,12))}).catch(()=>{}).finally(()=>{e||re(!1)}),()=>{e=!0}},[O]),(0,B.useEffect)(()=>{if(o!==`connections`)return;let e=!1;return fe(!0),Promise.allSettled([N({page:1,pageSize:24,verification:`verified`}),te()]).then(([t,n])=>{if(!e){if(t.status===`fulfilled`){let e=[`gmail`,`googlecalendar`,`googledrive`,`github`,`linear`];de(t.value.connectors.filter(t=>t.runtime.type===`composio`&&e.includes(t.runtime.toolkit)).sort((t,n)=>e.indexOf(t.runtime.type===`composio`?t.runtime.toolkit:``)-e.indexOf(n.runtime.type===`composio`?n.runtime.toolkit:``)))}n.status===`fulfilled`&&K(n.value),fe(!1)}}),()=>{e=!0}},[o]),(0,B.useEffect)(()=>()=>{z.current?.abort(),R.current?.close()},[]),(0,B.useEffect)(()=>()=>{w&&URL.revokeObjectURL(w)},[w]);let me=async(e,t=f)=>{await u(c(`/api/personal-agent/onboarding`),{method:`PUT`,body:JSON.stringify({step:e,draft:t})}),d(e)},Y=async e=>{b(null);let t=H[Math.max(0,Math.min(H.length-1,H.indexOf(o)+e))];try{await me(t)}catch(e){b(e instanceof Error?e.message:String(e))}},he=async(n=!1)=>{if(!(!e||_)){v(!0),b(null);try{let e=n?{displayName:`Ada`,appearance:`loopi`,voice:null}:f,r=e.voice&&O?.enabled&&F.some(t=>t.id===e.voice)?{provider:O.provider,model:O.model,voice:e.voice}:void 0,i=(await u(c(`/api/personal-agent`),{method:`POST`,body:JSON.stringify({displayName:e.displayName.trim()||`Ada`,appearance:e.appearance,...r?{voicePreference:r}:{}})})).payload,a=!1;if(!n&&x)try{await W(i.agentId,x),i=(await u(c(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:i.revision,displayName:i.displayName,appearance:`custom`})})).payload}catch{a=!0}t(i,a)}catch(e){b(e instanceof Error?e.message:String(e))}finally{v(!1)}}},X=(0,B.useCallback)(async e=>{z.current?.abort(),R.current?.close();let t=new AbortController;z.current=t,I(e),b(null);try{let n=new ee;R.current=n,await n.start();let r=await L(t.signal,e);if(t.signal.aborted)return;n.enqueue(r,()=>I(null))}catch(e){t.signal.aborted||b(e instanceof Error?e.message:String(e)),I(null)}},[]);if(!h)return(0,V.jsxs)(`div`,{className:`mx-auto w-full max-w-xl space-y-4 px-6 py-14`,children:[(0,V.jsx)(m,{className:`h-10 w-2/3`}),(0,V.jsx)(m,{className:`h-64 w-full rounded-2xl`}),(0,V.jsx)(m,{className:`h-12 w-full rounded-xl`})]});let Z=H.indexOf(o),ge={intro:n?`创建一个和你一起做事的助手`:`Create an assistant to work with you`,identity:n?`先给它一个形象和名字`:`Choose a look and a name`,voice:n?`想让我用什么声音回应?`:`How should your assistant sound?`,connections:n?`要让我了解哪些信息?`:`What information can your assistant use?`}[o];return(0,V.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-surface-base`,children:[(0,V.jsx)(`header`,{className:`shrink-0 px-5 pt-5 sm:px-8 sm:pt-7`,children:(0,V.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-10 items-center justify-between gap-4`,children:[Z>0?(0,V.jsxs)(`button`,{type:`button`,disabled:_,onClick:()=>void Y(-1),className:`-ml-2 inline-flex min-h-10 items-center gap-1.5 rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:[(0,V.jsx)(T,{className:`size-4`}),n?`上一步`:`Back`]}):(0,V.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n?`设置我的助手`:`Set up my assistant`}),(0,V.jsx)(i,{to:`/chat`,className:`-mr-2 inline-flex min-h-10 items-center rounded-lg px-2 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`稍后继续`:`Finish later`})]}),(0,V.jsx)(`div`,{className:`mt-4 grid grid-cols-4 gap-1.5`,role:`progressbar`,"aria-label":n?`设置进度`:`Setup progress`,"aria-valuenow":Z+1,"aria-valuemin":1,"aria-valuemax":H.length,children:H.map((e,t)=>(0,V.jsx)(`span`,{className:`h-1 rounded-full transition-colors duration-200 ${t<=Z?`bg-accent`:`bg-surface-active`}`},e))})]})}),(0,V.jsx)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-8 sm:px-8`,children:(0,V.jsxs)(`div`,{className:`mx-auto my-auto w-full max-w-2xl py-6 motion-safe:animate-[page-enter_220ms_ease-out]`,children:[(0,V.jsxs)(`div`,{className:`mb-8 flex items-center gap-4`,children:[(0,V.jsx)(`span`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-surface-hover`,children:w?(0,V.jsx)(`img`,{src:w,alt:``,className:`size-14 rounded-xl object-cover`}):(0,V.jsx)(j,{appearance:f.appearance,className:`size-14`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`我的助手`:`My assistant`}),(0,V.jsx)(`p`,{className:`mt-1 text-lg font-semibold text-fg`,children:f.displayName||`Ada`})]})]}),(0,V.jsx)(`p`,{className:`mb-3 text-xs font-medium tracking-wide text-fg-subtle`,children:n?`第 ${Z+1} 步 · 共 ${H.length} 步`:`Step ${Z+1} of ${H.length}`}),(0,V.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:ge}),o===`intro`&&(0,V.jsxs)(`div`,{className:`mt-6 max-w-xl space-y-3 text-base leading-8 text-fg-muted`,children:[(0,V.jsx)(`p`,{children:n?`你可以找它讨论问题,也可以交给它一件要推进的事。`:`Talk through a question or give it something to move forward.`}),(0,V.jsx)(`p`,{children:n?`需要深入处理时,它会找合适的 Agent,并把进展带回对话。`:`It can ask a suitable Agent for deeper work and bring the progress back.`}),(0,V.jsx)(`p`,{children:n?`它能使用哪些数据和设备,由你决定。`:`You choose which data and devices it can use.`})]}),o===`identity`&&(0,V.jsxs)(`div`,{className:`mt-7 space-y-7`,children:[(0,V.jsxs)(`label`,{className:`block text-sm font-medium text-fg`,children:[n?`助手名字`:`Assistant name`,(0,V.jsx)(`input`,{value:f.displayName,maxLength:60,onChange:e=>p(t=>({...t,displayName:e.target.value})),onBlur:()=>p(e=>({...e,displayName:e.displayName.trim()||`Ada`})),className:`mt-2 block w-full rounded-xl border border-edge bg-surface-panel px-4 py-3 text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`选择头像`:`Choose an avatar`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-4`,children:[le.map(e=>(0,V.jsxs)(`button`,{type:`button`,"aria-pressed":!x&&f.appearance===e.id,onClick:()=>{C(null),E(null),p(t=>({...t,appearance:e.id}))},className:`flex min-h-28 flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${!x&&f.appearance===e.id?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,V.jsx)(j,{appearance:e.id,className:`size-14`}),n?e.zh:e.en]},e.id)),(0,V.jsxs)(`label`,{className:`flex min-h-28 cursor-pointer flex-col items-center justify-center gap-2 rounded-2xl p-3 text-sm transition-colors focus-within:ring-2 focus-within:ring-accent ${x?`bg-accent/10 text-fg ring-1 ring-accent/40`:`bg-surface-panel text-fg-muted hover:bg-surface-hover`}`,children:[(0,V.jsx)(ne,{className:`size-6`}),n?`上传图片`:`Upload image`,(0,V.jsx)(`input`,{className:`sr-only`,type:`file`,accept:`image/png,image/jpeg,image/webp`,onChange:e=>{let t=e.target.files?.[0];if(t){if(t.size>512*1024||![`image/png`,`image/jpeg`,`image/webp`].includes(t.type)){b(n?`请选择不超过 512 KB 的 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image under 512 KB.`);return}C(t),E(URL.createObjectURL(t))}}})]})]}),(0,V.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:n?`自定义图片在创建助手时上传;刷新后需要重新选择。`:`Custom images upload when you create the assistant; select again after a refresh.`})]})]}),o===`voice`&&(0,V.jsxs)(`div`,{className:`mt-5`,children:[(0,V.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`用于这个助手的语音通话;文字回答不受影响。试听不会使用麦克风。`:`This affects calls with this assistant. Text stays the same. Preview does not use your microphone.`}),P?(0,V.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,V.jsx)(m,{className:`h-20 rounded-xl`}),(0,V.jsx)(m,{className:`h-20 rounded-xl`})]}):O?.enabled&&F.length>0?(0,V.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[(0,V.jsx)(`button`,{type:`button`,"aria-pressed":!f.voice,onClick:()=>p(e=>({...e,voice:null})),className:`rounded-xl p-4 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${f.voice?`bg-surface-panel text-fg-muted hover:bg-surface-hover`:`bg-accent/10 text-fg ring-1 ring-accent/40`}`,children:n?`使用默认声音`:`Use the default voice`}),F.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl p-3 transition-colors ${f.voice===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,V.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 rounded-lg text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-pressed":f.voice===e.id,onClick:()=>p(t=>({...t,voice:e.id})),children:[(0,V.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),(0,V.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description||e.style||(n?`点击选择`:`Select this voice`)})]}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>void X(e.id),className:`flex size-9 shrink-0 items-center justify-center rounded-full bg-surface-hover text-fg hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`试听${e.name}`:`Preview ${e.name}`,children:(0,V.jsx)(M,{className:`size-4 ${ae===e.id?`text-accent`:``}`})})]},e.id))]}):(0,V.jsxs)(`div`,{className:`mt-5 rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:[(0,V.jsx)(`p`,{children:n?`当前没有可试听的语音。你可以先用文字对话,稍后再设置。`:`No voice is ready to preview. You can start with text and set it up later.`}),(0,V.jsx)(i,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`mt-3 inline-block text-accent hover:underline`,children:n?`设置语音服务`:`Set up voice`})]})]}),o===`connections`&&(0,V.jsxs)(`div`,{className:`mt-5`,children:[(0,V.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:n?`现在连接,或进入对话后再添加。连接不会自动读取历史数据或创建持续关注。`:`Connect now or add sources later. Connecting does not automatically scan history or create ongoing monitoring.`}),G?(0,V.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,V.jsx)(m,{className:`h-18 rounded-xl`}),(0,V.jsx)(m,{className:`h-18 rounded-xl`})]}):(0,V.jsx)(`div`,{className:`mt-5 space-y-2`,children:ue.length?ue.map(e=>{let t=U(pe.find(t=>t.connectorId===e.id));return(0,V.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel p-4`,children:[(0,V.jsx)(A,{connector:e,size:`sm`}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,V.jsx)(`p`,{className:`line-clamp-2 text-xs text-fg-muted`,children:e.description})]}),t?(0,V.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-success`,children:[(0,V.jsx)(a,{className:`size-4`}),n?`已连接`:`Connected`]}):(0,V.jsx)(`button`,{type:`button`,onClick:()=>J(D(e)),className:`rounded-lg bg-surface-hover px-3 py-2 text-xs text-fg transition-colors hover:bg-surface-active focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`连接`:`Connect`})]},e.id)}):(0,V.jsx)(`p`,{className:`rounded-xl bg-surface-panel p-5 text-sm text-fg-muted`,children:n?`暂无可用的推荐服务;你仍可直接进入对话。`:`No suggested services are available. You can continue to chat.`})})]}),!e&&(0,V.jsxs)(`p`,{className:`mt-5 rounded-xl bg-warning/5 p-4 text-sm text-fg-muted`,children:[n?`开始前需要一个可用模型。`:`A compatible model is required before you start.`,` `,(0,V.jsx)(i,{to:`/settings/capabilities/models`,className:`text-accent underline`,children:n?`配置模型`:`Set up a model`})]}),y&&(0,V.jsx)(`p`,{role:`alert`,className:`mt-5 text-sm text-danger`,children:y})]},o)}),(0,V.jsx)(`footer`,{className:`shrink-0 px-5 pb-6 pt-3 sm:px-8 sm:pb-9`,children:(0,V.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col-reverse gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,V.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:n?`这些选择以后都能调整`:`You can change these choices later`}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[o===`intro`&&(0,V.jsx)(`button`,{type:`button`,disabled:!e||_,onClick:()=>void he(!0),className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-40`,children:n?`用默认设置开始`:`Use defaults`}),o===`voice`&&(0,V.jsx)(`button`,{type:`button`,onClick:()=>{let e={...f,voice:null};p(e),b(null),me(`connections`,e).catch(e=>b(e instanceof Error?e.message:String(e)))},className:`min-h-11 rounded-lg px-3 text-sm text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:n?`跳过`:`Skip`}),(0,V.jsxs)(`button`,{type:`button`,disabled:_||o===`connections`&&!e,onClick:()=>o===`connections`?void he():void Y(1),className:`flex min-h-11 items-center gap-2 rounded-xl bg-accent px-5 text-sm font-medium text-on-accent transition-colors hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 disabled:opacity-40`,children:[_?n?`正在创建…`:`Creating…`:o===`connections`?n?`进入对话`:`Start chatting`:n?`继续`:`Continue`,` `,!_&&(0,V.jsx)(oe,{className:`size-4`})]})]})]})}),q&&(0,V.jsx)(S,{draft:q,onChange:J,onClose:()=>J(null),t:s(r).connectorsSettings,onInstalled:async()=>{K(await te()),J(null)}})]})}function de({record:e,zh:t,onSelectVoice:n,onGreetingChange:r}){let[a,s]=(0,B.useState)(!1),[c,l]=(0,B.useState)(!0),[u,d]=(0,B.useState)(``),[f,p]=(0,B.useState)(null),[h,g]=(0,B.useState)([]),[_,v]=(0,B.useState)(e.voicePreference?.voice??``),[y,b]=(0,B.useState)(!1),[x,S]=(0,B.useState)(null),[C,w]=(0,B.useState)(null),T=(0,B.useRef)(null),E=(0,B.useRef)(null);(0,B.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await ce();if(e||(s(t.openingGreeting===!0),!t.enabled||!t.tts))return;let n={provider:t.tts.provider,model:t.tts.model};p(n);let r=await se(n.provider,n.model,`realtime`);e||g(r)}catch(t){e||S(t instanceof Error?t.message:String(t))}finally{e||l(!1)}})(),()=>{e=!0}},[]),(0,B.useEffect)(()=>()=>{E.current?.abort(),T.current?.close()},[]);let D=()=>{E.current?.abort(),E.current=null,T.current?.close(),T.current=null,w(null)},O=async e=>{if(C!==null){D();return}D(),S(null);let n=new AbortController;E.current=n,w(e);try{let t=new ee;T.current=t,await t.start();let r=await L(n.signal,e);n.signal.aborted||t.enqueue(r,()=>{E.current===n&&(w(null),E.current=null,T.current=null,t.close())})}catch(e){if(!n.signal.aborted){let n=e?.body?.error?.code;S(t&&n===`unsupported_voice`?`当前音色暂不可用,请刷新语音目录或选择其他音色。`:e instanceof Error?e.message:String(e))}E.current===n&&D()}},te=async e=>{if(y||e===_)return;D();let t=_;v(e),d(``),b(!0),S(null);try{await n(e&&f?{provider:f.provider,model:f.model,voice:e}:null)||v(t)}catch(e){v(t),S(e instanceof Error?e.message:String(e))}finally{b(!1)}},k=h.find(e=>e.id===_),A=t?`默认声音`:`Default voice`,j=k?.name||(_?t?`当前音色不可用`:`Current voice unavailable`:A),N=u.trim().toLocaleLowerCase(),P=h.filter(e=>!N||`${e.name} ${e.description??``} ${e.style??``}`.toLocaleLowerCase().includes(N)).map(e=>({value:e.id,label:e.name}));return(0,V.jsxs)(`section`,{className:`border-t border-edge pt-5`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:t?`通话声音`:`Call voice`}),c?(0,V.jsx)(`div`,{className:`mt-3`,"aria-busy":`true`,children:(0,V.jsx)(m,{className:`h-10 w-full`})}):f&&h.length?(0,V.jsxs)(`div`,{className:`mt-3 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,V.jsx)(o,{value:_,selectedLabel:j,options:P,placeholder:A,emptyLabel:A,ariaLabel:t?`选择通话音色`:`Choose call voice`,disabled:y,onChange:e=>void te(e),searchPlaceholder:h.length>8?t?`搜索音色`:`Search voices`:void 0,searchValue:u,onSearchChange:d,statusMessage:N&&!P.length?t?`没有匹配的音色`:`No matching voices`:void 0})}),(0,V.jsxs)(`button`,{type:`button`,disabled:y||!!(_&&!k),onClick:()=>void O(_),className:`touch-target flex h-10 shrink-0 items-center justify-center gap-1.5 rounded-lg border border-edge px-3 text-sm text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,title:C===null?t?`试听${j}`:`Preview ${j}`:t?`停止试听`:`Stop preview`,"aria-label":C===null?t?`试听${j}`:`Preview ${j}`:t?`停止试听`:`Stop preview`,children:[C===null?(0,V.jsx)(M,{className:`size-4`,"aria-hidden":!0}):(0,V.jsx)(F,{className:`size-4 text-accent`,"aria-hidden":!0}),C===null?t?`试听`:`Preview`:t?`停止`:`Stop`]})]}),(0,V.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:k?.description||k?.style||(_?t?`选择后自动保存,用于之后的语音通话。`:`Saved automatically for future voice calls.`:t?`跟随语音服务的默认音色。`:`Uses the voice service’s default voice.`)})]}):(0,V.jsxs)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:[t?`当前没有可用音色。`:`No voice is ready.`,` `,(0,V.jsx)(i,{to:`/settings/capabilities/models?configure=speech&returnTo=%2Fpersonal`,className:`text-accent underline`,children:t?`设置语音服务`:`Set up voice`})]}),r&&a&&(0,V.jsxs)(`label`,{className:`mt-4 flex items-center justify-between gap-3 text-sm text-fg`,children:[t?`连接时打招呼`:`Greet me when connected`,(0,V.jsx)(`input`,{type:`checkbox`,checked:e.voiceCallPreferences?.openingGreetingEnabled??!0,disabled:y,onChange:e=>{let t=e.target.checked;b(!0),r(t).catch(e=>S(String(e))).finally(()=>b(!1))}})]}),x&&(0,V.jsx)(`p`,{role:`alert`,className:`mt-3 text-xs text-danger`,children:x})]})}var G=new p;function fe({conversationId:e,zh:t,onSaved:n}){let r=d(t=>t.sessions[e]),[i,a]=(0,B.useState)(!0),[o,c]=(0,B.useState)(``);(0,B.useEffect)(()=>{let t=!0;return G.loadSessionAgentConfig(e).then(n=>{t&&f(e,n)}).catch(e=>{t&&c(String(e))}).finally(()=>{t&&a(!1)}),()=>{t=!1}},[e]);let l=!!r?.modelConfigSaving;async function u(t,i){d.getState().patchSessionMeta(e,{modelConfigSaving:!0});try{f(e,await G.patchSessionAgentConfig(e,{model:t,thinkingLevel:i,configVersion:r?.configVersion})),await n()}catch(t){let n=await G.loadSessionAgentConfig(e).catch(()=>null);throw n&&f(e,n),t}finally{d.getState().patchSessionMeta(e,{modelConfigSaving:!1})}}return(0,V.jsxs)(`section`,{children:[(0,V.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:t?`对话模型与思考强度`:`Conversation model and thinking`}),i?(0,V.jsx)(m,{className:`h-9 w-full`}):(0,V.jsx)(I,{chat:s(t?`zh`:`en`).chat,sessionModel:r?.model??``,thinkingLevel:r?.thinkingLevel??`off`,modelDisabled:l,thinkingDisabled:l,onModelChange:u,onThinkingChange:e=>u(r?.model??``,e)}),o&&(0,V.jsx)(`p`,{role:`alert`,className:`mt-2 text-sm text-danger`,children:o})]})}var pe=5;function K(e){let t=e.replace(/\s+/g,` `).trim();if(t.length<=58)return t;let n=t.replace(/([^)]{1,80})|\([^)]{1,80}\)/g,``).replace(/([A-Za-z0-9])(?=[\u4e00-\u9fff])/g,`$1 `).replace(/\s+/g,` `).trim(),r=n.split(/[。!?;;,]/,1)[0]?.trim()||n;return r.length>58?`${r.slice(0,57).trimEnd()}…`:r}function q(e,t){if(e.phase===`closed`)return{label:t?`已结束`:`Finished`,tone:`bg-fg-subtle`};let n=e.operationalState??e.runStatus;return n===`running`?{label:t?`正在执行`:`Working`,tone:`bg-accent`}:n===`queued`?{label:t?`等待开始`:`Queued`,tone:`bg-fg-subtle`}:n===`failed`?{label:t?`执行失败`:`Failed`,tone:`bg-danger`}:n===`waiting`?{label:t?`等待继续`:`Waiting`,tone:`bg-warning`}:n===`blocked`?{label:t?`已阻塞`:`Blocked`,tone:`bg-warning`}:n===`verifying`?{label:t?`正在验证`:`Verifying`,tone:`bg-accent`}:n===`cancelled`?{label:t?`执行已取消`:`Cancelled`,tone:`bg-fg-subtle`}:e.phase===`review`?{label:t?`等待验收`:`In review`,tone:`bg-warning`}:e.phase===`active`?{label:t?`正在推进`:`In progress`,tone:`bg-accent`}:e.phase===`ready`?{label:t?`准备开始`:`Ready`,tone:`bg-fg-subtle`}:{label:t?`待处理`:`Planned`,tone:`bg-fg-subtle`}}function J(e){let t=(0,z.c)(30),{item:n,zh:r}=e,a;t[0]!==n||t[1]!==r?(a=q(n,r),t[0]=n,t[1]=r,t[2]=a):a=t[2];let o=a,s;t[3]===n.id?s=t[4]:(s=x(`/personal`,n.id),t[3]=n.id,t[4]=s);let c=`mt-2 size-1.5 shrink-0 rounded-full ${o.tone}`,l;t[5]===c?l=t[6]:(l=(0,V.jsx)(`span`,{className:c,"aria-hidden":!0}),t[5]=c,t[6]=l);let u;t[7]===n.title?u=t[8]:(u=K(n.title),t[7]=n.title,t[8]=u);let d;t[9]===u?d=t[10]:(d=(0,V.jsx)(`span`,{className:`line-clamp-2 break-words text-sm font-medium leading-5 text-fg`,children:u}),t[9]=u,t[10]=d);let f;t[11]===o.label?f=t[12]:(f=(0,V.jsx)(`span`,{children:o.label}),t[11]=o.label,t[12]=f);let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,V.jsx)(`span`,{className:`text-fg-subtle`,"aria-hidden":!0,children:`·`}),t[13]=p):p=t[13];let m=r?`zh`:`en`,h;t[14]!==n.updatedAt||t[15]!==m?(h=R(n.updatedAt,m),t[14]=n.updatedAt,t[15]=m,t[16]=h):h=t[16];let g;t[17]===h?g=t[18]:(g=(0,V.jsx)(`span`,{children:h}),t[17]=h,t[18]=g);let _;t[19]!==g||t[20]!==f?(_=(0,V.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-2 text-xs text-fg-muted`,children:[f,p,g]}),t[19]=g,t[20]=f,t[21]=_):_=t[21];let v;t[22]!==_||t[23]!==d?(v=(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,_]}),t[22]=_,t[23]=d,t[24]=v):v=t[24];let y;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,V.jsx)(O,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-visible:opacity-100`,"aria-hidden":!0}),t[25]=y):y=t[25];let b;return t[26]!==v||t[27]!==s||t[28]!==l?(b=(0,V.jsxs)(i,{to:s,className:`group flex min-w-0 items-start gap-3 rounded-2xl bg-surface-panel px-4 py-4 transition-colors duration-150 hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[l,v,y]}),t[26]=v,t[27]=s,t[28]=l,t[29]=b):b=t[29],b}var me=[{id:`loopi`,zh:`Loopi`,en:`Loopi`,color:`bg-slate-100/50 dark:bg-slate-400/10`},{id:`loopi-curious`,zh:`好奇`,en:`Curious`,color:`bg-blue-100/50 dark:bg-blue-400/10`},{id:`loopi-care`,zh:`温和`,en:`Gentle`,color:`bg-violet-100/50 dark:bg-violet-400/10`}];function Y(){let e=w(),t=(0,B.useRef)(e);t.current=e;let n=l(e=>e.language)===`zh`,r=re(e=>e.setPageHeader),i=re(e=>e.clearPageHeader),[a,o]=(0,B.useState)(null),s=(0,B.useRef)(null),d=(0,B.useRef)(Promise.resolve()),[f,p]=(0,B.useState)([]),[x,S]=(0,B.useState)(!0),[ee,T]=(0,B.useState)(0),[D,O]=(0,B.useState)(null),[te,A]=(0,B.useState)(!1),[M,N]=(0,B.useState)(`loopi`),[F,oe]=(0,B.useState)(!1),I=(0,B.useRef)(null),L=(0,B.useRef)(null),se=(0,B.useRef)(null),[ce,R]=(0,B.useState)(``),[z,H]=(0,B.useState)(!1),[le,U]=(0,B.useState)(!1),[W,G]=(0,B.useState)(!1),[K,q]=(0,B.useState)(null),[Y,he]=(0,B.useState)(!1),[X,Z]=(0,B.useState)(!1),[ge,_e]=(0,B.useState)(!1),[Q,ve]=(0,B.useState)(0),$=(0,B.useRef)(0),ye=(0,B.useCallback)(()=>{G(!1),U(!1),H(!0)},[]),be=(0,B.useCallback)(()=>{G(!1),U(!1),H(e=>!e)},[]),xe=(0,B.useCallback)(async()=>{try{let[e,t]=await Promise.all([u(c(`/api/personal-agent`)),u(c(`/api/personal-agent/models`))]);s.current=e.payload,o(e.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e.payload})),e.payload&&window.dispatchEvent(new Event(`session-updated`)),p(t.payload),e.payload&&(R(e.payload.displayName),N(e.payload.appearance))}catch(e){O(e instanceof Error?e.message:String(e))}finally{S(!1)}},[]);(0,B.useEffect)(()=>{xe()},[xe]);let Se=(0,B.useCallback)(e=>{T(e=>e+1),O(null);let t=d.current.then(async()=>{let t=s.current;if(!t)return!1;let n=e.displayName?.trim()||t.displayName,r=e.appearance??t.appearance,i=e.voicePreference===void 0?t.voicePreference:e.voicePreference;if(n===t.displayName&&r===t.appearance&&JSON.stringify(i)===JSON.stringify(t.voicePreference)&&(!e.voiceCallPreferences||JSON.stringify(e.voiceCallPreferences)===JSON.stringify(t.voiceCallPreferences)))return!0;try{let a=await u(c(`/api/personal-agent/profile`),{method:`PATCH`,body:JSON.stringify({revision:t.revision,displayName:n,appearance:r,...e.voicePreference===void 0?{}:{voicePreference:i},...e.voiceCallPreferences?{voiceCallPreferences:e.voiceCallPreferences}:{}})});return s.current=a.payload,o(a.payload),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:a.payload})),!0}catch(e){return O(e instanceof Error?e.message:String(e)),!1}}).finally(()=>T(e=>e-1));return d.current=t,t},[]),Ce=(0,B.useCallback)(async()=>{let e=++$.current;G(!0),q(null),he(!1),Z(!1),_e(!1),ve(0);try{let t=await u(c(`/api/personal-agent/activity?limit=${pe}&offset=0`));if(e!==$.current)return;q(t.payload),ve(t.payload.items.length)}catch{e===$.current&&he(!0)}},[]),we=(0,B.useCallback)(async()=>{if(!K||X||Q>=K.total)return;let e=$.current;Z(!0),_e(!1);try{let t=await u(c(`/api/personal-agent/activity?limit=${pe}&offset=${Q}`));if(e!==$.current)return;q(e=>e?{total:t.payload.total,items:[...e.items,...t.payload.items.filter(t=>!e.items.some(e=>e.id===t.id))]}:t.payload),ve(e=>e+t.payload.items.length)}catch{e===$.current&&_e(!0)}finally{e===$.current&&Z(!1)}},[K,Q,X]);(0,B.useEffect)(()=>{if(!W||!K||X)return;let e,t=()=>{window.clearTimeout(e),e=window.setTimeout(async()=>{let e=$.current;try{let t=await u(c(`/api/personal-agent/activity?limit=${Math.max(pe,Math.min(100,Q))}&offset=0`));if(e!==$.current)return;q(t.payload),ve(t.payload.items.length)}catch{}},120)},n=window.setInterval(t,5e3);return window.addEventListener(`task-changed-v2`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.clearTimeout(e),window.clearInterval(n),window.removeEventListener(`task-changed-v2`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[K,Q,X,W]);let Te=async e=>{if(!a||![`image/png`,`image/jpeg`,`image/webp`].includes(e.type)){O(n?`请选择 PNG、JPEG 或 WebP 图片。`:`Choose a PNG, JPEG, or WebP image.`);return}if(e.size===0||e.size>512*1024){O(n?`图片大小不能超过 512 KB。`:`Image must be 512 KB or smaller.`);return}oe(!0),O(null);try{let t=await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>n(r.error),r.readAsDataURL(e)});await u(c(`/api/agents/${encodeURIComponent(a.agentId)}/avatar`),{method:`PUT`,body:JSON.stringify({base64:t.slice(t.indexOf(`,`)+1),mimeType:e.type})}),P(a.agentId),N(`custom`),U(!1),await Se({appearance:`custom`})}catch(e){O(e instanceof Error?e.message:String(e))}finally{oe(!1)}};(0,B.useLayoutEffect)(()=>{let o=a?.state===`ready`,s=o?a.appearance:M,c=o?a.displayName:`Ada`;return r({startExtra:null,main:(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[o?(0,V.jsx)(`button`,{ref:se,type:`button`,onClick:be,"aria-expanded":z,className:`touch-target -m-1 shrink-0 rounded-full p-1 transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`编辑${c}的资料`:`Edit ${c}'s profile`,title:n?`资料`:`Profile`,children:(0,V.jsx)(`span`,{className:`flex size-8 items-center justify-center`,children:(0,V.jsx)(j,{appearance:s,agentId:a?.agentId,className:`size-8`})})}):(0,V.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center`,children:(0,V.jsx)(j,{appearance:s,agentId:a?.agentId,className:`size-8`})}),(0,V.jsx)(`h1`,{className:`min-w-0 truncate text-sm font-semibold text-fg sm:text-base`,children:c})]}),end:o?(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(`button`,{type:`button`,disabled:e.active,onClick:()=>{a?.state===`ready`&&t.current.open({conversationId:a.conversationId,name:a.displayName,mode:`assistant`})},className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,"aria-label":n?`语音通话`:`Voice call`,title:n?`语音通话`:`Voice call`,children:(0,V.jsx)(E,{className:`size-5`})}),(0,V.jsxs)(_,{open:W,onOpenChange:e=>{e?Ce():G(!1)},children:[(0,V.jsx)(y,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,"aria-pressed":W,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`正在做的事`:`Activity`,children:(0,V.jsx)(k,{className:`size-5`})})}),(0,V.jsx)(h,{children:(0,V.jsxs)(g,{side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":n?`派发的任务`:`Delegated tasks`,className:`z-50 flex h-[min(34rem,calc(100dvh-6rem))] w-[min(22rem,calc(100vw-1rem))] min-h-0 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-xl focus:outline-none`,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 px-6 pb-3 pt-6`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`h2`,{className:`text-base font-semibold tracking-tight text-fg`,children:n?`交给我推进的事`:`Delegated work`}),(0,V.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:K?n?`最近更新 · 共 ${K.total} 项`:`Recently updated · ${K.total} total`:n?`查看任务进展与结果`:`Follow progress and results`})]}),(0,V.jsx)(v,{className:`touch-target -mr-2 -mt-1 rounded-lg p-2 text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":n?`关闭活动`:`Close activity`,children:(0,V.jsx)(ae,{className:`size-4`})})]}),(0,V.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-5 pt-3`,children:[!K&&!Y&&(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(m,{className:`h-18 rounded-2xl`}),(0,V.jsx)(m,{className:`h-18 rounded-2xl`}),(0,V.jsx)(m,{className:`h-18 rounded-2xl`})]}),Y&&(0,V.jsxs)(`div`,{className:`px-5 py-12 text-center`,children:[(0,V.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`暂时无法读取任务`:`Could not load tasks`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>void Ce(),className:`mt-3 rounded-lg px-3 py-2 text-sm text-accent hover:bg-surface-hover`,children:n?`重试`:`Try again`})]}),K?.items.length===0&&(0,V.jsxs)(`div`,{className:`px-5 py-16 text-center`,children:[(0,V.jsx)(k,{className:`mx-auto size-7 text-fg-subtle`,"aria-hidden":!0}),(0,V.jsx)(`p`,{className:`mt-4 text-sm font-medium text-fg`,children:n?`还没有派发的任务`:`No delegated work yet`}),(0,V.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n?`你可以在对话里直接告诉我想推进的事。`:`Tell me what you would like to move forward in chat.`})]}),K&&K.items.length>0&&(0,V.jsx)(`div`,{className:`space-y-2`,children:K.items.map(e=>(0,V.jsx)(J,{item:e,zh:n},e.id))}),K&&Q<K.total&&(0,V.jsxs)(`div`,{className:`pt-4 text-center`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:()=>void we(),disabled:X,className:`min-h-10 rounded-xl bg-surface-panel px-5 text-sm font-medium text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-50`,children:X?n?`正在加载…`:`Loading…`:n?`加载更多`:`Load more`}),ge&&(0,V.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-danger`,children:n?`加载失败,请重试`:`Could not load more. Try again.`})]})]})]})})]}),(0,V.jsx)(`button`,{ref:L,type:`button`,onClick:be,"aria-expanded":z,className:`touch-target rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":n?`编辑资料`:`Edit profile`,children:(0,V.jsx)(C,{className:`size-5`})})]}):null}),()=>i()},[K,Y,Q,X,ge,M,i,we,Ce,a,r,W,z,be,e.active,n]);function Ee(){return a?(0,V.jsxs)(_,{open:z,onOpenChange:e=>{H(e),e||U(!1)},children:[(0,V.jsx)(b,{virtualRef:L}),(0,V.jsx)(h,{children:(0,V.jsxs)(g,{side:`bottom`,align:`end`,sideOffset:8,collisionPadding:8,"aria-label":n?`编辑 Personal AI`:`Edit Personal AI`,onInteractOutside:e=>{e.target instanceof Node&&(L.current?.contains(e.target)||se.current?.contains(e.target))&&e.preventDefault()},className:`z-50 flex w-[min(22rem,calc(100vw-1rem))] flex-col rounded-2xl border border-edge bg-surface-overlay shadow-xl outline-none`,children:[(0,V.jsxs)(`div`,{className:`relative flex shrink-0 flex-col items-center px-4 pt-4 text-center`,children:[(0,V.jsx)(`button`,{type:`button`,disabled:F,onClick:()=>U(e=>!e),"aria-expanded":le,"aria-controls":`personal-appearance-options`,"aria-label":n?`选择头像`:`Choose avatar`,className:`rounded-full transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50`,children:(0,V.jsx)(j,{appearance:M,agentId:a.agentId,className:`size-16`})}),(0,V.jsx)(`input`,{id:`personal-name`,"aria-label":n?`助手名称`:`Assistant name`,value:ce,onChange:e=>R(e.target.value),onBlur:e=>{let t=e.currentTarget.value.trim();t?(R(t),Se({displayName:t})):R(s.current?.displayName??``)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=s.current?.displayName??``,R(e.currentTarget.value),e.currentTarget.blur())},maxLength:60,placeholder:`Ada`,className:`mt-2 w-full min-w-0 rounded-lg border border-transparent bg-transparent px-2 py-1 text-center text-lg font-semibold text-fg outline-none transition-colors hover:border-edge focus:border-edge focus:bg-surface-base focus-visible:ring-2 focus-visible:ring-accent`}),ee>0&&(0,V.jsx)(`span`,{className:`absolute right-4 top-4 text-xs text-fg-muted`,children:n?`正在保存…`:`Saving…`})]}),(0,V.jsxs)(`div`,{className:`space-y-4 px-4 py-4`,children:[D&&(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:D}),le&&(0,V.jsxs)(`section`,{id:`personal-appearance-options`,children:[(0,V.jsx)(`h3`,{className:`mb-3 text-sm font-medium text-fg`,children:n?`形象`:`Appearance`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-4 gap-2`,children:[me.map(e=>(0,V.jsxs)(`button`,{type:`button`,onClick:()=>{N(e.id),U(!1),Se({appearance:e.id})},"aria-pressed":M===e.id,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent ${M===e.id?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,V.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full ${e.color}`,children:(0,V.jsx)(j,{appearance:e.id,className:`size-8`})}),(0,V.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:n?e.zh:e.en})]},e.id)),(0,V.jsx)(`input`,{ref:I,type:`file`,accept:`image/png,image/jpeg,image/webp`,className:`sr-only`,"aria-label":n?`上传头像`:`Upload avatar`,onChange:e=>{let t=e.currentTarget.files?.[0];t&&Te(t),e.currentTarget.value=``}}),(0,V.jsxs)(`button`,{type:`button`,disabled:F,onClick:()=>I.current?.click(),"aria-pressed":M===`custom`,className:`flex min-w-0 flex-col items-center gap-1.5 rounded-xl px-1 py-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50 ${M===`custom`?`bg-accent/10 ring-1 ring-accent/40`:`bg-surface-panel hover:bg-surface-hover`}`,children:[(0,V.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-full bg-surface-panel`,children:M===`custom`?(0,V.jsx)(j,{appearance:`custom`,agentId:a.agentId,className:`size-8`}):(0,V.jsx)(ne,{className:`size-4 text-fg-muted`,"aria-hidden":!0})}),(0,V.jsx)(`span`,{className:`truncate text-xs text-fg-muted`,children:F?n?`上传中…`:`Uploading…`:n?`上传`:`Upload`})]})]})]}),(0,V.jsx)(de,{onGreetingChange:e=>Se({voiceCallPreferences:{openingGreetingEnabled:e}}),record:a,zh:n,onSelectVoice:e=>Se({voicePreference:e})}),(0,V.jsx)(`div`,{className:`border-t border-edge pt-4`,children:(0,V.jsx)(fe,{conversationId:a.conversationId,zh:n,onSaved:async()=>{let e=await u(c(`/api/personal-agent`));e.ok&&e.payload&&(s.current=e.payload,o(e.payload))}})})]})]})})]}):null}return x?(0,V.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-5 px-6 py-12`,children:[(0,V.jsx)(m,{className:`h-20 w-20 rounded-full`}),(0,V.jsx)(m,{className:`h-9 w-72`}),(0,V.jsx)(m,{className:`h-44 w-full rounded-2xl`})]}):a?.state===`ready`?(0,V.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col bg-surface-panel`,children:[te&&(0,V.jsxs)(`div`,{role:`alert`,className:`flex shrink-0 items-center justify-between gap-3 border-b border-warning/30 bg-warning/5 px-5 py-3 text-sm text-fg-muted`,children:[(0,V.jsx)(`span`,{children:n?`助手已创建,头像上传未完成。可在资料设置中重新上传。`:`Your assistant is ready. Upload the avatar again in profile settings.`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>{A(!1),ye()},className:`shrink-0 text-accent hover:underline`,children:n?`打开设置`:`Open settings`})]}),(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,V.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,V.jsx)(ie,{embedded:!0,personal:!0,personalWelcome:{name:a.displayName,addressAs:a.userCallName??void 0,avatar:(0,V.jsx)(j,{appearance:a.appearance,agentId:a.agentId,className:`size-14`}),opening:n?`有什么想讨论或推进的事?直接告诉我就好。`:`What would you like to discuss or move forward? Just tell me what is on your mind.`},conversationId:a.conversationId})})}),Ee()]}):(0,V.jsx)(ue,{modelsAvailable:f.length>0,onCreated:(e,t)=>{s.current=e,o(e),R(e.displayName),A(t),window.dispatchEvent(new CustomEvent(`personal-agent-updated`,{detail:e})),window.dispatchEvent(new Event(`session-updated`))}})}export{Y as PersonalPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./popover-select-DGKUpVsz.js";import{i as a,n as o,o as s}from"./locale-store-JogcXC4J.js";import{t as c}from"./personal-proactivity-BJcZ3Yhi.js";import{t as l}from"./skeleton-BI5TyibZ.js";import{n as u,t as d}from"./settings-page-header-CYpuTXUW.js";import"./settings-page-layout-B20AfmFG.js";var f=n(),p=e(t(),1),m=r();function h(){try{return[`UTC`,...Intl.supportedValuesOf(`timeZone`)]}catch{return[`UTC`,`Asia/Shanghai`,`Asia/Hong_Kong`,`Asia/Taipei`,`Asia/Tokyo`,`Asia/Seoul`,`Asia/Singapore`,`Asia/Kolkata`,`Asia/Dubai`,`Europe/London`,`Europe/Paris`,`Europe/Berlin`,`America/New_York`,`America/Chicago`,`America/Denver`,`America/Los_Angeles`,`Australia/Sydney`,`Pacific/Auckland`]}}var g=h();function _({zh:e}){let[t,n]=(0,p.useState)(),[r,o]=(0,p.useState)(``),[u,d]=(0,p.useState)(!1),[f,h]=(0,p.useState)(``),_=f.trim().toLowerCase().replaceAll(`_`,` `),v=[...new Set([...g,t?.timezone].filter(e=>!!e))].sort().filter(e=>e.replaceAll(`_`,` `).toLowerCase().includes(_)).map(e=>({value:e,label:e.replaceAll(`_`,` `),group:e.split(`/`)[0]}));(0,p.useEffect)(()=>{let e=!0;return s(a(`/api/personal-agent/proactivity`)).then(t=>{e&&t.ok&&n(c.parse(t.payload))}).catch(t=>{e&&o(String(t))}),()=>{e=!1}},[]);async function y(e){if(!(!t||u)){d(!0),o(``);try{let r=await s(a(`/api/personal-agent/proactivity`),{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...t,...e})});r.ok&&n(c.parse(r.payload))}catch(e){o(String(e));let t=await s(a(`/api/personal-agent/proactivity`)).catch(()=>null);t?.ok&&n(c.parse(t.payload))}finally{d(!1)}}}return(0,m.jsxs)(`section`,{className:`space-y-3 border-t border-edge pt-5`,children:[(0,m.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:e?`主动联系`:`Proactive messages`}),!t&&!r?(0,m.jsx)(l,{className:`h-9 w-full`}):t&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(i,{placeholder:e?`选择主动方式`:`Choose participation`,value:t.mode,disabled:u,allowEmpty:!1,options:[{value:`off`,label:e?`关闭主动联系`:`Off`},{value:`follow_up`,label:e?`仅明确跟进`:`Requested follow-ups`},{value:`balanced`,label:e?`适度主动`:`Thoughtful participation`}],onChange:e=>void y({mode:e})}),(0,m.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,m.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[e?`静默开始`:`Quiet from`,(0,m.jsx)(i,{placeholder:e?`选择时间`:`Choose time`,value:String(t.quietStart),disabled:u,allowEmpty:!1,options:Array.from({length:24},(e,t)=>({value:String(t),label:`${String(t).padStart(2,`0`)}:00`})),onChange:e=>void y({quietStart:Number(e)})})]}),(0,m.jsxs)(`label`,{className:`text-xs text-fg-muted`,children:[e?`静默结束`:`Quiet until`,(0,m.jsx)(i,{placeholder:e?`选择时间`:`Choose time`,value:String(t.quietEnd),disabled:u,allowEmpty:!1,options:Array.from({length:24},(e,t)=>({value:String(t),label:`${String(t).padStart(2,`0`)}:00`})),onChange:e=>void y({quietEnd:Number(e)})})]})]}),(0,m.jsxs)(`label`,{className:`block text-xs text-fg-muted`,children:[e?`时区`:`Timezone`,(0,m.jsx)(i,{placeholder:e?`选择时区`:`Choose timezone`,ariaLabel:e?`时区`:`Timezone`,value:t.timezone,selectedLabel:t.timezone.replaceAll(`_`,` `),options:v,disabled:u,allowEmpty:!1,triggerClassName:`mt-1`,searchPlaceholder:e?`搜索时区或城市`:`Search timezone or city`,searchValue:f,onSearchChange:h,statusMessage:v.length?void 0:e?`没有匹配的时区`:`No matching timezones`,onChange:e=>{h(``),e!==t.timezone&&y({timezone:e})}})]}),(0,m.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`有值得交流的进展时,在聊天里留下消息。明确请求的结果会照常交付。`:`Useful developments appear in this chat. Requested results are delivered as usual.`})]}),r&&(0,m.jsx)(`p`,{role:`alert`,className:`text-xs text-danger`,children:r})]})}function v(){let e=(0,f.c)(7),t=o(y)===`zh`,n=t?`管理主动联系和静默时段。`:`Manage proactive messages and quiet hours.`,r;e[0]===n?r=e[1]:(r=(0,m.jsx)(d,{title:`Personal AI`,subtitle:n}),e[0]=n,e[1]=r);let i;e[2]===t?i=e[3]:(i=(0,m.jsx)(_,{zh:t}),e[2]=t,e[3]=i);let a;return e[4]!==r||e[5]!==i?(a=(0,m.jsxs)(u,{children:[r,i]}),e[4]=r,e[5]=i,e[6]=a):a=e[6],a}function y(e){return e.language}export{v as PersonalSettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./download-Dk-ZjtO6.js";import{i,n as a,o}from"./locale-store-JogcXC4J.js";import{i as s}from"./vendor-swr-BIWyz7Rc.js";import{t as c}from"./button-aIC072nz.js";import{t as l}from"./skeleton-BI5TyibZ.js";import{Fl as u}from"./index-ygkHNYyo.js";import{a as d}from"./runtime-tools-api-CSm5SpnR.js";var f=e(t(),1),p=()=>i(`/api/runtime-tools/phone-dependencies`);async function m(){return(await o(p())).payload}async function h(e){await o(i(`/api/runtime-tools/phone-dependencies/adb/path`),{method:`POST`,body:JSON.stringify({path:e})})}async function g(e,t,n,r){return d({path:`/api/runtime-tools/phone-dependencies/${e}/${t}/stream`,body:r?{path:r}:{},onProgress:n})}var _=n();function v({cloudOnly:e=!1,onChanged:t}){let n=a(e=>e.language)===`zh`,[i,o]=(0,f.useState)(),[d,v]=(0,f.useState)(!1),[y,b]=(0,f.useState)({adb:``,scrcpy:``}),[x,S]=(0,f.useState)(),[C,w]=(0,f.useState)(``),[T,E]=(0,f.useState)(!1),{data:D,error:O,mutate:k}=s(p(),m,{refreshInterval:i?2500:0}),A=n?{ready:`已就绪`,absent:`未安装`,corrupted:`需要修复`,unsupported:`当前平台需自行安装`,installing:`安装中`}:{ready:`Ready`,absent:`Not installed`,corrupted:`Needs repair`,unsupported:`Use an existing installation`,installing:`Installing`},j=n?{download:`下载中`,verify:`校验文件`,extract:`解压文件`,install:`安装中`,probe:`验证版本`,complete:`安装完成`}:{download:`Downloading`,verify:`Verifying files`,extract:`Extracting`,install:`Installing`,probe:`Checking version`,complete:`Installed`};async function M(e,r){o(e),E(!1),w(``),S(void 0);try{r===`detect`?await h(``):r===`existing`&&e===`adb`?await h(y.adb.trim()):await g(e,r===`existing`?`import`:r,S,r===`existing`?y.scrcpy.trim():void 0),await k(),t?.(),w(n?`依赖已就绪。`:`Dependency is ready.`)}catch(e){E(!0),w(e instanceof Error?e.message:String(e))}finally{o(void 0),S(void 0)}}return(0,_.jsxs)(`section`,{className:`space-y-4 rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,"aria-label":n?`手机依赖状态`:`Phone dependencies`,children:[(0,_.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,_.jsx)(`h2`,{className:`text-sm font-semibold`,children:n?`手机依赖状态`:`Phone dependencies`}),(0,_.jsx)(c,{variant:`ghost`,"aria-label":n?`刷新手机依赖状态`:`Refresh phone dependencies`,disabled:!!i,onClick:()=>void k(),children:(0,_.jsx)(u,{className:`size-4`,"aria-hidden":!0})})]}),(0,_.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`检测和安装发生在 Gateway 所在机器。Electron 内置 Gateway 时安装在当前电脑,无需全局安装。`:`Checks and installation run on the Gateway host, or this computer for Electron’s embedded Gateway. No global installation is needed.`}),D?.installationEnabled===!1?(0,_.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`托管安装已禁用,可在运行环境中启用;已有 ADB 仍可使用。`:`Managed installation is disabled. Enable it in Runtime Tools, or use an existing ADB installation.`}):null,e?(0,_.jsxs)(`div`,{className:`space-y-2 text-xs text-fg-muted`,children:[(0,_.jsx)(`p`,{children:n?`阿里云连接无需本机 ADB;实时视频和持续触控需要 scrcpy server。`:`Alibaba Cloud connections need no local ADB. Live video and continuous touch require scrcpy server.`}),(0,_.jsx)(`button`,{className:`text-accent-fg hover:underline`,"aria-expanded":d,onClick:()=>v(e=>!e),children:d?n?`收起本机连接依赖`:`Hide local connection dependencies`:n?`连接本机手机?查看 ADB 依赖`:`Connecting a local phone? Show ADB dependencies`})]}):null,O?(0,_.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:n?`无法读取依赖状态,请刷新重试。`:`Could not load dependency status. Refresh to retry.`}):D?D.statuses.filter(t=>!e||d||t.kind!==`adb`).map(e=>(0,_.jsxs)(`div`,{className:`space-y-2 border-t border-edge-subtle pt-3`,children:[(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,_.jsxs)(`div`,{className:`min-w-0`,children:[(0,_.jsx)(`p`,{className:`text-sm font-medium`,children:e.kind===`adb`?`ADB · Android Platform Tools`:`scrcpy server`}),(0,_.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[A[e.state],e.version?` · ${e.version}`:` · ${n?`托管版本`:`Managed version`} ${e.requestedVersion}`,e.source===`system`?n?` · 使用已有安装`:` · Existing installation`:e.source===`custom`?n?` · 自定义路径`:` · Custom path`:``]})]}),(0,_.jsxs)(c,{disabled:!!i||e.state===`installing`||!e.canInstall,variant:e.state===`ready`?`secondary`:`primary`,onClick:()=>void M(e.kind,e.state===`corrupted`||e.state===`ready`&&e.source===`managed`?`repair`:`install`),children:[(0,_.jsx)(r,{className:`size-4`,"aria-hidden":!0}),i===e.kind||e.state===`installing`?n?`处理中…`:`Working…`:e.state===`ready`&&e.source!==`managed`?n?`安装托管副本`:`Install managed copy`:e.state===`ready`||e.state===`corrupted`?n?`修复托管安装`:`Repair managed copy`:n?`安装`:`Install`]})]}),(0,_.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e.kind===`adb`?n?`仅连接本机 USB 手机或模拟器时需要;云手机无需安装。`:`Required for local USB phones and emulators. Cloud phones do not need it.`:n?`用于实时画面和跟手操作;缺失时仍可使用截图模式。`:`Required for live video and continuous touch. Snapshots remain available without it.`}),(0,_.jsxs)(`details`,{className:`text-xs text-fg-muted`,children:[(0,_.jsx)(`summary`,{className:`cursor-pointer py-1`,children:e.kind===`adb`?n?`使用已有 ADB`:`Use existing ADB`:n?`导入已有 scrcpy server`:`Import existing scrcpy server`}),e.path?(0,_.jsxs)(`p`,{className:`mt-2 break-all`,children:[n?`当前文件:`:`Current file: `,e.path]}):null,(0,_.jsxs)(`label`,{className:`mt-3 block space-y-2`,children:[(0,_.jsx)(`span`,{children:e.kind===`adb`?n?`Gateway 上的 ADB 可执行文件绝对路径`:`Absolute ADB executable path on Gateway`:n?`Gateway 上的 scrcpy server 文件绝对路径`:`Absolute scrcpy server file path on Gateway`}),(0,_.jsx)(`input`,{"aria-label":e.kind===`adb`?n?`已有 ADB 路径`:`Existing ADB path`:n?`已有 scrcpy server 路径`:`Existing scrcpy server path`,value:y[e.kind],disabled:!!i,onChange:t=>b(n=>({...n,[e.kind]:t.target.value})),className:`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-2 focus-visible:outline-accent`})]}),(0,_.jsx)(`p`,{className:`mt-2`,children:e.kind===`scrcpy`?n?`只接受固定版本 ${e.requestedVersion},校验通过后复制到托管目录。`:`Only pinned version ${e.requestedVersion} is accepted and copied into managed storage after verification.`:n?`验证版本后保存路径;不会替换此文件或重启 ADB 服务。`:`Checks the version and saves the path without replacing files or restarting ADB.`}),(0,_.jsx)(c,{className:`mt-3`,disabled:!!i||!y[e.kind].trim(),onClick:()=>void M(e.kind,`existing`),children:n?`验证并使用`:`Verify and use`}),e.kind===`adb`?(0,_.jsx)(c,{variant:`ghost`,className:`ml-2 mt-3`,disabled:!!i,onClick:()=>void M(`adb`,`detect`),children:n?`恢复自动检测`:`Use automatic detection`}):null]})]},e.kind)):(0,_.jsx)(l,{className:`h-28 rounded-xl`}),(0,_.jsx)(`div`,{className:`min-h-5 text-xs`,"aria-live":`polite`,children:x?(0,_.jsxs)(`p`,{role:`status`,className:`text-fg-muted`,children:[j[x.phase]??x.phase,x.downloadedBytes&&x.totalBytes?` · ${Math.min(100,Math.round(x.downloadedBytes/x.totalBytes*100))}%`:``]}):C?(0,_.jsx)(`p`,{role:T?`alert`:`status`,className:T?`text-danger`:`text-fg-muted`,children:C}):null}),(0,_.jsx)(`a`,{href:`#/settings/runtimes`,className:`text-xs text-accent-fg hover:underline`,children:n?`管理下载代理与离线包`:`Manage download proxy and offline packages`})]})}export{v as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{n,r}from"./popover-select-DGKUpVsz.js";import{a as i,i as a,o}from"./locale-store-JogcXC4J.js";import{i as s}from"./vendor-swr-BIWyz7Rc.js";import{t as c}from"./skeleton-BI5TyibZ.js";var l=e(),u=`phone-mock/settings-about`,d=`Open Android Settings and inspect About phone`;async function f(e,t,n=t===void 0?`GET`:`POST`){let r=await o(a(`/api/phone${e}`),{method:n,...t===void 0?{}:{headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}});if(!r.ok)throw Error(r.error?.message??`Phone operation failed`);return r.payload}var p=()=>f(`/settings`),m=()=>f(`/devices`),h=()=>f(`/models`);async function g(e,t){let n=await i(a(`/api/phone/devices/${encodeURIComponent(e)}/screen`),{signal:t});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error?.message??`HTTP ${n.status}`)}return n.blob()}async function _(e,t){return(await f(e?`/devices/${encodeURIComponent(e)}/apps`:`/apps?serial=${encodeURIComponent(t)}`)).applications}var v=t();function y(e){let t=(0,l.c)(24),{value:i,onChange:a,zh:o,disabled:u}=e,d=u===void 0?!1:u,f=s(`phone-models`,h);if(!f.data&&!f.error){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,v.jsx)(c,{className:`h-11 w-full rounded-lg`}),t[0]=e):e=t[0],e}let p=o?`手机模型`:`Phone model`,m=d||!!f.error,g;t[1]===a?g=t[2]:(g=e=>a(e.target.value),t[1]=a,t[2]=g);let _=o?`未配置`:`Not configured`,y;t[3]===_?y=t[4]:(y=(0,v.jsx)(r,{value:``,children:_}),t[3]=_,t[4]=y);let b;t[5]!==f.data?.models||t[6]!==i?(b=i&&!f.data?.models.some(e=>e.id===i)&&(0,v.jsx)(r,{value:i,children:i}),t[5]=f.data?.models,t[6]=i,t[7]=b):b=t[7];let x;t[8]!==f.data?.models||t[9]!==o?(x=f.data?.models.map(e=>(0,v.jsx)(r,{value:e.id,children:e.mock?o?`模拟模型 · 系统设置测试`:`Mock · Android Settings test`:`${e.name} · ${e.id.split(`/`)[0]}${e.configured?``:o?` · 待配置凭据`:` · Credentials needed`}`},e.id)),t[8]=f.data?.models,t[9]=o,t[10]=x):x=t[10];let S;t[11]!==p||t[12]!==m||t[13]!==g||t[14]!==y||t[15]!==b||t[16]!==x||t[17]!==i?(S=(0,v.jsxs)(n,{"aria-label":p,value:i,disabled:m,onChange:g,children:[y,b,x]}),t[11]=p,t[12]=m,t[13]=g,t[14]=y,t[15]=b,t[16]=x,t[17]=i,t[18]=S):S=t[18];let C;t[19]===f.error?C=t[20]:(C=f.error&&(0,v.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(f.error)}),t[19]=f.error,t[20]=C);let w;return t[21]!==C||t[22]!==S?(w=(0,v.jsxs)(`div`,{className:`space-y-2`,children:[S,C]}),t[21]=C,t[22]=S,t[23]=w):w=t[23],w}function b(e){let t=(0,l.c)(24),{value:n,inherited:r,onChange:i,zh:a}=e,o=a?`手机操作模型`:`Phone Use model`,s;t[0]===o?s=t[1]:(s=(0,v.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:o}),t[0]=o,t[1]=s);let c=n?n.primary:`${a?`继承全局`:`Inherited`}: ${r?.primary??`—`}`,u;t[2]===c?u=t[3]:(u=(0,v.jsx)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:c}),t[2]=c,t[3]=u);let d;t[4]!==s||t[5]!==u?(d=(0,v.jsxs)(`div`,{children:[s,u]}),t[4]=s,t[5]=u,t[6]=d):d=t[6];let f;t[7]!==r?.primary||t[8]!==i||t[9]!==n?(f=()=>i(n?void 0:{primary:r?.primary??``,fallbacks:[]}),t[7]=r?.primary,t[8]=i,t[9]=n,t[10]=f):f=t[10];let p=n?a?`继承全局`:`Inherit globally`:a?`单独设置`:`Override`,m;t[11]!==f||t[12]!==p?(m=(0,v.jsx)(`button`,{type:`button`,className:`touch-target rounded-lg px-3 py-2 text-sm text-accent-fg hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-accent`,onClick:f,children:p}),t[11]=f,t[12]=p,t[13]=m):m=t[13];let h;t[14]!==d||t[15]!==m?(h=(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[d,m]}),t[14]=d,t[15]=m,t[16]=h):h=t[16];let g;t[17]!==i||t[18]!==n||t[19]!==a?(g=n&&(0,v.jsx)(y,{value:n.primary,onChange:e=>i({primary:e,fallbacks:[]}),zh:a}),t[17]=i,t[18]=n,t[19]=a,t[20]=g):g=t[20];let _;return t[21]!==g||t[22]!==h?(_=(0,v.jsxs)(`section`,{className:`space-y-3 rounded-2xl border border-edge bg-surface-base p-4`,children:[h,g]}),t[21]=g,t[22]=h,t[23]=_):_=t[23],_}export{_ as a,g as c,u as i,p as l,y as n,m as o,d as r,h as s,b as t,f as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{t as a}from"./app-window-DXFNqt_0.js";import{n as o,r as s}from"./popover-select-DGKUpVsz.js";import{t as c}from"./cn-0WouolD0.js";import{a as l,i as u,n as d}from"./locale-store-JogcXC4J.js";import{i as f}from"./vendor-swr-BIWyz7Rc.js";import{t as p}from"./button-aIC072nz.js";import{t as m}from"./skeleton-BI5TyibZ.js";import{Bc as h,Dn as g,Fc as _,Fl as v,Ic as y,It as b,Jd as x,Lc as S,On as C,Rc as w,Vc as T,Wl as E,ia as D,kl as O,nd as k,qc as ee,yl as A,zc as j}from"./index-ygkHNYyo.js";import{n as te,t as M}from"./settings-page-header-CYpuTXUW.js";import{a as N,c as P,i as F,l as I,n as L,o as ne,r as R,s as z,u as B}from"./phone-model-picker-CZoIAQ1j.js";import{t as V}from"./phone-dependencies-card-ChFtdFhA.js";var re=n(),H=e(t(),1),U=r();function W({zh:e,onAdded:t}){let[n,r]=(0,H.useState)(e?`阿里云手机`:`Alibaba Cloud Phone`),[i,a]=(0,H.useState)(``),[o,s]=(0,H.useState)(),[c,l]=(0,H.useState)(),[u,d]=(0,H.useState)(!1),[f,m]=(0,H.useState)(!1),[h,g]=(0,H.useState)(``),_=(0,H.useRef)(void 0),v=(0,H.useRef)(!0),y=()=>{let e=_.current;_.current=void 0,l(void 0),e&&B(`/cloud/aliyun/tests/${e}`,void 0,`DELETE`).catch(()=>{})};(0,H.useEffect)(()=>(v.current=!0,()=>{v.current=!1,_.current&&B(`/cloud/aliyun/tests/${_.current}`,void 0,`DELETE`).catch(()=>{})}),[]);let b=async()=>{if(o){y(),m(!0),g(``);try{if(o.size>16384)throw Error(e?`私钥文件不能超过 16 KB`:`Private key must be at most 16 KB`);let t=await B(`/cloud/aliyun/test`,{endpoint:i.trim(),privateKey:await o.text()});if(!v.current){B(`/cloud/aliyun/tests/${t.token}`,void 0,`DELETE`).catch(()=>{});return}_.current=t.token,l(t)}catch(e){v.current&&g(String(e instanceof Error?e.message:e))}finally{v.current&&m(!1)}}},x=async()=>{if(c){m(!0),g(``);try{await B(`/cloud/aliyun/add`,{token:c.token,name:n.trim(),makeDefault:u}),_.current=void 0,t()}catch(e){v.current&&g(String(e instanceof Error?e.message:e))}finally{v.current&&m(!1)}}},S=`mt-2 w-full rounded-xl border border-edge bg-surface-inset px-3 py-2 text-sm text-fg`;return(0,U.jsxs)(`div`,{className:`space-y-4`,children:[(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e?`在阿里云控制台绑定密钥对并创建 ADB 连接,复制公网或 Gateway 可访问的内网地址。无需云账号 AccessKey。`:`Bind a key pair and create an ADB connection in the Alibaba console. Use an address reachable from the Gateway. No cloud account AccessKey is needed.`}),(0,U.jsxs)(`label`,{className:`block text-sm`,children:[e?`手机名称`:`Phone name`,(0,U.jsx)(`input`,{className:S,value:n,maxLength:100,disabled:f,onChange:e=>r(e.target.value)})]}),(0,U.jsxs)(`label`,{className:`block text-sm`,children:[e?`ADB 地址`:`ADB address`,(0,U.jsx)(`input`,{className:S,placeholder:`203.0.113.10:10001`,value:i,disabled:f,autoComplete:`off`,onChange:e=>{y(),a(e.target.value)}})]}),(0,U.jsxs)(`label`,{className:`block text-sm`,children:[e?`私钥文件(adbkey)`:`Private key file (adbkey)`,(0,U.jsx)(`input`,{className:S,type:`file`,disabled:f,onChange:e=>{y(),s(e.target.files?.[0])}})]}),(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`私钥仅提交到当前 Gateway,添加后保存在 Gateway 凭据目录,不会替换电脑现有 ADB 密钥。`:`The key is sent only to this Gateway and saved in its credentials directory after adding. Existing host ADB keys stay unchanged.`}),(0,U.jsx)(p,{disabled:f||!i.trim()||!o,onClick:()=>void b(),children:f?e?`处理中…`:`Working…`:e?`测试连接`:`Test connection`}),h&&(0,U.jsx)(`p`,{role:`alert`,className:`break-words text-sm text-danger`,children:h}),c&&(0,U.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-edge p-4`,children:[(0,U.jsxs)(`p`,{role:`status`,className:`text-sm`,children:[e?`连接成功`:`Connected`,` · `,c.model,` · Android `,c.androidVersion]}),(0,U.jsx)(`img`,{src:c.screenshot,alt:e?`云手机当前画面`:`Current cloud phone screen`,className:`mx-auto max-h-64 rounded-lg object-contain`}),(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`添加后可在聊天中使用实时视频、接管操作和交还 Agent;视频不可用时使用截图。测试结果有效期为 10 分钟。默认只允许系统设置,添加后可在「管理」中调整。`:`After adding, use live video, takeover and Agent handback in chat, with snapshots when video is unavailable. Test expires after 10 minutes. Settings is the initial allowed app; adjust it in Manage.`}),(0,U.jsxs)(`label`,{className:`flex items-center gap-2 text-sm`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:u,disabled:f,onChange:e=>d(e.target.checked)}),e?`设为默认手机`:`Set as default phone`]}),(0,U.jsx)(p,{variant:`primary`,disabled:f||!n.trim()||c.expiresAt<=Date.now(),onClick:()=>void x(),children:e?`添加手机`:`Add phone`})]}),(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`移除连接只删除 xopc 的连接与私钥,不会销毁云手机,也不会关闭阿里云侧的 ADB 端口。`:`Removing a connection deletes its xopc credentials. It does not destroy the cloud phone or close its cloud ADB endpoint.`})]})}var G=[{id:`local-adb`,available:!0,name:[`Gateway 电脑上的手机 / 模拟器`,`Phone or emulator on the Gateway host`],description:[`通过 USB 或已配对的无线 ADB 连接。`,`Connect over USB or previously paired wireless ADB.`]},{id:`remote-connector`,available:!1,name:[`通过本地连接器连接`,`Local connector`],description:[`Gateway 在服务器上,手机连接在你的电脑上。`,`Connect a phone on your computer to a remote Gateway.`]},{id:`aliyun`,available:!0,name:[`阿里云手机`,`Alibaba Cloud Phone`],description:[`填写 ADB 地址并上传私钥,连接已有云手机。`,`Connect an existing cloud phone with its ADB address and private key.`]},{id:`tencent`,available:!1,name:[`腾讯云手机`,`Tencent Cloud Phone`],description:[`连接云账号,选择地域和已有实例。`,`Connect an account, then choose a region and existing instance.`]}];function ie(e){let t=(0,re.c)(48),{zh:n,onClose:r,onSelect:i,onAdded:a}=e,[o,s]=(0,H.useState)(),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={refreshInterval:3e3},t[0]=c):c=t[0];let l=f(o===`local-adb`?`phone-devices`:null,ne,c),u;t[1]===o?u=t[2]:(u=G.find(e=>e.id===o),t[1]=o,t[2]=u);let d=u,g=+!n,b;t[3]===n?b=t[4]:(b=n?{device:`已连接,可添加`,unauthorized:`等待手机授权:解锁手机,点击「允许 USB 调试」`,offline:`设备离线:重新连接数据线或无线调试`,recovery:`恢复模式:请先启动 Android 系统`,sideload:`请退出刷机模式并启动 Android 系统`}:{device:`Connected · Ready to add`,unauthorized:`Unlock the phone and allow USB debugging`,offline:`Offline · Reconnect USB or wireless debugging`,recovery:`Boot Android before connecting`,sideload:`Exit sideload mode and boot Android`},t[3]=n,t[4]=b);let C=b,E;t[5]===l.data?.discovery?E=t[6]:(E=l.data?.discovery??[],t[5]=l.data?.discovery,t[6]=E);let D=E,O;t[7]===r?O=t[8]:(O=e=>{e||r()},t[7]=r,t[8]=O);let k;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,U.jsx)(j,{className:`fixed inset-0 z-[80] bg-black/40`}),t[9]=k):k=t[9];let A;t[10]!==o||t[11]!==n?(A=o&&(0,U.jsx)(p,{variant:`ghost`,"aria-label":n?`返回连接方式`:`Back to connection methods`,onClick:()=>s(void 0),children:(0,U.jsx)(x,{className:`size-4`})}),t[10]=o,t[11]=n,t[12]=A):A=t[12];let te=n?`添加手机`:`Add phone`,M;t[13]===te?M=t[14]:(M=(0,U.jsx)(T,{className:`text-base font-semibold`,children:te}),t[13]=te,t[14]=M);let N=d?d.name[g]:n?`选择手机连接在哪里。手机模型在添加设备后独立配置。`:`Choose where the phone connects. Phone models are configured separately.`,P;t[15]===N?P=t[16]:(P=(0,U.jsx)(w,{className:`mt-1 text-sm text-fg-muted`,children:N}),t[15]=N,t[16]=P);let F;t[17]!==P||t[18]!==M?(F=(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[M,P]}),t[17]=P,t[18]=M,t[19]=F):F=t[19];let I=n?`关闭添加手机`:`Close add phone`,L;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,U.jsx)(ee,{className:`size-4`}),t[20]=L):L=t[20];let R;t[21]===I?R=t[22]:(R=(0,U.jsx)(y,{asChild:!0,children:(0,U.jsx)(p,{variant:`ghost`,"aria-label":I,children:L})}),t[21]=I,t[22]=R);let z;t[23]!==F||t[24]!==R||t[25]!==A?(z=(0,U.jsxs)(`header`,{className:`flex shrink-0 items-start gap-3 border-b border-edge p-5`,children:[A,F,R]}),t[23]=F,t[24]=R,t[25]=A,t[26]=z):z=t[26];let B;t[27]!==l||t[28]!==D||t[29]!==g||t[30]!==o||t[31]!==a||t[32]!==r||t[33]!==i||t[34]!==C||t[35]!==n?(B=o?o===`aliyun`?(0,U.jsx)(W,{zh:n,onAdded:()=>{a?.(),r()}}):o===`local-adb`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`rounded-xl bg-surface-inset p-3 text-sm`,children:n?`连接位置:Gateway 所在电脑。若 Gateway 在服务器上,浏览器无法访问你电脑的 USB 手机。`:`Connection location: the Gateway host. A remote Gateway cannot access your browser computer’s USB phone.`}),(0,U.jsxs)(`ol`,{className:`list-decimal space-y-2 pl-5 text-sm text-fg-muted`,children:[(0,U.jsx)(`li`,{children:n?`手机开启开发者选项和 USB 调试;模拟器直接启动即可。`:`Enable developer options and USB debugging, or start an emulator.`}),(0,U.jsx)(`li`,{children:n?`用数据线连接 Gateway 电脑,在手机上允许 USB 调试。`:`Connect to the Gateway host with a data cable, then allow USB debugging on the phone.`}),(0,U.jsx)(`li`,{children:n?`等待下方显示设备,选择后确认名称和应用范围。`:`Select a discovered device below, then confirm its name and app access.`})]}),(0,U.jsxs)(`details`,{className:`text-sm`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:n?`使用无线连接或安装连接工具`:`Wireless connection or connection tools`}),(0,U.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:n?`当前支持发现已连接到 Gateway ADB 的无线设备。界面内无线配对尚未实现。ADB 可在手机控制页的「手机依赖状态」中手动安装,或使用 Gateway 电脑上已有的 Platform Tools;无需安装完整 Android Studio。`:`Previously connected wireless ADB devices are supported. In-app wireless pairing is not implemented yet. Install ADB from Phone dependencies or use existing Platform Tools on the Gateway host.`}),(0,U.jsx)(`a`,{href:`https://developer.android.com/tools/adb`,target:`_blank`,rel:`noopener noreferrer`,className:`mt-2 inline-block text-xs text-accent-fg hover:underline`,children:n?`查看 Android 官方连接指引`:`Android connection guide`})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`发现的设备`:`Discovered devices`}),(0,U.jsxs)(p,{disabled:l.isValidating,onClick:()=>{l.mutate()},children:[(0,U.jsx)(v,{className:`size-4`}),n?`刷新`:`Refresh`]})]}),!l.data&&!l.error?(0,U.jsx)(m,{className:`h-24 w-full rounded-xl`}):null,(l.error||l.data?.diagnostic)&&(0,U.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[n?`无法检测设备,请检查 Gateway 电脑的 ADB 安装与连接。`:`Unable to detect devices. Check ADB on the Gateway host.`,(0,U.jsx)(`span`,{className:`mt-1 block break-all text-xs`,children:l.data?.diagnostic??String(l.error)})]}),D.map(e=>{let t=l.data?.devices.some(t=>t.serial===e.serial);return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-xl border border-edge p-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`p`,{className:`text-sm font-medium`,children:e.name}),(0,U.jsx)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:e.serial}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:C[e.state]??e.state})]}),(0,U.jsx)(p,{disabled:t||e.state!==`device`,onClick:()=>i(e),children:t?n?`已添加`:`Added`:n?`选择设备`:`Choose device`})]},e.serial)}),l.data&&!D.length&&(0,U.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:n?`尚未发现设备。请检查数据线、手机调试授权,或启动模拟器。`:`No devices found. Check the cable and debugging authorization, or start an emulator.`})]}):(0,U.jsxs)(`div`,{className:`space-y-4 rounded-xl border border-edge bg-surface-base p-4`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-medium`,children:n?`此接入方式暂未支持`:`This connection method is not available yet`}),(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o===`remote-connector`?n?`后续可通过本地连接器将电脑上的手机接入远程 Gateway。当前请将手机连接到 Gateway 所在电脑。`:`A future local connector will connect your phone to a remote Gateway. For now, connect it to the Gateway host.`:n?`云手机适配器接入后,可配置云账号、选择地域和已有实例,再验证连接并添加。当前尚不能连接云实例,不会要求填写云密钥。`:`Once the cloud adapter is available, connect an account, select a region and existing instance, then verify and add it. Cloud connections are not supported yet.`}),(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`添加已有实例与购买、创建、销毁实例分开处理。`:`Adding existing instances is separate from purchasing, creating or destroying them.`})]}):G.map(e=>(0,U.jsxs)(`button`,{className:`block min-h-20 w-full rounded-xl border border-edge bg-surface-base p-4 text-left hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-accent`,onClick:()=>s(e.id),children:[(0,U.jsxs)(`span`,{className:`flex flex-wrap items-center justify-between gap-2 text-sm font-medium`,children:[e.name[g],!e.available&&(0,U.jsx)(`span`,{className:`text-xs font-normal text-fg-muted`,children:n?`暂未支持`:`Not available yet`})]}),(0,U.jsx)(`span`,{className:`mt-2 block text-xs text-fg-muted`,children:e.description[g]})]},e.id)),t[27]=l,t[28]=D,t[29]=g,t[30]=o,t[31]=a,t[32]=r,t[33]=i,t[34]=C,t[35]=n,t[36]=B):B=t[36];let V;t[37]===B?V=t[38]:(V=(0,U.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:B}),t[37]=B,t[38]=V);let ie=n?`取消`:`Cancel`,K;t[39]===ie?K=t[40]:(K=(0,U.jsx)(`footer`,{className:`flex shrink-0 justify-end border-t border-edge p-4`,children:(0,U.jsx)(y,{asChild:!0,children:(0,U.jsx)(p,{children:ie})})}),t[39]=ie,t[40]=K);let q;t[41]!==z||t[42]!==V||t[43]!==K?(q=(0,U.jsxs)(h,{children:[k,(0,U.jsxs)(S,{className:`fixed left-1/2 top-1/2 z-[81] flex h-[min(42rem,90dvh)] w-[min(38rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay text-fg`,children:[z,V,K]})]}),t[41]=z,t[42]=V,t[43]=K,t[44]=q):q=t[44];let J;return t[45]!==q||t[46]!==O?(J=(0,U.jsx)(_,{open:!0,onOpenChange:O,children:q}),t[45]=q,t[46]=O,t[47]=J):J=t[47],J}function K({device:e,sessionId:t,zh:n,onClose:r}){let[i,a]=(0,H.useState)(0),[o,s]=(0,H.useState)(),[c,d]=(0,H.useState)(``),[f,g]=(0,H.useState)(!0);return(0,H.useEffect)(()=>{let r=new AbortController,i=!0,a;return g(!0),d(``),s(void 0),(async()=>{try{let o;if(t){let e=await l(u(`/api/phone/sessions/${t}/screen`),{signal:r.signal});if(!e.ok)throw Error(n?`当前无法查看屏幕,请暂停任务后重试`:`Screen unavailable. Pause the task and retry.`);o=await e.blob()}else o=await P(e.id,r.signal);if(!i)return;a=URL.createObjectURL(o),s(a)}catch(e){i&&d(e instanceof Error?e.message:String(e))}finally{i&&g(!1)}})(),()=>{i=!1,r.abort(),a&&URL.revokeObjectURL(a)}},[e.id,t,i,n]),(0,U.jsx)(_,{open:!0,onOpenChange:e=>{e||r()},children:(0,U.jsxs)(h,{children:[(0,U.jsx)(j,{className:`fixed inset-0 z-[80] bg-black/40`}),(0,U.jsxs)(S,{className:`fixed left-1/2 top-1/2 z-[81] flex h-[min(48rem,90dvh)] w-[min(30rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay text-fg`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge p-4`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(T,{className:`text-base font-semibold`,children:n?`手机屏幕`:`Phone screen`}),(0,U.jsxs)(w,{className:`mt-1 truncate text-sm text-fg-muted`,children:[e.name,` · `,n?`仅查看`:`View only`]})]}),(0,U.jsx)(y,{asChild:!0,children:(0,U.jsx)(p,{variant:`ghost`,"aria-label":n?`关闭预览`:`Close preview`,children:(0,U.jsx)(ee,{className:`size-4`})})})]}),(0,U.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-hidden bg-surface-inset p-3`,"aria-busy":f,children:f?(0,U.jsx)(m,{className:`h-full w-full rounded-lg`}):c?(0,U.jsx)(`p`,{role:`alert`,className:`max-h-full overflow-y-auto break-words p-4 text-sm text-danger`,children:c}):o?(0,U.jsx)(`img`,{src:o,alt:n?`授权手机的当前屏幕截图`:`Current screenshot of the authorized phone`,className:`h-full w-full object-contain`}):null}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge p-4`,children:[(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?`临时截图,不保存到聊天或附件库。`:`Temporary screenshot; not saved to chat or attachments.`}),(0,U.jsxs)(p,{disabled:f,onClick:()=>a(e=>e+1),children:[(0,U.jsx)(v,{className:`size-4`}),n?`刷新画面`:`Refresh screen`]})]})]})]})})}function q(e){let t=(0,re.c)(29),{deviceId:n,serial:r,mode:i,selected:o,onModeChange:s,onSelectedChange:l,disabled:u,zh:d}=e,h=(0,H.useId)(),[g,_]=(0,H.useState)(``),y;t[0]!==n||t[1]!==i||t[2]!==r?(y=i===`selected`?[`phone-applications`,n??r]:null,t[0]=n,t[1]=i,t[2]=r,t[3]=y):y=t[3];let b;t[4]!==n||t[5]!==r?(b=()=>N(n,r),t[4]=n,t[5]=r,t[6]=b):b=t[6];let x;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(x={revalidateOnFocus:!1,shouldRetryOnError:!1},t[7]=x):x=t[7];let S=f(y,b,x),C;if(t[8]!==S||t[9]!==u||t[10]!==h||t[11]!==i||t[12]!==s||t[13]!==l||t[14]!==g||t[15]!==o||t[16]!==d){let e=g.trim().toLocaleLowerCase(),n=S.data?.filter(t=>`${t.label} ${t.packageName}`.toLocaleLowerCase().includes(e))??[],r=S.data,f=r?o.filter(e=>!r.some(t=>t.packageName===e)):[],y;t[18]!==l||t[19]!==o?(y=e=>l(o.includes(e)?o.filter(t=>t!==e):[...o,e]),t[18]=l,t[19]=o,t[20]=y):y=t[20];let b=y,x=d?`应用权限`:`Application access`,w;t[21]===x?w=t[22]:(w=(0,U.jsx)(`legend`,{className:`mb-2 text-sm font-medium`,children:x}),t[21]=x,t[22]=w);let T;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(T=[`all`,`selected`],t[23]=T):T=t[23];let E;t[24]!==h||t[25]!==i||t[26]!==s||t[27]!==d?(E=(0,U.jsx)(`div`,{className:`grid gap-2`,children:T.map(e=>(0,U.jsxs)(`label`,{className:c(`flex min-h-14 cursor-pointer items-start gap-3 rounded-xl border p-3`,i===e?`border-accent/50 bg-accent-soft`:`border-edge bg-surface-base`),children:[(0,U.jsx)(`input`,{type:`radio`,name:h,value:e,checked:i===e,onChange:()=>s(e),className:`mt-1 size-4 shrink-0 accent-accent`}),(0,U.jsxs)(`span`,{className:`min-w-0`,children:[(0,U.jsx)(`span`,{className:`block text-sm font-medium`,children:e===`all`?d?`允许所有应用`:`Allow all apps`:d?`仅允许所选应用`:`Only selected apps`}),(0,U.jsx)(`span`,{className:`mt-0.5 block text-xs leading-relaxed text-fg-muted`,children:e===`all`?d?`可在手机上的应用间切换,无需逐个配置。`:`Switch between apps on this phone without individual setup.`:d?`从手机上已安装的应用中选择。`:`Choose from applications installed on the phone.`})]})]},e))}),t[24]=h,t[25]=i,t[26]=s,t[27]=d,t[28]=E):E=t[28],C=(0,U.jsxs)(`fieldset`,{disabled:u,className:`space-y-3`,children:[w,E,i===`selected`?(0,U.jsxs)(`div`,{className:`space-y-2`,"aria-label":d?`选择手机应用`:`Choose phone applications`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,U.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:d?`已选择 ${o.length} 个应用`:`${o.length} apps selected`}),(0,U.jsxs)(p,{variant:`ghost`,className:`gap-1 px-2 py-1 text-xs`,"aria-label":d?`刷新应用列表`:`Refresh applications`,disabled:u||S.isValidating,onClick:()=>{S.mutate()},children:[(0,U.jsx)(v,{className:c(`size-3.5`,S.isValidating&&`animate-spin motion-reduce:animate-none`),"aria-hidden":!0}),d?`刷新`:`Refresh`]})]}),(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(O,{className:`pointer-events-none absolute left-3 top-3 size-4 text-fg-muted`,"aria-hidden":!0}),(0,U.jsx)(`input`,{type:`search`,"aria-label":d?`搜索手机应用`:`Search phone applications`,placeholder:d?`搜索应用`:`Search apps`,value:g,onChange:e=>_(e.target.value),className:`min-h-10 w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm focus-visible:outline-2 focus-visible:outline-accent`})]}),S.error?(0,U.jsxs)(`div`,{role:`alert`,className:`rounded-lg bg-surface-inset p-3 text-sm text-fg-muted`,children:[d?`暂时无法读取应用,请确认手机已连接后重试。之前的选择会保留。`:`Unable to read apps. Check the phone connection and retry. Previous selections are preserved.`,(0,U.jsx)(p,{variant:`ghost`,className:`ml-1 text-accent`,onClick:()=>{S.mutate()},children:d?`重试`:`Retry`})]}):null,!S.data&&!S.error?(0,U.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-2 rounded-lg border border-edge p-3`,children:[(0,U.jsx)(m,{className:`h-10 w-full`}),(0,U.jsx)(m,{className:`h-10 w-full`}),(0,U.jsx)(m,{className:`h-10 w-full`})]}):S.data?(0,U.jsxs)(`div`,{className:`max-h-56 overflow-y-auto overscroll-contain rounded-lg border border-edge bg-surface-base`,"aria-label":d?`可选应用`:`Available applications`,children:[n.map(e=>(0,U.jsxs)(`label`,{className:`flex min-h-12 cursor-pointer items-center gap-3 px-3 py-2 hover:bg-surface-hover`,children:[(0,U.jsx)(a,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-sm`,title:e.label,children:e.label}),e.label!==e.packageName&&S.data.some(t=>t.packageName!==e.packageName&&t.label===e.label)?(0,U.jsx)(`span`,{className:`block truncate text-xs text-fg-muted`,children:e.packageName}):null]}),(0,U.jsx)(`input`,{type:`checkbox`,"aria-label":e.label,checked:o.includes(e.packageName),onChange:()=>b(e.packageName),className:`size-4 shrink-0 accent-accent`})]},e.packageName)),n.length?null:(0,U.jsx)(`p`,{className:`p-4 text-center text-sm text-fg-muted`,children:e?d?`没有找到匹配的应用`:`No matching applications`:d?`这台手机上没有可打开的应用`:`No launchable applications on this phone`})]}):null,f.length?(0,U.jsxs)(`div`,{className:`space-y-1 text-xs text-fg-muted`,children:[(0,U.jsx)(`p`,{children:d?`以下原有选择未在手机上找到,可取消选择。`:`These previous selections are no longer available. You may deselect them.`}),f.map(e=>(0,U.jsxs)(`label`,{className:`flex min-h-9 items-center gap-2`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:!0,onChange:()=>b(e),className:`accent-accent`}),(0,U.jsx)(`span`,{className:`break-all`,children:e})]},e))]}):null,o.length?null:(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:d?`至少选择一个应用后保存。`:`Choose at least one application before saving.`})]}):null]}),t[8]=S,t[9]=u,t[10]=h,t[11]=i,t[12]=s,t[13]=l,t[14]=g,t[15]=o,t[16]=d,t[17]=C}else C=t[17];return C}function J({value:e,zh:t,disabled:n,onSave:r,onSelect:a}){let o=f(`phone-models`,z),s=f(`phone-provider-meta`,b),[c,l]=(0,H.useState)(e),[u,d]=(0,H.useState)(!1),[m,h]=(0,H.useState)(``),[g,_]=(0,H.useState)(!1);(0,H.useEffect)(()=>{l(e)},[e]);let v=o.data?.models.find(e=>e.id===c),y=c.split(`/`)[0],x=s.data?.find(e=>e.id===y)?.name??y,S=!c||!!v?.configured,C=async()=>{if(!(u||!S)){d(!0),h(``),_(!1);try{await r(c),_(!0)}catch(e){h(e instanceof Error?e.message:String(e))}finally{d(!1)}}};return(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start`,children:[(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,U.jsx)(L,{value:c,onChange:e=>{l(e),a?.(e),_(!1),h(``)},zh:t,disabled:n||u})}),(0,U.jsx)(p,{variant:`primary`,disabled:n||u||!o.data||!S||c===e,onClick:()=>{C()},children:u?t?`保存中…`:`Saving…`:t?`保存`:`Save`})]}),c&&o.data?(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:v?.mock?t?`本地模拟测试,无需 API Key。`:`Local mock testing. No API key required.`:v?`${t?`服务商`:`Provider`}:${x} · ${v.configured?t?`凭据已配置`:`Credentials configured`:t?`请先配置凭据`:`Configure credentials first`}`:t?`当前模型不可用,请重新选择。`:`This model is unavailable. Choose another model.`}):null,(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[t?`仅显示支持手机操作的模型。`:`Only Phone Use models are listed.`,(0,U.jsx)(i,{to:`/settings/capabilities/models`,className:`ml-1 text-accent-fg hover:underline`,children:t?`前往模型管理添加或配置`:`Add or configure in Models`})]}),m&&(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:m}),g&&(0,U.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:t?`手机模型已保存`:`Phone model saved`})]})}var ae=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,oe=`space-y-4 rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`;function se({device:e,serial:t,name:n,onSave:r,onClose:i,zh:a}){let[o,s]=(0,H.useState)(e?.name??n),[c,l]=(0,H.useState)(e?.appAccess??(e?.allowedApps.length?`selected`:`all`)),[u,d]=(0,H.useState)(e?.allowedApps??[]),[f,m]=(0,H.useState)(e?.enabled??!0),[g,v]=(0,H.useState)(!1),[b,x]=(0,H.useState)(``),C=async()=>{v(!0),x(``);try{let n={name:o,appAccess:c,allowedApps:c===`all`?[]:u,enabled:f};await B(e?`/devices/${e.id}`:`/devices`,e?n:{...n,serial:t},e?`PATCH`:`POST`),await r(),i()}catch(e){x(e instanceof Error?e.message:String(e))}finally{v(!1)}};return(0,U.jsx)(_,{open:!0,onOpenChange:e=>{!e&&!g&&i()},children:(0,U.jsxs)(h,{children:[(0,U.jsx)(j,{className:`fixed inset-0 z-[80] bg-black/40`}),(0,U.jsxs)(S,{className:`fixed left-1/2 top-1/2 z-[81] flex h-[min(44rem,90dvh)] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay p-5 text-fg`,children:[(0,U.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(T,{className:`text-base font-semibold`,children:e?a?`管理手机`:`Manage phone`:a?`添加手机`:`Add phone`}),(0,U.jsx)(w,{className:`mt-1 text-sm text-fg-muted`,children:a?`设备连接在 Gateway 所在电脑。修改权限会停止当前控制。`:`This phone connects to the Gateway host. Changing access stops active control.`})]}),(0,U.jsx)(y,{asChild:!0,children:(0,U.jsx)(p,{variant:`ghost`,disabled:g,"aria-label":a?`关闭`:`Close`,children:(0,U.jsx)(ee,{className:`size-4`})})})]}),(0,U.jsxs)(`form`,{className:`mt-5 flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),C()},children:[(0,U.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto pr-1`,children:[(0,U.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[a?`名称`:`Name`,(0,U.jsx)(`input`,{className:ae,value:o,maxLength:100,required:!0,onChange:e=>s(e.target.value)})]}),(0,U.jsxs)(`p`,{className:`break-all text-xs text-fg-muted`,children:[`ADB: `,t]}),(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a?`已启用 phone_use 工具的 Agent 可使用这台手机。`:`Agents with the phone_use tool can use this phone.`}),(0,U.jsx)(q,{deviceId:e?.id,serial:t,mode:c,selected:u,onModeChange:l,onSelectedChange:d,zh:a,disabled:g}),(0,U.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-3 text-sm`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:f,onChange:e=>m(e.target.checked)}),a?`允许访问这台手机`:`Enable access to this phone`]}),b&&(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:b})]}),(0,U.jsxs)(`div`,{className:`mt-4 flex shrink-0 justify-end gap-2 border-t border-edge pt-4`,children:[(0,U.jsx)(p,{type:`button`,disabled:g,onClick:i,children:a?`取消`:`Cancel`}),(0,U.jsx)(p,{type:`submit`,variant:`primary`,disabled:g||!o.trim()||c===`selected`&&!u.length,children:g?a?`保存中…`:`Saving…`:a?`保存手机`:`Save phone`})]})]})]})]})})}function Y(){let e=d(e=>e.language)===`zh`,t=f(`phone-settings`,I),n=f(`phone-devices`,ne,{refreshInterval:15e3}),r=f(`settings-agent-defaults`,g),i=r.data?.defaults.models.phoneUse?.primary??``,[a,c]=(0,H.useState)(i);(0,H.useEffect)(()=>{c(i)},[i]);let[l,u]=(0,H.useState)(!1),[h,_]=(0,H.useState)(``),[y,b]=(0,H.useState)(``),[x,S]=(0,H.useState)(!1),[w,T]=(0,H.useState)(),[O,ee]=(0,H.useState)(``),[j,N]=(0,H.useState)(``),[P,L]=(0,H.useState)(``),[z,re]=(0,H.useState)(()=>sessionStorage.getItem(`phone-settings-session`)??``),W=f(z?[`phone-session`,z]:null,()=>B(`/sessions/${z}`),{refreshInterval:1500}),[G,q]=(0,H.useState)(),[Y,ce]=(0,H.useState)({}),X=W.data,Z=X?.status===`running`,le=O||n.data?.defaultDeviceId||``,Q=i===F,$=async(e,t)=>{u(!0),_(``),b(``);try{await e(),t&&b(t)}catch(e){_(e instanceof Error?e.message:String(e))}finally{u(!1)}},ue=async e=>{let t=await g(),n={...t.defaults.models};e?n.phoneUse={primary:e,fallbacks:[]}:delete n.phoneUse;let i=await C({...t.defaults,models:n},{scope:`models`,expectedModels:t.defaults.models});await r.mutate(i,!1),c(e)},de=()=>$(async()=>{z&&X&&![`closed`,`cancelled`,`failed`,`outcome_unknown`].includes(X.status)&&await B(`/sessions/${z}/execute`,{op:`close`});let e=await B(`/sessions`,{deviceId:le,mode:`control`,...Q?{appPackage:`com.android.settings`}:{}});re(e.id),sessionStorage.setItem(`phone-settings-session`,e.id),await B(`/sessions/${e.id}/execute`,Q?{op:`run`,scenario:`settings-about`,goal:R,maxActions:8}:{op:`run`,goal:j,...P?{expectText:P}:{},maxActions:6})}),fe=e=>$(async()=>{await B(`/sessions/${z}/execute`,{op:e}),await W.mutate()}),pe=async t=>{ce(n=>({...n,[t.id]:{pending:!0,text:e?`正在诊断…`:`Checking…`}}));try{let n=await B(`/devices/${t.id}/diagnostics`,{}),r=e?{device:`已连接`,disconnected:`未连接`,unauthorized:`未授权调试`,offline:`离线`}:{device:`Connected`,disconnected:`Disconnected`,unauthorized:`Debugging not authorized`,offline:`Offline`};ce(i=>({...i,[t.id]:{pending:!1,text:`${e?`诊断结果`:`Diagnostics`}:${r[n.state]??n.state}`}}))}catch(e){ce(n=>({...n,[t.id]:{pending:!1,error:!0,text:e instanceof Error?e.message:String(e)}}))}},me=e?{ready:`就绪`,running:`执行中`,paused:`已暂停`,needs_user:`等待人工处理`,completed:`执行结束`,cancelled:`已停止`,closed:`已关闭`,failed:`执行失败`,outcome_unknown:`结果待核查`}:{},he=!!(n.data?.devices.length&&n.data.devices.every(e=>e.connection));return(0,U.jsxs)(te,{gap:`gap-7`,children:[(0,U.jsx)(M,{title:(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[e?`手机控制`:`Phone Use`,(0,U.jsx)(D,{})]}),subtitle:e?`连接 Android 手机或模拟器,配置独立的手机操作模型。`:`Connect an Android phone or emulator and choose a dedicated phone model.`}),h&&(0,U.jsx)(`p`,{role:`alert`,className:`rounded-xl bg-danger-soft p-3 text-sm text-danger`,children:h}),y&&(0,U.jsx)(`p`,{role:`status`,className:`text-sm text-fg-muted`,children:y}),t.error&&(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(t.error)}),(0,U.jsxs)(`section`,{className:oe,"aria-label":e?`手机控制设置`:`Phone control settings`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{className:`text-sm font-semibold`,children:e?`启用手机控制`:`Enable Phone Use`}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e?`执行位置:Gateway 所在电脑。远程浏览器不会连接你本机的 USB。`:`Runs on the Gateway host. A remote browser cannot access your local USB devices.`})]}),t.data?(0,U.jsx)(`input`,{type:`checkbox`,role:`switch`,"aria-checked":t.data.config.enabled,"aria-label":e?`启用手机控制`:`Enable Phone Use`,className:`size-5 shrink-0 accent-accent`,checked:t.data.config.enabled,disabled:l||Z,onChange:e=>{let n=e.target.checked;$(async()=>{await B(`/settings`,{...t.data.config,enabled:n},`PATCH`),await t.mutate()})}}):(0,U.jsx)(m,{className:`h-8 w-12`})]}),t.data&&(0,U.jsxs)(`details`,{className:`text-sm`,children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-fg-muted`,children:e?`执行限制`:`Execution limits`}),(0,U.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[e?`每次小目标最多 12 步、${t.data.config.maxOperationDurationMs/1e3} 秒活跃执行时间;会话限制`:`Each goal: up to 12 actions / ${t.data.config.maxOperationDurationMs/1e3} active seconds. Session limits`,`: `,t.data.config.maxActionsPerSession,` `,e?`动作`:`actions`,` · `,t.data.config.maxModelRequests,` `,e?`模型请求`:`model requests`]})]})]}),(0,U.jsxs)(`section`,{"aria-label":e?`手机模型配置`:`Phone model configuration`,className:oe,children:[(0,U.jsx)(`h2`,{className:`text-sm font-semibold`,children:e?`手机操作模型`:`Phone model`}),!r.data&&!r.error?(0,U.jsx)(m,{className:`h-44 w-full`}):(0,U.jsx)(J,{value:i,onSelect:c,onSave:ue,zh:e,disabled:l||Z||!r.data}),r.error&&(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(r.error)}),(0,U.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:e?`手机截图会发送给所选模型;页面摘要可能进入聊天模型。`:`Phone screenshots go to the selected model; page summaries may reach the chat model.`}),(0,U.jsx)(`div`,{className:`flex flex-wrap items-center gap-3`,children:(0,U.jsx)(p,{disabled:l||!a,onClick:()=>{$(async()=>{let t=await B(`/models/diagnostics`,{modelRef:a});b(t.mock?e?`模拟适配器可用;此测试不验证真实模型。`:`Mock adapter ready; this does not validate a real model.`:t.groundingVerified?e?`模型连接、动作协议和测试图定位通过;未操作真实手机。`:`Connection, protocol and test-image grounding passed. No phone was operated.`:e?`动作协议有效,但测试图定位未通过。`:`Protocol valid, but test-image grounding did not pass.`)})},children:e?`测试模型连接`:`Test model connection`})})]}),(0,U.jsx)(V,{cloudOnly:he,onChanged:()=>{n.mutate(),t.mutate()}}),(0,U.jsxs)(`section`,{className:`space-y-3`,"aria-label":e?`手机管理`:`Phone management`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`h2`,{className:`text-sm font-semibold`,children:e?`手机管理`:`Phones`}),(0,U.jsx)(p,{disabled:l,onClick:()=>S(!0),children:e?`添加手机`:`Add phone`}),(0,U.jsxs)(p,{disabled:l||n.isValidating,onClick:()=>{$(()=>n.mutate())},children:[(0,U.jsx)(v,{className:`size-4`}),e?`刷新设备`:`Refresh devices`]})]}),!n.data&&!n.error?(0,U.jsx)(m,{className:`h-32 w-full rounded-xl`}):(0,U.jsxs)(`div`,{className:oe,children:[(n.error||!he&&n.data?.diagnostic)&&(0,U.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[n.data?.diagnostic??String(n.error),` · `,e?`检查 Gateway 电脑的 Android SDK 与 ADB。`:`Check Android SDK and ADB on the Gateway host.`]}),n.data?.devices.map(t=>(0,U.jsxs)(`div`,{className:`space-y-3 border-b border-edge-subtle pb-4 last:border-b-0 last:pb-0`,children:[(0,U.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,U.jsx)(A,{className:`mt-0.5 size-5 shrink-0 text-fg-muted`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`p`,{className:`break-words text-sm font-medium`,children:[t.name,t.id===n.data?.defaultDeviceId&&(0,U.jsx)(`span`,{className:`ml-2 text-xs text-fg-muted`,children:e?`默认`:`Default`})]}),(0,U.jsxs)(`p`,{className:`mt-1 break-all text-xs text-fg-muted`,children:[t.connection?`${e?`阿里云`:`Alibaba Cloud`} · ADB · `:``,t.serial,` · `,t.enabled?t.connection?e?`已配置 · 按需连接`:`Configured · Connects on demand`:n.data?.discovery.find(e=>e.serial===t.serial)?.state??(e?`离线`:`Disconnected`):e?`已禁用`:`Disabled`]})]})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(p,{disabled:l,onClick:()=>T({device:t,serial:t.serial,name:t.name}),children:e?`管理`:`Manage`}),(0,U.jsx)(p,{disabled:l||Z,onClick:()=>{q(t)},children:e?`查看屏幕`:`View screen`}),(0,U.jsx)(p,{disabled:l||Y[t.id]?.pending,onClick:()=>{pe(t)},children:t.connection?e?`连接诊断`:`Connect & diagnose`:e?`诊断`:`Diagnose`}),t.id!==n.data?.defaultDeviceId&&(0,U.jsx)(p,{disabled:l,onClick:()=>{$(async()=>{await B(`/devices/${t.id}/default`,{}),await n.mutate()})},children:e?`设为默认`:`Set default`}),(0,U.jsx)(p,{variant:`ghost`,disabled:l,onClick:()=>{$(async()=>{await B(`/devices/${t.id}`,void 0,`DELETE`),await n.mutate()})},children:e?`移除连接`:`Remove connection`})]}),(0,U.jsx)(`p`,{role:`status`,"aria-live":`polite`,title:Y[t.id]?.text,className:`h-5 truncate text-xs leading-5 ${Y[t.id]?.error?`text-danger`:`text-fg-muted`}`,children:Y[t.id]?.text})]},t.id)),n.data?.discovery.filter(e=>!n.data?.devices.some(t=>t.serial===e.serial)).map(t=>(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-sm`,children:t.name}),(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[t.emulator?e?`Android 模拟器`:`Android emulator`:`Android`,` · `,t.state]})]}),(0,U.jsx)(p,{disabled:l||t.state!==`device`,onClick:()=>T({serial:t.serial,name:t.name}),children:e?`添加手机`:`Add phone`})]},t.serial)),!n.data?.devices.length&&!n.data?.discovery.length&&(0,U.jsx)(`p`,{className:`py-3 text-sm text-fg-muted`,children:e?`尚未发现设备。先启动 Android 模拟器,或通过 USB 连接手机并允许调试。`:`No devices found. Start an Android emulator, or connect a phone over USB and authorize debugging.`})]})]}),(0,U.jsxs)(`section`,{className:oe,"aria-label":e?`手机试运行`:`Phone test run`,children:[(0,U.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold`,children:[(0,U.jsx)(k,{className:`size-4`}),e?`试运行`:`Test run`]}),(0,U.jsxs)(o,{"aria-label":e?`测试手机`:`Test phone`,value:le,disabled:l||Z,onChange:e=>ee(e.target.value),children:[(0,U.jsx)(s,{value:``,children:e?`选择手机`:`Choose phone`}),n.data?.devices.filter(e=>e.enabled).map(e=>(0,U.jsx)(s,{value:e.id,children:e.name},e.id))]}),Q?(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e?`固定测试:打开系统设置,进入关于手机,并通过界面文字验证结果。这是模拟模型,不是 AI 推理。`:`Fixed test: open Settings, navigate to About phone and verify native UI evidence. This is a scripted mock, not AI inference.`}):(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[e?`本次授权的小目标`:`Authorized goal`,(0,U.jsx)(`textarea`,{className:ae,value:j,maxLength:2e3,onChange:e=>N(e.target.value)})]}),(0,U.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[e?`完成时应显示的文字(可选)`:`Expected completion text (optional)`,(0,U.jsx)(`input`,{className:ae,value:P,maxLength:200,onChange:e=>L(e.target.value)})]}),(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:e?`先手动打开允许的应用。模型说完成只表示执行结束,只有匹配界面证据才会显示验证通过。`:`First open an allowed app manually. A model completion claim remains unverified until native UI evidence matches.`})]}),(0,U.jsxs)(p,{variant:`primary`,disabled:l||Z||!t.data?.config.enabled||!i||a!==i||!le||!Q&&!j.trim(),onClick:()=>{de()},children:[(0,U.jsx)(E,{className:`size-4`}),Q?e?`运行模拟测试`:`Run mock test`:e?`开始试运行`:`Start test run`]}),W.error&&(0,U.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:String(W.error)}),X&&(0,U.jsxs)(`div`,{className:`space-y-3 rounded-xl border border-edge bg-surface-inset p-4`,"aria-live":`polite`,children:[(0,U.jsxs)(`p`,{className:`text-sm font-medium`,children:[X.deviceName,` · `,me[X.status]??X.status]}),(0,U.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[X.actions,` `,e?`动作`:`actions`,` · `,X.modelRequests,` `,e?`模型请求`:`model requests`,` · `,X.verified?e?`界面条件已验证`:`UI condition verified`:e?`尚未验证完成`:`Completion unverified`]}),X.message&&(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:X.message}),(X.errorCode||X.stopReason)&&(0,U.jsx)(`p`,{className:`break-all text-xs text-fg-muted`,children:X.errorCode??X.stopReason}),(0,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(p,{disabled:l||!Z,onClick:()=>{fe(`pause`)},children:e?`暂停`:`Pause`}),(0,U.jsx)(p,{disabled:l||![`paused`,`needs_user`].includes(X.status),onClick:()=>{fe(`resume`)},children:e?`恢复`:`Resume`}),(0,U.jsx)(p,{disabled:l||[`closed`,`cancelled`].includes(X.status),onClick:()=>{fe(`cancel`)},children:e?`停止`:`Stop`}),(0,U.jsx)(p,{disabled:l,onClick:()=>{fe(`close`)},children:e?`释放手机`:`Release phone`}),X.status===`ready`&&(0,U.jsx)(p,{disabled:l,onClick:()=>{$(async()=>{await B(`/sessions/${z}/execute`,Q?{op:`run`,scenario:`settings-about`,goal:`Open Android Settings and inspect About phone`,maxActions:8}:{op:`run`,goal:j,...P?{expectText:P}:{}}),await W.mutate()})},children:e?`继续当前目标`:`Continue goal`})]}),X.facts?.length?(0,U.jsxs)(`details`,{children:[(0,U.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:e?`本次观察到的界面文字`:`Observed UI text`}),(0,U.jsx)(`ul`,{className:`mt-2 max-h-52 space-y-1 overflow-auto text-xs text-fg-muted`,children:X.facts.map((e,t)=>(0,U.jsx)(`li`,{className:`break-words`,children:e},t))})]}):null]})]}),G&&(0,U.jsx)(K,{device:G,sessionId:X?.deviceId===G.id&&![`closed`,`cancelled`,`failed`,`outcome_unknown`].includes(X.status)?z:void 0,zh:e,onClose:()=>q(void 0)}),x&&(0,U.jsx)(ie,{onAdded:()=>{n.mutate()},zh:e,onClose:()=>S(!1),onSelect:e=>{S(!1),T({serial:e.serial,name:e.name})}}),w&&t.data&&(0,U.jsx)(se,{...w,zh:e,onSave:async()=>{await n.mutate()},onClose:()=>T(void 0)})]})}export{Y as PhoneSettingsPage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./chunk-KS7C4IRE-BvcCCgTW.js";import{i as ee,n as a,o}from"./locale-store-JogcXC4J.js";import{a as s,i as te}from"./vendor-swr-BIWyz7Rc.js";import{t as c}from"./button-aIC072nz.js";import{t as l}from"./skeleton-BI5TyibZ.js";import{Bc as u,F as d,Fc as f,I as p,Ic as m,Lc as ne,P as re,Rc as h,Vc as ie,qc as ae,tu as oe,z as se,zc as ce}from"./index-ygkHNYyo.js";import{n as g,t as le}from"./plugin-presentation-CO5BFDGW.js";var _=n(),v=e(t(),1),y=r();function b(e){let t=(0,_.c)(61),{pluginId:n,initialConnect:r,onClose:b}=e,S=r===void 0?!1:r,C=a(x).startsWith(`zh`),{mutate:w}=s(),[ue,T]=(0,v.useState)(!1),E=(0,v.useRef)(document.activeElement instanceof HTMLElement?document.activeElement:null),D;t[0]===n?D=t[1]:(D=async()=>{let e=await o(ee(`/api/extensions/agent-plugins/${encodeURIComponent(n)}`));if(!e.ok)throw Error(e.error??`Plugin not found`);return e.payload},t[0]=n,t[1]=D);let O;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(O={revalidateOnFocus:!0},t[2]=O):O=t[2];let{data:k,error:A,mutate:j}=te(`plugin-details:${n}`,D,O),M=k?g(k,C):C?`插件详情`:`Plugin details`,N=k?.localizations?.[C?`zh-CN`:`en`]?.description??k?.description;if(ue&&k){let e;t[3]!==j||t[4]!==T?(e=()=>{T(!1),j()},t[3]=j,t[4]=T,t[5]=e):e=t[5];let n;return t[6]!==k||t[7]!==b||t[8]!==e?(n=(0,y.jsx)(re,{extension:k,onUninstalled:b,onClose:e}),t[6]=k,t[7]=b,t[8]=e,t[9]=n):n=t[9],n}let P;t[10]===b?P=t[11]:(P=e=>{e||b()},t[10]=b,t[11]=P);let F;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,y.jsx)(ce,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[12]=F):F=t[12];let I;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(I=e=>{E.current?.isConnected&&(e.preventDefault(),E.current.focus({preventScroll:!0}))},t[13]=I):I=t[13];let L=k?.branding?.iconUrl,R;t[14]===L?R=t[15]:(R=(0,y.jsx)(d,{iconUrl:L,fallback:oe}),t[14]=L,t[15]=R);let z;t[16]===M?z=t[17]:(z=(0,y.jsx)(ie,{className:`truncate text-base font-semibold text-fg`,children:M}),t[16]=M,t[17]=z);let B;t[18]===k?B=t[19]:(B=k?(0,y.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[k.version,` · `,k.name]}):null,t[18]=k,t[19]=B);let V;t[20]!==B||t[21]!==z?(V=(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[z,B]}),t[20]=B,t[21]=z,t[22]=V):V=t[22];let H=C?`关闭插件详情`:`Close plugin details`,U;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,y.jsx)(ae,{className:`size-5`,"aria-hidden":!0}),t[23]=U):U=t[23];let W;t[24]===H?W=t[25]:(W=(0,y.jsx)(m,{asChild:!0,children:(0,y.jsx)(c,{variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":H,children:U})}),t[24]=H,t[25]=W);let G;t[26]!==V||t[27]!==W||t[28]!==R?(G=(0,y.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-edge px-5 py-4`,children:[R,V,W]}),t[26]=V,t[27]=W,t[28]=R,t[29]=G):G=t[29];let K=C?`查看插件能力、管理账号连接与授权。关闭后返回原来的列表。`:`View plugin capabilities and manage account connections. Close to return to the list.`,q;t[30]===K?q=t[31]:(q=(0,y.jsx)(h,{className:`sr-only`,children:K}),t[30]=K,t[31]=q);let J;t[32]!==k||t[33]!==N||t[34]!==A||t[35]!==S||t[36]!==w||t[37]!==b||t[38]!==n||t[39]!==j||t[40]!==C?(J=(0,y.jsx)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`,children:A?(0,y.jsx)(`p`,{role:`alert`,className:`text-sm text-fg-muted`,children:String(A)}):k?(0,y.jsxs)(y.Fragment,{children:[N?(0,y.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:N}):null,(0,y.jsx)(p,{initialConnect:S,extension:k,zh:C,onChanged:async()=>{await j(),await w(`gateway-extensions-list`)}},n),k.components?.skills.length?(0,y.jsxs)(`section`,{className:`space-y-3 border-t border-edge pt-5`,children:[(0,y.jsx)(`h3`,{className:`text-sm font-medium`,children:C?`技能(${k.components.skills.length})`:`Skills (${k.components.skills.length})`}),(0,y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:k.components.skills.map(e=>(0,y.jsx)(i,{onClick:b,to:`/capabilities/skills?${new URLSearchParams({tab:`installed`,source:`plugin`,q:k.dialect===`portable`?e.name:`${n}.${e.name}`})}`,className:`max-w-full break-words rounded-lg border border-edge px-3 py-2 text-sm text-accent hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:e.name},e.name))})]}):null]}):(0,y.jsxs)(`div`,{className:`space-y-4`,"aria-busy":`true`,children:[(0,y.jsx)(l,{className:`h-14 w-full`}),(0,y.jsx)(l,{className:`h-28 w-full`}),(0,y.jsx)(l,{className:`h-40 w-full`})]})}),t[32]=k,t[33]=N,t[34]=A,t[35]=S,t[36]=w,t[37]=b,t[38]=n,t[39]=j,t[40]=C,t[41]=J):J=t[41];let Y;t[42]!==k||t[43]!==T||t[44]!==C?(Y=k?(0,y.jsx)(c,{variant:`ghost`,onClick:()=>T(!0),children:C?`管理插件`:`Manage plugin`}):(0,y.jsx)(`span`,{}),t[42]=k,t[43]=T,t[44]=C,t[45]=Y):Y=t[45];let X;t[46]!==k||t[47]!==M||t[48]!==C?(X=k&&le(k)?(0,y.jsx)(c,{asChild:!0,children:(0,y.jsx)(i,{to:se(M,C),children:C?`开始使用`:`Start using`})}):(0,y.jsx)(m,{asChild:!0,children:(0,y.jsx)(c,{variant:`secondary`,children:C?`完成`:`Done`})}),t[46]=k,t[47]=M,t[48]=C,t[49]=X):X=t[49];let Z;t[50]!==Y||t[51]!==X?(Z=(0,y.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 border-t border-edge px-5 py-4`,children:[Y,X]}),t[50]=Y,t[51]=X,t[52]=Z):Z=t[52];let Q;t[53]!==G||t[54]!==q||t[55]!==J||t[56]!==Z?(Q=(0,y.jsxs)(u,{children:[F,(0,y.jsxs)(ne,{onCloseAutoFocus:I,className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[131] flex h-[min(38rem,calc(100dvh-2rem))] w-[min(42rem,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-popover`,children:[G,q,J,Z]})]}),t[53]=G,t[54]=q,t[55]=J,t[56]=Z,t[57]=Q):Q=t[57];let $;return t[58]!==Q||t[59]!==P?($=(0,y.jsx)(f,{open:!0,onOpenChange:P,children:Q}),t[58]=Q,t[59]=P,t[60]=$):$=t[60],$}function x(e){return e.language}export{b as PluginDetailsDialog};
|