@xopcai/xopc 0.0.286 → 0.0.291
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/README.md +16 -0
- package/README.zh-CN.md +16 -0
- package/dist/browser-ext/dist/assets/{auth-BXCWrPlg.js → auth-B2CDTr_F.js} +2 -1
- package/dist/browser-ext/dist/background.js +1 -1
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +36 -10
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-xOhV8FHx.js → activity-store-6lmzUBEr.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BzQbYWEj.js → agent-avatar-dicebear-BCtrkF15.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D2eYNelh.js +1 -0
- package/dist/gateway/static/root/assets/agents-BedA5XwI.js +1 -0
- package/dist/gateway/static/root/assets/{api-CVJQLBv9.js → api-D6yepxBp.js} +1 -1
- package/dist/gateway/static/root/assets/api-Dnfnl1Gd.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CTyuXkNC.js → app-management-settings-panel-Md562Fo-.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-Tk-GJtvF.js → appearance-settings-BiBFI4BM.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BA-7OrhJ.js → apps-page-Corla83b.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-O49jeeXo.js → archive-plugin-A_Unp751.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-r9lBF2tW.js → attachment-load-D6idSUyP.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CFFLXYgS.js → automations-page-C6j71Lgs.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-DjZdhLQ5.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BpM43vsn.js → binary-plugins-BkKYh-8v.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DFrfEcGw.js → block-editor-CDcMvaku.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-CyHGQwxQ.js → browser-automation-inputs-Cq4sIJt2.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-CPkOWfM9.js → browser-automations-page-C64k4TBH.js} +2 -2
- package/dist/gateway/static/root/assets/{browser-settings-page-BOcseZxg.js → browser-settings-page-1k5rj_qR.js} +3 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B2NvoTYb.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-DExixzp4.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-BArPeImO.js → channels-status-swr-CVzEYBpX.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D5Aka4S8.js → chat-terminal-dock-B9eKFkbg.js} +2 -2
- package/dist/gateway/static/root/assets/computer-model-settings-DW6j2lsn.js +1 -0
- package/dist/gateway/static/root/assets/computer-settings-page-C2Qyw63Q.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-C3ubZz7K.js +2 -0
- package/dist/gateway/static/root/assets/{date-picker-DNtRu6EB.js → date-picker-BdxjXVKL.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-Dng3dIQa.js → dependency-picker-CXOa4uh4.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-BicYycxy.js → desktop-pet-CBWiAaSv.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BEse55eX.js → desktop-pet-settings-BX1aILDK.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-be30HuFI.js → device-pairing-wizard-bqm_Yf4i.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-YzhYyuay.js → extension-debug-page-B4MMerja.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CEXVIkDl.js → extension-page-B3ZtINak.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CrlbgK8g.js → extension-settings-page-8BkQVh0z.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-BNuoHXiZ.js → gateway-config-swr-BBovMBQ1.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-ZyhacQX5.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-zMPfje0n.js → gateway-startup-retry-NXDtzZED.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-BtxitqZ3.js → heartbeat-settings-Bllcxm2A.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-Cv2e8XBR.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-B_Tyx74A.js → image-generation-api-D01ieqGC.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-eZciuLw_.js → imports-page-DJG1BJzd.js} +1 -1
- package/dist/gateway/static/root/assets/index-B7EieIE4.js +75 -0
- package/dist/gateway/static/root/assets/index-BD5uNzie.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B796W039.js → keyboard-shortcuts-settings-6A6JOHTI.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Cipj52Zq.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-DXmY5jwM.js → local-apps-page-bD-m7YHJ.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-D0001I7p.js → locale-store-eliqUnBr.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-D5feO2yw.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-b1MG7s-3.js → management-settings-B7mz0_44.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-2txE_Blz.js → markdown-view-BIg7cei7.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CDEf3ksI.js → media-plugins-DQ2HfMeG.js} +1 -1
- package/dist/gateway/static/root/assets/messages-NYDOR8-j.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-DhYJigb3.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-Bg5NPUdf.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-Bi_-DA5J.js → page-tabs-DmG_Qjl8.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Dhfdf14p.js → preview-open-alternatives-Y9J1kjKC.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-page-BNouL7Tv.js → proactive-page-Duc_NQ8l.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BkbZBqBr.js → product-open-page-DtgWUAwT.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DVOiucVA.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Dr_kDoCJ.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-icwoEKYB.js → registry-api-Dpm3N2h0.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-hyJ2KKKK.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-bmgxwWpW.js → runtime-tools-settings-panel-DB7J9opJ.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-DoZeepCg.js → schema-form-CMYuPOlE.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DGsnYcoh.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DuzZqQMn.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-sw2bbS2b.js → settings-form-section-BayJP08a.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BWF8uac0.js → settings-page-CWBqZtt6.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C97S5g5c.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BIHYD6-O.js → share-preview-page-Wn5bQA-5.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-pfVzP8F7.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DDJ0ZKx3.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DbDpLjDW.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-dvue6Ish.js → skills-page.utils-DCHY_kou.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DCyxPWCl.js → system-settings-panel-DhgITgId.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-UqwtiHYu.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-CZwYGpbY.js → theme-store-DUHPzKzv.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-__auf8Ww.js → tunnel-api-DJ3gz2tM.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-Iq83UDt3.js → use-autosave-htvgT192.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-xOsXY_2W.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-D-QssKik.js → voice-api-key-field-BviJF3Oa.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-B0wNN_tE.js → voice-config-api-Bjy8EFqi.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-5NRYg1iI.js → work-discovery-overlay-BOBVNEYZ.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Ds2SZjLG.js → workflow-run-setup-panel-D1N9uUyM.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-2ylzlgkG.js +6 -0
- package/dist/gateway/static/root/index.html +10 -10
- package/dist/package.js +1 -1
- package/dist/packages/computer-control-contract/src/index.js +178 -0
- package/dist/packages/realtime-protocol/src/voice-audio.js +15 -10
- package/dist/packages/realtime-protocol/src/voice-catalog.js +61 -0
- package/dist/packages/realtime-protocol/src/voice.js +257 -248
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +5 -4
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/embedded/run-turn.js +9 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +4 -2
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +1 -1
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/index.js +25 -15
- package/dist/src/agent/skills/parse-skill-metadata.d.ts +5 -1
- package/dist/src/agent/skills/parse-skill-metadata.js +21 -1
- package/dist/src/agent/skills/types.d.ts +7 -0
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent/tool-manuals/computer.d.ts +1 -0
- package/dist/src/agent/tool-manuals/computer.js +19 -0
- package/dist/src/agent/tool-manuals/index.js +7 -0
- package/dist/src/agent/tools/computer-use-tool.d.ts +11 -0
- package/dist/src/agent/tools/computer-use-tool.js +86 -0
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +30 -0
- package/dist/src/agent-config/index.js +2 -2
- package/dist/src/agent-config/resolver.js +5 -0
- package/dist/src/agent-config/schema.d.ts +32 -0
- package/dist/src/agent-config/schema.js +5 -2
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/capabilities/readiness/from-config.js +14 -2
- package/dist/src/capabilities/readiness/planner.js +3 -2
- package/dist/src/capabilities/readiness/types.d.ts +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +3 -3
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/computer/broker.d.ts +97 -0
- package/dist/src/computer/broker.js +337 -0
- package/dist/src/computer/config.d.ts +9 -0
- package/dist/src/computer/config.js +16 -0
- package/dist/src/computer/control-guard.d.ts +4 -0
- package/dist/src/computer/control-guard.js +17 -0
- package/dist/src/computer/errors.d.ts +7 -0
- package/dist/src/computer/errors.js +30 -0
- package/dist/src/computer/model-adapter.d.ts +44 -0
- package/dist/src/computer/model-adapter.js +273 -0
- package/dist/src/computer/model-config.d.ts +3 -0
- package/dist/src/computer/model-config.js +27 -0
- package/dist/src/computer/model-policy.d.ts +3 -0
- package/dist/src/computer/model-policy.js +20 -0
- package/dist/src/computer/runtime.d.ts +128 -0
- package/dist/src/computer/runtime.js +388 -0
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.d.ts +36 -0
- package/dist/src/config/models-json.js +15 -1
- package/dist/src/config/schema.d.ts +37 -0
- package/dist/src/config/schema.js +11 -2
- package/dist/src/config/voice.js +2 -2
- package/dist/src/endpoint-tools/invocation-service.d.ts +1 -0
- package/dist/src/endpoint-tools/invocation-service.js +5 -2
- package/dist/src/endpoint-tools/policy.js +7 -0
- package/dist/src/endpoint-tools/runtime.js +1 -0
- package/dist/src/endpoint-tools/upload-service.d.ts +13 -1
- package/dist/src/endpoint-tools/upload-service.js +73 -8
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +7 -1
- package/dist/src/gateway/agent-builtin-tools.js +7 -0
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/global-defaults-admin.js +16 -0
- package/dist/src/gateway/hono/lib/config-payload.d.ts +15 -0
- package/dist/src/gateway/hono/lib/config-payload.js +2 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +13 -2
- package/dist/src/gateway/hono/routes/endpoint-tools.js +3 -2
- package/dist/src/gateway/hono/routes/models.js +6 -3
- package/dist/src/gateway/hono/routes/voice.js +55 -1
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/security/gateway-scopes.d.ts +1 -1
- package/dist/src/gateway/security/gateway-scopes.js +3 -0
- package/dist/src/gateway/service/config-coordinator.js +4 -1
- package/dist/src/gateway/service.js +12 -12
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-catalog-persistence.js +11 -2
- package/dist/src/providers/model-catalog-store.js +1 -0
- package/dist/src/providers/model-catalog-types.d.ts +7 -2
- package/dist/src/providers/model-reference-auditor.js +6 -3
- package/dist/src/providers/model-registry.js +4 -1
- package/dist/src/providers/model-supplements.js +18 -2
- package/dist/src/providers/presentation.js +4 -2
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/providers/xopc-cloud-model-source.js +10 -4
- package/dist/src/storage/sqlite/index.d.ts +1 -1
- package/dist/src/storage/sqlite/index.js +2 -2
- package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +8 -0
- package/dist/src/storage/sqlite/migrations/conversation-backup.js +17 -7
- package/dist/src/storage/sqlite/migrations/conversation-windows-owners.js +5 -2
- package/dist/src/storage/sqlite/migrations/discover.js +2 -2
- package/dist/src/storage/sqlite/migrations/errors.d.ts +5 -0
- package/dist/src/storage/sqlite/migrations/errors.js +12 -2
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -2
- package/dist/src/storage/sqlite/schema.js +2 -2
- package/dist/src/storage/sqlite/schema.sql +2641 -526
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui.js +2 -2
- package/dist/src/voice/platform-catalog.d.ts +81 -0
- package/dist/src/voice/platform-catalog.js +16 -0
- package/dist/src/voice/platform-settings.d.ts +4 -0
- package/dist/src/voice/platform-settings.js +120 -0
- package/dist/src/voice/platform-streams.d.ts +12 -0
- package/dist/src/voice/platform-streams.js +250 -0
- package/dist/src/voice/realtime/omniEngine.js +8 -5
- package/dist/src/voice/realtime/omniRoute.d.ts +1 -0
- package/dist/src/voice/realtime/omniRoute.js +11 -1
- package/dist/src/voice/realtime/runtime.js +14 -6
- package/dist/src/voice/stt/providers/xopc-cloud-transcription.js +15 -8
- package/dist/src/voice/tts/providers/xopc-cloud-speech.js +12 -19
- package/dist/src/work-discovery/service.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +7 -4
- package/skills/creative/algorithmic-art/SKILL.md +7 -0
- package/skills/creative/frontend-design/SKILL.md +8 -0
- package/skills/creative/hatch-pet/SKILL.md +7 -0
- package/skills/creative/theme-factory/SKILL.md +8 -0
- package/skills/documents/doc-coauthoring/SKILL.md +7 -0
- package/skills/documents/docx/SKILL.md +7 -0
- package/skills/documents/pdf/SKILL.md +7 -0
- package/skills/documents/pptx/SKILL.md +7 -0
- package/skills/documents/xlsx/SKILL.md +9 -1
- package/skills/engineering/build-xopc-local-app/SKILL.md +7 -0
- package/skills/engineering/define-task/SKILL.md +7 -0
- package/skills/engineering/diagnose/SKILL.md +8 -0
- package/skills/engineering/tdd/SKILL.md +8 -0
- package/skills/tools/find-skills/SKILL.md +8 -0
- package/skills/tools/github/SKILL.md +7 -0
- package/skills/tools/summarize/SKILL.md +8 -0
- package/skills/tools/webapp-testing/SKILL.md +8 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BxR5eog4.js +0 -1
- package/dist/gateway/static/root/assets/agents-Dx1om1eN.js +0 -1
- package/dist/gateway/static/root/assets/api-q1kIMCLW.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-DUZE1NOH.js +0 -6
- package/dist/gateway/static/root/assets/capabilities-settings-panel-ohEV64hG.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-UOf9mgqt.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BEQR0NRq.js +0 -2
- package/dist/gateway/static/root/assets/gateway-settings-CDJY1AOW.js +0 -1
- package/dist/gateway/static/root/assets/home-page-_oqo0pNR.js +0 -1
- package/dist/gateway/static/root/assets/index--YC42LAz.css +0 -2
- package/dist/gateway/static/root/assets/index-fVtuw2o9.js +0 -75
- package/dist/gateway/static/root/assets/local-app-workbench-page-Z8mpau9d.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-BGOO8ouT.js +0 -2
- package/dist/gateway/static/root/assets/messages-BWANv-N-.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-Bm33_3xJ.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-C32-xssK.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-CZ7glGYw.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-DP3ZINZz.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-xqJcPdOO.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BaxIfjpm.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cy3Ab3Vg.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BuYto2mT.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DKtWUneq.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Dn7ElMUk.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-D-7UtJIc.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-efmH43Pq.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-DByIJcQq.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-BJv3eoKR.js +0 -6
- package/dist/src/storage/sqlite/migrations/002_add_flush_columns.sql +0 -3
- package/dist/src/storage/sqlite/migrations/003_add_note_markdown_meta.sql +0 -4
- package/dist/src/storage/sqlite/migrations/004_add_session_type_metadata.sql +0 -15
- package/dist/src/storage/sqlite/migrations/005_add_note_agent_contexts.sql +0 -10
- package/dist/src/storage/sqlite/migrations/006_add_goals.sql +0 -108
- package/dist/src/storage/sqlite/migrations/007_goal_run_judge_schema.sql +0 -4
- package/dist/src/storage/sqlite/migrations/008_goal_queue_workflow_runs.sql +0 -53
- package/dist/src/storage/sqlite/migrations/009_cron_jobs.sql +0 -24
- package/dist/src/storage/sqlite/migrations/010_session_id_identity.sql +0 -30
- package/dist/src/storage/sqlite/migrations/011_goal_context_messages.sql +0 -8
- package/dist/src/storage/sqlite/migrations/012_memory_records.sql +0 -63
- package/dist/src/storage/sqlite/migrations/013_memory_trace_events.sql +0 -21
- package/dist/src/storage/sqlite/migrations/014_memory_record_governance.sql +0 -10
- package/dist/src/storage/sqlite/migrations/015_memory_trace_feedback.sql +0 -4
- package/dist/src/storage/sqlite/migrations/016_automations.sql +0 -47
- package/dist/src/storage/sqlite/migrations/017_automation_run_events.sql +0 -14
- package/dist/src/storage/sqlite/migrations/018_automation_safety.sql +0 -1
- package/dist/src/storage/sqlite/migrations/019_projects.sql +0 -40
- package/dist/src/storage/sqlite/migrations/020_project_default_agent.sql +0 -1
- package/dist/src/storage/sqlite/migrations/021_projects_fts.sql +0 -21
- package/dist/src/storage/sqlite/migrations/022_work_items.sql +0 -61
- package/dist/src/storage/sqlite/migrations/023_work_item_attachments.sql +0 -15
- package/dist/src/storage/sqlite/migrations/024_activity_events.sql +0 -62
- package/dist/src/storage/sqlite/migrations/025_project_pinned_at.sql +0 -5
- package/dist/src/storage/sqlite/migrations/026_goal_contracts.sql +0 -10
- package/dist/src/storage/sqlite/migrations/027_mobile_notifications.sql +0 -43
- package/dist/src/storage/sqlite/migrations/028_goal_evidence_requirements.sql +0 -47
- package/dist/src/storage/sqlite/migrations/029_user_understanding.sql +0 -133
- package/dist/src/storage/sqlite/migrations/030_connectors.sql +0 -94
- package/dist/src/storage/sqlite/migrations/031_connector_approvals.sql +0 -24
- package/dist/src/storage/sqlite/migrations/032_connector_webhook_deliveries.sql +0 -15
- package/dist/src/storage/sqlite/migrations/033_user_trust_policies.sql +0 -6
- package/dist/src/storage/sqlite/migrations/034_allow_global_auto_trust.sql +0 -14
- package/dist/src/storage/sqlite/migrations/035_user_profile_prompt_state.sql +0 -7
- package/dist/src/storage/sqlite/migrations/036_goal_outcome_metric.sql +0 -12
- package/dist/src/storage/sqlite/migrations/037_connected_knowledge_pipeline.sql +0 -47
- package/dist/src/storage/sqlite/migrations/038_user_owned_memory.sql +0 -68
- package/dist/src/storage/sqlite/migrations/039_memory_reference_consents.sql +0 -19
- package/dist/src/storage/sqlite/migrations/040_local_apps.sql +0 -32
- package/dist/src/storage/sqlite/migrations/041_local_app_release_lifecycle.sql +0 -17
- package/dist/src/storage/sqlite/migrations/042_work_discovery.sql +0 -41
- package/dist/src/storage/sqlite/migrations/043_local_app_acceptance_runs.sql +0 -16
- package/dist/src/storage/sqlite/migrations/044_repair_work_discovery_foreign_keys.sql +0 -75
- package/dist/src/storage/sqlite/migrations/045_extension_ui_grants.sql +0 -13
- package/dist/src/storage/sqlite/migrations/046_work_discovery_feedback.sql +0 -13
- package/dist/src/storage/sqlite/migrations/047_work_discovery_sources.sql +0 -16
- package/dist/src/storage/sqlite/migrations/048_work_understanding_investigations.sql +0 -40
- package/dist/src/storage/sqlite/migrations/049_work_understanding_threads.sql +0 -52
- package/dist/src/storage/sqlite/migrations/050_work_discovery_source_refreshes.sql +0 -15
- package/dist/src/storage/sqlite/migrations/051_focus_watches.sql +0 -26
- package/dist/src/storage/sqlite/migrations/052_proactive_insights.sql +0 -25
- package/dist/src/storage/sqlite/migrations/053_browser_recipes.sql +0 -45
- package/dist/src/storage/sqlite/migrations/054_task_outcomes.sql +0 -24
- package/dist/src/storage/sqlite/migrations/055_relationship_settings.sql +0 -14
- package/dist/src/storage/sqlite/migrations/056_task_verification.sql +0 -6
- package/dist/src/storage/sqlite/migrations/057_interaction_states.sql +0 -11
- package/dist/src/storage/sqlite/migrations/058_proactive_value.sql +0 -3
- package/dist/src/storage/sqlite/migrations/059_composer_input_history.sql +0 -8
- package/dist/src/storage/sqlite/migrations/060_remove_runtime_transcript_messages.sql +0 -45
- package/dist/src/storage/sqlite/migrations/061_drop_compaction_checkpoints.sql +0 -2
- package/dist/src/storage/sqlite/migrations/062_connector_learning_jobs.sql +0 -27
- package/dist/src/storage/sqlite/migrations/063_knowledge_collection_scopes.sql +0 -14
- package/dist/src/storage/sqlite/migrations/064_user_claims.sql +0 -60
- package/dist/src/storage/sqlite/migrations/065_knowledge_item_scope_identity.sql +0 -116
- package/dist/src/storage/sqlite/migrations/066_first_class_focuses.sql +0 -126
- package/dist/src/storage/sqlite/migrations/067_home_attention_acknowledgements.sql +0 -9
- package/dist/src/storage/sqlite/migrations/068_proactive_event_spine.sql +0 -71
- package/dist/src/storage/sqlite/migrations/069_proactive_scenario_control.sql +0 -69
- package/dist/src/storage/sqlite/migrations/070_proactive_execution.sql +0 -55
- package/dist/src/storage/sqlite/migrations/071_proactive_inbox.sql +0 -45
- package/dist/src/storage/sqlite/migrations/072_proactive_judgments.sql +0 -14
- package/dist/src/storage/sqlite/migrations/073_enable_default_proactive_scenarios.sql +0 -13
- package/dist/src/storage/sqlite/migrations/074_deduplicate_blocked_work_routing.sql +0 -5
- package/dist/src/storage/sqlite/migrations/075_connector_sync_policies.sql +0 -13
- package/dist/src/storage/sqlite/migrations/076_meeting_preparation_scenario.sql +0 -29
- package/dist/src/storage/sqlite/migrations/077_proactive_insight_fingerprints.sql +0 -4
- package/dist/src/storage/sqlite/migrations/078_discussion_captures.sql +0 -64
- package/dist/src/storage/sqlite/migrations/079_discussion_follow_up_scenario.sql +0 -29
- package/dist/src/storage/sqlite/migrations/080_task_outcome_context.sql +0 -15
- package/dist/src/storage/sqlite/migrations/081_project_monitoring_policies.sql +0 -10
- package/dist/src/storage/sqlite/migrations/082_one_click_live_discussions.sql +0 -100
- package/dist/src/storage/sqlite/migrations/083_session_task_plans.sql +0 -9
- package/dist/src/storage/sqlite/migrations/084_work_intake_lifecycle.sql +0 -26
- package/dist/src/storage/sqlite/migrations/085_task_outcome_projection.sql +0 -19
- package/dist/src/storage/sqlite/migrations/086_outcome_aggregates.sql +0 -168
- package/dist/src/storage/sqlite/migrations/087_context_snapshots.sql +0 -21
- package/dist/src/storage/sqlite/migrations/088_automation_execution_deadlines.sql +0 -5
- package/dist/src/storage/sqlite/migrations/089_automation_run_leases.sql +0 -8
- package/dist/src/storage/sqlite/migrations/090_outcome_contract_judgment.sql +0 -2
- package/dist/src/storage/sqlite/migrations/091_context_allocation.sql +0 -1
- package/dist/src/storage/sqlite/migrations/092_outcome_execution_runtime.sql +0 -88
- package/dist/src/storage/sqlite/migrations/093_remove_legacy_goals.sql +0 -174
- package/dist/src/storage/sqlite/migrations/094_outcome_judgment_and_authority.sql +0 -3
- package/dist/src/storage/sqlite/migrations/095_session_input_queue.sql +0 -35
- package/dist/src/storage/sqlite/migrations/096_drop_work_intakes.sql +0 -6
- package/dist/src/storage/sqlite/migrations/097_work_item_lifecycle.sql +0 -194
- package/dist/src/storage/sqlite/migrations/098_discussion_note_documents.sql +0 -99
- package/dist/src/storage/sqlite/migrations/099_task_model.sql +0 -500
- package/dist/src/storage/sqlite/migrations/100_project_task_taskrun.sql +0 -763
- package/dist/src/storage/sqlite/migrations/101_session_response_language.sql +0 -1
- package/dist/src/storage/sqlite/migrations/102_session_user_context_mode.sql +0 -2
- package/dist/src/storage/sqlite/migrations/103_finalize_structured_memory.sql +0 -3
- package/dist/src/storage/sqlite/migrations/104_turn_memory_feedback.sql +0 -77
- package/dist/src/storage/sqlite/migrations/105_dreaming_ledger.sql +0 -34
- package/dist/src/storage/sqlite/migrations/106_dreaming_run_reproducibility.sql +0 -2
- package/dist/src/storage/sqlite/migrations/107_connector_accounts.sql +0 -146
- package/dist/src/storage/sqlite/migrations/108_repair_user_memory_provider.sql +0 -18
- package/dist/src/storage/sqlite/migrations/109_endpoint_principals.sql +0 -14
- package/dist/src/storage/sqlite/migrations/110_session_input_origin.sql +0 -43
- package/dist/src/storage/sqlite/migrations/111_endpoint_tool_invocations.sql +0 -18
- package/dist/src/storage/sqlite/migrations/112_endpoint_instance_bindings.sql +0 -8
- package/dist/src/storage/sqlite/migrations/113_memory_evidence_single_source.sql +0 -76
- package/dist/src/storage/sqlite/migrations/114_user_context_domain.sql +0 -193
- package/dist/src/storage/sqlite/migrations/115_remove_legacy_user_context.sql +0 -6
- package/dist/src/storage/sqlite/migrations/116_structured_context_consolidation.sql +0 -38
- package/dist/src/storage/sqlite/migrations/117_unified_understanding_sources.sql +0 -110
- package/dist/src/storage/sqlite/migrations/118_task_board_rank.sql +0 -6
- package/dist/src/storage/sqlite/migrations/119_proactive_disposition.sql +0 -13
- package/dist/src/storage/sqlite/migrations/120_task_conversation.sql +0 -112
- package/dist/src/storage/sqlite/migrations/121_automation_inbox.sql +0 -24
- package/dist/src/storage/sqlite/migrations/122_automation_session_projects.sql +0 -18
- package/dist/src/storage/sqlite/migrations/123_remove_v2_compaction_boundaries.sql +0 -25
- package/dist/src/storage/sqlite/migrations/124_workflow_context_snapshots.sql +0 -15
- package/dist/src/storage/sqlite/migrations/125_project_workflow_presets.sql +0 -12
- package/dist/src/storage/sqlite/migrations/126_focus_context_governance.sql +0 -72
- package/dist/src/storage/sqlite/migrations/127_context_object_origin.sql +0 -36
- package/dist/src/storage/sqlite/migrations/128_context_extraction.sql +0 -73
- package/dist/src/storage/sqlite/migrations/129_focus_versions.sql +0 -51
- package/dist/src/storage/sqlite/migrations/130_context_evidence_provenance.sql +0 -18
- package/dist/src/storage/sqlite/migrations/131_session_input_contexts.sql +0 -2
- package/dist/src/storage/sqlite/migrations/132_transcript_source_context_metadata.sql +0 -34
- package/dist/src/storage/sqlite/migrations/133_archive_legacy_work_discovery_profile_facts.sql +0 -11
- package/dist/src/storage/sqlite/migrations/134_memory_provenance.sql +0 -18
- package/dist/src/storage/sqlite/migrations/135_user_people.sql +0 -59
- package/dist/src/storage/sqlite/migrations/136_product_notifications.sql +0 -79
- package/dist/src/storage/sqlite/migrations/137_understanding_status_audit.sql +0 -71
- package/dist/src/storage/sqlite/migrations/138_device_access.sql +0 -96
- package/dist/src/storage/sqlite/migrations/139_turn_outcome_artifact_backfill.sql +0 -231
- package/dist/src/storage/sqlite/migrations/140_endpoint_session_bindings.sql +0 -8
- package/dist/src/storage/sqlite/migrations/141_device_pairing_approval.sql +0 -17
- package/dist/src/storage/sqlite/migrations/142_session_input_instance.sql +0 -1
- package/dist/src/storage/sqlite/migrations/143_fixed_session_model.sql +0 -1
- package/dist/src/storage/sqlite/migrations/144_execution_environments.sql +0 -59
- package/dist/src/storage/sqlite/migrations/145_project_execution_mode.sql +0 -5
- package/dist/src/storage/sqlite/migrations/146_understanding_focus_exclusions.sql +0 -9
- package/dist/src/storage/sqlite/migrations/147_durable_application_state.sql +0 -39
- package/dist/src/storage/sqlite/migrations/148_user_model_foundation.sql +0 -554
- package/dist/src/storage/sqlite/migrations/149_separate_source_index_from_memory.sql +0 -18
- package/dist/src/storage/sqlite/migrations/150_session_connection_waits.sql +0 -47
- package/dist/src/storage/sqlite/migrations/151_proactive_scope_cleanup.sql +0 -6
- package/dist/src/storage/sqlite/migrations/152_proactive_scenario_contract.sql +0 -140
- package/dist/src/storage/sqlite/migrations/153_browser_control_v2.sql +0 -45
- package/dist/src/storage/sqlite/migrations/154_session_clarification_waits.sql +0 -60
- package/dist/src/storage/sqlite/migrations/155_browser_extension.sql +0 -120
- package/dist/src/storage/sqlite/migrations/156_browser_tab_bindings.sql +0 -14
- package/dist/src/storage/sqlite/migrations/157_browser_endpoint_principals.sql +0 -50
- package/dist/src/storage/sqlite/migrations/158_browser_native_enrollment.sql +0 -4
- package/dist/src/storage/sqlite/migrations/159_proactive_controls.sql +0 -68
- package/dist/src/storage/sqlite/migrations/160_proactive_web_push.sql +0 -27
- package/dist/src/storage/sqlite/migrations/161_proactive_delivery_and_lifecycle.sql +0 -51
- package/dist/src/storage/sqlite/migrations/162_proactive_product.sql +0 -7
- package/dist/src/storage/sqlite/migrations/163_proactive_follow_ups.sql +0 -29
- package/dist/src/storage/sqlite/migrations/164_browser_sessions.sql +0 -8
- package/dist/src/storage/sqlite/migrations/165_device_pairing_target.sql +0 -40
- package/dist/src/storage/sqlite/migrations/__tests__/mobile-discussion-source.test.ts +0 -20
- package/dist/src/storage/sqlite/migrations/conversation-backup.ts +0 -66
- package/dist/src/storage/sqlite/migrations/conversation-key-decoder.ts +0 -50
- package/dist/src/storage/sqlite/migrations/conversation-uuid.ts +0 -324
- package/dist/src/storage/sqlite/migrations/conversation-windows-owners.ts +0 -71
- package/dist/src/storage/sqlite/migrations/discover.ts +0 -52
- package/dist/src/storage/sqlite/migrations/errors.ts +0 -32
- package/dist/src/storage/sqlite/migrations/runner.ts +0 -204
- package/dist/src/storage/sqlite/migrations/types.ts +0 -15
|
@@ -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-Cq1tE_3b.js";import{t as a}from"./popover-select-DldSX8GX.js";import{t as o}from"./circle-check-C23XjkUj.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./cn-JdwAhgNB.js";import{c as l,n as u}from"./locale-store-D0001I7p.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{t as f}from"./button-CGlRPNzi.js";import{r as p}from"./gateway-config-swr-BNuoHXiZ.js";import{t as m}from"./skeleton-BwbyijEw.js";import{n as h,t as g}from"./registry-api-icwoEKYB.js";import{Fl as _,Iu as v,Pu as y,Sc as b,Zc as x,_n as S,cn as C,dc as w,dl as T,gc as E,jc as D,li as O,ln as ee,pc as k,y as te}from"./index-fVtuw2o9.js";import{n as A,r as j}from"./settings-page-layout-CsUQKRq0.js";import{n as M,t as ne}from"./use-autosave-Iq83UDt3.js";import{u as N}from"./voice-config-api-B0wNN_tE.js";import{r as re}from"./image-generation-api-B_Tyx74A.js";var P=e(t(),1),ie=n(),F=r(),I={"xopc-cloud":`XOPC Cloud`,"xopc-local":`XOPC Local`,alibaba:`Alibaba Cloud`,edge:`Microsoft Edge`,groq:`Groq`,minimax:`MiniMax`,openai:`OpenAI`,"tts-local-cli":`Local TTS`};function L(e,t,n){let r=e?.[t]?.[n];return typeof r==`string`&&r.trim()?r.trim():void 0}function R(e){return I[e]??e}function z(e){let t=(0,ie.c)(17),{icon:n,label:r,enabled:i,details:a,zh:o}=e,s;t[0]===n?s=t[1]:(s=(0,F.jsx)(`div`,{className:`rounded-lg bg-accent/10 p-2 text-accent`,children:(0,F.jsx)(n,{className:`size-4`,"aria-hidden":!0})}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r}),t[2]=r,t[3]=c);let l=i?o?`已启用`:`On`:o?`已关闭`:`Off`,u;t[4]===l?u=t[5]:(u=(0,F.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] font-medium text-fg-muted`,children:l}),t[4]=l,t[5]=u);let d;t[6]!==c||t[7]!==u?(d=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[c,u]}),t[6]=c,t[7]=u,t[8]=d):d=t[8];let f=i?a:o?`不处理语音`:`Voice processing is disabled`,p;t[9]===f?p=t[10]:(p=(0,F.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:f}),t[9]=f,t[10]=p);let m;t[11]!==d||t[12]!==p?(m=(0,F.jsxs)(`div`,{className:`min-w-0`,children:[d,p]}),t[11]=d,t[12]=p,t[13]=m):m=t[13];let h;return t[14]!==s||t[15]!==m?(h=(0,F.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge bg-surface-panel p-4`,children:[s,m]}),t[14]=s,t[15]=m,t[16]=h):h=t[16],h}function B(e){let t=(0,ie.c)(27),{zh:n}=e,{data:r,error:a,isLoading:o}=p(!0),s=r?.payload?.config,c,l,u;if(t[0]!==s){u=s===void 0?void 0:N(s);let e=u?L(u.stt.providers,u.stt.provider,`model`):void 0,n=u?L(u.tts.providers,u.tts.provider,`model`):void 0,r=u?L(u.tts.providers,u.tts.provider,`voice`):void 0;c=u?[R(u.stt.provider),e].filter(Boolean).join(` · `):void 0,l=u?[R(u.tts.provider),n,r].filter(Boolean).join(` · `):void 0,t[0]=s,t[1]=c,t[2]=l,t[3]=u}else c=t[1],l=t[2],u=t[3];let d=l,h=n?`语音能力`:`Voice capabilities`,g;t[4]===h?g=t[5]:(g=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:h}),t[4]=h,t[5]=g);let _=n?`语音识别和朗读由所有智能体共用,在语音设置中统一管理。`:`STT and TTS are shared by every agent and managed in global voice settings.`,b;t[6]===_?b=t[7]:(b=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:_}),t[6]=_,t[7]=b);let S;t[8]!==g||t[9]!==b?(S=(0,F.jsxs)(`div`,{children:[g,b]}),t[8]=g,t[9]=b,t[10]=S):S=t[10];let C=n?`管理语音设置`:`Manage voice settings`,w;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,F.jsx)(v,{className:`size-4`,"aria-hidden":!0}),t[11]=w):w=t[11];let T;t[12]===C?T=t[13]:(T=(0,F.jsx)(f,{asChild:!0,variant:`secondary`,className:`shrink-0`,children:(0,F.jsxs)(i,{to:`/settings/capabilities/voice`,children:[C,w]})}),t[12]=C,t[13]=T);let E;t[14]!==S||t[15]!==T?(E=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[S,T]}),t[14]=S,t[15]=T,t[16]=E):E=t[16];let D;t[17]!==a||t[18]!==o||t[19]!==c||t[20]!==d||t[21]!==u||t[22]!==n?(D=o||!u?a?(0,F.jsx)(`p`,{className:`mt-4 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:n?`暂时无法读取语音配置。`:`Voice settings could not be loaded.`}):(0,F.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,F.jsx)(m,{className:`h-20 rounded-xl`}),(0,F.jsx)(m,{className:`h-20 rounded-xl`})]}):(0,F.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,F.jsx)(z,{icon:x,label:n?`语音转文字(STT)`:`Speech to text (STT)`,enabled:u.stt.enabled,details:c,zh:n}),(0,F.jsx)(z,{icon:y,label:n?`文字转语音(TTS)`:`Text to speech (TTS)`,enabled:u.tts.enabled,details:d,zh:n})]}),t[17]=a,t[18]=o,t[19]=c,t[20]=d,t[21]=u,t[22]=n,t[23]=D):D=t[23];let O;return t[24]!==E||t[25]!==D?(O=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[E,D]}),t[24]=E,t[25]=D,t[26]=O):O=t[26],O}var V=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],H=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`,U={en:{fast:[`Fast tasks`,`Short, low-latency work`],reasoning:[`Complex reasoning`,`Planning and multi-step analysis`],coding:[`Coding`,`Implementation and debugging`],review:[`Review`,`Critique and verification`],vision:[`Vision`,`Image and visual analysis`],understanding:[`Understanding`,`Long-form content comprehension`]},zh:{fast:[`快速任务`,`简短、低延迟的工作`],reasoning:[`复杂推理`,`规划和多步骤分析`],coding:[`编程`,`实现、调试和代码修改`],review:[`审查`,`检查、批评和验证`],vision:[`视觉任务`,`图片和视觉内容分析`],understanding:[`内容理解`,`长内容阅读和理解`]}};function W(e,t){return{primary:t,fallbacks:e?.fallbacks??[]}}function ae(e){let t=(0,ie.c)(35),{primary:n,value:r,models:i,loading:a,error:o,zh:c,onChange:l}=e,u;if(t[0]!==i||t[1]!==n||t[2]!==r){let e;t[4]!==n||t[5]!==r?(e=e=>e.id!==n&&!r.includes(e.id),t[4]=n,t[5]=r,t[6]=e):e=t[6],u=i.filter(e),t[0]=i,t[1]=n,t[2]=r,t[3]=u}else u=t[3];let d=u,f=c?`回退顺序`:`Fallback order`,p;t[7]===f?p=t[8]:(p=(0,F.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:f}),t[7]=f,t[8]=p);let m=c?`主模型不可用时,按从左到右的顺序尝试。`:`Tried from left to right when the primary model is unavailable.`,h;t[9]===m?h=t[10]:(h=(0,F.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:m}),t[9]=m,t[10]=h);let g;t[11]!==p||t[12]!==h?(g=(0,F.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,F.jsxs)(`div`,{children:[p,h]})}),t[11]=p,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==i||t[15]!==l||t[16]!==r||t[17]!==c?(_=r.length>0?(0,F.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:r.map((e,t)=>(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-2 rounded-full border border-edge bg-surface-panel py-1 pl-2.5 pr-1 text-xs text-fg`,children:[(0,F.jsx)(`span`,{className:`text-fg-subtle`,children:t+1}),(0,F.jsx)(`span`,{children:i.find(t=>t.id===e)?.name??e}),(0,F.jsx)(`button`,{type:`button`,"aria-label":c?`移除 ${e}`:`Remove ${e}`,className:`rounded-full p-1 text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>l(r.filter(t=>t!==e)),children:(0,F.jsx)(s,{className:`size-3`})})]},e))}):(0,F.jsx)(`p`,{className:`mt-3 text-xs text-fg-subtle`,children:c?`未设置回退模型。`:`No fallback models configured.`}),t[14]=i,t[15]=l,t[16]=r,t[17]=c,t[18]=_):_=t[18];let v=c?`添加回退模型`:`Add fallback model`,y=c?`搜索模型或服务商`:`Search models or providers`,b=c?`没有可添加的模型`:`No models available to add`,x=c?`添加回退模型`:`Add fallback model`,S;t[19]!==l||t[20]!==r?(S=e=>{e&&l([...r,e])},t[19]=l,t[20]=r,t[21]=S):S=t[21];let C;t[22]!==d||t[23]!==o||t[24]!==a||t[25]!==b||t[26]!==x||t[27]!==S||t[28]!==v||t[29]!==y?(C=(0,F.jsx)(O,{value:``,models:d,modelsLoading:a,modelsError:o,placeholder:v,searchPlaceholder:y,noMatches:b,showProviderInTrigger:!1,contentAlign:`start`,className:`mt-3 w-full max-w-md`,ariaLabel:x,onChange:S}),t[22]=d,t[23]=o,t[24]=a,t[25]=b,t[26]=x,t[27]=S,t[28]=v,t[29]=y,t[30]=C):C=t[30];let w;return t[31]!==C||t[32]!==g||t[33]!==_?(w=(0,F.jsxs)(`div`,{children:[g,_,C]}),t[31]=C,t[32]=g,t[33]=_,t[34]=w):w=t[34],w}function G(e){let t=(0,ie.c)(121),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let o=d(g,h,a),s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},t[1]=s):s=t[1];let c=d(`agent-defaults-image-models`,re,s),l;t[2]===o.data?l=t[3]:(l=o.data??[],t[2]=o.data,t[3]=l);let u=l,p;t[4]===c.data?p=t[5]:(p=c.data??[],t[4]=c.data,t[5]=p);let m;t[6]===p?m=t[7]:(m=p.flatMap(K),t[6]=p,t[7]=m);let _=m,v=i?U.zh:U.en,y;t[8]!==n||t[9]!==r?(y=(e,t)=>{let i={...n.models.intents};t?i[e]=W(i[e],t):delete i[e],r({...n,models:{...n.models,intents:i}})},t[8]=n,t[9]=r,t[10]=y):y=t[10];let b=y,x=i?`默认对话模型`:`Default conversation model`,S;t[11]===x?S=t[12]:(S=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:x}),t[11]=x,t[12]=S);let C=i?`大多数对话和没有专用路由的任务都会使用它。`:`Used for most conversations and every task without a dedicated route.`,w;t[13]===C?w=t[14]:(w=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:C}),t[13]=C,t[14]=w);let T;t[15]!==w||t[16]!==S?(T=(0,F.jsxs)(`div`,{children:[S,w]}),t[15]=w,t[16]=S,t[17]=T):T=t[17];let E=i?`主模型`:`Primary model`,D;t[18]===E?D=t[19]:(D=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:E}),t[18]=E,t[19]=D);let ee=i?`选择模型`:`Select a model`,k=i?`搜索模型或服务商`:`Search models or providers`,te=i?`没有匹配的模型`:`No matching models`,A=i?`默认对话模型`:`Default conversation model`,j;t[20]!==n||t[21]!==r?(j=e=>r({...n,models:{...n.models,chat:{...n.models.chat,primary:e}}}),t[20]=n,t[21]=r,t[22]=j):j=t[22];let M;t[23]!==n.models.chat.primary||t[24]!==ee||t[25]!==k||t[26]!==te||t[27]!==A||t[28]!==j?(M=(0,F.jsx)(O,{value:n.models.chat.primary,placeholder:ee,searchPlaceholder:k,noMatches:te,showProviderSettingsFooter:!0,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:A,onChange:j}),t[23]=n.models.chat.primary,t[24]=ee,t[25]=k,t[26]=te,t[27]=A,t[28]=j,t[29]=M):M=t[29];let ne;t[30]!==D||t[31]!==M?(ne=(0,F.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[D,M]}),t[30]=D,t[31]=M,t[32]=ne):ne=t[32];let N;t[33]!==n||t[34]!==r?(N=e=>r({...n,models:{...n.models,chat:{...n.models.chat,fallbacks:e}}}),t[33]=n,t[34]=r,t[35]=N):N=t[35];let P;t[36]!==n.models.chat.fallbacks||t[37]!==n.models.chat.primary||t[38]!==u||t[39]!==o.error||t[40]!==o.isLoading||t[41]!==N||t[42]!==i?(P=(0,F.jsx)(`div`,{className:`mt-6 border-t border-edge pt-5`,children:(0,F.jsx)(ae,{primary:n.models.chat.primary,value:n.models.chat.fallbacks,models:u,loading:o.isLoading,error:o.error,zh:i,onChange:N})}),t[36]=n.models.chat.fallbacks,t[37]=n.models.chat.primary,t[38]=u,t[39]=o.error,t[40]=o.isLoading,t[41]=N,t[42]=i,t[43]=P):P=t[43];let I;t[44]!==T||t[45]!==ne||t[46]!==P?(I=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[T,ne,P]}),t[44]=T,t[45]=ne,t[46]=P,t[47]=I):I=t[47];let L=i?`图片能力`:`Image capabilities`,R;t[48]===L?R=t[49]:(R=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:L}),t[48]=L,t[49]=R);let z=i?`没有图片任务时可以保持关闭。`:`Leave these off when the agents do not work with images.`,G;t[50]===z?G=t[51]:(G=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:z}),t[50]=z,t[51]=G);let q=i?`图片理解模型`:`Image understanding model`,J;t[52]===q?J=t[53]:(J=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:q}),t[52]=q,t[53]=J);let Y=n.models.imageUnderstanding?.primary??``,X=i?`关闭图片理解`:`Image understanding off`,Z=i?`搜索视觉模型`:`Search vision models`,Q=i?`没有可用的视觉模型`:`No vision models available`,oe=i?`关闭图片理解`:`Image understanding off`,se=i?`图片理解模型`:`Image understanding model`,ce;t[54]!==n||t[55]!==r?(ce=e=>{let t={...n.models};e?t.imageUnderstanding=W(t.imageUnderstanding,e):delete t.imageUnderstanding,r({...n,models:t})},t[54]=n,t[55]=r,t[56]=ce):ce=t[56];let le;t[57]!==Y||t[58]!==X||t[59]!==Z||t[60]!==Q||t[61]!==oe||t[62]!==se||t[63]!==ce?(le=(0,F.jsx)(O,{value:Y,placeholder:X,searchPlaceholder:Z,noMatches:Q,capabilitiesFilter:`vision`,allowEmpty:!0,emptyLabel:oe,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:se,onChange:ce}),t[57]=Y,t[58]=X,t[59]=Z,t[60]=Q,t[61]=oe,t[62]=se,t[63]=ce,t[64]=le):le=t[64];let ue;t[65]!==J||t[66]!==le?(ue=(0,F.jsxs)(`div`,{children:[J,le]}),t[65]=J,t[66]=le,t[67]=ue):ue=t[67];let de=i?`图片生成模型`:`Image generation model`,fe;t[68]===de?fe=t[69]:(fe=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:de}),t[68]=de,t[69]=fe);let pe=n.models.imageGeneration?.primary??``,me=i?`关闭图片生成`:`Image generation off`,he=i?`搜索图片模型或服务商`:`Search image models or providers`,ge=i?`没有可用的图片生成模型`:`No image generation models available`,_e=i?`关闭图片生成`:`Image generation off`,ve=i?`图片生成模型`:`Image generation model`,ye;t[70]!==n||t[71]!==r?(ye=e=>{let t={...n.models};e?t.imageGeneration={primary:e,fallbacks:t.imageGeneration?.fallbacks??[],timeoutMs:t.imageGeneration?.timeoutMs,autoProviderFallback:t.imageGeneration?.autoProviderFallback??!0}:delete t.imageGeneration,r({...n,models:t})},t[70]=n,t[71]=r,t[72]=ye):ye=t[72];let be;t[73]!==_||t[74]!==c.error||t[75]!==c.isLoading||t[76]!==pe||t[77]!==me||t[78]!==he||t[79]!==ge||t[80]!==_e||t[81]!==ve||t[82]!==ye?(be=(0,F.jsx)(O,{value:pe,models:_,modelsLoading:c.isLoading,modelsError:c.error,placeholder:me,searchPlaceholder:he,noMatches:ge,allowEmpty:!0,emptyLabel:_e,contentAlign:`start`,className:`mt-2 w-full`,ariaLabel:ve,onChange:ye}),t[73]=_,t[74]=c.error,t[75]=c.isLoading,t[76]=pe,t[77]=me,t[78]=he,t[79]=ge,t[80]=_e,t[81]=ve,t[82]=ye,t[83]=be):be=t[83];let xe;t[84]!==fe||t[85]!==be?(xe=(0,F.jsxs)(`div`,{children:[fe,be]}),t[84]=fe,t[85]=be,t[86]=xe):xe=t[86];let $;t[87]!==ue||t[88]!==xe?($=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-5 lg:grid-cols-2`,children:[ue,xe]}),t[87]=ue,t[88]=xe,t[89]=$):$=t[89];let Se;t[90]!==n||t[91]!==r||t[92]!==i?(Se=n.models.imageGeneration?(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 border-t border-edge pt-5 sm:grid-cols-2`,children:[(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[i?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,F.jsx)(`input`,{type:`number`,min:1,className:`${H} mt-2`,value:n.models.imageGeneration.timeoutMs??``,onChange:e=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,timeoutMs:e.target.value?Number(e.target.value):void 0}}})})]}),(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,F.jsx)(`span`,{children:i?`服务商自动回退`:`Automatic provider fallback`}),(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[!0,!1].map(e=>(0,F.jsx)(f,{variant:n.models.imageGeneration?.autoProviderFallback===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,models:{...n.models,imageGeneration:{...n.models.imageGeneration,autoProviderFallback:e}}}),children:e?i?`开启`:`On`:i?`关闭`:`Off`},String(e)))})]})]}):null,t[90]=n,t[91]=r,t[92]=i,t[93]=Se):Se=t[93];let Ce;t[94]!==R||t[95]!==G||t[96]!==$||t[97]!==Se?(Ce=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[R,G,$,Se]}),t[94]=R,t[95]=G,t[96]=$,t[97]=Se,t[98]=Ce):Ce=t[98];let we;t[99]===i?we=t[100]:(we=(0,F.jsx)(B,{zh:i}),t[99]=i,t[100]=we);let Te=i?`按任务选择模型`:`Route by task`,Ee;t[101]===Te?Ee=t[102]:(Ee=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:Te}),t[101]=Te,t[102]=Ee);let De=i?`仅在确实需要不同模型时设置;否则保持“使用默认对话模型”。`:`Set a route only when a task genuinely needs another model; otherwise keep the default.`,Oe;t[103]===De?Oe=t[104]:(Oe=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:De}),t[103]=De,t[104]=Oe);let ke;t[105]!==v||t[106]!==n.models.intents||t[107]!==b||t[108]!==i?(ke=V.map(e=>(0,F.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,F.jsxs)(`div`,{className:`mb-3`,children:[(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:v[e][0]}),(0,F.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:v[e][1]})]}),(0,F.jsx)(O,{value:n.models.intents[e]?.primary??``,placeholder:i?`使用默认对话模型`:`Use default conversation model`,searchPlaceholder:i?`搜索模型或服务商`:`Search models or providers`,noMatches:i?`没有匹配的模型`:`No matching models`,allowEmpty:!0,emptyLabel:i?`使用默认对话模型`:`Use default conversation model`,showProviderInTrigger:!1,contentAlign:`start`,className:`w-full`,ariaLabel:i?`${v[e][0]}模型`:`${v[e][0]} model`,onChange:t=>b(e,t)})]},e)),t[105]=v,t[106]=n.models.intents,t[107]=b,t[108]=i,t[109]=ke):ke=t[109];let Ae;t[110]===ke?Ae=t[111]:(Ae=(0,F.jsx)(`div`,{className:`mt-5 grid gap-3 lg:grid-cols-2`,children:ke}),t[110]=ke,t[111]=Ae);let je;t[112]!==Ee||t[113]!==Oe||t[114]!==Ae?(je=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[Ee,Oe,Ae]}),t[112]=Ee,t[113]=Oe,t[114]=Ae,t[115]=je):je=t[115];let Me;return t[116]!==I||t[117]!==Ce||t[118]!==we||t[119]!==je?(Me=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[I,Ce,we,je]}),t[116]=I,t[117]=Ce,t[118]=we,t[119]=je,t[120]=Me):Me=t[120],Me}function K(e){return e.models.map(t=>({id:`${e.id}/${t}`,name:t,provider:e.label}))}var q=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function J(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function Y(e){let t=(0,ie.c)(151),{draft:n,setDraft:r,zh:i}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[0]=o):o=t[0];let s=d(`agent-defaults-workflows`,te,o),l;t[1]===s.data?l=t[2]:(l=s.data??[],t[1]=s.data,t[2]=l);let u;t[3]===l?u=t[4]:(u=l.map(X),t[3]=l,t[4]=u);let p=u,m=n.workflows.allowed===void 0,h;t[5]!==n||t[6]!==r?(h=(e,t)=>{let i=n.workflows.allowed??[],a=t?[...new Set([...i,e])]:i.filter(t=>t!==e);r({...n,workflows:{...n.workflows,allowed:a}})},t[5]=n,t[6]=r,t[7]=h):h=t[7];let g=h,_=i?`执行限制`:`Execution limits`,v;t[8]===_?v=t[9]:(v=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:_}),t[8]=_,t[9]=v);let y=i?`为所有智能体设置安全上限;留空时使用系统默认值。`:`Set safe upper bounds for every agent. Empty fields use system defaults.`,b;t[10]===y?b=t[11]:(b=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:y}),t[10]=y,t[11]=b);let x=i?`每次运行最多轮数`:`Maximum turns per run`,S=n.runtime.maxTurns??``,C=i?`系统默认`:`System default`,w;t[12]!==n||t[13]!==r?(w=e=>r({...n,runtime:{...n.runtime,maxTurns:J(e.target.value)}}),t[12]=n,t[13]=r,t[14]=w):w=t[14];let T;t[15]!==S||t[16]!==C||t[17]!==w?(T=(0,F.jsx)(`input`,{type:`number`,min:1,value:S,placeholder:C,onChange:w,className:`${q} mt-2`}),t[15]=S,t[16]=C,t[17]=w,t[18]=T):T=t[18];let E;t[19]!==T||t[20]!==x?(E=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[x,T]}),t[19]=T,t[20]=x,t[21]=E):E=t[21];let D=i?`单轮超时(毫秒)`:`Turn timeout (ms)`,O=n.runtime.timeoutMs??``,ee=i?`系统默认`:`System default`,k;t[22]!==n||t[23]!==r?(k=e=>r({...n,runtime:{...n.runtime,timeoutMs:J(e.target.value)}}),t[22]=n,t[23]=r,t[24]=k):k=t[24];let A;t[25]!==O||t[26]!==ee||t[27]!==k?(A=(0,F.jsx)(`input`,{type:`number`,min:1,value:O,placeholder:ee,onChange:k,className:`${q} mt-2`}),t[25]=O,t[26]=ee,t[27]=k,t[28]=A):A=t[28];let j;t[29]!==D||t[30]!==A?(j=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[D,A]}),t[29]=D,t[30]=A,t[31]=j):j=t[31];let M=i?`每轮最多工具失败次数`:`Maximum tool failures per turn`,ne=n.runtime.maxToolFailuresPerTurn??``,N=i?`系统默认`:`System default`,re;t[32]!==n||t[33]!==r?(re=e=>r({...n,runtime:{...n.runtime,maxToolFailuresPerTurn:J(e.target.value)}}),t[32]=n,t[33]=r,t[34]=re):re=t[34];let P;t[35]!==ne||t[36]!==N||t[37]!==re?(P=(0,F.jsx)(`input`,{type:`number`,min:1,value:ne,placeholder:N,onChange:re,className:`${q} mt-2`}),t[35]=ne,t[36]=N,t[37]=re,t[38]=P):P=t[38];let I;t[39]!==M||t[40]!==P?(I=(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[M,P]}),t[39]=M,t[40]=P,t[41]=I):I=t[41];let L;t[42]!==E||t[43]!==j||t[44]!==I?(L=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 md:grid-cols-3`,children:[E,j,I]}),t[42]=E,t[43]=j,t[44]=I,t[45]=L):L=t[45];let R;t[46]!==L||t[47]!==v||t[48]!==b?(R=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[v,b,L]}),t[46]=L,t[47]=v,t[48]=b,t[49]=R):R=t[49];let z=i?`提示词缓存`:`Prompt cache`,B;t[50]===z?B=t[51]:(B=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:z}),t[50]=z,t[51]=B);let V=i?`复用稳定的上下文以降低响应延迟和模型费用。`:`Reuse stable context to reduce latency and model cost.`,H;t[52]===V?H=t[53]:(H=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:V}),t[52]=V,t[53]=H);let U=i?`缓存模式`:`Cache mode`,W;t[54]===U?W=t[55]:(W=(0,F.jsx)(`span`,{children:U}),t[54]=U,t[55]=W);let ae;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ae=[`auto`,`off`],t[56]=ae):ae=t[56];let G;t[57]!==n||t[58]!==r||t[59]!==i?(G=(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:ae.map(e=>(0,F.jsx)(f,{variant:n.runtime.promptCache?.mode===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:e,lifetime:n.runtime.promptCache?.lifetime??`short`}}}),children:e===`auto`?i?`自动`:`Automatic`:i?`关闭`:`Off`},e))}),t[57]=n,t[58]=r,t[59]=i,t[60]=G):G=t[60];let K;t[61]!==W||t[62]!==G?(K=(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[W,G]}),t[61]=W,t[62]=G,t[63]=K):K=t[63];let Y;t[64]!==n||t[65]!==r||t[66]!==i?(Y=n.runtime.promptCache?.mode===`auto`?(0,F.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,F.jsx)(`span`,{children:i?`缓存周期`:`Cache lifetime`}),(0,F.jsx)(`div`,{className:`mt-1.5 flex rounded-lg bg-surface-panel p-1`,children:[`short`,`long`].map(e=>(0,F.jsx)(f,{variant:n.runtime.promptCache?.lifetime===e?`secondary`:`ghost`,className:`flex-1 py-1.5 text-xs`,onClick:()=>r({...n,runtime:{...n.runtime,promptCache:{mode:`auto`,lifetime:e}}}),children:e===`short`?i?`短期`:`Short`:i?`长期`:`Long`},e))})]}):null,t[64]=n,t[65]=r,t[66]=i,t[67]=Y):Y=t[67];let Z;t[68]!==K||t[69]!==Y?(Z=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[K,Y]}),t[68]=K,t[69]=Y,t[70]=Z):Z=t[70];let Q;t[71]!==B||t[72]!==H||t[73]!==Z?(Q=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[B,H,Z]}),t[71]=B,t[72]=H,t[73]=Z,t[74]=Q):Q=t[74];let oe=i?`工作流`:`Workflows`,se;t[75]===oe?se=t[76]:(se=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:oe}),t[75]=oe,t[76]=se);let ce=i?`设置默认工作流,并决定智能体可以调用哪些工作流。`:`Set a default workflow and control which workflows agents may invoke.`,le;t[77]===ce?le=t[78]:(le=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ce}),t[77]=ce,t[78]=le);let ue=i?`默认工作流`:`Default workflow`,de;t[79]===ue?de=t[80]:(de=(0,F.jsx)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:ue}),t[79]=ue,t[80]=de);let fe=n.workflows.default??``,pe=s.isLoading?i?`正在加载…`:`Loading…`:i?`不设置默认工作流`:`No default workflow`,me=i?`不设置默认工作流`:`No default workflow`,he=i?`默认工作流`:`Default workflow`,ge;t[81]!==n||t[82]!==r?(ge=e=>r({...n,workflows:{...n.workflows,default:e||void 0}}),t[81]=n,t[82]=r,t[83]=ge):ge=t[83];let _e;t[84]!==fe||t[85]!==pe||t[86]!==me||t[87]!==he||t[88]!==ge||t[89]!==p||t[90]!==s.isLoading?(_e=(0,F.jsx)(a,{value:fe,options:p,placeholder:pe,emptyLabel:me,disabled:s.isLoading,ariaLabel:he,onChange:ge,triggerClassName:`mt-2`}),t[84]=fe,t[85]=pe,t[86]=me,t[87]=he,t[88]=ge,t[89]=p,t[90]=s.isLoading,t[91]=_e):_e=t[91];let ve;t[92]!==de||t[93]!==_e?(ve=(0,F.jsxs)(`div`,{className:`mt-5 max-w-xl`,children:[de,_e]}),t[92]=de,t[93]=_e,t[94]=ve):ve=t[94];let ye;t[95]===s.error?ye=t[96]:(ye=s.error?(0,F.jsx)(`p`,{className:`mt-3 text-sm text-red-600`,children:s.error instanceof Error?s.error.message:String(s.error)}):null,t[95]=s.error,t[96]=ye);let be=i?`允许调用的工作流`:`Allowed workflows`,xe;t[97]===be?xe=t[98]:(xe=(0,F.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:be}),t[97]=be,t[98]=xe);let $;t[99]!==n||t[100]!==r?($=()=>r({...n,workflows:{...n.workflows,allowed:void 0}}),t[99]=n,t[100]=r,t[101]=$):$=t[101];let Se=m?`border-accent bg-accent/5 ring-1 ring-accent/20`:`border-edge bg-surface-panel hover:border-edge-strong`,Ce;t[102]===Se?Ce=t[103]:(Ce=c(`rounded-xl border p-4 text-left`,Se),t[102]=Se,t[103]=Ce);let we=i?`允许全部工作流`:`Allow every workflow`,Te;t[104]===we?Te=t[105]:(Te=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:we}),t[104]=we,t[105]=Te);let Ee=i?`新增工作流也会自动可用。`:`New workflows become available automatically.`,De;t[106]===Ee?De=t[107]:(De=(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Ee}),t[106]=Ee,t[107]=De);let Oe;t[108]!==$||t[109]!==Ce||t[110]!==Te||t[111]!==De?(Oe=(0,F.jsxs)(`button`,{type:`button`,onClick:$,className:Ce,children:[Te,De]}),t[108]=$,t[109]=Ce,t[110]=Te,t[111]=De,t[112]=Oe):Oe=t[112];let ke;t[113]!==n||t[114]!==r?(ke=()=>r({...n,workflows:{...n.workflows,allowed:[]}}),t[113]=n,t[114]=r,t[115]=ke):ke=t[115];let Ae=m?`border-edge bg-surface-panel hover:border-edge-strong`:`border-accent bg-accent/5 ring-1 ring-accent/20`,je;t[116]===Ae?je=t[117]:(je=c(`rounded-xl border p-4 text-left`,Ae),t[116]=Ae,t[117]=je);let Me=i?`只允许选中的工作流`:`Allow selected workflows only`,Ne;t[118]===Me?Ne=t[119]:(Ne=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:Me}),t[118]=Me,t[119]=Ne);let Pe=i?`未选中的工作流不能被调用。`:`Unselected workflows cannot be invoked.`,Fe;t[120]===Pe?Fe=t[121]:(Fe=(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:Pe}),t[120]=Pe,t[121]=Fe);let Ie;t[122]!==ke||t[123]!==je||t[124]!==Ne||t[125]!==Fe?(Ie=(0,F.jsxs)(`button`,{type:`button`,onClick:ke,className:je,children:[Ne,Fe]}),t[122]=ke,t[123]=je,t[124]=Ne,t[125]=Fe,t[126]=Ie):Ie=t[126];let Le;t[127]!==Oe||t[128]!==Ie?(Le=(0,F.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[Oe,Ie]}),t[127]=Oe,t[128]=Ie,t[129]=Le):Le=t[129];let Re;t[130]!==m||t[131]!==n.workflows.allowed||t[132]!==g||t[133]!==s.data||t[134]!==s.isLoading||t[135]!==i?(Re=m?null:(0,F.jsxs)(`div`,{className:`mt-3 divide-y divide-edge rounded-xl border border-edge bg-surface-panel`,children:[(s.data??[]).map(e=>(0,F.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:n.workflows.allowed?.includes(e.id)??!1,onChange:t=>g(e.id,t.target.checked),className:`mt-0.5 size-4 accent-[var(--color-accent)]`}),(0,F.jsxs)(`span`,{children:[(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title||e.name}),e.description?(0,F.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)),(s.data??[]).length===0&&!s.isLoading?(0,F.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`还没有工作流。`:`No workflows yet.`}):null]}),t[130]=m,t[131]=n.workflows.allowed,t[132]=g,t[133]=s.data,t[134]=s.isLoading,t[135]=i,t[136]=Re):Re=t[136];let ze;t[137]!==xe||t[138]!==Le||t[139]!==Re?(ze=(0,F.jsxs)(`div`,{className:`mt-6 border-t border-edge pt-5`,children:[xe,Le,Re]}),t[137]=xe,t[138]=Le,t[139]=Re,t[140]=ze):ze=t[140];let Be;t[141]!==se||t[142]!==le||t[143]!==ve||t[144]!==ye||t[145]!==ze?(Be=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[se,le,ve,ye,ze]}),t[141]=se,t[142]=le,t[143]=ve,t[144]=ye,t[145]=ze,t[146]=Be):Be=t[146];let Ve;return t[147]!==R||t[148]!==Q||t[149]!==Be?(Ve=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[R,Q,Be]}),t[147]=R,t[148]=Q,t[149]=Be,t[150]=Ve):Ve=t[150],Ve}function X(e){return{value:e.id,label:e.title||e.name}}function Z(e){return[...new Set(e)].sort()}function Q(e){let t=(0,ie.c)(99),{draft:n,setDraft:r,zh:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a={revalidateOnFocus:!1},t[0]=a):a=t[0];let{data:s,error:l,isLoading:u}=d(`agent-defaults-skills-catalog`,S,a),[f,p]=(0,P.useState)(``),m=n.skills.mode===`selected`?n.skills.include:n.skills.exclude;s?.catalog;let h;if(t[1]!==m||t[2]!==s?.catalog||t[3]!==f){let e=[...s?.catalog??[]],n=new Set(e.map(ce));for(let t of m)n.has(t)||e.push({name:t,description:``,enabled:!0});let r=f.trim().toLowerCase();h=e.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r)).sort(se),t[1]=m,t[2]=s?.catalog,t[3]=f,t[4]=h}else h=t[4];let g=h,_;t[5]!==n.skills.exclude||t[6]!==n.skills.include||t[7]!==n.skills.mode?(_=e=>n.skills.mode===`selected`?n.skills.include.includes(e):!n.skills.exclude.includes(e),t[5]=n.skills.exclude,t[6]=n.skills.include,t[7]=n.skills.mode,t[8]=_):_=t[8];let v=_,y;t[9]!==n||t[10]!==r?(y=e=>{if(n.skills.mode===`selected`){let t=n.skills.include.includes(e)?n.skills.include.filter(t=>t!==e):Z([...n.skills.include,e]);r({...n,skills:{mode:`selected`,include:t}});return}let t=n.skills.exclude.includes(e)?n.skills.exclude.filter(t=>t!==e):Z([...n.skills.exclude,e]);r({...n,skills:{mode:`all-enabled`,exclude:t}})},t[9]=n,t[10]=r,t[11]=y):y=t[11];let x=y,C;t[12]===s?.catalog?C=t[13]:(C=s?.catalog??[],t[12]=s?.catalog,t[13]=C);let w;if(t[14]!==v||t[15]!==C){let e;t[17]===v?e=t[18]:(e=e=>e.enabled&&v(e.name),t[17]=v,t[18]=e),w=C.filter(e),t[14]=v,t[15]=C,t[16]=w}else w=t[16];let E=w.length,D=i?`技能策略`:`Skill policy`,O;t[19]===D?O=t[20]:(O=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:D}),t[19]=D,t[20]=O);let ee=i?`决定所有智能体默认可以使用哪些技能。`:`Choose which skills every agent can discover and use by default.`,k;t[21]===ee?k=t[22]:(k=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:ee}),t[21]=ee,t[22]=k);let te;t[23]!==n||t[24]!==r?(te=()=>r({...n,skills:{mode:`all-enabled`,exclude:[]}}),t[23]=n,t[24]=r,t[25]=te):te=t[25];let A=n.skills.mode===`all-enabled`?`border-accent bg-accent/5 ring-1 ring-accent/20`:`border-edge bg-surface-panel hover:border-edge-strong`,j;t[26]===A?j=t[27]:(j=c(`flex items-start gap-3 rounded-xl border p-4 text-left`,A),t[26]=A,t[27]=j);let M;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,F.jsx)(o,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[28]=M):M=t[28];let ne=i?`使用所有已启用技能`:`Use every enabled skill`,N;t[29]===ne?N=t[30]:(N=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:ne}),t[29]=ne,t[30]=N);let re=i?`推荐。以后启用的新技能也会自动可用,可单独排除。`:`Recommended. Newly enabled skills become available automatically; exclude exceptions below.`,I;t[31]===re?I=t[32]:(I=(0,F.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:re}),t[31]=re,t[32]=I);let L;t[33]!==N||t[34]!==I?(L=(0,F.jsxs)(`span`,{children:[N,I]}),t[33]=N,t[34]=I,t[35]=L):L=t[35];let R;t[36]!==te||t[37]!==j||t[38]!==L?(R=(0,F.jsxs)(`button`,{type:`button`,onClick:te,className:j,children:[M,L]}),t[36]=te,t[37]=j,t[38]=L,t[39]=R):R=t[39];let z;t[40]!==n||t[41]!==r?(z=()=>r({...n,skills:{mode:`selected`,include:[]}}),t[40]=n,t[41]=r,t[42]=z):z=t[42];let B=n.skills.mode===`selected`?`border-accent bg-accent/5 ring-1 ring-accent/20`:`border-edge bg-surface-panel hover:border-edge-strong`,V;t[43]===B?V=t[44]:(V=c(`flex items-start gap-3 rounded-xl border p-4 text-left`,B),t[43]=B,t[44]=V);let H;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,F.jsx)(T,{className:`mt-0.5 size-5 shrink-0 text-accent`}),t[45]=H):H=t[45];let U=i?`只使用选中的技能`:`Use selected skills only`,W;t[46]===U?W=t[47]:(W=(0,F.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:U}),t[46]=U,t[47]=W);let ae=i?`适合严格受控的环境;新增技能不会自动加入。`:`For tightly controlled environments; new skills are not added automatically.`,G;t[48]===ae?G=t[49]:(G=(0,F.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:ae}),t[48]=ae,t[49]=G);let K;t[50]!==W||t[51]!==G?(K=(0,F.jsxs)(`span`,{children:[W,G]}),t[50]=W,t[51]=G,t[52]=K):K=t[52];let q;t[53]!==z||t[54]!==V||t[55]!==K?(q=(0,F.jsxs)(`button`,{type:`button`,onClick:z,className:V,children:[H,K]}),t[53]=z,t[54]=V,t[55]=K,t[56]=q):q=t[56];let J;t[57]!==R||t[58]!==q?(J=(0,F.jsxs)(`div`,{className:`mt-5 grid gap-3 sm:grid-cols-2`,children:[R,q]}),t[57]=R,t[58]=q,t[59]=J):J=t[59];let Y;t[60]!==k||t[61]!==J||t[62]!==O?(Y=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[O,k,J]}),t[60]=k,t[61]=J,t[62]=O,t[63]=Y):Y=t[63];let X=n.skills.mode===`selected`?i?`选择可用技能`:`Select available skills`:i?`管理例外`:`Manage exceptions`,Q;t[64]===X?Q=t[65]:(Q=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:X}),t[64]=X,t[65]=Q);let le=i?`当前默认可用 ${E} 个技能。`:`${E} skills are available by default.`,ue;t[66]===le?ue=t[67]:(ue=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:le}),t[66]=le,t[67]=ue);let de;t[68]!==Q||t[69]!==ue?(de=(0,F.jsxs)(`div`,{children:[Q,ue]}),t[68]=Q,t[69]=ue,t[70]=de):de=t[70];let fe=i?`搜索技能`:`Search skills`,pe;t[71]===fe?pe=t[72]:(pe=(0,F.jsx)(`span`,{className:`sr-only`,children:fe}),t[71]=fe,t[72]=pe);let me;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,F.jsx)(b,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[73]=me):me=t[73];let he;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(he=e=>p(e.target.value),t[74]=he):he=t[74];let ge=i?`搜索技能`:`Search skills`,_e;t[75]!==f||t[76]!==ge?(_e=(0,F.jsx)(`input`,{type:`search`,value:f,onChange:he,placeholder:ge,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[75]=f,t[76]=ge,t[77]=_e):_e=t[77];let ve;t[78]!==pe||t[79]!==_e?(ve=(0,F.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[pe,me,_e]}),t[78]=pe,t[79]=_e,t[80]=ve):ve=t[80];let ye;t[81]!==de||t[82]!==ve?(ye=(0,F.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[de,ve]}),t[81]=de,t[82]=ve,t[83]=ye):ye=t[83];let be;t[84]===l?be=t[85]:(be=l?(0,F.jsx)(`p`,{className:`mt-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:l instanceof Error?l.message:String(l)}):null,t[84]=l,t[85]=be);let xe;t[86]!==v||t[87]!==u||t[88]!==g||t[89]!==x||t[90]!==i?(xe=u?(0,F.jsx)(`div`,{className:`mt-4 space-y-2`,children:[0,1,2,3].map(oe)}):(0,F.jsxs)(`div`,{className:`mt-4 max-h-[32rem] divide-y divide-edge overflow-y-auto rounded-xl border border-edge bg-surface-panel`,children:[g.map(e=>{let t=v(e.name);return(0,F.jsxs)(`label`,{className:c(`flex cursor-pointer items-start gap-3 px-4 py-3 hover:bg-surface-hover/60`,!e.enabled&&`cursor-not-allowed opacity-55`),children:[(0,F.jsx)(`input`,{type:`checkbox`,checked:t,disabled:!e.enabled,onChange:()=>x(e.name),className:`mt-0.5 size-4 rounded border-edge accent-[var(--color-accent)]`}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,F.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,F.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.name}),e.enabled?null:(0,F.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[10px] text-fg-muted`,children:i?`全局未启用`:`Disabled globally`})]}),e.description?(0,F.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.description}):null]})]},e.name)}),g.length===0?(0,F.jsx)(`p`,{className:`px-4 py-8 text-center text-sm text-fg-muted`,children:i?`没有匹配的技能。`:`No matching skills.`}):null]}),t[86]=v,t[87]=u,t[88]=g,t[89]=x,t[90]=i,t[91]=xe):xe=t[91];let $;t[92]!==ye||t[93]!==be||t[94]!==xe?($=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[ye,be,xe]}),t[92]=ye,t[93]=be,t[94]=xe,t[95]=$):$=t[95];let Se;return t[96]!==Y||t[97]!==$?(Se=(0,F.jsxs)(`div`,{className:`space-y-5`,children:[Y,$]}),t[96]=Y,t[97]=$,t[98]=Se):Se=t[98],Se}function oe(e){return(0,F.jsx)(m,{className:`h-14 rounded-xl`},e)}function se(e,t){return e.name.localeCompare(t.name)}function ce(e){return e.name}function le(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function ue(e){let t=(0,ie.c)(92),{draft:n,setDraft:r,builtinTools:i,zh:a}=e,[o,s]=(0,P.useState)(``),[l,u]=(0,P.useState)(`all`),[d,p]=(0,P.useState)(),m;t[0]===i?m=t[1]:(m=new Map(i.map(fe)),t[0]=i,t[1]=m);let h=m,g;t[2]!==i||t[3]!==n.tools?(g=[...new Set([...i.map(de),...Object.keys(n.tools)])].sort(),t[2]=i,t[3]=n.tools,t[4]=g):g=t[4];let _=g,v;if(t[5]!==_||t[6]!==n.tools){let e;t[8]===n.tools?e=t[9]:(e=e=>(n.tools[e]?.mode??`allow`)===`allow`,t[8]=n.tools,t[9]=e),v=_.filter(e),t[5]=_,t[6]=n.tools,t[7]=v}else v=t[7];let y=v.length,x;if(t[10]!==_||t[11]!==n.tools){let e;t[13]===n.tools?e=t[14]:(e=e=>n.tools[e]?.mode===`ask`,t[13]=n.tools,t[14]=e),x=_.filter(e),t[10]=_,t[11]=n.tools,t[12]=x}else x=t[12];let S=x.length,C;if(t[15]!==_||t[16]!==n.tools){let e;t[18]===n.tools?e=t[19]:(e=e=>n.tools[e]?.mode===`deny`,t[18]=n.tools,t[19]=e),C=_.filter(e),t[15]=_,t[16]=n.tools,t[17]=C}else C=t[17];let w;t[20]!==v.length||t[21]!==x.length||t[22]!==C.length?(w={allow:y,ask:S,deny:C.length},t[20]=v.length,t[21]=x.length,t[22]=C.length,t[23]=w):w=t[23];let T=w,E;if(t[24]!==_||t[25]!==h||t[26]!==n.tools||t[27]!==l||t[28]!==o){let e=o.trim().toLowerCase();E=_.filter(t=>{let r=n.tools[t]?.mode??`allow`,i=h.get(t),a=`${t} ${i?.en??``} ${i?.zh??``}`.toLowerCase();return(!e||a.includes(e))&&(l===`all`||r===l)}),t[24]=_,t[25]=h,t[26]=n.tools,t[27]=l,t[28]=o,t[29]=E}else E=t[29];let D=E,O;t[30]!==n||t[31]!==r?(O=(e,t)=>{let i=n.tools[e]??{mode:`allow`};r({...n,tools:{...n.tools,[e]:{...i,...t}}})},t[30]=n,t[31]=r,t[32]=O):O=t[32];let ee=O,te=a?`全部 ${_.length}`:`All ${_.length}`,A;t[33]===te?A=t[34]:(A={id:`all`,label:te},t[33]=te,t[34]=A);let j=a?`允许 ${T.allow}`:`Allow ${T.allow}`,M;t[35]===j?M=t[36]:(M={id:`allow`,label:j},t[35]=j,t[36]=M);let ne=a?`询问 ${T.ask}`:`Ask ${T.ask}`,N;t[37]===ne?N=t[38]:(N={id:`ask`,label:ne},t[37]=ne,t[38]=N);let re=a?`禁用 ${T.deny}`:`Deny ${T.deny}`,I;t[39]===re?I=t[40]:(I={id:`deny`,label:re},t[39]=re,t[40]=I);let L;t[41]!==A||t[42]!==M||t[43]!==N||t[44]!==I?(L=[A,M,N,I],t[41]=A,t[42]=M,t[43]=N,t[44]=I,t[45]=L):L=t[45];let R=L,z=a?`默认工具权限`:`Default tool permissions`,B;t[46]===z?B=t[47]:(B=(0,F.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:z}),t[46]=z,t[47]=B);let V=a?`允许:直接执行;询问:执行前确认;禁用:智能体无法使用。`:`Allow runs directly, Ask requires confirmation, and Deny makes the tool unavailable.`,H;t[48]===V?H=t[49]:(H=(0,F.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:V}),t[48]=V,t[49]=H);let U;t[50]!==B||t[51]!==H?(U=(0,F.jsxs)(`div`,{children:[B,H]}),t[50]=B,t[51]=H,t[52]=U):U=t[52];let W;t[53]!==l||t[54]!==R?(W=(0,F.jsx)(`div`,{className:`flex flex-wrap gap-1 rounded-xl bg-surface-panel p-1`,children:R.map(e=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>u(e.id),className:c(`rounded-lg px-3 py-1.5 text-xs font-medium`,l===e.id?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:e.label},e.id))}),t[53]=l,t[54]=R,t[55]=W):W=t[55];let ae=a?`搜索工具`:`Search tools`,G;t[56]===ae?G=t[57]:(G=(0,F.jsx)(`span`,{className:`sr-only`,children:ae}),t[56]=ae,t[57]=G);let K;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,F.jsx)(b,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`}),t[58]=K):K=t[58];let q;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(q=e=>s(e.target.value),t[59]=q):q=t[59];let J=a?`搜索工具`:`Search tools`,Y;t[60]!==o||t[61]!==J?(Y=(0,F.jsx)(`input`,{type:`search`,value:o,onChange:q,placeholder:J,className:`w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg outline-none focus:border-accent`}),t[60]=o,t[61]=J,t[62]=Y):Y=t[62];let X;t[63]!==G||t[64]!==Y?(X=(0,F.jsxs)(`label`,{className:`relative block w-full sm:w-72`,children:[G,K,Y]}),t[63]=G,t[64]=Y,t[65]=X):X=t[65];let Z;t[66]!==W||t[67]!==X?(Z=(0,F.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center justify-between gap-3`,children:[W,X]}),t[66]=W,t[67]=X,t[68]=Z):Z=t[68];let Q;if(t[69]!==h||t[70]!==n.tools||t[71]!==d||t[72]!==ee||t[73]!==D||t[74]!==a){let e;t[76]!==h||t[77]!==n.tools||t[78]!==d||t[79]!==ee||t[80]!==a?(e=e=>{let t=n.tools[e]??{mode:`allow`},r=h.get(e),i=d===e;return(0,F.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`code`,{className:`text-xs font-medium text-fg`,children:e}),r?(0,F.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a?r.zh:r.en}):null]}),(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,F.jsx)(`div`,{className:`flex rounded-lg bg-surface-base p-1`,children:[`allow`,`ask`,`deny`].map(n=>(0,F.jsx)(`button`,{type:`button`,onClick:()=>ee(e,{mode:n}),className:c(`rounded-md px-2.5 py-1 text-xs font-medium capitalize`,t.mode===n?`bg-accent text-white`:`text-fg-muted hover:text-fg`),children:n===`allow`?a?`允许`:`Allow`:n===`ask`?a?`询问`:`Ask`:a?`禁用`:`Deny`},n))}),(0,F.jsx)(f,{variant:`ghost`,className:`px-2 py-1`,"aria-label":a?`${e} 调用限制`:`${e} call limits`,onClick:()=>p(i?void 0:e),children:(0,F.jsx)(k,{className:`size-4`})})]})]}),i?(0,F.jsxs)(`div`,{className:`mt-3 grid gap-3 rounded-lg bg-surface-base p-3 sm:grid-cols-2`,children:[(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`每轮最多调用次数`:`Maximum calls per turn`,(0,F.jsx)(`input`,{type:`number`,min:1,value:t.maxCallsPerTurn??``,placeholder:a?`不限制`:`Unlimited`,onChange:t=>ee(e,{maxCallsPerTurn:le(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]}),(0,F.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[a?`单次超时(毫秒)`:`Call timeout (ms)`,(0,F.jsx)(`input`,{type:`number`,min:1,value:t.timeoutMs??``,placeholder:a?`使用系统默认值`:`Use system default`,onChange:t=>ee(e,{timeoutMs:le(t.target.value)}),className:`mt-2 w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none focus:border-accent`})]})]}):null]},e)},t[76]=h,t[77]=n.tools,t[78]=d,t[79]=ee,t[80]=a,t[81]=e):e=t[81],Q=D.map(e),t[69]=h,t[70]=n.tools,t[71]=d,t[72]=ee,t[73]=D,t[74]=a,t[75]=Q}else Q=t[75];let oe;t[82]!==D.length||t[83]!==a?(oe=D.length===0?(0,F.jsx)(`p`,{className:`px-4 py-10 text-center text-sm text-fg-muted`,children:a?`没有匹配的工具。`:`No matching tools.`}):null,t[82]=D.length,t[83]=a,t[84]=oe):oe=t[84];let se;t[85]!==Q||t[86]!==oe?(se=(0,F.jsxs)(`div`,{className:`mt-4 max-h-[38rem] divide-y divide-edge overflow-y-auto rounded-xl border border-edge bg-surface-panel`,children:[Q,oe]}),t[85]=Q,t[86]=oe,t[87]=se):se=t[87];let ce;return t[88]!==U||t[89]!==Z||t[90]!==se?(ce=(0,F.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-5`,children:[U,Z,se]}),t[88]=U,t[89]=Z,t[90]=se,t[91]=ce):ce=t[91],ce}function de(e){return e.id}function fe(e){return[e.id,e.description]}function pe(){let e=(0,ie.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsxs)(j,{gap:`gap-5`,children:[(0,F.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,F.jsxs)(`div`,{className:`space-y-2`,children:[(0,F.jsx)(m,{className:`h-7 w-56`}),(0,F.jsx)(m,{className:`h-4 w-96 max-w-full`})]}),(0,F.jsx)(m,{className:`h-9 w-28`})]}),(0,F.jsx)(m,{className:`h-20 rounded-2xl`}),(0,F.jsx)(m,{className:`h-12 rounded-xl`}),(0,F.jsx)(m,{className:`h-72 rounded-2xl`})]}),e[0]=t):t=e[0],t}function me(e){let t=(0,ie.c)(67),{initial:n,builtinTools:r,zh:i}=e,[a,o]=(0,P.useState)(`models`),s;t[0]===n?s=t[1]:(s=()=>structuredClone(n),t[0]=n,t[1]=s);let[l,u]=(0,P.useState)(s),d;t[2]===n?d=t[3]:(d=()=>structuredClone(n),t[2]=n,t[3]=d);let[p,m]=(0,P.useState)(d),h;t[4]===l?h=t[5]:(h=JSON.stringify(l),t[4]=l,t[5]=h);let g;t[6]===p?g=t[7]:(g=JSON.stringify(p),t[6]=p,t[7]=g);let v=h!==g,y=i?`模型`:`Models`,b;t[8]===y?b=t[9]:(b={id:`models`,label:y,icon:w},t[8]=y,t[9]=b);let x=i?`技能`:`Skills`,S;t[10]===x?S=t[11]:(S={id:`skills`,label:x,icon:D},t[10]=x,t[11]=S);let C=i?`工具`:`Tools`,T;t[12]===C?T=t[13]:(T={id:`tools`,label:C,icon:E},t[12]=C,t[13]=T);let O=i?`运行`:`Runtime`,k;t[14]===O?k=t[15]:(k={id:`runtime`,label:O,icon:_},t[14]=O,t[15]=k);let te;t[16]!==T||t[17]!==k||t[18]!==b||t[19]!==S?(te=[b,S,T,k],t[16]=T,t[17]=k,t[18]=b,t[19]=S,t[20]=te):te=t[20];let N=te,re;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(re=async e=>{let t=structuredClone(e),n=await ee(t),r=structuredClone(n.defaults);u(e=>JSON.stringify(e)===JSON.stringify(t)?r:e),m(structuredClone(r))},t[21]=re):re=t[21];let I=re,L;t[22]!==v||t[23]!==l?(L={value:l,dirty:v,onSave:I,delayMs:0},t[22]=v,t[23]=l,t[24]=L):L=t[24];let R=ne(L),z=R.onBlurCapture,B=i?`智能体设置`:`Agent settings`,V;t[25]!==R.error||t[26]!==R.status?(V=(0,F.jsx)(M,{status:R.status,error:R.error}),t[25]=R.error,t[26]=R.status,t[27]=V):V=t[27];let H;t[28]!==B||t[29]!==V?(H=(0,F.jsx)(A,{title:B,actions:V}),t[28]=B,t[29]=V,t[30]=H):H=t[30];let U;t[31]!==R.error||t[32]!==R.retry||t[33]!==i?(U=R.error?(0,F.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:[(0,F.jsx)(`span`,{children:R.error}),(0,F.jsx)(f,{type:`button`,variant:`ghost`,className:`h-8 text-red-600`,onClick:R.retry,children:i?`重试`:`Retry`})]}):null,t[31]=R.error,t[32]=R.retry,t[33]=i,t[34]=U):U=t[34];let W=i?`默认配置分区`:`Default configuration sections`,ae;t[35]!==a||t[36]!==N?(ae=N.map(e=>{let{id:t,label:n,icon:r}=e;return(0,F.jsxs)(`button`,{type:`button`,"aria-pressed":a===t,onClick:()=>o(t),className:c(`flex min-w-0 items-center justify-center gap-2 rounded-xl px-3 py-2.5 text-left transition-colors`,a===t?`bg-surface-panel text-fg shadow-surface ring-1 ring-edge`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,F.jsx)(r,{className:c(`size-4 shrink-0`,a===t?`text-accent`:`text-fg-subtle`)}),(0,F.jsx)(`span`,{className:`text-sm font-medium`,children:n})]},t)}),t[35]=a,t[36]=N,t[37]=ae):ae=t[37];let K;t[38]!==W||t[39]!==ae?(K=(0,F.jsx)(`nav`,{className:`grid grid-cols-2 gap-2 rounded-2xl border border-edge bg-surface-base p-2 lg:grid-cols-4`,"aria-label":W,children:ae}),t[38]=W,t[39]=ae,t[40]=K):K=t[40];let q;t[41]!==a||t[42]!==l||t[43]!==i?(q=a===`models`?(0,F.jsx)(G,{draft:l,setDraft:u,zh:i}):null,t[41]=a,t[42]=l,t[43]=i,t[44]=q):q=t[44];let J;t[45]!==a||t[46]!==l||t[47]!==i?(J=a===`skills`?(0,F.jsx)(Q,{draft:l,setDraft:u,zh:i}):null,t[45]=a,t[46]=l,t[47]=i,t[48]=J):J=t[48];let X;t[49]!==a||t[50]!==r||t[51]!==l||t[52]!==i?(X=a===`tools`?(0,F.jsx)(ue,{draft:l,setDraft:u,builtinTools:r,zh:i}):null,t[49]=a,t[50]=r,t[51]=l,t[52]=i,t[53]=X):X=t[53];let Z;t[54]!==a||t[55]!==l||t[56]!==i?(Z=a===`runtime`?(0,F.jsx)(Y,{draft:l,setDraft:u,zh:i}):null,t[54]=a,t[55]=l,t[56]=i,t[57]=Z):Z=t[57];let oe;return t[58]!==R.onBlurCapture||t[59]!==H||t[60]!==U||t[61]!==K||t[62]!==q||t[63]!==J||t[64]!==X||t[65]!==Z?(oe=(0,F.jsxs)(j,{gap:`gap-5`,onBlurCapture:z,children:[H,U,K,q,J,X,Z]}),t[58]=R.onBlurCapture,t[59]=H,t[60]=U,t[61]=K,t[62]=q,t[63]=J,t[64]=X,t[65]=Z,t[66]=oe):oe=t[66],oe}function he(){let e=(0,ie.c)(17),t=l(_e),n=u(ge)===`zh`,{data:r,error:i,isLoading:a,mutate:o}=d(t?`settings-agent-defaults`:null,C);if(!t){let t=n?`需要本机服务令牌。`:`Local service token required.`,r;return e[0]===t?r=e[1]:(r=(0,F.jsx)(j,{children:(0,F.jsx)(`p`,{className:`text-sm text-fg-muted`,children:t})}),e[0]=t,e[1]=r),r}if(i&&!r){let t=String(i),r;e[2]===t?r=e[3]:(r=(0,F.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:t}),e[2]=t,e[3]=r);let a;e[4]===o?a=e[5]:(a=()=>void o(),e[4]=o,e[5]=a);let s=n?`重试`:`Retry`,c;e[6]!==a||e[7]!==s?(c=(0,F.jsx)(f,{onClick:a,children:s}),e[6]=a,e[7]=s,e[8]=c):c=e[8];let l;return e[9]!==r||e[10]!==c?(l=(0,F.jsxs)(j,{children:[r,c]}),e[9]=r,e[10]=c,e[11]=l):l=e[11],l}if(a||!r){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,F.jsx)(pe,{}),e[12]=t):t=e[12],t}let s;return e[13]!==r.builtinTools||e[14]!==r.defaults||e[15]!==n?(s=(0,F.jsx)(me,{initial:r.defaults,builtinTools:r.builtinTools,zh:n}),e[13]=r.builtinTools,e[14]=r.defaults,e[15]=n,e[16]=s):s=e[16],s}function ge(e){return e.language}function _e(e){return e.conversationId}export{he as AgentDefaultsSettingsPanel};
|
|
@@ -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{d as i,p as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{t as o}from"./plus-Q2yW6OE7.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./cn-JdwAhgNB.js";import{c as l,n as u}from"./locale-store-D0001I7p.js";import{t as d}from"./messages-BWANv-N-.js";import{a as f,i as p,n as m,o as h,r as g,s as _,t as v}from"./dist-BGTk37IG.js";import{i as y}from"./vendor-swr-BIWyz7Rc.js";import{t as b}from"./button-CGlRPNzi.js";import{t as x}from"./skeleton-BwbyijEw.js";import{i as S,o as C}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{t as w}from"./settings-shell-layer-context-DCp6ykjQ.js";import{Du as T,Ec as E,Fl as D,Gs as O,P as k,Qc as A,Ua as j,Xs as M,dc as N,dn as P,fn as F,hn as I,mn as L,mo as R,pn as z,un as ee}from"./index-fVtuw2o9.js";import{r as B}from"./settings-page-layout-CsUQKRq0.js";var V=n(),H=e(t(),1),U=r(),te=[`fast`,`reasoning`,`coding`,`review`,`vision`,`understanding`],W=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function G(e){return[...new Set(e.split(`,`).map(e=>e.trim()).filter(Boolean))]}function K(e){let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:void 0}function q(e){let t=(0,V.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,U.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[10px] font-medium text-accent`,children:n}),t[0]=n,t[1]=r),r}function J(e){let t=(0,V.c)(10),{title:n,description:r,action:i}=e,a;t[0]===n?a=t[1]:(a=(0,U.jsx)(`h3`,{className:`text-base font-semibold text-fg`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=r?(0,U.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:r}):null,t[2]=r,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,U.jsxs)(`div`,{children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;return t[7]!==i||t[8]!==s?(c=(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[s,i]}),t[7]=i,t[8]=s,t[9]=c):c=t[9],c}function Y(e){let t=(0,V.c)(10),{label:n,value:r,detail:i}=e,a;t[0]===n?a=t[1]:(a=(0,U.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,U.jsx)(`p`,{className:`mt-2 truncate text-sm font-semibold text-fg`,title:r,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,U.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function X(e){let t=(0,V.c)(56),{label:n,inherited:r,value:i,zh:a,allowChatFallback:o,allowDisabled:s,onChange:c}=e,l=o===void 0?!1:o,u=s===void 0?!1:s,d=i!=null,f;t[0]===n?f=t[1]:(f=(0,U.jsx)(`h4`,{className:`text-sm font-medium text-fg`,children:n}),t[0]=n,t[1]=f);let p;t[2]!==i||t[3]!==a?(p=i===void 0?(0,U.jsx)(q,{children:a?`继承`:`Inherited`}):null,t[2]=i,t[3]=a,t[4]=p):p=t[4];let m;t[5]!==u||t[6]!==i||t[7]!==a?(m=i===null?(0,U.jsx)(q,{children:u?a?`已禁用`:`Disabled`:a?`使用 Chat`:`Uses Chat`}):null,t[5]=u,t[6]=i,t[7]=a,t[8]=m):m=t[8];let h;t[9]!==f||t[10]!==p||t[11]!==m?(h=(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[f,p,m]}),t[9]=f,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]!==r?.primary||t[14]!==i||t[15]!==a?(g=i===void 0?(0,U.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r?.primary??(a?`全局未配置`:`Not configured globally`)}):null,t[13]=r?.primary,t[14]=i,t[15]=a,t[16]=g):g=t[16];let _;t[17]!==h||t[18]!==g?(_=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[h,g]}),t[17]=h,t[18]=g,t[19]=_):_=t[19];let v;t[20]!==c||t[21]!==i||t[22]!==a?(v=i===void 0?null:(0,U.jsx)(b,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(void 0),children:a?`继承`:`Inherit`}),t[20]=c,t[21]=i,t[22]=a,t[23]=v):v=t[23];let y;t[24]!==l||t[25]!==c||t[26]!==i||t[27]!==a?(y=l&&i!==null?(0,U.jsx)(b,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(null),children:a?`使用 Chat`:`Use Chat`}):null,t[24]=l,t[25]=c,t[26]=i,t[27]=a,t[28]=y):y=t[28];let x;t[29]!==u||t[30]!==c||t[31]!==i||t[32]!==a?(x=u&&i!==null?(0,U.jsx)(b,{variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>c(null),children:a?`禁用`:`Disable`}):null,t[29]=u,t[30]=c,t[31]=i,t[32]=a,t[33]=x):x=t[33];let S;t[34]!==d||t[35]!==r?.fallbacks||t[36]!==r?.primary||t[37]!==c||t[38]!==a?(S=d?null:(0,U.jsx)(b,{className:`px-2 py-1 text-xs`,onClick:()=>c({primary:r?.primary??``,fallbacks:[...r?.fallbacks??[]]}),children:a?`自定义`:`Customize`}),t[34]=d,t[35]=r?.fallbacks,t[36]=r?.primary,t[37]=c,t[38]=a,t[39]=S):S=t[39];let C;t[40]!==y||t[41]!==x||t[42]!==S||t[43]!==v?(C=(0,U.jsxs)(`div`,{className:`flex gap-1`,children:[v,y,x,S]}),t[40]=y,t[41]=x,t[42]=S,t[43]=v,t[44]=C):C=t[44];let w;t[45]!==C||t[46]!==_?(w=(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[_,C]}),t[45]=C,t[46]=_,t[47]=w):w=t[47];let T;t[48]!==d||t[49]!==c||t[50]!==i||t[51]!==a?(T=d?(0,U.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,0.8fr)]`,children:[(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[a?`主模型`:`Primary model`,(0,U.jsx)(`input`,{className:`${W} mt-1.5 font-mono`,value:i.primary,onChange:e=>c({...i,primary:e.target.value})})]}),(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[a?`回退模型`:`Fallbacks`,(0,U.jsx)(`input`,{className:`${W} mt-1.5 font-mono`,value:i.fallbacks.join(`, `),onChange:e=>c({...i,fallbacks:G(e.target.value)}),placeholder:a?`逗号分隔`:`Comma separated`})]})]}):null,t[48]=d,t[49]=c,t[50]=i,t[51]=a,t[52]=T):T=t[52];let E;return t[53]!==w||t[54]!==T?(E=(0,U.jsxs)(`div`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[w,T]}),t[53]=w,t[54]=T,t[55]=E):E=t[55],E}function Z(e){return Object.values(e).some(e=>e!==void 0)?e:void 0}function Q({agent:e,toolIds:t,zh:n,messages:r,externalError:i,onDirtyChange:a,onClose:o,onOpenDefaults:s,onChat:l,onDelete:u}){let[d,f]=(0,H.useState)(`overview`),[p,m]=(0,H.useState)(()=>structuredClone(e.override)),[h,g]=(0,H.useState)(!1),[_,v]=(0,H.useState)(null),y=JSON.stringify(p)!==JSON.stringify(e.override),x=[p.models?.chat,...Object.values(p.models?.intents??{}),p.models?.imageUnderstanding,p.models?.imageGeneration].some(e=>e!=null&&!e.primary.trim());(0,H.useEffect)(()=>a(y),[y,a]);let S=(0,H.useMemo)(()=>[...new Set([...t,...Object.keys(e.effective.tools),...Object.keys(p.tools??{})])].sort(),[e.effective.tools,p.tools,t]),C=[p.models?n?`模型`:`Models`:null,p.skills?n?`技能`:`Skills`:null,p.tools?n?`工具权限`:`Tool access`:null,p.runtime||p.workflows?n?`运行限制`:`Runtime`:null].filter(e=>!!e),w=Object.values(e.effective.tools).filter(e=>e.mode===`deny`).length,k=e.effective.skills.mode===`selected`?n?`${e.effective.skills.include.length} 个已选技能`:`${e.effective.skills.include.length} selected skills`:n?`所有已启用技能`:`All enabled skills`,j=P({id:e.id,name:p.profile?.name??e.name},r),F={fast:r.editorIntentFast,reasoning:r.editorIntentReasoning,coding:r.editorIntentCoding,review:r.editorIntentReview,vision:r.editorIntentVision,understanding:r.editorIntentUnderstanding},L={inherit:r.editorToolModeInherit,allow:r.editorToolModeAllow,ask:r.editorToolModeAsk,deny:r.editorToolModeDeny},R=async()=>{g(!0),v(null);try{let t=(await I(e.id,{workspace:p.workspace??null,profile:p.profile,models:p.models??null,skills:p.skills??null,tools:p.tools??null,workflows:p.workflows??null,runtime:p.runtime??null})).agents.find(t=>t.id===e.id);t&&m(structuredClone(t.override))}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(!1)}},z=async()=>{g(!0),v(null);try{await I(e.id,{setDefault:!0})}catch(e){v(e instanceof Error?e.message:String(e))}finally{g(!1)}},ee=(e,t)=>{let n={...p.tools??{}};t===`inherit`?delete n[e]:n[e]={...n[e],mode:t},m({...p,tools:Object.keys(n).length>0?n:void 0})},B=(e,t)=>{let n={...p.models??{}},r={...n.intents??{}};t===void 0?delete r[e]:r[e]=t,Object.keys(r).length>0?n.intents=r:delete n.intents,m({...p,models:Object.keys(n).length>0?n:void 0})};return(0,U.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,U.jsx)(`aside`,{className:`shrink-0 overflow-x-auto border-b border-edge px-3 py-3 sm:w-52 sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-3 sm:py-4`,children:(0,U.jsx)(`nav`,{className:`flex gap-1 sm:flex-col`,children:[{id:`overview`,label:n?`概览`:`Overview`,icon:D},{id:`profile`,label:n?`个性`:`Profile`,icon:O},{id:`models`,label:n?`模型`:`Models`,icon:N},{id:`capabilities`,label:n?`技能与工具`:`Skills & tools`,icon:T},{id:`runtime`,label:n?`运行限制`:`Runtime`,icon:D},{id:`danger`,label:n?`危险区`:`Danger zone`,icon:M}].map(({id:e,label:t,icon:n})=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>f(e),className:c(`flex shrink-0 items-center gap-2.5 rounded-xl px-3 py-2 text-left text-sm font-medium transition-colors`,d===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,U.jsx)(n,{className:`size-4`}),t]},e))})}),(0,U.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,U.jsxs)(`main`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:[_||i?(0,U.jsx)(`p`,{className:`mb-4 rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:_??i}):null,d===`overview`?(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(J,{title:n?`配置概览`:`Configuration overview`,description:n?`查看当前真正生效的配置。未覆盖的部分会持续跟随全局默认值。`:`Review what actually takes effect. Anything not overridden keeps following global defaults.`,action:(0,U.jsxs)(b,{onClick:l,children:[(0,U.jsx)(A,{className:`size-4`}),n?`开始对话`:`Start chat`]})}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 rounded-2xl border border-accent/20 bg-accent/5 p-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:C.length>0?n?`已自定义:${C.join(`、`)}`:`Customized: ${C.join(`, `)}`:n?`能力配置使用全局默认`:`Capabilities use global defaults`}),(0,U.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:C.length>0?n?`其他能力会继续跟随全局默认配置。`:`All other capabilities continue to follow global defaults.`:n?`修改全局默认配置后,这个智能体会自动同步。`:`This agent updates automatically when global defaults change.`})]}),(0,U.jsx)(b,{onClick:s,children:n?`查看全局默认配置`:`View global defaults`})]}),(0,U.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,U.jsx)(Y,{label:n?`对话模型`:`Chat model`,value:e.effective.models.chat.primary,detail:p.models?.chat?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,U.jsx)(Y,{label:n?`技能`:`Skills`,value:k,detail:p.skills?n?`单独设置`:`Agent override`:n?`继承全局`:`Inherited globally`}),(0,U.jsx)(Y,{label:n?`工具权限`:`Tool access`,value:w>0?n?`${w} 个禁用`:`${w} denied`:n?`全部可用`:`All available`,detail:p.tools?n?`${Object.keys(p.tools).length} 个本地覆盖`:`${Object.keys(p.tools).length} local overrides`:n?`继承全局`:`Inherited globally`}),(0,U.jsx)(Y,{label:n?`工作区`:`Workspace`,value:e.effective.workspace,detail:p.workspace?n?`单独设置`:`Agent specific`:n?`自动工作区`:`Automatic workspace`})]}),e.isDefault?null:(0,U.jsx)(b,{onClick:()=>void z(),disabled:h,children:n?`设为默认智能体`:`Make default agent`})]}):null,d===`profile`?(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(J,{title:n?`个性与工作区`:`Profile and workspace`,description:n?`只设置这个智能体独有的身份、表达方式和工作目录。`:`Keep only this agent’s identity, behavior, and workspace here.`}),(0,U.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`名称`:`Name`,(0,U.jsx)(`input`,{className:`${W} mt-1.5`,value:j,onChange:e=>m({...p,profile:{name:e.target.value,...p.profile?.instructions?{instructions:p.profile.instructions}:{}}})})]}),(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-2`,children:[n?`工作区`:`Workspace`,p.workspace?null:(0,U.jsx)(q,{children:n?`自动`:`Automatic`})]}),(0,U.jsx)(`input`,{className:`${W} mt-1.5 font-mono`,value:p.workspace??``,placeholder:e.effective.workspace,onChange:e=>m({...p,workspace:e.target.value||void 0})})]})]}),(0,U.jsxs)(`label`,{className:`block text-xs font-medium text-fg-muted`,children:[n?`个性指令`:`Personality instructions`,(0,U.jsx)(`textarea`,{rows:10,className:`${W} mt-1.5 resize-y leading-6`,value:p.profile?.instructions??``,onChange:t=>m({...p,profile:{name:p.profile?.name||e.name,instructions:t.target.value||void 0}}),placeholder:n?`描述角色、语气、判断偏好和工作方式`:`Describe the role, tone, judgment preferences, and working style`})]})]}):null,d===`models`?(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(J,{title:n?`模型路由`:`Model routing`,description:n?`日常对话使用 Chat;固定意图只在对应任务中生效。默认继承全局。`:`Chat handles normal turns; fixed intents apply only to matching work. Everything inherits by default.`,action:p.models?(0,U.jsxs)(b,{variant:`ghost`,onClick:()=>m({...p,models:void 0}),children:[(0,U.jsx)(E,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,U.jsx)(X,{label:r.editorChatModel,inherited:e.effective.models.chat,value:p.models?.chat,zh:n,onChange:e=>{let t={...p.models??{}};e?t.chat=e:delete t.chat,m({...p,models:Object.keys(t).length>0?t:void 0})}}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`固定意图`:`Fixed intents`}),(0,U.jsx)(`div`,{className:`space-y-3`,children:te.map(t=>(0,U.jsx)(X,{label:F[t],inherited:e.effective.models.intents[t]??e.effective.models.chat,value:p.models?.intents?.[t],zh:n,allowChatFallback:!0,onChange:e=>B(t,e)},t))})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`mb-3 text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n?`图片能力`:`Image capabilities`}),(0,U.jsxs)(`div`,{className:`space-y-3`,children:[(0,U.jsx)(X,{label:n?`图片理解`:`Image understanding`,inherited:e.effective.models.imageUnderstanding,value:p.models?.imageUnderstanding,zh:n,allowDisabled:!0,onChange:e=>{let t={...p.models??{}};e===void 0?delete t.imageUnderstanding:t.imageUnderstanding=e,m({...p,models:Object.keys(t).length>0?t:void 0})}}),(0,U.jsx)(X,{label:n?`图片生成`:`Image generation`,inherited:e.effective.models.imageGeneration,value:p.models?.imageGeneration,zh:n,allowDisabled:!0,onChange:t=>{let n={...p.models??{}};t===void 0?delete n.imageGeneration:t===null?n.imageGeneration=null:n.imageGeneration={...t,timeoutMs:p.models?.imageGeneration?.timeoutMs??e.effective.models.imageGeneration?.timeoutMs,autoProviderFallback:p.models?.imageGeneration?.autoProviderFallback??e.effective.models.imageGeneration?.autoProviderFallback??!0},m({...p,models:Object.keys(n).length>0?n:void 0})}}),p.models?.imageGeneration?(0,U.jsxs)(`div`,{className:`grid gap-4 rounded-2xl border border-edge bg-surface-base p-4 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`生成超时(毫秒)`:`Generation timeout (ms)`,(0,U.jsx)(`input`,{type:`number`,min:1,className:`${W} mt-1.5`,value:p.models.imageGeneration.timeoutMs??``,onChange:e=>m({...p,models:{...p.models,imageGeneration:{...p.models.imageGeneration,timeoutMs:K(e.target.value)}}})})]}),(0,U.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,U.jsx)(`span`,{children:n?`提供商自动回退`:`Automatic provider fallback`}),(0,U.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[!0,!1].map(e=>(0,U.jsx)(`button`,{type:`button`,onClick:()=>m({...p,models:{...p.models,imageGeneration:{...p.models.imageGeneration,autoProviderFallback:e}}}),className:c(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,p.models?.imageGeneration?.autoProviderFallback===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e?n?`开启`:`On`:n?`关闭`:`Off`},String(e)))})]})]}):null]})]})]}):null,d===`capabilities`?(0,U.jsxs)(`div`,{className:`space-y-7`,children:[(0,U.jsx)(J,{title:n?`技能与工具`:`Skills and tools`,description:n?`默认继承全局能力;只设置确实不同的部分。`:`Keep inheritance for global capabilities; override only agents that genuinely differ.`}),(0,U.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`技能策略`:`Skill policy`}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:p.skills?n?`当前使用单独设置`:`Using an agent override`:n?`当前继承全局`:`Currently inherited globally`})]}),p.skills?(0,U.jsxs)(b,{variant:`ghost`,onClick:()=>m({...p,skills:void 0}),children:[(0,U.jsx)(E,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),(0,U.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,U.jsx)(b,{variant:p.skills?.mode===`merge`?`primary`:`secondary`,onClick:()=>m({...p,skills:{mode:`merge`,add:[],remove:[]}}),children:r.editorSkillModeMerge}),(0,U.jsx)(b,{variant:p.skills?.mode===`replace`?`primary`:`secondary`,onClick:()=>m({...p,skills:{mode:`replace`,include:[]}}),children:r.editorSkillModeReplace})]}),p.skills?.mode===`merge`?(0,U.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`新增技能`:`Add skills`,(0,U.jsx)(`input`,{className:`${W} mt-1.5`,value:p.skills.add.join(`, `),onChange:e=>m({...p,skills:{mode:`merge`,add:G(e.target.value),remove:p.skills?.mode===`merge`?p.skills.remove:[]}})})]}),(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`移除技能`:`Remove skills`,(0,U.jsx)(`input`,{className:`${W} mt-1.5`,value:p.skills.remove.join(`, `),onChange:e=>m({...p,skills:{mode:`merge`,add:p.skills?.mode===`merge`?p.skills.add:[],remove:G(e.target.value)}})})]})]}):null,p.skills?.mode===`replace`?(0,U.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[n?`仅启用这些技能`:`Enable only these skills`,(0,U.jsx)(`input`,{className:`${W} mt-1.5`,value:p.skills.include.join(`, `),onChange:e=>m({...p,skills:{mode:`replace`,include:G(e.target.value)}})})]}):null]}),(0,U.jsxs)(`section`,{children:[(0,U.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工具权限`:`Tool permissions`}),p.tools?(0,U.jsxs)(b,{variant:`ghost`,onClick:()=>m({...p,tools:void 0}),children:[(0,U.jsx)(E,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):null]}),(0,U.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:S.map(t=>{let r=p.tools?.[t]?.mode,i=e.effective.tools[t]?.mode??`allow`;return(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`code`,{className:`text-xs text-fg`,children:t}),(0,U.jsx)(`p`,{className:`mt-1 text-[11px] text-fg-muted`,children:r?n?`单独设置`:`Agent override`:`${n?`继承`:`Inherits`} ${L[i]}`})]}),(0,U.jsx)(`div`,{className:`flex rounded-xl bg-surface-hover p-1`,children:[`inherit`,`allow`,`ask`,`deny`].map(e=>(0,U.jsx)(`button`,{type:`button`,onClick:()=>ee(t,e),className:c(`rounded-lg px-2.5 py-1.5 text-xs font-medium transition-colors`,(e===`inherit`?!r:r===e)?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),children:L[e]},e))})]},t)})})]})]}):null,d===`runtime`?(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(J,{title:n?`运行限制`:`Runtime limits`,description:n?`留空即继承全局限制。`:`Leave blank to inherit global limits. Use overrides only to tighten or relax a specialist agent.`,action:p.runtime||p.workflows?(0,U.jsxs)(b,{variant:`ghost`,onClick:()=>m({...p,runtime:void 0,workflows:void 0}),children:[(0,U.jsx)(E,{className:`size-4`}),n?`全部继承`:`Inherit all`]}):void 0}),(0,U.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[[`maxTurns`,n?`单次最大轮数`:`Maximum turns`],[`timeoutMs`,n?`单轮超时(毫秒)`:`Turn timeout (ms)`],[`maxToolFailuresPerTurn`,n?`最大工具失败次数`:`Maximum tool failures`]].map(([t,r])=>(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r,p.runtime?.[t]===void 0?(0,U.jsx)(q,{children:n?`继承`:`Inherited`}):null]}),(0,U.jsx)(`input`,{type:`number`,min:1,className:`${W} mt-1.5`,value:p.runtime?.[t]??``,placeholder:String(e.effective.runtime[t]??``),onChange:e=>{let n=Z({...p.runtime??{},[t]:K(e.target.value)});m({...p,runtime:n})}})]},t))}),(0,U.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`工作流`:`Workflows`}),(0,U.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`默认工作流`:`Default workflow`,(0,U.jsx)(`input`,{className:`${W} mt-1.5`,value:p.workflows?.default??``,placeholder:e.effective.workflows.default,onChange:e=>{let t=Z({...p.workflows??{},default:e.target.value||void 0});m({...p,workflows:t})}})]}),(0,U.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n?`允许的工作流`:`Allowed workflows`,(0,U.jsx)(`input`,{className:`${W} mt-1.5`,value:p.workflows?.allowed?.join(`, `)??``,placeholder:e.effective.workflows.allowed?.join(`, `),onChange:e=>{let t=G(e.target.value),n=Z({...p.workflows??{},allowed:t.length>0?t:void 0});m({...p,workflows:n})}})]})]})]}),(0,U.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`提示词缓存`:`Prompt cache`}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:p.runtime?.promptCache?n?`使用单独设置`:`Using agent override`:n?`继承全局`:`Inherited globally`})]}),p.runtime?.promptCache?(0,U.jsxs)(b,{variant:`ghost`,onClick:()=>{let e=Z({...p.runtime??{},promptCache:void 0});m({...p,runtime:e})},children:[(0,U.jsx)(E,{className:`size-4`}),n?`继承`:`Inherit`]}):null]}),p.runtime?.promptCache?(0,U.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,U.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,U.jsx)(`span`,{children:n?`模式`:`Mode`}),(0,U.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`auto`,`off`].map(e=>(0,U.jsx)(`button`,{type:`button`,onClick:()=>m({...p,runtime:{...p.runtime,promptCache:{...p.runtime.promptCache,mode:e}}}),className:c(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,p.runtime?.promptCache?.mode===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`auto`?r.editorCacheModeAuto:r.editorCacheModeOff},e))})]}),(0,U.jsxs)(`div`,{className:`text-xs font-medium text-fg-muted`,children:[(0,U.jsx)(`span`,{children:n?`缓存周期`:`Lifetime`}),(0,U.jsx)(`div`,{className:`mt-1.5 flex rounded-xl bg-surface-hover p-1`,children:[`short`,`long`].map(e=>(0,U.jsx)(`button`,{type:`button`,onClick:()=>m({...p,runtime:{...p.runtime,promptCache:{...p.runtime.promptCache,lifetime:e}}}),className:c(`flex-1 rounded-lg px-3 py-2 text-xs font-medium`,p.runtime?.promptCache?.lifetime===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted`),children:e===`short`?r.editorCacheLifetimeShort:r.editorCacheLifetimeLong},e))})]})]}):(0,U.jsx)(b,{className:`mt-4`,onClick:()=>m({...p,runtime:{...p.runtime,promptCache:{...e.effective.runtime.promptCache??{mode:`auto`,lifetime:`short`}}}}),children:n?`自定义缓存策略`:`Customize cache policy`})]})]}):null,d===`danger`?(0,U.jsxs)(`div`,{className:`space-y-6`,children:[(0,U.jsx)(J,{title:n?`危险区`:`Danger zone`,description:n?`这些操作会改变默认路由或移除智能体。`:`These actions change default routing or remove the agent.`}),e.isDefault?null:(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-edge bg-surface-base p-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold text-fg`,children:n?`设为默认智能体`:`Make default agent`}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`新会话和未指定路由将使用这个智能体。`:`New sessions and unspecified routes will use this agent.`})]}),(0,U.jsx)(b,{disabled:h,onClick:()=>void z(),children:n?`设为默认`:`Make default`})]}),e.isDefault?(0,U.jsx)(`p`,{className:`rounded-2xl bg-surface-base p-4 text-sm text-fg-muted`,children:n?`默认智能体不能删除,请先将其他智能体设为默认。`:`The default agent cannot be deleted. Make another agent the default first.`}):(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-2xl border border-red-500/25 bg-red-500/5 p-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h4`,{className:`text-sm font-semibold text-red-600`,children:n?`删除智能体`:`Delete agent`}),(0,U.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n?`配置条目会被移除,删除前仍会再次确认。`:`The configuration entry will be removed after confirmation.`})]}),(0,U.jsxs)(b,{variant:`ghost`,className:`text-red-600`,onClick:u,children:[(0,U.jsx)(M,{className:`size-4`}),n?`删除`:`Delete`]})]})]}):null]}),(0,U.jsxs)(`footer`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge bg-surface-panel px-5 py-3`,children:[(0,U.jsx)(`p`,{className:`text-xs text-fg-muted`,children:x?n?`请补全自定义模型`:`Complete the custom model reference`:y?n?`有未保存的更改`:`Unsaved changes`:n?`所有更改已保存`:`All changes saved`}),(0,U.jsxs)(`div`,{className:`flex gap-2`,children:[(0,U.jsx)(b,{onClick:o,children:n?`关闭`:`Close`}),(0,U.jsx)(b,{variant:`primary`,disabled:h||!y||x||p.profile!==void 0&&!p.profile.name.trim(),onClick:()=>void R(),children:h?n?`保存中…`:`Saving…`:n?`保存更改`:`Save changes`})]})]})]})]})}function $(e){let t=(0,V.c)(36),{agent:n,messages:r,open:i,onOpenChange:a,children:o}=e,[l,u]=(0,H.useState)(null),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,U.jsx)(f,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim`,C)}),t[0]=d):d=t[0];let y;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(y=c(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover`,S,`inset-3 h-[calc(100dvh-1.5rem)] min-h-0 sm:inset-auto sm:left-1/2 sm:top-1/2`,`sm:h-[min(88vh,48rem)] sm:w-[min(94vw,62rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=y):y=t[1];let b;t[2]!==n.avatar||t[3]!==n.id?(b=(0,U.jsx)(k,{agentId:n.id,avatar:n.avatar,size:42,className:`size-11 shrink-0`}),t[2]=n.avatar,t[3]=n.id,t[4]=b):b=t[4];let x;t[5]!==n||t[6]!==r?(x=P(n,r),t[5]=n,t[6]=r,t[7]=x):x=t[7];let T;t[8]===x?T=t[9]:(T=(0,U.jsx)(_,{className:`truncate text-base font-semibold text-fg`,children:x}),t[8]=x,t[9]=T);let E;t[10]===n.id?E=t[11]:(E=(0,U.jsx)(p,{className:`mt-0.5 truncate font-mono text-xs text-fg-muted`,children:n.id}),t[10]=n.id,t[11]=E);let D;t[12]!==T||t[13]!==E?(D=(0,U.jsxs)(`div`,{className:`min-w-0`,children:[T,E]}),t[12]=T,t[13]=E,t[14]=D):D=t[14];let O;t[15]!==n.isDefault||t[16]!==r.listDefaultBadge?(O=n.isDefault?(0,U.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent`,children:r.listDefaultBadge}):null,t[15]=n.isDefault,t[16]=r.listDefaultBadge,t[17]=O):O=t[17];let A;t[18]!==b||t[19]!==D||t[20]!==O?(A=(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[b,D,O]}),t[18]=b,t[19]=D,t[20]=O,t[21]=A):A=t[21];let j;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,U.jsx)(s,{className:`size-4`}),t[22]=j):j=t[22];let M;t[23]===r.closeDialogAria?M=t[24]:(M=(0,U.jsx)(m,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":r.closeDialogAria,children:j})}),t[23]=r.closeDialogAria,t[24]=M);let N;t[25]!==M||t[26]!==A?(N=(0,U.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-4 border-b border-edge px-5 py-4`,children:[A,M]}),t[25]=M,t[26]=A,t[27]=N):N=t[27];let F;t[28]!==o||t[29]!==l||t[30]!==N?(F=(0,U.jsxs)(h,{children:[d,(0,U.jsx)(g,{ref:u,className:y,onOpenAutoFocus:ne,children:(0,U.jsxs)(w,{layer:`modal`,portalContainer:l,children:[N,o]})})]}),t[28]=o,t[29]=l,t[30]=N,t[31]=F):F=t[31];let I;return t[32]!==a||t[33]!==i||t[34]!==F?(I=(0,U.jsx)(v,{open:i,onOpenChange:a,children:F}),t[32]=a,t[33]=i,t[34]=F,t[35]=I):I=t[35],I}function ne(e){return e.preventDefault()}function re(e){let t=(0,V.c)(13),{agents:n,busy:r,messages:i,onOpen:a,onChat:o}=e,s;if(t[0]!==n||t[1]!==r||t[2]!==i||t[3]!==o||t[4]!==a){let e;t[6]!==r||t[7]!==i||t[8]!==o||t[9]!==a?(e=e=>{let t=P(e,i),n=ee(e,i);return(0,U.jsx)(`li`,{className:`min-h-0`,children:(0,U.jsxs)(`article`,{className:c(`group relative flex min-h-52 flex-col rounded-2xl border border-edge bg-surface-panel p-4 shadow-surface`,`transition-[transform,background-color,border-color] duration-200 ease-out hover:-translate-y-0.5 hover:border-accent/30 hover:bg-surface-hover/35 active:scale-[0.99] motion-reduce:transform-none`),children:[(0,U.jsx)(`button`,{type:`button`,disabled:r,"aria-label":i.listConfigureAgent.replace(`{{name}}`,t),onClick:()=>a(e.id),className:`absolute inset-0 z-0 rounded-2xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),(0,U.jsxs)(`div`,{className:`pointer-events-none relative z-10 flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,U.jsx)(k,{agentId:e.id,avatar:e.avatar,size:48,className:`size-12 shrink-0`}),(0,U.jsx)(`div`,{className:`min-w-0`,children:(0,U.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t})})]}),(0,U.jsx)(`span`,{className:c(`rounded-full px-2 py-0.5 text-[11px] font-medium`,e.isDefault?`bg-accent-soft text-accent`:`bg-surface-hover text-fg-muted`),children:e.isDefault?i.listDefaultBadge:i.listCustomBadge})]}),(0,U.jsx)(`p`,{className:`pointer-events-none relative z-10 mt-5 line-clamp-2 min-h-10 text-sm leading-5 text-fg-muted`,children:n||e.override.profile?.instructions||i.listUsesGlobalSettings}),(0,U.jsxs)(`div`,{className:`pointer-events-none relative z-10 mt-4 rounded-xl bg-surface-base px-3 py-2.5`,children:[(0,U.jsx)(`p`,{className:`text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:i.listCurrentModelLabel}),(0,U.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg`,children:e.effective.models.chat.primary})]}),(0,U.jsx)(`div`,{className:`relative z-10 mt-auto pt-4`,children:(0,U.jsxs)(b,{className:`w-full`,disabled:r,onClick:t=>{t.stopPropagation(),o(e.id)},children:[(0,U.jsx)(A,{className:`size-4`}),i.listChatWithAgent]})})]})},e.id)},t[6]=r,t[7]=i,t[8]=o,t[9]=a,t[10]=e):e=t[10],s=n.map(e),t[0]=n,t[1]=r,t[2]=i,t[3]=o,t[4]=a,t[5]=s}else s=t[5];let l;return t[11]===s?l=t[12]:(l=(0,U.jsx)(`ul`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:s}),t[11]=s,t[12]=l),l}var ie=`w-full rounded-xl border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/15`;function ae(e){let t=(0,V.c)(59),{open:n,busy:r,error:i,name:a,instructions:o,zh:l,onNameChange:u,onInstructionsChange:d,onCreate:y,onOpenChange:x}=e,w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,U.jsx)(f,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim`,C)}),t[0]=w):w=t[0];let T;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(T=c(`xopc-dialog-content fixed left-1/2 top-1/2 w-[min(92vw,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover`,S),t[1]=T):T=t[1];let E=l?`新建智能体`:`Create agent`,D;t[2]===E?D=t[3]:(D=(0,U.jsx)(_,{className:`text-base font-semibold text-fg`,children:E}),t[2]=E,t[3]=D);let O=l?`只设置身份即可开始,所有能力自动继承全局配置。`:`Set its identity and start. Every capability inherits globally.`,k;t[4]===O?k=t[5]:(k=(0,U.jsx)(p,{className:`mt-1 text-sm text-fg-muted`,children:O}),t[4]=O,t[5]=k);let A;t[6]!==D||t[7]!==k?(A=(0,U.jsxs)(`div`,{children:[D,k]}),t[6]=D,t[7]=k,t[8]=A):A=t[8];let j;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,U.jsx)(m,{asChild:!0,children:(0,U.jsx)(`button`,{type:`button`,className:`rounded-lg p-2 text-fg-muted hover:bg-surface-hover`,"aria-label":`Close`,children:(0,U.jsx)(s,{className:`size-4`})})}),t[9]=j):j=t[9];let M;t[10]===A?M=t[11]:(M=(0,U.jsxs)(`header`,{className:`flex items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[A,j]}),t[10]=A,t[11]=M);let N;t[12]===i?N=t[13]:(N=i?(0,U.jsx)(`p`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:i}):null,t[12]=i,t[13]=N);let P=l?`名称`:`Name`,F=l?`智能体名称`:`Agent name`,I;t[14]===u?I=t[15]:(I=e=>u(e.target.value),t[14]=u,t[15]=I);let L=l?`例如:数据分析师`:`For example: Data analyst`,R;t[16]!==a||t[17]!==F||t[18]!==I||t[19]!==L?(R=(0,U.jsx)(`input`,{id:`create-agent-name`,"aria-label":F,className:`${ie} mt-1.5`,value:a,onChange:I,placeholder:L}),t[16]=a,t[17]=F,t[18]=I,t[19]=L,t[20]=R):R=t[20];let z;t[21]!==P||t[22]!==R?(z=(0,U.jsxs)(`label`,{htmlFor:`create-agent-name`,className:`block text-xs font-medium text-fg-muted`,children:[P,R]}),t[21]=P,t[22]=R,t[23]=z):z=t[23];let ee=l?`个性与工作方式(可选)`:`Personality and working style (optional)`,B=l?`个性与工作方式`:`Personality and working style`,H;t[24]===d?H=t[25]:(H=e=>d(e.target.value),t[24]=d,t[25]=H);let te=l?`描述角色、语气和偏好的工作方式`:`Describe its role, tone, and preferred way of working`,W;t[26]!==o||t[27]!==B||t[28]!==H||t[29]!==te?(W=(0,U.jsx)(`textarea`,{id:`create-agent-instructions`,"aria-label":B,rows:4,className:`${ie} mt-1.5 resize-none`,value:o,onChange:H,placeholder:te}),t[26]=o,t[27]=B,t[28]=H,t[29]=te,t[30]=W):W=t[30];let G;t[31]!==ee||t[32]!==W?(G=(0,U.jsxs)(`label`,{htmlFor:`create-agent-instructions`,className:`block text-xs font-medium text-fg-muted`,children:[ee,W]}),t[31]=ee,t[32]=W,t[33]=G):G=t[33];let K;t[34]!==N||t[35]!==z||t[36]!==G?(K=(0,U.jsxs)(`div`,{className:`space-y-4 p-5`,children:[N,z,G]}),t[34]=N,t[35]=z,t[36]=G,t[37]=K):K=t[37];let q=l?`取消`:`Cancel`,J;t[38]!==r||t[39]!==q?(J=(0,U.jsx)(m,{asChild:!0,children:(0,U.jsx)(b,{disabled:r,children:q})}),t[38]=r,t[39]=q,t[40]=J):J=t[40];let Y;t[41]!==r||t[42]!==a?(Y=r||!a.trim(),t[41]=r,t[42]=a,t[43]=Y):Y=t[43];let X=r?l?`创建中…`:`Creating…`:l?`创建智能体`:`Create agent`,Z;t[44]!==y||t[45]!==Y||t[46]!==X?(Z=(0,U.jsx)(b,{variant:`primary`,disabled:Y,onClick:y,children:X}),t[44]=y,t[45]=Y,t[46]=X,t[47]=Z):Z=t[47];let Q;t[48]!==J||t[49]!==Z?(Q=(0,U.jsxs)(`footer`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[J,Z]}),t[48]=J,t[49]=Z,t[50]=Q):Q=t[50];let $;t[51]!==K||t[52]!==Q||t[53]!==M?($=(0,U.jsxs)(h,{children:[w,(0,U.jsxs)(g,{className:T,children:[M,K,Q]})]}),t[51]=K,t[52]=Q,t[53]=M,t[54]=$):$=t[54];let ne;return t[55]!==x||t[56]!==n||t[57]!==$?(ne=(0,U.jsx)(v,{open:n,onOpenChange:x,children:$}),t[55]=x,t[56]=n,t[57]=$,t[58]=ne):ne=t[58],ne}function oe(){let e=(0,V.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,U.jsxs)(`div`,{className:`space-y-2`,children:[(0,U.jsx)(x,{className:`h-7 w-28`}),(0,U.jsx)(x,{className:`h-4 w-80 max-w-full`})]}),(0,U.jsx)(x,{className:`h-9 w-28`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,U.jsxs)(B,{gap:`gap-5`,children:[t,(0,U.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:[0,1,2].map(se)})]}),e[1]=n):n=e[1],n}function se(e){return(0,U.jsx)(x,{className:`h-64 rounded-2xl`},e)}function ce(){let e=l(e=>e.conversationId),t=u(e=>e.language),n=t===`zh`,r=d(t).agentsSettings,s=i(),{agentId:c}=a(),{data:f,error:p,isLoading:m,mutate:h}=y(e?`settings-gateway-agents`:null,L),g=R(e=>e.setPageHeader),_=R(e=>e.clearPageHeader),[v,x]=(0,H.useState)({open:!1,name:``,instructions:``}),[S,C]=(0,H.useState)(!1),[w,T]=(0,H.useState)(null),E=(0,H.useRef)(!1),D=f?.agents.find(e=>e.id===c),O=(0,H.useMemo)(()=>(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(b,{onClick:()=>s(`/settings/agent-defaults`),children:n?`全局默认配置`:`Global defaults`}),(0,U.jsxs)(b,{variant:`primary`,onClick:()=>{T(null),x(e=>({...e,open:!0}))},children:[(0,U.jsx)(o,{className:`size-4`}),n?`新建智能体`:`New agent`]})]}),[s,n]);(0,H.useLayoutEffect)(()=>(g({startExtra:null,main:(0,U.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n?`智能体`:`Agents`}),end:O}),()=>_()),[_,O,g,n]);let k=async()=>{C(!0),T(null);try{let e=await F({profile:{name:v.name.trim(),...v.instructions.trim()?{instructions:v.instructions.trim()}:{}}});x({open:!1,name:``,instructions:``}),s(`/agents/${e.createdAgentId}`)}catch(e){T(e instanceof Error?e.message:String(e))}finally{C(!1)}},A=async e=>{let t=P(e,r);if(window.confirm(n?`删除 ${t}?此操作无法撤销。`:`Delete ${t}? This cannot be undone.`)){C(!0),T(null);try{await z(e.id),s(`/agents`)}catch(e){T(e instanceof Error?e.message:String(e))}finally{C(!1)}}},M=e=>{j(e),s(`/chat/new`)},N=e=>{E.current=!1,window.setTimeout(()=>s(`/agents/${e}`),0)},I=()=>{E.current&&!window.confirm(n?`放弃未保存的更改?`:`Discard unsaved changes?`)||(E.current=!1,s(`/agents`))},ee=()=>{E.current&&!window.confirm(n?`放弃未保存的更改?`:`Discard unsaved changes?`)||(E.current=!1,s(`/settings/agent-defaults`))},V=(0,H.useCallback)(e=>{E.current=e},[]);return e?p&&!f?(0,U.jsxs)(B,{children:[(0,U.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:String(p)}),(0,U.jsx)(b,{onClick:()=>void h(),children:n?`重试`:`Retry`})]}):m||!f?(0,U.jsx)(oe,{}):(0,U.jsxs)(B,{gap:`gap-5`,className:`max-w-6xl`,padding:`px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(p||w)&&!D?(0,U.jsx)(`p`,{className:`rounded-xl bg-red-500/10 px-3 py-2 text-sm text-red-600`,children:w??String(p)}):null,(0,U.jsx)(re,{agents:f.agents,busy:S,messages:r,onOpen:N,onChat:M}),D?(0,U.jsx)($,{agent:D,messages:r,open:!0,onOpenChange:e=>{e||I()},children:(0,U.jsx)(Q,{agent:D,toolIds:f.builtinToolIds,zh:n,messages:r,externalError:w,onDirtyChange:V,onClose:I,onOpenDefaults:ee,onChat:()=>M(D.id),onDelete:()=>void A(D)},D.id)}):null,(0,U.jsx)(ae,{open:v.open,busy:S,error:w,name:v.name,instructions:v.instructions,zh:n,onNameChange:e=>x(t=>({...t,name:e})),onInstructionsChange:e=>x(t=>({...t,instructions:e})),onCreate:()=>void k(),onOpenChange:e=>{S||(x(t=>({...t,open:e})),e||T(null))}})]}):(0,U.jsx)(B,{children:(0,U.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n?`需要本机服务令牌。`:`Local service token required.`})})}export{ce as AgentsSettingsPanel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,r as t}from"./locale-store-D0001I7p.js";var n=n=>e(t(n)),r=(n,r,i)=>e(t(n),{method:r,headers:{"content-type":`application/json`},body:JSON.stringify(i)});export{r as n,n as t};
|
|
@@ -1,6 +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{h as i,t as a}from"./chunk-KS7C4IRE-Cq1tE_3b.js";import{n as o,r as s}from"./popover-select-DldSX8GX.js";import{t as c}from"./circle-check-C23XjkUj.js";import{t as l}from"./markdown-view-2txE_Blz.js";import{t as u}from"./git-branch-Dh9uxTot.js";import{t as d}from"./message-circle-Badhj-4D.js";import{t as f}from"./plus-Q2yW6OE7.js";import{t as p}from"./x-B_N4OPjy.js";import{t as m}from"./cn-JdwAhgNB.js";import{n as h}from"./locale-store-D0001I7p.js";import{t as g}from"./messages-BWANv-N-.js";import{a as _,n as v,o as y,r as b,s as ee,t as x}from"./dist-BGTk37IG.js";import{i as S}from"./vendor-swr-BIWyz7Rc.js";import{t as C}from"./button-CGlRPNzi.js";import{t as w}from"./skeleton-BwbyijEw.js";import{An as T,Bs as te,Dc as ne,Dn as re,En as ie,Fa as E,Fc as D,Hu as ae,On as O,Sc as k,Su as oe,Tn as A,Vc as j,Yi as M,Yl as N,Zs as se,_u as ce,bu as P,ca as le,dc as ue,dn as de,gc as F,l as I,mo as L,ol as R,vu as z,y as B,zc as fe}from"./index-fVtuw2o9.js";import{a as V,i as H,o as U,r as W}from"./cron-expression-GDPX4NxC.js";import{a as G,i as pe,n as me,r as he,t as ge}from"./workflow-run-setup-panel-Ds2SZjLG.js";import{i as _e,n as ve,r as ye,t as K}from"./browser-automation-inputs-CyHGQwxQ.js";var q=e(t(),1),be=n(),xe=V();function J(e,t,n){let r=new Date;return r.setHours(e,t,0,0),r.toLocaleTimeString(n,{hour:`numeric`,minute:`2-digit`})}function Se(e,t){let n=e===7?0:e;return new Date(Date.UTC(2023,0,1)+n*864e5).toLocaleDateString(t,{weekday:`short`,timeZone:`UTC`})}function Ce(e,t){return e.length<=1?e[0]??``:t.startsWith(`zh`)?e.join(`、`):e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(`, `)}, and ${e.at(-1)}`}function we(e){return e.length===5&&e.every((e,t)=>e===t+1)}function Te(e){if(e.length!==2)return!1;let t=[...e].toSorted((e,t)=>e-t);return t[0]===0&&t[1]===6}function Ee(e,t,n,r){try{let i=xe.CronExpressionParser.parse(e,{...r?.timezone?{tz:r.timezone}:{}}).fields,a=W(i.minute.values),o=W(i.hour.values),s=W(i.dayOfWeek.values),c=W(i.dayOfMonth.values);if(a.length===60&&i.hour.isWildcard&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard)return n.everyMinute;if(!i.minute.isWildcard&&i.hour.isWildcard&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard&&a.length>1){let e=H(a);if(e!=null&&e>0)return n.everyNMinutes.replace(`{{n}}`,String(e))}if(!i.minute.isWildcard&&a.length===1&&!i.hour.isWildcard&&o.length>1&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard){let e=H(o);if(e!=null&&e>0)return n.everyNHours.replace(`{{n}}`,String(e))}if(!i.minute.isWildcard&&a.length===1&&i.hour.isWildcard&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard&&o.length===24)return n.hourly;let l=!i.minute.isWildcard&&a.length===1&&!i.hour.isWildcard&&o.length===1?J(o[0],a[0],t):``;if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&i.dayOfWeek.isWildcard)return n.dailyAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&we(s))return n.weekdaysAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&Te(s))return n.weekendsAt.replace(`{{time}}`,l);if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&s.length===1){let e=Se(s[0],t);return n.weeklyOn.replace(`{{day}}`,e).replace(`{{time}}`,l)}if(l&&i.dayOfMonth.isWildcard&&i.month.isWildcard&&!i.dayOfWeek.isWildcard&&s.length>1){let e=Ce(s.map(e=>Se(e,t)),t);return n.daysAt.replace(`{{days}}`,e).replace(`{{time}}`,l)}return l&&!i.dayOfMonth.isWildcard&&c.length===1&&i.month.isWildcard&&i.dayOfWeek.isWildcard?n.monthlyAt.replace(`{{day}}`,String(c[0])).replace(`{{time}}`,l):n.customSchedule}catch{return null}}function De(e,t,n,r){let i=e.trim();return i?Ee(i,t,n,r)||Oe(r?.nextRun,t)||n.customSchedule:Oe(r?.nextRun,t)||`—`}function Oe(e,t){if(!e)return``;let n=new Date(e);return Number.isNaN(n.getTime())?``:n.toLocaleString(t,{weekday:`short`,hour:`numeric`,minute:`2-digit`})}var ke=1e3,Y=60*ke,X=60*Y,Ae=24*X,je=7*Ae,Me=new Intl.ListFormat(`en-US`,{type:`conjunction`}),Ne=Object.fromEntries([`second`,`minute`,`hour`,`day`,`week`].map(e=>[e,new Intl.NumberFormat(`en-US`,{style:`unit`,unit:e,unitDisplay:`long`})])),Pe={en:new Intl.DateTimeFormat(`en-US`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}),zh:new Intl.DateTimeFormat(`zh-CN`,{month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`})},Fe={en:new Intl.DateTimeFormat(`en-US`,{hour:`2-digit`,minute:`2-digit`}),zh:new Intl.DateTimeFormat(`zh-CN`,{hour:`2-digit`,minute:`2-digit`})},Ie={minute:Y,hour:X,day:Ae,week:je};function Le(e){return e===`zh`?`zh-CN`:`en-US`}function Re(e,t,n){return n===`zh`?`${e} ${t===`week`?`周`:t===`day`?`天`:t===`hour`?`小时`:t===`minute`?`分钟`:`秒`}`:Ne[String(t)].format(e)}function ze(e,t){return t===`zh`?e.join(` `):Me.format(e)}function Be(e,t){let n=typeof e==`number`?e:Number.parseFloat(e);return Math.max(Y,Math.round((Number.isFinite(n)&&n>0?n:1)*Ie[t]))}function Ve(e,t,n){let r=typeof e==`number`?e:Number.parseFloat(e),i=Number.isFinite(r)&&r>0?r:1;return String(Number.parseFloat((i*Ie[t]/Ie[n]).toFixed(6)))}function He(e,t){let n=Math.max(ke,Math.round(e)),r=n===Ae?[{unit:`hour`,ms:X}]:n>=je&&n%je===0?[{unit:`week`,ms:je}]:n>=Ae?[{unit:`day`,ms:Ae},{unit:`hour`,ms:X},{unit:`minute`,ms:Y},{unit:`second`,ms:ke}]:n>=X?[{unit:`hour`,ms:X},{unit:`minute`,ms:Y},{unit:`second`,ms:ke}]:n>=Y?[{unit:`minute`,ms:Y},{unit:`second`,ms:ke}]:[{unit:`second`,ms:ke}],i=n,a=[];for(let{unit:e,ms:n}of r){let r=Math.floor(i/n);r<=0||(a.push(Re(r,e,t)),i%=n)}return ze(a,t)}function Ue(e,t){let n=He(e,t);return t===`zh`?`每 ${n}运行一次`:`Runs every ${n}`}function We(e,t){return Pe[t].format(new Date(e))}function Ge(e){return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())}function Ke(e,t,n=Date.now()){let r=new Date(e),i=Math.round((Ge(r)-Ge(new Date(n)))/Ae),a=Fe[t].format(r);return i===0?t===`zh`?`今天 ${a}`:`today at ${a}`:i===1?t===`zh`?`明天 ${a}`:`tomorrow at ${a}`:i===-1?t===`zh`?`昨天 ${a}`:`yesterday at ${a}`:We(e,t)}function qe(e,t){return e.eventType===`task.attention_required.v2`&&e.payloadMatch?.reason===`blocked`?t.trigger.taskBlockedWhen:e.eventType===`note.created`?t.trigger.noteCreatedWhen:e.eventType===`workflow.run.completed`&&e.payloadMatch?.status===`failed`?t.trigger.workflowFailedWhen:e.eventType===`session.transcript.updated`?t.trigger.sessionUpdatedWhen:t.trigger.eventWithType.replace(`{type}`,e.eventType)}function Je(e,t,n,r){if(e.kind===`manual`)return t.trigger.manualWhen;if(e.kind===`webhook`)return t.trigger.webhookWhen;if(e.kind===`event`)return qe(e,t);let i=e.schedule;return i.kind===`once`?t.trigger.onceAt.replace(`{time}`,Ke(Date.parse(i.at),r)):i.kind===`interval`?Ue(i.everyMs,r):De(i.expr,Le(r),n.scheduleBadge,{timezone:i.tz})}function Ye(e,t,n,r=Date.now()){return e.enabled?e.state.nextRunAtMs?Ke(e.state.nextRunAtMs,n,r):e.trigger.kind===`manual`?t.info.noAutomaticTrigger:e.trigger.kind===`event`||e.trigger.kind===`webhook`?t.info.waitingForTrigger:t.info.noUpcomingRun:t.info.pausedNoAutomaticRuns}function Xe(e,t,n,r=Date.now()){if(!e.state.lastRunAtMs)return t.info.notRunYet;let i=Ke(e.state.lastRunAtMs,n,r),a=e.state.lastRunStatus;return a?`${i} · ${t.status[a]}`:i}var Ze={name:``,description:``,projectId:``,triggerMode:`daily`,time:`09:00`,weekday:`1`,intervalValue:`1`,intervalUnit:`hour`,cronExpr:`0 9 * * *`,webhookSecretId:``,onceAt:``,eventType:``,eventSource:``,eventPayloadMatch:``,actionMode:`agent`,agentId:``,instruction:``,workflowId:``,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0,browserAutomationId:``,browserAutomationInputs:{},safetyMode:`suggest_only`,timeoutSeconds:`1800`,conversationMode:`new_session`,notificationPolicy:`attention`,completionWebhookUrl:``,disableAfterFailures:`3`},Qe=[{value:`15`,unit:`minute`},{value:`30`,unit:`minute`},{value:`1`,unit:`hour`},{value:`6`,unit:`hour`},{value:`24`,unit:`hour`}];function $e(e,t){let[n,r]=e.time.split(`:`),i=Number.parseInt(n||`9`,10),a=Number.parseInt(r||`0`,10),o;if(e.triggerMode===`manual`)o={kind:`manual`};else if(e.triggerMode===`once`)o={kind:`schedule`,schedule:{kind:`once`,at:new Date(e.onceAt).toISOString()}};else if(e.triggerMode===`webhook`)o={kind:`webhook`,...e.webhookSecretId.trim()?{secretId:e.webhookSecretId.trim()}:{}};else if(e.triggerMode===`taskBlocked`)o={kind:`event`,eventType:`task.attention_required.v2`,source:`tasks`,payloadMatch:{reason:`blocked`}};else if(e.triggerMode===`noteCreated`)o={kind:`event`,eventType:`note.created`,source:`notes`};else if(e.triggerMode===`workflowFailed`)o={kind:`event`,eventType:`workflow.run.completed`,source:`workflows`,payloadMatch:{status:`failed`}};else if(e.triggerMode===`sessionUpdated`)o={kind:`event`,eventType:`session.transcript.updated`,source:`sessions`};else if(e.triggerMode===`event`){let t=e.eventPayloadMatch.trim()?JSON.parse(e.eventPayloadMatch):void 0;o={kind:`event`,eventType:e.eventType.trim(),...e.eventSource.trim()?{source:e.eventSource.trim()}:{},...t?{payloadMatch:t}:{}}}else o=e.triggerMode===`interval`?{kind:`schedule`,schedule:{kind:`interval`,everyMs:Be(e.intervalValue,e.intervalUnit)}}:e.triggerMode===`weekly`?{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * ${e.weekday}`}}:e.triggerMode===`cron`?{kind:`schedule`,schedule:{kind:`cron`,expr:e.cronExpr.trim()}}:{kind:`schedule`,schedule:{kind:`cron`,expr:`${a} ${i} * * *`}};let s=he(t,e.workflowInput),c=e.workflowInput.goal.trim()||e.workflowGoal.trim(),l=e.actionMode===`browser_automation`?`auto_apply`:e.safetyMode,u;return u=e.actionMode===`workflow`?{kind:`workflow`,workflowId:e.workflowId.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{},...s===void 0?{}:{input:s},...c?{goal:c}:{},...e.workflowInput.concurrency.trim()?{concurrency:Math.max(1,Number.parseInt(e.workflowInput.concurrency,10)||1)}:{},...e.workflowInput.maxSubagents.trim()?{maxSubagents:Math.max(1,Number.parseInt(e.workflowInput.maxSubagents,10)||1)}:{}}:e.actionMode===`browser_automation`?{kind:`browser_automation`,automationId:e.browserAutomationId.trim(),inputs:e.browserAutomationInputs}:{kind:`agent`,instruction:e.instruction.trim(),...e.agentId.trim()?{agentId:e.agentId.trim()}:{}},{name:e.name.trim(),...e.description.trim()?{description:e.description.trim()}:{},...e.projectId.trim()?{projectId:e.projectId.trim()}:{},trigger:o,action:u,safety:{mode:l},conversationMode:e.conversationMode,notificationPolicy:e.notificationPolicy,...l===`auto_apply`&&e.completionWebhookUrl.trim()?{completionWebhookUrl:e.completionWebhookUrl.trim()}:{},reliability:{executionTimeoutSeconds:Math.max(1,Number.parseInt(e.timeoutSeconds,10)||1800),disableAfterConsecutiveFailures:Math.max(1,Number.parseInt(e.disableAfterFailures,10)||3)}}}function et(e){let t=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+\*$/);if(t)return{triggerMode:`daily`,time:`${t[2].padStart(2,`0`)}:${t[1].padStart(2,`0`)}`,weekday:`1`,cronExpr:e};let n=e.match(/^(\d{1,2})\s+(\d{1,2})\s+\*\s+\*\s+([0-6])$/);return n?{triggerMode:`weekly`,time:`${n[2].padStart(2,`0`)}:${n[1].padStart(2,`0`)}`,weekday:n[3],cronExpr:e}:{triggerMode:`cron`,time:Ze.time,weekday:Ze.weekday,cronExpr:e}}function tt(e){let t=[[`week`,10080*6e4],[`day`,1440*6e4],[`hour`,60*6e4],[`minute`,6e4]],[n,r]=t.find(([,t])=>e>=t&&e%t===0)??t.at(-1);return{intervalValue:String(e/r),intervalUnit:n}}function nt(e){let t=new Date(e);if(Number.isNaN(t.getTime()))return e;let n=t.getTimezoneOffset()*6e4;return new Date(t.getTime()-n).toISOString().slice(0,16)}function rt(e){let t=e.payloadMatch;return e.eventType===`task.attention_required.v2`&&e.source===`tasks`&&t?.reason===`blocked`?{triggerMode:`taskBlocked`}:e.eventType===`note.created`&&e.source===`notes`&&!t?{triggerMode:`noteCreated`}:e.eventType===`workflow.run.completed`&&e.source===`workflows`&&t?.status===`failed`?{triggerMode:`workflowFailed`}:e.eventType===`session.transcript.updated`&&e.source===`sessions`&&!t?{triggerMode:`sessionUpdated`}:{triggerMode:`event`,eventType:e.eventType,eventSource:e.source??``,eventPayloadMatch:t?JSON.stringify(t,null,2):``}}function it(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:{}}function at(e){if(!e.trim())return!0;try{let t=JSON.parse(e);return!!t&&typeof t==`object`&&!Array.isArray(t)&&Object.values(t).every(e=>e===null||[`string`,`number`,`boolean`].includes(typeof e))}catch{return!1}}function ot(e,t=[]){let n={triggerMode:`manual`};if(e.trigger.kind===`webhook`)n={triggerMode:`webhook`,webhookSecretId:e.trigger.secretId??``};else if(e.trigger.kind===`event`)n=rt(e.trigger);else if(e.trigger.kind===`schedule`){let t=e.trigger.schedule;t.kind===`cron`&&(n=et(t.expr)),t.kind===`interval`&&(n={triggerMode:`interval`,...tt(t.everyMs)}),t.kind===`once`&&(n={triggerMode:`once`,onceAt:nt(t.at)})}let r=e.action,i=r.kind===`workflow`?t.find(e=>e.id===r.workflowId)??null:null,a=r.kind===`workflow`?it(r.input):{},o=e.reliability?.executionTimeoutSeconds??r.timeoutSeconds??e.reliability?.timeoutSeconds??(r.kind===`browser_automation`?600:1800);return{...Ze,...n,name:e.name,description:e.description??``,projectId:e.projectId??``,actionMode:r.kind,agentId:r.kind===`browser_automation`?``:r.agentId??``,instruction:r.kind===`agent`?r.instruction:``,workflowId:r.kind===`workflow`?r.workflowId:``,workflowGoal:r.kind===`workflow`?r.goal??``:``,browserAutomationId:r.kind===`browser_automation`?r.automationId:``,browserAutomationInputs:r.kind===`browser_automation`?r.inputs??{}:{},workflowInput:{goal:r.kind===`workflow`?r.goal??``:``,argValues:i?me(i.name,a):{},schemaInput:a,concurrency:r.kind===`workflow`&&r.concurrency?String(r.concurrency):``,maxSubagents:r.kind===`workflow`&&r.maxSubagents?String(r.maxSubagents):``},workflowInputValid:!0,safetyMode:e.safety?.mode??`auto_apply`,timeoutSeconds:String(o),conversationMode:e.conversationMode??`new_session`,notificationPolicy:e.notificationPolicy??`attention`,completionWebhookUrl:e.completionWebhookUrl??``,disableAfterFailures:String(e.reliability?.disableAfterConsecutiveFailures??3)}}function st(e,t,n){let r=$e(t,n),i=e.trigger.kind===`schedule`&&r.trigger.kind===`schedule`&&e.trigger.schedule.kind===r.trigger.schedule.kind?{...r.trigger,schedule:{...e.trigger.schedule,...r.trigger.schedule}}:r.trigger,a=r.action;return e.action.kind===`agent`&&r.action.kind===`agent`?a={...e.action,...r.action,agentId:r.action.agentId}:e.action.kind===`workflow`&&r.action.kind===`workflow`?a={...e.action,...r.action,agentId:r.action.agentId,input:r.action.input,goal:r.action.goal,concurrency:r.action.concurrency,maxSubagents:r.action.maxSubagents}:e.action.kind===`browser_automation`&&r.action.kind===`browser_automation`&&(a={...e.action,...r.action}),{...r,description:t.description.trim(),projectId:t.projectId.trim(),completionWebhookUrl:t.completionWebhookUrl.trim(),trigger:i,action:a,reliability:{...e.reliability,...r.reliability}}}var Z=r();function ct(e,t,n){return e?We(e,n):t.never}function lt(e,t){return e.kind===`workflow`?t.action.workflowWithId.replace(`{id}`,e.workflowId):e.kind===`browser_automation`?`Browser automation: ${e.automationId}`:e.agentId?t.action.agentWithId.replace(`{id}`,e.agentId):t.action.agent}function ut(e){return e.safety?.mode??`auto_apply`}function dt(e){return e===`succeeded`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`failed`||e===`timeout`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`running`||e===`queued`||e===`cancelling`?`bg-blue-500/10 text-blue-700 dark:text-blue-300`:`bg-surface-hover text-fg-muted`}function ft(e,t){if(e==null)return t.never;if(e<1e3)return`${e}ms`;let n=Math.round(e/1e3);return n<60?`${n}s`:`${Math.floor(n/60)}m ${n%60}s`}function pt(e){return e.status===`running`||e.status===`queued`||e.status===`cancelling`}function mt(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}function ht(e,t){if((e.state.consecutiveFailures??0)>0)return!0;let n=t.reduce((t,n)=>n.automationId===e.id&&(!t||n.createdAtMs>t.createdAtMs)?n:t,void 0);return n?mt(n):!1}function gt(e,t){return e.action.kind===`agent`?e.action.instruction:e.action.kind===`workflow`&&e.action.goal?.trim()||lt(e.action,t)}function _t(e){return(e.description?.match(/\[managed-by=([^\]]+)\]/))?.[1]?.trim()||null}function vt(e){return!!_t(e)}function yt(e){return e.description?.replace(/\s*\[managed-by=[^\]]+\]\s*/g,` `).trim()??``}function bt(e){return pt(e)?0:mt(e)?1:e.status===`succeeded`?2:3}function xt(e){return[...e].sort((e,t)=>{let n=bt(e)-bt(t);return n===0?t.createdAtMs-e.createdAtMs:n})}function St(){let e=(0,be.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,Z.jsx)(w,{className:`h-4 w-36`}),(0,Z.jsx)(w,{className:`h-3 w-56 max-w-full`})]}),(0,Z.jsx)(w,{className:`h-7 w-20 rounded-full`})]}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsxs)(`section`,{className:`rounded-xl bg-surface-panel p-4 shadow-surface`,children:[t,(0,Z.jsx)(`div`,{className:`mt-4 grid gap-2`,children:Array.from({length:6}).map(Ct)})]}),e[1]=n):n=e[1];let r,i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(w,{className:`h-4 w-32`}),i=(0,Z.jsx)(w,{className:`mt-4 h-24 rounded-lg`}),e[2]=r,e[3]=i):(r=e[2],i=e[3]);let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(`div`,{className:`grid gap-4`,"aria-hidden":`true`,children:(0,Z.jsxs)(`div`,{className:`grid gap-3 xl:grid-cols-[minmax(0,1fr)_26rem]`,children:[n,(0,Z.jsxs)(`section`,{className:`hidden rounded-xl bg-surface-panel p-4 shadow-surface xl:block`,children:[r,i,(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-2`,children:[(0,Z.jsx)(w,{className:`h-12 rounded-lg`}),(0,Z.jsx)(w,{className:`h-12 rounded-lg`}),(0,Z.jsx)(w,{className:`h-12 rounded-lg`})]})]})]})}),e[4]=a):a=e[4],a}function Ct(e,t){return(0,Z.jsx)(`div`,{className:`rounded-lg bg-surface-base p-3`,children:(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(w,{className:`size-4 rounded-full`}),(0,Z.jsx)(w,{className:`h-4 w-32`}),(0,Z.jsx)(w,{className:`h-5 w-20 rounded-full`})]}),(0,Z.jsx)(w,{className:`mt-3 h-4 w-full`}),(0,Z.jsx)(w,{className:`mt-2 h-4 w-3/5`})]}),(0,Z.jsx)(w,{className:`h-8 w-24 rounded-md`})]})},t)}function wt({projectId:e,embedded:t=!1,title:n,subtitle:r}){let a=h(e=>e.language),c=g(a),l=c.automations,u=c.cron,d=L(e=>e.setPageHeader),w=L(e=>e.clearPageHeader),[ne,D]=i(),ae=ne.get(`run`)?.trim()??``,oe=ne.get(`automation`)?.trim()??``,j=ne.get(`draft`)?.trim()??``,se=ne.get(`action`)?.trim()??``,ce=ne.get(`projectId`)?.trim()??``,P=e?.trim()||ce,ue=!!e?.trim(),de=ne.get(`autogenerate`)===`1`,F=(0,q.useRef)(``),[R,z]=(0,q.useState)(`all`),[fe,V]=(0,q.useState)(``),[H,U]=(0,q.useState)(!1),[W,G]=(0,q.useState)(`blank`),[me,he]=(0,q.useState)(null),[ge,ye]=(0,q.useState)(!1),[K,be]=(0,q.useState)(Ze),[xe,J]=(0,q.useState)(null),[Se,Ce]=(0,q.useState)(null),[we,Te]=(0,q.useState)(!1),[Ee,De]=(0,q.useState)(null),[Oe,ke]=(0,q.useState)(``),[Y,X]=(0,q.useState)(null),[Ae,je]=(0,q.useState)(!1),[Me,Ne]=(0,q.useState)(!1),[Pe,Fe]=(0,q.useState)(P),[Ie,Le]=(0,q.useState)(`new_session`),[Re,ze]=(0,q.useState)(`attention`),[Be,Ve]=(0,q.useState)(null),[He,Ue]=(0,q.useState)(!1),[We,Ge]=(0,q.useState)(!1),[Ke,qe]=(0,q.useState)(!1),[Ye,Xe]=(0,q.useState)(null),Qe=S([`automations`,P],()=>I.list(P?{projectId:P}:void 0),{refreshInterval:15e3}),et=S([`automation-runs`,P],()=>I.runs(50,void 0,P?{projectId:P}:void 0),{refreshInterval:1e4}),tt=S(Se?`automation-run-events:${Se}`:null,()=>I.runEvents(Se),{refreshInterval:5e3}),nt=S(`automation-workflow-definitions`,B),rt=S(`automation-browser-automations`,()=>_e.list()),it=S(`automation-chat-agents`,le),ct=S(`automation-projects`,()=>E({sortBy:`name`,sortOrder:`asc`,limit:200})),lt=Qe.isLoading&&!Qe.data||et.isLoading&&!et.data,ut=Qe.data?.automations??[],dt=(0,q.useMemo)(()=>xt(et.data?.runs??[]),[et.data?.runs]),ft=(0,q.useMemo)(()=>ut.filter(e=>!vt(e)),[ut]),mt=(0,q.useMemo)(()=>ut.filter(vt),[ut]),ht=(0,q.useMemo)(()=>new Set(mt.map(e=>e.id)),[mt]),_t=(0,q.useMemo)(()=>dt.filter(e=>!ht.has(e.automationId)),[dt,ht]),bt=(0,q.useMemo)(()=>dt.find(e=>e.id===Se)??null,[dt,Se]),Ct=(0,q.useMemo)(()=>ut.find(e=>e.id===Ee)??null,[ut,Ee]),wt=(0,q.useMemo)(()=>ut.find(e=>e.id===me)??null,[ut,me]),Et=(0,q.useMemo)(()=>dt.filter(e=>e.automationId===Ee).sort((e,t)=>t.createdAtMs-e.createdAtMs),[dt,Ee]),Dt=tt.data?.events??[],Ot=(0,q.useMemo)(()=>_t.filter(e=>!pt(e)&&e.readAtMs==null),[_t]),At=fe.trim().toLocaleLowerCase(),jt=(0,q.useMemo)(()=>(R===`system`?mt:ft).filter(e=>R===`active`&&!e.enabled||R===`paused`&&e.enabled?!1:At?[e.name,yt(e),gt(e,l),Je(e.trigger,l,u,a)].some(e=>e.toLocaleLowerCase().includes(At)):!0),[u,R,l,a,At,mt,ft,_t]),Mt=(0,q.useMemo)(()=>nt.data??[],[nt.data]),Nt=(0,q.useMemo)(()=>(rt.data?.automations??[]).filter(e=>e.enabled),[rt.data]),It=it.data?.items??[],Lt=ct.data?.items??[],Rt=(0,q.useMemo)(()=>Mt.find(e=>e.id===K.workflowId.trim())??null,[K.workflowId,Mt]),zt=(0,q.useMemo)(()=>Nt.find(e=>e.id===K.browserAutomationId.trim())??null,[Nt,K.browserAutomationId]),Bt=K.actionMode===`workflow`&&(!K.workflowId.trim()||Mt.length>0&&!Mt.some(e=>e.id===K.workflowId)),Vt=K.actionMode===`workflow`&&Rt?!pe(Rt,K.workflowInput,K.workflowInputValid).valid:!1,Ht=!!K.name.trim()&&(K.triggerMode!==`once`||Number.isFinite(new Date(K.onceAt).getTime()))&&(K.triggerMode!==`event`||!!K.eventType.trim()&&at(K.eventPayloadMatch))&&(K.actionMode===`workflow`?!Bt&&!Vt:K.actionMode===`browser_automation`?zt!==null&&ve(zt,K.browserAutomationInputs):!!K.instruction.trim()),Gt=(0,q.useMemo)(()=>[{name:l.templates.dailyAgent.name,description:l.templates.dailyAgent.description,form:{...Ze,name:l.templates.dailyAgent.name,instruction:l.templates.dailyAgent.instruction,triggerMode:`daily`}},{name:l.templates.morningWorkflow.name,description:l.templates.morningWorkflow.description,form:{...Ze,name:l.templates.morningWorkflow.formName,actionMode:`workflow`,workflowId:Mt[0]?.id??``}},{name:l.templates.webhookAgent.name,description:l.templates.webhookAgent.description,form:{...Ze,name:l.templates.webhookAgent.formName,triggerMode:`webhook`}},{name:l.templates.blockedTask.name,description:l.templates.blockedTask.description,form:{...Ze,name:l.templates.blockedTask.formName,triggerMode:`taskBlocked`,instruction:l.templates.blockedTask.instruction}},{name:l.templates.noteCreated.name,description:l.templates.noteCreated.description,form:{...Ze,name:l.templates.noteCreated.formName,triggerMode:`noteCreated`,instruction:l.templates.noteCreated.instruction}}],[l,Mt]);(0,q.useEffect)(()=>{if(jt.length===0){De(null);return}Ee&&jt.some(e=>e.id===Ee)||De(jt[0].id)},[jt,Ee]);let Kt=(0,q.useCallback)(async()=>{await Promise.all([Qe.mutate(),et.mutate(),tt.mutate()])},[Qe.mutate,tt.mutate,et.mutate]),qt=(0,q.useCallback)(e=>{if(ue){De(null),Ce(null);return}D(t=>{let n=new URLSearchParams(t);return e?n.set(`projectId`,e):n.delete(`projectId`),n.delete(`automation`),n.delete(`run`),n}),De(null),Ce(null)},[ue,D]);(0,q.useEffect)(()=>{ue&&(Fe(P),be(e=>e.projectId===P?e:{...e,projectId:P}))},[P,ue]);let $=(0,q.useCallback)(e=>{if(he(null),ye(!1),G(e),U(!0),e===`blank`){be({...Ze,projectId:P});return}ke(``),X(null),Ne(!1),Fe(P),Le(`new_session`),ze(`attention`)},[P]),Jt=(0,q.useCallback)(e=>{be(ot(e,Mt)),he(e.id),ye(!1),De(null),G(`blank`),U(!0)},[Mt]),Yt=(0,q.useCallback)(()=>{Y&&(be({...ot(Y.automation,Mt),projectId:Pe,conversationMode:Ie,notificationPolicy:Re}),he(null),ye(!0),G(`blank`))},[Y,Ie,Re,Pe,Mt]),Xt=(0,q.useCallback)(async()=>{qe(!0),J(null);try{await Kt()}catch(e){J(e instanceof Error?e.message:String(e))}finally{qe(!1)}},[l.feedback.actionFailed,Kt]);(0,q.useEffect)(()=>{if(!oe)return;let e=ut.find(e=>e.id===oe);e&&(z(vt(e)?`system`:`all`),De(e.id),D(e=>{let t=new URLSearchParams(e);return t.delete(`automation`),t},{replace:!0}))},[oe,ut,D]),(0,q.useEffect)(()=>{se===`create`&&($(`blank`),D(e=>{let t=new URLSearchParams(e);return t.delete(`action`),t},{replace:!0}))},[se,$,D]),(0,q.useEffect)(()=>{if(!j)return;let e=`${a}:${de?`auto`:`seed`}:${j}`;F.current!==e&&(F.current=e,ke(j),X(null),Ne(!1),Fe(P),G(`draft`),U(!0),D(e=>{let t=new URLSearchParams(e);return t.delete(`draft`),t.delete(`autogenerate`),t},{replace:!0}),de&&(J(null),je(!0),I.draft({prompt:j,language:a}).then(e=>{X(e.draft),Ne(!1)}).catch(e=>{J(e instanceof Error?e.message:String(e))}).finally(()=>{je(!1)})))},[de,j,a,P,D]);let Zt=(0,q.useCallback)(e=>{let t=dt.find(t=>t.id===e);if(!t||pt(t)||t.readAtMs!=null)return;let n=Date.now();et.mutate(t=>t&&{...t,runs:t.runs.map(t=>t.id===e?{...t,readAtMs:n}:t)},!1),I.markRunRead(e).catch(e=>{J(e instanceof Error?e.message:String(e)),et.mutate()})},[dt,et.mutate]),Qt=(0,q.useCallback)(e=>{Zt(e),Ce(e),Te(!0),D(t=>{let n=new URLSearchParams(t);return n.set(`run`,e),n},{replace:!0})},[Zt,D]),$t=(0,q.useCallback)(e=>{De(e);let t=dt.find(t=>t.automationId===e);t&&t.readAtMs==null&&!pt(t)&&Zt(t.id)},[Zt,dt]);(0,q.useEffect)(()=>{ae&&(Zt(ae),Ce(ae),Te(!0))},[Zt,ae]),(0,q.useEffect)(()=>{Ve(null),Ge(!1)},[Se]);async function en(){if(J(null),Ht){if(ge&&Y){Xe(`draft:edit`);try{let e=$e(K,Rt),{simulation:t}=await I.simulate(e);X({...Y,automation:e,simulation:t}),Fe(K.projectId),Le(K.conversationMode),ze(K.notificationPolicy),Ne(!1),ye(!1),G(`draft`)}catch(e){J(e instanceof Error?e.message:String(e))}finally{Xe(null)}return}if(wt){let e=wt.id;await tn(`automation:${e}:edit`,()=>I.update(e,st(wt,K,Rt)))&&(U(!1),he(null),De(e));return}try{let e=$e(K,Rt),{automation:t}=await I.create(e);be(Ze),U(!1),z(`all`),V(``),qt(t.projectId??``),await Kt(),De(t.id)}catch(e){J(e instanceof Error?e.message:String(e))}}}async function tn(e,t){J(null),Xe(e);try{return await t(),await Kt(),!0}catch(e){return J(e instanceof Error?e.message:String(e)),!1}finally{Xe(null)}}async function nn(){await tn(`runs:read-all`,()=>I.markAllRunsRead(P||void 0))}async function rn(){let e=Oe.trim();if(e){J(null),je(!0);try{X((await I.draft({prompt:e,language:a})).draft),Ne(!1)}catch(e){J(e instanceof Error?e.message:String(e))}finally{je(!1)}}}async function an(){if(!Y)return;let e=``,t=``;await tn(`draft:publish`,async()=>{let{automation:n}=await I.create({...Y.automation,...Pe?{projectId:Pe}:{projectId:void 0},conversationMode:Ie,notificationPolicy:Re});X(null),ke(``),Ne(!1),U(!1),z(`all`),V(``),e=n.id,t=n.projectId??``})&&e&&(qt(t),De(e))}async function on(){if(!Y)return;let e=``,t=``,n=``;await tn(`draft:test`,async()=>{let{automation:r}=await I.create({...Y.automation,...Pe?{projectId:Pe}:{projectId:void 0},conversationMode:Ie,notificationPolicy:Re,enabled:!1}),{run:i}=await I.runNow(r.id);e=r.id,t=r.projectId??``,n=i.id,X(null),ke(``),Ne(!1),U(!1),z(`all`),V(``)})&&e&&n&&(qt(t),De(e),Qt(n))}async function sn(e){J(null),Ue(!0),Ve(null),Ge(!1);try{Ve((await I.repairDraft(e.id,{language:a})).repair)}catch(e){J(e instanceof Error?e.message:String(e))}finally{Ue(!1)}}async function cn(e){Be&&await tn(`run:${e.id}:repair`,async()=>{await I.update(e.automationId,Be.patch),Ve(null),Ge(!1)})}let ln=(0,q.useMemo)(()=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(M,{className:`size-9 shrink-0 p-0`,loading:Ke,label:l.refresh,onClick:Xt}),(0,Z.jsxs)(C,{variant:`primary`,onClick:()=>$(`draft`),children:[(0,Z.jsx)(f,{className:`size-4`}),l.new]})]}),[l.new,l.refresh,$,Ke,Xt]);return(0,q.useLayoutEffect)(()=>{if(!t)return d({startExtra:null,main:(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:l.title}),end:ln}),()=>w()},[w,t,ln,l.title,d]),(0,Z.jsxs)(`div`,{className:m(`flex min-h-0 min-w-0 flex-1 flex-col`,t?`bg-transparent`:`bg-surface-panel`),children:[(0,Z.jsxs)(`div`,{className:m(`flex w-full flex-col gap-4`,t?`py-1`:`mx-auto max-w-[96rem] px-4 py-7 sm:px-6 lg:px-8 lg:py-9`),children:[t?(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 rounded-xl border border-edge-subtle bg-surface-base px-4 py-3 shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(te,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n||l.title})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r||l.subtitle})]}),ln]}):null,xe?(0,Z.jsx)(`div`,{className:`rounded-lg border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:xe}):null,lt?(0,Z.jsx)(St,{}):(0,Z.jsxs)(`section`,{className:`grid min-h-0 items-start gap-4 xl:grid-cols-[20rem_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`border-b border-edge-subtle p-3`,children:[ue?null:(0,Z.jsxs)(o,{"aria-label":l.filters.project,className:Q,value:P,onChange:e=>qt(e.target.value),children:[(0,Z.jsx)(s,{value:``,children:l.filters.allProjects}),Lt.map(e=>(0,Z.jsx)(s,{value:e.id,children:e.name},e.id))]}),(0,Z.jsxs)(`label`,{className:m(`flex items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg-muted focus-within:border-accent`,!ue&&`mt-2`),children:[(0,Z.jsx)(k,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-subtle`,value:fe,onChange:e=>V(e.target.value),placeholder:l.filters.search})]}),(0,Z.jsxs)(`nav`,{className:`mt-3 flex items-center gap-1`,"aria-label":l.filters.status,children:[[{id:`all`,label:l.filters.all},{id:`active`,label:l.filters.active},{id:`paused`,label:l.paused}].map(e=>(0,Z.jsx)(`button`,{type:`button`,className:m(`rounded-md px-2.5 py-1.5 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,R===e.id&&`bg-surface-hover text-fg`),onClick:()=>z(e.id),children:e.label},e.id)),(0,Z.jsxs)(O,{children:[(0,Z.jsx)(T,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:m(`ml-auto rounded-md p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,R===`system`&&`bg-surface-hover text-fg`),"aria-label":l.system.title,children:(0,Z.jsx)(N,{className:`size-4`})})}),(0,Z.jsx)(re,{children:(0,Z.jsx)(A,{align:`end`,className:`z-70 min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:(0,Z.jsxs)(ie,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>z(`system`),children:[l.system.title,` `,mt.length]})})})]})]}),Ot.length>0&&R!==`system`?(0,Z.jsxs)(`div`,{className:`mt-2 flex items-center justify-between gap-2 rounded-md bg-accent/8 px-2.5 py-1.5 text-xs text-accent-fg`,children:[(0,Z.jsxs)(`span`,{children:[l.filters.unread,` · `,Ot.length]}),(0,Z.jsx)(`button`,{type:`button`,className:`font-medium hover:underline`,disabled:Ye===`runs:read-all`,onClick:()=>void nn(),children:l.filters.markAllRead})]}):null]}),(0,Z.jsx)(kt,{automations:jt,runs:R===`system`?dt:_t,labels:l,cronLabels:u,language:a,selectedAutomationId:Ee,onOpenDetails:$t})]}),Ct?(0,Z.jsx)(Ft,{automation:Ct,runs:Et,labels:l,cronLabels:u,language:a,projects:Lt,busyAction:Ye,onEdit:Jt,onSelectRun:Qt,onAction:tn}):(0,Z.jsx)(Ut,{icon:(0,Z.jsx)(te,{className:`size-5`}),title:l.empty.filtered})]})]}),(0,Z.jsx)(x,{open:H,onOpenChange:e=>{U(e),e||(he(null),ye(!1))},children:(0,Z.jsxs)(y,{children:[(0,Z.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(b,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-66 flex h-[min(760px,calc(100vh-2rem))] w-[min(100%-2rem,48rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-5 py-4`,children:[(0,Z.jsx)(ee,{className:`text-base font-semibold text-fg`,children:W===`draft`?l.draft.title:wt?l.editTitle:ge?l.draft.editTitle:l.createTitle}),(0,Z.jsx)(v,{asChild:!0,children:(0,Z.jsx)(C,{variant:`ghost`,"aria-label":l.close,children:(0,Z.jsx)(p,{className:`size-4`})})})]}),W===`draft`?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:(0,Z.jsx)(Tt,{labels:l,prompt:Oe,draft:Y,loading:Ae,approved:Me,publishBusy:Ye===`draft:publish`,testBusy:Ye===`draft:test`,templates:Gt,projects:Lt,projectId:Pe,conversationMode:Ie,notificationPolicy:Re,onPromptChange:ke,onGenerate:rn,onEdit:Yt,onPublish:an,onTest:on,onProjectChange:Fe,onConversationModeChange:Le,onNotificationPolicyChange:ze,projectLocked:ue,onApprovedChange:Ne,onDiscard:()=>{X(null),Ne(!1)},onTemplateSelect:e=>{be({...e,projectId:Pe}),G(`blank`)},onOpenAdvanced:()=>{be({...Ze,projectId:Pe,conversationMode:Ie,notificationPolicy:Re}),G(`blank`)}})}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Wt,{form:K,labels:l,setForm:be,projects:Lt,workflowDefinitions:Mt,selectedWorkflow:Rt,workflowsLoading:nt.isLoading,browserAutomations:Nt,selectedBrowserAutomation:zt,browserAutomationsLoading:rt.isLoading,agentOptions:It,agentsLoading:it.isLoading,language:a,projectLocked:ue}),(0,Z.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-edge px-5 py-4`,children:[ge?(0,Z.jsx)(C,{variant:`ghost`,onClick:()=>{ye(!1),G(`draft`)},children:l.cancel}):(0,Z.jsx)(v,{asChild:!0,children:(0,Z.jsx)(C,{variant:`ghost`,children:l.cancel})}),(0,Z.jsx)(C,{variant:`primary`,onClick:en,disabled:!Ht||Ye===`draft:edit`||!!(wt&&Ye),children:Ye===`draft:edit`||wt&&Ye===`automation:${wt.id}:edit`?l.feedback.working:wt||ge?l.save:l.create})]})]})]})]})}),(0,Z.jsx)(x,{open:we&&!!bt,onOpenChange:e=>{Te(e),!e&&D(e=>{let t=new URLSearchParams(e);return t.delete(`run`),t},{replace:!0})},children:(0,Z.jsxs)(y,{children:[(0,Z.jsx)(_,{className:`xopc-dialog-overlay fixed inset-0 z-65 bg-scrim backdrop-blur-[1px]`}),(0,Z.jsxs)(b,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-66 flex h-[min(85vh,40rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(ee,{className:`truncate text-base font-semibold text-fg`,children:bt?.automationName??l.dashboard.result}),(0,Z.jsx)(v,{asChild:!0,children:(0,Z.jsx)(C,{variant:`ghost`,"aria-label":l.close,children:(0,Z.jsx)(p,{className:`size-4`})})})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,Z.jsx)(Pt,{className:`rounded-none border-0`,run:bt,events:Dt,labels:l,cronLabels:u,language:a,loading:tt.isLoading,repairDraft:Be,repairLoading:He,repairApproved:We,busyAction:Ye,onRepairApprovedChange:Ge,onSuggestRepair:sn,onApplyRepair:cn})})]})]})})]})}function Tt(e){let t=(0,be.c)(108),{labels:n,prompt:r,draft:i,loading:a,approved:c,publishBusy:l,testBusy:u,templates:d,projects:f,projectId:p,conversationMode:h,notificationPolicy:g,onPromptChange:_,onGenerate:v,onEdit:y,onPublish:b,onTest:ee,onProjectChange:x,onConversationModeChange:S,onNotificationPolicyChange:w,onApprovedChange:T,onDiscard:te,onTemplateSelect:ne,onOpenAdvanced:re,projectLocked:ie}=e,E=l===void 0?!1:l,ae=u===void 0?!1:u,O=ie===void 0?!1:ie,k=!!(i&&i.simulation.requiredConfirmations.length>0),oe;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Z.jsx)(ue,{className:`size-4 text-accent`}),t[0]=oe):oe=t[0];let A;t[1]===n.draft.title?A=t[2]:(A=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[oe,n.draft.title]}),t[1]=n.draft.title,t[2]=A);let j;t[3]===n.draft.subtitle?j=t[4]:(j=(0,Z.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:n.draft.subtitle}),t[3]=n.draft.subtitle,t[4]=j);let M;t[5]!==A||t[6]!==j?(M=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[A,j]}),t[5]=A,t[6]=j,t[7]=M):M=t[7];let N;t[8]!==a||t[9]!==r?(N=a||!r.trim(),t[8]=a,t[9]=r,t[10]=N):N=t[10];let se;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(ue,{className:`size-4`}),t[11]=se):se=t[11];let ce=a?n.draft.generating:n.draft.generate,P;t[12]!==v||t[13]!==ce||t[14]!==N?(P=(0,Z.jsxs)(C,{variant:`primary`,onClick:v,disabled:N,children:[se,ce]}),t[12]=v,t[13]=ce,t[14]=N,t[15]=P):P=t[15];let le;t[16]!==P||t[17]!==M?(le=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[M,P]}),t[16]=P,t[17]=M,t[18]=le):le=t[18];let de;t[19]===_?de=t[20]:(de=e=>_(e.target.value),t[19]=_,t[20]=de);let F;t[21]!==n.draft.placeholder||t[22]!==r||t[23]!==de?(F=(0,Z.jsx)(`textarea`,{className:`mt-4 min-h-20 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none focus:border-accent`,value:r,onChange:de,placeholder:n.draft.placeholder}),t[21]=n.draft.placeholder,t[22]=r,t[23]=de,t[24]=F):F=t[24];let I=O?`sm:grid-cols-2`:`sm:grid-cols-3`,L;t[25]===I?L=t[26]:(L=m(`mt-3 grid gap-3`,I),t[25]=I,t[26]=L);let R;t[27]!==n.draft.noProject||t[28]!==n.draft.project||t[29]!==x||t[30]!==p||t[31]!==O||t[32]!==f?(R=O?null:(0,Z.jsx)($,{label:n.draft.project,children:(0,Z.jsxs)(o,{className:Q,value:p,onChange:e=>x(e.target.value),children:[(0,Z.jsx)(s,{value:``,children:n.draft.noProject}),f.map(Et)]})}),t[27]=n.draft.noProject,t[28]=n.draft.project,t[29]=x,t[30]=p,t[31]=O,t[32]=f,t[33]=R):R=t[33];let z;t[34]===S?z=t[35]:(z=e=>S(e.target.value),t[34]=S,t[35]=z);let B;t[36]===n.draft.newConversation?B=t[37]:(B=(0,Z.jsx)(s,{value:`new_session`,children:n.draft.newConversation}),t[36]=n.draft.newConversation,t[37]=B);let V;t[38]===n.draft.continuousConversation?V=t[39]:(V=(0,Z.jsx)(s,{value:`continuous`,children:n.draft.continuousConversation}),t[38]=n.draft.continuousConversation,t[39]=V);let H;t[40]!==h||t[41]!==z||t[42]!==B||t[43]!==V?(H=(0,Z.jsxs)(o,{className:Q,value:h,onChange:z,children:[B,V]}),t[40]=h,t[41]=z,t[42]=B,t[43]=V,t[44]=H):H=t[44];let U;t[45]!==n.draft.conversation||t[46]!==H?(U=(0,Z.jsx)($,{label:n.draft.conversation,children:H}),t[45]=n.draft.conversation,t[46]=H,t[47]=U):U=t[47];let W;t[48]===w?W=t[49]:(W=e=>w(e.target.value),t[48]=w,t[49]=W);let G;t[50]===n.draft.notifyAttention?G=t[51]:(G=(0,Z.jsx)(s,{value:`attention`,children:n.draft.notifyAttention}),t[50]=n.draft.notifyAttention,t[51]=G);let pe;t[52]===n.draft.notifyAll?pe=t[53]:(pe=(0,Z.jsx)(s,{value:`all`,children:n.draft.notifyAll}),t[52]=n.draft.notifyAll,t[53]=pe);let me;t[54]===n.draft.notifyNone?me=t[55]:(me=(0,Z.jsx)(s,{value:`none`,children:n.draft.notifyNone}),t[54]=n.draft.notifyNone,t[55]=me);let he;t[56]!==g||t[57]!==W||t[58]!==G||t[59]!==pe||t[60]!==me?(he=(0,Z.jsxs)(o,{className:Q,value:g,onChange:W,children:[G,pe,me]}),t[56]=g,t[57]=W,t[58]=G,t[59]=pe,t[60]=me,t[61]=he):he=t[61];let ge;t[62]!==n.draft.notifications||t[63]!==he?(ge=(0,Z.jsx)($,{label:n.draft.notifications,children:he}),t[62]=n.draft.notifications,t[63]=he,t[64]=ge):ge=t[64];let _e;t[65]!==L||t[66]!==R||t[67]!==U||t[68]!==ge?(_e=(0,Z.jsxs)(`div`,{className:L,children:[R,U,ge]}),t[65]=L,t[66]=R,t[67]=U,t[68]=ge,t[69]=_e):_e=t[69];let ve;t[70]!==i||t[71]!==n.draft.advancedCreate||t[72]!==n.draft.suggestions||t[73]!==n.draft.suggestionsDescription||t[74]!==re||t[75]!==ne||t[76]!==d?(ve=i?null:(0,Z.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.draft.suggestions}),(0,Z.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:n.draft.suggestionsDescription})]}),(0,Z.jsx)(C,{variant:`ghost`,onClick:re,children:n.draft.advancedCreate})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:d.slice(0,4).map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`rounded-lg border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>ne(e.form),children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.name}),(0,Z.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:e.description})]},e.name))})]}),t[70]=i,t[71]=n.draft.advancedCreate,t[72]=n.draft.suggestions,t[73]=n.draft.suggestionsDescription,t[74]=re,t[75]=ne,t[76]=d,t[77]=ve):ve=t[77];let ye;t[78]!==c||t[79]!==i||t[80]!==n.draft.approval||t[81]!==n.draft.assumptions||t[82]!==n.draft.discard||t[83]!==n.draft.edit||t[84]!==n.draft.publish||t[85]!==n.draft.review||t[86]!==n.draft.risks||t[87]!==n.draft.safety||t[88]!==n.draft.testOnce||t[89]!==n.draft.testing||t[90]!==n.feedback||t[91]!==n.info||t[92]!==n.none||t[93]!==T||t[94]!==te||t[95]!==y||t[96]!==b||t[97]!==ee||t[98]!==E||t[99]!==k||t[100]!==ae?(ye=i?(0,Z.jsxs)(`div`,{className:`mt-4 grid gap-3 rounded-lg bg-surface-base p-4 lg:grid-cols-[1fr_1fr]`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:i.automation.name}),i.automation.description?(0,Z.jsx)(`div`,{className:`mt-1 text-sm text-fg-muted`,children:i.automation.description}):null,(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 text-sm`,children:[(0,Z.jsx)(Ht,{label:n.info.when,value:i.simulation.triggerSummary}),(0,Z.jsx)(Ht,{label:n.info.run,value:i.simulation.actionSummary})]})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:n.draft.review}),(0,Z.jsx)(Dt,{title:n.draft.safety,items:[...i.simulation.safetyNotes,...i.simulation.requiredConfirmations],empty:n.none}),(0,Z.jsx)(Dt,{title:n.draft.assumptions,items:i.assumptions,empty:n.none}),(0,Z.jsx)(Dt,{title:n.draft.risks,items:i.risks,empty:n.none}),k?(0,Z.jsxs)(`label`,{className:`mt-4 flex items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:c,onChange:e=>T(e.target.checked)}),(0,Z.jsx)(`span`,{children:n.draft.approval})]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,Z.jsx)(C,{variant:`ghost`,onClick:te,children:n.draft.discard}),(0,Z.jsxs)(C,{variant:`secondary`,onClick:y,children:[(0,Z.jsx)(fe,{className:`size-4`}),n.draft.edit]}),(0,Z.jsxs)(C,{variant:`secondary`,onClick:ee,disabled:ae||E||k&&!c,children:[(0,Z.jsx)(D,{className:`size-4`}),ae?n.draft.testing:n.draft.testOnce]}),(0,Z.jsx)(C,{variant:`primary`,onClick:b,disabled:E||k&&!c,children:E?n.feedback.working:n.draft.publish})]})]})]}):null,t[78]=c,t[79]=i,t[80]=n.draft.approval,t[81]=n.draft.assumptions,t[82]=n.draft.discard,t[83]=n.draft.edit,t[84]=n.draft.publish,t[85]=n.draft.review,t[86]=n.draft.risks,t[87]=n.draft.safety,t[88]=n.draft.testOnce,t[89]=n.draft.testing,t[90]=n.feedback,t[91]=n.info,t[92]=n.none,t[93]=T,t[94]=te,t[95]=y,t[96]=b,t[97]=ee,t[98]=E,t[99]=k,t[100]=ae,t[101]=ye):ye=t[101];let K;return t[102]!==le||t[103]!==F||t[104]!==_e||t[105]!==ve||t[106]!==ye?(K=(0,Z.jsxs)(`section`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-4 shadow-surface`,children:[le,F,_e,ve,ye]}),t[102]=le,t[103]=F,t[104]=_e,t[105]=ve,t[106]=ye,t[107]=K):K=t[107],K}function Et(e){return(0,Z.jsx)(s,{value:e.id,children:e.name},e.id)}function Dt(e){let t=(0,be.c)(10),{title:n,items:r,empty:i}=e,a;t[0]===n?a=t[1]:(a=(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=a);let o;t[2]!==i||t[3]!==r?(o=r.length>0?r.map(Ot):(0,Z.jsx)(`li`,{className:`text-fg-muted`,children:i}),t[2]=i,t[3]=r,t[4]=o):o=t[4];let s;t[5]===o?s=t[6]:(s=(0,Z.jsx)(`ul`,{className:`mt-1 space-y-1 text-sm text-fg`,children:o}),t[5]=o,t[6]=s);let c;return t[7]!==a||t[8]!==s?(c=(0,Z.jsxs)(`div`,{className:`mt-3`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function Ot(e){return(0,Z.jsxs)(`li`,{children:[`- `,e]},e)}function kt(e){let t=(0,be.c)(20),{automations:n,runs:r,labels:i,cronLabels:a,language:o,selectedAutomationId:s,onOpenDetails:c}=e;if(n.length===0){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(te,{className:`size-5`}),t[0]=e):e=t[0];let n;return t[1]===i.empty.filtered?n=t[2]:(n=(0,Z.jsx)(Ut,{className:`rounded-none border-0 shadow-none`,icon:e,title:i.empty.filtered}),t[1]=i.empty.filtered,t[2]=n),n}let l;if(t[3]!==n||t[4]!==a||t[5]!==i||t[6]!==o||t[7]!==c||t[8]!==r||t[9]!==s){let e;t[11]!==a||t[12]!==i||t[13]!==o||t[14]!==c||t[15]!==r||t[16]!==s?(e=e=>{let t=r.filter(t=>t.automationId===e.id).sort(At),n=t.find(pt),l=t[0];return(0,Z.jsxs)(`button`,{type:`button`,className:m(`block w-full p-3 text-left outline-none hover:bg-surface-hover focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,s===e.id&&`bg-surface-hover`),onClick:()=>c(e.id),children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:m(`size-2 shrink-0 rounded-full`,n?`bg-blue-500`:ht(e,t)?`bg-red-500`:e.enabled?`bg-emerald-500`:`bg-fg-subtle`)}),(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.name}),l&&l.readAtMs==null&&!pt(l)?(0,Z.jsx)(`span`,{className:`ml-auto size-2 shrink-0 rounded-full bg-blue-500`,children:(0,Z.jsx)(`span`,{className:`sr-only`,children:i.filters.unread})}):null]}),(0,Z.jsx)(`div`,{className:`mt-1 truncate pl-4 text-xs text-fg-muted`,children:Je(e.trigger,i,a,o)}),(0,Z.jsxs)(`div`,{className:`mt-1 flex min-w-0 items-center justify-between gap-2 pl-4 text-xs text-fg-subtle`,children:[(0,Z.jsx)(`span`,{className:m(`truncate`,l?.error&&`text-red-700 dark:text-red-300`),children:l?l.error||l.summary||i.status[l.status]:e.enabled?`${i.next}: ${ct(e.state.nextRunAtMs,i,o)}`:i.paused}),l?.status?(0,Z.jsx)(`span`,{className:m(`shrink-0 rounded-full px-1.5 py-0.5`,dt(l.status)),children:i.status[l.status]}):null]})]},e.id)},t[11]=a,t[12]=i,t[13]=o,t[14]=c,t[15]=r,t[16]=s,t[17]=e):e=t[17],l=n.map(e),t[3]=n,t[4]=a,t[5]=i,t[6]=o,t[7]=c,t[8]=r,t[9]=s,t[10]=l}else l=t[10];let u;return t[18]===l?u=t[19]:(u=(0,Z.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:l}),t[18]=l,t[19]=u),u}function At(e,t){return t.createdAtMs-e.createdAtMs}function jt(e,t){let n=t.events,r=e.data&&typeof e.data==`object`?e.data:{},i=typeof r.actionKind==`string`?r.actionKind:null,a=typeof r.status==`string`&&r.status in t.status?t.status[r.status]:null;switch(e.type){case`run.queued`:return e.message.toLowerCase().includes(`manual`)?n.manualQueued:e.message.toLowerCase().includes(`scheduled`)?n.scheduledQueued:n.eventQueued;case`run.started`:return n.runStarted;case`action.started`:return i?n.actionStarted.replace(`{kind}`,i):n.actionStartedFallback;case`action.completed`:return i?n.actionCompleted.replace(`{kind}`,i):n.actionCompletedFallback;case`action.failed`:return i?n.actionFailed.replace(`{kind}`,i):n.actionFailedFallback;case`completion_hook.started`:return n.completionHookStarted;case`completion_hook.completed`:return n.completionHookCompleted;case`completion_hook.failed`:return n.completionHookFailed;case`run.completed`:return a?n.runCompleted.replace(`{status}`,a):n.runCompletedFallback;default:return e.message}}function Mt(e){let t=(0,be.c)(17),{value:n,labels:r,title:i,defaultExpanded:a}=e,[o,s]=(0,q.useState)(a===void 0?!1:a),c;t[0]===n?c=t[1]:(c=JSON.stringify(n,null,2),t[0]=n,t[1]=c);let l=c,u;t[2]===l?u=t[3]:(u=l.split(`
|
|
2
|
-
`),t[2]=l,t[3]=u);let d=u.length,f=l.length>720||d>18,p;t[4]!==f||t[5]!==l?(p=f?`${l.split(`
|
|
3
|
-
`).slice(0,10).join(`
|
|
4
|
-
`).trimEnd()}...`:l,t[4]=f,t[5]=l,t[6]=p):p=t[6];let h=p,g;t[7]!==o||t[8]!==f||t[9]!==r||t[10]!==i?(g=f?(0,Z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>s(Nt),"aria-expanded":o,children:[(0,Z.jsx)(`span`,{children:i}),(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-accent-fg`,children:[o?r.details.hideDetails:r.details.showDetails,(0,Z.jsx)(P,{className:m(`size-3.5 transition-transform`,o&&`rotate-180`),"aria-hidden":!0})]})]}):(0,Z.jsx)(`div`,{className:`px-2.5 py-2 text-xs font-medium text-fg-muted`,children:i}),t[7]=o,t[8]=f,t[9]=r,t[10]=i,t[11]=g):g=t[11];let _=o||!f?l:h,v;t[12]===_?v=t[13]:(v=(0,Z.jsx)(`pre`,{className:`whitespace-pre-wrap break-all px-2.5 pb-2 text-xs leading-relaxed text-fg-muted`,children:_}),t[12]=_,t[13]=v);let y;return t[14]!==g||t[15]!==v?(y=(0,Z.jsxs)(`div`,{className:`mt-2 rounded-md border border-edge/70 bg-surface-muted/35`,children:[g,v]}),t[14]=g,t[15]=v,t[16]=y):y=t[16],y}function Nt(e){return!e}function Pt(e){let t=(0,be.c)(148),{className:n,run:r,events:i,labels:o,cronLabels:s,language:f,loading:p,repairDraft:h,repairLoading:g,repairApproved:_,busyAction:v,onRepairApprovedChange:y,onSuggestRepair:b,onApplyRepair:ee}=e;if(!r){let e;t[0]===n?e=t[1]:(e=m(`flex min-h-64 flex-col justify-center rounded-lg border border-edge-subtle bg-surface-base px-4 text-center text-sm text-fg-muted shadow-surface`,n),t[0]=n,t[1]=e);let r;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(ae,{className:`mx-auto size-5`}),t[2]=r):r=t[2];let i;t[3]===o.selectRun?i=t[4]:(i=(0,Z.jsx)(`div`,{className:`mt-2`,children:o.selectRun}),t[3]=o.selectRun,t[4]=i);let a;return t[5]!==e||t[6]!==i?(a=(0,Z.jsxs)(`aside`,{className:e,children:[r,i]}),t[5]=e,t[6]=i,t[7]=a):a=t[7],a}let x=r.error||r.summary,S=r.conversationId?`/chat/${encodeURIComponent(r.conversationId)}`:r.workflowRunId?`/workflows?run=${encodeURIComponent(r.workflowRunId)}`:null,T=r.conversationId?o.runDetail.openConversation:o.runDetail.openWorkflow,te=r.conversationId?d:u,ne=pt(r)?ae:mt(r)?ce:c,re;t[8]===n?re=t[9]:(re=m(`rounded-lg border border-edge-subtle bg-surface-base shadow-surface`,n),t[8]=n,t[9]=re);let ie;t[10]===r.automationName?ie=t[11]:(ie=(0,Z.jsx)(`div`,{className:`truncate text-sm font-semibold text-fg`,children:r.automationName}),t[10]=r.automationName,t[11]=ie);let E;t[12]===r.id?E=t[13]:(E=r.id.slice(0,8),t[12]=r.id,t[13]=E);let D;t[14]===E?D=t[15]:(D=(0,Z.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:E}),t[14]=E,t[15]=D);let O;t[16]!==ie||t[17]!==D?(O=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[ie,D]}),t[16]=ie,t[17]=D,t[18]=O):O=t[18];let k;t[19]===r.status?k=t[20]:(k=m(`shrink-0 rounded-full px-2 py-0.5 text-xs`,dt(r.status)),t[19]=r.status,t[20]=k);let oe=o.status[r.status],A;t[21]!==k||t[22]!==oe?(A=(0,Z.jsx)(`span`,{className:k,children:oe}),t[21]=k,t[22]=oe,t[23]=A):A=t[23];let j;t[24]!==O||t[25]!==A?(j=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[O,A]}),t[24]=O,t[25]=A,t[26]=j):j=t[26];let M;t[27]!==o||t[28]!==f||t[29]!==r.createdAtMs?(M=ct(r.createdAtMs,o,f),t[27]=o,t[28]=f,t[29]=r.createdAtMs,t[30]=M):M=t[30];let N;t[31]===M?N=t[32]:(N=(0,Z.jsx)(`span`,{children:M}),t[31]=M,t[32]=N);let se;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Z.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[33]=se):se=t[33];let le=o.details.duration,de;t[34]!==o||t[35]!==r.durationMs?(de=ft(r.durationMs,o),t[34]=o,t[35]=r.durationMs,t[36]=de):de=t[36];let F;t[37]!==o.details.duration||t[38]!==de?(F=(0,Z.jsxs)(`span`,{children:[le,` `,de]}),t[37]=o.details.duration,t[38]=de,t[39]=F):F=t[39];let I;t[40]!==N||t[41]!==F?(I=(0,Z.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[N,se,F]}),t[40]=N,t[41]=F,t[42]=I):I=t[42];let L;t[43]!==o.repair||t[44]!==b||t[45]!==g||t[46]!==r?(L=r.status===`failed`||r.status===`timeout`||r.status===`cancelled`?(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsxs)(C,{variant:`secondary`,onClick:()=>b(r),disabled:g,children:[(0,Z.jsx)(ue,{className:`size-4`}),g?o.repair.generating:o.repair.suggest]})}):null,t[43]=o.repair,t[44]=b,t[45]=g,t[46]=r,t[47]=L):L=t[47];let B;t[48]!==I||t[49]!==L||t[50]!==j?(B=(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[j,I,L]}),t[48]=I,t[49]=L,t[50]=j,t[51]=B):B=t[51];let fe;t[52]===r?fe=t[53]:(fe=pt(r)?`text-blue-500`:mt(r)?`text-red-500`:`text-emerald-500`,t[52]=r,t[53]=fe);let V;t[54]===fe?V=t[55]:(V=m(`size-4`,fe),t[54]=fe,t[55]=V);let H;t[56]!==ne||t[57]!==V?(H=(0,Z.jsx)(ne,{className:V}),t[56]=ne,t[57]=V,t[58]=H):H=t[58];let U;t[59]!==o.runDetail.resultTitle||t[60]!==H?(U=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[H,o.runDetail.resultTitle]}),t[59]=o.runDetail.resultTitle,t[60]=H,t[61]=U):U=t[61];let W;t[62]!==te||t[63]!==T||t[64]!==S?(W=S?(0,Z.jsx)(C,{asChild:!0,variant:`secondary`,className:`h-8 rounded-md px-2.5 text-xs`,children:(0,Z.jsxs)(a,{to:S,children:[(0,Z.jsx)(te,{className:`size-3.5`}),T,(0,Z.jsx)(z,{className:`size-3.5`})]})}):null,t[62]=te,t[63]=T,t[64]=S,t[65]=W):W=t[65];let G;t[66]!==U||t[67]!==W?(G=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[U,W]}),t[66]=U,t[67]=W,t[68]=G):G=t[68];let pe=r.error&&`border-red-500/25 bg-red-500/5`,me;t[69]===pe?me=t[70]:(me=m(`mt-3 max-h-80 overflow-y-auto rounded-lg border border-edge/70 bg-surface-muted/25 p-3`,pe),t[69]=pe,t[70]=me);let he;t[71]!==o.runDetail.noResult||t[72]!==o.runDetail.resultPending||t[73]!==x||t[74]!==r?(he=x?r.error?(0,Z.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-relaxed text-red-700 dark:text-red-300`,children:x}):(0,Z.jsx)(l,{content:x,compact:!0,className:`text-sm`}):(0,Z.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:pt(r)?o.runDetail.resultPending:o.runDetail.noResult}),t[71]=o.runDetail.noResult,t[72]=o.runDetail.resultPending,t[73]=x,t[74]=r,t[75]=he):he=t[75];let ge;t[76]!==me||t[77]!==he?(ge=(0,Z.jsx)(`div`,{className:me,children:he}),t[76]=me,t[77]=he,t[78]=ge):ge=t[78];let _e;t[79]!==G||t[80]!==ge?(_e=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[G,ge]}),t[79]=G,t[80]=ge,t[81]=_e):_e=t[81];let ve;t[82]===o.runDetail.runInfo?ve=t[83]:(ve=(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.runDetail.runInfo}),t[82]=o.runDetail.runInfo,t[83]=ve);let ye;t[84]!==s||t[85]!==o||t[86]!==f||t[87]!==r.manual||t[88]!==r.triggerSnapshot?(ye=r.manual?o.trigger.manual:Je(r.triggerSnapshot,o,s,f),t[84]=s,t[85]=o,t[86]=f,t[87]=r.manual,t[88]=r.triggerSnapshot,t[89]=ye):ye=t[89];let K;t[90]!==o.explain.whyRan||t[91]!==ye?(K=(0,Z.jsx)(Bt,{label:o.explain.whyRan,value:ye}),t[90]=o.explain.whyRan,t[91]=ye,t[92]=K):K=t[92];let q=o.details.started,xe;t[93]!==o||t[94]!==f||t[95]!==r.startedAtMs?(xe=ct(r.startedAtMs,o,f),t[93]=o,t[94]=f,t[95]=r.startedAtMs,t[96]=xe):xe=t[96];let J;t[97]!==o.details.started||t[98]!==xe?(J=(0,Z.jsx)(Bt,{label:q,value:xe}),t[97]=o.details.started,t[98]=xe,t[99]=J):J=t[99];let Se;t[100]!==o.details.model||t[101]!==r.model?(Se=r.model?(0,Z.jsx)(Bt,{label:o.details.model,value:r.model}):null,t[100]=o.details.model,t[101]=r.model,t[102]=Se):Se=t[102];let Ce;t[103]!==K||t[104]!==J||t[105]!==Se?(Ce=(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 text-xs text-fg-muted`,children:[K,J,Se]}),t[103]=K,t[104]=J,t[105]=Se,t[106]=Ce):Ce=t[106];let we;t[107]!==ve||t[108]!==Ce?(we=(0,Z.jsxs)(`section`,{className:`border-b border-edge p-4`,children:[ve,Ce]}),t[107]=ve,t[108]=Ce,t[109]=we):we=t[109];let Te;t[110]!==v||t[111]!==o||t[112]!==ee||t[113]!==y||t[114]!==_||t[115]!==h||t[116]!==r?(Te=h?(0,Z.jsxs)(`div`,{className:`border-b border-edge px-4 py-3`,children:[(0,Z.jsx)(`div`,{className:`text-xs font-semibold uppercase text-fg-muted`,children:o.repair.title}),(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg`,children:h.explanation}),h.expectedEffect?(0,Z.jsx)(`div`,{className:`mt-2 text-sm text-fg-muted`,children:h.expectedEffect}):null,(0,Z.jsx)(Dt,{title:o.repair.risks,items:h.risks,empty:o.none}),(0,Z.jsx)(Mt,{value:h.patch,labels:o,title:o.details.repairPatch}),h.requiresApproval?(0,Z.jsxs)(`label`,{className:`mt-3 flex items-start gap-2 text-sm text-fg`,children:[(0,Z.jsx)(`input`,{className:`mt-1`,type:`checkbox`,checked:_,onChange:e=>y(e.target.checked)}),(0,Z.jsx)(`span`,{children:o.repair.approval})]}):null,(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsx)(C,{variant:`primary`,onClick:()=>ee(r),disabled:v===`run:${r.id}:repair`||h.requiresApproval&&!_,children:v===`run:${r.id}:repair`?o.feedback.working:o.repair.apply})})]}):null,t[110]=v,t[111]=o,t[112]=ee,t[113]=y,t[114]=_,t[115]=h,t[116]=r,t[117]=Te):Te=t[117];let Ee;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Z.jsx)(R,{className:`size-4 shrink-0`}),t[118]=Ee):Ee=t[118];let De;t[119]===o.runDetail.technicalEvents?De=t[120]:(De=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-sm font-medium text-fg-muted`,children:[Ee,o.runDetail.technicalEvents]}),t[119]=o.runDetail.technicalEvents,t[120]=De);let Oe;t[121]!==i.length||t[122]!==o.runDetail.eventCount?(Oe=o.runDetail.eventCount.replace(`{count}`,String(i.length)),t[121]=i.length,t[122]=o.runDetail.eventCount,t[123]=Oe):Oe=t[123];let ke;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Z.jsx)(P,{className:`size-4 transition-transform group-open:rotate-180`}),t[124]=ke):ke=t[124];let Y;t[125]===Oe?Y=t[126]:(Y=(0,Z.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[Oe,ke]}),t[125]=Oe,t[126]=Y);let X;t[127]!==De||t[128]!==Y?(X=(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 rounded-md outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[De,Y]}),t[127]=De,t[128]=Y,t[129]=X):X=t[129];let Ae;t[130]===o.runDetail.technicalEventsDescription?Ae=t[131]:(Ae=(0,Z.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-fg-muted`,children:o.runDetail.technicalEventsDescription}),t[130]=o.runDetail.technicalEventsDescription,t[131]=Ae);let je;t[132]!==i||t[133]!==o||t[134]!==f||t[135]!==p?(je=(0,Z.jsx)(`div`,{className:`mt-4`,children:p?(0,Z.jsxs)(`div`,{className:`space-y-3`,"aria-label":o.loading,children:[(0,Z.jsx)(w,{className:`h-10 w-full`}),(0,Z.jsx)(w,{className:`h-10 w-4/5`}),(0,Z.jsx)(w,{className:`h-10 w-11/12`})]}):i.length===0?(0,Z.jsx)(`div`,{className:`text-sm text-fg-muted`,children:o.empty.events}):(0,Z.jsx)(`ol`,{className:`space-y-3`,children:i.map(e=>(0,Z.jsxs)(`li`,{className:`grid grid-cols-[0.75rem_1fr] gap-3`,children:[(0,Z.jsx)(`span`,{className:m(`mt-1 size-2 rounded-full`,Vt(e.type))}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-sm text-fg`,children:jt(e,o)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[ct(e.createdAtMs,o,f),` · `,e.type]}),e.data&&typeof e.data==`object`?(0,Z.jsxs)(`details`,{className:`group/event mt-2 rounded-md border border-edge/70 bg-surface-muted/35`,children:[(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 px-2.5 py-2 text-xs font-medium text-fg-muted outline-none hover:text-fg`,children:[o.details.eventData,(0,Z.jsx)(P,{className:`size-3.5 transition-transform group-open/event:rotate-180`})]}),(0,Z.jsx)(`pre`,{className:`max-h-72 overflow-auto whitespace-pre-wrap break-all border-t border-edge/70 px-2.5 py-2 text-xs leading-relaxed text-fg-muted`,children:JSON.stringify(e.data,null,2)})]}):null]})]},e.id))})}),t[132]=i,t[133]=o,t[134]=f,t[135]=p,t[136]=je):je=t[136];let Me;t[137]!==X||t[138]!==Ae||t[139]!==je?(Me=(0,Z.jsxs)(`details`,{className:`group px-4 py-3`,children:[X,Ae,je]}),t[137]=X,t[138]=Ae,t[139]=je,t[140]=Me):Me=t[140];let Ne;return t[141]!==re||t[142]!==B||t[143]!==_e||t[144]!==we||t[145]!==Te||t[146]!==Me?(Ne=(0,Z.jsxs)(`aside`,{className:re,children:[B,_e,we,Te,Me]}),t[141]=re,t[142]=B,t[143]=_e,t[144]=we,t[145]=Te,t[146]=Me,t[147]=Ne):Ne=t[147],Ne}function Ft(e){let t=(0,be.c)(83),{automation:n,runs:r,labels:i,cronLabels:a,language:o,projects:s,busyAction:u,onEdit:d,onSelectRun:f,onAction:p}=e,h=u===`automation:${n.id}:run`,g=u===`automation:${n.id}:toggle`,_=u===`automation:${n.id}:delete`,v;t[0]===n?v=t[1]:(v=vt(n),t[0]=n,t[1]=v);let y=v,b;t[2]===n.name?b=t[3]:(b=(0,Z.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:n.name}),t[2]=n.name,t[3]=b);let ee=n.enabled?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`bg-surface-hover text-fg-muted`,x;t[4]===ee?x=t[5]:(x=m(`shrink-0 rounded-full px-2 py-0.5 text-xs`,ee),t[4]=ee,t[5]=x);let S=n.enabled?i.enabled:i.paused,w;t[6]!==x||t[7]!==S?(w=(0,Z.jsx)(`span`,{className:x,children:S}),t[6]=x,t[7]=S,t[8]=w):w=t[8];let te;t[9]!==b||t[10]!==w?(te=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[b,w]}),t[9]=b,t[10]=w,t[11]=te):te=t[11];let E;t[12]===n?E=t[13]:(E=yt(n)?(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:yt(n)}):null,t[12]=n,t[13]=E);let k;t[14]!==te||t[15]!==E?(k=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[te,E]}),t[14]=te,t[15]=E,t[16]=k):k=t[16];let oe;t[17]!==n||t[18]!==u||t[19]!==_||t[20]!==i.dashboard.delete||t[21]!==i.dashboard.deleted||t[22]!==i.dashboard.pause||t[23]!==i.dashboard.resume||t[24]!==i.dashboard.resumed||t[25]!==i.dashboard.runNow||t[26]!==i.details||t[27]!==i.edit||t[28]!==i.feedback||t[29]!==p||t[30]!==d||t[31]!==y||t[32]!==h||t[33]!==g?(oe=y?null:(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Z.jsxs)(C,{variant:`secondary`,disabled:u!==null,onClick:()=>void p(`automation:${n.id}:toggle`,()=>n.enabled?I.pause(n.id):I.resume(n.id),n.enabled?i.feedback.paused:i.dashboard.resumed),children:[g?(0,Z.jsx)(ne,{className:`size-4 animate-spin`}):n.enabled?(0,Z.jsx)(j,{className:`size-4`}):(0,Z.jsx)(D,{className:`size-4`}),n.enabled?i.dashboard.pause:i.dashboard.resume]}),(0,Z.jsxs)(C,{variant:`primary`,disabled:u!==null,onClick:()=>void p(`automation:${n.id}:run`,()=>I.runNow(n.id),i.feedback.rerunQueued),children:[h?(0,Z.jsx)(ne,{className:`size-4 animate-spin`}):(0,Z.jsx)(D,{className:`size-4`}),i.dashboard.runNow]}),(0,Z.jsxs)(O,{children:[(0,Z.jsx)(T,{asChild:!0,children:(0,Z.jsx)(C,{variant:`ghost`,className:`size-9 p-0`,"aria-label":i.details.moreActions,children:(0,Z.jsx)(N,{className:`size-4`})})}),(0,Z.jsx)(re,{children:(0,Z.jsxs)(A,{align:`end`,className:`z-70 min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:[(0,Z.jsxs)(ie,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover`,onSelect:()=>d(n),children:[(0,Z.jsx)(fe,{className:`size-4`}),i.edit]}),(0,Z.jsxs)(ie,{className:`flex cursor-pointer items-center gap-2 rounded-md px-3 py-2 text-sm text-red-700 outline-none hover:bg-red-500/10 dark:text-red-300`,disabled:u!==null,onSelect:()=>void p(`automation:${n.id}:delete`,()=>I.remove(n.id),i.dashboard.deleted),children:[_?(0,Z.jsx)(ne,{className:`size-4 animate-spin`}):(0,Z.jsx)(se,{className:`size-4`}),i.dashboard.delete]})]})})]})]}),t[17]=n,t[18]=u,t[19]=_,t[20]=i.dashboard.delete,t[21]=i.dashboard.deleted,t[22]=i.dashboard.pause,t[23]=i.dashboard.resume,t[24]=i.dashboard.resumed,t[25]=i.dashboard.runNow,t[26]=i.details,t[27]=i.edit,t[28]=i.feedback,t[29]=p,t[30]=d,t[31]=y,t[32]=h,t[33]=g,t[34]=oe):oe=t[34];let M;t[35]!==oe||t[36]!==k?(M=(0,Z.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[k,oe]}),t[35]=oe,t[36]=k,t[37]=M):M=t[37];let ce;t[38]===i.info.task?ce=t[39]:(ce=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.info.task}),t[38]=i.info.task,t[39]=ce);let P;t[40]!==n||t[41]!==i?(P=gt(n,i),t[40]=n,t[41]=i,t[42]=P):P=t[42];let le;t[43]===P?le=t[44]:(le=(0,Z.jsx)(`div`,{className:`mt-2 rounded-xl border border-edge-subtle bg-surface-base p-4`,children:(0,Z.jsx)(l,{content:P,compact:!0})}),t[43]=P,t[44]=le);let ue;t[45]!==ce||t[46]!==le?(ue=(0,Z.jsxs)(`section`,{children:[ce,le]}),t[45]=ce,t[46]=le,t[47]=ue):ue=t[47];let de;t[48]!==n||t[49]!==a||t[50]!==i||t[51]!==o||t[52]!==s?(de=(0,Z.jsx)(Lt,{automation:n,labels:i,cronLabels:a,language:o,projects:s}),t[48]=n,t[49]=a,t[50]=i,t[51]=o,t[52]=s,t[53]=de):de=t[53];let F;t[54]===i.dashboard.runHistory?F=t[55]:(F=(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.dashboard.runHistory}),t[54]=i.dashboard.runHistory,t[55]=F);let L;t[56]===i.dashboard.runHistoryDescription?L=t[57]:(L=(0,Z.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:i.dashboard.runHistoryDescription}),t[56]=i.dashboard.runHistoryDescription,t[57]=L);let R;t[58]!==F||t[59]!==L?(R=(0,Z.jsxs)(`div`,{children:[F,L]}),t[58]=F,t[59]=L,t[60]=R):R=t[60];let z;t[61]===r.length?z=t[62]:(z=(0,Z.jsx)(`span`,{className:`rounded-full bg-surface-base px-2.5 py-1 text-xs text-fg-muted`,children:r.length}),t[61]=r.length,t[62]=z);let B;t[63]!==R||t[64]!==z?(B=(0,Z.jsxs)(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[R,z]}),t[63]=R,t[64]=z,t[65]=B):B=t[65];let V;t[66]!==i||t[67]!==o||t[68]!==f||t[69]!==r?(V=r.length===0?(0,Z.jsx)(Ut,{icon:(0,Z.jsx)(ae,{className:`size-5`}),title:i.empty.runs}):(0,Z.jsx)(`div`,{className:`divide-y divide-edge-subtle overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,children:r.slice(0,8).map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`block w-full p-3 text-left hover:bg-surface-hover`,onClick:()=>f(e.id),children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[e.status===`succeeded`?(0,Z.jsx)(c,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-300`}):(0,Z.jsx)(ae,{className:`size-4 shrink-0 text-fg-muted`}),(0,Z.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:ct(e.createdAtMs,i,o)})]}),(0,Z.jsx)(`span`,{className:m(`shrink-0 rounded-full px-2 py-0.5 text-xs`,dt(e.status)),children:i.status[e.status]})]}),(0,Z.jsx)(`p`,{className:m(`mt-1 line-clamp-2 pl-6 text-sm text-fg-muted`,e.error&&`text-red-700 dark:text-red-300`),children:e.error||e.summary||lt(e.actionSnapshot,i)})]},e.id))}),t[66]=i,t[67]=o,t[68]=f,t[69]=r,t[70]=V):V=t[70];let H;t[71]!==B||t[72]!==V?(H=(0,Z.jsxs)(`section`,{className:`min-w-0`,children:[B,V]}),t[71]=B,t[72]=V,t[73]=H):H=t[73];let U;t[74]!==de||t[75]!==H?(U=(0,Z.jsxs)(`div`,{className:`grid items-start gap-5 lg:grid-cols-[20rem_minmax(0,1fr)]`,children:[de,H]}),t[74]=de,t[75]=H,t[76]=U):U=t[76];let W;t[77]!==ue||t[78]!==U?(W=(0,Z.jsxs)(`div`,{className:`grid gap-5 p-5`,children:[ue,U]}),t[77]=ue,t[78]=U,t[79]=W):W=t[79];let G;return t[80]!==M||t[81]!==W?(G=(0,Z.jsxs)(`article`,{className:`min-w-0 overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel shadow-surface`,children:[M,W]}),t[80]=M,t[81]=W,t[82]=G):G=t[82],G}function It(e,t){return e===`suggest_only`?t.safety.suggestOnlyDescription:e===`ask_before_apply`?t.safety.askBeforeApplyDescription:t.safety.autoApplyDescription}function Lt(e){let t=(0,be.c)(146),{automation:n,labels:r,cronLabels:i,language:a,projects:o}=e,s,c,l,f,p,m,h,g,_,v,y;if(t[0]!==n||t[1]!==i||t[2]!==r||t[3]!==a){let e=ut(n),o;t[15]!==n||t[16]!==r||t[17]!==a?(o=Ye(n,r,a),t[15]=n,t[16]=r,t[17]=a,t[18]=o):o=t[18];let d=o,b;t[19]!==n.state.nextRunAtMs||t[20]!==a?(b=n.state.nextRunAtMs?We(n.state.nextRunAtMs,a):void 0,t[19]=n.state.nextRunAtMs,t[20]=a,t[21]=b):b=t[21];let ee=b;if(t[22]!==n.trigger.eventType||t[23]!==n.trigger.kind||t[24]!==n.trigger.schedule||t[25]!==n.trigger.secretId||t[26]!==n.trigger.source||t[27]!==r.info.anchor||t[28]!==r.info.calendarSchedule||t[29]!==r.info.eventSource||t[30]!==r.info.eventType||t[31]!==r.info.expression||t[32]!==r.info.fixedInterval||t[33]!==r.info.oneTimeSchedule||t[34]!==r.info.rawInterval||t[35]!==r.info.scheduleType||t[36]!==r.info.timezone||t[37]!==r.info.webhookSecret||t[38]!==a){if(y=[],n.trigger.kind===`schedule`){let e=n.trigger.schedule,i=e.kind===`interval`?r.info.fixedInterval:e.kind===`cron`?r.info.calendarSchedule:r.info.oneTimeSchedule,o;if(t[40]!==r.info.scheduleType||t[41]!==i?(o={label:r.info.scheduleType,value:i},t[40]=r.info.scheduleType,t[41]=i,t[42]=o):o=t[42],y.push(o),e.kind===`interval`){let n=`${e.everyMs} ms`,i;if(t[43]!==r.info.rawInterval||t[44]!==n?(i={label:r.info.rawInterval,value:n},t[43]=r.info.rawInterval,t[44]=n,t[45]=i):i=t[45],y.push(i),e.anchorMs){let n=r.info.anchor,i;t[46]!==a||t[47]!==e.anchorMs?(i=We(e.anchorMs,a),t[46]=a,t[47]=e.anchorMs,t[48]=i):i=t[48];let o;t[49]!==r.info.anchor||t[50]!==i?(o={label:n,value:i},t[49]=r.info.anchor,t[50]=i,t[51]=o):o=t[51],y.push(o)}}else if(e.kind===`cron`){let n;if(t[52]!==r.info.expression||t[53]!==e.expr?(n={label:r.info.expression,value:e.expr},t[52]=r.info.expression,t[53]=e.expr,t[54]=n):n=t[54],y.push(n),e.tz){let n;t[55]!==r.info.timezone||t[56]!==e.tz?(n={label:r.info.timezone,value:e.tz},t[55]=r.info.timezone,t[56]=e.tz,t[57]=n):n=t[57],y.push(n)}}else{let n;t[58]!==r.info.oneTimeSchedule||t[59]!==e.at?(n={label:r.info.oneTimeSchedule,value:e.at},t[58]=r.info.oneTimeSchedule,t[59]=e.at,t[60]=n):n=t[60],y.push(n)}}else if(n.trigger.kind===`event`){let e;if(t[61]!==n.trigger.eventType||t[62]!==r.info.eventType?(e={label:r.info.eventType,value:n.trigger.eventType},t[61]=n.trigger.eventType,t[62]=r.info.eventType,t[63]=e):e=t[63],y.push(e),n.trigger.source){let e;t[64]!==n.trigger.source||t[65]!==r.info.eventSource?(e={label:r.info.eventSource,value:n.trigger.source},t[64]=n.trigger.source,t[65]=r.info.eventSource,t[66]=e):e=t[66],y.push(e)}}else if(n.trigger.kind===`webhook`&&n.trigger.secretId){let e;t[67]!==n.trigger.secretId||t[68]!==r.info.webhookSecret?(e={label:r.info.webhookSecret,value:n.trigger.secretId},t[67]=n.trigger.secretId,t[68]=r.info.webhookSecret,t[69]=e):e=t[69],y.push(e)}t[22]=n.trigger.eventType,t[23]=n.trigger.kind,t[24]=n.trigger.schedule,t[25]=n.trigger.secretId,t[26]=n.trigger.source,t[27]=r.info.anchor,t[28]=r.info.calendarSchedule,t[29]=r.info.eventSource,t[30]=r.info.eventType,t[31]=r.info.expression,t[32]=r.info.fixedInterval,t[33]=r.info.oneTimeSchedule,t[34]=r.info.rawInterval,t[35]=r.info.scheduleType,t[36]=r.info.timezone,t[37]=r.info.webhookSecret,t[38]=a,t[39]=y}else y=t[39];_=`h-fit overflow-hidden rounded-xl border border-edge-subtle bg-surface-base shadow-surface`,t[70]===r.info.overview?v=t[71]:(v=(0,Z.jsx)(`div`,{className:`border-b border-edge-subtle px-4 py-3`,children:(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.info.overview})}),t[70]=r.info.overview,t[71]=v),m=`grid gap-4 p-4`;let x;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Z.jsx)(oe,{className:`size-4`,"aria-hidden":!0}),t[72]=x):x=t[72];let S=r.info.schedule,C;t[73]!==n.trigger||t[74]!==i||t[75]!==r||t[76]!==a?(C=Je(n.trigger,r,i,a),t[73]=n.trigger,t[74]=i,t[75]=r,t[76]=a,t[77]=C):C=t[77];let w=n.enabled?`${r.info.nextRun}:${d}`:d;t[78]!==r.info.schedule||t[79]!==ee||t[80]!==C||t[81]!==w?(h=(0,Z.jsx)(zt,{icon:x,label:S,value:C,description:w,descriptionTitle:ee}),t[78]=r.info.schedule,t[79]=ee,t[80]=C,t[81]=w,t[82]=h):h=t[82];let T;t[83]===n.action.kind?T=t[84]:(T=n.action.kind===`workflow`?(0,Z.jsx)(u,{className:`size-4`,"aria-hidden":!0}):n.action.kind===`browser_automation`?(0,Z.jsx)(R,{className:`size-4`,"aria-hidden":!0}):(0,Z.jsx)(te,{className:`size-4`,"aria-hidden":!0}),t[83]=n.action.kind,t[84]=T);let ne=r.info.action,re;t[85]!==n.action||t[86]!==r?(re=lt(n.action,r),t[85]=n.action,t[86]=r,t[87]=re):re=t[87],t[88]!==r.info.action||t[89]!==T||t[90]!==re?(g=(0,Z.jsx)(zt,{icon:T,label:ne,value:re}),t[88]=r.info.action,t[89]=T,t[90]=re,t[91]=g):g=t[91],s=zt,t[92]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(F,{className:`size-4`,"aria-hidden":!0}),t[92]=c):c=t[92],l=r.info.permission,f=r.safety[e],p=It(e,r),t[0]=n,t[1]=i,t[2]=r,t[3]=a,t[4]=s,t[5]=c,t[6]=l,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=y}else s=t[4],c=t[5],l=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12],v=t[13],y=t[14];let b;t[93]!==s||t[94]!==c||t[95]!==l||t[96]!==f||t[97]!==p?(b=(0,Z.jsx)(s,{icon:c,label:l,value:f,description:p}),t[93]=s,t[94]=c,t[95]=l,t[96]=f,t[97]=p,t[98]=b):b=t[98];let ee;t[99]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Z.jsx)(u,{className:`size-4`,"aria-hidden":!0}),t[99]=ee):ee=t[99];let x;t[100]!==n.projectId||t[101]!==r.info.noProject||t[102]!==o?(x=o.find(e=>e.id===n.projectId)?.name??r.info.noProject,t[100]=n.projectId,t[101]=r.info.noProject,t[102]=o,t[103]=x):x=t[103];let S;t[104]!==r.info.project||t[105]!==x?(S=(0,Z.jsx)(zt,{icon:ee,label:r.info.project,value:x}),t[104]=r.info.project,t[105]=x,t[106]=S):S=t[106];let C;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(d,{className:`size-4`,"aria-hidden":!0}),t[107]=C):C=t[107];let w=n.conversationMode===`continuous`?r.info.continuousConversation:r.info.newConversation,T;t[108]!==r.info.conversation||t[109]!==w?(T=(0,Z.jsx)(zt,{icon:C,label:r.info.conversation,value:w}),t[108]=r.info.conversation,t[109]=w,t[110]=T):T=t[110];let ne;t[111]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Z.jsx)(ce,{className:`size-4`,"aria-hidden":!0}),t[111]=ne):ne=t[111];let re=n.notificationPolicy===`all`?r.info.notifyAll:n.notificationPolicy===`none`?r.info.notifyNone:r.info.notifyAttention,ie;t[112]!==r.info.notifications||t[113]!==re?(ie=(0,Z.jsx)(zt,{icon:ne,label:r.info.notifications,value:re}),t[112]=r.info.notifications,t[113]=re,t[114]=ie):ie=t[114];let E;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(ae,{className:`size-4`,"aria-hidden":!0}),t[115]=E):E=t[115];let D=r.info.lastRun,O;t[116]!==n||t[117]!==r||t[118]!==a?(O=Xe(n,r,a),t[116]=n,t[117]=r,t[118]=a,t[119]=O):O=t[119];let k=n.state.lastRunStatus===`failed`||n.state.lastRunStatus===`timeout`?`danger`:`default`,A;t[120]!==r.info.lastRun||t[121]!==O||t[122]!==k?(A=(0,Z.jsx)(zt,{icon:E,label:D,value:O,valueTone:k}),t[120]=r.info.lastRun,t[121]=O,t[122]=k,t[123]=A):A=t[123];let j;t[124]!==n.state.consecutiveFailures||t[125]!==n.state.lastError||t[126]!==r.dashboard?(j=n.state.consecutiveFailures?(0,Z.jsxs)(`div`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,children:[r.dashboard.failures,`:`,n.state.consecutiveFailures,n.state.lastError?(0,Z.jsx)(`p`,{className:`mt-1 break-words text-xs`,children:n.state.lastError}):null]}):n.state.lastError?(0,Z.jsx)(`p`,{className:`break-words text-sm text-red-700 dark:text-red-300`,children:n.state.lastError}):null,t[124]=n.state.consecutiveFailures,t[125]=n.state.lastError,t[126]=r.dashboard,t[127]=j):j=t[127];let M;t[128]!==r.info.technicalDetails||t[129]!==y?(M=y.length>0?(0,Z.jsxs)(`details`,{className:`group border-t border-edge-subtle pt-3`,children:[(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-2 text-sm text-fg-muted outline-none hover:text-fg focus-visible:ring-2 focus-visible:ring-accent`,children:[(0,Z.jsx)(`span`,{children:r.info.technicalDetails}),(0,Z.jsx)(P,{className:`size-4 transition-transform group-open:rotate-180`,"aria-hidden":!0})]}),(0,Z.jsx)(`div`,{className:`mt-3 grid gap-2`,children:y.map(Rt)})]}):null,t[128]=r.info.technicalDetails,t[129]=y,t[130]=M):M=t[130];let N;t[131]!==b||t[132]!==S||t[133]!==T||t[134]!==ie||t[135]!==A||t[136]!==j||t[137]!==M||t[138]!==m||t[139]!==h||t[140]!==g?(N=(0,Z.jsxs)(`div`,{className:m,children:[h,g,b,S,T,ie,A,j,M]}),t[131]=b,t[132]=S,t[133]=T,t[134]=ie,t[135]=A,t[136]=j,t[137]=M,t[138]=m,t[139]=h,t[140]=g,t[141]=N):N=t[141];let se;return t[142]!==N||t[143]!==_||t[144]!==v?(se=(0,Z.jsxs)(`aside`,{className:_,children:[v,N]}),t[142]=N,t[143]=_,t[144]=v,t[145]=se):se=t[145],se}function Rt(e){return(0,Z.jsxs)(`div`,{className:`grid gap-0.5`,children:[(0,Z.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:e.label}),(0,Z.jsx)(`span`,{className:`break-all font-mono text-xs text-fg-muted`,children:e.value})]},`${e.label}:${e.value}`)}function zt(e){let t=(0,be.c)(19),{icon:n,label:r,value:i,description:a,descriptionTitle:o,valueTone:s}=e,c=s===void 0?`default`:s,l;t[0]===n?l=t[1]:(l=(0,Z.jsx)(`span`,{className:`mt-0.5 text-fg-subtle`,children:n}),t[0]=n,t[1]=l);let u;t[2]===r?u=t[3]:(u=(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r}),t[2]=r,t[3]=u);let d=c===`danger`?`text-red-700 dark:text-red-300`:`text-fg`,f;t[4]===d?f=t[5]:(f=m(`mt-1 text-sm font-medium leading-5`,d),t[4]=d,t[5]=f);let p;t[6]!==f||t[7]!==i?(p=(0,Z.jsx)(`div`,{className:f,children:i}),t[6]=f,t[7]=i,t[8]=p):p=t[8];let h;t[9]!==a||t[10]!==o?(h=a?(0,Z.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,title:o,children:a}):null,t[9]=a,t[10]=o,t[11]=h):h=t[11];let g;t[12]!==u||t[13]!==p||t[14]!==h?(g=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[u,p,h]}),t[12]=u,t[13]=p,t[14]=h,t[15]=g):g=t[15];let _;return t[16]!==l||t[17]!==g?(_=(0,Z.jsxs)(`div`,{className:`grid grid-cols-[1.25rem_1fr] gap-2.5`,children:[l,g]}),t[16]=l,t[17]=g,t[18]=_):_=t[18],_}function Bt(e){let t=(0,be.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:`grid grid-cols-[5rem_1fr] gap-2`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Vt(e){return e.endsWith(`.failed`)?`bg-red-500`:e.endsWith(`.completed`)?`bg-emerald-500`:e.endsWith(`.started`)?`bg-blue-500`:`bg-fg-muted`}function Ht(e){let t=(0,be.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`div`,{className:`text-xs font-medium uppercase text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Z.jsx)(`div`,{className:`mt-1 truncate text-sm text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Ut(e){let t=(0,be.c)(8),{className:n,icon:r,title:i}=e,a;t[0]===n?a=t[1]:(a=m(`flex min-h-48 flex-col items-center justify-center text-fg-muted`,n),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=(0,Z.jsx)(`div`,{className:`mt-2 text-sm`,children:i}),t[2]=i,t[3]=o);let s;return t[4]!==r||t[5]!==a||t[6]!==o?(s=(0,Z.jsxs)(`div`,{className:a,children:[r,o]}),t[4]=r,t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Wt(e){let t=(0,be.c)(274),{form:n,labels:r,setForm:i,projects:a,workflowDefinitions:c,selectedWorkflow:l,workflowsLoading:u,browserAutomations:d,selectedBrowserAutomation:f,browserAutomationsLoading:p,agentOptions:h,agentsLoading:_,language:v,projectLocked:y}=e,b=y===void 0?!1:y,ee=g(v).agentsSettings,x;t[0]===i?x=t[1]:(x=e=>i(t=>({...t,...e})),t[0]=i,t[1]=x);let S=x,C=Be(n.intervalValue,n.intervalUnit),w=Date.now(),T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T=[1,2,3],t[2]=T):T=t[2];let te;t[3]!==C||t[4]!==w||t[5]!==v?(te=T.map(e=>Ke(w+C*e,v,w)),t[3]=C,t[4]=w,t[5]=v,t[6]=te):te=t[6];let ne=te,re,ie;t[7]!==n.actionMode||t[8]!==n.workflowId||t[9]!==i||t[10]!==c?(re=()=>{if(n.actionMode!==`workflow`||n.workflowId.trim())return;let e=c[0]?.id;e&&i(t=>({...t,workflowId:e,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}))},ie=[n.actionMode,n.workflowId,i,c],t[7]=n.actionMode,t[8]=n.workflowId,t[9]=i,t[10]=c,t[11]=re,t[12]=ie):(re=t[11],ie=t[12]),(0,q.useEffect)(re,ie);let E,D;t[13]!==d||t[14]!==n.actionMode||t[15]!==n.browserAutomationId||t[16]!==i?(E=()=>{if(n.actionMode!==`browser_automation`||n.browserAutomationId.trim())return;let e=d[0];e&&i(t=>({...t,browserAutomationId:e.id,browserAutomationInputs:ye(e)}))},D=[d,n.actionMode,n.browserAutomationId,i],t[13]=d,t[14]=n.actionMode,t[15]=n.browserAutomationId,t[16]=i,t[17]=E,t[18]=D):(E=t[17],D=t[18]),(0,q.useEffect)(E,D);let ae;t[19]===S?ae=t[20]:(ae=e=>S({name:e.target.value}),t[19]=S,t[20]=ae);let O;t[21]!==n.name||t[22]!==ae?(O=(0,Z.jsx)(`input`,{className:Q,value:n.name,onChange:ae}),t[21]=n.name,t[22]=ae,t[23]=O):O=t[23];let k;t[24]!==r.form.name||t[25]!==O?(k=(0,Z.jsx)($,{label:r.form.name,children:O}),t[24]=r.form.name,t[25]=O,t[26]=k):k=t[26];let oe;t[27]===S?oe=t[28]:(oe=e=>S({description:e.target.value}),t[27]=S,t[28]=oe);let A;t[29]!==n.description||t[30]!==oe?(A=(0,Z.jsx)(`input`,{className:Q,value:n.description,onChange:oe}),t[29]=n.description,t[30]=oe,t[31]=A):A=t[31];let j;t[32]!==r.form.description||t[33]!==A?(j=(0,Z.jsx)($,{label:r.form.description,children:A}),t[32]=r.form.description,t[33]=A,t[34]=j):j=t[34];let M;t[35]!==n.projectId||t[36]!==r.form.noProject||t[37]!==r.form.project||t[38]!==b||t[39]!==a||t[40]!==S?(M=b?null:(0,Z.jsx)($,{label:r.form.project,children:(0,Z.jsxs)(o,{className:Q,value:n.projectId,onChange:e=>S({projectId:e.target.value}),children:[(0,Z.jsx)(s,{value:``,children:r.form.noProject}),a.map(qt)]})}),t[35]=n.projectId,t[36]=r.form.noProject,t[37]=r.form.project,t[38]=b,t[39]=a,t[40]=S,t[41]=M):M=t[41];let N;t[42]===r.form.trigger?N=t[43]:(N=(0,Z.jsx)(Jt,{title:r.form.trigger}),t[42]=r.form.trigger,t[43]=N);let se;t[44]===S?se=t[45]:(se=e=>S({triggerMode:e.target.value}),t[44]=S,t[45]=se);let ce;t[46]===r.trigger.manual?ce=t[47]:(ce=(0,Z.jsx)(s,{value:`manual`,children:r.trigger.manual}),t[46]=r.trigger.manual,t[47]=ce);let le;t[48]===r.trigger.once?le=t[49]:(le=(0,Z.jsx)(s,{value:`once`,children:r.trigger.once}),t[48]=r.trigger.once,t[49]=le);let ue;t[50]===r.trigger.daily?ue=t[51]:(ue=(0,Z.jsx)(s,{value:`daily`,children:r.trigger.daily}),t[50]=r.trigger.daily,t[51]=ue);let F;t[52]===r.trigger.weekly?F=t[53]:(F=(0,Z.jsx)(s,{value:`weekly`,children:r.trigger.weekly}),t[52]=r.trigger.weekly,t[53]=F);let I;t[54]===r.trigger.interval?I=t[55]:(I=(0,Z.jsx)(s,{value:`interval`,children:r.trigger.interval}),t[54]=r.trigger.interval,t[55]=I);let L;t[56]===r.trigger.customCron?L=t[57]:(L=(0,Z.jsx)(s,{value:`cron`,children:r.trigger.customCron}),t[56]=r.trigger.customCron,t[57]=L);let R;t[58]===r.trigger.webhook?R=t[59]:(R=(0,Z.jsx)(s,{value:`webhook`,children:r.trigger.webhook}),t[58]=r.trigger.webhook,t[59]=R);let z;t[60]===r.trigger.taskBlocked?z=t[61]:(z=(0,Z.jsx)(s,{value:`taskBlocked`,children:r.trigger.taskBlocked}),t[60]=r.trigger.taskBlocked,t[61]=z);let B;t[62]===r.trigger.noteCreated?B=t[63]:(B=(0,Z.jsx)(s,{value:`noteCreated`,children:r.trigger.noteCreated}),t[62]=r.trigger.noteCreated,t[63]=B);let fe;t[64]===r.trigger.workflowFailed?fe=t[65]:(fe=(0,Z.jsx)(s,{value:`workflowFailed`,children:r.trigger.workflowFailed}),t[64]=r.trigger.workflowFailed,t[65]=fe);let V;t[66]===r.trigger.sessionUpdated?V=t[67]:(V=(0,Z.jsx)(s,{value:`sessionUpdated`,children:r.trigger.sessionUpdated}),t[66]=r.trigger.sessionUpdated,t[67]=V);let H;t[68]===r.trigger.customEvent?H=t[69]:(H=(0,Z.jsx)(s,{value:`event`,children:r.trigger.customEvent}),t[68]=r.trigger.customEvent,t[69]=H);let W;t[70]!==n.triggerMode||t[71]!==se||t[72]!==ce||t[73]!==le||t[74]!==ue||t[75]!==F||t[76]!==I||t[77]!==L||t[78]!==R||t[79]!==z||t[80]!==B||t[81]!==fe||t[82]!==V||t[83]!==H?(W=(0,Z.jsxs)(o,{className:Q,value:n.triggerMode,onChange:se,children:[ce,le,ue,F,I,L,R,z,B,fe,V,H]}),t[70]=n.triggerMode,t[71]=se,t[72]=ce,t[73]=le,t[74]=ue,t[75]=F,t[76]=I,t[77]=L,t[78]=R,t[79]=z,t[80]=B,t[81]=fe,t[82]=V,t[83]=H,t[84]=W):W=t[84];let pe;t[85]!==n.onceAt||t[86]!==n.triggerMode||t[87]!==r.form.onceAt||t[88]!==S?(pe=n.triggerMode===`once`?(0,Z.jsx)($,{label:r.form.onceAt,children:(0,Z.jsx)(`input`,{className:Q,type:`datetime-local`,value:n.onceAt,onChange:e=>S({onceAt:e.target.value})})}):null,t[85]=n.onceAt,t[86]=n.triggerMode,t[87]=r.form.onceAt,t[88]=S,t[89]=pe):pe=t[89];let me;t[90]!==n.time||t[91]!==n.triggerMode||t[92]!==n.weekday||t[93]!==r.form.day||t[94]!==r.form.time||t[95]!==r.weekdays||t[96]!==S?(me=n.triggerMode===`daily`||n.triggerMode===`weekly`?(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)($,{label:r.form.time,children:(0,Z.jsx)(U,{value:n.time,onChange:e=>S({time:e}),ariaLabel:r.form.time})}),n.triggerMode===`weekly`?(0,Z.jsx)($,{label:r.form.day,children:(0,Z.jsxs)(o,{className:Q,value:n.weekday,onChange:e=>S({weekday:e.target.value}),children:[(0,Z.jsx)(s,{value:`1`,children:r.weekdays.monday}),(0,Z.jsx)(s,{value:`2`,children:r.weekdays.tuesday}),(0,Z.jsx)(s,{value:`3`,children:r.weekdays.wednesday}),(0,Z.jsx)(s,{value:`4`,children:r.weekdays.thursday}),(0,Z.jsx)(s,{value:`5`,children:r.weekdays.friday}),(0,Z.jsx)(s,{value:`6`,children:r.weekdays.saturday}),(0,Z.jsx)(s,{value:`0`,children:r.weekdays.sunday})]})}):null]}):null,t[90]=n.time,t[91]=n.triggerMode,t[92]=n.weekday,t[93]=r.form.day,t[94]=r.form.time,t[95]=r.weekdays,t[96]=S,t[97]=me):me=t[97];let he=n.triggerMode===`interval`?(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge-subtle bg-surface-base p-3`,children:[(0,Z.jsx)($,{label:r.form.intervalEvery,children:(0,Z.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,Z.jsx)(`input`,{className:Q,type:`number`,min:6e4/Be(1,n.intervalUnit),step:`any`,inputMode:`decimal`,value:n.intervalValue,onChange:e=>S({intervalValue:e.target.value})}),(0,Z.jsxs)(o,{className:Q,value:n.intervalUnit,onChange:e=>{let t=e.target.value;S({intervalValue:Ve(n.intervalValue,n.intervalUnit,t),intervalUnit:t})},children:[(0,Z.jsx)(s,{value:`minute`,children:r.form.intervalUnits.minute}),(0,Z.jsx)(s,{value:`hour`,children:r.form.intervalUnits.hour}),(0,Z.jsx)(s,{value:`day`,children:r.form.intervalUnits.day}),(0,Z.jsx)(s,{value:`week`,children:r.form.intervalUnits.week})]})]})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.form.commonIntervals}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Qe.map(e=>{let t=Be(e.value,e.unit),n=t===C;return(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":n,className:m(`rounded-full border px-2.5 py-1 text-xs transition-colors`,n?`border-accent bg-accent/10 text-accent`:`border-edge-subtle text-fg-muted hover:border-edge hover:bg-surface-hover hover:text-fg`),onClick:()=>S({intervalValue:e.value,intervalUnit:e.unit}),children:He(t,v)},`${e.value}:${e.unit}`)})})]}),(0,Z.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5`,children:[(0,Z.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:Ue(C,v)}),(0,Z.jsxs)(`div`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:[r.form.nextThreeRuns,`:`,ne.join(v===`zh`?`、`:`, `)]}),(0,Z.jsx)(`div`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:r.form.fixedIntervalHint})]})]}):null,_e;t[98]!==n.cronExpr||t[99]!==n.triggerMode||t[100]!==r.form.expression||t[101]!==S?(_e=n.triggerMode===`cron`?(0,Z.jsx)($,{label:r.form.expression,children:(0,Z.jsx)(`input`,{className:Q,value:n.cronExpr,onChange:e=>S({cronExpr:e.target.value})})}):null,t[98]=n.cronExpr,t[99]=n.triggerMode,t[100]=r.form.expression,t[101]=S,t[102]=_e):_e=t[102];let ve;t[103]!==n.triggerMode||t[104]!==n.webhookSecretId||t[105]!==r.form.secretId||t[106]!==S?(ve=n.triggerMode===`webhook`?(0,Z.jsx)($,{label:r.form.secretId,children:(0,Z.jsx)(`input`,{className:Q,value:n.webhookSecretId,onChange:e=>S({webhookSecretId:e.target.value})})}):null,t[103]=n.triggerMode,t[104]=n.webhookSecretId,t[105]=r.form.secretId,t[106]=S,t[107]=ve):ve=t[107];let xe;t[108]!==n.eventPayloadMatch||t[109]!==n.eventSource||t[110]!==n.eventType||t[111]!==n.triggerMode||t[112]!==r.form.eventPayloadMatch||t[113]!==r.form.eventSource||t[114]!==r.form.eventType||t[115]!==r.form.invalidJsonObject||t[116]!==S?(xe=n.triggerMode===`event`?(0,Z.jsxs)(`div`,{className:`grid gap-3 rounded-lg border border-edge-subtle bg-surface-base p-3`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsx)($,{label:r.form.eventType,children:(0,Z.jsx)(`input`,{className:Q,value:n.eventType,onChange:e=>S({eventType:e.target.value})})}),(0,Z.jsx)($,{label:r.form.eventSource,children:(0,Z.jsx)(`input`,{className:Q,value:n.eventSource,onChange:e=>S({eventSource:e.target.value})})})]}),(0,Z.jsxs)($,{label:r.form.eventPayloadMatch,children:[(0,Z.jsx)(`textarea`,{className:m(Q,`min-h-24 resize-y font-mono text-xs`),value:n.eventPayloadMatch,onChange:e=>S({eventPayloadMatch:e.target.value}),placeholder:`{
|
|
5
|
-
"status": "blocked"
|
|
6
|
-
}`}),at(n.eventPayloadMatch)?null:(0,Z.jsx)(`span`,{className:`text-xs text-red-700 dark:text-red-300`,children:r.form.invalidJsonObject})]})]}):null,t[108]=n.eventPayloadMatch,t[109]=n.eventSource,t[110]=n.eventType,t[111]=n.triggerMode,t[112]=r.form.eventPayloadMatch,t[113]=r.form.eventSource,t[114]=r.form.eventType,t[115]=r.form.invalidJsonObject,t[116]=S,t[117]=xe):xe=t[117];let J;t[118]===r.form.action?J=t[119]:(J=(0,Z.jsx)(Jt,{title:r.form.action}),t[118]=r.form.action,t[119]=J);let Se;t[120]!==n.timeoutSeconds||t[121]!==n.workflowId||t[122]!==S||t[123]!==c?(Se=e=>{let t=e.target.value,r=Number.parseInt(n.timeoutSeconds,10);S({actionMode:t,...r===600||r===1800?{timeoutSeconds:t===`browser_automation`?`600`:`1800`}:{},...t===`browser_automation`?{safetyMode:`auto_apply`}:{},...t===`workflow`&&!n.workflowId.trim()&&c[0]?{workflowId:c[0].id,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}:{}})},t[120]=n.timeoutSeconds,t[121]=n.workflowId,t[122]=S,t[123]=c,t[124]=Se):Se=t[124];let Ce;t[125]===r.action.runAgent?Ce=t[126]:(Ce=(0,Z.jsx)(s,{value:`agent`,children:r.action.runAgent}),t[125]=r.action.runAgent,t[126]=Ce);let we;t[127]===r.action.runWorkflow?we=t[128]:(we=(0,Z.jsx)(s,{value:`workflow`,children:r.action.runWorkflow}),t[127]=r.action.runWorkflow,t[128]=we);let Te=v===`zh`?`浏览器自动化`:`Browser automation`,Ee;t[129]===Te?Ee=t[130]:(Ee=(0,Z.jsx)(s,{value:`browser_automation`,children:Te}),t[129]=Te,t[130]=Ee);let De;t[131]!==n.actionMode||t[132]!==Se||t[133]!==Ce||t[134]!==we||t[135]!==Ee?(De=(0,Z.jsxs)(o,{className:Q,value:n.actionMode,onChange:Se,children:[Ce,we,Ee]}),t[131]=n.actionMode,t[132]=Se,t[133]=Ce,t[134]=we,t[135]=Ee,t[136]=De):De=t[136];let Oe=n.actionMode===`browser_automation`?null:(0,Z.jsx)($,{label:r.form.agent,children:(0,Z.jsxs)(o,{className:Q,value:n.agentId,onChange:e=>S({agentId:e.target.value}),children:[(0,Z.jsx)(s,{value:``,children:_?r.form.loadingAgents:r.form.defaultAgent}),h.map(e=>(0,Z.jsx)(s,{value:e.id,children:de(e,ee)},e.id))]})}),ke;t[137]!==d||t[138]!==p||t[139]!==n.actionMode||t[140]!==n.agentId||t[141]!==n.browserAutomationId||t[142]!==n.browserAutomationInputs||t[143]!==n.description||t[144]!==n.instruction||t[145]!==n.name||t[146]!==n.triggerMode||t[147]!==n.workflowId||t[148]!==n.workflowInput||t[149]!==r.form.instruction||t[150]!==r.form.loadingWorkflows||t[151]!==r.form.noWorkflows||t[152]!==r.form.triggeredRun||t[153]!==r.form.workflow||t[154]!==v||t[155]!==f||t[156]!==l||t[157]!==S||t[158]!==c||t[159]!==u?(ke=n.actionMode===`agent`?(0,Z.jsxs)($,{label:r.form.instruction,children:[(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(G,{value:n.instruction,onApply:e=>S({instruction:e}),fieldId:`automation.instruction`,fieldLabel:r.form.instruction,scenario:`automation.instruction`,locale:v,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,agentId:n.agentId},showLabel:!1})}),(0,Z.jsx)(`textarea`,{className:m(Q,`min-h-32 resize-y`),value:n.instruction,onChange:e=>S({instruction:e.target.value})})]}):n.actionMode===`workflow`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:r.form.workflow,children:(0,Z.jsxs)(o,{className:Q,value:n.workflowId,onChange:e=>S({workflowId:e.target.value,workflowGoal:``,workflowInput:{goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``},workflowInputValid:!0}),disabled:u||c.length===0,children:[u?(0,Z.jsx)(s,{value:``,children:r.form.loadingWorkflows}):null,!u&&c.length===0?(0,Z.jsx)(s,{value:``,children:r.form.noWorkflows}):null,c.map(Kt)]})}),l?(0,Z.jsx)(ge,{definition:l,language:v,value:n.workflowInput,onChange:e=>S({workflowInput:e,workflowGoal:e.goal,workflowInputValid:!0}),mode:`automation`,badgeLabel:r.form.triggeredRun,onValidityChange:e=>S({workflowInputValid:e.valid}),aiAssist:{inputScenario:`automation.workflowInput`,goalScenario:`automation.workflowGoal`,context:{automationName:n.name,automationDescription:n.description,triggerMode:n.triggerMode,workflowId:l.id,workflowTitle:l.title,workflowDescription:l.description}},inputClassName:`rounded-lg`}):null]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:v===`zh`?`浏览器自动化`:`Browser automation`,children:(0,Z.jsxs)(o,{className:Q,value:n.browserAutomationId,onChange:e=>{let t=d.find(t=>t.id===e.target.value);S({browserAutomationId:e.target.value,browserAutomationInputs:t?ye(t):{}})},disabled:p||d.length===0,children:[d.length===0?(0,Z.jsx)(s,{value:``,children:v===`zh`?`没有已启用的浏览器自动化`:`No enabled browser automations`}):null,d.map(Gt)]})}),f&&Object.keys(f.inputs).length>0?(0,Z.jsx)($,{label:v===`zh`?`运行时填写`:`Run inputs`,children:(0,Z.jsx)(K,{automation:f,values:n.browserAutomationInputs,language:v,onChange:e=>S({browserAutomationInputs:e})})}):null]}),t[137]=d,t[138]=p,t[139]=n.actionMode,t[140]=n.agentId,t[141]=n.browserAutomationId,t[142]=n.browserAutomationInputs,t[143]=n.description,t[144]=n.instruction,t[145]=n.name,t[146]=n.triggerMode,t[147]=n.workflowId,t[148]=n.workflowInput,t[149]=r.form.instruction,t[150]=r.form.loadingWorkflows,t[151]=r.form.noWorkflows,t[152]=r.form.triggeredRun,t[153]=r.form.workflow,t[154]=v,t[155]=f,t[156]=l,t[157]=S,t[158]=c,t[159]=u,t[160]=ke):ke=t[160];let Y;t[161]===r.form.advancedDescription?Y=t[162]:(Y=(0,Z.jsx)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:r.form.advancedDescription}),t[161]=r.form.advancedDescription,t[162]=Y);let X;t[163]!==r.form.advanced||t[164]!==Y?(X=(0,Z.jsxs)(`span`,{children:[r.form.advanced,Y]}),t[163]=r.form.advanced,t[164]=Y,t[165]=X):X=t[165];let Ae;t[166]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,Z.jsx)(P,{className:`size-4 transition-transform group-open:rotate-180`}),t[166]=Ae):Ae=t[166];let je;t[167]===X?je=t[168]:(je=(0,Z.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-4 py-3 text-sm font-semibold text-fg outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[X,Ae]}),t[167]=X,t[168]=je);let Me;t[169]!==n.actionMode||t[170]!==n.safetyMode||t[171]!==r.form.safety||t[172]!==r.safety||t[173]!==S?(Me=n.actionMode===`browser_automation`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Jt,{title:r.form.safety}),(0,Z.jsxs)($,{label:r.form.safety,children:[(0,Z.jsxs)(o,{className:Q,value:n.safetyMode,onChange:e=>{let t=e.target.value;S({safetyMode:t})},children:[(0,Z.jsx)(s,{value:`suggest_only`,children:r.safety.suggest_only}),(0,Z.jsx)(s,{value:`ask_before_apply`,children:r.safety.ask_before_apply}),(0,Z.jsx)(s,{value:`auto_apply`,children:r.safety.auto_apply})]}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.safetyMode===`suggest_only`?r.safety.suggestOnlyDescription:n.safetyMode===`ask_before_apply`?r.safety.askBeforeApplyDescription:r.safety.autoApplyDescription})]})]}),t[169]=n.actionMode,t[170]=n.safetyMode,t[171]=r.form.safety,t[172]=r.safety,t[173]=S,t[174]=Me):Me=t[174];let Ne;t[175]===r.form.results?Ne=t[176]:(Ne=(0,Z.jsx)(Jt,{title:r.form.results}),t[175]=r.form.results,t[176]=Ne);let Pe;t[177]===S?Pe=t[178]:(Pe=e=>S({conversationMode:e.target.value}),t[177]=S,t[178]=Pe);let Fe;t[179]===r.form.newConversation?Fe=t[180]:(Fe=(0,Z.jsx)(s,{value:`new_session`,children:r.form.newConversation}),t[179]=r.form.newConversation,t[180]=Fe);let Ie;t[181]===r.form.continuousConversation?Ie=t[182]:(Ie=(0,Z.jsx)(s,{value:`continuous`,children:r.form.continuousConversation}),t[181]=r.form.continuousConversation,t[182]=Ie);let Le;t[183]!==n.conversationMode||t[184]!==Pe||t[185]!==Fe||t[186]!==Ie?(Le=(0,Z.jsxs)(o,{className:Q,value:n.conversationMode,onChange:Pe,children:[Fe,Ie]}),t[183]=n.conversationMode,t[184]=Pe,t[185]=Fe,t[186]=Ie,t[187]=Le):Le=t[187];let Re;t[188]!==r.form.conversation||t[189]!==Le?(Re=(0,Z.jsx)($,{label:r.form.conversation,children:Le}),t[188]=r.form.conversation,t[189]=Le,t[190]=Re):Re=t[190];let ze;t[191]===S?ze=t[192]:(ze=e=>S({notificationPolicy:e.target.value}),t[191]=S,t[192]=ze);let We;t[193]===r.form.notifyAttention?We=t[194]:(We=(0,Z.jsx)(s,{value:`attention`,children:r.form.notifyAttention}),t[193]=r.form.notifyAttention,t[194]=We);let Ge;t[195]===r.form.notifyAll?Ge=t[196]:(Ge=(0,Z.jsx)(s,{value:`all`,children:r.form.notifyAll}),t[195]=r.form.notifyAll,t[196]=Ge);let qe;t[197]===r.form.notifyNone?qe=t[198]:(qe=(0,Z.jsx)(s,{value:`none`,children:r.form.notifyNone}),t[197]=r.form.notifyNone,t[198]=qe);let Je;t[199]!==n.notificationPolicy||t[200]!==ze||t[201]!==We||t[202]!==Ge||t[203]!==qe?(Je=(0,Z.jsxs)(o,{className:Q,value:n.notificationPolicy,onChange:ze,children:[We,Ge,qe]}),t[199]=n.notificationPolicy,t[200]=ze,t[201]=We,t[202]=Ge,t[203]=qe,t[204]=Je):Je=t[204];let Ye;t[205]!==r.form.notifications||t[206]!==Je?(Ye=(0,Z.jsx)($,{label:r.form.notifications,children:Je}),t[205]=r.form.notifications,t[206]=Je,t[207]=Ye):Ye=t[207];let Xe;t[208]!==n.completionWebhookUrl||t[209]!==n.safetyMode||t[210]!==r.form.completionWebhook||t[211]!==S?(Xe=n.safetyMode===`auto_apply`?(0,Z.jsx)($,{label:r.form.completionWebhook,children:(0,Z.jsx)(`input`,{className:Q,value:n.completionWebhookUrl,onChange:e=>S({completionWebhookUrl:e.target.value})})}):null,t[208]=n.completionWebhookUrl,t[209]=n.safetyMode,t[210]=r.form.completionWebhook,t[211]=S,t[212]=Xe):Xe=t[212];let Ze;t[213]===r.form.reliability?Ze=t[214]:(Ze=(0,Z.jsx)(Jt,{title:r.form.reliability}),t[213]=r.form.reliability,t[214]=Ze);let $e;t[215]===S?$e=t[216]:($e=e=>S({timeoutSeconds:e.target.value}),t[215]=S,t[216]=$e);let et;t[217]!==n.timeoutSeconds||t[218]!==$e?(et=(0,Z.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.timeoutSeconds,onChange:$e}),t[217]=n.timeoutSeconds,t[218]=$e,t[219]=et):et=t[219];let tt;t[220]!==r.form.timeoutSeconds||t[221]!==et?(tt=(0,Z.jsx)($,{label:r.form.timeoutSeconds,children:et}),t[220]=r.form.timeoutSeconds,t[221]=et,t[222]=tt):tt=t[222];let nt;t[223]===S?nt=t[224]:(nt=e=>S({disableAfterFailures:e.target.value}),t[223]=S,t[224]=nt);let rt;t[225]!==n.disableAfterFailures||t[226]!==nt?(rt=(0,Z.jsx)(`input`,{className:Q,inputMode:`numeric`,value:n.disableAfterFailures,onChange:nt}),t[225]=n.disableAfterFailures,t[226]=nt,t[227]=rt):rt=t[227];let it;t[228]!==r.form.disableAfterFailures||t[229]!==rt?(it=(0,Z.jsx)($,{label:r.form.disableAfterFailures,children:rt}),t[228]=r.form.disableAfterFailures,t[229]=rt,t[230]=it):it=t[230];let ot;t[231]!==tt||t[232]!==it?(ot=(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[tt,it]}),t[231]=tt,t[232]=it,t[233]=ot):ot=t[233];let st;t[234]===r.form.effectivePolicy?st=t[235]:(st=(0,Z.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:r.form.effectivePolicy}),t[234]=r.form.effectivePolicy,t[235]=st);let ct=n.timeoutSeconds||`—`,lt;t[236]!==r.form.executionDeadline||t[237]!==ct?(lt=(0,Z.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[r.form.executionDeadline,`: `,ct,`s`]}),t[236]=r.form.executionDeadline,t[237]=ct,t[238]=lt):lt=t[238];let ut;t[239]===r.form.downstreamTimeoutHint?ut=t[240]:(ut=(0,Z.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-fg-subtle`,children:r.form.downstreamTimeoutHint}),t[239]=r.form.downstreamTimeoutHint,t[240]=ut);let dt;t[241]!==st||t[242]!==lt||t[243]!==ut?(dt=(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge bg-surface-muted/40 px-3 py-2.5`,children:[st,lt,ut]}),t[241]=st,t[242]=lt,t[243]=ut,t[244]=dt):dt=t[244];let ft;t[245]!==Me||t[246]!==Ne||t[247]!==Re||t[248]!==Ye||t[249]!==Xe||t[250]!==Ze||t[251]!==ot||t[252]!==dt?(ft=(0,Z.jsxs)(`div`,{className:`grid gap-4 border-t border-edge-subtle p-4`,children:[Me,Ne,Re,Ye,Xe,Ze,ot,dt]}),t[245]=Me,t[246]=Ne,t[247]=Re,t[248]=Ye,t[249]=Xe,t[250]=Ze,t[251]=ot,t[252]=dt,t[253]=ft):ft=t[253];let pt;t[254]!==je||t[255]!==ft?(pt=(0,Z.jsxs)(`details`,{className:`group rounded-xl border border-edge-subtle bg-surface-base`,children:[je,ft]}),t[254]=je,t[255]=ft,t[256]=pt):pt=t[256];let mt;return t[257]!==k||t[258]!==j||t[259]!==M||t[260]!==N||t[261]!==W||t[262]!==pe||t[263]!==me||t[264]!==he||t[265]!==_e||t[266]!==ve||t[267]!==xe||t[268]!==J||t[269]!==De||t[270]!==Oe||t[271]!==ke||t[272]!==pt?(mt=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,Z.jsxs)(`div`,{className:`grid gap-4`,children:[k,j,M,N,W,pe,me,he,_e,ve,xe,J,De,Oe,ke,pt]})}),t[257]=k,t[258]=j,t[259]=M,t[260]=N,t[261]=W,t[262]=pe,t[263]=me,t[264]=he,t[265]=_e,t[266]=ve,t[267]=xe,t[268]=J,t[269]=De,t[270]=Oe,t[271]=ke,t[272]=pt,t[273]=mt):mt=t[273],mt}function Gt(e){return(0,Z.jsx)(s,{value:e.id,children:e.name},e.id)}function Kt(e){return(0,Z.jsx)(s,{value:e.id,children:e.title||e.name},e.id)}function qt(e){return(0,Z.jsx)(s,{value:e.id,children:e.name},e.id)}var Q=`min-h-11 w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-base sm:min-h-0 sm:text-sm text-fg outline-none focus:border-accent`;function $(e){let t=(0,be.c)(5),{label:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,Z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;return t[2]!==r||t[3]!==i?(a=(0,Z.jsxs)(`div`,{className:`grid gap-1.5`,children:[i,r]}),t[2]=r,t[3]=i,t[4]=a):a=t[4],a}function Jt(e){let t=(0,be.c)(3),{title:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Z.jsx)(u,{className:`size-4 text-fg-muted`}),t[0]=r):r=t[0];let i;return t[1]===n?i=t[2]:(i=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 pt-2 text-sm font-semibold text-fg`,children:[r,n]}),t[1]=n,t[2]=i),i}export{wt as t};
|