@xopcai/xopc 0.0.392 → 0.0.393
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CZmaQbC9.js → agent-avatar-dicebear-1AF2KGju.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CPJr7NRR.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-cjJXJj_3.js +1 -0
- package/dist/gateway/static/root/assets/agents-DW3TlnIg.js +77 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-znm6_dW_.js → agents-admin-api-B5aykqg_.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-B_MFhXXU.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-TYGidVnd.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-DOkyvOF0.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-dSkmoISk.js → archive-plugin-BrFfEp0u.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DhWRn0dZ.js → automations-page-B7OofUPF.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-DIod-bfm.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BJlZrYym.js → binary-plugins-BfAWnYG8.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-OHBssIfN.js → block-editor-_Y-QwZ-3.js} +5 -5
- package/dist/gateway/static/root/assets/browser-automation-inputs-DH9QHI9m.js +1 -0
- package/dist/gateway/static/root/assets/browser-automations-page-B_SnD9B0.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-BPlqYpMM.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-page-BtzZvMIK.js +2 -0
- package/dist/gateway/static/root/assets/{capabilities-CgDteXZH.js → capabilities-pt2M56-E.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-WzoG3oBb.js +8 -0
- package/dist/gateway/static/root/assets/capability-header-actions-CFVx3iaZ.js +1 -0
- package/dist/gateway/static/root/assets/channels-BXA55GY2.js +1 -0
- package/dist/gateway/static/root/assets/chat-terminal-dock-D3GuiG3N.js +36 -0
- package/dist/gateway/static/root/assets/computer-settings-page-CIbHDlp8.js +1 -0
- package/dist/gateway/static/root/assets/connector-service-page-CDyCHkpK.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-DA2b6cJu.js +1 -0
- package/dist/gateway/static/root/assets/date-picker-C424c_g9.js +1 -0
- package/dist/gateway/static/root/assets/dependency-picker-BVJh9sYc.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-Q52A8vjp.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-settings-CZr1CXxu.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-sprite-Bd-aOI7N.js +30 -0
- package/dist/gateway/static/root/assets/desktop-pet-sprite-BuB0g8zv.css +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-D_WWTsze.js +1 -0
- package/dist/gateway/static/root/assets/directory-picker-path-field-C6cUgrvg.js +1 -0
- package/dist/gateway/static/root/assets/extension-debug-page-DyyfC4gA.js +1 -0
- package/dist/gateway/static/root/assets/extension-page-Dho9o3ZZ.js +1 -0
- package/dist/gateway/static/root/assets/extension-settings-page-CdnIGyCH.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-BM__9Fws.js → gateway-config-swr-BEePO3Wl.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-DS_GDx-x.js → gateway-realtime-Dng_VOvI.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-DtlBf7oH.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-D0KSQRNZ.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DosoyMIH.js → gateway-startup-retry-CDCiy7Cd.js} +1 -1
- package/dist/gateway/static/root/assets/{highlighted-body-KQOG7T2V-BYHXWIfK.js → highlighted-body-KQOG7T2V-BNpj_mIM.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-CH_A0W29.js +2 -0
- package/dist/gateway/static/root/assets/image-generation-api-DwkO2y46.js +1 -0
- package/dist/gateway/static/root/assets/imports-page-BrYvomnU.js +1 -0
- package/dist/gateway/static/root/assets/index-CKdOZoVu.js +260 -0
- package/dist/gateway/static/root/assets/index-Rxjt-jc3.css +1 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-BveDYfYk.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-CcIi1BhT.js +1 -0
- package/dist/gateway/static/root/assets/local-apps-page-B1a69mlV.js +1 -0
- package/dist/gateway/static/root/assets/{local-session-drafts-Bye3ZtsW.js → local-session-drafts-CYEDUPH7.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-BKyOF23r.js → locale-store-CE7L6MlS.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-Us1jv3C4.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-C9RAM7-s.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-D_7clISS.js → markdown-view-PrKvVpRh.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-B_4o8hac.js → media-plugins-CR1fp6IL.js} +1 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-DQdcaMiu.js +1 -0
- package/dist/gateway/static/root/assets/messages-CaeL_miw.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-Q4yRx9iZ.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-C9qu16IN.js +8 -0
- package/dist/gateway/static/root/assets/page-context-capture-button-Cn_WK68Y.js +1 -0
- package/dist/gateway/static/root/assets/personal-page-DrP6hEcg.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-3NbiWGRG.js +1 -0
- package/dist/gateway/static/root/assets/product-open-page-KKE5-V8k.js +1 -0
- package/dist/gateway/static/root/assets/product-preview-content-BM0oqNxi.js +1 -0
- package/dist/gateway/static/root/assets/project-detail-page-CPZrwf8n.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Besfx_07.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-DLHHYP_v.js → registry-api-BO2Ck3aA.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CTDghL5L.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-Dq_50s27.js → runtime-tools-api-B1sb8nlw.js} +1 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-W0X_Fy7b.js +1 -0
- package/dist/gateway/static/root/assets/schema-form-DNM2Zdyr.js +1 -0
- package/dist/gateway/static/root/assets/{session-api-Br11ih_M.js → session-api-CaAUJvu1.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-DoFTlgNz.js +16 -0
- package/dist/gateway/static/root/assets/sessions-page-Dxtablvd.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-C7zklouD.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-DCSHPFAN.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-4odCW0_2.js → settings-page-B18UbbaJ.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-JoSfluza.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-BLnS3hoH.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-DcIuPJK3.js +1 -0
- package/dist/gateway/static/root/assets/skill-api-CcYGkRPL.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-PnUZjoPK.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-D3JAw62U.js +2 -0
- package/dist/gateway/static/root/assets/style-BQqU-1pP.js +7 -0
- package/dist/gateway/static/root/assets/system-settings-panel-C974myUM.js +1 -0
- package/dist/gateway/static/root/assets/tab-completion-input-CxtEp0aP.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-CiljFekC.js +2 -0
- package/dist/gateway/static/root/assets/{task-expandable-content-CmQt5uxa.js → task-expandable-content-DTEVoNrM.js} +1 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-DEE75MUn.js +1 -0
- package/dist/gateway/static/root/assets/tunnel-api-DWyI3uA3.js +1 -0
- package/dist/gateway/static/root/assets/usage-page-DJYvbxk7.js +1 -0
- package/dist/gateway/static/root/assets/use-autosave-CY0YuljR.js +1 -0
- package/dist/gateway/static/root/assets/user-model-page-eHZJD6Fw.js +2 -0
- package/dist/gateway/static/root/assets/voice-api-key-field-BNG4ixJE.js +1 -0
- package/dist/gateway/static/root/assets/{voice-config-api-CmDtDA4g.js → voice-config-api-D0Wscn9W.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-CohIoAre.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-Czfs5XFH.js → workflow-run-setup-panel-BXI8eyYh.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CVti0u-l.js +6 -0
- package/dist/gateway/static/root/assets/xopc-cloud-account-card-C_COnY_B.js +1 -0
- package/dist/gateway/static/root/index.html +19 -69
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-instance-gateway.d.ts +2 -0
- package/dist/src/agent/agent-manager.d.ts +1 -1
- package/dist/src/agent/agent-manager.js +11 -20
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/child-agent-factory.d.ts +2 -1
- package/dist/src/agent/child-agent-factory.js +2 -1
- package/dist/src/agent/coding/projectEvidence.d.ts +9 -0
- package/dist/src/agent/coding/projectEvidence.js +177 -0
- package/dist/src/agent/coding/repository-instructions.d.ts +8 -1
- package/dist/src/agent/coding/repository-instructions.js +9 -4
- package/dist/src/agent/coding/run-verification.d.ts +17 -2
- package/dist/src/agent/coding/run-verification.js +82 -12
- package/dist/src/agent/embedded/codemode-extension.js +1 -1
- package/dist/src/agent/embedded/execution-context.d.ts +1 -0
- package/dist/src/agent/embedded/execution-context.js +4 -1
- package/dist/src/agent/embedded/external-tool-discovery.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -0
- package/dist/src/agent/embedded/run-turn.js +41 -5
- package/dist/src/agent/embedded/session-runner.js +1 -1
- package/dist/src/agent/embedded/session-tool-result-guard.js +5 -0
- package/dist/src/agent/embedded/types.d.ts +2 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js +2 -1
- package/dist/src/agent/external-tools/cliProvider.js +2 -2
- package/dist/src/agent/external-tools/composio-provider.js +2 -2
- package/dist/src/agent/external-tools/endpoint-provider.js +2 -2
- package/dist/src/agent/external-tools/extension-provider.js +1 -1
- package/dist/src/agent/external-tools/gateway-tools.js +1 -1
- package/dist/src/agent/external-tools/memory-provider.js +1 -1
- package/dist/src/agent/independent-execution.d.ts +2 -0
- package/dist/src/agent/independent-execution.js +12 -0
- package/dist/src/agent/memory/compaction.js +1 -1
- package/dist/src/agent/orchestration/delegation-scope.d.ts +1 -0
- package/dist/src/agent/orchestration/delegation-scope.js +4 -1
- package/dist/src/agent/orchestration/loop-guard.js +6 -2
- package/dist/src/agent/prompt/sections/agent-identity.js +4 -6
- package/dist/src/agent/prompt/sections/behavior.d.ts +3 -2
- package/dist/src/agent/prompt/sections/behavior.js +34 -27
- package/dist/src/agent/prompt/sections/memory-skills.d.ts +1 -1
- package/dist/src/agent/prompt/sections/memory-skills.js +10 -11
- package/dist/src/agent/prompt/sections/messaging-runtime.d.ts +3 -2
- package/dist/src/agent/prompt/sections/messaging-runtime.js +21 -24
- package/dist/src/agent/prompt/sections/response-language.js +7 -6
- package/dist/src/agent/prompt/sections/tooling.js +11 -10
- package/dist/src/agent/prompt/service-prompt-builder.js +3 -1
- package/dist/src/agent/prompt/system-prompt-params.d.ts +2 -1
- package/dist/src/agent/prompt/system-prompt-params.js +2 -0
- package/dist/src/agent/prompt/system-prompt.d.ts +2 -1
- package/dist/src/agent/prompt/system-prompt.js +21 -18
- package/dist/src/agent/prompt/types.d.ts +2 -0
- package/dist/src/agent/service/process-direct-streaming.js +1 -1
- package/dist/src/agent/service.js +3 -2
- package/dist/src/agent/skills/format-skills-prompt.js +5 -2
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +5 -0
- package/dist/src/agent/tools/dataBatch.d.ts +1 -0
- package/dist/src/agent/tools/dataBatch.js +4 -1
- package/dist/src/agent/tools/delegate-tool.d.ts +1 -0
- package/dist/src/agent/tools/delegate-tool.js +1 -0
- package/dist/src/agent/tools/error-tracker.js +4 -2
- package/dist/src/agent/tools/exec-command.js +4 -3
- package/dist/src/agent/tools/factory.d.ts +1 -0
- package/dist/src/agent/tools/factory.js +20 -21
- package/dist/src/agent/tools/{delegation-parent-policy.d.ts → noninteractive-tool-policy.d.ts} +1 -1
- package/dist/src/agent/tools/{delegation-parent-policy.js → noninteractive-tool-policy.js} +4 -4
- package/dist/src/agent/tools/personal-read-tool.js +1 -1
- package/dist/src/agent/tools/personal-task-tool.js +1 -1
- package/dist/src/agent/tools/publish-artifacts.js +1 -1
- package/dist/src/agent/tools/search/cache.d.ts +3 -1
- package/dist/src/agent/tools/search/cache.js +4 -1
- package/dist/src/agent/tools/search/providers/deepseek-protocol.d.ts +9 -0
- package/dist/src/agent/tools/search/providers/deepseek-protocol.js +84 -0
- package/dist/src/agent/tools/search/providers/deepseek.d.ts +9 -0
- package/dist/src/agent/tools/search/providers/deepseek.js +55 -0
- package/dist/src/agent/tools/search/providers/xopc-cloud.d.ts +2 -1
- package/dist/src/agent/tools/search/providers/xopc-cloud.js +36 -1
- package/dist/src/agent/tools/search/registry.d.ts +1 -0
- package/dist/src/agent/tools/search/registry.js +32 -6
- package/dist/src/agent/tools/search/request-gate.d.ts +13 -0
- package/dist/src/agent/tools/search/request-gate.js +41 -0
- package/dist/src/agent/tools/search/resolve-config.js +1 -1
- package/dist/src/agent/tools/search/search-info.d.ts +8 -0
- package/dist/src/agent/tools/search/search-info.js +34 -0
- package/dist/src/agent/tools/search/types.d.ts +19 -1
- package/dist/src/agent/tools/toolExposure.d.ts +3 -0
- package/dist/src/agent/tools/toolExposure.js +25 -0
- package/dist/src/agent/tools/web.js +8 -1
- package/dist/src/agent/tools/xopc-use-tool.js +7 -3
- package/dist/src/agent/workflow/subagent-runner.d.ts +1 -0
- package/dist/src/agent/workflow/subagent-runner.js +3 -3
- package/dist/src/agent/workflow/workflow-child-tools.js +13 -8
- package/dist/src/agent/workspace-runtime/registry.js +1 -1
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/service/action-executor.js +2 -2
- package/dist/src/bootstrap/application-state.js +1 -1
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/chat-commands/agent-edit.js +1 -1
- package/dist/src/cli/command-manifest.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/commands/search.d.ts +2 -2
- package/dist/src/cli/commands/search.js +8 -6
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/computer/model-adapter.d.ts +3 -0
- package/dist/src/computer/model-adapter.js +120 -3
- package/dist/src/computer/model-policy.d.ts +1 -1
- package/dist/src/computer/model-policy.js +13 -6
- package/dist/src/computer/runtime.js +1 -0
- package/dist/src/config/agent-model-intents.js +1 -1
- package/dist/src/config/agent-profile.js +2 -2
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.d.ts +14 -8
- package/dist/src/config/models-json.js +3 -1
- package/dist/src/config/outbound-proxy.d.ts +11 -0
- package/dist/src/config/outbound-proxy.js +30 -0
- package/dist/src/config/rules.js +5 -0
- package/dist/src/config/schema.d.ts +29 -6
- package/dist/src/config/schema.js +21 -4
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/config-tools-web.js +15 -4
- package/dist/src/gateway/gateway-workflow-host.types.d.ts +3 -0
- package/dist/src/gateway/hono/lib/config-payload.d.ts +5 -0
- package/dist/src/gateway/hono/lib/config-payload.js +6 -1
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +7 -0
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/context-sources.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +5 -2
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +1 -1
- package/dist/src/gateway/lock.js +1 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +8 -3
- package/dist/src/gateway/service.js +5 -3
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/infra/http-proxy-env.d.ts +3 -0
- package/dist/src/infra/http-proxy-env.js +22 -2
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/personal-agent/communication.d.ts +2 -1
- package/dist/src/personal-agent/communication.js +11 -2
- package/dist/src/personal-agent/persona.d.ts +2 -1
- package/dist/src/personal-agent/persona.js +3 -2
- package/dist/src/personal-agent/proactivity/service.js +1 -1
- package/dist/src/personal-agent/prompts.d.ts +2 -0
- package/dist/src/personal-agent/prompts.js +69 -7
- package/dist/src/personal-agent/reply-composer.js +2 -2
- package/dist/src/personal-agent/reply-style.d.ts +4 -2
- package/dist/src/personal-agent/reply-style.js +19 -3
- package/dist/src/personal-agent/request-service.js +14 -9
- package/dist/src/personal-agent/service.js +2 -2
- package/dist/src/pets/loopi-artwork.d.ts +2 -0
- package/dist/src/pets/loopi-artwork.js +36 -0
- package/dist/src/pets/pointer.d.ts +6 -0
- package/dist/src/pets/pointer.js +16 -0
- package/dist/src/project-trust/trust-store.d.ts +5 -0
- package/dist/src/project-trust/trust-store.js +7 -1
- package/dist/src/providers/index.js +3 -3
- package/dist/src/providers/model-catalog-persistence.js +1 -1
- package/dist/src/providers/model-registry.js +2 -0
- package/dist/src/providers/model-supplements.d.ts +0 -2
- package/dist/src/providers/model-supplements.js +2 -18
- package/dist/src/providers/xopc-cloud-credit-budget.d.ts +1 -0
- package/dist/src/providers/xopc-cloud-credit-budget.js +4 -1
- package/dist/src/routing/resolve-route.js +1 -1
- package/dist/src/routing/resolve-tui-session-key.js +1 -1
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.js +1 -1
- package/dist/src/tasks/task-allocation-service.js +51 -40
- package/dist/src/tasks/task-application-service.js +5 -1
- package/dist/src/tasks/task-contract-planner.js +21 -6
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-language.d.ts +2 -0
- package/dist/src/tasks/task-language.js +13 -2
- package/dist/src/tasks/task-run-coordinator.js +5 -1
- package/dist/src/tasks/task-run-dispatcher.js +2 -1
- package/dist/src/tui/backends/embedded-backend.js +2 -2
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +2 -3
- package/package.json +8 -4
- package/dist/gateway/static/root/assets/activity-YogQEteU.js +0 -1
- package/dist/gateway/static/root/assets/activity-store-DtTSRUyF.js +0 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-0GXoU7WL.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-BxDqL7uc.js +0 -1
- package/dist/gateway/static/root/assets/agents-CYmRcXr-.js +0 -77
- package/dist/gateway/static/root/assets/app-chrome-BeB4KgOf.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-FhWeowCY.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-DXin262V.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-2M_l4Naz.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CVIWgoTx.js +0 -6
- package/dist/gateway/static/root/assets/browser-automation-inputs-uVEhZWHz.js +0 -1
- package/dist/gateway/static/root/assets/browser-automations-page-CEFnpvTO.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-sQpJic5b.js +0 -3
- package/dist/gateway/static/root/assets/button-aIC072nz.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-BSB93QBR.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-BKkN4sTh.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DCZTR8Hu.js +0 -8
- package/dist/gateway/static/root/assets/capability-header-actions-D0HwmxyW.js +0 -1
- package/dist/gateway/static/root/assets/channels-DRraXYSd.js +0 -1
- package/dist/gateway/static/root/assets/chat-terminal-dock-DpM489kK.js +0 -36
- package/dist/gateway/static/root/assets/chevron-left-DqFhpbvK.js +0 -1
- package/dist/gateway/static/root/assets/chevron-right-BweFrslA.js +0 -1
- package/dist/gateway/static/root/assets/circle-alert-BEjgurr2.js +0 -1
- package/dist/gateway/static/root/assets/circle-dashed-8qMD7gHf.js +0 -1
- package/dist/gateway/static/root/assets/circle-dot-BAseJTrF.js +0 -1
- package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-D0ir9aA1.js +0 -1
- package/dist/gateway/static/root/assets/connector-service-page-Y5SYaiJO.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DRSbj4gn.js +0 -1
- package/dist/gateway/static/root/assets/copy-text-row-C7egVuKr.js +0 -1
- package/dist/gateway/static/root/assets/date-formatters-CUZAyDEg.js +0 -1
- package/dist/gateway/static/root/assets/date-picker-DyUP-8hR.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-QF9qLWIG.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-Qfns4SO-.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-CuITd-Xa.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-sprite-BP6iMVw1.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-C8RPqM_F.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-DnD9eyoU.js +0 -1
- package/dist/gateway/static/root/assets/dist-C3DSFZCi.js +0 -1
- package/dist/gateway/static/root/assets/electron-env-Dit0bHgy.js +0 -1
- package/dist/gateway/static/root/assets/extension-debug-page-B5ikNsSj.js +0 -1
- package/dist/gateway/static/root/assets/extension-page-D-PBMAtT.js +0 -1
- package/dist/gateway/static/root/assets/extension-provider-CdlACvkE.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BPUYMNb0.js +0 -1
- package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-uEdmIROn.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-BKj4PQs4.js +0 -1
- package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +0 -1
- package/dist/gateway/static/root/assets/home-page-D1ZBF3me.js +0 -2
- package/dist/gateway/static/root/assets/image-generation-api-BB3D6OV1.js +0 -1
- package/dist/gateway/static/root/assets/imports-page-BCcWIxOO.js +0 -1
- package/dist/gateway/static/root/assets/index-Bo70AuAq.js +0 -260
- package/dist/gateway/static/root/assets/index-BxoR4_xr.css +0 -1
- package/dist/gateway/static/root/assets/index.module-Cd9ENXfk.js +0 -1
- package/dist/gateway/static/root/assets/interaction-BdhHBbYa.js +0 -1
- package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +0 -1
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-Bc9UWPqr.js +0 -1
- package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-jnK1j04U.js +0 -1
- package/dist/gateway/static/root/assets/local-apps-page-DpN8UN_Y.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-DBR5mfxw.js +0 -2
- package/dist/gateway/static/root/assets/loopi-C09I2mNj.css +0 -1
- package/dist/gateway/static/root/assets/loopi-Djb8XU3l.js +0 -1
- package/dist/gateway/static/root/assets/management-settings-rs2cdb5f.js +0 -1
- package/dist/gateway/static/root/assets/mermaid-MCJ5UELQ-Bl4kOOZT.js +0 -1
- package/dist/gateway/static/root/assets/message-square-plus-XP0tGdlV.js +0 -1
- package/dist/gateway/static/root/assets/messages-B7VtMXec.js +0 -3
- package/dist/gateway/static/root/assets/mic-CuUb7zc-.js +0 -1
- package/dist/gateway/static/root/assets/minimize-2-DtOGrlpo.js +0 -1
- package/dist/gateway/static/root/assets/models-hub-cache-D0vR7vex.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-B7R-cZWE.js +0 -5
- package/dist/gateway/static/root/assets/notes-api-DZkezSIy.js +0 -2
- package/dist/gateway/static/root/assets/notes-page-DY9MNatd.js +0 -8
- package/dist/gateway/static/root/assets/page-context-capture-button-C-X8J1IO.js +0 -1
- package/dist/gateway/static/root/assets/pencil-DmIY3Oa-.js +0 -1
- package/dist/gateway/static/root/assets/personal-page-CIZWUoUh.js +0 -1
- package/dist/gateway/static/root/assets/popover-select-DGKUpVsz.js +0 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-BJU2fmPn.js +0 -1
- package/dist/gateway/static/root/assets/product-open-page-CYV_8zRl.js +0 -1
- package/dist/gateway/static/root/assets/product-preview-content-DfQ9h_YX.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-B_fYXcAW.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-CHdeAtpp.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CbJWGHW_.js +0 -1
- package/dist/gateway/static/root/assets/rotate-ccw-JM1TBLpp.js +0 -1
- package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +0 -1
- package/dist/gateway/static/root/assets/runtime-tools-settings-panel-jqYXsCuk.js +0 -1
- package/dist/gateway/static/root/assets/schema-form-DNXZLVqh.js +0 -1
- package/dist/gateway/static/root/assets/search-DA7gz22f.js +0 -1
- package/dist/gateway/static/root/assets/secret-input-BxWHx6J6.js +0 -1
- package/dist/gateway/static/root/assets/send-session-input-NpLYu1ip.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-Bb9pevyM.js +0 -16
- package/dist/gateway/static/root/assets/sessions-page-DrGCnBhV.js +0 -1
- package/dist/gateway/static/root/assets/settings-2-D-csvaET.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-B61Eh7eB.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-draft-Dy10ldo8.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-num14vSv.js +0 -1
- package/dist/gateway/static/root/assets/settings-shell-dialog-layer-BU3UuiJr.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DaU9o0Ll.js +0 -1
- package/dist/gateway/static/root/assets/share-link-dialog-BhjQPZbF.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-LERhIwgz.js +0 -2
- package/dist/gateway/static/root/assets/shares-api-CgsiMdCX.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DmvyqIyT.js +0 -1
- package/dist/gateway/static/root/assets/skeleton-BI5TyibZ.js +0 -1
- package/dist/gateway/static/root/assets/skill-api-plToSoFo.js +0 -1
- package/dist/gateway/static/root/assets/skill-api-utils-C7V4JVXM.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BFw81Ar6.js +0 -1
- package/dist/gateway/static/root/assets/skill-wire-pattern-BPpeIcCi.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BLUsxGOo.js +0 -2
- package/dist/gateway/static/root/assets/style-1FPsMO2E.js +0 -7
- package/dist/gateway/static/root/assets/system-settings-panel-DL3WXRnL.js +0 -1
- package/dist/gateway/static/root/assets/tab-completion-input-D64VNmiA.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-DWM5xGbe.js +0 -2
- package/dist/gateway/static/root/assets/theme-store-CPdeCbZI.js +0 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-m51enJFx.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-B5I53jzk.js +0 -1
- package/dist/gateway/static/root/assets/usage-page-B7qyfnMN.js +0 -1
- package/dist/gateway/static/root/assets/use-async-resource-GrnWNwMZ.js +0 -1
- package/dist/gateway/static/root/assets/use-autosave-C2__K1-y.js +0 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-61W-5Q6m.js +0 -2
- package/dist/gateway/static/root/assets/use-file-preview-expanded-DZUWxdhm.js +0 -2
- package/dist/gateway/static/root/assets/user-model-page-DkIuYpuf.js +0 -2
- package/dist/gateway/static/root/assets/voice-api-key-field-DB--pFJX.js +0 -1
- package/dist/gateway/static/root/assets/voice-transcribe-api-Cp2uDvFO.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-Blwp7T-_.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-RN_QXcGY.js +0 -6
- package/dist/gateway/static/root/assets/workspace-api-lHTRLje0.js +0 -2
- package/dist/gateway/static/root/assets/xopc-cloud-account-card-D31rz9OQ.js +0 -1
- package/dist/src/agent/bootstrap/project-agents-context.d.ts +0 -2
- package/dist/src/agent/bootstrap/project-agents-context.js +0 -30
|
@@ -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{f as i,g as a,l as o,m as s,t as c,u as l}from"./chunk-KS7C4IRE-B2HK1psj.js";import{t as u}from"./check-DUBLcKHA.js";import{t as d}from"./chevron-right-BweFrslA.js";import{n as f,r as p,t as m}from"./popover-select-DGKUpVsz.js";import{t as h}from"./copy-Dv6d4Dvw.js";import{t as g}from"./download-Dk-ZjtO6.js";import{t as _}from"./ellipsis-0k4rZLoy.js";import{t as v}from"./markdown-view-D_7clISS.js";import{t as y}from"./pencil-DmIY3Oa-.js";import{t as b}from"./plus-Q2yW6OE7.js";import{t as x}from"./rotate-ccw-JM1TBLpp.js";import{t as S}from"./search-DA7gz22f.js";import{t as C}from"./x-B_N4OPjy.js";import{t as w}from"./messages-B7VtMXec.js";import{t as T}from"./cn-0WouolD0.js";import{c as E,n as D}from"./locale-store-BKyOF23r.js";import{a as O,i as k,n as A,o as j,r as M,s as N,t as P}from"./dist-BGTk37IG.js";import{t as F}from"./copy-to-clipboard-HOJ79TWv.js";import{i as I}from"./vendor-swr-BIWyz7Rc.js";import{t as L}from"./button-aIC072nz.js";import{t as R}from"./skeleton-BI5TyibZ.js";import{n as z}from"./interaction-BdhHBbYa.js";import{o as B}from"./agents-admin-api-znm6_dW_.js";import{i as V}from"./theme-store-CPdeCbZI.js";import{i as H,n as U}from"./date-formatters-CUZAyDEg.js";import{$r as W,A as G,Ac as ee,Ao as K,Ar as q,Bn as te,Br as ne,Bs as re,C as ie,Ca as J,D as ae,Do as Y,Dr as oe,E as se,Fr as ce,Fs as le,Gr as ue,Hr as de,Ir as fe,Jr as pe,Js as X,Kr as me,Ks as he,Ln as ge,Lr as _e,Mr as ve,No as ye,Nr as be,Ns as xe,O as Se,Po as Ce,Qc as we,Qs as Te,Rc as Ee,Rr as De,S as Oe,T as ke,Uc as Ae,Vr as je,Wr as Me,Xr as Ne,Xs as Pe,Yi as Fe,Yo as Ie,Yr as Le,Zr as Re,_ as ze,b as Be,cc as Ve,d as He,ei as Ue,el as We,f as Ge,g as Ke,gi as qe,h as Je,hs as Ye,i as Xe,ic as Ze,ii as Qe,ir as $e,j as et,jr as tt,k as nt,ki as rt,kr as it,m as at,mc as ot,ni as st,nl as ct,nr as lt,or as ut,os as dt,p as ft,qc as pt,qr as mt,ri as ht,rr as gt,ti as _t,tr as vt,u as yt,ua as bt,ul as xt,v as St,vc as Ct,w as wt,wc as Tt,wo as Et,x as Dt,y as Ot,zr as kt}from"./index-Bo70AuAq.js";import{l as At}from"./vendor-codemirror-DFxP3B9T.js";import{t as jt}from"./code-editor-CXIH8jQw.js";import{a as Mt,i as Nt,o as Pt,r as Ft,t as It}from"./workflow-run-setup-panel-Czfs5XFH.js";import{t as Lt}from"./tab-completion-input-D64VNmiA.js";import{t as Rt}from"./tab-completion-input.utils-BP3NH_du.js";import{a as zt,c as Bt,i as Vt,l as Ht,n as Ut,o as Wt,r as Gt,s as Kt,t as qt,u as Jt}from"./style-1FPsMO2E.js";var Z=e(t(),1),Q=n(),Yt=[`queued`,`running`,`succeeded`,`attention`],Xt=new Set([`failed`,`timeout`,`cancelled`]);function Zt(e){return e.metadata?.conversationId?.trim()||null}function Qt(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function $t(e,t){if(!e||typeof e!=`object`)return null;let n=e;for(let e of t){let t=n[e];if(typeof t==`string`&&t.trim())return t.trim()}return null}function en(e,t=90){let n=e.metadata?.input?.goal?.trim()||(typeof e.metadata?.input?.payload==`string`?e.metadata.input.payload.trim():null)||$t(e.metadata?.input?.payload,[`query`,`goal`,`prompt`,`input`,`message`])||$t(e.metadata?.input?.variables,[`query`,`goal`,`prompt`,`input`,`message`]);return n?Qt(n,t):null}function tn(e,t=90){return en(e,t)??Qt(e.title?.trim()||e.definitionId,t)}function nn(e,t=44){return Qt(e.title?.trim()||e.definitionId,t)}function rn(e,t){let n=t.trim().toLowerCase();return n?[en(e,500),e.title,e.definitionId,e.id].filter(Boolean).join(` `).toLowerCase().includes(n):!0}function an(e,t){let n=t.workflowFilterId.trim();return e.filter(e=>n&&e.definitionId!==n||!_e(e,t.triggerFilter??`all`)?!1:rn(e,t.searchQuery))}function on(e){return e.completedAtMs??e.createdAtMs}function sn(e,t){return e.status===`queued`?`queued`:e.status===`running`?`running`:e.status===`succeeded`?`succeeded`:Xt.has(e.status)?`attention`:null}function cn(e,t){let n=[...t];return e===`queued`?n.sort((e,t)=>e.createdAtMs-t.createdAtMs):e===`running`?n.sort((e,t)=>(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)):n.sort((e,t)=>on(t)-on(e))}function ln(e,t){let n={queued:[],running:[],succeeded:[],attention:[]};for(let r of e){let e=sn(r,t);e&&n[e].push(r)}return Yt.map(e=>{if(e===`succeeded`){let t=cn(`succeeded`,n.succeeded);return{id:e,runs:t,totalInWindow:t.length}}return{id:e,runs:cn(e,n[e])}})}function un(e,t,n){let r=Math.round((t-e)/1e3);if(r<60)return H(-r,`second`,n);let i=Math.round(r/60);if(i<60)return H(-i,`minute`,n);let a=Math.round(i/60);return a<48?H(-a,`hour`,n):H(-Math.round(a/24),`day`,n)}function dn(e){return e.status===`queued`||e.status===`running`}function fn(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}var $=r(),pn=(0,Z.memo)(function(e){let t=(0,Q.c)(76),{run:n,language:r,localeTag:i,nowMs:a,selected:o,onOpen:s,onOpenChat:c,onCancel:l,onRetry:u}=e,d=w(r).workflows,[f,p]=(0,Z.useState)(!1),m;t[0]===n?m=t[1]:(m=Zt(n),t[0]=n,t[1]=m);let h=!m,g;t[2]===n?g=t[3]:(g=dn(n),t[2]=n,t[3]=g);let v=g,y=n.status===`running`||n.status===`queued`,b;t[4]!==n.metrics.agentCount||t[5]!==n.metrics.doneAgentCount?(b=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[4]=n.metrics.agentCount,t[5]=n.metrics.doneAgentCount,t[6]=b):b=t[6];let x=b,S=n.metrics.errorAgentCount>0,C=n.startedAtMs??n.createdAtMs,E=tt(v?a-C:n.metrics.durationMs),D=be(d.taskArtifacts,{count:n.metrics.artifactCount}),O;t[7]===n?O=t[8]:(O=tn(n),t[7]=n,t[8]=O);let k=O,A;t[9]===n?A=t[10]:(A=nn(n),t[9]=n,t[10]=A);let j=A,M;t[11]!==s||t[12]!==n?(M=()=>{s(n)},t[11]=s,t[12]=n,t[13]=M):M=t[13];let N=M,P;t[14]!==h||t[15]!==c||t[16]!==n?(P=()=>{h||c(n)},t[14]=h,t[15]=c,t[16]=n,t[17]=P):P=t[17];let F=P,I=o&&`ring-1 ring-accent/30`,R;t[18]===I?R=t[19]:(R=T(`group relative min-h-24 overflow-hidden rounded-lg bg-surface-panel p-3 shadow-surface transition-colors`,I,`hover:bg-surface-hover`),t[18]=I,t[19]=R);let B;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(B=T(`w-full text-left`,z.focusRingPanel),t[20]=B):B=t[20];let V;t[21]===k?V=t[22]:(V=(0,$.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5 text-fg`,children:k}),t[21]=k,t[22]=V);let H;t[23]===j?H=t[24]:(H=(0,$.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:j}),t[23]=j,t[24]=H);let U;t[25]!==V||t[26]!==H?(U=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[V,H]}),t[25]=V,t[26]=H,t[27]=U):U=t[27];let W;t[28]===n.status?W=t[29]:(W=T(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,De(n.status)),t[28]=n.status,t[29]=W);let G;t[30]!==i||t[31]!==a||t[32]!==C?(G=un(C,a,i),t[30]=i,t[31]=a,t[32]=C,t[33]=G):G=t[33];let ee;t[34]===G?ee=t[35]:(ee=(0,$.jsx)(`span`,{children:G}),t[34]=G,t[35]=ee);let K=E===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:be(d.taskElapsed,{duration:E})})]}),q;t[36]!==ee||t[37]!==K?(q=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[ee,K]}),t[36]=ee,t[37]=K,t[38]=q):q=t[38];let te=n.metrics.artifactCount>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:D}):null,ne=o?(0,$.jsx)(`span`,{className:`font-medium text-accent-fg`,children:d.taskOpenDetails}):null,re;t[39]!==te||t[40]!==ne?(re=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[te,ne]}),t[39]=te,t[40]=ne,t[41]=re):re=t[41];let ie=h&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,J;t[42]===ie?J=t[43]:(J=T(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,z.focusRingPanel,ie),t[42]=ie,t[43]=J);let ae;t[44]!==h||t[45]!==F||t[46]!==d.continueInChat||t[47]!==J?(ae=(0,$.jsx)(`button`,{type:`button`,className:J,disabled:h,onClick:F,children:d.continueInChat}),t[44]=h,t[45]=F,t[46]=d.continueInChat,t[47]=J,t[48]=ae):ae=t[48];let Y;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(Y=T(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,z.focusRingPanel),t[49]=Y):Y=t[49];let oe;t[50]!==N||t[51]!==d.taskOpenDetails?(oe=(0,$.jsx)(`button`,{type:`button`,className:Y,onClick:N,children:d.taskOpenDetails}),t[50]=N,t[51]=d.taskOpenDetails,t[52]=oe):oe=t[52];let se;t[53]!==ae||t[54]!==oe?(se=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[ae,oe]}),t[53]=ae,t[54]=oe,t[55]=se):se=t[55];let ce;t[56]===p?ce=t[57]:(ce=()=>p(hn),t[56]=p,t[57]=ce);let le;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t[58]=le):le=t[58];let ue;t[59]!==d.taskActionsAria||t[60]!==f||t[61]!==ce?(ue=(0,$.jsx)(L,{variant:`ghost`,className:`size-7 p-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100`,"aria-label":d.taskActionsAria,"aria-expanded":f,onClick:ce,children:le}),t[59]=d.taskActionsAria,t[60]=f,t[61]=ce,t[62]=ue):ue=t[62];let de;t[63]!==v||t[64]!==d.cancel||t[65]!==d.rerun||t[66]!==d.taskCloseMenu||t[67]!==f||t[68]!==l||t[69]!==u||t[70]!==n||t[71]!==p?(de=f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-10 cursor-default`,"aria-label":d.taskCloseMenu,onClick:()=>p(!1)}),(0,$.jsxs)(`div`,{className:`absolute right-0 z-20 mt-1 min-w-36 rounded-lg border border-edge bg-surface-panel py-1 shadow-surface`,children:[v?(0,$.jsx)(mn,{label:d.cancel,tone:`danger`,onClick:()=>{p(!1),l(n.id)}}):null,fn(n)?(0,$.jsx)(mn,{label:d.rerun,onClick:()=>{p(!1),u(n.id)}}):null]})]}):null,t[63]=v,t[64]=d.cancel,t[65]=d.rerun,t[66]=d.taskCloseMenu,t[67]=f,t[68]=l,t[69]=u,t[70]=n,t[71]=p,t[72]=de):de=t[72];let fe;return t[73]!==ue||t[74]!==de?(fe=(0,$.jsxs)(`div`,{className:`absolute right-2 top-2`,children:[ue,de]}),t[73]=ue,t[74]=de,t[75]=fe):fe=t[75],(0,$.jsxs)(`div`,{className:R,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:N,"aria-label":`${d.taskOpenDetails}: ${k}`,"aria-current":o?`true`:void 0,className:B,children:[(0,$.jsxs)(`div`,{className:`pr-7`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[U,(0,$.jsx)(`span`,{className:W,children:d.status[n.status]??n.status})]}),q]}),y?(0,$.jsxs)(`div`,{className:`mt-2.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[11px] text-fg-muted`,children:[(0,$.jsx)(`span`,{children:be(d.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{children:[x,`%`]})]}),(0,$.jsx)(`div`,{className:`mt-1.5 h-1.5 overflow-hidden rounded-full bg-surface-hover`,children:(0,$.jsx)(`div`,{className:`h-full rounded-full bg-accent transition-all`,style:{width:`${x}%`}})})]}):null,re,S?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(ye,{className:`size-3 shrink-0`,"aria-hidden":!0}),be(d.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),se,fe]})});function mn(e){let t=(0,Q.c)(8),{label:n,disabled:r,tone:i,onClick:a}=e,o=r?`cursor-not-allowed text-fg-subtle`:`text-fg hover:bg-surface-hover`,s=i===`danger`&&!r&&`text-red-600 dark:text-red-300`,c;t[0]!==o||t[1]!==s?(c=T(`block w-full px-3 py-1.5 text-left text-xs`,o,s),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l;return t[3]!==r||t[4]!==n||t[5]!==a||t[6]!==c?(l=(0,$.jsx)(`button`,{type:`button`,disabled:r,onClick:a,className:c,children:n}),t[3]=r,t[4]=n,t[5]=a,t[6]=c,t[7]=l):l=t[7],l}function hn(e){return!e}function gn(e,t){return t.boardColumns[e]}var _n=(0,Z.memo)(function(e){let t=(0,Q.c)(17),{column:n,language:r,localeTag:i,nowMs:a,selectedRunId:o,loading:s,onOpenRun:c,onOpenRunChat:l,onCancelRun:u,onRetryRun:d}=e,f=w(r).workflows,[p,m]=(0,Z.useState)(!1),h=n.id===`succeeded`,g=h?5:n.runs.length,v;t[0]!==g||t[1]!==n.runs||t[2]!==p||t[3]!==h?(v=h&&!p?n.runs.slice(0,g):n.runs,t[0]=g,t[1]=n.runs,t[2]=p,t[3]=h,t[4]=v):v=t[4];let y=v,b=h&&n.runs.length>5&&!p,x=h&&p,S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=T(`flex max-h-full w-72 min-w-72 max-w-72 shrink-0 flex-col overflow-y-auto rounded-lg bg-surface-base shadow-surface`),t[5]=S):S=t[5];let C;t[6]===n.runs.length?C=t[7]:(C=(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.runs.length}),t[6]=n.runs.length,t[7]=C);let E;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(_,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[8]=E):E=t[8];let D=s&&y.length===0?(0,$.jsx)(vn,{}):y.length===0?(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel/70 px-3 py-6 text-center text-xs text-fg-subtle`,children:f.boardColumnEmpty}):y.map(e=>(0,$.jsx)(pn,{run:e,language:r,localeTag:i,nowMs:a,selected:e.id===o,onOpen:c,onOpenChat:l,onCancel:u,onRetry:d},e.id)),O=b?(0,$.jsx)(L,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!0),children:be(f.boardExpandSucceeded,{count:Math.min(n.runs.length,n.totalInWindow??n.runs.length)})}):null,k;t[9]!==x||t[10]!==f||t[11]!==m?(k=x?(0,$.jsx)(L,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!1),children:f.boardCollapseSucceeded}):null,t[9]=x,t[10]=f,t[11]=m,t[12]=k):k=t[12];let A;return t[13]!==D||t[14]!==O||t[15]!==k?(A=(0,$.jsxs)(`div`,{className:`mx-2 mt-3 grid min-h-0 min-w-0 content-start gap-2 pb-2 pr-1 [scrollbar-gutter:stable]`,children:[D,O,k]}),t[13]=D,t[14]=O,t[15]=k,t[16]=A):A=t[16],(0,$.jsxs)(`section`,{className:S,"aria-label":gn(n.id,f),children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-2 p-3`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,$.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:gn(n.id,f)}),C]}),E]}),A]})});function vn(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`article`,{className:`min-h-24 rounded-lg bg-surface-panel p-3 shadow-surface`,"aria-hidden":`true`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(R,{className:`size-4/5`}),(0,$.jsx)(R,{className:`mt-2 h-3 w-24`})]}),(0,$.jsx)(R,{className:`h-5 w-14 rounded-full`})]}),(0,$.jsx)(R,{className:`mt-3 h-3 w-2/3`}),(0,$.jsx)(R,{className:`mt-4 h-5 w-20 rounded-full`})]}),e[0]=t):t=e[0],t}function yn(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var bn=(0,Z.memo)(function(e){let t=(0,Q.c)(54),{runs:n,language:r,localeTag:i,labels:a,searchQuery:o,workflowFilterId:s,triggerFilter:c,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m,onStart:h}=e,g;t[0]===n?g=t[1]:(g=n.some(xn),t[0]=n,t[1]=g);let _=g,v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),[b,x]=(0,Z.useState)(Sn),[S,C]=(0,Z.useState)(!1),w,T;t[2]===_?(w=t[3],T=t[4]):(w=()=>{if(!_)return;let e=window.setInterval(()=>x(Date.now()),1e3);return()=>window.clearInterval(e)},T=[_],t[2]=_,t[3]=w,t[4]=T),(0,Z.useEffect)(w,T);let E;t[5]!==b||t[6]!==n||t[7]!==o||t[8]!==c||t[9]!==s?(E=ln(an(n,{searchQuery:o,workflowFilterId:s,triggerFilter:c}),b),t[5]=b,t[6]=n,t[7]=o,t[8]=c,t[9]=s,t[10]=E):E=t[10];let D=E,O=D.reduce(Cn,0),k;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(k=e=>{let t=y.current;!t||t.pointerId!==e.pointerId||(y.current=null,C(!1),e.currentTarget.hasPointerCapture?.(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},t[11]=k):k=t[11];let A=k,j;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{if(e.button!==0||yn(e.target))return;let t=v.current;t&&(y.current={pointerId:e.pointerId,startX:e.clientX,scrollLeft:t.scrollLeft,active:!1},e.currentTarget.setPointerCapture(e.pointerId))},t[12]=j):j=t[12];let M=j,N;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>{let t=y.current,n=v.current;if(!t||!n||t.pointerId!==e.pointerId)return;let r=e.clientX-t.startX;!t.active&&Math.abs(r)<5||(t.active||(t.active=!0,C(!0)),e.preventDefault(),n.scrollLeft=t.scrollLeft-r)},t[13]=N):N=t[13];let P=N;if(!u&&O===0){let e;t[14]===a.boardEmptyTitle?e=t[15]:(e=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:a.boardEmptyTitle}),t[14]=a.boardEmptyTitle,t[15]=e);let n;t[16]===a.boardEmptyHint?n=t[17]:(n=(0,$.jsx)(`p`,{className:`mx-auto mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.boardEmptyHint}),t[16]=a.boardEmptyHint,t[17]=n);let r;t[18]!==a.boardStart||t[19]!==h?(r=(0,$.jsx)(`div`,{className:`mt-4 flex justify-center`,children:(0,$.jsx)(L,{variant:`primary`,onClick:h,children:a.boardStart})}),t[18]=a.boardStart,t[19]=h,t[20]=r):r=t[20];let i;return t[21]!==r||t[22]!==e||t[23]!==n?(i=(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col items-center justify-center rounded-2xl border border-dashed border-edge bg-surface-panel/40 px-6 py-12 text-center`,children:[e,n,r]}),t[21]=r,t[22]=e,t[23]=n,t[24]=i):i=t[24],i}let F=S?`cursor-grabbing select-none`:`cursor-grab`,I;t[25]===F?I=t[26]:(I=[`min-h-0 h-full min-w-0 overflow-x-auto rounded-lg p-2`,F],t[25]=F,t[26]=I);let R=I.join(` `),z;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(z=e=>{y.current?.pointerId===e.pointerId&&(y.current=null,C(!1))},t[27]=z):z=t[27];let B;if(t[28]!==D||t[29]!==r||t[30]!==u||t[31]!==i||t[32]!==b||t[33]!==p||t[34]!==d||t[35]!==f||t[36]!==m||t[37]!==l){let e;t[39]!==r||t[40]!==u||t[41]!==i||t[42]!==b||t[43]!==p||t[44]!==d||t[45]!==f||t[46]!==m||t[47]!==l?(e=e=>(0,$.jsx)(_n,{column:e,language:r,localeTag:i,nowMs:b,selectedRunId:l,loading:u,onOpenRun:d,onOpenRunChat:f,onCancelRun:p,onRetryRun:m},e.id),t[39]=r,t[40]=u,t[41]=i,t[42]=b,t[43]=p,t[44]=d,t[45]=f,t[46]=m,t[47]=l,t[48]=e):e=t[48],B=D.map(e),t[28]=D,t[29]=r,t[30]=u,t[31]=i,t[32]=b,t[33]=p,t[34]=d,t[35]=f,t[36]=m,t[37]=l,t[38]=B}else B=t[38];let V;t[49]===B?V=t[50]:(V=(0,$.jsx)(`div`,{className:`flex min-h-full min-w-max items-start gap-3 pr-4`,children:B}),t[49]=B,t[50]=V);let H;return t[51]!==R||t[52]!==V?(H=(0,$.jsx)(`div`,{ref:v,className:R,onPointerDown:M,onPointerMove:P,onPointerUp:A,onPointerCancel:A,onLostPointerCapture:z,children:V}),t[51]=R,t[52]=V,t[53]=H):H=t[53],H});function xn(e){return e.status===`queued`||e.status===`running`}function Sn(){return Date.now()}function Cn(e,t){return e+t.runs.length}function wn(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?be(t.agentScaleExact,{count:n.min}):be(t.agentScaleRange,{min:n.min,max:n.max}):null}function Tn(e){let t=(0,Q.c)(79),{definition:n,language:r,labels:i,onPick:a,onDetail:o,onEdit:s,savedForProject:c}=e,l;t[0]!==n||t[1]!==r?(l=W(n,r),t[0]=n,t[1]=r,t[2]=l):l=t[2];let u=l,d;t[3]!==n||t[4]!==i?(d=wn(n,i),t[3]=n,t[4]=i,t[5]=d):d=t[5];let f=d,p=n.metadata.source===`user`,m;t[6]===n.inputSchema?m=t[7]:(m=n.inputSchema&&Pt(n.inputSchema)&&Mt(n.inputSchema).length>0,t[6]=n.inputSchema,t[7]=m);let h=m,g=p?`bg-accent-soft text-accent-fg`:`bg-surface-inset text-fg-muted`,_;t[8]===g?_=t[9]:(_=T(`rounded-full px-2 py-0.5 text-[10px] font-medium`,g),t[8]=g,t[9]=_);let v=p?i.badgeUser:i.badgeBuiltin,b;t[10]!==_||t[11]!==v?(b=(0,$.jsx)(`span`,{className:_,children:v}),t[10]=_,t[11]=v,t[12]=b):b=t[12];let x;t[13]!==h||t[14]!==i.inputSchemaBadge?(x=h?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-surface-inset px-2 py-0.5 text-[10px] text-fg-subtle`,children:[(0,$.jsx)(we,{className:`size-2.5`,"aria-hidden":!0}),i.inputSchemaBadge]}):null,t[13]=h,t[14]=i.inputSchemaBadge,t[15]=x):x=t[15];let S;t[16]!==i.projectWorkflowBadge||t[17]!==c?(S=c?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-success-soft px-2 py-0.5 text-[10px] text-success`,children:[(0,$.jsx)(ct,{className:`size-2.5`,"aria-hidden":!0}),i.projectWorkflowBadge]}):null,t[16]=i.projectWorkflowBadge,t[17]=c,t[18]=S):S=t[18];let C;t[19]!==b||t[20]!==x||t[21]!==S?(C=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[b,x,S]}),t[19]=b,t[20]=x,t[21]=S,t[22]=C):C=t[22];let w;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(w=T(`mt-2 line-clamp-2 text-left text-sm font-semibold leading-5 text-fg hover:text-accent-fg`,z.focusRingPanel),t[23]=w):w=t[23];let E;t[24]!==n||t[25]!==o?(E=()=>o(n),t[24]=n,t[25]=o,t[26]=E):E=t[26];let D;t[27]!==u.title||t[28]!==E?(D=(0,$.jsx)(`button`,{type:`button`,className:w,onClick:E,children:u.title}),t[27]=u.title,t[28]=E,t[29]=D):D=t[29];let O;t[30]!==C||t[31]!==D?(O=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[C,D]}),t[30]=C,t[31]=D,t[32]=O):O=t[32];let k=`${p?i.editWorkflow:i.copyAndEditWorkflow}: ${u.title}`,A;t[33]!==n||t[34]!==s?(A=()=>s(n),t[33]=n,t[34]=s,t[35]=A):A=t[35];let j;t[36]===p?j=t[37]:(j=p?(0,$.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),t[36]=p,t[37]=j);let M;t[38]!==k||t[39]!==A||t[40]!==j?(M=(0,$.jsx)(L,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":k,onClick:A,children:j}),t[38]=k,t[39]=A,t[40]=j,t[41]=M):M=t[41];let N;t[42]!==O||t[43]!==M?(N=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[O,M]}),t[42]=O,t[43]=M,t[44]=N):N=t[44];let P;t[45]===u.description?P=t[46]:(P=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:u.description}),t[45]=u.description,t[46]=P);let F;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(Te,{className:`size-3`,"aria-hidden":!0}),t[47]=F):F=t[47];let I;t[48]!==n.phases.length||t[49]!==i.phaseCount?(I=be(i.phaseCount,{count:n.phases.length}),t[48]=n.phases.length,t[49]=i.phaseCount,t[50]=I):I=t[50];let R;t[51]===I?R=t[52]:(R=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[F,I]}),t[51]=I,t[52]=R);let B;t[53]===f?B=t[54]:(B=f?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(Y,{className:`size-3`,"aria-hidden":!0}),f]}):null,t[53]=f,t[54]=B);let V;t[55]!==R||t[56]!==B?(V=(0,$.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-3 pt-4 text-[11px] text-fg-subtle`,children:[R,B]}),t[55]=R,t[56]=B,t[57]=V):V=t[57];let H;t[58]!==n||t[59]!==a?(H=()=>a(n),t[58]=n,t[59]=a,t[60]=H):H=t[60];let U;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(Ye,{className:`size-3.5`,"aria-hidden":!0}),t[61]=U):U=t[61];let G;t[62]!==i.configureAndRun||t[63]!==H?(G=(0,$.jsxs)(L,{type:`button`,variant:`secondary`,className:`h-8 flex-1 rounded-lg text-xs`,onClick:H,children:[U,i.configureAndRun]}),t[62]=i.configureAndRun,t[63]=H,t[64]=G):G=t[64];let K;t[65]!==n||t[66]!==o?(K=()=>o(n),t[65]=n,t[66]=o,t[67]=K):K=t[67];let q;t[68]!==i.viewDetails||t[69]!==K?(q=(0,$.jsx)(L,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:K,children:i.viewDetails}),t[68]=i.viewDetails,t[69]=K,t[70]=q):q=t[70];let te;t[71]!==G||t[72]!==q?(te=(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[G,q]}),t[71]=G,t[72]=q,t[73]=te):te=t[73];let ne;return t[74]!==N||t[75]!==P||t[76]!==V||t[77]!==te?(ne=(0,$.jsxs)(`article`,{className:`flex min-h-48 flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 transition-colors hover:border-edge hover:bg-surface-hover/35`,children:[N,P,V,te]}),t[74]=N,t[75]=P,t[76]=V,t[77]=te,t[78]=ne):ne=t[78],ne}function En(e){let t=(0,Q.c)(45),{definitions:n,runs:r,language:i,projectPresetDefinitionIds:a,onPick:o,onDetail:s,onEdit:c}=e,[l]=(0,Z.useState)(kn),u=w(i).workflows,d=i===`zh`?`zh-CN`:`en-US`,[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(`all`),[v,y]=(0,Z.useState)(`all`),b;t[0]!==g||t[1]!==n||t[2]!==m||t[3]!==v?(b=q(n,m,g,v),t[0]=g,t[1]=n,t[2]=m,t[3]=v,t[4]=b):b=t[4];let x=b,C;if(t[5]!==n||t[6]!==r){let e=new Map(n.map(On)),i=new Set;C=[...r].sort(Dn).flatMap(t=>{if(i.has(t.definitionId))return[];let n=e.get(t.definitionId);return n?(i.add(t.definitionId),[{definition:n,lastRunAtMs:t.startedAtMs??t.createdAtMs}]):[]}).slice(0,3),t[5]=n,t[6]=r,t[7]=C}else C=t[7];let E=C,D=be(u.workflowCount,{count:x.length}),O;t[8]===D?O=t[9]:(O=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:D}),t[8]=D,t[9]=O);let k=u.sourceFilterAria,A;t[10]!==u.sources||t[11]!==y||t[12]!==v?(A=pe.map(e=>(0,$.jsx)(`button`,{type:`button`,className:T(`h-8 rounded-md px-2.5 text-xs font-medium transition-colors`,v===e?`bg-surface-base text-fg shadow-surface`:`text-fg-muted hover:text-fg`,z.focusRingPanel),"aria-pressed":v===e,onClick:()=>y(e),children:u.sources[e]},e)),t[10]=u.sources,t[11]=y,t[12]=v,t[13]=A):A=t[13];let j;t[14]!==u.sourceFilterAria||t[15]!==A?(j=(0,$.jsx)(`div`,{className:`flex rounded-lg bg-surface-inset p-0.5`,role:`group`,"aria-label":k,children:A}),t[14]=u.sourceFilterAria,t[15]=A,t[16]=j):j=t[16];let M=u.categoryFilterAria,N;t[17]===_?N=t[18]:(N=e=>_(e.target.value),t[17]=_,t[18]=N);let P;t[19]===u.categories?P=t[20]:(P=Me.map(e=>(0,$.jsx)(p,{value:e,children:u.categories[e]},e)),t[19]=u.categories,t[20]=P);let F;t[21]!==g||t[22]!==u.categoryFilterAria||t[23]!==N||t[24]!==P?(F=(0,$.jsx)(f,{value:g,"aria-label":M,onChange:N,className:`h-9 min-w-36 rounded-lg border border-edge bg-surface-base px-2.5 text-xs font-medium text-fg shadow-surface`,children:P}),t[21]=g,t[22]=u.categoryFilterAria,t[23]=N,t[24]=P,t[25]=F):F=t[25];let I;t[26]!==F||t[27]!==j?(I=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[j,F]}),t[26]=F,t[27]=j,t[28]=I):I=t[28];let L;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(S,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[29]=L):L=t[29];let R;t[30]===h?R=t[31]:(R=e=>h(e.target.value),t[30]=h,t[31]=R);let B=u.librarySearchPlaceholder,V;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(V=T(`h-10 w-full rounded-lg border border-edge bg-surface-base py-2 pl-10 pr-3 text-sm text-fg`,`placeholder:text-fg-muted`,z.focusRingPanel),t[32]=V):V=t[32];let H;t[33]!==u.librarySearchPlaceholder||t[34]!==m||t[35]!==R?(H=(0,$.jsxs)(`div`,{className:`relative max-w-xl`,children:[L,(0,$.jsx)(`input`,{value:m,onChange:R,placeholder:B,className:V})]}),t[33]=u.librarySearchPlaceholder,t[34]=m,t[35]=R,t[36]=H):H=t[36];let U;return t[37]!==x||t[38]!==u||t[39]!==i||t[40]!==s||t[41]!==c||t[42]!==o||t[43]!==a?(U=x.length===0?(0,$.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:u.noDefinitions}),(0,$.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-5 text-fg-muted`,children:u.noDefinitionsHint})]}):(0,$.jsx)(`div`,{className:`grid grid-cols-1 gap-3 pt-4 sm:grid-cols-2 xl:grid-cols-3`,children:x.map(e=>(0,$.jsx)(Tn,{definition:e,language:i,labels:u,savedForProject:a?.has(e.id)??!1,onPick:o,onDetail:s,onEdit:c},e.id))}),t[37]=x,t[38]=u,t[39]=i,t[40]=s,t[41]=c,t[42]=o,t[43]=a,t[44]=U):U=t[44],(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5`,children:[E.length>0&&!m&&g===`all`&&v===`all`?(0,$.jsxs)(`section`,{"aria-labelledby":`recent-workflows-heading`,children:[(0,$.jsx)(`h2`,{id:`recent-workflows-heading`,className:`text-sm font-semibold text-fg`,children:u.recentlyUsed}),(0,$.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:E.map(e=>{let{definition:t,lastRunAtMs:n}=e;return(0,$.jsxs)(`button`,{type:`button`,className:T(`flex min-w-52 flex-1 items-center justify-between gap-3 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2 text-left hover:bg-surface-hover`,`sm:max-w-sm`,z.focusRingPanel),onClick:()=>o(t),children:[(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:W(t,i).title}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-[11px] text-fg-subtle`,children:un(n,l,d)})]}),(0,$.jsx)(Ye,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0})]},t.id)})})]}):null,(0,$.jsxs)(`section`,{"aria-labelledby":`all-workflows-heading`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{id:`all-workflows-heading`,className:`text-sm font-semibold text-fg`,children:u.allWorkflows}),O]}),I]}),H]}),U]})]})}function Dn(e,t){return(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)}function On(e){return[e.id,e]}function kn(){return Date.now()}var An=(0,Z.memo)(function(e){let t=(0,Q.c)(108),{run:n,language:r,localeTag:i,nowMs:a,onOpen:o,onOpenChat:s,onCancel:c,onRetry:l}=e,u,f,p,m,h,g,_,v,y,b,x,S,C,E,D,O,k;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==n){p=w(r).workflows;let e;t[22]===n?e=t[23]:(e=dn(n),t[22]=n,t[23]=e),u=e;let s;t[24]===n?s=t[25]:(s=fn(n),t[24]=n,t[25]=s),m=s;let c;t[26]===n?c=t[27]:(c=Zt(n),t[26]=n,t[27]=c),f=!!c;let l=n.startedAtMs??n.createdAtMs,d=tt(u?a-l:n.metrics.durationMs),A;t[28]!==n.metrics.agentCount||t[29]!==n.metrics.doneAgentCount?(A=n.metrics.agentCount>0?Math.round(n.metrics.doneAgentCount/n.metrics.agentCount*100):0,t[28]=n.metrics.agentCount,t[29]=n.metrics.doneAgentCount,t[30]=A):A=t[30];let j=A;y=`group border-b border-edge-subtle last:border-b-0`,v=`flex min-w-0 flex-col gap-3 p-3 transition-colors hover:bg-surface-hover/55 sm:px-4 lg:flex-row lg:items-center`,O=`button`,t[31]!==o||t[32]!==n?(k=()=>o(n),t[31]=o,t[32]=n,t[33]=k):k=t[33],t[34]===Symbol.for(`react.memo_cache_sentinel`)?(g=T(`min-w-0 flex-1 text-left`,z.focusRingPanel),t[34]=g):g=t[34];let M=p.taskOpenDetails,N;t[35]===n?N=t[36]:(N=tn(n),t[35]=n,t[36]=N),_=`${M}: ${N}`,E=`flex min-w-0 items-start gap-3`;let P;t[37]===n.status?P=t[38]:(P=T(`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold`,De(n.status)),t[37]=n.status,t[38]=P),D=(0,$.jsx)(`span`,{className:P,children:p.status[n.status]??n.status}),h=`min-w-0 flex-1`;let F;t[39]===n?F=t[40]:(F=tn(n),t[39]=n,t[40]=F),t[41]===F?b=t[42]:(b=(0,$.jsx)(`span`,{className:`block truncate text-sm font-medium text-fg`,children:F}),t[41]=F,t[42]=b);let I;t[43]===n?I=t[44]:(I=nn(n),t[43]=n,t[44]=I);let L;t[45]===I?L=t[46]:(L=(0,$.jsx)(`span`,{className:`truncate font-medium`,children:I}),t[45]=I,t[46]=L);let R;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),t[47]=R):R=t[47];let B;t[48]!==i||t[49]!==a||t[50]!==l?(B=un(l,a,i),t[48]=i,t[49]=a,t[50]=l,t[51]=B):B=t[51];let V;t[52]===B?V=t[53]:(V=(0,$.jsx)(`span`,{children:B}),t[52]=B,t[53]=V);let H=d===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:be(p.taskElapsed,{duration:d})})]});t[54]!==L||t[55]!==V||t[56]!==H?(x=(0,$.jsxs)(`span`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-fg-muted`,children:[L,R,V,H]}),t[54]=L,t[55]=V,t[56]=H,t[57]=x):x=t[57],S=u&&n.metrics.agentCount>0?(0,$.jsxs)(`span`,{className:`mt-2 block max-w-md`,children:[(0,$.jsxs)(`span`,{className:`flex items-center justify-between text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:be(p.agentProgress,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}),(0,$.jsxs)(`span`,{className:`tabular-nums`,children:[j,`%`]})]}),(0,$.jsx)(`span`,{className:`mt-1 block h-1.5 overflow-hidden rounded-full bg-surface-inset`,children:(0,$.jsx)(`span`,{className:`block h-full rounded-full bg-accent transition-[width] duration-200 motion-reduce:transition-none`,style:{width:`${j}%`}})})]}):null,C=n.metrics.errorAgentCount>0?(0,$.jsxs)(`span`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(ye,{className:`size-3 shrink-0`,"aria-hidden":!0}),be(p.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null,t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=n,t[5]=u,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]=b,t[15]=x,t[16]=S,t[17]=C,t[18]=E,t[19]=D,t[20]=O,t[21]=k}else u=t[5],f=t[6],p=t[7],m=t[8],h=t[9],g=t[10],_=t[11],v=t[12],y=t[13],b=t[14],x=t[15],S=t[16],C=t[17],E=t[18],D=t[19],O=t[20],k=t[21];let A;t[58]!==h||t[59]!==b||t[60]!==x||t[61]!==S||t[62]!==C?(A=(0,$.jsxs)(`span`,{className:h,children:[b,x,S,C]}),t[58]=h,t[59]=b,t[60]=x,t[61]=S,t[62]=C,t[63]=A):A=t[63];let j;t[64]!==A||t[65]!==E||t[66]!==D?(j=(0,$.jsxs)(`div`,{className:E,children:[D,A]}),t[64]=A,t[65]=E,t[66]=D,t[67]=j):j=t[67];let M;t[68]!==g||t[69]!==_||t[70]!==j||t[71]!==O||t[72]!==k?(M=(0,$.jsx)(`button`,{type:O,onClick:k,className:g,"aria-label":_,children:j}),t[68]=g,t[69]=_,t[70]=j,t[71]=O,t[72]=k,t[73]=M):M=t[73];let N;t[74]!==p.rerun||t[75]!==l||t[76]!==m||t[77]!==n.id?(N=m?(0,$.jsx)(L,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>l(n.id),children:p.rerun}):null,t[74]=p.rerun,t[75]=l,t[76]=m,t[77]=n.id,t[78]=N):N=t[78];let P;t[79]!==f||t[80]!==p.continueInChat||t[81]!==s||t[82]!==n?(P=n.status===`succeeded`&&f?(0,$.jsx)(L,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>s(n),children:p.continueInChat}):null,t[79]=f,t[80]=p.continueInChat,t[81]=s,t[82]=n,t[83]=P):P=t[83];let F;t[84]!==u||t[85]!==p.cancel||t[86]!==c||t[87]!==n.id?(F=u?(0,$.jsx)(L,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg text-xs text-red-600 dark:text-red-300`,onClick:()=>c(n.id),children:p.cancel}):null,t[84]=u,t[85]=p.cancel,t[86]=c,t[87]=n.id,t[88]=F):F=t[88];let I;t[89]!==o||t[90]!==n?(I=()=>o(n),t[89]=o,t[90]=n,t[91]=I):I=t[91];let R;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(d,{className:`size-4`,"aria-hidden":!0}),t[92]=R):R=t[92];let B;t[93]!==p.taskOpenDetails||t[94]!==I?(B=(0,$.jsx)(L,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":p.taskOpenDetails,onClick:I,children:R}),t[93]=p.taskOpenDetails,t[94]=I,t[95]=B):B=t[95];let V;t[96]!==N||t[97]!==P||t[98]!==F||t[99]!==B?(V=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 pl-7 lg:pl-0`,children:[N,P,F,B]}),t[96]=N,t[97]=P,t[98]=F,t[99]=B,t[100]=V):V=t[100];let H;t[101]!==v||t[102]!==M||t[103]!==V?(H=(0,$.jsxs)(`div`,{className:v,children:[M,V]}),t[101]=v,t[102]=M,t[103]=V,t[104]=H):H=t[104];let U;return t[105]!==y||t[106]!==H?(U=(0,$.jsx)(`article`,{className:y,children:H}),t[105]=y,t[106]=H,t[107]=U):U=t[107],U});function jn(e){let t=(0,Q.c)(41),{vm:n}=e,{labels:r,language:i,loading:a,pageTab:o,ownerAgentId:s,agentOptions:c,setOwnerAgentId:l,refreshAll:u,startWorkflowCreation:d,openManualWorkflowCreator:m}=n,h;t[0]!==c||t[1]!==r.agentFilterAria||t[2]!==r.allAgents||t[3]!==i||t[4]!==s||t[5]!==o||t[6]!==l?(h=o===`runs`&&c.length>1?(0,$.jsxs)(f,{value:s??``,"aria-label":r.agentFilterAria,onChange:e=>l(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,$.jsx)(p,{value:``,children:r.allAgents}),c.map(e=>(0,$.jsx)(p,{value:e.id,children:te(e,w(i).agentsSettings)},e.id))]}):null,t[0]=c,t[1]=r.agentFilterAria,t[2]=r.allAgents,t[3]=i,t[4]=s,t[5]=o,t[6]=l,t[7]=h):h=t[7];let g;t[8]!==r.refresh||t[9]!==a||t[10]!==u?(g=(0,$.jsx)(rt,{className:`size-9 shrink-0 p-0`,loading:a,label:r.refresh,onClick:u}),t[8]=r.refresh,t[9]=a,t[10]=u,t[11]=g):g=t[11];let _;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(b,{className:`size-4`,"aria-hidden":!0}),t[12]=_):_=t[12];let v;t[13]!==r.addWorkflow||t[14]!==d?(v=(0,$.jsxs)(L,{variant:`primary`,className:`h-9 rounded-r-none pr-2.5`,onClick:d,children:[_,r.addWorkflow]}),t[13]=r.addWorkflow,t[14]=d,t[15]=v):v=t[15];let x;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(pt,{className:`size-4`,"aria-hidden":!0}),t[16]=x):x=t[16];let S;t[17]===r.createOptions?S=t[18]:(S=(0,$.jsx)(ut,{asChild:!0,children:(0,$.jsx)(L,{variant:`primary`,className:`h-9 w-9 rounded-l-none border-l border-white/20 px-0`,"aria-label":r.createOptions,title:r.createOptions,children:x})}),t[17]=r.createOptions,t[18]=S);let C;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(le,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),t[19]=C):C=t[19];let T;t[20]!==r.createWithAssistant||t[21]!==d?(T=(0,$.jsxs)(lt,{className:`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,onSelect:d,children:[C,r.createWithAssistant]}),t[20]=r.createWithAssistant,t[21]=d,t[22]=T):T=t[22];let E;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(y,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),t[23]=E):E=t[23];let D;t[24]!==r.setUpManually||t[25]!==m?(D=(0,$.jsxs)(lt,{className:`touch-target flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover`,onSelect:m,children:[E,r.setUpManually]}),t[24]=r.setUpManually,t[25]=m,t[26]=D):D=t[26];let O;t[27]!==D||t[28]!==T?(O=(0,$.jsx)(gt,{children:(0,$.jsxs)(vt,{align:`end`,sideOffset:6,className:`z-70 min-w-52 rounded-xl border border-edge bg-surface-panel p-1 shadow-popover`,children:[T,D]})}),t[27]=D,t[28]=T,t[29]=O):O=t[29];let k;t[30]!==O||t[31]!==S?(k=(0,$.jsxs)($e,{children:[S,O]}),t[30]=O,t[31]=S,t[32]=k):k=t[32];let A;t[33]!==r.createOptions||t[34]!==k||t[35]!==v?(A=(0,$.jsxs)(`div`,{className:`inline-flex h-9 shrink-0`,role:`group`,"aria-label":r.createOptions,children:[v,k]}),t[33]=r.createOptions,t[34]=k,t[35]=v,t[36]=A):A=t[36];let j;return t[37]!==h||t[38]!==A||t[39]!==g?(j=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[h,g,A]}),t[37]=h,t[38]=A,t[39]=g,t[40]=j):j=t[40],j}var Mn=new Set([`failed`,`timeout`,`cancelled`]),Nn=[{id:`runs`,icon:he},{id:`library`,icon:X}],Pn={failed:0,timeout:0,cancelled:0,running:1,queued:2,succeeded:3};function Fn(e){return Mn.has(e.status)}function In(e,t){return t===`all`?!0:t===`attention`?Fn(e):e.status===t}function Ln(e){return[...e].sort((e,t)=>{let n=(Pn[e.status]??4)-(Pn[t.status]??4);if(n!==0)return n;if(e.status===`queued`&&t.status===`queued`)return e.createdAtMs-t.createdAtMs;let r=e.completedAtMs??e.startedAtMs??e.createdAtMs;return(t.completedAtMs??t.startedAtMs??t.createdAtMs)-r})}function Rn(e,t){return e===`Home`?`runs`:e===`End`?`library`:e===`ArrowLeft`||e===`ArrowRight`?t===`runs`?`library`:`runs`:null}function zn(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(R,{className:`h-5 w-16 rounded-full`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle p-4 last:border-b-0`,"aria-hidden":`true`,children:[t,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(R,{className:`h-4 w-52 max-w-full`}),(0,$.jsx)(R,{className:`mt-2 h-3 w-36 max-w-full`})]}),(0,$.jsx)(R,{className:`hidden h-8 w-20 rounded-lg sm:block`})]}),e[1]=n):n=e[1],n}function Bn(e){let t=(0,Q.c)(27),{vm:n}=e,{language:r,ownerAgentId:i,localeTag:a,labels:o,hasToken:s,definitions:c,projectPresetDefinitionIds:l,runs:u,searchQuery:d,setSearchQuery:m,workflowFilterId:h,setWorkflowFilterId:g,triggerFilter:_,setTriggerFilter:v,statusFilter:y,setStatusFilter:b,clearRunFilters:x,pageTab:w,setPageTab:E,runLayout:D,setRunLayout:O,openRunDetails:k,openRunInChat:A,openDefinitionDetails:j,openWorkflowEditor:M,startWorkflow:N,actionError:P,loading:F,error:I,cancelRun:R,retryRun:B}=n,V=bt(Un),H=bt(Hn),U=Date.now(),G=Ln(u.filter(Fn)),ee;t[0]===y?ee=t[1]:(ee=e=>In(e,y),t[0]=y,t[1]=ee);let K=Ln(an(u,{searchQuery:d,workflowFilterId:h,triggerFilter:_}).filter(ee)),q=!!(i||d||h||_!==`all`||y!==`all`),te,ne;if(t[2]!==H||t[3]!==s||t[4]!==o.title||t[5]!==V||t[6]!==n?(te=()=>{if(!s){H();return}return V({startExtra:null,main:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:o.title}),end:(0,$.jsx)(jn,{vm:n})}),()=>H()},ne=[H,s,o.title,V,n],t[2]=H,t[3]=s,t[4]=o.title,t[5]=V,t[6]=n,t[7]=te,t[8]=ne):(te=t[7],ne=t[8]),(0,Z.useLayoutEffect)(te,ne),!s){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(ot,{className:`size-10 text-accent-fg`,"aria-hidden":!0}),t[9]=e):e=t[9];let n;t[10]===o.title?n=t[11]:(n=(0,$.jsx)(`h1`,{className:`mt-4 text-xl font-semibold text-fg`,children:o.title}),t[10]=o.title,t[11]=n);let r;t[12]===o.needToken?r=t[13]:(r=(0,$.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:o.needToken}),t[12]=o.needToken,t[13]=r);let i;return t[14]!==n||t[15]!==r?(i=(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-auto bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`flex w-full flex-col items-center px-3 py-16 text-center sm:px-5 xl:px-6`,children:[e,n,r]})}),t[14]=n,t[15]=r,t[16]=i):i=t[16],i}let ie=o.pageTabsAria,J=Nn.map(e=>{let{id:t,icon:n}=e;return(0,$.jsxs)(`button`,{id:`workflow-tab-${t}`,type:`button`,role:`tab`,"aria-selected":w===t,"aria-controls":`workflow-panel-${t}`,tabIndex:w===t?0:-1,draggable:!1,className:T(`relative inline-flex shrink-0 items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`transition-transform duration-150 ease-out active:scale-[0.98] motion-reduce:transition-none motion-reduce:active:scale-100`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,w===t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>E(t),onKeyDown:e=>{let n=Rn(e.key,t);n&&(e.preventDefault(),E(n),window.requestAnimationFrame(()=>{document.getElementById(`workflow-tab-${n}`)?.focus()}))},children:[(0,$.jsx)(n,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:o.pageTabs[t]}),t===`runs`&&G.length>0?(0,$.jsx)(`span`,{className:`rounded-full bg-red-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-red-700 dark:text-red-300`,children:G.length}):null]},t)}),ae;t[17]!==o.pageTabsAria||t[18]!==J?(ae=(0,$.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":ie,role:`tablist`,children:J}),t[17]=o.pageTabsAria,t[18]=J,t[19]=ae):ae=t[19];let Y;t[20]!==P||t[21]!==I?(Y=P??I?(0,$.jsx)(`div`,{className:`mt-4 rounded-lg border border-red-500/25 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-300`,role:`alert`,children:P??I}):null,t[20]=P,t[21]=I,t[22]=Y):Y=t[22];let oe=w===`runs`?(0,$.jsxs)(`div`,{id:`workflow-panel-runs`,role:`tabpanel`,"aria-labelledby":`workflow-tab-runs`,className:`flex flex-col gap-4 py-4`,children:[G.length>0?(0,$.jsx)(`section`,{className:`rounded-xl border border-amber-500/30 bg-amber-500/8 px-4 py-3`,"aria-labelledby":`workflow-attention-heading`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 lg:flex-row lg:items-center lg:justify-between`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,$.jsx)(ye,{className:`mt-0.5 size-4 shrink-0 text-amber-700 dark:text-amber-300`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{id:`workflow-attention-heading`,className:`text-sm font-semibold text-fg`,children:o.attentionTitle}),(0,$.jsx)(`span`,{className:`rounded-full bg-amber-500/15 px-2 py-0.5 text-[10px] font-semibold text-amber-800 dark:text-amber-200`,children:G.length})]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[tn(G[0]),` · `,un(G[0].completedAtMs??G[0].createdAtMs,U,a)]})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pl-7 lg:pl-0`,children:[(0,$.jsx)(L,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>k(G[0]),children:o.attentionView}),(0,$.jsx)(L,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>void B(G[0].id),children:o.rerun})]})]})}):null,(0,$.jsx)(`section`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3`,"aria-label":o.runFiltersAria,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-52 flex-1 sm:max-w-sm`,children:[(0,$.jsx)(S,{className:`pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`input`,{value:d,onChange:e=>m(e.target.value),placeholder:o.runsSearchPlaceholder,className:T(`h-9 w-full rounded-lg border border-edge bg-surface-panel py-2 pl-9 pr-3 text-sm text-fg shadow-surface`,`placeholder:text-fg-muted`,z.focusRingPanel)})]}),(0,$.jsx)(f,{value:y,"aria-label":o.statusFilterAria,onChange:e=>b(e.target.value),className:`h-9 min-w-32 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[`all`,`attention`,`running`,`queued`,`succeeded`].map(e=>(0,$.jsx)(p,{value:e,children:o.runStatuses[e]},e))}),(0,$.jsxs)(f,{value:_,"aria-label":o.boardTriggerFilterAria,onChange:e=>v(e.target.value),className:`h-9 min-w-[7.5rem] rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,$.jsx)(p,{value:`all`,children:o.boardTriggerFilterAll}),(0,$.jsx)(p,{value:`automation`,children:o.boardTriggerFilterAutomation}),(0,$.jsx)(p,{value:`webui`,children:o.boardTriggerFilterWebui}),(0,$.jsx)(p,{value:`chat`,children:o.boardTriggerFilterChat}),(0,$.jsx)(p,{value:`api`,children:o.boardTriggerFilterApi})]}),(0,$.jsxs)(f,{value:h,"aria-label":o.boardWorkflowFilterAria,onChange:e=>g(e.target.value),className:`h-9 min-w-40 rounded-lg border border-edge bg-surface-panel px-2.5 text-xs font-medium text-fg shadow-surface`,children:[(0,$.jsx)(p,{value:``,children:o.boardWorkflowFilterAll}),c.map(e=>(0,$.jsx)(p,{value:e.id,children:W(e,r).title},e.id))]}),q?(0,$.jsxs)(L,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:x,children:[(0,$.jsx)(C,{className:`size-3.5`,"aria-hidden":!0}),o.clearFilters]}):null,(0,$.jsxs)(`div`,{className:`ml-auto flex rounded-lg bg-surface-inset p-0.5`,role:`group`,"aria-label":o.layoutAria,children:[(0,$.jsxs)(`button`,{type:`button`,className:T(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,D===`list`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,z.focusRingPanel),"aria-pressed":D===`list`,onClick:()=>O(`list`),children:[(0,$.jsx)(re,{className:`size-3.5`,"aria-hidden":!0}),o.runLayouts.list]}),(0,$.jsxs)(`button`,{type:`button`,className:T(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,D===`board`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,z.focusRingPanel),"aria-pressed":D===`board`,onClick:()=>O(`board`),children:[(0,$.jsx)(Pe,{className:`size-3.5`,"aria-hidden":!0}),o.runLayouts.board]})]})]})}),D===`list`?(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-base`,"aria-labelledby":`workflow-runs-heading`,children:[(0,$.jsxs)(`header`,{className:`flex items-start justify-between gap-3 border-b border-edge-subtle px-4 py-3`,children:[(0,$.jsx)(`h2`,{id:`workflow-runs-heading`,className:`text-sm font-semibold text-fg`,children:o.allRuns}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-semibold tabular-nums text-fg-muted`,children:K.length})]}),F&&K.length===0?Array.from({length:4}).map(Vn):K.length>0?K.map(e=>(0,$.jsx)(An,{run:e,language:r,localeTag:a,nowMs:U,onOpen:k,onOpenChat:A,onCancel:e=>void R(e),onRetry:e=>void B(e)},e.id)):(0,$.jsxs)(`div`,{className:`flex min-h-64 flex-col items-center justify-center px-4 py-12 text-center`,children:[(0,$.jsx)(ot,{className:`size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`mt-3 text-sm font-semibold text-fg`,children:q?o.noRunResultsTitle:o.noRunsTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-5 text-fg-muted`,children:q?o.noRunResultsHint:o.noRunsStartHint}),(0,$.jsx)(L,{type:`button`,variant:q?`secondary`:`primary`,className:`mt-4 h-9 rounded-lg text-xs`,onClick:q?x:()=>E(`library`),children:q?o.clearFilters:o.chooseWorkflow})]})]}):(0,$.jsx)(`div`,{className:`h-[min(72vh,48rem)] min-h-[24rem] w-full sm:min-h-[28rem]`,children:(0,$.jsx)(bn,{runs:K,language:r,localeTag:a,labels:{boardEmptyTitle:o.boardEmptyTitle,boardEmptyHint:o.boardEmptyHint,boardStart:o.chooseWorkflow,loading:o.loading},searchQuery:``,workflowFilterId:``,triggerFilter:`all`,selectedRunId:null,loading:F,onOpenRun:k,onOpenRunChat:A,onCancelRun:e=>void R(e),onRetryRun:e=>void B(e),onStart:()=>E(`library`)})})]}):(0,$.jsx)(`section`,{id:`workflow-panel-library`,role:`tabpanel`,"aria-labelledby":`workflow-tab-library`,className:`py-5`,children:(0,$.jsx)(En,{definitions:c,runs:u,language:r,projectPresetDefinitionIds:l,onPick:N,onDetail:j,onEdit:M})}),se;return t[23]!==Y||t[24]!==oe||t[25]!==ae?(se=(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`mx-auto flex min-h-full w-full max-w-[96rem] flex-col px-3 pb-5 pt-3 sm:px-5 lg:pt-4 xl:px-6`,children:[ae,Y,oe]})}),t[23]=Y,t[24]=oe,t[25]=ae,t[26]=se):se=t[26],se}function Vn(e,t){return(0,$.jsx)(zn,{},t)}function Hn(e){return e.clearPageHeader}function Un(e){return e.setPageHeader}function Wn(e,t){let n=new URLSearchParams({draft:e.trim()}),r=t?.trim();return r?n.set(`projectId`,r):n.set(`projectScope`,`none`),`/chat/new?${n.toString()}`}function Gn(){let e=D(e=>e.language),t=w(e).workflows,n=e===`zh`?`zh-CN`:`en-US`,r=E(e=>e.conversationId),o=!!r,s=i(),[c,l]=a(),u=c.get(`q`)??``,d=c.get(`wf`)?.trim()??``,f=c.get(`trigger`)?.trim()||`all`,p=c.get(`status`)?.trim()??``,m=c.get(`tab`)?.trim()??``,h=c.get(`layout`)?.trim()??``,g=c.get(`agent`)?.trim()??``,_=c.get(`projectId`)?.trim()||void 0,v=ue.has(m)?m:`runs`,y=mt.has(h)?h:`list`,b=Ne.has(p)?p:`all`,[x,S]=(0,Z.useState)(null),C=I(o?[`workflow-agents`,r]:null,B,{revalidateOnFocus:!1}),T=g||void 0,O=T?[T]:(C.data?.agents??[]).map(e=>e.id),k=I(o?[`workflow-definitions`,r]:null,St,{revalidateOnFocus:!1}),A=I(o&&_?[`workflow-project-presets`,r,_]:null,()=>ze(_),{revalidateOnFocus:!1}),j=I(o&&O.length?[`workflow-runs`,r,O,_??``]:null,()=>Dt(O,100,{projectId:_}),{revalidateOnFocus:!1,refreshInterval:e=>e?.some(e=>e.status===`queued`||e.status===`running`)?3e3:0}),M=k.data??[],N=j.data??[],P=(0,Z.useCallback)(e=>{l(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},[l]),F=(0,Z.useCallback)(e=>P(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),[P]),L=(0,Z.useCallback)(e=>P(t=>{let n=e.trim();n?t.set(de,n):t.delete(de)}),[P]),R=(0,Z.useCallback)(e=>P(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),[P]),z=(0,Z.useCallback)(e=>P(t=>{e&&e!==`all`?t.set(Re,e):t.delete(Re)}),[P]),V=(0,Z.useCallback)(e=>P(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),[P]),H=(0,Z.useCallback)(e=>P(t=>{e===`list`?t.delete(me):t.set(me,e)}),[P]),U=(0,Z.useCallback)(e=>P(t=>{e===`all`?t.delete(Le):t.set(Le,e)}),[P]),W=(0,Z.useCallback)(()=>P(e=>{e.delete(`q`),e.delete(`wf`),e.delete(Re),e.delete(Le),e.delete(de)}),[P]),G=(0,Z.useMemo)(()=>{let e=new URLSearchParams;return _&&e.set(`projectId`,_),e.size?`?${e.toString()}`:``},[_]),ee=(0,Z.useCallback)(e=>s(`/workflows/${e.id}${G}`),[s,G]),K=(0,Z.useCallback)(()=>{s(Wn(t.createWithAssistantPrompt,_))},[t.createWithAssistantPrompt,s,_]),q=(0,Z.useCallback)(()=>{s(`/workflows/new${G}`)},[s,G]),te=ee,ne=(0,Z.useCallback)(e=>{let t=new URLSearchParams(G.slice(1));e.metadata.source!==`user`&&t.set(`copy`,e.id),s(e.metadata.source===`user`?`/workflows/${e.id}/edit${G}`:`/workflows/new${t.size?`?${t.toString()}`:``}`)},[s,G]),re=(0,Z.useCallback)(e=>{let t=new URLSearchParams(G.slice(1)),n=e.ownerAgentId??e.metadata?.agentId??T;return n&&t.set(`agentId`,n),t.size?`?${t.toString()}`:``},[T,G]),ie=(0,Z.useCallback)(e=>s(`/workflows/runs/${e.id}${re(e)}`),[s,re]),J=(0,Z.useCallback)(e=>{let t=Zt(e);t&&s(kt(t))},[s]),ae=(0,Z.useCallback)(async e=>{try{await He(e,{ownerAgentId:N.find(t=>t.id===e)?.ownerAgentId??T}),await j.mutate()}catch(e){S(e instanceof Error?e.message:t.cancelFailed)}},[t.cancelFailed,T,N,j]),Y=(0,Z.useCallback)(async e=>{try{let t=N.find(t=>t.id===e);s(`/workflows/runs/${(await ke(e,{ownerAgentId:t?.ownerAgentId??T})).runId}${t?re(t):G}`)}catch(e){S(e instanceof Error?e.message:t.retryFailed)}},[t.retryFailed,s,T,G,re,N]);(0,Z.useEffect)(()=>{let e=()=>void j.mutate();return window.addEventListener(`workflow-run-updated`,e),window.addEventListener(`workflow-run-error`,e),()=>{window.removeEventListener(`workflow-run-updated`,e),window.removeEventListener(`workflow-run-error`,e)}},[j]);let oe=(0,Z.useCallback)(()=>{Promise.all([C.mutate(),k.mutate(),A.mutate(),j.mutate()])},[C,k,A,j]),se=C.isLoading||k.isLoading||j.isLoading||A.isLoading,ce=C.error?.message??k.error?.message??j.error?.message??A.error?.message??null;return{language:e,localeTag:n,labels:t,hasToken:o,searchQuery:u,setSearchQuery:F,ownerAgentId:T,projectId:_,agentOptions:C.data?.agents??[],setOwnerAgentId:L,workflowFilterId:d,setWorkflowFilterId:R,triggerFilter:f,setTriggerFilter:z,statusFilter:b,setStatusFilter:U,clearRunFilters:W,pageTab:v,setPageTab:V,runLayout:y,setRunLayout:H,definitions:M,projectPresetDefinitionIds:new Set((A.data??[]).map(e=>e.definitionId)),runs:N,openDefinitionDetails:ee,startWorkflowCreation:K,openManualWorkflowCreator:q,startWorkflow:te,openWorkflowEditor:ne,openRunDetails:ie,openRunInChat:J,actionError:x,loading:se,error:ce,refreshAll:oe,cancelRun:ae,retryRun:Y}}function Kn(){let e=(0,Q.c)(2),t=Gn(),n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(Bn,{vm:t}),e[0]=t,e[1]=n),n}function qn(e){let t=(0,Q.c)(16),{value:n,language:r,onChange:i}=e,a=I(`settings-agent-defaults`,ge),o=a.data?.defaults.models.chat.primary,s=r===`zh`,c=`${s?`全局默认模型`:`Global default model`}${o?` · ${o}`:``}`;if(a.isLoading){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(R,{className:`mt-1 h-10 w-full rounded-lg`}),t[0]=e):e=t[0],e}let l=n??``,u=s?`步骤模型`:`Step model`,d=s?`搜索模型`:`Search models`,f=s?`没有匹配的模型`:`No matching models`,p;t[1]===i?p=t[2]:(p=e=>i(e||void 0),t[1]=i,t[2]=p);let m;t[3]!==c||t[4]!==l||t[5]!==u||t[6]!==d||t[7]!==f||t[8]!==p?(m=(0,$.jsx)(qe,{value:l,placeholder:c,emptyLabel:c,allowEmpty:!0,ariaLabel:u,searchPlaceholder:d,noMatches:f,contentAlign:`start`,className:`w-full`,onChange:p}),t[3]=c,t[4]=l,t[5]=u,t[6]=d,t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]!==a.error||t[11]!==s?(h=a.error?(0,$.jsx)(`p`,{role:`alert`,className:`mt-1 text-xs text-danger`,children:s?`无法加载全局默认模型`:`Unable to load the global default model`}):null,t[10]=a.error,t[11]=s,t[12]=h):h=t[12];let g;return t[13]!==m||t[14]!==h?(g=(0,$.jsxs)(`div`,{className:`mt-1`,children:[m,h]}),t[13]=m,t[14]=h,t[15]=g):g=t[15],g}function Jn(e){return{title:e.title,description:e.description,version:e.version,inputSchema:e.inputSchema,outputSchema:e.outputSchema,defaults:e.defaults,tags:e.metadata.tags,whenToUse:e.metadata.whenToUse,estimatedAgents:e.metadata.estimatedAgents,examplePrompts:e.metadata.examplePrompts,i18n:e.metadata.i18n,permissions:e.permissions,resources:e.resources,connectors:e.connectors}}function Yn(e){let t=(0,Q.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=At(),t[0]=n):n=t[0];let r=n,i;return t[1]===e?i=t[2]:(i=(0,$.jsx)(jt,{...e,language:r}),t[1]=e,t[2]=i),i}function Xn({initialSource:e,resetKey:t,fileName:n,language:r,readOnly:i=!0,error:a,onChange:o,allowImport:s=!1,className:c=`h-[28rem]`}){let l=Zn(r),d=V(e=>e.resolved)===`dark`,[f,p]=(0,Z.useState)(e),[m,h]=(0,Z.useState)(0),[_,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(null),x=(0,Z.useRef)(null),S=(0,Z.useRef)(null),C=(0,Z.useRef)(null),w=(0,Z.useRef)(e);w.current=e,(0,Z.useEffect)(()=>{p(w.current),h(e=>e+1)},[t]),(0,Z.useEffect)(()=>{let e=e=>{let t=C.current;t&&b(Qn(t.startHeight+e.clientY-t.startY))},t=()=>{C.current=null,document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`)};return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t),t()}},[]);let T=e=>{x.current&&(e.preventDefault(),C.current={startY:e.clientY,startHeight:x.current.getBoundingClientRect().height},document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`)},E=e=>{e.key!==`ArrowUp`&&e.key!==`ArrowDown`||(e.preventDefault(),b(Qn((y??x.current?.getBoundingClientRect().height??448)+(e.key===`ArrowDown`?24:-24))))},D=e=>{p(e),o?.(e)};return(0,$.jsxs)(`section`,{ref:x,className:`relative flex min-h-0 flex-col overflow-hidden rounded-xl border border-edge bg-surface-base ${c}`,style:y===null?void 0:{height:y,minHeight:280,flex:`none`},children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-edge bg-surface-panel px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`mr-auto flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(Tt,{className:`size-3.5`,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:l.title}),(0,$.jsx)(`span`,{className:a?`text-danger`:`text-success`,children:a?l.invalid:l.valid})]}),i?null:(0,$.jsx)(L,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:!!a,onClick:()=>{try{D(`${JSON.stringify(JSON.parse(f),null,2)}\n`),h(e=>e+1)}catch{}},children:l.format}),s?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`input`,{ref:S,type:`file`,accept:`application/json,.json`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&t.text().then(e=>{D(e),h(e=>e+1)})}}),(0,$.jsxs)(L,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>S.current?.click(),children:[(0,$.jsx)(K,{className:`size-3.5`,"aria-hidden":!0}),l.import]})]}):null,(0,$.jsxs)(L,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void F(f).then(e=>{e&&(v(!0),window.setTimeout(()=>v(!1),1500))}),children:[_?(0,$.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(Ee,{className:`size-3.5`,"aria-hidden":!0}),_?l.copied:l.copy]}),(0,$.jsxs)(L,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>{let e=URL.createObjectURL(new Blob([f],{type:`application/json;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=n,t.click(),URL.revokeObjectURL(e)},children:[(0,$.jsx)(g,{className:`size-3.5`,"aria-hidden":!0}),l.download]})]}),a?(0,$.jsx)(`div`,{className:`shrink-0 border-b border-danger/25 bg-danger/5 px-4 py-2 text-xs text-danger`,children:a}):null,(0,$.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,$.jsx)(Yn,{initialContent:f,onChange:D,isDark:d,readOnly:i,lineWrap:!1},`${t}:${m}`)}),(0,$.jsx)(`div`,{role:`separator`,"aria-orientation":`horizontal`,"aria-label":l.resize,title:l.resize,tabIndex:0,className:`group absolute inset-x-0 bottom-0 z-10 flex h-3 touch-none cursor-row-resize items-end justify-center border-t border-transparent outline-none hover:border-accent/40 focus:border-accent/40`,onPointerDown:T,onKeyDown:E,onDoubleClick:()=>b(null),children:(0,$.jsx)(`span`,{className:`mb-1 h-0.5 w-10 rounded-full bg-edge-strong transition-colors group-hover:bg-accent group-focus:bg-accent`})})]})}function Zn(e){return e===`zh`?{title:`工作流定义 · JSON`,valid:`有效`,invalid:`需要修复`,format:`格式化`,copy:`复制`,copied:`已复制`,download:`下载`,import:`导入`,resize:`上下拖动调整源码区域高度`}:{title:`Workflow definition · JSON`,valid:`Valid`,invalid:`Needs attention`,format:`Format`,copy:`Copy`,copied:`Copied`,download:`Download`,import:`Import`,resize:`Drag vertically to resize the source area`}}function Qn(e){let t=typeof window>`u`?960:Math.max(280,window.innerHeight-96);return Math.min(t,Math.max(280,Math.round(e)))}function $n(e){return er(e.name,e.graph,Jn(e))}function er(e,t,n){return{formatVersion:1,name:e,manifest:structuredClone(n),graph:structuredClone(t)}}function tr(e){return er(e.name,e.graph,{title:e.title,description:e.description,version:e.version,defaults:e.defaults,tags:e.tags,estimatedAgents:e.estimatedAgents,permissions:e.permissions,resources:e.resources,connectors:e.connectors,inputSchema:e.inputSchema,outputSchema:e.outputSchema,whenToUse:e.whenToUse,examplePrompts:e.examplePrompts,i18n:e.i18n})}function nr(e,t){let n=dr(e),r=dr(t);if(n.length*r.length>25e4)return fr(n,r);let i=Array.from({length:n.length+1},()=>new Uint32Array(r.length+1));for(let e=n.length-1;e>=0;--e)for(let t=r.length-1;t>=0;--t)i[e][t]=n[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let a=[],o=0,s=0;for(;o<n.length&&s<r.length;)n[o]===r[s]?(a.push({kind:`same`,beforeLine:o+1,afterLine:s+1,text:n[o]}),o+=1,s+=1):i[o+1][s]>=i[o][s+1]?(a.push({kind:`removed`,beforeLine:o+1,text:n[o]}),o+=1):(a.push({kind:`added`,afterLine:s+1,text:r[s]}),s+=1);for(;o<n.length;)a.push({kind:`removed`,beforeLine:++o,text:n[o-1]});for(;s<r.length;)a.push({kind:`added`,afterLine:++s,text:r[s-1]});return a}function rr(e){return`${JSON.stringify(e,null,2)}\n`}function ir(e){let t;try{t=JSON.parse(e)}catch(e){return{ok:!1,error:e instanceof Error?e.message:`Invalid JSON.`}}if(!cr(t))return ur(`The source root must be a JSON object.`);if(t.formatVersion!==1)return ur(`formatVersion must be 1.`);if(typeof t.name!=`string`||!/^[a-z][a-z0-9_-]*$/.test(t.name))return ur(`name must use lowercase letters, numbers, underscores, or hyphens.`);if(!cr(t.manifest))return ur(`manifest must be an object.`);let n=ar(t.manifest);if(n)return ur(n);if(!cr(t.graph))return ur(`graph must be an object.`);if(t.graph.schemaVersion!==1)return ur(`graph.schemaVersion must be 1.`);if(!Array.isArray(t.graph.nodes))return ur(`graph.nodes must be an array.`);if(!Array.isArray(t.graph.edges))return ur(`graph.edges must be an array.`);for(let[e,n]of t.graph.nodes.entries()){let t=or(n,e);if(t)return ur(t)}for(let[e,n]of t.graph.edges.entries()){let t=sr(n,e);if(t)return ur(t)}return{ok:!0,document:t}}function ar(e){for(let t of[`title`,`description`,`version`,`whenToUse`])if(e[t]!==void 0&&typeof e[t]!=`string`)return`manifest.${t} must be a string.`;return e.tags!==void 0&&(!Array.isArray(e.tags)||e.tags.some(e=>typeof e!=`string`))?`manifest.tags must be an array of strings.`:e.defaults!==void 0&&!cr(e.defaults)?`manifest.defaults must be an object.`:null}function or(e,t){return cr(e)?typeof e.id!=`string`||!e.id?`graph.nodes[${t}].id must be a non-empty string.`:[`input`,`agent`,`decision`,`merge`,`output`].includes(String(e.kind))?typeof e.title==`string`?!cr(e.position)||!lr(e.position.x)||!lr(e.position.y)?`graph.nodes[${t}].position must contain finite x and y values.`:cr(e.config)?null:`graph.nodes[${t}].config must be an object.`:`graph.nodes[${t}].title must be a string.`:`graph.nodes[${t}].kind is invalid.`:`graph.nodes[${t}] must be an object.`}function sr(e,t){if(!cr(e))return`graph.edges[${t}] must be an object.`;for(let n of[`id`,`source`,`target`])if(typeof e[n]!=`string`||!e[n])return`graph.edges[${t}].${n} must be a non-empty string.`;return e.sourcePort!==void 0&&![`true`,`false`,`default`].includes(String(e.sourcePort))?`graph.edges[${t}].sourcePort is invalid.`:null}function cr(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function lr(e){return typeof e==`number`&&Number.isFinite(e)}function ur(e){return{ok:!1,error:e}}function dr(e){let t=e.split(`
|
|
2
|
-
`);return t.at(-1)===``&&t.pop(),t}function fr(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n+=1;let r=0;for(;r<e.length-n&&r<t.length-n&&e[e.length-r-1]===t[t.length-r-1];)r+=1;return[...e.slice(0,n).map((e,t)=>({kind:`same`,beforeLine:t+1,afterLine:t+1,text:e})),...e.slice(n,e.length-r).map((e,t)=>({kind:`removed`,beforeLine:n+t+1,text:e})),...t.slice(n,t.length-r).map((e,t)=>({kind:`added`,afterLine:n+t+1,text:e})),...e.slice(e.length-r).map((n,i)=>({kind:`same`,beforeLine:e.length-r+i+1,afterLine:t.length-r+i+1,text:n}))]}function pr(e){let t=(0,Q.c)(31),{comparison:n,language:r,onClose:i}=e,a;t[0]===n?a=t[1]:(a=n?nr(n.before,n.after):[],t[0]=n,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=o.filter(hr),t[2]=o,t[3]=s);let c=s.length,l=!!n,u;t[4]===i?u=t[5]:(u=e=>{e||i()},t[4]=i,t[5]=u);let d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(O,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),t[6]=d):d=t[6];let f=r===`zh`?`源码变更`:`Source changes`,p;t[7]===f?p=t[8]:(p=(0,$.jsx)(N,{className:`text-base font-semibold text-fg`,children:f}),t[7]=f,t[8]=p);let m=n?`${n.beforeLabel} → ${n.afterLabel} · ${r===`zh`?`${c} 行变更`:`${c} changed lines`}`:``,h;t[9]===m?h=t[10]:(h=(0,$.jsx)(k,{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,$.jsxs)(`div`,{children:[p,h]}),t[11]=p,t[12]=h,t[13]=g):g=t[13];let _=r===`zh`?`关闭`:`Close`,v;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,$.jsx)(C,{className:`size-4`}),t[14]=v):v=t[14];let y;t[15]===_?y=t[16]:(y=(0,$.jsx)(A,{asChild:!0,children:(0,$.jsx)(L,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":_,children:v})}),t[15]=_,t[16]=y);let b;t[17]!==g||t[18]!==y?(b=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[g,y]}),t[17]=g,t[18]=y,t[19]=b):b=t[19];let x;t[20]===o?x=t[21]:(x=o.map(mr),t[20]=o,t[21]=x);let S;t[22]===x?S=t[23]:(S=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto bg-surface-base py-3 font-mono text-xs leading-5`,children:x}),t[22]=x,t[23]=S);let w;t[24]!==b||t[25]!==S?(w=(0,$.jsxs)(j,{children:[d,(0,$.jsxs)(M,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(46rem,calc(100vh-2rem))] w-[min(64rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-float`,children:[b,S]})]}),t[24]=b,t[25]=S,t[26]=w):w=t[26];let T;return t[27]!==w||t[28]!==l||t[29]!==u?(T=(0,$.jsx)(P,{open:l,onOpenChange:u,children:w}),t[27]=w,t[28]=l,t[29]=u,t[30]=T):T=t[30],T}function mr(e,t){return(0,$.jsxs)(`div`,{className:e.kind===`added`?`grid min-w-max grid-cols-[3rem_3rem_1.5rem_minmax(40rem,1fr)] bg-success/10 text-success`:e.kind===`removed`?`grid min-w-max grid-cols-[3rem_3rem_1.5rem_minmax(40rem,1fr)] bg-danger/10 text-danger`:`grid min-w-max grid-cols-[3rem_3rem_1.5rem_minmax(40rem,1fr)] text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`select-none border-r border-edge-subtle pr-2 text-right text-fg-subtle`,children:e.beforeLine??``}),(0,$.jsx)(`span`,{className:`select-none border-r border-edge-subtle pr-2 text-right text-fg-subtle`,children:e.afterLine??``}),(0,$.jsx)(`span`,{className:`select-none text-center`,children:e.kind===`added`?`+`:e.kind===`removed`?`−`:` `}),(0,$.jsx)(`span`,{className:`whitespace-pre pr-5`,children:e.text||` `})]},`${t}:${e.kind}`)}function hr(e){return e.kind!==`same`}function gr(e,t){let n=new Set(t);if(!n.has(e))return e;for(let t=2;t<1e3;t+=1){let r=`${e}_${t}`;if(!n.has(r))return r}return`${e}_${Date.now()}`}function _r(e){if(!(e instanceof Error))return null;let t=e;if(t.status!==409||!t.body||typeof t.body!=`object`)return null;let n=t.body,r=typeof n.currentRevision==`number`?n.currentRevision:0;return n.code===`WORKFLOW_NAME_EXISTS`&&typeof n.name==`string`&&typeof n.suggestedName==`string`?{code:`WORKFLOW_NAME_EXISTS`,name:n.name,currentRevision:r,suggestedName:n.suggestedName}:n.code===`WORKFLOW_REVISION_CONFLICT`?{code:`WORKFLOW_REVISION_CONFLICT`,currentRevision:r}:null}var vr={padding:.24,minZoom:.45,maxZoom:1};function yr({language:e,saving:t,initialDraft:n,initialName:r,existingNames:i,saveConflict:a,onSave:s,onSaveAndStart:u,onClearSaveConflict:d,onReloadLatest:f,onStartAuthoring:p}){let m=Ar(e),[h,g]=(0,Z.useState)(`my_workflow`),[_,v]=(0,Z.useState)(()=>Er()),[y,b]=(0,Z.useState)(()=>({title:m.untitled,description:``,tags:[`custom`]})),[S,w]=(0,Z.useState)(`agent-1`),[E,D,O]=Kt(_.nodes.map(e=>wr(e,e.id===`agent-1`))),[k,A]=(0,Z.useState)(``),[j,M]=(0,Z.useState)(``),[N,P]=(0,Z.useState)(!1),[F,I]=(0,Z.useState)(null),[R,B]=(0,Z.useState)(null),[V,H]=(0,Z.useState)(`idle`),[W,G]=(0,Z.useState)(0),[ee,K]=(0,Z.useState)([]),[q,te]=(0,Z.useState)(null),ne=(0,Z.useRef)(``),re=(0,Z.useRef)(``),ie=(0,Z.useRef)(void 0),J=(0,Z.useRef)(void 0),Y=(0,Z.useRef)(``),oe=(0,Z.useRef)(!1),se=(0,Z.useRef)(null),[ce,le]=(0,Z.useState)(0),[ue,de]=(0,Z.useState)(`canvas`),[fe,pe]=(0,Z.useState)(``),[X,me]=(0,Z.useState)(0),[he,ge]=(0,Z.useState)(null),[_e,ve]=(0,Z.useState)(null),[ye,be]=(0,Z.useState)(null),xe=l(!!he);o((0,Z.useCallback)(e=>{he&&(e.preventDefault(),e.returnValue=``)},[he])),(0,Z.useEffect)(()=>{xe.state===`blocked`&&(window.confirm(e===`zh`?`源码仍有错误。要放弃这些修改吗?`:`The source still has errors. Discard these changes?`)?xe.proceed():xe.reset())},[xe,e]),(0,Z.useEffect)(()=>{let e=`${n?.mode??`new`}:${n?.name??r}:${n?.baseRevision??0}:${n?.repairPrompt??``}`;if(ne.current===e)return;ne.current=e,g(n?.name??r),v(structuredClone(n?.graph??Er())),le(e=>e+1),b(structuredClone(n?.manifest??{title:m.untitled,description:``,tags:[`custom`]})),w(n?.graph.nodes.find(e=>e.kind===`agent`)?.id??`agent-1`),A(n?.repairPrompt??``),I(null),M(``),B(null),G(n?.baseRevision??0),K([]),te(null),ie.current=void 0,J.current=void 0,H(`idle`),de(`canvas`);let t=rr(er(n?.name??r,n?.graph??Er(),n?.manifest??{title:m.untitled,description:``,tags:[`custom`]}));Y.current=t,pe(t),me(e=>e+1),ge(null),ve(null),be(null)},[m.untitled,n,r]),(0,Z.useEffect)(()=>{n?.mode===`edit`&&Ot(n.name).then(K).catch(()=>K([]))},[n?.mode,n?.name]),(0,Z.useEffect)(()=>{if(!h.trim())return;let e=!0,t=window.setTimeout(()=>{et(h,_,y).then(t=>{e&&B(t)}).catch(()=>{e&&B(null)})},350);return()=>{e=!1,window.clearTimeout(t)}},[_,y,h]),(0,Z.useEffect)(()=>{if(!h.trim())return;H(`saving`);let e=window.setTimeout(()=>{ae({id:ie.current,workflowName:h,graph:_,manifest:y,baseRevision:W,expectedUpdatedAtMs:J.current}).then(e=>{ie.current=e.id,J.current=e.updatedAtMs,H(`saved`)}).catch(()=>H(`error`))},900);return()=>window.clearTimeout(e)},[W,_,y,h]),(0,Z.useLayoutEffect)(()=>{D(e=>{let t=new Map(e.map(e=>[e.id,e]));return _.nodes.map(e=>({...t.get(e.id),...wr(e,e.id===S)}))})},[_.nodes,S,D]),(0,Z.useEffect)(()=>{let e=se.current;if(!e||_.nodes.length===0)return;let t=window.requestAnimationFrame(()=>{e.fitView(vr)});return()=>window.cancelAnimationFrame(t)},[_.nodes.length,ce]);let Se=(0,Z.useMemo)(()=>_.edges.map(Tr),[_.edges]),Ce=_.nodes.find(e=>e.id===S)??null,we=(0,Z.useMemo)(()=>new Set(i),[i]),Ee=n?.mode!==`edit`&&we.has(h),De=Ee?gr(h,we):h,Oe=R?.valid===!0&&!Ee&&!t&&!N&&he===null,ke=e=>{if(e!==ue&&!(e===`canvas`&&he)){if(e===`source`){let e=rr(er(h,_,y));Y.current=e,pe(e),me(e=>e+1),ge(null)}de(e)}},Ae=t=>{Y.current=t;let r=ir(t);if(!r.ok){ge(r.error);return}if(n?.mode===`edit`&&r.document.name!==n.name){ge(e===`zh`?`已发布工作流的内部名称不能修改。`:`The internal name of a published workflow cannot be changed.`);return}ge(null),B(null),g(r.document.name),v(structuredClone(r.document.graph)),b(structuredClone(r.document.manifest)),w(e=>r.document.graph.nodes.some(t=>t.id===e)?e:r.document.graph.nodes.find(e=>e.kind===`agent`)?.id??``),le(e=>e+1)},je=e=>{if(g(e),ue!==`source`)return;let t=ir(Y.current);if(!t.ok)return;let n=rr({...t.document,name:e});Y.current=n,pe(n),me(e=>e+1),Ae(n)},Me=e=>{let t=Jn(e);if(g(e.name),v(structuredClone(e.graph)),b(t),G(e.revision),ge(null),ue===`source`){let n=rr(er(e.name,e.graph,t));Y.current=n,pe(n),me(e=>e+1)}},Ne=(0,Z.useCallback)(e=>{v(t=>{let n=t.nodes.map(t=>t.id!==e.id||t.position.x===e.position.x&&t.position.y===e.position.y?t:{...t,position:e.position});return n.some((e,n)=>e!==t.nodes[n])?{...t,nodes:n}:t})},[]),Pe=(0,Z.useCallback)(e=>{let t=e.filter(e=>e.type!==`select`);t.length!==0&&v(e=>({...e,edges:zt(t,e.edges.map(Tr)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),Fe=(0,Z.useCallback)(e=>{!e.source||!e.target||v(t=>({...t,edges:Vt({...e,id:`edge-${crypto.randomUUID()}`},t.edges.map(Tr)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),Le=(0,Z.useCallback)((e,t)=>{v(n=>({...n,nodes:n.nodes.map(n=>n.id===e?t(n):n)}))},[]),Re=e=>{let t=`${e}-${crypto.randomUUID().slice(0,8)}`,n=Dr(e,t,_.nodes.length);v(e=>{let r=e.nodes.find(e=>e.id===S&&e.kind!==`output`),i=r?[{id:`edge-${crypto.randomUUID()}`,source:r.id,target:t}]:[];return{...e,nodes:[...e.nodes,n],edges:[...e.edges,...i]}}),le(e=>e+1),w(t)},ze=()=>{!Ce||Ce.kind===`input`||Ce.kind===`output`||(v(e=>({...e,nodes:e.nodes.filter(e=>e.id!==Ce.id),edges:e.edges.filter(e=>e.source!==Ce.id&&e.target!==Ce.id)})),le(e=>e+1),w(``))},Be=(0,Z.useCallback)(async()=>{if(k.trim()){I(null),P(!0);try{await p({prompt:k,name:h})}catch(e){I(e instanceof Error?e.message:m.generationError)}finally{P(!1)}}},[k,m.generationError,h,p]);(0,Z.useEffect)(()=>{let e=n?.repairPrompt?.trim();!e||k.trim()!==e||N||re.current===e||(re.current=e,Be())},[k,Be,N,n?.repairPrompt]);let He=async e=>{if(!Oe||oe.current)return;oe.current=!0;let t={name:h,graph:_,manifest:y,expectedRevision:W};try{if(e)await u({...t,goal:j.trim()||y.description||h});else{let e=await s(t);if(!e)return;Me(e)}ie.current&&await Ge(ie.current).catch(()=>void 0)}catch{return}finally{oe.current=!1}},Ue=async e=>{if(!(q!==null||n?.mode!==`edit`)){te(e);try{let t=await wt(n.name,e,W);Me(t),le(e=>e+1),w(t.graph.nodes.find(e=>e.kind===`agent`)?.id??``),K(await Ot(n.name))}finally{te(null)}}},Ke=async t=>{if(!(_e!==null||n?.mode!==`edit`)){ve(t);try{be({before:rr($n(await at(n.name,t))),after:rr(er(h,_,y)),beforeLabel:`v${t}`,afterLabel:e===`zh`?`当前草稿 · v${W}`:`Current draft · v${W}`})}finally{ve(null)}}};return(0,$.jsxs)(`main`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-surface-panel`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-edge px-4 py-3`,children:[(0,$.jsx)(c,{to:`/workflows`,className:T(`inline-flex size-9 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,z.focusRingPanel),"aria-label":e===`zh`?`返回工作流`:`Back to workflows`,children:(0,$.jsx)(xt,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:n?.mode===`edit`?m.editTitle:m.createTitle}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:m.subtitle})]}),(0,$.jsx)(`div`,{className:`flex rounded-lg bg-surface-base p-1`,role:`tablist`,"aria-label":e===`zh`?`工作流编辑视图`:`Workflow editor view`,children:[`canvas`,`source`].map(t=>(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":ue===t,disabled:t===`canvas`&&!!he,className:T(`rounded-md px-3 py-1.5 text-xs font-medium disabled:cursor-not-allowed disabled:opacity-50`,ue===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),onClick:()=>ke(t),children:t===`canvas`?e===`zh`?`画布`:`Canvas`:e===`zh`?`源码`:`Source`},t))}),(0,$.jsx)(`span`,{className:T(`text-xs`,V===`error`?`text-danger`:`text-fg-subtle`),children:V===`saving`?m.savingDraft:V===`saved`?m.savedDraft:V===`error`?m.draftError:``})]}),F?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-danger/30 bg-danger/5 px-4 py-2 text-sm text-danger`,role:`alert`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[m.generationError,`: `,F]}),(0,$.jsx)(L,{variant:`ghost`,className:`h-8`,onClick:()=>I(null),"aria-label":m.dismissError,children:(0,$.jsx)(C,{className:`size-4`,"aria-hidden":!0})})]}):null,a?(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-warning/30 bg-warning/5 px-4 py-2 text-sm text-fg`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:a.code===`WORKFLOW_NAME_EXISTS`?e===`zh`?`内部名称“${a.name}”已被使用。`:`The internal name “${a.name}” is already in use.`:e===`zh`?`这个工作流已更新到版本 ${a.currentRevision}。`:`This workflow has changed to revision ${a.currentRevision}.`}),a.code===`WORKFLOW_NAME_EXISTS`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(L,{variant:`secondary`,className:`h-8`,onClick:()=>{je(a.suggestedName),d()},children:e===`zh`?`使用 ${a.suggestedName}`:`Use ${a.suggestedName}`}),(0,$.jsx)(c,{className:`text-sm font-medium text-accent-fg hover:underline`,to:`/workflows/${encodeURIComponent(a.name)}`,children:e===`zh`?`打开已有工作流`:`Open existing`})]}):(0,$.jsx)(L,{variant:`secondary`,className:`h-8`,onClick:f,children:e===`zh`?`加载最新版本`:`Load latest`})]}):null,!a&&Ee?(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-warning/30 bg-warning/5 px-4 py-2 text-sm text-fg`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1`,children:e===`zh`?`内部名称“${h}”已被使用。`:`The internal name “${h}” is already in use.`}),(0,$.jsx)(L,{variant:`secondary`,className:`h-8`,onClick:()=>je(De),children:e===`zh`?`使用 ${De}`:`Use ${De}`})]}):null,ue===`source`?(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto bg-surface-base p-4`,children:(0,$.jsx)(Xn,{initialSource:fe,resetKey:X,fileName:`${h||`workflow`}.workflow.json`,language:e,readOnly:!1,error:he,onChange:Ae,allowImport:!0,className:`min-h-[32rem] flex-1`})}):(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto lg:flex-row lg:overflow-hidden`,children:[(0,$.jsxs)(`section`,{className:`flex min-h-[32rem] min-w-0 flex-1 flex-col bg-surface-base lg:min-h-0`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2 border-b border-edge px-3 py-2`,children:[(0,$.jsxs)(`div`,{className:`mr-2 min-w-36`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.flowTitle}),(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:m.stepCount(_.nodes.length)})]}),(0,$.jsxs)(L,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>Re(`agent`),children:[(0,$.jsx)(We,{className:`size-3.5`}),m.addAgent]}),(0,$.jsxs)(L,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>Re(`decision`),children:[(0,$.jsx)(ot,{className:`size-3.5`}),m.addDecision]}),(0,$.jsxs)(L,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>Re(`merge`),children:[(0,$.jsx)(Te,{className:`size-3.5`}),m.addMerge]}),(0,$.jsx)(`span`,{className:`ml-auto text-xs text-fg-subtle`,children:m.canvasHint})]}),(0,$.jsx)(`div`,{className:`relative min-h-72 flex-1`,children:_.nodes.length>0?(0,$.jsxs)(Wt,{"aria-label":m.flowAria,nodes:E,edges:Se,nodeTypes:xr,onNodesChange:O,onEdgesChange:Pe,onConnect:Fe,nodesDraggable:!0,nodesConnectable:!0,onNodeClick:(e,t)=>w(t.id),onNodeDragStart:(e,t)=>w(t.id),onNodeDragStop:(e,t)=>Ne(t),onInit:e=>{se.current=e,window.requestAnimationFrame(()=>{e.fitView(vr)})},fitView:!0,fitViewOptions:vr,minZoom:.25,maxZoom:1.5,deleteKeyCode:null,proOptions:{hideAttribution:!0},children:[(0,$.jsx)(qt,{color:`var(--color-edge)`,gap:22,size:1}),(0,$.jsx)(Ut,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`})]}):(0,$.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-center text-sm text-fg-muted`,children:m.emptyFlow})})]}),(0,$.jsx)(`aside`,{className:`flex w-full shrink-0 flex-col border-t border-edge bg-surface-panel lg:w-[22rem] lg:border-l lg:border-t-0`,children:(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`label`,{className:`block text-xs font-medium text-fg`,htmlFor:`workflow-title`,children:m.humanTitle}),(0,$.jsx)(`input`,{id:`workflow-title`,value:y.title??``,onChange:e=>b(t=>({...t,title:e.target.value})),className:Cr}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`workflow-description`,children:m.task}),(0,$.jsx)(`textarea`,{id:`workflow-description`,value:y.description??``,onChange:e=>b(t=>({...t,description:e.target.value})),className:`${Cr} min-h-20 resize-y`}),(0,$.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:m.advanced}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`workflow-name`,children:m.workflowName}),(0,$.jsx)(`input`,{id:`workflow-name`,value:h,disabled:n?.mode===`edit`,onChange:e=>g(Or(e.target.value)),className:`${Cr} disabled:cursor-not-allowed disabled:opacity-60`}),Ee?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e===`zh`?`该内部名称已被使用,请换一个名称。`:`This internal name is already in use.`}):null,n?.mode===`edit`&&ee.length>0?(0,$.jsxs)(`div`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(Ve,{className:`size-3.5`}),m.versions,` · v`,W]}),(0,$.jsx)(`div`,{className:`mt-2 space-y-1`,children:ee.map(t=>(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-lg px-2 py-1.5 hover:bg-surface-hover`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 text-xs text-fg-muted`,children:[`v`,t.revision,` · `,U(t.createdAtMs,e)]}),t.revision===W?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:m.currentVersion}):(0,$.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1`,children:[(0,$.jsx)(L,{variant:`ghost`,className:`h-7 px-2 text-xs`,disabled:_e!==null,onClick:()=>void Ke(t.revision),children:_e===t.revision?e===`zh`?`加载中…`:`Loading…`:e===`zh`?`对比`:`Compare`}),(0,$.jsxs)(L,{variant:`ghost`,className:`h-7 px-2 text-xs`,disabled:q!==null,onClick:()=>void Ue(t.revision),children:[(0,$.jsx)(x,{className:`size-3`}),q===t.revision?m.restoring:m.restore]})]})]},t.revision))})]}):null]})]}),(0,$.jsx)(`div`,{className:`my-4 border-t border-edge`}),Ce?(0,$.jsx)(Sr,{node:Ce,language:e,copy:m,updateNode:Le,onDelete:ze}):(0,$.jsx)(`div`,{className:`py-8 text-center text-sm text-fg-muted`,children:m.selectNode}),R&&!R.valid?(0,$.jsxs)(`section`,{className:`mt-4 rounded-lg border border-danger/30 bg-danger/5 p-3`,children:[(0,$.jsx)(`h3`,{className:`text-xs font-medium text-danger`,children:m.needsAttention}),(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs text-danger`,children:R.errors.slice(0,5).map((e,t)=>(0,$.jsxs)(`li`,{children:[`• `,e.message]},`${e.code}-${t}`))})]}):null]})})})]}),(0,$.jsx)(`footer`,{className:`shrink-0 border-t border-edge bg-surface-panel p-3`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 lg:flex-row lg:items-center`,children:[ue===`canvas`?(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,$.jsx)(Ie,{className:`size-4 shrink-0 text-accent-fg`}),(0,$.jsx)(Lt,{value:k,onChange:e=>A(e.target.value),suggestion:Rt(m.aiPlaceholder),onAcceptSuggestion:A,onKeyDown:e=>{e.key===`Enter`&&Be()},placeholder:m.aiPlaceholder,className:`${Cr} mt-0 flex-1`}),(0,$.jsx)(L,{variant:`secondary`,className:`h-10 shrink-0`,disabled:N||!k.trim(),onClick:()=>void Be(),children:N?m.designing:m.applyWithAi})]}):(0,$.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-fg-muted`,children:he?e===`zh`?`修复源码错误后才能切换画布或保存。`:`Fix source errors before switching to the canvas or saving.`:e===`zh`?`源码与画布使用同一个草稿。`:`Source and canvas share the same draft.`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`input`,{value:j,onChange:e=>M(e.target.value),placeholder:m.testGoal,className:`${Cr} mt-0 w-52`}),(0,$.jsxs)(L,{variant:`secondary`,disabled:!Oe,onClick:()=>void He(!1),children:[(0,$.jsx)(dt,{className:`size-4`}),m.publish]}),(0,$.jsxs)(L,{variant:`primary`,disabled:!Oe,onClick:()=>void He(!0),children:[(0,$.jsx)(Ye,{className:`size-4`}),m.publishAndRun]})]})]})}),(0,$.jsx)(pr,{comparison:ye,language:e,onClose:()=>be(null)})]})}function br(e){let t=(0,Q.c)(28),{data:n,selected:r}=e,i=n.workflowNode,a;t[0]===i.kind?a=t[1]:(a=i.kind===`input`?(0,$.jsx)(Ze,{}):i.kind===`agent`?(0,$.jsx)(We,{}):i.kind===`decision`?(0,$.jsx)(ot,{}):i.kind===`merge`?(0,$.jsx)(Te,{}):(0,$.jsx)(Ye,{}),t[0]=i.kind,t[1]=a);let o=a,s=r?`border-accent ring-2 ring-accent/20`:`border-edge`,c;t[2]===s?c=t[3]:(c=T(`w-52 rounded-xl border bg-surface-panel p-3 shadow-surface transition-colors`,s),t[2]=s,t[3]=c);let l;t[4]===i.kind?l=t[5]:(l=i.kind===`input`?null:(0,$.jsx)(Gt,{type:`target`,position:Ht.Left,className:`!size-2.5 !border-2 !border-surface-panel !bg-fg-subtle`}),t[4]=i.kind,t[5]=l);let u;t[6]===o?u=t[7]:(u=(0,$.jsx)(`span`,{className:`mt-0.5 [&>svg]:size-4 text-accent-fg`,children:o}),t[6]=o,t[7]=u);let d;t[8]===i.title?d=t[9]:(d=(0,$.jsx)(`strong`,{className:`block truncate text-sm font-medium text-fg`,children:i.title}),t[8]=i.title,t[9]=d);let f;t[10]!==i.description||t[11]!==i.kind?(f=i.description||kr(i.kind),t[10]=i.description,t[11]=i.kind,t[12]=f):f=t[12];let p;t[13]===f?p=t[14]:(p=(0,$.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-4 text-fg-muted`,children:f}),t[13]=f,t[14]=p);let m;t[15]!==d||t[16]!==p?(m=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[d,p]}),t[15]=d,t[16]=p,t[17]=m):m=t[17];let h;t[18]!==u||t[19]!==m?(h=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[u,m]}),t[18]=u,t[19]=m,t[20]=h):h=t[20];let g;t[21]===i.kind?g=t[22]:(g=i.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Gt,{id:`true`,type:`source`,position:Ht.Right,style:{top:`38%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-success`}),(0,$.jsx)(Gt,{id:`false`,type:`source`,position:Ht.Right,style:{top:`70%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-danger`})]}):i.kind===`output`?null:(0,$.jsx)(Gt,{type:`source`,position:Ht.Right,className:`!size-2.5 !border-2 !border-surface-panel !bg-accent`}),t[21]=i.kind,t[22]=g);let _;return t[23]!==h||t[24]!==g||t[25]!==c||t[26]!==l?(_=(0,$.jsxs)(`div`,{className:c,children:[l,h,g]}),t[23]=h,t[24]=g,t[25]=c,t[26]=l,t[27]=_):_=t[27],_}var xr={workflow:br};function Sr(e){let t=(0,Q.c)(71),{node:n,language:r,copy:i,updateNode:a,onDelete:o}=e,s;t[0]!==n.id||t[1]!==a?(s=e=>a(n.id,t=>({...t,...e})),t[0]=n.id,t[1]=a,t[2]=s):s=t[2];let c=s,l;t[3]!==n.id||t[4]!==a?(l=e=>a(n.id,t=>({...t,config:{...t.config,...e}})),t[3]=n.id,t[4]=a,t[5]=l):l=t[5];let u=l,d;t[6]===i.stepSettings?d=t[7]:(d=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.stepSettings}),t[6]=i.stepSettings,t[7]=d);let f;t[8]!==i.remove||t[9]!==n.kind||t[10]!==o?(f=n.kind!==`input`&&n.kind!==`output`?(0,$.jsxs)(L,{variant:`ghost`,className:`h-8 px-2 text-danger`,onClick:o,children:[(0,$.jsx)(Ce,{className:`size-3.5`}),i.remove]}):null,t[8]=i.remove,t[9]=n.kind,t[10]=o,t[11]=f):f=t[11];let p;t[12]!==d||t[13]!==f?(p=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[d,f]}),t[12]=d,t[13]=f,t[14]=p):p=t[14];let h;t[15]===i.stepName?h=t[16]:(h=(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-title`,children:i.stepName}),t[15]=i.stepName,t[16]=h);let g;t[17]===c?g=t[18]:(g=e=>c({title:e.target.value}),t[17]=c,t[18]=g);let _;t[19]!==n.title||t[20]!==g?(_=(0,$.jsx)(`input`,{id:`node-title`,value:n.title,onChange:g,className:Cr}),t[19]=n.title,t[20]=g,t[21]=_):_=t[21];let v;t[22]===i.stepPurpose?v=t[23]:(v=(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-description`,children:i.stepPurpose}),t[22]=i.stepPurpose,t[23]=v);let y=n.description??``,b;t[24]===c?b=t[25]:(b=e=>c({description:e.target.value}),t[24]=c,t[25]=b);let x;t[26]!==y||t[27]!==b?(x=(0,$.jsx)(`textarea`,{id:`node-description`,value:y,onChange:b,className:`${Cr} min-h-16 resize-y`}),t[26]=y,t[27]=b,t[28]=x):x=t[28];let S;t[29]!==i.advanced||t[30]!==i.instructions||t[31]!==i.model||t[32]!==r||t[33]!==n.config||t[34]!==n.kind||t[35]!==u?(S=n.kind===`agent`?(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(`details`,{className:`mt-4 border-t border-edge pt-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs font-medium text-fg-muted`,children:i.advanced}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-prompt`,children:i.instructions}),(0,$.jsx)(`textarea`,{id:`node-prompt`,value:String(n.config.prompt??``),onChange:e=>u({prompt:e.target.value}),className:`${Cr} min-h-36 resize-y`}),(0,$.jsx)(`div`,{className:`mt-3 text-xs font-medium text-fg`,children:i.model}),(0,$.jsx)(qn,{value:n.config.model,language:r,onChange:e=>u({model:e})})]})}):null,t[29]=i.advanced,t[30]=i.instructions,t[31]=i.model,t[32]=r,t[33]=n.config,t[34]=n.kind,t[35]=u,t[36]=S):S=t[36];let C;t[37]!==i.compareValue||t[38]!==i.condition||t[39]!==i.contains||t[40]!==i.equals||t[41]!==i.exists||t[42]!==i.notEquals||t[43]!==i.valuePath||t[44]!==n.config||t[45]!==n.kind||t[46]!==u?(C=n.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`decision-path`,children:i.valuePath}),(0,$.jsx)(`input`,{id:`decision-path`,value:n.config.rule?.path??``,onChange:e=>u({rule:{...n.config.rule??{operator:`exists`},path:e.target.value}}),placeholder:`result.approved`,className:Cr}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,id:`decision-operator-label`,children:i.condition}),(0,$.jsx)(m,{value:n.config.rule?.operator??`exists`,placeholder:i.condition,allowEmpty:!1,ariaLabelledBy:`decision-operator-label`,options:[{value:`exists`,label:i.exists},{value:`equals`,label:i.equals},{value:`not_equals`,label:i.notEquals},{value:`contains`,label:i.contains}],onChange:e=>u({rule:{...n.config.rule??{path:``},operator:e}})}),n.config.rule?.operator===`exists`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`decision-value`,children:i.compareValue}),(0,$.jsx)(`input`,{id:`decision-value`,value:String(n.config.rule?.value??``),onChange:e=>u({rule:{...n.config.rule,value:e.target.value}}),className:Cr})]})]}):null,t[37]=i.compareValue,t[38]=i.condition,t[39]=i.contains,t[40]=i.equals,t[41]=i.exists,t[42]=i.notEquals,t[43]=i.valuePath,t[44]=n.config,t[45]=n.kind,t[46]=u,t[47]=C):C=t[47];let w;t[48]!==i.combineAs||t[49]!==i.listResults||t[50]!==i.namedResults||t[51]!==n.config||t[52]!==n.kind||t[53]!==u?(w=n.kind===`merge`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,id:`merge-mode-label`,children:i.combineAs}),(0,$.jsx)(m,{value:String(n.config.mode??`object`),placeholder:i.combineAs,allowEmpty:!1,ariaLabelledBy:`merge-mode-label`,options:[{value:`object`,label:i.namedResults},{value:`array`,label:i.listResults}],onChange:e=>u({mode:e})})]}):null,t[48]=i.combineAs,t[49]=i.listResults,t[50]=i.namedResults,t[51]=n.config,t[52]=n.kind,t[53]=u,t[54]=w):w=t[54];let T;t[55]!==i.autoSummary||t[56]!==i.summaryTemplate||t[57]!==n.config||t[58]!==n.kind||t[59]!==u?(T=n.kind===`output`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`output-summary`,children:i.summaryTemplate}),(0,$.jsx)(`textarea`,{id:`output-summary`,value:String(n.config.summary??``),onChange:e=>u({summary:e.target.value||void 0}),placeholder:i.autoSummary,className:`${Cr} min-h-20 resize-y`})]}):null,t[55]=i.autoSummary,t[56]=i.summaryTemplate,t[57]=n.config,t[58]=n.kind,t[59]=u,t[60]=T):T=t[60];let E;return t[61]!==x||t[62]!==S||t[63]!==C||t[64]!==w||t[65]!==T||t[66]!==p||t[67]!==h||t[68]!==_||t[69]!==v?(E=(0,$.jsxs)(`section`,{children:[p,h,_,v,x,S,C,w,T]}),t[61]=x,t[62]=S,t[63]=C,t[64]=w,t[65]=T,t[66]=p,t[67]=h,t[68]=_,t[69]=v,t[70]=E):E=t[70],E}var Cr=`mt-1 block h-10 w-full rounded-lg border border-edge bg-surface-inset px-3 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-edge-strong`;function wr(e,t=!1){return{id:e.id,type:`workflow`,position:e.position,selected:t,data:{workflowNode:e}}}function Tr(e){return{id:e.id,source:e.source,target:e.target,sourceHandle:e.sourcePort===`true`||e.sourcePort===`false`?e.sourcePort:void 0,markerEnd:{type:Bt.ArrowClosed},style:{stroke:`var(--color-fg-subtle)`,strokeWidth:1.5}}}function Er(){return{schemaVersion:1,nodes:[{id:`input`,kind:`input`,title:`Input`,description:`What the user provides`,position:{x:0,y:120},config:{}},{id:`agent-1`,kind:`agent`,title:`Do the work`,description:`Understand and complete the request`,phaseId:`work`,position:{x:300,y:120},config:{prompt:`Complete this goal: {{goal}}
|
|
3
|
-
|
|
4
|
-
User input:
|
|
5
|
-
{{input}}`,maxIterations:12}},{id:`output`,kind:`output`,title:`Result`,description:`A clear answer for the user`,position:{x:620,y:120},config:{}}],edges:[{id:`input-agent`,source:`input`,target:`agent-1`},{id:`agent-output`,source:`agent-1`,target:`output`}]}}function Dr(e,t,n){let r={x:280+n%3*280,y:80+Math.floor(n/3)*180};return e===`agent`?{id:t,kind:e,title:`New AI step`,description:`Describe what this step should accomplish`,phaseId:`work`,position:r,config:{prompt:`Use the previous results to complete this step:
|
|
6
|
-
{{predecessors}}`,maxIterations:12}}:e===`decision`?{id:t,kind:e,title:`Check a condition`,description:`Choose what happens next`,position:r,config:{rule:{path:``,operator:`exists`}}}:{id:t,kind:e,title:`Combine results`,description:`Bring parallel work together`,position:r,config:{mode:`object`}}}function Or(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,`_`).replace(/^_+/,``)}function kr(e){return{input:`User input`,agent:`AI step`,decision:`Decision`,merge:`Combine`,output:`User result`}[e]}function Ar(e){return e===`zh`?{untitled:`未命名工作流`,editTitle:`编辑工作流`,createTitle:`手动创建工作流`,subtitle:`高级模式:直接配置步骤、连接、输入和输出。`,close:`关闭`,savingDraft:`正在保存草稿…`,savedDraft:`草稿已保存`,draftError:`草稿保存失败`,generationError:`无法进入工作流对话`,dismissError:`关闭错误提示`,flowTitle:`工作流步骤图`,flowAria:`可编辑的工作流步骤图`,stepCount:e=>`${e} 个步骤 · 点击步骤可编辑`,emptyFlow:`还没有步骤。添加一个 AI 步骤开始设计。`,addAgent:`添加 AI 步骤`,addDecision:`添加判断`,addMerge:`合并结果`,canvasHint:`拖动步骤并连接圆点`,workflowName:`内部名称`,humanTitle:`用户看到的名称`,task:`这个工作流最终帮用户得到什么?`,versions:`版本记录`,currentVersion:`当前`,restore:`恢复为新版本`,restoring:`恢复中…`,selectNode:`选择一个步骤来编辑`,needsAttention:`发布前需要处理`,stepSettings:`步骤设置`,remove:`删除`,stepName:`步骤名称`,stepPurpose:`这一步的作用`,instructions:`告诉 AI 要做什么`,advanced:`高级设置`,model:`模型(可选)`,defaultModel:`使用智能默认值`,valuePath:`要检查的值`,condition:`判断条件`,exists:`存在`,equals:`等于`,notEquals:`不等于`,contains:`包含`,compareValue:`比较值`,combineAs:`合并方式`,namedResults:`按步骤名称组织`,listResults:`按列表组织`,summaryTemplate:`结果摘要(可选)`,autoSummary:`留空则自动生成`,aiPlaceholder:`例如:增加一个风险评审步骤,并与方案分析并行`,designing:`正在进入对话…`,applyWithAi:`在对话中修改`,testGoal:`用什么例子测试?`,publish:`保存`,publishAndRun:`保存并测试`}:{untitled:`Untitled workflow`,editTitle:`Edit workflow`,createTitle:`Build workflow manually`,subtitle:`Advanced mode: configure steps, connections, inputs, and outputs directly.`,close:`Close`,savingDraft:`Saving draft…`,savedDraft:`Draft saved`,draftError:`Draft could not be saved`,generationError:`Could not open the workflow conversation`,dismissError:`Dismiss error`,flowTitle:`Workflow map`,flowAria:`Editable workflow step map`,stepCount:e=>`${e} steps · select a step to edit`,emptyFlow:`No steps yet. Add an AI step to start designing.`,addAgent:`Add AI step`,addDecision:`Add decision`,addMerge:`Combine results`,canvasHint:`Drag steps and connect the dots`,workflowName:`Internal name`,humanTitle:`Name users see`,task:`What will this workflow help the user achieve?`,versions:`Version history`,currentVersion:`Current`,restore:`Restore as new`,restoring:`Restoring…`,selectNode:`Select a step to edit it`,needsAttention:`Needs attention before publishing`,stepSettings:`Step settings`,remove:`Remove`,stepName:`Step name`,stepPurpose:`Purpose of this step`,instructions:`Tell the AI what to do`,advanced:`Advanced settings`,model:`Model (optional)`,defaultModel:`Use smart default`,valuePath:`Value to check`,condition:`Condition`,exists:`Exists`,equals:`Equals`,notEquals:`Does not equal`,contains:`Contains`,compareValue:`Compare with`,combineAs:`Combine as`,namedResults:`Named results`,listResults:`List of results`,summaryTemplate:`Result summary (optional)`,autoSummary:`Leave blank to generate automatically`,aiPlaceholder:`For example: add a risk review in parallel with solution analysis`,designing:`Opening conversation…`,applyWithAi:`Edit in conversation`,testGoal:`What example should we test?`,publish:`Save`,publishAndRun:`Save & test`}}function jr(e){let t=(0,Q.c)(54),{graph:n,language:r,className:i}=e,a;t[0]===r?a=t[1]:(a=Ir(r),t[0]=r,t[1]=a);let o=a,[s,c]=(0,Z.useState)(n.nodes.find(Mr)?.id??n.nodes[0]?.id),l;if(t[2]!==o.kind||t[3]!==n.nodes){let e;t[5]===o.kind?e=t[6]:(e=e=>({id:e.id,type:`definitionNode`,position:e.position,data:{definitionNode:e,kindLabel:o.kind[e.kind]}}),t[5]=o.kind,t[6]=e),l=n.nodes.map(e),t[2]=o.kind,t[3]=n.nodes,t[4]=l}else l=t[4];let u=l,d;if(t[7]!==o.no||t[8]!==o.yes||t[9]!==n.edges){let e;t[11]!==o.no||t[12]!==o.yes?(e=e=>({id:e.id,source:e.source,target:e.target,sourceHandle:e.sourcePort===`true`||e.sourcePort===`false`?e.sourcePort:void 0,label:e.sourcePort===`true`?o.yes:e.sourcePort===`false`?o.no:void 0,labelStyle:{fill:`var(--color-fg-subtle)`,fontSize:10},labelBgStyle:{fill:`var(--color-surface-panel)`,fillOpacity:.9},markerEnd:{type:Bt.ArrowClosed},style:{stroke:`var(--color-fg-subtle)`,strokeWidth:1.5}}),t[11]=o.no,t[12]=o.yes,t[13]=e):e=t[13],d=n.edges.map(e),t[7]=o.no,t[8]=o.yes,t[9]=n.edges,t[10]=d}else d=t[10];let f=d,p=n.nodes,m,h,g,_,v,y;if(t[14]!==i||t[15]!==o.ariaLabel||t[16]!==o.empty||t[17]!==o.kind||t[18]!==o.selectHint||t[19]!==f||t[20]!==n.nodes||t[21]!==u||t[22]!==s){m=Symbol.for(`react.early_return_sentinel`);bb0:{let e;t[29]===s?e=t[30]:(e=e=>e.id===s,t[29]=s,t[30]=e);let r=p.find(e);if(n.nodes.length===0){let e;t[31]===i?e=t[32]:(e=T(`flex min-h-72 items-center justify-center bg-surface-base/40 px-6 text-center text-sm text-fg-muted`,i),t[31]=i,t[32]=e);let n;t[33]!==o.empty||t[34]!==e?(n=(0,$.jsx)(`div`,{className:e,children:o.empty}),t[33]=o.empty,t[34]=e,t[35]=n):n=t[35],m=n;break bb0}t[36]===i?_=t[37]:(_=T(`overflow-hidden bg-surface-base/45`,i),t[36]=i,t[37]=_),v=o.ariaLabel;let a;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(a=(e,t)=>c(t.id),t[38]=a):a=t[38];let l;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(l={padding:.24,minZoom:.45,maxZoom:1},t[39]=l):l=t[39];let d,b,x;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(d={hideAttribution:!0},b=(0,$.jsx)(qt,{color:`var(--color-edge)`,gap:22,size:1}),x=(0,$.jsx)(Ut,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`}),t[40]=d,t[41]=b,t[42]=x):(d=t[40],b=t[41],x=t[42]),t[43]!==f||t[44]!==u?(y=(0,$.jsx)(`div`,{className:`h-[22rem] min-h-72`,children:(0,$.jsxs)(Wt,{nodes:u,edges:f,nodeTypes:Fr,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,onNodeClick:a,fitView:!0,fitViewOptions:l,minZoom:.3,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:d,children:[b,x]})}),t[43]=f,t[44]=u,t[45]=y):y=t[45],h=`flex min-h-16 items-start gap-3 border-t border-edge bg-surface-panel px-4 py-3`,g=r?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{className:`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent-fg`,children:Pr(r.kind)}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`strong`,{className:`block text-sm font-medium text-fg`,children:r.title}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:r.description||o.kind[r.kind]})]})]}):(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:o.selectHint})}t[14]=i,t[15]=o.ariaLabel,t[16]=o.empty,t[17]=o.kind,t[18]=o.selectHint,t[19]=f,t[20]=n.nodes,t[21]=u,t[22]=s,t[23]=m,t[24]=h,t[25]=g,t[26]=_,t[27]=v,t[28]=y}else m=t[23],h=t[24],g=t[25],_=t[26],v=t[27],y=t[28];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let b;t[46]!==h||t[47]!==g?(b=(0,$.jsx)(`div`,{className:h,children:g}),t[46]=h,t[47]=g,t[48]=b):b=t[48];let x;return t[49]!==b||t[50]!==_||t[51]!==v||t[52]!==y?(x=(0,$.jsxs)(`section`,{className:_,"aria-label":v,children:[y,b]}),t[49]=b,t[50]=_,t[51]=v,t[52]=y,t[53]=x):x=t[53],x}function Mr(e){return e.kind===`agent`}function Nr(e){let t=(0,Q.c)(25),{data:n,selected:r}=e,i=n.definitionNode,a=r?`border-accent ring-2 ring-accent/20`:`border-edge`,o;t[0]===a?o=t[1]:(o=T(`w-48 rounded-xl border bg-surface-panel p-3 shadow-surface transition-colors`,a),t[0]=a,t[1]=o);let s;t[2]===i.kind?s=t[3]:(s=i.kind===`input`?null:(0,$.jsx)(Gt,{type:`target`,position:Ht.Left,className:`!invisible`}),t[2]=i.kind,t[3]=s);let c;t[4]===i.kind?c=t[5]:(c=Pr(i.kind),t[4]=i.kind,t[5]=c);let l;t[6]===c?l=t[7]:(l=(0,$.jsx)(`span`,{className:`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg bg-accent-soft text-accent-fg`,children:c}),t[6]=c,t[7]=l);let u;t[8]===i.title?u=t[9]:(u=(0,$.jsx)(`strong`,{className:`block truncate text-sm font-medium text-fg`,children:i.title}),t[8]=i.title,t[9]=u);let d;t[10]===n.kindLabel?d=t[11]:(d=(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-subtle`,children:n.kindLabel}),t[10]=n.kindLabel,t[11]=d);let f;t[12]!==u||t[13]!==d?(f=(0,$.jsxs)(`span`,{className:`min-w-0`,children:[u,d]}),t[12]=u,t[13]=d,t[14]=f):f=t[14];let p;t[15]!==l||t[16]!==f?(p=(0,$.jsxs)(`div`,{className:`flex items-start gap-2.5`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17];let m;t[18]===i.kind?m=t[19]:(m=i.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Gt,{id:`true`,type:`source`,position:Ht.Right,style:{top:`38%`},className:`!invisible`}),(0,$.jsx)(Gt,{id:`false`,type:`source`,position:Ht.Right,style:{top:`70%`},className:`!invisible`})]}):i.kind===`output`?null:(0,$.jsx)(Gt,{type:`source`,position:Ht.Right,className:`!invisible`}),t[18]=i.kind,t[19]=m);let h;return t[20]!==m||t[21]!==o||t[22]!==s||t[23]!==p?(h=(0,$.jsxs)(`div`,{className:o,children:[s,p,m]}),t[20]=m,t[21]=o,t[22]=s,t[23]=p,t[24]=h):h=t[24],h}function Pr(e){return e===`input`?(0,$.jsx)(Ze,{className:`size-4`,"aria-hidden":!0}):e===`agent`?(0,$.jsx)(We,{className:`size-4`,"aria-hidden":!0}):e===`decision`?(0,$.jsx)(ot,{className:`size-4`,"aria-hidden":!0}):e===`merge`?(0,$.jsx)(Te,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(Ye,{className:`size-4`,"aria-hidden":!0})}var Fr={definitionNode:Nr};function Ir(e){return e===`zh`?{ariaLabel:`工作流步骤图`,empty:`这个工作流还没有可展示的步骤。`,selectHint:`点击步骤查看它的作用。`,yes:`是`,no:`否`,kind:{input:`任务输入`,agent:`AI 执行`,decision:`条件判断`,merge:`汇总结果`,output:`最终结果`}}:{ariaLabel:`Workflow step map`,empty:`This workflow has no steps to display yet.`,selectHint:`Select a step to see what it does.`,yes:`Yes`,no:`No`,kind:{input:`Task input`,agent:`AI work`,decision:`Decision`,merge:`Combine results`,output:`Deliverable`}}}function Lr(e){let t=(0,Q.c)(54),{graph:n,view:r,language:i,onRepair:a}=e,[o,s]=(0,Z.useState)(),c=(0,Z.useRef)(null),l=(0,Z.useRef)(void 0),d;t[0]===i?d=t[1]:(d=Kr(i),t[0]=i,t[1]=d);let f=d,p;t[2]===r.nodes?p=t[3]:(p=new Map(r.nodes.map(Hr)),t[2]=r.nodes,t[3]=p);let m=p,h;if(t[4]!==n.nodes||t[5]!==m){let e;t[7]===m?e=t[8]:(e=e=>({id:e.id,type:`runNode`,position:e.position,data:{definitionNode:e,runNode:m.get(e.id)}}),t[7]=m,t[8]=e),h=n.nodes.map(e),t[4]=n.nodes,t[5]=m,t[6]=h}else h=t[6];let g=h,_;if(t[9]!==n.edges||t[10]!==m){let e;t[12]===m?e=t[13]:(e=e=>({id:e.id,source:e.source,target:e.target,sourceHandle:e.sourcePort===`true`||e.sourcePort===`false`?e.sourcePort:void 0,markerEnd:{type:Bt.ArrowClosed},animated:m.get(e.source)?.status===`running`,style:{stroke:m.get(e.source)?.status===`done`?`var(--color-success)`:`var(--color-fg-subtle)`,strokeWidth:1.5}}),t[12]=m,t[13]=e),_=n.edges.map(e),t[9]=n.edges,t[10]=m,t[11]=_}else _=t[11];let v=_,y;t[14]!==o||t[15]!==m?(y=o?m.get(o):void 0,t[14]=o,t[15]=m,t[16]=y):y=t[16];let b=y,S;t[17]!==n.nodes||t[18]!==o?(S=o?n.nodes.find(e=>e.id===o):void 0,t[17]=n.nodes,t[18]=o,t[19]=S):S=t[19];let C=S,w;t[20]===r.nodes?w=t[21]:(w=r.nodes.some(Vr),t[20]=r.nodes,t[21]=w);let E=w,D,O;t[22]===r.nodes?(D=t[23],O=t[24]):(D=()=>{let e=r.nodes.find(Br)??r.nodes.find(zr)??[...r.nodes].reverse().find(Rr);if(!e||l.current===e.id)return;l.current=e.id,s(e.id);let t=window.requestAnimationFrame(()=>{c.current?.fitView({nodes:[{id:e.id}],padding:1.4,minZoom:.65,maxZoom:1,duration:300})});return()=>window.cancelAnimationFrame(t)},O=[r.nodes],t[22]=r.nodes,t[23]=D,t[24]=O),(0,Z.useEffect)(D,O);let k;t[25]===f.title?k=t[26]:(k=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:f.title}),t[25]=f.title,t[26]=k);let A;t[27]===f.hint?A=t[28]:(A=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:f.hint}),t[27]=f.hint,t[28]=A);let j;t[29]!==k||t[30]!==A?(j=(0,$.jsxs)(`div`,{children:[k,A]}),t[29]=k,t[30]=A,t[31]=j):j=t[31];let M;t[32]!==f.repair||t[33]!==E||t[34]!==a?(M=E&&a?(0,$.jsxs)(L,{variant:`secondary`,className:`h-8 text-xs`,onClick:a,children:[(0,$.jsx)(x,{className:`size-3.5`}),f.repair]}):null,t[32]=f.repair,t[33]=E,t[34]=a,t[35]=M):M=t[35];let N;t[36]!==j||t[37]!==M?(N=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[j,M]}),t[36]=j,t[37]=M,t[38]=N):N=t[38];let P,F;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(P=(e,t)=>s(t.id),F=e=>{c.current=e},t[39]=P,t[40]=F):(P=t[39],F=t[40]);let I,R;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(I={hideAttribution:!0},R=(0,$.jsx)(qt,{color:`var(--color-edge)`,gap:22,size:1}),t[41]=I,t[42]=R):(I=t[41],R=t[42]);let z;t[43]!==v||t[44]!==g?(z=(0,$.jsx)(`div`,{className:`h-[28rem]`,children:(0,$.jsx)(Wt,{nodes:g,edges:v,nodeTypes:Gr,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,onNodeClick:P,onInit:F,fitView:!0,minZoom:.3,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:I,children:R})}),t[43]=v,t[44]=g,t[45]=z):z=t[45];let B;t[46]!==f.status||t[47]!==b||t[48]!==C?(B=b?(0,$.jsxs)(`div`,{className:T(`flex items-start gap-2 border-t border-edge px-4 py-3 text-xs`,b.status===`error`?`text-danger`:`text-fg-muted`),children:[b.status===`error`?(0,$.jsx)(ye,{className:`mt-0.5 size-3.5 shrink-0`}):b.status===`done`?(0,$.jsx)(u,{className:`mt-0.5 size-3.5 shrink-0 text-success`}):null,(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`strong`,{className:`font-medium text-fg`,children:b.title}),C?.description?(0,$.jsx)(`span`,{className:`block pt-0.5 text-fg-subtle`,children:C.description}):null,(0,$.jsx)(`span`,{className:`block pt-1`,children:b.error||b.resultPreview||f.status[b.status]})]})]}):null,t[46]=f.status,t[47]=b,t[48]=C,t[49]=B):B=t[49];let V;return t[50]!==N||t[51]!==z||t[52]!==B?(V=(0,$.jsxs)(`section`,{className:`mt-5 overflow-hidden rounded-2xl border border-edge bg-surface-base/35`,children:[N,z,B]}),t[50]=N,t[51]=z,t[52]=B,t[53]=V):V=t[53],V}function Rr(e){return e.status===`done`}function zr(e){return e.status===`error`}function Br(e){return e.status===`running`}function Vr(e){return e.status===`error`}function Hr(e){return[e.id,e]}function Ur(e){let t=(0,Q.c)(30),{data:n,selected:r}=e,i=n.definitionNode,a=n.runNode?.status??`pending`,o;t[0]===i.kind?o=t[1]:(o=i.kind===`input`?(0,$.jsx)(Ze,{}):i.kind===`agent`?(0,$.jsx)(We,{}):i.kind===`decision`?(0,$.jsx)(ot,{}):i.kind===`merge`?(0,$.jsx)(Te,{}):(0,$.jsx)(Ye,{}),t[0]=i.kind,t[1]=o);let s=o,c=a===`running`&&`border-accent ring-2 ring-accent/20`,l=a===`done`&&`border-success/50`,u=a===`error`&&`border-danger ring-2 ring-danger/15`,d=(a===`pending`||a===`skipped`)&&`border-edge opacity-70`,f=r&&`ring-2 ring-accent/25`,p;t[2]!==c||t[3]!==l||t[4]!==u||t[5]!==d||t[6]!==f?(p=T(`w-48 rounded-xl border bg-surface-panel px-3 py-2.5 shadow-surface`,c,l,u,d,f),t[2]=c,t[3]=l,t[4]=u,t[5]=d,t[6]=f,t[7]=p):p=t[7];let m;t[8]===i.kind?m=t[9]:(m=i.kind===`input`?null:(0,$.jsx)(Gt,{type:`target`,position:Ht.Left,className:`!invisible`}),t[8]=i.kind,t[9]=m);let h;t[10]===s?h=t[11]:(h=(0,$.jsx)(`span`,{className:`[&>svg]:size-4 text-fg-subtle`,children:s}),t[10]=s,t[11]=h);let g;t[12]===i.title?g=t[13]:(g=(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-medium text-fg`,children:i.title}),t[12]=i.title,t[13]=g);let _;t[14]===a?_=t[15]:(_=(0,$.jsx)(Wr,{status:a}),t[14]=a,t[15]=_);let v;t[16]!==g||t[17]!==_||t[18]!==h?(v=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[h,g,_]}),t[16]=g,t[17]=_,t[18]=h,t[19]=v):v=t[19];let y;t[20]===i.description?y=t[21]:(y=i.description?(0,$.jsx)(`p`,{className:`mt-1.5 line-clamp-2 text-xs leading-4 text-fg-muted`,children:i.description}):null,t[20]=i.description,t[21]=y);let b;t[22]===i.kind?b=t[23]:(b=i.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Gt,{id:`true`,type:`source`,position:Ht.Right,className:`!invisible`}),(0,$.jsx)(Gt,{id:`false`,type:`source`,position:Ht.Right,className:`!invisible`})]}):i.kind===`output`?null:(0,$.jsx)(Gt,{type:`source`,position:Ht.Right,className:`!invisible`}),t[22]=i.kind,t[23]=b);let x;return t[24]!==v||t[25]!==y||t[26]!==b||t[27]!==p||t[28]!==m?(x=(0,$.jsxs)(`div`,{className:p,children:[m,v,y,b]}),t[24]=v,t[25]=y,t[26]=b,t[27]=p,t[28]=m,t[29]=x):x=t[29],x}function Wr(e){let t=(0,Q.c)(4),{status:n}=e;if(n===`done`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{className:`flex size-5 items-center justify-center rounded-full bg-success-soft text-success`,children:(0,$.jsx)(u,{className:`size-3`})}),t[0]=e):e=t[0],e}if(n===`error`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{className:`flex size-5 items-center justify-center rounded-full bg-danger/10 text-danger`,children:(0,$.jsx)(ye,{className:`size-3`})}),t[1]=e):e=t[1],e}if(n===`running`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`span`,{className:`size-2.5 animate-pulse rounded-full bg-accent motion-reduce:animate-none`}),t[2]=e):e=t[2],e}let r;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(`span`,{className:`size-2 rounded-full bg-edge-strong`}),t[3]=r):r=t[3],r}var Gr={runNode:Ur};function Kr(e){return e===`zh`?{title:`运行过程`,hint:`点选步骤查看当前结果;画布会随着执行自动更新。`,repair:`修复这个工作流`,status:{pending:`等待中`,running:`执行中`,done:`已完成`,error:`失败`,skipped:`已跳过`}}:{title:`Live workflow`,hint:`Select a step to inspect it. The canvas updates as work progresses.`,repair:`Repair workflow`,status:{pending:`Waiting`,running:`Running`,done:`Completed`,error:`Failed`,skipped:`Skipped`}}}function qr(e,t){return t.status[e]??e}function Jr(e,t){return t.phaseStatus[e]??e}function Yr(e,t){let{run:n}=e;return n.status===`succeeded`?be(t.runSummarySucceeded,{agents:n.metrics.doneAgentCount,artifacts:n.metrics.artifactCount}):n.status===`failed`||n.status===`timeout`?n.error?.message??t.runSummaryFailedFallback:n.status===`cancelled`?t.runSummaryCancelled:be(t.runSummaryActive,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}function Xr(e,t){let{run:n}=e;return n.status===`failed`?t.diagnosticFailedHint:n.status===`timeout`?t.diagnosticTimeoutHint:n.status===`cancelled`?t.diagnosticCancelledHint:n.status===`succeeded`&&n.metrics.errorAgentCount>0?t.diagnosticPartialHint:null}function Zr(e){return ce(e)}function Qr({view:e,comparison:t,loading:n,language:r,localeTag:a,activeTab:o,onTabChange:s,onCancel:c,onRetry:l,onReplay:d,onOpenRunId:f,ownerAgentId:p,onRepairWorkflow:m}){let _=w(r).workflows,y=oe(r),b=i(),[S,C]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(!1),[O,k]=(0,Z.useState)(null),[A,j]=(0,Z.useState)(!1),[M,N]=(0,Z.useState)(null),[P,I]=(0,Z.useState)(null),[,z]=(0,Z.useState)(0),B=e?.run.status,V=B?je.has(B):!1;(0,Z.useEffect)(()=>{e?.run.id&&(C(!1),N(null))},[e?.run.id,V,B,e?.run.metrics.errorAgentCount]),(0,Z.useEffect)(()=>{if(!V)return;let e=window.setInterval(()=>z(e=>e+1),1e3);return()=>window.clearInterval(e)},[V]);let H=(0,Z.useMemo)(()=>e?yt(e):null,[e]),U=(0,Z.useMemo)(()=>H?Qe(H):{phases:[],unphased:null},[H]),W=(0,Z.useMemo)(()=>O==null||!H?null:H.agents.find(e=>e.id===O)??null,[O,H]);(0,Z.useEffect)(()=>{H?.runId&&k((H.agents.find(e=>e.status===`error`||e.status===`skipped`)??H.agents.find(e=>e.status===`running`)??null)?.id??null)},[H?.runId]);let G=(0,Z.useCallback)(e=>{k(e.id)},[]),ee=(0,Z.useMemo)(()=>e?it(e):[],[e]),K=e?fe(e.run.result):void 0,q=K?bi(K):null,te=K?ne(K):``,re=!!K,ie=(0,Z.useCallback)(async()=>{re&&await F(te)&&(j(!0),window.setTimeout(()=>j(!1),1500))},[re,te]),J=(0,Z.useCallback)(()=>{if(!re||!e)return;let t=new Blob([te],{type:`text/markdown;charset=utf-8`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${e.run.definitionId}-${e.run.id.slice(0,8)}.md`,r.click(),URL.revokeObjectURL(n)},[re,te,e]),ae=(0,Z.useCallback)(()=>{if(!e)return;let t=Zr(e);t&&b(kt(t))},[b,e]),Y=(0,Z.useCallback)(async t=>{if(e){N(null),I(t.id);try{vi(await ft(e.run.id,t.id,{ownerAgentId:p}),t.name||t.id)}catch(e){N(e instanceof Error?e.message:String(e))}finally{I(null)}}},[p,e]),se=(0,Z.useCallback)(t=>{if(!e||!t.prompt)return;let n=Zr(e);if(!n){F(t.prompt);return}b(kt(n,t.prompt))},[b,e]),ce=(0,Z.useCallback)(e=>{if(e.kind===`copy_result`){ie();return}if(e.kind===`open_artifact`){let t=Si(e.payload),n=q?.artifacts.find(e=>e.id===t||e.name===t);n&&Y(n);return}let t=Si(e.payload),n=q?.followUps.find(e=>e.id===t);if(n?.prompt){se(n);return}let r=Ci(e.payload);r&&se({id:e.id,title:e.label,prompt:r})},[ie,Y,se,q?.artifacts,q?.followUps]),le=(0,Z.useCallback)(t=>{if(!e||t==null)return;let n=String(t),r=e.agents.findIndex(e=>String(e.id)===n);if(r<0)return;let i=Number.parseInt(n,10);k(Number.isFinite(i)?i:r+1)},[e]),ue=e?Zr(e):null,de=q?.actions.filter(e=>wi(e,q))??[],pe=de.some(e=>e.kind===`copy_result`);if(n)return(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel p-5`,children:(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl`,"aria-busy":!0,children:[(0,$.jsx)(R,{className:`h-8 w-72 max-w-full`}),(0,$.jsx)(R,{className:`mt-4 h-28 rounded-2xl`}),(0,$.jsx)(R,{className:`mt-5 h-[28rem] rounded-2xl`})]})});if(!e||!H)return null;let{run:X}=e,me=e.controls.canCancel&&V,he=V&&X.startedAtMs!=null?tt(Date.now()-X.startedAtMs):tt(X.metrics.durationMs??void 0),ge=Yr(e,_),_e=Xr(e,_),ye=e.controls.canRetry&&e.agents.some(e=>(e.status===`error`||e.status===`skipped`)&&e.prompt?.trim()),Se=e.controls.canRetry&&(e.phases.some(t=>t.status===`failed`&&e.agents.some(e=>e.phaseId===t.id&&e.prompt?.trim()))||e.agents.some(e=>(e.status===`error`||e.status===`skipped`)&&e.phaseId&&e.prompt?.trim())),Ce=X.goal?.trim()||X.title,we=e.nodes.find(e=>e.status===`running`)??e.nodes.find(e=>e.status===`error`)??[...e.nodes].reverse().find(e=>e.status===`done`),Te=we?.kind===`output`&&!we.error?K?.summary??we.resultPreview:null,Ee=Te??(we?we.error||(r===`zh`?`${we.status===`running`?`正在执行`:we.status===`done`?`刚刚完成`:`需要处理`}:${we.title}`:`${we.status===`running`?`Working on`:we.status===`done`?`Just completed`:`Needs attention`}: ${we.title}`):ge),Oe=ee.length>0||!!_e,ke=(X.status===`failed`||X.status===`timeout`)&&!!m;return(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel`,children:(0,$.jsxs)(`section`,{className:`mx-auto w-full max-w-6xl p-5`,children:[(0,$.jsxs)(`header`,{className:`rounded-2xl border border-edge-subtle bg-surface-base/60 p-4`,children:[(0,$.jsx)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-lg font-semibold leading-7 text-fg`,children:Ce}),(0,$.jsx)(`span`,{className:T(`rounded-full px-2 py-0.5 text-xs font-medium`,De(X.status)),children:qr(X.status,_)})]}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[X.title,` · `,X.definitionId]}),(0,$.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:ge}),_e?(0,$.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-subtle`,children:_e}):null,(0,$.jsxs)(`div`,{className:T(`mt-4 rounded-xl border px-3 py-2.5`,we?.status===`error`?`border-danger/30 bg-danger/5`:`border-accent/20 bg-accent-soft/50`),children:[(0,$.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:r===`zh`?`当前状态`:`Current status`}),Te?(0,$.jsx)(`div`,{className:`mt-2 max-h-40 overflow-hidden [mask-image:linear-gradient(to_bottom,black_calc(100%-1.5rem),transparent)]`,children:(0,$.jsx)(v,{content:Ee,compact:!0,className:`workflow-status-markdown`,codeCopy:!1,renderMermaid:!1})}):(0,$.jsx)(`p`,{className:`mt-1 text-sm font-medium text-fg`,children:Ee})]})]})}),(0,$.jsxs)(`dl`,{className:`mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,$.jsx)(ki,{label:_.metrics.startedAt,value:ve(X.startedAtMs??X.createdAtMs,a)}),(0,$.jsx)(ki,{label:_.metrics.duration,value:he}),(0,$.jsx)(ki,{label:_.metrics.agents,value:be(_.agentProgress,{done:X.metrics.doneAgentCount,total:X.metrics.agentCount})}),(0,$.jsx)(ki,{label:_.metrics.artifacts,value:String(X.metrics.artifactCount)})]})]}),(0,$.jsx)(ei,{activeTab:o,onChange:s,labels:_,artifactCount:q?.artifacts.length??e.artifacts.length,language:r,showSource:!!X.metadata?.definition}),o===`result`?(0,$.jsxs)(`section`,{className:`mt-5 space-y-4`,children:[re?(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge bg-surface-base`,children:[(0,$.jsxs)(`header`,{className:`flex flex-col gap-3 border-b border-edge-subtle bg-surface-panel/45 px-4 py-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:_.resultTitle}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:_.resultReadyHint})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[ue?(0,$.jsxs)(L,{variant:`primary`,className:`h-8 text-xs`,onClick:ae,children:[(0,$.jsx)(xe,{className:`size-3.5`,"aria-hidden":!0}),_.continueInChat]}):null,de.map(e=>(0,$.jsx)(L,{variant:`secondary`,className:`h-8 text-xs`,onClick:()=>ce(e),children:e.label},e.id)),pe?null:(0,$.jsxs)(L,{variant:`secondary`,className:`h-8 text-xs`,onClick:ie,children:[A?(0,$.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),A?_.copied:_.copyResult]}),(0,$.jsxs)(L,{variant:`secondary`,className:`h-8 text-xs`,onClick:J,children:[(0,$.jsx)(g,{className:`size-3.5`,"aria-hidden":!0}),_.exportResult]})]})]}),(0,$.jsx)(`div`,{className:`px-5 py-6 sm:px-8 sm:py-8`,children:(0,$.jsx)(`div`,{className:`mx-auto w-full max-w-4xl`,children:(0,$.jsx)(Ue,{result:K,labels:y.result})})})]}):X.status!==`failed`&&X.status!==`timeout`?(0,$.jsx)(`div`,{className:`rounded-xl border border-dashed border-edge p-4 text-sm text-fg-muted`,children:_.noResult}):null,X.status===`failed`||X.status===`timeout`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`section`,{className:`flex flex-col gap-3 rounded-2xl border border-amber-500/25 bg-amber-500/5 p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:_.recoveryActionsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:_e})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[ke?(0,$.jsxs)(L,{variant:`primary`,onClick:m,children:[(0,$.jsx)(Et,{className:`size-4`,"aria-hidden":!0}),r===`zh`?`让 AI 修复`:`Fix with AI`]}):null,ye?(0,$.jsxs)(L,{variant:`secondary`,onClick:()=>d(`failed_agents`),children:[(0,$.jsx)(x,{className:`size-4`,"aria-hidden":!0}),_.replayFailedAgents]}):null,Se?(0,$.jsxs)(L,{variant:`secondary`,onClick:()=>d(`failed_phases`),children:[(0,$.jsx)(x,{className:`size-4`,"aria-hidden":!0}),_.replayFailedPhases]}):null,e.controls.canRetry?(0,$.jsxs)(L,{variant:`secondary`,onClick:l,children:[(0,$.jsx)(x,{className:`size-4`,"aria-hidden":!0}),_.rerun]}):null]})]}),(0,$.jsx)(di,{view:e,language:r})]}):null,q?(0,$.jsx)(_i,{task:q,labels:_,downloadingArtifactId:P,downloadError:M,onCopyText:e=>void F(e),onDownloadArtifact:e=>void Y(e),onStartFollowUp:se,compact:!0}):null,me?(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsxs)(L,{variant:`secondary`,onClick:c,className:`text-red-600 dark:text-red-300`,children:[(0,$.jsx)(Ae,{className:`size-4`,"aria-hidden":!0}),_.cancel]})}):null]}):null,o===`process`?(0,$.jsxs)($.Fragment,{children:[e.run.metadata?.definition.graph?(0,$.jsx)(Lr,{graph:e.run.metadata.definition.graph,view:e,language:r,onRepair:m}):null,Oe?(0,$.jsx)($r,{diagnostics:ee,labels:_,hint:_e,onOpenAgent:le}):null,(0,$.jsx)(ti,{snapshot:H,rollup:U,view:e,labels:_,cardLabels:y,isActive:V,processExpanded:S,logsExpanded:E,selectedAgentId:O,selectedAgent:W,durationText:he,onToggleProcess:()=>C(e=>!e),onToggleLogs:()=>D(e=>!e),onSelectAgent:G}),(0,$.jsx)(si,{view:e,comparison:t,labels:_,onOpenRunId:f}),(0,$.jsx)(ci,{view:e,labels:_})]}):null,o===`artifacts`?(0,$.jsx)(_i,{task:q,labels:_,downloadingArtifactId:P,downloadError:M,onCopyText:e=>void F(e),onDownloadArtifact:e=>void Y(e),onStartFollowUp:se}):null,o===`source`&&X.metadata?.definition?(0,$.jsx)(Xn,{initialSource:rr(tr(X.metadata.definition)),resetKey:`${X.id}:${X.metadata.definition.revision}`,fileName:`${X.definitionId}-${X.id.slice(0,8)}.workflow.json`,language:r,className:`mt-5 h-[36rem]`}):null]})})}function $r(e){let t=(0,Q.c)(13),{diagnostics:n,labels:r,hint:i,onOpenAgent:a}=e;if(n.length===0&&!i)return null;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(`div`,{className:`rounded-xl bg-rose-500/10 p-2 text-rose-700 dark:text-rose-300`,children:(0,$.jsx)(ye,{className:`size-4`,"aria-hidden":!0})}),t[0]=o):o=t[0];let s;t[1]===r.reliabilityTitle?s=t[2]:(s=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.reliabilityTitle}),t[1]=r.reliabilityTitle,t[2]=s);let c=i??r.reliabilityHint,l;t[3]===c?l=t[4]:(l=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:c}),t[3]=c,t[4]=l);let u;t[5]!==n||t[6]!==r||t[7]!==a?(u=n.length>0?(0,$.jsx)(`ul`,{className:`mt-3 space-y-2`,children:n.slice(0,5).map(e=>(0,$.jsx)(`li`,{className:`rounded-xl border border-edge-subtle bg-surface-panel px-3 py-2`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:oi(e,r)}),e.message?(0,$.jsx)(`div`,{className:`mt-0.5 text-xs leading-5 text-fg-muted`,children:e.message}):null,e.detail?(0,$.jsx)(`div`,{className:`mt-0.5 line-clamp-2 text-xs leading-5 text-fg-subtle`,children:e.detail}):null]}),e.agentId==null?null:(0,$.jsx)(L,{type:`button`,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,onClick:()=>a(e.agentId),children:r.openAgentDetails})]})},e.key))}):null,t[5]=n,t[6]=r,t[7]=a,t[8]=u):u=t[8];let d;return t[9]!==s||t[10]!==l||t[11]!==u?(d=(0,$.jsx)(`section`,{className:`mt-5 rounded-2xl border border-rose-500/20 bg-rose-500/5 p-4`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[o,(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s,l,u]})]})}),t[9]=s,t[10]=l,t[11]=u,t[12]=d):d=t[12],d}function ei(e){let t=(0,Q.c)(20),{activeTab:n,onChange:r,labels:i,artifactCount:a,language:o,showSource:s}=e,c;t[0]===i.resultTitle?c=t[1]:(c={id:`result`,label:i.resultTitle},t[0]=i.resultTitle,t[1]=c);let l;t[2]===i.process?l=t[3]:(l={id:`process`,label:i.process},t[2]=i.process,t[3]=l);let u=a||void 0,d;t[4]!==i.taskArtifacts||t[5]!==u?(d={id:`artifacts`,label:i.taskArtifacts,count:u},t[4]=i.taskArtifacts,t[5]=u,t[6]=d):d=t[6];let f;t[7]!==o||t[8]!==s?(f=s?[{id:`source`,label:o===`zh`?`执行定义`:`Run definition`}]:[],t[7]=o,t[8]=s,t[9]=f):f=t[9];let p;t[10]!==c||t[11]!==l||t[12]!==d||t[13]!==f?(p=[c,l,d,...f],t[10]=c,t[11]=l,t[12]=d,t[13]=f,t[14]=p):p=t[14];let m=p,h;return t[15]!==n||t[16]!==i.taskActionsAria||t[17]!==r||t[18]!==m?(h=(0,$.jsx)(`div`,{className:`mt-5 flex overflow-x-auto border-b border-edge pb-2`,children:(0,$.jsx)(J,{items:m,activeTab:n,onChange:r,ariaLabel:i.taskActionsAria})}),t[15]=n,t[16]=i.taskActionsAria,t[17]=r,t[18]=m,t[19]=h):h=t[19],h}function ti(e){let t=(0,Q.c)(37),{snapshot:n,rollup:r,view:i,labels:a,cardLabels:o,isActive:s,processExpanded:c,logsExpanded:l,selectedAgentId:u,selectedAgent:d,durationText:f,onToggleProcess:p,onToggleLogs:m,onSelectAgent:h}=e,g;t[0]===a.process?g=t[1]:(g=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.process}),t[0]=a.process,t[1]=g);let _;t[2]!==a.agentProgress||t[3]!==i.run.metrics.agentCount||t[4]!==i.run.metrics.doneAgentCount?(_=be(a.agentProgress,{done:i.run.metrics.doneAgentCount,total:i.run.metrics.agentCount}),t[2]=a.agentProgress,t[3]=i.run.metrics.agentCount,t[4]=i.run.metrics.doneAgentCount,t[5]=_):_=t[5];let v;t[6]!==f||t[7]!==_?(v=(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[_,` · `,f]}),t[6]=f,t[7]=_,t[8]=v):v=t[8];let y;t[9]!==g||t[10]!==v?(y=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[g,v]}),t[9]=g,t[10]=v,t[11]=y):y=t[11];let b=c?`rotate-180`:null,x;t[12]===b?x=t[13]:(x=T(`size-4 shrink-0 text-fg-subtle transition-transform`,b),t[12]=b,t[13]=x);let S;t[14]===x?S=t[15]:(S=(0,$.jsx)(pt,{className:x,"aria-hidden":!0}),t[14]=x,t[15]=S);let C;t[16]!==p||t[17]!==c||t[18]!==y||t[19]!==S?(C=(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-4 px-4 py-3 text-left`,onClick:p,"aria-expanded":c,children:[y,S]}),t[16]=p,t[17]=c,t[18]=y,t[19]=S,t[20]=C):C=t[20];let w;t[21]!==o||t[22]!==s||t[23]!==a||t[24]!==l||t[25]!==h||t[26]!==m||t[27]!==c||t[28]!==r||t[29]!==d||t[30]!==u||t[31]!==n||t[32]!==i.phases?(w=c?(0,$.jsx)(`div`,{className:`border-t border-edge px-4 pb-4 pt-4`,children:(0,$.jsxs)(`div`,{className:`grid gap-4 xl:grid-cols-[minmax(0,1fr)_minmax(20rem,26rem)]`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[s?(0,$.jsx)(st,{snapshot:n,labels:o,logsExpanded:l,onToggleLogs:m,selectedAgentId:u,onSelectAgent:h}):(0,$.jsx)(_t,{rollup:r,currentPhase:n.currentPhase,labels:o.phase,recentLogs:n.logs,recentLogsHeading:o.recentLogsHeading,showAllLogsLabel:o.showAllLogs,logsExpanded:l,onToggleLogs:m,selectedAgentId:u,onSelectAgent:h}),i.phases.length>0?(0,$.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:i.phases.map(e=>(0,$.jsx)(`div`,{className:`rounded-xl border border-edge bg-surface-panel px-3 py-2`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:Jr(e.status,a)})]})},e.id))}):null]}),(0,$.jsx)(ni,{agent:d,snapshot:n,labels:a,cardLabels:o})]})}):null,t[21]=o,t[22]=s,t[23]=a,t[24]=l,t[25]=h,t[26]=m,t[27]=c,t[28]=r,t[29]=d,t[30]=u,t[31]=n,t[32]=i.phases,t[33]=w):w=t[33];let E;return t[34]!==C||t[35]!==w?(E=(0,$.jsxs)(`div`,{className:`mt-5 rounded-2xl border border-edge bg-surface-base/35`,children:[C,w]}),t[34]=C,t[35]=w,t[36]=E):E=t[36],E}function ni(e){let t=(0,Q.c)(57),{agent:n,snapshot:r,labels:i,cardLabels:a}=e,[o,s]=(0,Z.useState)(!1),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{s(!1)},t[0]=c):c=t[0];let l=n?.id,u;if(t[1]===l?u=t[2]:(u=[l],t[1]=l,t[2]=u),(0,Z.useEffect)(c,u),!n){let e;return t[3]===i.noSubagents?e=t[4]:(e=(0,$.jsx)(`aside`,{className:`min-w-0 rounded-2xl border border-dashed border-edge bg-surface-panel/45 p-4 text-sm text-fg-muted`,children:i.noSubagents}),t[3]=i.noSubagents,t[4]=e),e}let d;t[5]===n?d=t[6]:(d=ht(n),t[5]=n,t[6]=d);let f=d,p=n.error||n.resultPreview||n.currentStep||a.checkDetail.runningPlaceholder,m;t[7]===n.label?m=t[8]:(m=(0,$.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.label}),t[7]=n.label,t[8]=m);let h=n.phase||i.process,g;t[9]!==f||t[10]!==h?(g=[h,f].filter(Boolean),t[9]=f,t[10]=h,t[11]=g):g=t[11];let _=g.join(` · `),v;t[12]===_?v=t[13]:(v=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:_}),t[12]=_,t[13]=v);let y;t[14]!==m||t[15]!==v?(y=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[m,v]}),t[14]=m,t[15]=v,t[16]=y):y=t[16];let b;t[17]===n.status?b=t[18]:(b=T(`rounded-full px-2 py-0.5 text-xs font-medium`,Oi(n.status)),t[17]=n.status,t[18]=b);let x=i.agentStatus[n.status]??n.status,S;t[19]!==b||t[20]!==x?(S=(0,$.jsx)(`span`,{className:b,children:x}),t[19]=b,t[20]=x,t[21]=S):S=t[21];let C;t[22]!==y||t[23]!==S?(C=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[y,S]}),t[22]=y,t[23]=S,t[24]=C):C=t[24];let w;t[25]===i.agentOutputHeading?w=t[26]:(w=(0,$.jsx)(`h4`,{className:`text-xs font-semibold text-fg`,children:i.agentOutputHeading}),t[25]=i.agentOutputHeading,t[26]=w);let E=n.error?`font-mono text-rose-600 dark:text-rose-400`:`text-fg-muted`,D;t[27]===E?D=t[28]:(D=T(`mt-2 max-h-72 overflow-auto whitespace-pre-wrap wrap-break-word text-sm leading-6`,E),t[27]=E,t[28]=D);let O;t[29]!==p||t[30]!==D?(O=(0,$.jsx)(`div`,{className:D,children:p}),t[29]=p,t[30]=D,t[31]=O):O=t[31];let k;t[32]!==w||t[33]!==O?(k=(0,$.jsxs)(`section`,{className:`mt-4 rounded-xl border border-edge-subtle bg-surface-base/60 p-3`,children:[w,O]}),t[32]=w,t[33]=O,t[34]=k):k=t[34];let A;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>s(ai),t[35]=A):A=t[35];let j=i.debugDetailsTitle,M=o&&`rotate-180`,N;t[36]===M?N=t[37]:(N=T(`size-4 shrink-0 text-fg-subtle transition-transform`,M),t[36]=M,t[37]=N);let P;t[38]===N?P=t[39]:(P=(0,$.jsx)(pt,{className:N,"aria-hidden":!0}),t[38]=N,t[39]=P);let F;t[40]!==o||t[41]!==i.debugDetailsTitle||t[42]!==P?(F=(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between gap-3 px-3 py-2 text-left text-xs font-semibold text-fg`,onClick:A,"aria-expanded":o,children:[j,P]}),t[40]=o,t[41]=i.debugDetailsTitle,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==o||t[45]!==n||t[46]!==a||t[47]!==i||t[48]!==r?(I=o?(0,$.jsxs)(`div`,{className:`space-y-3 border-t border-edge-subtle p-3`,children:[n.steps?.length?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-fg-subtle`,children:a.checkDetail.stepsHeading}),(0,$.jsx)(`div`,{className:`mt-2 space-y-2`,children:n.steps.slice(0,8).map(ii)})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-fg-subtle`,children:i.agentInputHeading}),(0,$.jsx)(`pre`,{className:`mt-1 max-h-44 overflow-auto whitespace-pre-wrap wrap-break-word rounded-lg bg-surface-panel p-2 font-mono text-xs leading-5 text-fg-muted`,children:n.prompt||`—`})]}),(0,$.jsx)(Ti,{agent:n,labels:i}),r.logs.length>0?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`div`,{className:`text-[10px] font-medium uppercase tracking-wide text-fg-subtle`,children:a.recentLogsHeading}),(0,$.jsx)(`div`,{className:`mt-1 max-h-36 space-y-0.5 overflow-auto rounded-lg bg-surface-panel p-2 font-mono text-xs text-fg-subtle`,children:r.logs.map(ri)})]}):null]}):null,t[44]=o,t[45]=n,t[46]=a,t[47]=i,t[48]=r,t[49]=I):I=t[49];let L;t[50]!==F||t[51]!==I?(L=(0,$.jsxs)(`section`,{className:`mt-3 rounded-xl border border-edge-subtle bg-surface-base/40`,children:[F,I]}),t[50]=F,t[51]=I,t[52]=L):L=t[52];let R;return t[53]!==C||t[54]!==k||t[55]!==L?(R=(0,$.jsxs)(`aside`,{className:`min-w-0 rounded-2xl border border-edge bg-surface-panel p-4`,children:[C,k,L]}),t[53]=C,t[54]=k,t[55]=L,t[56]=R):R=t[56],R}function ri(e){return(0,$.jsx)(`div`,{className:`wrap-break-word`,children:e},e)}function ii(e){return(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-2.5 py-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`min-w-0 truncate text-xs font-medium text-fg`,children:e.label}),(0,$.jsx)(`span`,{className:`shrink-0 text-[10px] text-fg-subtle`,children:e.status})]}),e.detail||e.resultPreview||e.error?(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:e.error||e.resultPreview||e.detail}):null]},e.id)}function ai(e){return!e}function oi(e,t){return e.kind===`run_error`?e.code?be(t.diagnosticsRunErrorWithCode,{code:e.code}):t.diagnosticsRunError:e.kind===`agent_error`?be(t.diagnosticsAgentError,{agent:e.agentLabel??String(e.agentId??`—`)}):e.kind===`step_error`?be(t.diagnosticsStepError,{agent:e.agentLabel??String(e.agentId??`—`),step:e.stepLabel??e.stepId??`—`}):be(t.diagnosticsAgentSkipped,{agent:e.agentLabel??String(e.agentId??`—`)})}function si(e){let t=(0,Q.c)(36),{view:n,comparison:r,labels:i,onOpenRunId:a}=e,o=n.run.metadata?.replay;if(!o)return null;let s;t[0]===i.replayLineageTitle?s=t[1]:(s=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:i.replayLineageTitle}),t[0]=i.replayLineageTitle,t[1]=s);let c;t[2]!==i||t[3]!==o.scope||t[4]!==o.targetCount?(c=be(i.replayLineageSummary,{scope:ui(o.scope,i),count:o.targetCount}),t[2]=i,t[3]=o.scope,t[4]=o.targetCount,t[5]=c):c=t[5];let l;t[6]===c?l=t[7]:(l=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:c}),t[6]=c,t[7]=l);let u;t[8]!==i.replaySourceRun||t[9]!==o.sourceRunId?(u=(0,$.jsx)(Ai,{label:i.replaySourceRun,value:o.sourceRunId}),t[8]=i.replaySourceRun,t[9]=o.sourceRunId,t[10]=u):u=t[10];let d=i.replayTargetAgents,f;t[11]===o.agentIds?f=t[12]:(f=o.agentIds.join(`, `),t[11]=o.agentIds,t[12]=f);let p;t[13]!==i.replayTargetAgents||t[14]!==f?(p=(0,$.jsx)(Ai,{label:d,value:f}),t[13]=i.replayTargetAgents,t[14]=f,t[15]=p):p=t[15];let m;t[16]!==u||t[17]!==p?(m=(0,$.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs sm:grid-cols-2`,children:[u,p]}),t[16]=u,t[17]=p,t[18]=m):m=t[18];let h;t[19]!==r||t[20]!==i.replayDurationDelta||t[21]!==i.replayFixedAgents||t[22]!==i.replayStillFailingAgents?(h=r?(0,$.jsxs)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-3`,children:[(0,$.jsx)(ki,{label:i.replayFixedAgents,value:String(r.fixedAgentIds.length)}),(0,$.jsx)(ki,{label:i.replayStillFailingAgents,value:String(r.stillFailingAgentIds.length)}),(0,$.jsx)(ki,{label:i.replayDurationDelta,value:li(r.durationDeltaMs)})]}):null,t[19]=r,t[20]=i.replayDurationDelta,t[21]=i.replayFixedAgents,t[22]=i.replayStillFailingAgents,t[23]=h):h=t[23];let g;t[24]!==s||t[25]!==l||t[26]!==m||t[27]!==h?(g=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[s,l,m,h]}),t[24]=s,t[25]=l,t[26]=m,t[27]=h,t[28]=g):g=t[28];let _;t[29]!==i.replayOpenSource||t[30]!==a||t[31]!==o.sourceRunId?(_=a?(0,$.jsx)(L,{type:`button`,variant:`secondary`,className:`shrink-0`,onClick:()=>a(o.sourceRunId),children:i.replayOpenSource}):null,t[29]=i.replayOpenSource,t[30]=a,t[31]=o.sourceRunId,t[32]=_):_=t[32];let v;return t[33]!==g||t[34]!==_?(v=(0,$.jsx)(`section`,{className:`mt-5 rounded-2xl border border-edge-subtle bg-surface-base/35 p-4`,children:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[g,_]})}),t[33]=g,t[34]=_,t[35]=v):v=t[35],v}function ci(e){let t=(0,Q.c)(40),{view:n,labels:r}=e,i;t[0]===n.run.metadata?.contextRefs?i=t[1]:(i=n.run.metadata?.contextRefs??[],t[0]=n.run.metadata?.contextRefs,t[1]=i);let a=i,o=n.run.metadata?.contextSnapshot,s;t[2]===n.run.metadata?.writebackPolicy?.targets?s=t[3]:(s=n.run.metadata?.writebackPolicy?.targets??[],t[2]=n.run.metadata?.writebackPolicy?.targets,t[3]=s);let c=s;if(!a.length&&!c.length)return null;let l;t[4]===r.contextRefsTitle?l=t[5]:(l=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.contextRefsTitle}),t[4]=r.contextRefsTitle,t[5]=l);let u;t[6]!==r.contextRefsHint||t[7]!==r.contextSnapshotSummary||t[8]!==o?(u=o?r.contextSnapshotSummary.replace(`{{count}}`,String(o.totalTokens)):r.contextRefsHint,t[6]=r.contextRefsHint,t[7]=r.contextSnapshotSummary,t[8]=o,t[9]=u):u=t[9];let d;t[10]===u?d=t[11]:(d=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:u}),t[10]=u,t[11]=d);let f;t[12]!==r.contextRefKinds||t[13]!==r.noContextRefs||t[14]!==a?(f=a.length?a.map(e=>(0,$.jsx)(Ai,{label:r.contextRefKinds[e.kind]??e.kind,value:[e.title||e.id,e.role].filter(Boolean).join(` · `)},`${e.kind}:${e.id}:${e.role??``}`)):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.noContextRefs}),t[12]=r.contextRefKinds,t[13]=r.noContextRefs,t[14]=a,t[15]=f):f=t[15];let p;t[16]===f?p=t[17]:(p=(0,$.jsx)(`div`,{className:`mt-3 grid gap-2`,children:f}),t[16]=f,t[17]=p);let m;t[18]!==l||t[19]!==d||t[20]!==p?(m=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[l,d,p]}),t[18]=l,t[19]=d,t[20]=p,t[21]=m):m=t[21];let h;t[22]===r.writebackTitle?h=t[23]:(h=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.writebackTitle}),t[22]=r.writebackTitle,t[23]=h);let g;t[24]===r.writebackHint?g=t[25]:(g=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:r.writebackHint}),t[24]=r.writebackHint,t[25]=g);let _;t[26]!==r.noWritebackTargets||t[27]!==r.writebackModes||t[28]!==r.writebackTargetKinds||t[29]!==c?(_=c.length?c.map(e=>(0,$.jsx)(Ai,{label:r.writebackTargetKinds[e.kind]??e.kind,value:`${e.id} · ${r.writebackModes[e.mode]??e.mode}`},`${e.kind}:${e.id}:${e.mode}`)):(0,$.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.noWritebackTargets}),t[26]=r.noWritebackTargets,t[27]=r.writebackModes,t[28]=r.writebackTargetKinds,t[29]=c,t[30]=_):_=t[30];let v;t[31]===_?v=t[32]:(v=(0,$.jsx)(`div`,{className:`mt-3 grid gap-2`,children:_}),t[31]=_,t[32]=v);let y;t[33]!==g||t[34]!==v||t[35]!==h?(y=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[h,g,v]}),t[33]=g,t[34]=v,t[35]=h,t[36]=y):y=t[36];let b;return t[37]!==y||t[38]!==m?(b=(0,$.jsx)(`section`,{className:`mt-5 rounded-2xl border border-edge-subtle bg-surface-base/35 p-4`,children:(0,$.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[m,y]})}),t[37]=y,t[38]=m,t[39]=b):b=t[39],b}function li(e){return e==null?`—`:`${e>0?`+`:e<0?`-`:``}${tt(Math.abs(e))}`}function ui(e,t){return e===`failed_phases`?t.replayScopeFailedPhases:t.replayScopeFailedAgents}function di(e){let t=(0,Q.c)(8),{view:n,language:r}=e,i=n.nodes,a,o;if(t[0]!==r||t[1]!==n.nodes){o=Symbol.for(`react.early_return_sentinel`);bb0:{let e=i.filter(gi),s=n.nodes.filter(hi);if(e.length===0&&s.length===0){o=null;break bb0}let c=r===`zh`?`已保留的阶段结果`:`Work completed before the failure`,l;t[4]===c?l=t[5]:(l=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:c}),t[4]=c,t[5]=l);let u=r===`zh`?`失败不会清空已经完成的工作。你可以先使用这些结果,再让 AI 修复剩余步骤。`:`Completed work is preserved. You can use it now and ask AI to repair the remaining steps.`,d;t[6]===u?d=t[7]:(d=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:u}),t[6]=u,t[7]=d),a=(0,$.jsxs)(`section`,{className:`rounded-2xl border border-amber-500/25 bg-amber-500/5 p-4`,children:[l,d,e.length>0?(0,$.jsx)(`ul`,{className:`mt-3 space-y-2`,children:e.map(mi)}):null,s.length>0?(0,$.jsx)(`p`,{className:`mt-3 text-xs text-danger`,children:r===`zh`?`待修复:${s.map(pi).join(`、`)}`:`Needs repair: ${s.map(fi).join(`, `)}`}):null]})}t[0]=r,t[1]=n.nodes,t[2]=a,t[3]=o}else a=t[2],o=t[3];return o===Symbol.for(`react.early_return_sentinel`)?a:o}function fi(e){return e.title}function pi(e){return e.title}function mi(e){return(0,$.jsxs)(`li`,{className:`rounded-xl border border-edge-subtle bg-surface-base/60 px-3 py-2.5`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words text-xs leading-5 text-fg-muted`,children:e.resultPreview})]},e.id)}function hi(e){return e.status===`error`}function gi(e){return e.status===`done`&&e.resultPreview?.trim()}function _i(e){let t=(0,Q.c)(19),{task:n,labels:r,downloadingArtifactId:i,downloadError:a,onCopyText:o,onDownloadArtifact:s,onStartFollowUp:c,compact:l}=e,u=l===void 0?!1:l;if(!n||!n.artifacts.length&&!n.followUps.length){if(u)return null;let e;return t[0]===r.noArtifacts?e=t[1]:(e=(0,$.jsx)(`section`,{className:`mt-5 rounded-xl border border-dashed border-edge p-4 text-sm text-fg-muted`,children:r.noArtifacts}),t[0]=r.noArtifacts,t[1]=e),e}let d=!u&&`mt-5`,f;t[2]===d?f=t[3]:(f=T(`grid gap-3 lg:grid-cols-3`,d),t[2]=d,t[3]=f);let p;t[4]!==a||t[5]!==i||t[6]!==r||t[7]!==s||t[8]!==n.artifacts?(p=n.artifacts.length>0?(0,$.jsxs)(yi,{title:r.taskArtifacts,children:[(0,$.jsx)(`ul`,{className:`space-y-2`,children:n.artifacts.map(e=>(0,$.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-base px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,title:e.title??e.name,children:e.title??e.name}),(0,$.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-subtle`,children:e.mimeType}),(0,$.jsxs)(`button`,{type:`button`,className:`mt-1 inline-flex items-center gap-1 text-xs font-medium text-accent-fg hover:underline disabled:cursor-wait disabled:opacity-60`,disabled:i===e.id,onClick:()=>s(e),children:[(0,$.jsx)(g,{className:`size-3`,"aria-hidden":!0}),i===e.id?r.downloadingArtifact:r.downloadArtifact]})]},e.id))}),a?(0,$.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-rose-600 dark:text-rose-400`,children:a}):null]}):null,t[4]=a,t[5]=i,t[6]=r,t[7]=s,t[8]=n.artifacts,t[9]=p):p=t[9];let m;t[10]!==r||t[11]!==o||t[12]!==c||t[13]!==n.followUps?(m=n.followUps.length>0?(0,$.jsx)(yi,{title:r.taskFollowUps,children:(0,$.jsx)(`ul`,{className:`space-y-2`,children:n.followUps.map(e=>(0,$.jsxs)(`li`,{className:`rounded-lg bg-surface-base px-2.5 py-2`,children:[(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.title}),e.prompt?(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-2`,children:[(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:()=>c(e),children:r.startFollowUp}),(0,$.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-fg-subtle hover:text-fg`,onClick:()=>o(e.prompt??``),children:r.copyPrompt})]}):null]},e.id))})}):null,t[10]=r,t[11]=o,t[12]=c,t[13]=n.followUps,t[14]=m):m=t[14];let h;return t[15]!==f||t[16]!==p||t[17]!==m?(h=(0,$.jsxs)(`div`,{className:f,children:[p,m]}),t[15]=f,t[16]=p,t[17]=m,t[18]=h):h=t[18],h}function vi(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n)}function yi(e){let t=(0,Q.c)(10),{title:n,children:r,className:i}=e,a;t[0]===i?a=t[1]:(a=T(`min-w-0 rounded-xl border border-edge-subtle bg-surface-base/35 p-3`,i),t[0]=i,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,$.jsx)(`h4`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n}),t[2]=n,t[3]=o);let s;t[4]===r?s=t[5]:(s=(0,$.jsx)(`div`,{className:`mt-2`,children:r}),t[4]=r,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,$.jsxs)(`section`,{className:a,children:[o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function bi(e){if(!e||typeof e!=`object`||Array.isArray(e))return null;let t=e,n=Array.isArray(t.actions)?t.actions:[],r=Array.isArray(t.artifacts)?t.artifacts:[],i=Array.isArray(t.followUps)?t.followUps:[];return n.length===0&&r.length===0&&i.length===0?null:{actions:n,artifacts:r,followUps:i}}function xi(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:null}function Si(e){if(typeof e==`string`)return e.trim()||null;let t=xi(e);if(!t)return null;for(let e of[`artifactId`,`followUpId`,`id`,`name`])if(typeof t[e]==`string`&&t[e].trim())return t[e].trim();return null}function Ci(e){let t=xi(e);if(!t)return null;for(let e of[`prompt`,`message`,`text`])if(typeof t[e]==`string`&&t[e].trim())return t[e].trim();return null}function wi(e,t){if(e.kind===`copy_result`)return!0;let n=Si(e.payload);return e.kind===`open_artifact`?!!(n&&t.artifacts.some(e=>e.id===n||e.name===n)):e.kind===`start_followup`?!!(Ci(e.payload)||n&&t.followUps.some(e=>e.id===n&&e.prompt)):!!Ci(e.payload)}function Ti(e){let t=(0,Q.c)(21),{agent:n,labels:r}=e,i=n.invocation;if(!i)return null;let a=i.resolvedModelRef??i.modelRef,o;t[0]!==r.agentInvocationModel||t[1]!==a?(o={label:r.agentInvocationModel,value:a},t[0]=r.agentInvocationModel,t[1]=a,t[2]=o):o=t[2];let s;t[3]===i.toolset?s=t[4]:(s=i.toolset?.join(`, `),t[3]=i.toolset,t[4]=s);let c;t[5]!==r.agentInvocationTools||t[6]!==s?(c={label:r.agentInvocationTools,value:s},t[5]=r.agentInvocationTools,t[6]=s,t[7]=c):c=t[7];let l=i.maxIterations==null?void 0:String(i.maxIterations),u;t[8]!==r.agentInvocationIterations||t[9]!==l?(u={label:r.agentInvocationIterations,value:l},t[8]=r.agentInvocationIterations,t[9]=l,t[10]=u):u=t[10];let d=i.schema?r.agentInvocationSchemaPresent:void 0,f;t[11]!==r.agentInvocationSchema||t[12]!==d?(f={label:r.agentInvocationSchema,value:d},t[11]=r.agentInvocationSchema,t[12]=d,t[13]=f):f=t[13];let p;t[14]!==o||t[15]!==c||t[16]!==u||t[17]!==f?(p=[o,c,u,f].filter(Di),t[14]=o,t[15]=c,t[16]=u,t[17]=f,t[18]=p):p=t[18];let m=p;if(m.length===0)return null;let h;return t[19]===m?h=t[20]:(h=(0,$.jsx)(`dl`,{className:`mt-3 grid gap-2 border-t border-edge-subtle pt-3 text-xs sm:grid-cols-2 lg:grid-cols-4`,children:m.map(Ei)}),t[19]=m,t[20]=h),h}function Ei(e){return(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:e.label}),(0,$.jsx)(`dd`,{className:`mt-0.5 truncate font-medium text-fg-muted`,title:e.value,children:e.value})]},e.label)}function Di(e){return!!e.value}function Oi(e){return e===`done`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`error`?`bg-rose-500/10 text-rose-700 dark:text-rose-300`:e===`running`?`bg-accent-soft text-accent-fg`:`bg-surface-hover text-fg-subtle`}function ki(e){let t=(0,Q.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,$.jsx)(`dd`,{className:`mt-1 text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge bg-surface-base/40 p-3`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Ai(e){let t=(0,Q.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(`div`,{className:`text-xs text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,$.jsx)(`div`,{className:`mt-1 truncate text-sm font-medium text-fg`,title:r,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function ji(){let e=(0,Q.c)(11),t=E(Mi),[n]=a(),r;e[0]===n?r=e[1]:(r=n.get(`agentId`)?.trim()||void 0,e[0]=n,e[1]=r);let i=r,o;e[2]===t?o=e[3]:(o=t?[`workflow-route-agents`,t]:null,e[2]=t,e[3]=o);let s;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},e[4]=s):s=e[4];let c=I(o,B,s),l=i??c.data?.defaultId,u;e[5]===c.data?.agents?u=e[6]:(u=c.data?.agents??[],e[5]=c.data?.agents,e[6]=u);let d;return e[7]!==c.isLoading||e[8]!==l||e[9]!==u?(d={ownerAgentId:l,agents:u,loading:c.isLoading},e[7]=c.isLoading,e[8]=l,e[9]=u,e[10]=d):d=e[10],d}function Mi(e){return e.conversationId}function Ni(e){let t=(0,Q.c)(19),n=E(Pi),r;t[0]===n?r=t[1]:(r=n?[`workflow-route-definitions`,n]:null,t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i={revalidateOnFocus:!1},t[2]=i):i=t[2];let a=I(r,St,i),o;t[3]!==e||t[4]!==a.data?(o=a.data?.find(t=>t.id===e||t.name===e),t[3]=e,t[4]=a.data,t[5]=o):o=t[5];let s=o,c;t[6]===a?c=t[7]:(c=async e=>{await a.mutate(t=>[...(t??[]).filter(t=>t.id!==e.id&&t.name!==e.name),e],{revalidate:!1})},t[6]=a,t[7]=c);let l=c,u;t[8]===a?u=t[9]:(u=async()=>{await a.mutate()},t[8]=a,t[9]=u);let d=u,f;t[10]===a.data?f=t[11]:(f=a.data??[],t[10]=a.data,t[11]=f);let p;return t[12]!==s||t[13]!==a.error||t[14]!==a.isLoading||t[15]!==d||t[16]!==f||t[17]!==l?(p={definition:s,definitions:f,loading:a.isLoading,error:a.error,upsertDefinition:l,refreshDefinitions:d},t[12]=s,t[13]=a.error,t[14]=a.isLoading,t[15]=d,t[16]=f,t[17]=l,t[18]=p):p=t[18],p}function Pi(e){return e.conversationId}var Fi=()=>({goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``});function Ii(){let{definitionId:e}=s(),[t,n]=a(),r=i(),o=D(e=>e.language),l=w(o).workflows,u=o===`zh`?`zh-CN`:`en-US`,d=bt(e=>e.setPageHeader),m=bt(e=>e.clearPageHeader),{ownerAgentId:h,agents:g,loading:_}=ji(),[v,b]=(0,Z.useState)(),x=v??h,S=t.get(`projectId`)?.trim()||void 0,C=t.get(`view`)===`source`?`source`:`canvas`,{definition:T,loading:E,error:O}=Ni(e),k=I(`workflow-project-options`,()=>Fe({limit:100,sortBy:`updatedAt`,sortOrder:`desc`}),{revalidateOnFocus:!1}),A=I(S?[`workflow-project-presets`,S]:null,()=>ze(S),{revalidateOnFocus:!1}),j=I(x?[`workflow-detail-runs`,x,e,S??``]:null,()=>Be(100,{ownerAgentId:x,projectId:S}),{revalidateOnFocus:!1}),[M,N]=(0,Z.useState)(Fi),[P,F]=(0,Z.useState)([]),[z,B]=(0,Z.useState)(!1),[V,H]=(0,Z.useState)(!1),[K,q]=(0,Z.useState)(null),ne=(0,Z.useRef)(void 0),re=(0,Z.useMemo)(()=>(j.data??[]).filter(e=>e.definitionId===T?.id).slice(0,6),[T?.id,j.data]),ie=Nt(T,M),J=T?W(T,o):null,ae=A.data?.find(e=>e.definitionId===T?.id),Y=!!ae&&JSON.stringify(ae?.contextRefs)===JSON.stringify(P);(0,Z.useEffect)(()=>{if(!S||!T||!A.data)return;let e=`${S}:${T.id}`;ne.current!==e&&(ne.current=e,F(ae?.contextRefs??[]))},[T,S,ae?.contextRefs,A.data]);let oe=(0,Z.useCallback)(e=>{ne.current=void 0,F([]),n(t=>{let n=new URLSearchParams(t);return e?n.set(`projectId`,e):n.delete(`projectId`),n},{replace:!0})},[n]),ce=(0,Z.useCallback)(async()=>{if(!(!S||!T||V)){H(!0),q(null);try{let e=await se(S,T.id,P);await A.mutate(t=>[e,...(t??[]).filter(t=>t.definitionId!==e.definitionId)],{revalidate:!1})}catch(e){q(e instanceof Error?e.message:l.projectWorkflowSaveFailed)}finally{H(!1)}}},[P,T,l.projectWorkflowSaveFailed,S,A,V]),le=(0,Z.useCallback)(async()=>{if(!(!S||!T||V)){H(!0),q(null);try{await Oe(S,T.id),await A.mutate(e=>(e??[]).filter(e=>e.definitionId!==T.id),{revalidate:!1})}catch(e){q(e instanceof Error?e.message:l.projectWorkflowRemoveFailed)}finally{H(!1)}}},[T,l.projectWorkflowRemoveFailed,S,A,V]),ue=new URLSearchParams({tab:`library`});S&&ue.set(`projectId`,S);let de=`/workflows?${ue.toString()}`,fe=new URLSearchParams;x&&fe.set(`agentId`,x),S&&fe.set(`projectId`,S);let pe=fe.size?`?${fe.toString()}`:``,X=e=>{n(t=>{let n=new URLSearchParams(t);return e===`source`?n.set(`view`,`source`):n.delete(`view`),n},{replace:!0})},me=null;if(T){let e=new URLSearchParams;x&&e.set(`agentId`,x),S&&e.set(`projectId`,S),T.metadata.source!==`user`&&e.set(`copy`,T.id),me=`${T.metadata.source===`user`?`/workflows/${T.id}/edit`:`/workflows/new`}${e.size?`?${e.toString()}`:``}`}(0,Z.useLayoutEffect)(()=>(d({startExtra:(0,$.jsx)(c,{to:de,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":o===`zh`?`返回工作流库`:`Back to workflow library`,children:(0,$.jsx)(xt,{className:`size-4`,"aria-hidden":!0})}),main:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:J?.title??(o===`zh`?`工作流详情`:`Workflow details`)}),T?(0,$.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[T.metadata.source===`user`?l.badgeUser:l.badgeBuiltin,` · `,o===`zh`?`版本 ${T.revision}`:`Version ${T.revision}`]}):null]}),end:T&&me?(0,$.jsx)(L,{asChild:!0,variant:`secondary`,className:`h-9 shrink-0`,children:(0,$.jsxs)(c,{to:me,children:[T.metadata.source===`user`?(0,$.jsx)(y,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(ee,{className:`size-4`,"aria-hidden":!0}),T.metadata.source===`user`?l.editWorkflow:l.copyAndEditWorkflow]})}):null}),()=>m()),[m,T,me,l.badgeBuiltin,l.badgeUser,l.copyAndEditWorkflow,l.editWorkflow,o,J?.title,de,d]);let he=(0,Z.useCallback)(async()=>{if(!(!T||!x||!ie.valid||z)){B(!0),q(null);try{r(`/workflows/runs/${(await G({definitionId:T.id,goal:M.goal.trim()||J?.description||T.title,input:Ft(T,M),agentId:x,projectId:S,contextRefs:P,concurrency:M.concurrency.trim()?Number(M.concurrency):void 0,maxSubagents:M.maxSubagents.trim()?Number(M.maxSubagents):void 0})).runId}${pe}`)}catch(e){q(e instanceof Error?e.message:l.startFailed)}finally{B(!1)}}},[P,T,ie.valid,l.startFailed,J?.description,r,x,S,pe,M,z]);return E?(0,$.jsx)(Ui,{}):!T||!J?(0,$.jsx)(Wi,{message:O?.message??(o===`zh`?`没有找到这个工作流`:`Workflow not found`)}):(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-y-auto bg-surface-panel`,children:(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl px-4 pb-5 pt-3 sm:px-6 lg:pt-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsx)(`p`,{className:`max-w-3xl text-sm leading-6 text-fg-muted`,children:J.description}),(0,$.jsx)(`div`,{className:`flex rounded-lg bg-surface-base p-1`,role:`tablist`,"aria-label":o===`zh`?`工作流视图`:`Workflow view`,children:[`canvas`,`source`].map(e=>(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":C===e,className:`rounded-md px-3 py-1.5 text-xs font-medium ${C===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`}`,onClick:()=>X(e),children:e===`canvas`?o===`zh`?`画布`:`Canvas`:o===`zh`?`源码`:`Source`},e))})]}),(0,$.jsxs)(`div`,{className:`mt-5 grid gap-5 xl:grid-cols-[minmax(0,1fr)_22rem]`,children:[(0,$.jsx)(`div`,{className:`min-w-0`,children:C===`source`?(0,$.jsx)(Xn,{initialSource:rr($n(T)),resetKey:`${T.id}:${T.revision}`,fileName:`${T.name}.workflow.json`,language:o}):(0,$.jsx)(jr,{graph:T.graph,language:o,className:`h-[28rem] rounded-xl border border-edge`})}),(0,$.jsxs)(`aside`,{className:`rounded-xl border border-edge bg-surface-base/45 p-4`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o===`zh`?`开始一次运行`:`Start a run`}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:J.whenToUse||J.description}),(0,$.jsxs)(`label`,{className:`mt-4 block text-xs font-medium text-fg-muted`,children:[(0,$.jsxs)(`span`,{className:`mb-1.5 flex items-center gap-1.5`,children:[(0,$.jsx)(Ct,{className:`size-3.5 text-fg-subtle`,"aria-hidden":!0}),l.runProject]}),(0,$.jsxs)(f,{value:S??``,"aria-label":l.runProject,onChange:e=>oe(e.target.value),className:`h-9 w-full rounded-lg border border-edge bg-surface-panel px-2.5 text-sm text-fg shadow-surface`,children:[(0,$.jsx)(p,{value:``,children:l.runProjectNone}),(k.data?.items??[]).filter(e=>e.status!==`archived`&&e.status!==`cancelled`).map(e=>(0,$.jsx)(p,{value:e.id,children:e.name},e.id))]})]}),(0,$.jsxs)(`label`,{className:`mt-3 block text-xs font-medium text-fg-muted`,children:[o===`zh`?`执行助手`:`Execution assistant`,_?(0,$.jsx)(R,{className:`mt-1 h-10 w-full rounded-lg`}):(0,$.jsx)(f,{value:x??``,onChange:e=>b(e.target.value),className:`mt-1 w-full`,"aria-label":o===`zh`?`执行助手`:`Execution assistant`,children:g.map(e=>(0,$.jsx)(p,{value:e.id,children:te(e,w(o).agentsSettings)},e.id))})]}),(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(Jt,{projectId:S,language:o,value:P,onChange:F})}),S?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,$.jsxs)(L,{type:`button`,variant:`ghost`,className:`h-8 flex-1 justify-start px-2 text-xs`,disabled:V||Y,onClick:()=>void ce(),children:[(0,$.jsx)(ct,{className:`size-3.5`,"aria-hidden":!0}),Y?l.projectWorkflowSaved:ae?l.updateProjectWorkflow:l.saveProjectWorkflow]}),ae?(0,$.jsx)(L,{type:`button`,variant:`ghost`,className:`size-8 p-0 text-fg-muted`,disabled:V,"aria-label":l.removeProjectWorkflow,onClick:()=>void le(),children:(0,$.jsx)(Ce,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(It,{definition:T,language:o,value:M,onChange:N,mode:`manual`,badgeLabel:l.readyToStart,aiAssist:{context:{surface:`workflow-start`,workflowId:T.id,workflowName:T.name,workflowTitle:J.title,workflowDescription:J.description}}})}),K?(0,$.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:K}):null,(0,$.jsxs)(L,{variant:`primary`,className:`mt-4 w-full`,disabled:!x||_||!ie.valid||z,onClick:()=>void he(),children:[(0,$.jsx)(Ye,{className:`size-4`,"aria-hidden":!0}),z?l.starting:l.runWorkflow]})]})]}),(0,$.jsxs)(`section`,{className:`mt-6 border-t border-edge pt-5`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o===`zh`?`最近运行`:`Recent runs`}),re.length?(0,$.jsx)(`div`,{className:`mt-3 grid gap-2 md:grid-cols-2 xl:grid-cols-3`,children:re.map(e=>(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge bg-surface-base/40 p-3 text-left hover:bg-surface-hover`,onClick:()=>r(`/workflows/runs/${e.id}${pe}`),children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:l.status[e.status]})]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:U(e.createdAtMs,u)})]},e.id))}):(0,$.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:o===`zh`?`还没有运行记录。`:`No runs yet.`})]})]})})}function Li(){let{definitionId:e}=s(),[t]=a(),n=i(),r=D(e=>e.language),{ownerAgentId:o}=ji(),c=t.get(`copy`)?.trim()||void 0,l=t.get(`repairRun`)?.trim()||void 0,u=t.get(`projectId`)?.trim()||void 0,d=new URLSearchParams;o&&d.set(`agentId`,o),u&&d.set(`projectId`,u);let f=d.size?`?${d.toString()}`:``,{definition:p,definitions:m,loading:h,upsertDefinition:g,refreshDefinitions:_}=Ni(e??c),v=I(l&&o?[`workflow-repair-run`,l,o]:null,()=>Je(l,{ownerAgentId:o}),{revalidateOnFocus:!1}),[y,b]=(0,Z.useState)(!1),[x,S]=(0,Z.useState)(null),[C,w]=(0,Z.useState)(null),T=(0,Z.useMemo)(()=>m.map(e=>e.name),[m]),E=(0,Z.useMemo)(()=>gr(`my_workflow`,T),[T]),O=(0,Z.useMemo)(()=>{if(!p)return null;let t=e&&p.metadata.source===`user`?`edit`:`copy`,n=(v.data?.nodes.filter(e=>e.status===`error`)??[]).map(e=>r===`zh`?`${e.title}:${e.error??`执行失败`}`:`${e.title}: ${e.error??`execution failed`}`).join(r===`zh`?`;`:`; `)||v.data?.run.error?.message||void 0,i=l&&v.data?r===`zh`?`修复这次运行中的失败步骤,并保持原始目标不变:${n??`请根据运行记录定位失败原因`}`:`Repair the failed steps from this run while preserving the original goal: ${n??`use the run record to identify the failure`}`:void 0;return{mode:t,name:t===`edit`?p.name:Hi(p.name,m),graph:structuredClone(p.graph),manifest:Jn(p),baseRevision:t===`edit`?p.revision:0,sourceTitle:p.title,repairPrompt:i}},[p,e,m,r,v.data?.nodes,l]),k=(0,Z.useCallback)(async e=>{b(!0),S(null),w(null);try{let t=await Se(e.name,e.graph,e.manifest,e.expectedRevision);return await g(t),n(`/workflows/${t.id}/edit${f}`,{replace:!0}),t}catch(e){let t=_r(e);w(t),t||S(e instanceof Error?e.message:String(e))}finally{b(!1)}},[f,n,g]),A=(0,Z.useCallback)(async e=>{b(!0),S(null),w(null);try{let t=await Se(e.name,e.graph,e.manifest,e.expectedRevision);await g(t),n(`/workflows/runs/${(await G({definitionId:t.id,goal:e.goal,input:{goal:e.goal},agentId:o,projectId:u})).runId}${f}`)}catch(e){let t=_r(e);throw w(t),t||S(e instanceof Error?e.message:String(e)),e}finally{b(!1)}},[f,n,o,u,g]);return h?(0,$.jsx)(Ui,{}):e&&!p?(0,$.jsx)(Wi,{message:r===`zh`?`没有找到这个工作流`:`Workflow not found`}):(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[x?(0,$.jsx)(`div`,{className:`border-b border-danger/30 bg-danger/5 px-4 py-2 text-sm text-danger`,children:x}):null,(0,$.jsx)(yr,{language:r,saving:y,initialDraft:O,initialName:E,existingNames:T,saveConflict:C,onSave:k,onSaveAndStart:A,onClearSaveConflict:()=>w(null),onReloadLatest:()=>{w(null),S(null),_()},onStartAuthoring:async t=>{let r=await nt({prompt:t.prompt,agentId:o,projectId:u,workflowName:t.name,editing:!!(e&&p?.metadata.source===`user`)});n(`/chat/${encodeURIComponent(r)}`)}})]})}function Ri(){let e=(0,Q.c)(67),{runId:t}=s(),n=i(),[r]=a(),o=D(Vi),l;e[0]===o?l=e[1]:(l=w(o),e[0]=o,e[1]=l);let u=l.workflows,d=o===`zh`?`zh-CN`:`en-US`,f=bt(Bi),p=bt(zi),{ownerAgentId:m}=ji(),h=r.get(`projectId`)?.trim()||void 0,g;e[2]===m?g=e[3]:(g={ownerAgentId:m},e[2]=m,e[3]=g);let _=Xe(t,g),[v,y]=(0,Z.useState)(`process`),b=(0,Z.useRef)(!0),x;e[4]!==_.view?.run.metadata?.replay||e[5]!==m||e[6]!==t?(x=_.view?.run.metadata?.replay&&t?[`workflow-run-page-comparison`,t,m]:null,e[4]=_.view?.run.metadata?.replay,e[5]=m,e[6]=t,e[7]=x):x=e[7];let S;e[8]!==m||e[9]!==t?(S=()=>Ke(t,{ownerAgentId:m}),e[8]=m,e[9]=t,e[10]=S):S=e[10];let C;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(C={revalidateOnFocus:!1},e[11]=C):C=e[11];let T=I(x,S,C),E;e[12]===_.view?E=e[13]:(E=_.view?je.has(_.view.run.status):!0,e[12]=_.view,e[13]=E);let O=E,k;e[14]!==O||e[15]!==y?(k=()=>{b.current&&!O&&y(`result`),b.current=O},e[14]=O,e[15]=y,e[16]=k):k=e[16];let A;e[17]===O?A=e[18]:(A=[O],e[17]=O,e[18]=A),(0,Z.useEffect)(k,A);let j=new URLSearchParams({tab:`runs`});m&&j.set(`agentId`,m),h&&j.set(`projectId`,h);let M=`/workflows?${j.toString()}`,N,P;e[19]!==p||e[20]!==u.backToRuns||e[21]!==u.runDetailsTitle||e[22]!==_.view||e[23]!==M||e[24]!==f?(N=()=>(f({startExtra:(0,$.jsx)(c,{to:M,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":u.backToRuns,children:(0,$.jsx)(xt,{className:`size-4`,"aria-hidden":!0})}),main:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:u.runDetailsTitle}),_.view?(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:_.view.run.title}):null]}),end:null}),()=>p()),P=[p,u.backToRuns,u.runDetailsTitle,_.view,M,f],e[19]=p,e[20]=u.backToRuns,e[21]=u.runDetailsTitle,e[22]=_.view,e[23]=M,e[24]=f,e[25]=N,e[26]=P):(N=e[25],P=e[26]),(0,Z.useLayoutEffect)(N,P);let F;e[27]!==n||e[28]!==m||e[29]!==h?(F=e=>{let t=new URLSearchParams;m&&t.set(`agentId`,m),h&&t.set(`projectId`,h),n(`/workflows/runs/${e}${t.size?`?${t.toString()}`:``}`)},e[27]=n,e[28]=m,e[29]=h,e[30]=F):F=e[30];let L=F,R;e[31]!==L||e[32]!==m||e[33]!==t?(R=async()=>{t&&L((await ke(t,{ownerAgentId:m})).runId)},e[31]=L,e[32]=m,e[33]=t,e[34]=R):R=e[34];let z=R,B;e[35]!==L||e[36]!==m||e[37]!==t?(B=async e=>{t&&L((await ie(t,e,{ownerAgentId:m})).runId)},e[35]=L,e[36]=m,e[37]=t,e[38]=B):B=e[38];let V=B;if(!_.loading&&!_.view){let t=_.error instanceof Error?_.error.message:o===`zh`?`没有找到这次运行`:`Workflow run not found`,n;return e[39]===t?n=e[40]:(n=(0,$.jsx)(Wi,{message:t}),e[39]=t,e[40]=n),n}let H;e[41]!==_||e[42]!==m||e[43]!==t?(H=()=>t&&void He(t,{ownerAgentId:m}).then(()=>_.mutate()),e[41]=_,e[42]=m,e[43]=t,e[44]=H):H=e[44];let U;e[45]===z?U=e[46]:(U=()=>void z(),e[45]=z,e[46]=U);let W;e[47]===V?W=e[48]:(W=e=>void V(e),e[47]=V,e[48]=W);let G;e[49]!==_.view||e[50]!==n||e[51]!==m?(G=_.view?()=>n(`/workflows/${_.view.run.definitionId}/edit?repairRun=${encodeURIComponent(_.view.run.id)}${m?`&agentId=${encodeURIComponent(m)}`:``}`):void 0,e[49]=_.view,e[50]=n,e[51]=m,e[52]=G):G=e[52];let ee;return e[53]!==v||e[54]!==T.data||e[55]!==o||e[56]!==_.loading||e[57]!==_.view||e[58]!==d||e[59]!==L||e[60]!==m||e[61]!==y||e[62]!==H||e[63]!==U||e[64]!==W||e[65]!==G?(ee=(0,$.jsx)(Qr,{view:_.view,comparison:T.data,loading:_.loading,language:o,localeTag:d,activeTab:v,onTabChange:y,onCancel:H,onRetry:U,onReplay:W,onOpenRunId:L,ownerAgentId:m,onRepairWorkflow:G}),e[53]=v,e[54]=T.data,e[55]=o,e[56]=_.loading,e[57]=_.view,e[58]=d,e[59]=L,e[60]=m,e[61]=y,e[62]=H,e[63]=U,e[64]=W,e[65]=G,e[66]=ee):ee=e[66],ee}function zi(e){return e.clearPageHeader}function Bi(e){return e.setPageHeader}function Vi(e){return e.language}function Hi(e,t){let n=new Set(t.map(e=>e.name)),r=`${e}_copy`;if(!n.has(r))return r;for(let e=2;e<100;e+=1){let t=`${r}_${e}`;if(!n.has(t))return t}return`${r}_${Date.now()}`}function Ui(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`main`,{className:`min-h-0 flex-1 overflow-auto bg-surface-panel p-5`,"aria-busy":!0,children:(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl`,children:[(0,$.jsx)(R,{className:`h-5 w-36`}),(0,$.jsx)(R,{className:`mt-5 h-9 w-80 max-w-full`}),(0,$.jsx)(R,{className:`mt-4 h-[28rem] rounded-xl`})]})}),e[0]=t):t=e[0],t}function Wi(e){let t=(0,Q.c)(5),{message:n}=e,r;t[0]===n?r=t[1]:(r=(0,$.jsx)(`p`,{className:`text-sm text-danger`,children:n}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(L,{asChild:!0,variant:`secondary`,className:`mt-4`,children:(0,$.jsxs)(c,{to:`/workflows`,children:[(0,$.jsx)(xt,{className:`size-4`}),`Back`]})}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,$.jsx)(`main`,{className:`flex min-h-0 flex-1 items-center justify-center bg-surface-panel p-6 text-center`,children:(0,$.jsxs)(`div`,{children:[r,i]})}),t[3]=r,t[4]=a),a}export{Ii as WorkflowDetailPage,Li as WorkflowEditorPage,Ri as WorkflowRunPage,Kn as WorkflowsPage};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/session-manager-Bb9pevyM.js","assets/rolldown-runtime-aKtaBQYM.js","assets/locale-store-BKyOF23r.js","assets/vendor-react-BOUWij0V.js","assets/messages-B7VtMXec.js","assets/schemas-CObaziC7.js","assets/gateway-realtime-DS_GDx-x.js","assets/gateway-realtime-store-uEdmIROn.js","assets/local-session-drafts-Bye3ZtsW.js","assets/session-api-Br11ih_M.js","assets/gateway-startup-retry-DosoyMIH.js","assets/constants-DeXt1mV-.js","assets/tool-activity-BtJkgjFf.js","assets/registry-api-DLHHYP_v.js","assets/preload-helper-zJ_50EbN.js","assets/attachment-utils-core-BIOUBrpT.js","assets/agents-admin-api-znm6_dW_.js","assets/gateway-config-swr-BM__9Fws.js","assets/vendor-swr-BIWyz7Rc.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./preload-helper-zJ_50EbN.js";import{i as t,r as n}from"./locale-store-BKyOF23r.js";import{i as r,n as i,r as a,t as o}from"./files-Bw4SBGdM.js";async function s(e){let t=await e.json().catch(()=>null);return Error(t?.error?.message??`HTTP ${e.status}`)}async function c(e,r){let i=await t(n(e),r);if(!i.ok)throw await s(i);return i.json()}async function l(t){if(!t?.projectId&&t?.conversationId){let{SessionManager:n}=await e(async()=>{let{SessionManager:e}=await import(`./session-manager-Bb9pevyM.js`).then(e=>e.n);return{SessionManager:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]));await new n().materialize(t.conversationId,`session_resources`)}let n=t?.projectId?{kind:`project`,id:t.projectId}:t?.conversationId?{kind:`session`,id:t.conversationId}:t?.agentId?{kind:`agent`,id:t.agentId}:null;if(n){let e=await c(`/api/files/contexts/${n.kind}/${encodeURIComponent(n.id)}`);return r.parse(e.space)}let i=await c(`/api/files/default-space`);return r.parse(i.space)}function u(e){return{id:e.id,name:e.name,path:e.relativePath,isDirectory:e.kind===`directory`,mimeType:e.mimeType,revision:e.revision}}async function d(e,t){let n=await l(t),r=await c(`/api/files/resolve`,{method:`POST`,body:JSON.stringify({spaceId:n.id,path:e,taskRunId:t?.taskRunId})});return i.parse(r.resource)}async function f(e,t){return d(e,t)}async function p(e=``,t){let n=await l(t),r=new URLSearchParams;return e&&r.set(`path`,e),{entries:a.parse(await c(`/api/files/spaces/${encodeURIComponent(n.id)}/children${r.size?`?${r}`:``}`)).items.map(u)}}async function m(e=``,t){return(await p(e,t)).entries}async function h(e){let t=await l(e);return u(o.parse(await c(`/api/files/spaces/${encodeURIComponent(t.id)}/root`)).resource)}async function g(e,t,n=50){let r=await l(t),i=new URLSearchParams({q:e.trim(),limit:String(n),spaceId:r.id});return a.parse(await c(`/api/files/search?${i}`)).items.map(u)}async function _(e,r){let i=await d(e,r),a=await t(n(`/api/files/${encodeURIComponent(i.id)}/content`));if(!a.ok)throw await s(a);return{content:await a.text(),path:i.relativePath,mtimeMs:i.modifiedAt,revision:i.revision}}async function v(e,t){let n;try{n=await l(t)}catch{return null}try{let r=await c(`/api/files/resolve`,{method:`POST`,body:JSON.stringify({spaceId:n.id,path:e,taskRunId:t?.taskRunId})}),a=i.parse(r.resource);return{absolutePath:r.absolutePath,fileId:a.id,inputPath:e,displayName:a.name,scope:r.absolutePath?`external`:`workspace`,locationKind:r.absolutePath?`host`:`workspace`,exists:!0,isDirectory:a.kind===`directory`,workspaceRelativePath:a.relativePath,capabilities:a.capabilities.filter(e=>e===`preview`||e===`edit`),mtimeMs:a.modifiedAt}}catch{try{return(await c(`/api/files/resolve-reference`,{method:`POST`,body:JSON.stringify({spaceId:n.id,path:e,conversationId:t?.conversationId})})).reference}catch{return null}}}async function y(e,t,n){return await c(`/api/files/references/${encodeURIComponent(e)}/action`,{method:`POST`,body:JSON.stringify({action:t,conversationId:n?.conversationId})})}async function b(e,r){let i=await d(e,r),a=await t(n(`/api/files/${encodeURIComponent(i.id)}/content`),{headers:{Accept:`*/*`}});if(!a.ok)throw await s(a);return a.blob()}async function x(e,t,n){let r=await d(e,n),a=await c(`/api/files/${encodeURIComponent(r.id)}/content`,{method:`PUT`,body:JSON.stringify({content:t,revision:r.revision})}),o=i.parse(a.resource);return{path:o.relativePath,mtimeMs:o.modifiedAt,revision:o.revision}}async function S(e,r=``,i){let a=await l(i),c=new FormData;c.set(`directory`,r),c.set(`file`,e);let d=await t(n(`/api/files/spaces/${encodeURIComponent(a.id)}/upload`),{method:`POST`,body:c});if(!d.ok)throw await s(d);return u(o.parse(await d.json()).resource)}async function C(e){let r=await t(n(`/api/files/${encodeURIComponent(e)}`),{method:`DELETE`});if(!r.ok)throw await s(r)}function w(e,t){let n=new Blob([t],{type:`text/plain;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(r)}function T(e,t,n){let r=new Blob([t],{type:n}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=e,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}export{b as a,_ as c,f as d,g as f,p as i,y as l,x as m,T as n,h as o,S as p,w as r,m as s,C as t,v as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cloud-C4-yfnnk.js";import{t as r}from"./external-link-DjqjBmc3.js";import{a as i,n as a,r as o}from"./locale-store-BKyOF23r.js";import{n as s,t as c}from"./cloud-credits-BMYMiiNn.js";import{i as l}from"./vendor-swr-BIWyz7Rc.js";import{t as u}from"./button-aIC072nz.js";import{t as d}from"./skeleton-BI5TyibZ.js";import{No as f,ss as p}from"./index-Bo70AuAq.js";var m=e(),h=t();function g(e){let t=(BigInt(e)+500n)/1000n*1000n;return s(String(t))}async function _(){let e=await i(o(`/api/models/xopc-cloud/account-summary`));return c.parse(e.payload)}function v(e){let t=(0,m.c)(148),{labels:i}=e,o=a(y)===`zh`?`zh-CN`:`en-US`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s={refreshInterval:6e4,revalidateOnFocus:!0},t[0]=s):s=t[0];let{data:c,error:v,isLoading:b,isValidating:x,mutate:S}=l(`/api/models/xopc-cloud/account-summary`,_,s);if(b){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,h.jsx)(d,{className:`h-40 w-full rounded-xl`}),t[1]=e):e=t[1],e}if(v||!c){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,h.jsx)(f,{className:`mt-0.5 size-4 shrink-0 text-amber-500`,"aria-hidden":!0}),t[2]=e):e=t[2];let n;t[3]===i.title?n=t[4]:(n=(0,h.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i.title}),t[3]=i.title,t[4]=n);let r;t[5]===i.unavailable?r=t[6]:(r=(0,h.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:i.unavailable}),t[5]=i.unavailable,t[6]=r);let a;t[7]!==n||t[8]!==r?(a=(0,h.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[e,(0,h.jsxs)(`div`,{children:[n,r]})]}),t[7]=n,t[8]=r,t[9]=a):a=t[9];let o;t[10]===S?o=t[11]:(o=()=>void S(),t[10]=S,t[11]=o);let s=x?`size-4 animate-spin`:`size-4`,c;t[12]===s?c=t[13]:(c=(0,h.jsx)(p,{className:s,"aria-hidden":!0}),t[12]=s,t[13]=c);let l;t[14]!==x||t[15]!==i.retry||t[16]!==o||t[17]!==c?(l=(0,h.jsxs)(u,{type:`button`,variant:`secondary`,disabled:x,onClick:o,children:[c,i.retry]}),t[14]=x,t[15]=i.retry,t[16]=o,t[17]=c,t[18]=l):l=t[18];let d;return t[19]!==a||t[20]!==l?(d=(0,h.jsx)(`section`,{className:`rounded-xl bg-surface-hover/25 p-4`,children:(0,h.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[a,l]})}),t[19]=a,t[20]=l,t[21]=d):d=t[21],d}let C,w,T,E,D,O,k,A,j,M;if(t[22]!==c.balance.availableCreditMicro||t[23]!==c.balance.expiring[0]||t[24]!==c.balance.grantedCreditMicro||t[25]!==c.balance.purchasedCreditMicro||t[26]!==c.balance.refundReservedCreditMicro||t[27]!==c.balance.usageReservedCreditMicro||t[28]!==c.links.details||t[29]!==c.links.purchase||t[30]!==c.usage.chargedCreditMicro||t[31]!==c.usage.requests||t[32]!==c.usage.totalTokens||t[33]!==i.availableCredits||t[34]!==i.connected||t[35]!==i.details||t[36]!==i.expiring||t[37]!==i.granted||t[38]!==i.purchase||t[39]!==i.purchased||t[40]!==i.recentUsage||t[41]!==i.reserved||t[42]!==i.title||t[43]!==i.tokenUsage||t[44]!==i.usageSummary||t[45]!==i.zeroBalance||t[46]!==o){let e=new Intl.NumberFormat(o),a=i.usageSummary.replace(`{{credits}}`,g(c.usage.chargedCreditMicro)).replace(`{{requests}}`,e.format(c.usage.requests));C=`rounded-xl bg-surface-hover/40 p-4 sm:p-5`;let s;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,h.jsx)(n,{className:`size-4 text-accent-fg`,"aria-hidden":!0}),t[57]=s):s=t[57];let l;t[58]===i.title?l=t[59]:(l=(0,h.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i.title}),t[58]=i.title,t[59]=l);let d;t[60]===i.connected?d=t[61]:(d=(0,h.jsx)(`span`,{className:`rounded-full bg-emerald-500/10 px-2 py-0.5 text-xs font-medium text-emerald-700 dark:text-emerald-300`,children:i.connected}),t[60]=i.connected,t[61]=d);let f;t[62]!==l||t[63]!==d?(f=(0,h.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[s,l,d]}),t[62]=l,t[63]=d,t[64]=f):f=t[64];let p;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,h.jsx)(r,{className:`size-3.5`,"aria-hidden":!0}),t[65]=p):p=t[65];let m;t[66]!==c.links.purchase||t[67]!==i.purchase?(m=(0,h.jsx)(u,{asChild:!0,variant:`primary`,children:(0,h.jsxs)(`a`,{href:c.links.purchase,target:`_blank`,rel:`noreferrer`,children:[i.purchase,p]})}),t[66]=c.links.purchase,t[67]=i.purchase,t[68]=m):m=t[68];let _;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,h.jsx)(r,{className:`size-3.5`,"aria-hidden":!0}),t[69]=_):_=t[69];let v;t[70]!==c.links.details||t[71]!==i.details?(v=(0,h.jsx)(u,{asChild:!0,variant:`secondary`,children:(0,h.jsxs)(`a`,{href:c.links.details,target:`_blank`,rel:`noreferrer`,children:[i.details,_]})}),t[70]=c.links.details,t[71]=i.details,t[72]=v):v=t[72];let y;t[73]!==m||t[74]!==v?(y=(0,h.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[m,v]}),t[73]=m,t[74]=v,t[75]=y):y=t[75],t[76]!==f||t[77]!==y?(w=(0,h.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[f,y]}),t[76]=f,t[77]=y,t[78]=w):w=t[78],j=`mt-4 grid gap-4 rounded-lg bg-surface-base/45 p-3 sm:grid-cols-[minmax(12rem,0.7fr)_minmax(0,1.3fr)] sm:gap-6`;let b;t[79]===i.availableCredits?b=t[80]:(b=(0,h.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:i.availableCredits}),t[79]=i.availableCredits,t[80]=b);let x;t[81]===c.balance.availableCreditMicro?x=t[82]:(x=g(c.balance.availableCreditMicro),t[81]=c.balance.availableCreditMicro,t[82]=x);let S;t[83]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,h.jsx)(`span`,{className:`ml-2 text-sm font-medium text-fg-muted`,children:`Credits`}),t[83]=S):S=t[83];let N;t[84]===x?N=t[85]:(N=(0,h.jsxs)(`p`,{className:`mt-1 text-2xl font-semibold tracking-tight text-fg`,children:[x,S]}),t[84]=x,t[85]=N);let P;t[86]!==c.balance.availableCreditMicro||t[87]!==i.zeroBalance?(P=c.balance.availableCreditMicro===`0`?(0,h.jsx)(`p`,{className:`mt-1 text-sm font-medium text-danger`,children:i.zeroBalance}):null,t[86]=c.balance.availableCreditMicro,t[87]=i.zeroBalance,t[88]=P):P=t[88];let F=i.purchased,I;t[89]===c.balance.purchasedCreditMicro?I=t[90]:(I=g(c.balance.purchasedCreditMicro),t[89]=c.balance.purchasedCreditMicro,t[90]=I);let L;t[91]!==i.purchased||t[92]!==I?(L=(0,h.jsxs)(`div`,{children:[F,`: `,I,` Credits`]}),t[91]=i.purchased,t[92]=I,t[93]=L):L=t[93];let R=i.granted,z;t[94]===c.balance.grantedCreditMicro?z=t[95]:(z=g(c.balance.grantedCreditMicro),t[94]=c.balance.grantedCreditMicro,t[95]=z);let B;t[96]!==i.granted||t[97]!==z?(B=(0,h.jsxs)(`div`,{children:[R,`: `,z,` Credits`]}),t[96]=i.granted,t[97]=z,t[98]=B):B=t[98];let V=i.reserved,H=String(BigInt(c.balance.usageReservedCreditMicro)+BigInt(c.balance.refundReservedCreditMicro)),U;t[99]===H?U=t[100]:(U=g(H),t[99]=H,t[100]=U);let W;t[101]!==i.reserved||t[102]!==U?(W=(0,h.jsxs)(`div`,{children:[V,`: `,U,` Credits`]}),t[101]=i.reserved,t[102]=U,t[103]=W):W=t[103];let G;t[104]!==L||t[105]!==B||t[106]!==W?(G=(0,h.jsxs)(`div`,{className:`mt-2 space-y-1 text-xs text-fg-muted`,children:[L,B,W]}),t[104]=L,t[105]=B,t[106]=W,t[107]=G):G=t[107];let K;t[108]!==c.balance.expiring[0]||t[109]!==i.expiring||t[110]!==o?(K=c.balance.expiring[0]?(0,h.jsx)(`p`,{className:`mt-2 text-xs text-amber-600 dark:text-amber-400`,children:i.expiring.replace(`{{credits}}`,g(c.balance.expiring[0].creditMicro)).replace(`{{date}}`,new Date(c.balance.expiring[0].expiresAt).toLocaleDateString(o))}):null,t[108]=c.balance.expiring[0],t[109]=i.expiring,t[110]=o,t[111]=K):K=t[111],t[112]!==b||t[113]!==N||t[114]!==P||t[115]!==G||t[116]!==K?(M=(0,h.jsxs)(`div`,{children:[b,N,P,G,K]}),t[112]=b,t[113]=N,t[114]=P,t[115]=G,t[116]=K,t[117]=M):M=t[117],t[118]===i.recentUsage?k=t[119]:(k=(0,h.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:i.recentUsage}),t[118]=i.recentUsage,t[119]=k),A=(0,h.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-fg-muted`,children:a}),D=`mt-2 text-xs text-fg-subtle`,t[120]===i.tokenUsage?O=t[121]:(O=(0,h.jsx)(`summary`,{className:`cursor-pointer`,children:i.tokenUsage}),t[120]=i.tokenUsage,t[121]=O),T=`mt-1`,E=e.format(c.usage.totalTokens),t[22]=c.balance.availableCreditMicro,t[23]=c.balance.expiring[0],t[24]=c.balance.grantedCreditMicro,t[25]=c.balance.purchasedCreditMicro,t[26]=c.balance.refundReservedCreditMicro,t[27]=c.balance.usageReservedCreditMicro,t[28]=c.links.details,t[29]=c.links.purchase,t[30]=c.usage.chargedCreditMicro,t[31]=c.usage.requests,t[32]=c.usage.totalTokens,t[33]=i.availableCredits,t[34]=i.connected,t[35]=i.details,t[36]=i.expiring,t[37]=i.granted,t[38]=i.purchase,t[39]=i.purchased,t[40]=i.recentUsage,t[41]=i.reserved,t[42]=i.title,t[43]=i.tokenUsage,t[44]=i.usageSummary,t[45]=i.zeroBalance,t[46]=o,t[47]=C,t[48]=w,t[49]=T,t[50]=E,t[51]=D,t[52]=O,t[53]=k,t[54]=A,t[55]=j,t[56]=M}else C=t[47],w=t[48],T=t[49],E=t[50],D=t[51],O=t[52],k=t[53],A=t[54],j=t[55],M=t[56];let N;t[122]!==T||t[123]!==E?(N=(0,h.jsxs)(`p`,{className:T,children:[E,` tokens`]}),t[122]=T,t[123]=E,t[124]=N):N=t[124];let P;t[125]!==N||t[126]!==D||t[127]!==O?(P=(0,h.jsxs)(`details`,{className:D,children:[O,N]}),t[125]=N,t[126]=D,t[127]=O,t[128]=P):P=t[128];let F;t[129]!==c.balance.updatedAt||t[130]!==i.updatedAt||t[131]!==o?(F=i.updatedAt.replace(`{{time}}`,new Date(c.balance.updatedAt).toLocaleString(o)),t[129]=c.balance.updatedAt,t[130]=i.updatedAt,t[131]=o,t[132]=F):F=t[132];let I;t[133]===F?I=t[134]:(I=(0,h.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:F}),t[133]=F,t[134]=I);let L;t[135]!==P||t[136]!==I||t[137]!==k||t[138]!==A?(L=(0,h.jsxs)(`div`,{children:[k,A,P,I]}),t[135]=P,t[136]=I,t[137]=k,t[138]=A,t[139]=L):L=t[139];let R;t[140]!==L||t[141]!==j||t[142]!==M?(R=(0,h.jsxs)(`div`,{className:j,children:[M,L]}),t[140]=L,t[141]=j,t[142]=M,t[143]=R):R=t[143];let z;return t[144]!==C||t[145]!==w||t[146]!==R?(z=(0,h.jsxs)(`section`,{className:C,children:[w,R]}),t[144]=C,t[145]=w,t[146]=R,t[147]=z):z=t[147],z}function y(e){return e.language}export{v as t};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_AGENTS_FILENAME, stripFrontMatter } from "../context/workspace.js";
|
|
2
|
-
import { join, resolve } from "node:path";
|
|
3
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
-
//#region src/agent/bootstrap/project-agents-context.ts
|
|
5
|
-
const PROJECT_AGENTS_MAX_CHARS = 2e4;
|
|
6
|
-
function truncateProjectAgentsContent(content) {
|
|
7
|
-
if (content.length <= PROJECT_AGENTS_MAX_CHARS) return content;
|
|
8
|
-
const suffix = `\n\n[Project AGENTS.md truncated to ${PROJECT_AGENTS_MAX_CHARS} characters]`;
|
|
9
|
-
return `${content.slice(0, Math.max(0, PROJECT_AGENTS_MAX_CHARS - suffix.length)).trimEnd()}${suffix}`;
|
|
10
|
-
}
|
|
11
|
-
function loadProjectAgentsContextFile(workspaceDir) {
|
|
12
|
-
const agentsPath = resolve(join(workspaceDir, DEFAULT_AGENTS_FILENAME));
|
|
13
|
-
if (!existsSync(agentsPath)) return null;
|
|
14
|
-
try {
|
|
15
|
-
const content = truncateProjectAgentsContent(stripFrontMatter(readFileSync(agentsPath, "utf-8")).trim());
|
|
16
|
-
if (!content) return null;
|
|
17
|
-
return {
|
|
18
|
-
path: agentsPath,
|
|
19
|
-
content: [
|
|
20
|
-
"Workspace AGENTS.md contains project-local instructions. Follow it for this workspace's coding conventions, commands, tests, and repository-specific workflows. If it conflicts with higher-priority system instructions, tool safety, or the user's explicit request, follow the higher-priority instruction.",
|
|
21
|
-
"",
|
|
22
|
-
content
|
|
23
|
-
].join("\n")
|
|
24
|
-
};
|
|
25
|
-
} catch {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
//#endregion
|
|
30
|
-
export { loadProjectAgentsContextFile };
|