@xopcai/xopc 0.0.325 → 0.0.329
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/README.zh-CN.md +4 -3
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CxfXpPWs.js → agent-avatar-dicebear-Bs1qnnhD.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-DHJyAT7t.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-DLKj_iIh.js +1 -0
- package/dist/gateway/static/root/assets/agents-SXZ5O0g4.js +70 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-p7fZB4dT.js → app-management-settings-panel-BrIji9B5.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-C-clVcfp.js → appearance-settings-Uts-MQ7K.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DcclVdxW.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-Xm6xChUX.js → archive-plugin-_EzRfBuI.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-Di8kuG4L.js → attachment-load-CHg7_XFl.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-GUZgDhKj.js → automations-page-CGMErk_w.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-Cc4yqiF6.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-OCrDjC9O.js → binary-plugins-D3WB-tVn.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-m9tqvu7x.js → block-editor-Cm1W-14I.js} +53 -53
- package/dist/gateway/static/root/assets/box-DvYoGszj.js +1 -0
- package/dist/gateway/static/root/assets/braces-Cfmtagno.js +1 -0
- package/dist/gateway/static/root/assets/{browser-automation-inputs-DSWXq9lI.js → browser-automation-inputs-VnvK-GQP.js} +1 -1
- package/dist/gateway/static/root/assets/browser-automations-page-CZYCvSSU.js +3 -0
- package/dist/gateway/static/root/assets/browser-settings-page-DDz9PE6m.js +3 -0
- package/dist/gateway/static/root/assets/calendar-clock-D-quYVPe.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-DH3aDk53.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C8jMZAJl.js +8 -0
- package/dist/gateway/static/root/assets/capability-discover-page-CgGvsf3t.js +1 -0
- package/dist/gateway/static/root/assets/capability-header-actions-C3chJDQu.js +1 -0
- package/dist/gateway/static/root/assets/capability-icon-BYm2-nS-.js +1 -0
- package/dist/gateway/static/root/assets/channels-CuVS_KsY.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BfnVh8oo.js → chat-terminal-dock-ClbmjCL2.js} +2 -2
- package/dist/gateway/static/root/assets/chevron-left-DqFhpbvK.js +1 -0
- package/dist/gateway/static/root/assets/clock-3-DnrAnuyZ.js +1 -0
- package/dist/gateway/static/root/assets/computer-settings-page-BfZaf516.js +1 -0
- package/dist/gateway/static/root/assets/connector-service-page-F-fYNIx8.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-B4SLpvSL.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-DXQTsUJn.js +1 -0
- package/dist/gateway/static/root/assets/dependency-picker-B_z3zihW.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-BsIYCAkG.js → desktop-pet-C1TZzKS3.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-B5JGIfqn.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-DFYK_Ywf.js +1 -0
- package/dist/gateway/static/root/assets/directory-picker-path-field-BfxaNwMB.js +1 -0
- package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-Ct9pABNW.js → extension-debug-page-Bs8_FYCm.js} +1 -1
- package/dist/gateway/static/root/assets/extension-marketplace-api-DqV4YRYs.js +1 -0
- package/dist/gateway/static/root/assets/{extension-page-BktsR4hj.js → extension-page-DH5vFbBw.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BQJc-vXH.js → extension-settings-page-hGKovxxC.js} +1 -1
- package/dist/gateway/static/root/assets/external-link-DjqjBmc3.js +1 -0
- package/dist/gateway/static/root/assets/eye-CABVeTq0.js +1 -0
- package/dist/gateway/static/root/assets/folder-open-CyzJ19I9.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-CoQVulMd.js → gateway-config-swr-BYMrbKZE.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BIsiP-JI.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B5GJ-CQV.js → gateway-startup-retry-DMqYXHAn.js} +1 -1
- package/dist/gateway/static/root/assets/gauge-C78eD2BA.js +1 -0
- package/dist/gateway/static/root/assets/git-branch-Dh9uxTot.js +1 -0
- package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +1 -0
- package/dist/gateway/static/root/assets/home-page-CoBivEvx.js +1 -0
- package/dist/gateway/static/root/assets/image-Cwyalflz.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-DvWDkbk1.js → image-generation-api-D1sQGaJz.js} +1 -1
- package/dist/gateway/static/root/assets/imports-page-rssb4rjP.js +1 -0
- package/dist/gateway/static/root/assets/inbox-DNoSz682.js +1 -0
- package/dist/gateway/static/root/assets/index-C4QN4gCi.css +1 -0
- package/dist/gateway/static/root/assets/index-Cr4SINLG.js +121 -0
- package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-ctJLm8TP.js → keyboard-shortcuts-settings-CMitbles.js} +1 -1
- package/dist/gateway/static/root/assets/layout-grid-CEVZdVFU.js +1 -0
- package/dist/gateway/static/root/assets/link-2-D_ZKYUW7.js +1 -0
- package/dist/gateway/static/root/assets/list-BBGUdmkF.js +1 -0
- package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-Di82Oacm.js +1 -0
- package/dist/gateway/static/root/assets/local-apps-page-CCvA9d9L.js +1 -0
- package/dist/gateway/static/root/assets/{locale-store-BPZR8x9b.js → locale-store-BSkKhYkc.js} +1 -1
- package/dist/gateway/static/root/assets/lock-keyhole-DEK5kH0u.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-BK8ol1q0.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-CebXkEtB.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-Dft8ASFD.js → markdown-view-DXubGEic.js} +2 -2
- package/dist/gateway/static/root/assets/{media-plugins-ni5zJ4Ok.js → media-plugins-DLJrmU9J.js} +1 -1
- package/dist/gateway/static/root/assets/message-circle-Badhj-4D.js +1 -0
- package/dist/gateway/static/root/assets/message-square-fVE7Ghj1.js +1 -0
- package/dist/gateway/static/root/assets/message-square-plus-XP0tGdlV.js +1 -0
- package/dist/gateway/static/root/assets/messages-D0G_sZvA.js +3 -0
- package/dist/gateway/static/root/assets/minimize-2-DtOGrlpo.js +1 -0
- package/dist/gateway/static/root/assets/models-hub-cache-B0EUPwTv.js +1 -0
- package/dist/gateway/static/root/assets/network-BUQLY1BV.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-xsKDIJdK.js +5 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-1qg2v-9j.js +1 -0
- package/dist/gateway/static/root/assets/notes-page-BFm7XnWH.js +8 -0
- package/dist/gateway/static/root/assets/page-context-capture-button-C3JiQEKD.js +1 -0
- package/dist/gateway/static/root/assets/paperclip-f1HujQY1.js +1 -0
- package/dist/gateway/static/root/assets/pencil-DmIY3Oa-.js +1 -0
- package/dist/gateway/static/root/assets/power-ZI-pBczI.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-buk_gdip.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-DQctU8z3.js → product-open-page-DwEEO0Ak.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CRQGCRSU.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DcqylysA.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-DWWO6ajd.js → registry-api-tx8XCHOs.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Cq5MaiRW.js +1 -0
- package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-xhOSYfiX.js → runtime-tools-settings-panel-De7HmmBu.js} +2 -2
- package/dist/gateway/static/root/assets/scenes-page-GXJ-b3dO.js +2 -0
- package/dist/gateway/static/root/assets/{schema-form-z8IeSdBp.js → schema-form-DPMEuj5D.js} +1 -1
- package/dist/gateway/static/root/assets/search-DA7gz22f.js +1 -0
- package/dist/gateway/static/root/assets/server-BlHCBjiE.js +1 -0
- package/dist/gateway/static/root/assets/sessions-page-C6FwYIRA.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BEyQiZs0.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-DM0D-BQ_.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-Br9no5e4.js → settings-page-CWS9yOH3.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-layout-X1x-2Cp9.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-BhGKiTPf.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-CE0SER59.js → share-preview-page-CcRi2yGy.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DNmcCBfX.js +1 -0
- package/dist/gateway/static/root/assets/skill-api-BCAV_F1P.js +1 -0
- package/dist/gateway/static/root/assets/skill-card-icon-BrrpZ3Mw.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BEV2WXGk.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-C8zOGpKw.js +2 -0
- package/dist/gateway/static/root/assets/star-BUWJqJ5c.js +1 -0
- package/dist/gateway/static/root/assets/stethoscope-DRqTAtjD.js +1 -0
- package/dist/gateway/static/root/assets/store-SzD1Jvgm.js +1 -0
- package/dist/gateway/static/root/assets/system-settings-panel-C_lajq9u.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-Dk8Bmlhw.js +1 -0
- package/dist/gateway/static/root/assets/tunnel-api-CYvKiE_f.js +1 -0
- package/dist/gateway/static/root/assets/upload-rrb46c3c.js +1 -0
- package/dist/gateway/static/root/assets/use-autosave-ZTHe1zCM.js +1 -0
- package/dist/gateway/static/root/assets/user-model-page-C_SPNZbP.js +2 -0
- package/dist/gateway/static/root/assets/user-round-C9jxPhMR.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-By6Lgbse.js → voice-api-key-field-C8Kpkct-.js} +1 -1
- package/dist/gateway/static/root/assets/voice-config-api-BvzxINUk.js +1 -0
- package/dist/gateway/static/root/assets/wand-sparkles-DWuJz5ya.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DdhgIlyf.js → work-discovery-overlay-ClB6T-dm.js} +1 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-X0Cyh2AR.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-BrL6dzf0.js +6 -0
- package/dist/gateway/static/root/connector-icons/SOURCES.md +1 -0
- package/dist/gateway/static/root/connector-icons/wecom.svg +9 -0
- package/dist/gateway/static/root/index.html +26 -8
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-instance-gateway.d.ts +2 -2
- package/dist/src/agent/agent-manager.d.ts +4 -2
- package/dist/src/agent/agent-manager.js +58 -19
- package/dist/src/agent/background-review/coordinator.d.ts +2 -7
- package/dist/src/agent/background-review/coordinator.js +17 -34
- package/dist/src/agent/background-review/prompts.d.ts +13 -5
- package/dist/src/agent/background-review/prompts.js +17 -12
- package/dist/src/agent/background-review/run-background-review.d.ts +3 -3
- package/dist/src/agent/background-review/run-background-review.js +58 -43
- package/dist/src/agent/context/execution-context.js +5 -2
- package/dist/src/agent/mcp/index.js +1 -1
- package/dist/src/agent/mcp/mcp-transport.js +2 -2
- package/dist/src/agent/mcp/oauth/index.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +2 -2
- package/dist/src/agent/mcp/oauth/mcp-oauth-provider.js +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
- package/dist/src/agent/prompt/sections/tooling.js +3 -0
- package/dist/src/agent/service/direct-turn-helpers.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.d.ts +12 -0
- package/dist/src/agent/tools/user-context-tool.js +29 -4
- package/dist/src/automations/domain/types.d.ts +7 -1
- package/dist/src/automations/service/action-executor.d.ts +2 -2
- package/dist/src/automations/service/action-executor.js +36 -13
- package/dist/src/automations/service/automation-service.js +2 -1
- package/dist/src/browser/automations/index.js +2 -2
- package/dist/src/browser/automations/service.d.ts +11 -2
- package/dist/src/browser/automations/service.js +19 -5
- package/dist/src/capabilities/readiness/from-config.d.ts +0 -1
- package/dist/src/capabilities/readiness/from-config.js +2 -4
- package/dist/src/cli/commands/auth.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-agent-plugin.js +2 -1
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/commands/providers.js +1 -1
- package/dist/src/config/schema.js +4 -4
- package/dist/src/connectors/china-catalog.js +5 -1
- package/dist/src/connectors/connected-source-ingestion.js +6 -1
- package/dist/src/connectors/connected-source-observations.d.ts +10 -0
- package/dist/src/connectors/connected-source-observations.js +80 -0
- package/dist/src/connectors/connected-source-understanding.js +198 -8
- package/dist/src/connectors/learning-coordinator.js +63 -26
- package/dist/src/connectors/learning-recipes.js +19 -2
- package/dist/src/discussions/audio-repair.d.ts +1 -1
- package/dist/src/discussions/live-worker.js +1 -3
- package/dist/src/discussions/recording.js +2 -2
- package/dist/src/discussions/sealer.js +2 -2
- package/dist/src/extensions/agent-plugins/auth.d.ts +2 -2
- package/dist/src/extensions/agent-plugins/auth.js +6 -35
- package/dist/src/extensions/agent-plugins/credentials.d.ts +2 -0
- package/dist/src/extensions/agent-plugins/credentials.js +37 -0
- package/dist/src/extensions/agent-plugins/plugin-oauth-scope.d.ts +1 -0
- package/dist/src/extensions/agent-plugins/plugin-oauth-scope.js +8 -0
- package/dist/src/extensions/marketplace.d.ts +4 -0
- package/dist/src/extensions/marketplace.js +4 -0
- package/dist/src/gateway/file-space-service.d.ts +9 -2
- package/dist/src/gateway/hono/routes/agent-plugins.js +2 -1
- package/dist/src/gateway/hono/routes/config.js +0 -3
- package/dist/src/gateway/hono/routes/connectors.js +3 -10
- package/dist/src/gateway/hono/routes/context-sources.d.ts +0 -1
- package/dist/src/gateway/hono/routes/context-sources.js +12 -15
- package/dist/src/gateway/hono/routes/status.js +0 -1
- package/dist/src/gateway/hono/routes/user-model.js +21 -3
- package/dist/src/gateway/hono/routes/voice.js +0 -67
- package/dist/src/gateway/service.js +6 -4
- package/dist/src/media-understanding/types.d.ts +1 -1
- package/dist/src/memory-maintenance/service.d.ts +1 -0
- package/dist/src/memory-maintenance/service.js +13 -0
- package/dist/src/migrations/retired-local-stt.d.ts +2 -0
- package/dist/src/migrations/retired-local-stt.js +52 -0
- package/dist/src/migrations/runner.js +2 -1
- package/dist/src/session/turn-outcome-projector.js +1 -1
- package/dist/src/storage/sqlite/connection.js +1 -0
- package/dist/src/storage/sqlite/migrations/207_user_model_policy_contract.sql +121 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/sql-assets.d.ts +1 -0
- package/dist/src/storage/sqlite/sql-assets.js +7 -4
- package/dist/src/tasks/index.js +2 -2
- package/dist/src/tasks/task-application-service.d.ts +1 -0
- package/dist/src/tasks/task-application-service.js +4 -2
- package/dist/src/tasks/task-context-assembler.js +10 -1
- package/dist/src/tasks/task-run-dispatcher.d.ts +1 -0
- package/dist/src/tasks/task-run-dispatcher.js +15 -2
- package/dist/src/user-context/sources/consent-repository.d.ts +7 -0
- package/dist/src/user-context/sources/consent-repository.js +81 -0
- package/dist/src/user-context/sources/index.d.ts +1 -0
- package/dist/src/user-context/sources/index.js +2 -1
- package/dist/src/user-context/sources/repository.js +73 -1
- package/dist/src/user-context/sources/types.d.ts +16 -0
- package/dist/src/user-model/action-rule-suggestions.d.ts +11 -0
- package/dist/src/user-model/action-rule-suggestions.js +29 -0
- package/dist/src/user-model/bootstrap.js +1 -1
- package/dist/src/user-model/capture/executor.js +83 -7
- package/dist/src/user-model/capture/semantic.d.ts +5 -2
- package/dist/src/user-model/capture/semantic.js +27 -11
- package/dist/src/user-model/domain.d.ts +26 -0
- package/dist/src/user-model/domain.js +40 -2
- package/dist/src/user-model/index.d.ts +2 -0
- package/dist/src/user-model/index.js +6 -4
- package/dist/src/user-model/maintenance-policy.d.ts +1 -0
- package/dist/src/user-model/maintenance-policy.js +13 -0
- package/dist/src/user-model/observation-repository.d.ts +48 -0
- package/dist/src/user-model/observation-repository.js +100 -0
- package/dist/src/user-model/repository.d.ts +5 -0
- package/dist/src/user-model/repository.js +121 -10
- package/dist/src/user-model/usage-policy.d.ts +5 -2
- package/dist/src/user-model/usage-policy.js +2 -2
- package/dist/src/voice/audio/normalize.d.ts +1 -1
- package/dist/src/voice/audio/normalize.js +1 -1
- package/dist/src/voice/{local → audio}/wav.js +1 -1
- package/dist/src/voice/language-profile.js +10 -16
- package/dist/src/voice/metadata/builtin.js +0 -46
- package/dist/src/voice/stt/providers/index.d.ts +0 -1
- package/dist/src/voice/stt/providers/index.js +1 -2
- package/dist/src/voice/stt/types.js +3 -4
- package/dist/src/voice/tts/merge-config.js +1 -1
- package/dist/src/voice/tts/speech-registry.d.ts +1 -1
- package/dist/src/voice/tts/types.d.ts +1 -1
- package/dist/src/work-discovery/analyzer.js +6 -5
- package/dist/src/work-discovery/service.js +2 -2
- package/dist/src/work-discovery/types.d.ts +1 -1
- package/dist/src/workflows/context/workflow-context.js +5 -1
- package/dist/src/workflows/index.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.d.ts +1 -0
- package/dist/src/workflows/service/workflow-run-service.js +13 -4
- package/package.json +13 -17
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CDHe8gJf.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-DMv-udoZ.js +0 -1
- package/dist/gateway/static/root/assets/agents-D_xOAXgj.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-Dz2g7eAN.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-BUZhG9aJ.js +0 -7
- package/dist/gateway/static/root/assets/browser-automations-page-DuOaridE.js +0 -3
- package/dist/gateway/static/root/assets/browser-settings-page-D2_PgHep.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-7Y_pJqyt.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-B-Igy1ro.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-aRG2lU4w.js +0 -1
- package/dist/gateway/static/root/assets/connector-service-page-B5EhnfJH.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-7HfRt1LW.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-CtDyij_x.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-z6ouWxmz.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-z-0aQ5ct.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-DlmhQvY5.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-BfDVlvy6.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CI_eQTPL.js +0 -1
- package/dist/gateway/static/root/assets/imports-page-DFpQfHVU.js +0 -1
- package/dist/gateway/static/root/assets/index-19rMUT3d.js +0 -121
- package/dist/gateway/static/root/assets/index-BKL5tg2f.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-C9kaP3Dy.js +0 -1
- package/dist/gateway/static/root/assets/local-apps-page-BxC_LTqq.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-Ok5SpG-G.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-aOzRaQHM.js +0 -1
- package/dist/gateway/static/root/assets/messages-kFWhF6_t.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-C9OEltN9.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-Dj9rMgdi.js +0 -8
- package/dist/gateway/static/root/assets/page-context-capture-button-BJA3d8vU.js +0 -1
- package/dist/gateway/static/root/assets/page-tabs-Dyc3wKkl.js +0 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-tIOIQbNX.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-Dy-EwZcc.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-JaGKa6rM.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Cb8-nd60.js +0 -1
- package/dist/gateway/static/root/assets/scenes-page-ClBkFdRY.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-BYW5l_nY.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CDNwmXuH.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-BXTJAser.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-layout-D6745w0p.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-D2N9764S.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Dk3_QOKQ.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CPt61fEv.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-Db6PB2C6.js +0 -2
- package/dist/gateway/static/root/assets/skills-page.utils-DrtW5FBy.js +0 -1
- package/dist/gateway/static/root/assets/system-settings-panel-CuY1Zh5s.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-o7RiDUMi.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-PGHDgvWb.js +0 -1
- package/dist/gateway/static/root/assets/use-autosave-B55oBQUt.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-DspelwAa.js +0 -2
- package/dist/gateway/static/root/assets/voice-config-api-BaxITrwZ.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-BOJYQaxX.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-6ObD0IQZ.js +0 -6
- package/dist/src/voice/local/model-files.d.ts +0 -14
- package/dist/src/voice/local/model-files.js +0 -92
- package/dist/src/voice/local/model-manager.d.ts +0 -18
- package/dist/src/voice/local/model-manager.js +0 -133
- package/dist/src/voice/local/models.d.ts +0 -28
- package/dist/src/voice/local/models.js +0 -99
- package/dist/src/voice/local/provider-switch.d.ts +0 -4
- package/dist/src/voice/local/provider-switch.js +0 -36
- package/dist/src/voice/local/runtime-client.d.ts +0 -28
- package/dist/src/voice/local/runtime-client.js +0 -183
- package/dist/src/voice/local/runtime-worker.d.ts +0 -1
- package/dist/src/voice/local/runtime-worker.js +0 -271
- package/dist/src/voice/stt/providers/local-transcription.d.ts +0 -2
- package/dist/src/voice/stt/providers/local-transcription.js +0 -53
- /package/dist/src/voice/{local → audio}/wav.d.ts +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,r as t}from"./locale-store-BPZR8x9b.js";import{n}from"./gateway-config-swr-CoQVulMd.js";var r=`xopc-local-voice-model-install-started`;async function i(){return(await e(t(`/api/voice/realtime/status`))).payload}async function a(n){let r=await e(t(`/api/voice/realtime/preview`),{method:`POST`,signal:n});if(r.payload.sampleRate!==24e3)throw Error(`Unsupported preview sample rate`);return Uint8Array.from(atob(r.payload.audio),e=>e.charCodeAt(0)).buffer}async function o(n,r,i){let a=new URLSearchParams({provider:n,model:r});return i&&a.set(`purpose`,i),(await e(t(`/api/voice/tts-voices?${a.toString()}`))).payload?.voices??[]}function s(){return{enabled:!0,provider:`xopc-local`,providers:{"xopc-local":{model:`sensevoice-small`},alibaba:{model:`qwen-audio-3.0-asr-flash`},openai:{model:`gpt-4o-mini-transcribe`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function c(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,providers:{alibaba:{model:`qwen-tts`,voice:`Cherry`},openai:{model:`tts-1`,voice:`alloy`},edge:{voice:`zh-CN-XiaoxiaoNeural`,lang:`zh-CN`},minimax:{model:`speech-2.8-hd`,voice:`male-qn-qingse`}}}}function l(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function u(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function d(e){let t=s();if(!l(e))return t;let n=u(e.provider),r=t.fallback??{enabled:!1,order:[`xopc-local`]};if(l(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):r.order;r={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:r.enabled,order:t.length?t:r.order}}let i={...t.providers??{},...l(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,l(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,providers:i,fallback:r}}function f(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function p(e){let t=c();if(!l(e))return t;let n=f(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i={...t.providers??{},...l(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,l(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,trigger:r,maxTextLength:typeof e.maxTextLength==`number`&&Number.isFinite(e.maxTextLength)?e.maxTextLength:t.maxTextLength,timeoutMs:typeof e.timeoutMs==`number`&&Number.isFinite(e.timeoutMs)?e.timeoutMs:t.timeoutMs,providers:i}}function m(e){return{...e}}function h(e){return{...e}}function g(e){let t=l(e)?e:{},n=l(t.voice)?t.voice:{},r=l(n.input)?n.input:{},i=l(r.refinement)?r.refinement:{},a=l(n.realtime)?n.realtime:{},o=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:d(t.stt),tts:p(t.tts),voice:{languageMode:n.languageMode===`manual`?`manual`:`auto`,language:n.language===`zh`?`zh`:`en`,input:{refinement:{mode:o,...typeof i.model==`string`&&i.model.trim()?{model:i.model.trim()}:{},...typeof i.customInstruction==`string`?{customInstruction:i.customInstruction}:{}}},realtime:{enabled:a.enabled===!0,defaultEngine:a.defaultEngine===`omni`?`omni`:`agent`,silenceDurationMs:typeof a.silenceDurationMs==`number`?a.silenceDurationMs:1200,idleTimeoutMs:typeof a.idleTimeoutMs==`number`?a.idleTimeoutMs:6e4,maxDictationMs:typeof a.maxDictationMs==`number`?a.maxDictationMs:6e5,maxConversationMs:typeof a.maxConversationMs==`number`?a.maxConversationMs:36e5,bargeIn:a.bargeIn!==!1,...l(a.stt)&&a.stt.provider===`xopc-cloud`&&typeof a.stt.model==`string`?{stt:{provider:`xopc-cloud`,model:a.stt.model}}:{},...l(a.tts)&&(a.tts.provider===`alibaba`||a.tts.provider===`xopc-cloud`)?{tts:{provider:a.tts.provider,...typeof a.tts.model==`string`?{model:a.tts.model}:{},...typeof a.tts.voice==`string`?{voice:a.tts.voice}:{}}}:{},...l(a.omni)?{omni:{...a.omni}}:{}}}}}async function _(){return g((await e(t(`/api/config`))).payload?.config??{})}async function v(r){await e(t(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:m(r.stt),tts:h(r.tts),voice:r.voice})}),r.voice.languageMode===`auto`&&await e(t(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:r.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),n()}async function y(){let n=await e(t(`/api/voice/models`));if(!n.payload?.models)throw Error(`Missing voice models payload`);return n.payload.models}async function b(){let n=await e(t(`/api/voice/providers`));if(!n.payload?.providers)throw Error(`Missing voice providers payload`);return n.payload}async function x(){let n=await e(t(`/api/voice/stt-providers`));if(!n.payload?.providers)throw Error(`Missing STT providers payload`);return n.payload}async function S(){let n=await e(t(`/api/voice/local/status`));if(!n.payload)throw Error(`Missing local voice status payload`);return n.payload}async function C(n){await e(t(`/api/voice/local/models/${encodeURIComponent(n)}/install`),{method:`POST`,body:`{}`})}async function w(n){await e(t(`/api/voice/local/models/${encodeURIComponent(n)}`),{method:`DELETE`})}async function T(n,r){let i=await e(t(`/api/voice/tts-test`),{method:`POST`,signal:r,body:JSON.stringify(n)});if(i.ok===!1){let e=typeof i.error==`string`?i.error:i.error?.message;throw Error(e||`TTS test failed`)}if(!i.payload||typeof i.payload.audio!=`string`||!i.payload.audio.trim())throw Error(`TTS test returned no audio. Check the selected voice engine and try again.`);return i.payload}async function E(n){let r=await e(t(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(n)});if(!r.payload)throw Error(`Missing reveal payload`);return r.payload}export{y as a,x as c,v as d,a as f,T as h,o as i,C as l,E as m,S as n,b as o,w as p,i as r,_ as s,r as t,g as u};
|
|
@@ -1,3 +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{n as i,r as a}from"./popover-select-DcsFzD_i.js";import{t as o}from"./markdown-view-Dft8ASFD.js";import{t as s}from"./x-B_N4OPjy.js";import{t as c}from"./cn-JdwAhgNB.js";import{i as l,r as u}from"./locale-store-BPZR8x9b.js";import{t as d}from"./messages-kFWhF6_t.js";import{a as f,n as p,o as m,r as h,s as g,t as _}from"./dist-BGTk37IG.js";import{t as v}from"./button-CS04eWY9.js";import{Fc as y,Gc as b,Ir as x,Pu as S,Uc as C,Vr as w,Xr as T,ai as E,ld as D,oi as O,qc as k,ru as A,sl as j,wc as M}from"./index-19rMUT3d.js";var N=e(t(),1),P=n();function F(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function I(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function L(e,t={}){let n=F(e.split(`
|
|
2
|
-
`).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
|
|
3
|
-
`));if(!n)return null;if(n.type===`text_delta`&&typeof n.delta==`string`)return t.onDelta?.(n.delta),null;if(n.type===`thinking_delta`&&typeof n.delta==`string`)return t.onThinkingDelta?.(n.delta),null;if(n.type===`done`&&typeof n.text==`string`)return n.text;if(n.type===`error`)throw Error(I(n));return null}async function R(e,t={}){let n=await l(u(`/api/ai/text-assist`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message;throw Error(t||`AI suggestion failed (${n.status})`)}if(!n.body){let e=await n.json().catch(()=>null);if(e?.text)return e;throw Error(`AI suggestion stream is empty`)}let r=n.body.getReader(),i=new TextDecoder,a=``,o=``,s=``;for(;;){let{done:e,value:n}=await r.read();if(n){a+=i.decode(n,{stream:!e});let r=a.split(/\r?\n\r?\n/);a=r.pop()??``;for(let e of r){let n=L(e,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});n!==null&&(o=n)}}if(e)break}if(a.trim()){let e=L(a,{onDelta:e=>{o+=e,t.onDelta?.(e)},onThinkingDelta:e=>{s+=e,t.onThinkingDelta?.(e)}});e!==null&&(o=e)}let c=o.trim();if(!c)throw Error(`AI returned an empty suggestion`);return{text:c,thinking:s.trim()||void 0}}function ee(){let[e,t]=(0,N.useState)(``),[n,r]=(0,N.useState)(``),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,N.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await R(e,{onDelta:e=>{t(t=>t+e)},onThinkingDelta:e=>{r(t=>t+e)}});return t(n.text),r(n.thinking??``),n.text}catch(e){return s(e instanceof Error?e.message:`AI suggestion failed`),null}finally{a(!1)}},[]),reset:(0,N.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var z=r(),te=5;function ne(e){return e.startsWith(`zh`)?{title:`AI 优化文案`,buttonTitle:`优化文案`,current:`当前内容`,suggestion:`AI 建议`,editedSuggestion:`审核并编辑建议`,thinking:`模型思考`,thinkingLoading:`思考中`,edit:`编辑`,preview:`预览`,loading:`正在生成建议...`,empty:`暂无内容`,generate:`生成建议`,regenerate:`重新生成`,applyCurrent:`应用当前内容`,replace:`替换`,append:`追加`,cancel:`取消`,close:`关闭`}:{title:`AI text assist`,buttonTitle:`Improve text`,current:`Current`,suggestion:`Suggestion`,editedSuggestion:`Review and edit suggestion`,thinking:`Model thinking`,thinkingLoading:`Thinking`,edit:`Edit`,preview:`Preview`,loading:`Generating suggestion...`,empty:`No content`,generate:`Generate suggestion`,regenerate:`Regenerate`,applyCurrent:`Apply current`,replace:`Replace`,append:`Append`,cancel:`Cancel`,close:`Close`}}function B(e){let t=(0,P.c)(239),{value:n,onApply:r,fieldId:i,fieldLabel:a,scenario:l,format:u,intent:d,locale:y,context:x,disabled:w,className:T,showLabel:E}=e,O=l===void 0?`generic.text`:l,k=u===void 0?`plain`:u,A=d===void 0?`improve`:d,M=E===void 0?!0:E,[F,I]=(0,N.useState)(!1),[L,R]=(0,N.useState)(n),[B,V]=(0,N.useState)(`preview`),[H,U]=(0,N.useState)(``),[W,ae]=(0,N.useState)(`edit`),[G,K]=(0,N.useState)(!0),[oe,se]=(0,N.useState)(!1),[ce,q]=(0,N.useState)(null),le=(0,N.useRef)(null),ue=(0,N.useRef)(!0),{suggestion:de,thinking:J,loading:Y,error:X,generate:fe,reset:pe}=ee(),me;t[0]===y?me=t[1]:(me=ne(y),t[0]=y,t[1]=me);let Z=me,he;t[2]!==Y||t[3]!==J?(he=Y&&J.trim().length>0,t[2]=Y,t[3]=J,t[4]=he):he=t[4];let Q=he,ge,_e;t[5]!==F||t[6]!==n?(ge=()=>{F||R(n)},_e=[F,n],t[5]=F,t[6]=n,t[7]=ge,t[8]=_e):(ge=t[7],_e=t[8]),(0,N.useEffect)(ge,_e);let ve,ye;t[9]===de?(ve=t[10],ye=t[11]):(ye=()=>{U(de)},ve=[de],t[9]=de,t[10]=ve,t[11]=ye),(0,N.useEffect)(ye,ve);let be,xe;t[12]===J?(be=t[13],xe=t[14]):(be=()=>{J.trim()&&K(!0)},xe=[J],t[12]=J,t[13]=be,t[14]=xe),(0,N.useEffect)(be,xe);let Se;t[15]!==Q||t[16]!==G?(Se=()=>{let e=le.current;!e||!Q||!G||ue.current&&(e.scrollTop=e.scrollHeight)},t[15]=Q,t[16]=G,t[17]=Se):Se=t[17];let Ce;t[18]!==Q||t[19]!==J||t[20]!==G?(Ce=[Q,J,G],t[18]=Q,t[19]=J,t[20]=G,t[21]=Ce):Ce=t[21],(0,N.useLayoutEffect)(Se,Ce);let we;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(we=()=>{let e=le.current;e&&(ue.current=e.scrollHeight-e.scrollTop-e.clientHeight<=te)},t[22]=we):we=t[22];let Te=we,Ee;t[23]!==x||t[24]!==i||t[25]!==a||t[26]!==k||t[27]!==fe||t[28]!==A||t[29]!==y||t[30]!==O?(Ee=async e=>{ae(`edit`),K(!0),ue.current=!0,await fe({intent:A,scenario:O,input:e,locale:y,field:{id:i,label:a,format:k},context:x})},t[23]=x,t[24]=i,t[25]=a,t[26]=k,t[27]=fe,t[28]=A,t[29]=y,t[30]=O,t[31]=Ee):Ee=t[31];let De=Ee,Oe;t[32]!==pe||t[33]!==n?(Oe=e=>{se(!!e.currentTarget.closest(`[role="dialog"]`)),q(document.querySelector(`.app-main-surface`)),R(n),V(`preview`),U(``),ae(`edit`),K(!0),pe(),I(!0)},t[32]=pe,t[33]=n,t[34]=Oe):Oe=t[34];let ke=Oe,Ae;t[35]!==L||t[36]!==De?(Ae=async()=>{await De(L)},t[35]=L,t[36]=De,t[37]=Ae):Ae=t[37];let je=Ae,Me;t[38]!==pe||t[39]!==n?(Me=()=>{I(!1),R(n),V(`preview`),U(``),ae(`edit`),K(!0),pe()},t[38]=pe,t[39]=n,t[40]=Me):Me=t[40];let $=Me,Ne;t[41]!==$||t[42]!==L||t[43]!==r?(Ne=()=>{r(L),$()},t[41]=$,t[42]=L,t[43]=r,t[44]=Ne):Ne=t[44];let Pe=Ne,Fe;t[45]!==$||t[46]!==H||t[47]!==r?(Fe=()=>{H.trim()&&(r(H),$())},t[45]=$,t[46]=H,t[47]=r,t[48]=Fe):Fe=t[48];let Ie=Fe,Le;t[49]!==$||t[50]!==L||t[51]!==H||t[52]!==r?(Le=()=>{if(!H.trim())return;let e=L.trimEnd();r(e?`${e}\n\n${H}`:H),$()},t[49]=$,t[50]=L,t[51]=H,t[52]=r,t[53]=Le):Le=t[53];let Re=Le,ze;t[54]!==H||t[55]!==X||t[56]!==Y?(ze=!Y&&!X&&H.trim().length>0,t[54]=H,t[55]=X,t[56]=Y,t[57]=ze):ze=t[57];let Be=ze,Ve=L!==n,He;t[58]!==H||t[59]!==X||t[60]!==J?(He=H.trim().length>0||J.trim().length>0||!!X,t[58]=H,t[59]=X,t[60]=J,t[61]=He):He=t[61];let Ue=He,We=!M&&`size-7 p-0`,Ge;t[62]!==T||t[63]!==We?(Ge=c(`h-7 gap-1 px-2 text-xs`,We,T),t[62]=T,t[63]=We,t[64]=Ge):Ge=t[64];let Ke=w||Y,qe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,z.jsx)(b,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=qe):qe=t[65];let Je=M?Z.buttonTitle:null,Ye;t[66]!==Z.buttonTitle||t[67]!==ke||t[68]!==Ge||t[69]!==Ke||t[70]!==Je?(Ye=(0,z.jsxs)(v,{type:`button`,variant:`ghost`,className:Ge,title:Z.buttonTitle,"aria-label":Z.buttonTitle,disabled:Ke,onClick:ke,children:[qe,Je]}),t[66]=Z.buttonTitle,t[67]=ke,t[68]=Ge,t[69]=Ke,t[70]=Je,t[71]=Ye):Ye=t[71];let Xe;t[72]===$?Xe=t[73]:(Xe=e=>e?I(!0):$(),t[72]=$,t[73]=Xe);let Ze=ce??void 0,Qe=oe?`bg-transparent`:`bg-scrim`,$e;t[74]===Qe?$e=t[75]:($e=c(`xopc-dialog-overlay absolute inset-0 z-[80]`,Qe),t[74]=Qe,t[75]=$e);let et;t[76]===$e?et=t[77]:(et=(0,z.jsx)(f,{className:$e}),t[76]=$e,t[77]=et);let tt;t[78]===Z.title?tt=t[79]:(tt=(0,z.jsx)(g,{className:`text-base font-semibold text-fg`,children:Z.title}),t[78]=Z.title,t[79]=tt);let nt;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(nt=(0,z.jsx)(s,{className:`size-5`,strokeWidth:1.75}),t[80]=nt):nt=t[80];let rt;t[81]===Z.close?rt=t[82]:(rt=(0,z.jsx)(p,{asChild:!0,children:(0,z.jsx)(v,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":Z.close,children:nt})}),t[81]=Z.close,t[82]=rt);let it;t[83]!==tt||t[84]!==rt?(it=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[tt,rt]}),t[83]=tt,t[84]=rt,t[85]=it):it=t[85];let at;t[86]===Z.current?at=t[87]:(at=(0,z.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:Z.current}),t[86]=Z.current,t[87]=at);let ot=B===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,st;t[88]===ot?st=t[89]:(st=c(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,ot),t[88]=ot,t[89]=st);let ct,lt;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(ct=()=>V(`edit`),lt=(0,z.jsx)(C,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[90]=ct,t[91]=lt):(ct=t[90],lt=t[91]);let ut;t[92]!==Z.edit||t[93]!==st?(ut=(0,z.jsxs)(`button`,{type:`button`,className:st,onClick:ct,children:[lt,Z.edit]}),t[92]=Z.edit,t[93]=st,t[94]=ut):ut=t[94];let dt=B===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,ft;t[95]===dt?ft=t[96]:(ft=c(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,dt),t[95]=dt,t[96]=ft);let pt,mt;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(pt=()=>V(`preview`),mt=(0,z.jsx)(S,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[97]=pt,t[98]=mt):(pt=t[97],mt=t[98]);let ht;t[99]!==Z.preview||t[100]!==ft?(ht=(0,z.jsxs)(`button`,{type:`button`,className:ft,onClick:pt,children:[mt,Z.preview]}),t[99]=Z.preview,t[100]=ft,t[101]=ht):ht=t[101];let gt;t[102]!==ut||t[103]!==ht?(gt=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-inset p-0.5`,children:[ut,ht]}),t[102]=ut,t[103]=ht,t[104]=gt):gt=t[104];let _t;t[105]!==at||t[106]!==gt?(_t=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[at,gt]}),t[105]=at,t[106]=gt,t[107]=_t):_t=t[107];let vt;t[108]!==L||t[109]!==B||t[110]!==k||t[111]!==Z.current||t[112]!==Z.empty?(vt=B===`preview`?(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:k===`markdown`?(0,z.jsx)(o,{content:L||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:L||Z.empty})}):(0,z.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25`,value:L,onChange:e=>R(e.currentTarget.value),placeholder:Z.empty,"aria-label":Z.current}),t[108]=L,t[109]=B,t[110]=k,t[111]=Z.current,t[112]=Z.empty,t[113]=vt):vt=t[113];let yt;t[114]!==_t||t[115]!==vt?(yt=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[_t,vt]}),t[114]=_t,t[115]=vt,t[116]=yt):yt=t[116];let bt;t[117]===Z.editedSuggestion?bt=t[118]:(bt=(0,z.jsx)(`span`,{children:Z.editedSuggestion}),t[117]=Z.editedSuggestion,t[118]=bt);let xt;t[119]!==Z.loading||t[120]!==Y?(xt=Y?(0,z.jsx)(`span`,{className:`ml-2 font-normal`,children:Z.loading}):null,t[119]=Z.loading,t[120]=Y,t[121]=xt):xt=t[121];let St;t[122]!==bt||t[123]!==xt?(St=(0,z.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[bt,xt]}),t[122]=bt,t[123]=xt,t[124]=St):St=t[124];let Ct=W===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,wt;t[125]===Ct?wt=t[126]:(wt=c(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ct),t[125]=Ct,t[126]=wt);let Tt,Et;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=()=>ae(`edit`),Et=(0,z.jsx)(C,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[127]=Tt,t[128]=Et):(Tt=t[127],Et=t[128]);let Dt;t[129]!==Z.edit||t[130]!==wt?(Dt=(0,z.jsxs)(`button`,{type:`button`,className:wt,onClick:Tt,children:[Et,Z.edit]}),t[129]=Z.edit,t[130]=wt,t[131]=Dt):Dt=t[131];let Ot=W===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,kt;t[132]===Ot?kt=t[133]:(kt=c(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,Ot),t[132]=Ot,t[133]=kt);let At,jt;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(At=()=>ae(`preview`),jt=(0,z.jsx)(S,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[134]=At,t[135]=jt):(At=t[134],jt=t[135]);let Mt;t[136]!==Z.preview||t[137]!==kt?(Mt=(0,z.jsxs)(`button`,{type:`button`,className:kt,onClick:At,children:[jt,Z.preview]}),t[136]=Z.preview,t[137]=kt,t[138]=Mt):Mt=t[138];let Nt;t[139]!==Dt||t[140]!==Mt?(Nt=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-inset p-0.5`,children:[Dt,Mt]}),t[139]=Dt,t[140]=Mt,t[141]=Nt):Nt=t[141];let Pt;t[142]!==St||t[143]!==Nt?(Pt=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[St,Nt]}),t[142]=St,t[143]=Nt,t[144]=Pt):Pt=t[144];let Ft=Q?`opacity-100`:`pointer-events-none opacity-0`,It;t[145]===Ft?It=t[146]:(It=c(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ft),t[145]=Ft,t[146]=It);let Lt=!Q,Rt;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=()=>K(re),t[147]=Rt):Rt=t[147];let zt;t[148]!==Z.thinkingLoading||t[149]!==Y?(zt=Y?(0,z.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,Z.thinkingLoading]}):null,t[148]=Z.thinkingLoading,t[149]=Y,t[150]=zt):zt=t[150];let Bt;t[151]!==Z.thinking||t[152]!==zt?(Bt=(0,z.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Z.thinking,zt]}),t[151]=Z.thinking,t[152]=zt,t[153]=Bt):Bt=t[153];let Vt=G&&`rotate-180`,Ht;t[154]===Vt?Ht=t[155]:(Ht=c(`size-3.5 shrink-0 transition-transform`,Vt),t[154]=Vt,t[155]=Ht);let Ut;t[156]===Ht?Ut=t[157]:(Ut=(0,z.jsx)(D,{className:Ht,strokeWidth:1.75,"aria-hidden":!0}),t[156]=Ht,t[157]=Ut);let Wt;t[158]!==Bt||t[159]!==Ut?(Wt=(0,z.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center justify-between gap-2 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:text-fg`,onClick:Rt,children:[Bt,Ut]}),t[158]=Bt,t[159]=Ut,t[160]=Wt):Wt=t[160];let Gt;t[161]!==J||t[162]!==G?(Gt=G?(0,z.jsx)(`pre`,{ref:le,className:`min-h-0 flex-1 overflow-auto border-t border-edge px-2.5 py-2 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,onScroll:Te,children:J}):null,t[161]=J,t[162]=G,t[163]=Gt):Gt=t[163];let Kt;t[164]!==Wt||t[165]!==Gt?(Kt=(0,z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-inset/70`,children:[Wt,Gt]}),t[164]=Wt,t[165]=Gt,t[166]=Kt):Kt=t[166];let qt;t[167]!==It||t[168]!==Lt||t[169]!==Kt?(qt=(0,z.jsx)(`div`,{className:It,"aria-hidden":Lt,children:Kt}),t[167]=It,t[168]=Lt,t[169]=Kt,t[170]=qt):qt=t[170];let Jt=Q?`pointer-events-none opacity-0`:`opacity-100`,Yt;t[171]===Jt?Yt=t[172]:(Yt=c(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Jt),t[171]=Jt,t[172]=Yt);let Xt;t[173]!==H||t[174]!==X||t[175]!==k||t[176]!==Z.empty||t[177]!==Z.loading||t[178]!==Z.suggestion||t[179]!==Y||t[180]!==W?(Xt=X?(0,z.jsx)(`pre`,{className:`h-full min-h-0 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg-muted`,children:X}):W===`preview`?(0,z.jsx)(`div`,{className:`h-full min-h-0 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:Y&&!H.trim()?(0,z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Z.loading}):k===`markdown`?(0,z.jsx)(o,{content:H||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:H||Z.empty})}):(0,z.jsx)(`textarea`,{className:`h-full min-h-0 w-full resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25 disabled:text-fg-muted`,value:H,onChange:e=>U(e.currentTarget.value),disabled:Y,placeholder:Y?Z.loading:Z.empty,"aria-label":Z.suggestion}),t[173]=H,t[174]=X,t[175]=k,t[176]=Z.empty,t[177]=Z.loading,t[178]=Z.suggestion,t[179]=Y,t[180]=W,t[181]=Xt):Xt=t[181];let Zt;t[182]!==Yt||t[183]!==Xt?(Zt=(0,z.jsx)(`div`,{className:Yt,children:Xt}),t[182]=Yt,t[183]=Xt,t[184]=Zt):Zt=t[184];let Qt;t[185]!==qt||t[186]!==Zt?(Qt=(0,z.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[qt,Zt]}),t[185]=qt,t[186]=Zt,t[187]=Qt):Qt=t[187];let $t;t[188]!==Pt||t[189]!==Qt?($t=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[Pt,Qt]}),t[188]=Pt,t[189]=Qt,t[190]=$t):$t=t[190];let en;t[191]!==yt||t[192]!==$t?(en=(0,z.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[yt,$t]}),t[191]=yt,t[192]=$t,t[193]=en):en=t[193];let tn;t[194]!==$||t[195]!==Z.cancel?(tn=(0,z.jsx)(v,{type:`button`,variant:`secondary`,onClick:$,children:Z.cancel}),t[194]=$,t[195]=Z.cancel,t[196]=tn):tn=t[196];let nn=!Ve,rn;t[197]!==Pe||t[198]!==Z.applyCurrent||t[199]!==nn?(rn=(0,z.jsx)(v,{type:`button`,variant:`secondary`,disabled:nn,onClick:Pe,children:Z.applyCurrent}),t[197]=Pe,t[198]=Z.applyCurrent,t[199]=nn,t[200]=rn):rn=t[200];let an;t[201]===je?an=t[202]:(an=()=>void je(),t[201]=je,t[202]=an);let on;t[203]===Ue?on=t[204]:(on=Ue?(0,z.jsx)(j,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,z.jsx)(b,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[203]=Ue,t[204]=on);let sn=Ue?Z.regenerate:Z.generate,cn;t[205]!==Y||t[206]!==an||t[207]!==on||t[208]!==sn?(cn=(0,z.jsxs)(v,{type:`button`,variant:`secondary`,disabled:Y,onClick:an,children:[on,sn]}),t[205]=Y,t[206]=an,t[207]=on,t[208]=sn,t[209]=cn):cn=t[209];let ln=!Be,un;t[210]!==Re||t[211]!==Z.append||t[212]!==ln?(un=(0,z.jsx)(v,{type:`button`,variant:`secondary`,disabled:ln,onClick:Re,children:Z.append}),t[210]=Re,t[211]=Z.append,t[212]=ln,t[213]=un):un=t[213];let dn=!Be,fn;t[214]!==Ie||t[215]!==Z.replace||t[216]!==dn?(fn=(0,z.jsx)(v,{type:`button`,variant:`primary`,disabled:dn,onClick:Ie,children:Z.replace}),t[214]=Ie,t[215]=Z.replace,t[216]=dn,t[217]=fn):fn=t[217];let pn;t[218]!==fn||t[219]!==tn||t[220]!==rn||t[221]!==cn||t[222]!==un?(pn=(0,z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[tn,rn,cn,un,fn]}),t[218]=fn,t[219]=tn,t[220]=rn,t[221]=cn,t[222]=un,t[223]=pn):pn=t[223];let mn;t[224]!==pn||t[225]!==it||t[226]!==en?(mn=(0,z.jsx)(`div`,{className:`absolute inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,z.jsxs)(h,{className:`xopc-dialog-content-pane pointer-events-auto flex h-[min(78vh,38rem)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,onOpenAutoFocus:ie,children:[it,en,pn]})}),t[224]=pn,t[225]=it,t[226]=en,t[227]=mn):mn=t[227];let hn;t[228]!==mn||t[229]!==Ze||t[230]!==et?(hn=(0,z.jsxs)(m,{container:Ze,children:[et,mn]}),t[228]=mn,t[229]=Ze,t[230]=et,t[231]=hn):hn=t[231];let gn;t[232]!==F||t[233]!==hn||t[234]!==Xe?(gn=(0,z.jsx)(_,{open:F,onOpenChange:Xe,children:hn}),t[232]=F,t[233]=hn,t[234]=Xe,t[235]=gn):gn=t[235];let _n;return t[236]!==gn||t[237]!==Ye?(_n=(0,z.jsxs)(z.Fragment,{children:[Ye,gn]}),t[236]=gn,t[237]=Ye,t[238]=_n):_n=t[238],_n}function re(e){return!e}function ie(e){return e.preventDefault()}function V(e){return!!(e&&e.type===`object`&&e.properties&&!Array.isArray(e.properties))}function H(e){let t=e.properties??{},n=new Set(e.required??[]);return Object.entries(t).map(([e,t])=>({key:e,schema:t,required:n.has(e)}))}function U(e,t){return!V(e)||!e?!0:H(e).every(e=>{if(!e.required)return!0;let n=t[e.key];return n==null?!1:typeof n==`string`?n.trim().length>0:!0})}function W(e,t){if(e)return V(e.inputSchema)?Object.keys(t.schemaInput).length>0?t.schemaInput:void 0:x(t.argValues)}function ae(e,t,n){let r=d(t).workflows;if(!e)return r.noInputSummary;let i=O(e,t);if(V(e.inputSchema)&&Object.keys(n.schemaInput).length>0)return Object.entries(n.schemaInput).map(([e,t])=>`${e}: ${String(t)}`).join(` · `);let a=Object.values(n.argValues).map(e=>e.trim()).filter(Boolean),o=n.goal.trim()||i.description;return o&&a.unshift(o),a.length>0?a.join(` · `):r.noInputSummary}function G(e,t,n=!0){return e?n?V(e.inputSchema)?U(e.inputSchema,t.schemaInput)?{valid:!0}:{valid:!1,reason:`schema-required`}:{valid:(T[e.name]??[]).every(e=>!e.required||!!t.argValues[e.key]?.trim())}:{valid:!1,reason:`raw-json`}:{valid:!1}}function K(e,t){return e[t]??t}function oe(e,t){let n=T[e]??[];if(n.length===0)return{};let r=t&&typeof t==`object`&&!Array.isArray(t)?t:{},i={};for(let e of n){let t=r[e.key];t!=null&&(i[e.key]=String(t))}return i}function se(e){let t=(0,P.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,z.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function ce(e){let t=(0,P.c)(34),{workflowName:n,language:r,argValues:i,onArgValuesChange:a,goal:o,onGoalChange:s,examplePrompts:l,showGoal:u,inputClassName:f,aiAssist:p}=e,m;t[0]===l?m=t[1]:(m=l===void 0?[]:l,t[0]=l,t[1]=m);let h=m,g=u===void 0?!0:u,_,v,y,b,x,S,C;if(t[2]!==p||t[3]!==i||t[4]!==h||t[5]!==o||t[6]!==f||t[7]!==r||t[8]!==a||t[9]!==s||t[10]!==g||t[11]!==n){y=d(r).workflows;let e=T[n]??[];v=e.length>0;let l=c(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,f),u;t[19]!==i||t[20]!==a||t[21]!==s?(u=e=>{E(e,s,e=>{a(e(i))})},t[19]=i,t[20]=a,t[21]=s,t[22]=u):u=t[22],_=u,b=`flex flex-col gap-3`,x=e.map(e=>{let t=K(y.args,e.labelKey),o=K(y.args,e.placeholderKey),s=i[e.key]??``;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[t,e.required?` *`:``]}),e.multiline&&p?(0,z.jsx)(B,{value:s,onApply:t=>a({...i,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:p.argScenario??`workflow.arg`,locale:r,context:{...p.context,workflowName:n,workflowArgs:i,fieldKey:e.key},disabled:p.disabled,showLabel:!1}):null]}),e.multiline?(0,z.jsx)(`textarea`,{value:s,onChange:t=>a({...i,[e.key]:t.target.value}),placeholder:o,className:c(l,`min-h-20 resize-y`)}):(0,z.jsx)(`input`,{value:s,onChange:t=>a({...i,[e.key]:t.target.value}),placeholder:o,className:l})]},e.key)}),S=v&&h.length>0?(0,z.jsx)(se,{examples:h,labels:y,onSelect:_}):null,C=g?(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:y.goalLabel}),p?(0,z.jsx)(B,{value:o,onApply:s,fieldId:`workflow.goal`,fieldLabel:y.goalLabel,scenario:p.goalScenario??`cron.workflowGoal`,locale:r,context:{...p.context,workflowName:n,workflowArgs:i},disabled:p.disabled,showLabel:!1}):null]}),(0,z.jsx)(`textarea`,{value:o,onChange:e=>s(e.target.value),placeholder:y.goalPlaceholder,className:c(l,`min-h-20 resize-y`)})]}):null,t[2]=p,t[3]=i,t[4]=h,t[5]=o,t[6]=f,t[7]=r,t[8]=a,t[9]=s,t[10]=g,t[11]=n,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C}else _=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18];let w;t[23]!==_||t[24]!==h||t[25]!==v||t[26]!==y?(w=!v&&h.length>0?(0,z.jsx)(se,{examples:h,labels:y,onSelect:_}):null,t[23]=_,t[24]=h,t[25]=v,t[26]=y,t[27]=w):w=t[27];let D;return t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==C||t[32]!==w?(D=(0,z.jsxs)(`div`,{className:b,children:[x,S,C,w]}),t[28]=b,t[29]=x,t[30]=S,t[31]=C,t[32]=w,t[33]=D):D=t[33],D}var q=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`;function le({schema:e,value:t,onChange:n,labels:r,aiAssist:i,onValidChange:a}){let o=(0,N.useMemo)(()=>H(e),[e]),[s,l]=(0,N.useState)(!1),[u,d]=(0,N.useState)(()=>JSON.stringify(t,null,2)),[f,p]=(0,N.useState)(null);if(o.length===0)return null;let m=(e,r)=>{let i={...t,[e]:r};(r===``||r===void 0)&&delete i[e],n(i),s&&d(JSON.stringify(i,null,2))},h=e=>{d(e);try{let t=e.trim()?JSON.parse(e):{};if(!t||typeof t!=`object`||Array.isArray(t)){p(r.rawJsonInvalid),a?.(!1);return}p(null),n(t),a?.(!0,t)}catch{p(r.rawJsonInvalid),a?.(!1)}};return(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel/70 p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.inputSchemaHeading}),(0,z.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:()=>{let e=!s;l(e),e&&(d(JSON.stringify(t,null,2)),p(null),a?.(!0))},children:r.rawJson})]}),s?(0,z.jsxs)(`div`,{className:`mt-3`,children:[(0,z.jsx)(`textarea`,{value:u,onChange:e=>h(e.target.value),spellCheck:!1,className:c(q,`min-h-40 font-mono text-xs leading-5`)}),f?(0,z.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-300`,children:f}):null]}):(0,z.jsx)(`div`,{className:`mt-3 grid gap-3`,children:o.map(e=>(0,z.jsx)(ue,{field:e,value:t[e.key],labels:r,aiAssist:i,allValues:t,onChange:t=>m(e.key,t)},e.key))})]})}function ue(e){let t=(0,P.c)(30),{field:n,value:r,labels:o,aiAssist:s,allValues:l,onChange:u}=e,d=n.schema.title||n.key,f=typeof n.schema.description==`string`?n.schema.description:void 0,p=Array.isArray(n.schema.type)?n.schema.type[0]:n.schema.type,m;t[0]===n.schema.enum?m=t[1]:(m=Array.isArray(n.schema.enum)?n.schema.enum:[],t[0]=n.schema.enum,t[1]=m);let h=m,g=!!s&&!h.length&&(p===`string`||!p),_=String(d),v=n.required?` *`:``,y;t[2]!==_||t[3]!==v?(y=(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg`,children:[_,v]}),t[2]=_,t[3]=v,t[4]=y):y=t[4];let b;t[5]!==s||t[6]!==l||t[7]!==n.key||t[8]!==n.schema||t[9]!==u||t[10]!==g||t[11]!==d||t[12]!==r?(b=g&&s?(0,z.jsx)(B,{value:typeof r==`string`?r:r==null?``:String(r),onApply:u,fieldId:`workflow.schema.${n.key}`,fieldLabel:String(d),scenario:s.scenario??`workflow.arg`,locale:s.locale,context:{...s.context,fieldKey:n.key,fieldSchema:n.schema,inputValues:l},disabled:s.disabled,showLabel:!1}):null,t[5]=s,t[6]=l,t[7]=n.key,t[8]=n.schema,t[9]=u,t[10]=g,t[11]=d,t[12]=r,t[13]=b):b=t[13];let x;t[14]!==y||t[15]!==b?(x=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[y,b]}),t[14]=y,t[15]=b,t[16]=x):x=t[16];let S;t[17]===f?S=t[18]:(S=f?(0,z.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-subtle`,children:f}):null,t[17]=f,t[18]=S);let C;t[19]!==f||t[20]!==h||t[21]!==o||t[22]!==u||t[23]!==p||t[24]!==r?(C=h.length>0?(0,z.jsxs)(i,{value:r==null?``:String(r),onChange:e=>u(e.target.value),className:q,children:[(0,z.jsx)(a,{value:``}),h.map(de)]}):p===`boolean`?(0,z.jsxs)(i,{value:typeof r==`boolean`?String(r):``,onChange:e=>u(e.target.value===``?void 0:e.target.value===`true`),className:q,children:[(0,z.jsx)(a,{value:``}),(0,z.jsx)(a,{value:`true`,children:o.booleanTrue}),(0,z.jsx)(a,{value:`false`,children:o.booleanFalse})]}):p===`number`||p===`integer`?(0,z.jsx)(`input`,{type:`number`,value:typeof r==`number`||typeof r==`string`?String(r):``,onChange:e=>u(e.target.value===``?void 0:Number(e.target.value)),className:q}):(0,z.jsx)(`textarea`,{value:typeof r==`string`?r:r==null?``:String(r),onChange:e=>u(e.target.value),className:c(q,f&&f.length>80?`min-h-20 resize-y`:`min-h-10 resize-y`)}),t[19]=f,t[20]=h,t[21]=o,t[22]=u,t[23]=p,t[24]=r,t[25]=C):C=t[25];let w;return t[26]!==x||t[27]!==S||t[28]!==C?(w=(0,z.jsxs)(`div`,{className:`block`,children:[x,S,C]}),t[26]=x,t[27]=S,t[28]=C,t[29]=w):w=t[29],w}function de(e){return(0,z.jsx)(a,{value:String(e),children:String(e)},String(e))}function J(e){let t=(0,P.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,z.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function Y(e){let t=(0,P.c)(114),{definition:n,language:r,value:i,onChange:a,aiAssist:o,inputClassName:s,onValidityChange:l}=e,u;t[0]===r?u=t[1]:(u=d(r),t[0]=r,t[1]=u);let f=u.workflows,p;t[2]!==n||t[3]!==r?(p=O(n,r),t[2]=n,t[3]=r,t[4]=p):p=t[4];let m=p,[h,g]=(0,N.useState)(!0),_;t[5]===m.examplePrompts?_=t[6]:(_=m.examplePrompts??[],t[5]=m.examplePrompts,t[6]=_);let v=_,y;t[7]===n.inputSchema?y=t[8]:(y=V(n.inputSchema),t[7]=n.inputSchema,t[8]=y);let b=y,x,S,C,w,T,E,D,k,A,j;if(t[9]!==o||t[10]!==n||t[11]!==v||t[12]!==b||t[13]!==s||t[14]!==f||t[15]!==r||t[16]!==m.description||t[17]!==a||t[18]!==l||t[19]!==h||t[20]!==i){T=Symbol.for(`react.early_return_sentinel`);bb0:{let e=c(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,s),u;t[31]!==n||t[32]!==a||t[33]!==l||t[34]!==h?(u=(e,t)=>{let r=t===void 0?h:t;a(e),l?.(G(n,e,r))},t[31]=n,t[32]=a,t[33]=l,t[34]=h,t[35]=u):u=t[35];let d=u,p;t[36]!==d||t[37]!==i?(p=e=>d({...i,goal:e}),t[36]=d,t[37]=i,t[38]=p):p=t[38];let _=p,y;t[39]!==d||t[40]!==i?(y=e=>d({...i,schemaInput:e}),t[39]=d,t[40]=i,t[41]=y):y=t[41];let O=y,M;t[42]!==d||t[43]!==i?(M=e=>d({...i,argValues:e}),t[42]=d,t[43]=i,t[44]=M):M=t[44];let N=M,P;if(t[45]!==_||t[46]!==O||t[47]!==i.schemaInput?(P=e=>{if(e.field===`goal`){_(e.text);return}O({...i.schemaInput,[e.field]:e.text})},t[45]=_,t[46]=O,t[47]=i.schemaInput,t[48]=P):P=t[48],x=P,!b){let e;t[49]!==o||t[50]!==n.id||t[51]!==n.name||t[52]!==n.title||t[53]!==m.description?(e=o?{disabled:o.disabled,argScenario:o.inputScenario??`workflow.arg`,goalScenario:o.goalScenario??`workflow.goal`,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,t[49]=o,t[50]=n.id,t[51]=n.name,t[52]=n.title,t[53]=m.description,t[54]=e):e=t[54];let a;t[55]!==n.name||t[56]!==v||t[57]!==s||t[58]!==r||t[59]!==N||t[60]!==_||t[61]!==e||t[62]!==i.argValues||t[63]!==i.goal?(a=(0,z.jsx)(ce,{workflowName:n.name,language:r,argValues:i.argValues,onArgValuesChange:N,goal:i.goal,onGoalChange:_,examplePrompts:v,inputClassName:s,aiAssist:e}),t[55]=n.name,t[56]=v,t[57]=s,t[58]=r,t[59]=N,t[60]=_,t[61]=e,t[62]=i.argValues,t[63]=i.goal,t[64]=a):a=t[64],T=a;break bb0}C=`flex flex-col gap-3`,t[65]!==o||t[66]!==n||t[67]!==f.booleanFalse||t[68]!==f.booleanTrue||t[69]!==f.inputSchemaHeading||t[70]!==f.rawJson||t[71]!==f.rawJsonInvalid||t[72]!==r||t[73]!==m.description||t[74]!==l||t[75]!==O||t[76]!==i?(w=n.inputSchema?(0,z.jsx)(le,{schema:n.inputSchema,value:i.schemaInput,onChange:O,onValidChange:(e,t)=>{g(e),l?.(G(n,t?{...i,schemaInput:t}:i,e))},aiAssist:o?{locale:r,disabled:o.disabled,scenario:o.inputScenario??`workflow.arg`,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,labels:{inputSchemaHeading:f.inputSchemaHeading,rawJson:f.rawJson,rawJsonInvalid:f.rawJsonInvalid,booleanTrue:f.booleanTrue,booleanFalse:f.booleanFalse}}):null,t[65]=o,t[66]=n,t[67]=f.booleanFalse,t[68]=f.booleanTrue,t[69]=f.inputSchemaHeading,t[70]=f.rawJson,t[71]=f.rawJsonInvalid,t[72]=r,t[73]=m.description,t[74]=l,t[75]=O,t[76]=i,t[77]=w):w=t[77],j=`flex flex-col gap-1`;let F;t[78]===f.goalLabel?F=t[79]:(F=(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:f.goalLabel}),t[78]=f.goalLabel,t[79]=F);let I;t[80]!==o||t[81]!==n.id||t[82]!==n.name||t[83]!==n.title||t[84]!==f.goalLabel||t[85]!==r||t[86]!==m.description||t[87]!==_||t[88]!==i.goal||t[89]!==i.schemaInput?(I=o?(0,z.jsx)(B,{value:i.goal,onApply:_,fieldId:`workflow.goal`,fieldLabel:f.goalLabel,scenario:o.goalScenario??`workflow.goal`,locale:r,context:{...o.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description,workflowInput:i.schemaInput},disabled:o.disabled,showLabel:!1}):null,t[80]=o,t[81]=n.id,t[82]=n.name,t[83]=n.title,t[84]=f.goalLabel,t[85]=r,t[86]=m.description,t[87]=_,t[88]=i.goal,t[89]=i.schemaInput,t[90]=I):I=t[90],t[91]!==F||t[92]!==I?(S=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[F,I]}),t[91]=F,t[92]=I,t[93]=S):S=t[93],E=i.goal,t[94]===_?D=t[95]:(D=e=>_(e.target.value),t[94]=_,t[95]=D),k=f.goalPlaceholder,A=c(e,`min-h-20 resize-y`)}t[9]=o,t[10]=n,t[11]=v,t[12]=b,t[13]=s,t[14]=f,t[15]=r,t[16]=m.description,t[17]=a,t[18]=l,t[19]=h,t[20]=i,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D,t[28]=k,t[29]=A,t[30]=j}else x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27],k=t[28],A=t[29],j=t[30];if(T!==Symbol.for(`react.early_return_sentinel`))return T;let M;t[96]!==E||t[97]!==D||t[98]!==k||t[99]!==A?(M=(0,z.jsx)(`textarea`,{value:E,onChange:D,placeholder:k,className:A}),t[96]=E,t[97]=D,t[98]=k,t[99]=A,t[100]=M):M=t[100];let F;t[101]!==S||t[102]!==M||t[103]!==j?(F=(0,z.jsxs)(`div`,{className:j,children:[S,M]}),t[101]=S,t[102]=M,t[103]=j,t[104]=F):F=t[104];let I;t[105]!==x||t[106]!==v||t[107]!==f?(I=(0,z.jsx)(J,{examples:v,labels:f,onSelect:x}),t[105]=x,t[106]=v,t[107]=f,t[108]=I):I=t[108];let L;return t[109]!==C||t[110]!==w||t[111]!==F||t[112]!==I?(L=(0,z.jsxs)(`div`,{className:C,children:[w,F,I]}),t[109]=C,t[110]=w,t[111]=F,t[112]=I,t[113]=L):L=t[113],L}function X(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?w(t.agentScaleExact,{count:n.min}):w(t.agentScaleRange,{min:n.min,max:n.max}):w(t.agentScaleExact,{count:e.defaults.maxSubagents})}function fe(e){let t=(0,P.c)(41),{definition:n,language:r,value:i,onChange:a,mode:o,badgeLabel:s,aiAssist:l,inputClassName:u,showTimeout:f,defaultAdvancedOpen:p,onValidityChange:m}=e,h=f===void 0?!1:f,g=p===void 0?!1:p,_=d(r).workflows,[v,b]=(0,N.useState)(g),x;t[0]!==n||t[1]!==r?(x=O(n,r),t[0]=n,t[1]=r,t[2]=x):x=t[2];let S=x,C;t[3]!==n.defaults||t[4]!==i.concurrency?(C=i.concurrency.trim()?Number(i.concurrency):n.defaults.concurrency,t[3]=n.defaults,t[4]=i.concurrency,t[5]=C):C=t[5];let T=C,E;t[6]!==n.defaults||t[7]!==i.maxSubagents?(E=i.maxSubagents.trim()?Number(i.maxSubagents):n.defaults.maxSubagents,t[6]=n.defaults,t[7]=i.maxSubagents,t[8]=E):E=t[8];let j=E,F;t[9]!==n||t[10]!==r||t[11]!==i?(F=ae(n,r,i),t[9]=n,t[10]=r,t[11]=i,t[12]=F):F=t[12];let I=F,L=s??_.readyToStart,R;t[13]!==a||t[14]!==i?(R=e=>a({...i,...e}),t[13]=a,t[14]=i,t[15]=R):R=t[15];let ee=R,te=o===`automation`&&`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,ne;t[16]===te?ne=t[17]:(ne=c(`space-y-4`,te),t[16]=te,t[17]=ne);let B=I||S.description,re;t[18]===B?re=t[19]:(re=(0,z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:B}),t[18]=B,t[19]=re);let ie;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,z.jsx)(A,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[20]=ie):ie=t[20];let V;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,z.jsx)(M,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[21]=V):V=t[21];let H;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,z.jsx)(k,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[22]=H):H=t[22];let U;t[23]!==a||t[24]!==i?(U=e=>a({...i,...e}),t[23]=a,t[24]=i,t[25]=U):U=t[25];let W;t[26]===m?W=t[27]:(W=e=>{m?.(e)},t[26]=m,t[27]=W);let G;t[28]!==l||t[29]!==n||t[30]!==u||t[31]!==r||t[32]!==U||t[33]!==W||t[34]!==i?(G=(0,z.jsx)(Y,{definition:n,language:r,value:i,onChange:U,onValidityChange:W,aiAssist:l,inputClassName:u}),t[28]=l,t[29]=n,t[30]=u,t[31]=r,t[32]=U,t[33]=W,t[34]=i,t[35]=G):G=t[35];let K;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(K=()=>b(pe),t[36]=K):K=t[36];let oe=_.advancedSettings,se=v&&`rotate-180`,ce;t[37]===se?ce=t[38]:(ce=c(`size-4 transition-transform`,se),t[37]=se,t[38]=ce);let q;return t[39]===ce?q=t[40]:(q=(0,z.jsx)(D,{className:ce}),t[39]=ce,t[40]=q),(0,z.jsxs)(`div`,{className:ne,children:[(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:_.runPlanPreview}),re]}),(0,z.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2 py-1 text-[11px] font-medium text-accent-fg`,children:L})]}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[ie,(0,z.jsx)(`span`,{children:w(_.phaseCount,{count:n.phases.length})})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[V,(0,z.jsx)(`span`,{children:X(n,_)})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[H,(0,z.jsx)(`span`,{children:w(_.runLimitsSummary,{concurrency:T,max:j})})]})]}),n.phases.length>0?(0,z.jsxs)(`div`,{className:`mt-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[(0,z.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),_.startPlanPhases]}),(0,z.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:n.phases.map(me)})]}):null]}),G,(0,z.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between px-3 py-2.5 text-left text-sm text-fg`,onClick:K,children:[oe,q]}),v?(0,z.jsxs)(`div`,{className:`grid gap-3 border-t border-edge px-3 pb-3 pt-3 sm:grid-cols-2`,children:[(0,z.jsx)(`input`,{value:i.concurrency,onChange:e=>ee({concurrency:e.target.value}),placeholder:w(_.concurrencyPlaceholder,{default:n.defaults.concurrency}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,z.jsx)(`input`,{value:i.maxSubagents,onChange:e=>ee({maxSubagents:e.target.value}),placeholder:w(_.maxSubagentsPlaceholder,{default:n.defaults.maxSubagents}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),h?(0,z.jsx)(`input`,{value:i.timeoutSeconds??``,onChange:e=>ee({timeoutSeconds:e.target.value}),placeholder:w(_.timeoutSecondsPlaceholder,{default:n.defaults.timeoutSec}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}):null]}):null]})]})}function pe(e){return!e}function me(e,t){return(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t>0?(0,z.jsx)(`span`,{className:`text-fg-subtle`,children:`→`}):null,(0,z.jsx)(`span`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1 text-[11px] text-fg-muted`,children:e.title})]},e.id)}export{B as a,G as i,oe as n,W as r,fe as t};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{c as i,f as a,g as o,l as s,m as c,t as l}from"./chunk-KS7C4IRE-BMYIfy9x.js";import{t as u}from"./check-DUBLcKHA.js";import{n as d,r as f,t as p}from"./popover-select-DcsFzD_i.js";import{t as m}from"./copy-Dv6d4Dvw.js";import{t as h}from"./download-Dk-ZjtO6.js";import{t as g}from"./markdown-view-Dft8ASFD.js";import{t as _}from"./plus-Q2yW6OE7.js";import{t as v}from"./x-B_N4OPjy.js";import{t as y}from"./cn-JdwAhgNB.js";import{c as b,n as x}from"./locale-store-BPZR8x9b.js";import{t as S}from"./messages-kFWhF6_t.js";import{a as C,c as w,i as T,n as E,o as D,r as O,s as k,t as A}from"./dist-BGTk37IG.js";import{t as j}from"./copy-to-clipboard-HOJ79TWv.js";import{i as M}from"./vendor-swr-BIWyz7Rc.js";import{t as N}from"./button-CS04eWY9.js";import{t as P}from"./skeleton-BwbyijEw.js";import{$l as F,$n as I,$r as L,A as R,Ac as z,Br as B,C as V,Cn as H,D as U,Dc as W,E as G,Ed as K,Fl as q,Fr as ee,Gc as te,Gr as ne,Ho as J,Hr as Y,Io as re,Iu as ie,Jr as ae,Kr as oe,Lr as se,Mu as ce,O as le,Qr as ue,Rr as de,S as fe,Sc as pe,T as me,Tu as he,Ur as ge,Vr as _e,Vu as ve,Wl as ye,Wr as X,Xl as be,Yr as xe,Yu as Se,Zr as Ce,_ as we,ao as Te,b as Ee,bn as De,bu as Oe,ci as ke,d as Ae,di as je,ed as Me,ei as Ne,f as Pe,fi as Fe,g as Ie,gd as Le,h as Re,hi as ze,hl as Be,i as Ve,ii as He,il as Ue,jc as We,k as Ge,ku as Ke,ld as qe,li as Je,lu as Ye,m as Xe,md as Ze,mi as Qe,mu as $e,ni as et,nl as tt,no as nt,oi as rt,ol as it,p as at,pi as ot,qr as st,qs as ct,ri as lt,ru as ut,sd as dt,ti as ft,tu as pt,u as mt,v as ht,vd as gt,w as _t,wc as vt,x as yt,y as bt,ya as xt,yl as St,zr as Ct}from"./index-19rMUT3d.js";import{l as wt}from"./vendor-codemirror-DFxP3B9T.js";import{t as Tt}from"./code-editor-CXIH8jQw.js";import{t as Et}from"./page-tabs-Dyc3wKkl.js";import{i as Dt,r as Ot,t as kt}from"./workflow-run-setup-panel-BOJYQaxX.js";import{n as At,t as jt}from"./tab-completion-input-D64VNmiA.js";import{t as Mt}from"./tab-completion-input.utils-BP3NH_du.js";import{a as Nt,c as Pt,i as Ft,l as It,n as Lt,o as Rt,r as zt,s as Bt,t as Vt}from"./style-TIDOdKy0.js";var Z=e(t(),1),Q=n(),Ht=[`queued`,`running`,`succeeded`,`attention`],Ut=new Set([`failed`,`timeout`,`cancelled`]);function Wt(e){return e.metadata?.conversationId?.trim()||null}function Gt(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function Kt(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 qt(e,t=90){let n=e.metadata?.input?.goal?.trim()||(typeof e.metadata?.input?.payload==`string`?e.metadata.input.payload.trim():null)||Kt(e.metadata?.input?.payload,[`query`,`goal`,`prompt`,`input`,`message`])||Kt(e.metadata?.input?.variables,[`query`,`goal`,`prompt`,`input`,`message`]);return n?Gt(n,t):null}function Jt(e,t=90){return qt(e,t)??Gt(e.title?.trim()||e.definitionId,t)}function Yt(e,t=44){return Gt(e.title?.trim()||e.definitionId,t)}function Xt(e,t){let n=t.trim().toLowerCase();return n?[qt(e,500),e.title,e.definitionId,e.id].filter(Boolean).join(` `).toLowerCase().includes(n):!0}function Zt(e,t){let n=t.workflowFilterId.trim();return e.filter(e=>n&&e.definitionId!==n||!X(e,t.triggerFilter??`all`)?!1:Xt(e,t.searchQuery))}function Qt(e){return e.completedAtMs??e.createdAtMs}function $t(e,t){return e.status===`queued`?`queued`:e.status===`running`?`running`:e.status===`succeeded`?`succeeded`:Ut.has(e.status)?`attention`:null}function en(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)=>Qt(t)-Qt(e))}function tn(e,t){let n={queued:[],running:[],succeeded:[],attention:[]};for(let r of e){let e=$t(r,t);e&&n[e].push(r)}return Ht.map(e=>{if(e===`succeeded`){let t=en(`succeeded`,n.succeeded);return{id:e,runs:t,totalInWindow:t.length}}return{id:e,runs:en(e,n[e])}})}function nn(e,t,n){let r=Math.round((t-e)/1e3);if(r<60)return Je(-r,`second`,n);let i=Math.round(r/60);if(i<60)return Je(-i,`minute`,n);let a=Math.round(i/60);return a<48?Je(-a,`hour`,n):Je(-Math.round(a/24),`day`,n)}function rn(e){return e.status===`queued`||e.status===`running`}function an(e){return e.status===`failed`||e.status===`timeout`||e.status===`cancelled`}var $=r(),on=(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=S(r).workflows,[f,p]=(0,Z.useState)(!1),m;t[0]===n?m=t[1]:(m=Wt(n),t[0]=n,t[1]=m);let h=!m,g;t[2]===n?g=t[3]:(g=rn(n),t[2]=n,t[3]=g);let _=g,v=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,C=n.metrics.errorAgentCount>0,w=n.startedAtMs??n.createdAtMs,T=Ct(_?a-w:n.metrics.durationMs),E=_e(d.taskArtifacts,{count:n.metrics.artifactCount}),D;t[7]===n?D=t[8]:(D=Jt(n),t[7]=n,t[8]=D);let O=D,k;t[9]===n?k=t[10]:(k=Yt(n),t[9]=n,t[10]=k);let A=k,j;t[11]!==s||t[12]!==n?(j=()=>{s(n)},t[11]=s,t[12]=n,t[13]=j):j=t[13];let M=j,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`,L;t[18]===I?L=t[19]:(L=y(`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]=L);let R;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(R=y(`w-full text-left`,ct.focusRingPanel),t[20]=R):R=t[20];let B;t[21]===O?B=t[22]:(B=(0,$.jsx)(`div`,{className:`line-clamp-2 text-sm font-medium leading-5 text-fg`,children:O}),t[21]=O,t[22]=B);let V;t[23]===A?V=t[24]:(V=(0,$.jsx)(`div`,{className:`mt-1 truncate text-[11px] font-medium text-fg-muted`,children:A}),t[23]=A,t[24]=V);let H;t[25]!==B||t[26]!==V?(H=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[B,V]}),t[25]=B,t[26]=V,t[27]=H):H=t[27];let U;t[28]===n.status?U=t[29]:(U=y(`shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold shadow-sm`,ne(n.status)),t[28]=n.status,t[29]=U);let W;t[30]!==i||t[31]!==a||t[32]!==w?(W=nn(w,a,i),t[30]=i,t[31]=a,t[32]=w,t[33]=W):W=t[33];let G;t[34]===W?G=t[35]:(G=(0,$.jsx)(`span`,{children:W}),t[34]=W,t[35]=G);let K=T===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:_e(d.taskElapsed,{duration:T})})]}),q;t[36]!==G||t[37]!==K?(q=(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[11px] text-fg-subtle`,children:[G,K]}),t[36]=G,t[37]=K,t[38]=q):q=t[38];let ee=n.metrics.artifactCount>0?(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 font-medium text-fg-muted`,children:E}):null,te=o?(0,$.jsx)(`span`,{className:`font-medium text-accent-fg`,children:d.taskOpenDetails}):null,J;t[39]!==ee||t[40]!==te?(J=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[ee,te]}),t[39]=ee,t[40]=te,t[41]=J):J=t[41];let Y=h&&`cursor-not-allowed text-fg-disabled hover:bg-transparent`,re;t[42]===Y?re=t[43]:(re=y(`rounded-md px-2 py-1 text-xs font-medium`,`text-accent-fg hover:bg-accent-soft`,ct.focusRingPanel,Y),t[42]=Y,t[43]=re);let ae;t[44]!==h||t[45]!==F||t[46]!==d.continueInChat||t[47]!==re?(ae=(0,$.jsx)(`button`,{type:`button`,className:re,disabled:h,onClick:F,children:d.continueInChat}),t[44]=h,t[45]=F,t[46]=d.continueInChat,t[47]=re,t[48]=ae):ae=t[48];let oe;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(oe=y(`rounded-md px-2 py-1 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,ct.focusRingPanel),t[49]=oe):oe=t[49];let se;t[50]!==M||t[51]!==d.taskOpenDetails?(se=(0,$.jsx)(`button`,{type:`button`,className:oe,onClick:M,children:d.taskOpenDetails}),t[50]=M,t[51]=d.taskOpenDetails,t[52]=se):se=t[52];let ce;t[53]!==ae||t[54]!==se?(ce=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-2`,children:[ae,se]}),t[53]=ae,t[54]=se,t[55]=ce):ce=t[55];let le;t[56]===p?le=t[57]:(le=()=>p(cn),t[56]=p,t[57]=le);let ue;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ue=(0,$.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),t[58]=ue):ue=t[58];let de;t[59]!==d.taskActionsAria||t[60]!==f||t[61]!==le?(de=(0,$.jsx)(N,{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:le,children:ue}),t[59]=d.taskActionsAria,t[60]=f,t[61]=le,t[62]=de):de=t[62];let fe;t[63]!==_||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?(fe=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:[_?(0,$.jsx)(sn,{label:d.cancel,tone:`danger`,onClick:()=>{p(!1),l(n.id)}}):null,an(n)?(0,$.jsx)(sn,{label:d.rerun,onClick:()=>{p(!1),u(n.id)}}):null]})]}):null,t[63]=_,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]=fe):fe=t[72];let pe;return t[73]!==de||t[74]!==fe?(pe=(0,$.jsxs)(`div`,{className:`absolute right-2 top-2`,children:[de,fe]}),t[73]=de,t[74]=fe,t[75]=pe):pe=t[75],(0,$.jsxs)(`div`,{className:L,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:M,"aria-label":`${d.taskOpenDetails}: ${O}`,"aria-current":o?`true`:void 0,className:R,children:[(0,$.jsxs)(`div`,{className:`pr-7`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[H,(0,$.jsx)(`span`,{className:U,children:d.status[n.status]??n.status})]}),q]}),v?(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:_e(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,J,C?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 text-[11px] text-amber-700 dark:text-amber-300`,children:[(0,$.jsx)(z,{className:`size-3 shrink-0`,"aria-hidden":!0}),_e(d.runRowErrorSummary,{count:n.metrics.errorAgentCount})]}):null]}),ce,pe]})});function sn(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=y(`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 cn(e){return!e}function ln(e,t){return t.boardColumns[e]}var un=(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=S(r).workflows,[p,m]=(0,Z.useState)(!1),h=n.id===`succeeded`,g=h?5:n.runs.length,_;t[0]!==g||t[1]!==n.runs||t[2]!==p||t[3]!==h?(_=h&&!p?n.runs.slice(0,g):n.runs,t[0]=g,t[1]=n.runs,t[2]=p,t[3]=h,t[4]=_):_=t[4];let v=_,b=h&&n.runs.length>5&&!p,x=h&&p,C;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(C=y(`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]=C):C=t[5];let w;t[6]===n.runs.length?w=t[7]:(w=(0,$.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.runs.length}),t[6]=n.runs.length,t[7]=w);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(ie,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[8]=T):T=t[8];let E=s&&v.length===0?(0,$.jsx)(dn,{}):v.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}):v.map(e=>(0,$.jsx)(on,{run:e,language:r,localeTag:i,nowMs:a,selected:e.id===o,onOpen:c,onOpenChat:l,onCancel:u,onRetry:d},e.id)),D=b?(0,$.jsx)(N,{variant:`ghost`,className:`h-8 w-full text-xs`,onClick:()=>m(!0),children:_e(f.boardExpandSucceeded,{count:Math.min(n.runs.length,n.totalInWindow??n.runs.length)})}):null,O;t[9]!==x||t[10]!==f||t[11]!==m?(O=x?(0,$.jsx)(N,{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]=O):O=t[12];let k;return t[13]!==E||t[14]!==D||t[15]!==O?(k=(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:[E,D,O]}),t[13]=E,t[14]=D,t[15]=O,t[16]=k):k=t[16],(0,$.jsxs)(`section`,{className:C,"aria-label":ln(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:ln(n.id,f)}),w]}),T]}),k]})});function dn(){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)(P,{className:`size-4/5`}),(0,$.jsx)(P,{className:`mt-2 h-3 w-24`})]}),(0,$.jsx)(P,{className:`h-5 w-14 rounded-full`})]}),(0,$.jsx)(P,{className:`mt-3 h-3 w-2/3`}),(0,$.jsx)(P,{className:`mt-4 h-5 w-20 rounded-full`})]}),e[0]=t):t=e[0],t}function fn(e){return e instanceof Element?!!e.closest(`a,button,input,select,textarea,[contenteditable="true"],[draggable="true"],[data-board-pan-skip="true"]`):!0}var pn=(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(mn),t[0]=n,t[1]=g);let _=g,v=(0,Z.useRef)(null),y=(0,Z.useRef)(null),[b,x]=(0,Z.useState)(hn),[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=tn(Zt(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(gn,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||fn(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,P;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(P=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]=P):P=t[13];let F=P;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)(N,{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 I=S?`cursor-grabbing select-none`:`cursor-grab`,L;t[25]===I?L=t[26]:(L=[`min-h-0 h-full min-w-0 overflow-x-auto rounded-lg p-2`,I],t[25]=I,t[26]=L);let R=L.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)(un,{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:F,onPointerUp:A,onPointerCancel:A,onLostPointerCapture:z,children:V}),t[51]=R,t[52]=V,t[53]=H):H=t[53],H});function mn(e){return e.status===`queued`||e.status===`running`}function hn(){return Date.now()}function gn(e,t){return e+t.runs.length}function _n(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?_e(t.agentScaleExact,{count:n.min}):_e(t.agentScaleRange,{min:n.min,max:n.max}):null}function vn(e){let t=(0,Q.c)(77),{definition:n,language:r,labels:i,onPick:a,onDetail:o,onEdit:s,savedForProject:c}=e,l;t[0]!==n||t[1]!==r?(l=rt(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=_n(n,i),t[3]=n,t[4]=i,t[5]=d):d=t[5];let f=d,p=n.metadata.source===`user`,m=p?`bg-accent-soft text-accent-fg`:`bg-surface-inset text-fg-muted`,h;t[6]===m?h=t[7]:(h=y(`rounded-full px-2 py-0.5 text-[10px] font-medium`,m),t[6]=m,t[7]=h);let g=p?i.badgeUser:i.badgeBuiltin,_;t[8]!==h||t[9]!==g?(_=(0,$.jsx)(`span`,{className:h,children:g}),t[8]=h,t[9]=g,t[10]=_):_=t[10];let v;t[11]!==n.inputSchema||t[12]!==i.inputSchemaBadge?(v=n.inputSchema?(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)(Ze,{className:`size-2.5`,"aria-hidden":!0}),i.inputSchemaBadge]}):null,t[11]=n.inputSchema,t[12]=i.inputSchemaBadge,t[13]=v):v=t[13];let b;t[14]!==i.projectWorkflowBadge||t[15]!==c?(b=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)(gt,{className:`size-2.5`,"aria-hidden":!0}),i.projectWorkflowBadge]}):null,t[14]=i.projectWorkflowBadge,t[15]=c,t[16]=b):b=t[16];let x;t[17]!==_||t[18]!==v||t[19]!==b?(x=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[_,v,b]}),t[17]=_,t[18]=v,t[19]=b,t[20]=x):x=t[20];let S;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(S=y(`mt-2 line-clamp-2 text-left text-sm font-semibold leading-5 text-fg hover:text-accent-fg`,ct.focusRingPanel),t[21]=S):S=t[21];let C;t[22]!==n||t[23]!==o?(C=()=>o(n),t[22]=n,t[23]=o,t[24]=C):C=t[24];let w;t[25]!==n.title||t[26]!==C?(w=(0,$.jsx)(`button`,{type:`button`,className:S,onClick:C,children:n.title}),t[25]=n.title,t[26]=C,t[27]=w):w=t[27];let T;t[28]!==w||t[29]!==x?(T=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[x,w]}),t[28]=w,t[29]=x,t[30]=T):T=t[30];let E=`${p?i.editWorkflow:i.copyAndEditWorkflow}: ${n.title}`,D;t[31]!==n||t[32]!==s?(D=()=>s(n),t[31]=n,t[32]=s,t[33]=D):D=t[33];let O;t[34]===p?O=t[35]:(O=p?(0,$.jsx)(St,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(ve,{className:`size-3.5`,"aria-hidden":!0}),t[34]=p,t[35]=O);let k;t[36]!==E||t[37]!==D||t[38]!==O?(k=(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":E,onClick:D,children:O}),t[36]=E,t[37]=D,t[38]=O,t[39]=k):k=t[39];let A;t[40]!==T||t[41]!==k?(A=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[T,k]}),t[40]=T,t[41]=k,t[42]=A):A=t[42];let j=u.whenToUse||u.description||n.description,M;t[43]===j?M=t[44]:(M=(0,$.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:j}),t[43]=j,t[44]=M);let P;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(ut,{className:`size-3`,"aria-hidden":!0}),t[45]=P):P=t[45];let F;t[46]!==n.phases.length||t[47]!==i.phaseCount?(F=_e(i.phaseCount,{count:n.phases.length}),t[46]=n.phases.length,t[47]=i.phaseCount,t[48]=F):F=t[48];let I;t[49]===F?I=t[50]:(I=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[P,F]}),t[49]=F,t[50]=I);let L;t[51]===f?L=t[52]:(L=f?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(vt,{className:`size-3`,"aria-hidden":!0}),f]}):null,t[51]=f,t[52]=L);let R;t[53]!==I||t[54]!==L?(R=(0,$.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-3 pt-4 text-[11px] text-fg-subtle`,children:[I,L]}),t[53]=I,t[54]=L,t[55]=R):R=t[55];let z;t[56]!==n||t[57]!==a?(z=()=>a(n),t[56]=n,t[57]=a,t[58]=z):z=t[58];let B;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(Be,{className:`size-3.5`,"aria-hidden":!0}),t[59]=B):B=t[59];let V;t[60]!==i.configureAndRun||t[61]!==z?(V=(0,$.jsxs)(N,{type:`button`,variant:`secondary`,className:`h-8 flex-1 rounded-lg text-xs`,onClick:z,children:[B,i.configureAndRun]}),t[60]=i.configureAndRun,t[61]=z,t[62]=V):V=t[62];let H;t[63]!==n||t[64]!==o?(H=()=>o(n),t[63]=n,t[64]=o,t[65]=H):H=t[65];let U;t[66]!==i.viewDetails||t[67]!==H?(U=(0,$.jsx)(N,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:H,children:i.viewDetails}),t[66]=i.viewDetails,t[67]=H,t[68]=U):U=t[68];let W;t[69]!==V||t[70]!==U?(W=(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[V,U]}),t[69]=V,t[70]=U,t[71]=W):W=t[71];let G;return t[72]!==A||t[73]!==M||t[74]!==R||t[75]!==W?(G=(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:[A,M,R,W]}),t[72]=A,t[73]=M,t[74]=R,t[75]=W,t[76]=G):G=t[76],G}function yn(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)(Sn),u=S(i).workflows,p=i===`zh`?`zh-CN`:`en-US`,[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(`all`),[v,b]=(0,Z.useState)(`all`),x;t[0]!==g||t[1]!==n||t[2]!==m||t[3]!==v?(x=de(n,m,g,v),t[0]=g,t[1]=n,t[2]=m,t[3]=v,t[4]=x):x=t[4];let C=x,w;if(t[5]!==n||t[6]!==r){let e=new Map(n.map(xn)),i=new Set;w=[...r].sort(bn).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]=w}else w=t[7];let T=w,E=_e(u.workflowCount,{count:C.length}),D;t[8]===E?D=t[9]:(D=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:E}),t[8]=E,t[9]=D);let O=u.sourceFilterAria,k;t[10]!==u.sources||t[11]!==b||t[12]!==v?(k=ft.map(e=>(0,$.jsx)(`button`,{type:`button`,className:y(`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`,ct.focusRingPanel),"aria-pressed":v===e,onClick:()=>b(e),children:u.sources[e]},e)),t[10]=u.sources,t[11]=b,t[12]=v,t[13]=k):k=t[13];let A;t[14]!==u.sourceFilterAria||t[15]!==k?(A=(0,$.jsx)(`div`,{className:`flex rounded-lg bg-surface-inset p-0.5`,role:`group`,"aria-label":O,children:k}),t[14]=u.sourceFilterAria,t[15]=k,t[16]=A):A=t[16];let j=u.categoryFilterAria,M;t[17]===_?M=t[18]:(M=e=>_(e.target.value),t[17]=_,t[18]=M);let N;t[19]===u.categories?N=t[20]:(N=Ce.map(e=>(0,$.jsx)(f,{value:e,children:u.categories[e]},e)),t[19]=u.categories,t[20]=N);let P;t[21]!==g||t[22]!==u.categoryFilterAria||t[23]!==M||t[24]!==N?(P=(0,$.jsx)(d,{value:g,"aria-label":j,onChange:M,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:N}),t[21]=g,t[22]=u.categoryFilterAria,t[23]=M,t[24]=N,t[25]=P):P=t[25];let F;t[26]!==P||t[27]!==A?(F=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[A,P]}),t[26]=P,t[27]=A,t[28]=F):F=t[28];let I;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(tt,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),t[29]=I):I=t[29];let L;t[30]===h?L=t[31]:(L=e=>h(e.target.value),t[30]=h,t[31]=L);let R=u.librarySearchPlaceholder,z;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(z=y(`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`,ct.focusRingPanel),t[32]=z):z=t[32];let B;t[33]!==u.librarySearchPlaceholder||t[34]!==m||t[35]!==L?(B=(0,$.jsxs)(`div`,{className:`relative max-w-xl`,children:[I,(0,$.jsx)(`input`,{value:m,onChange:L,placeholder:R,className:z})]}),t[33]=u.librarySearchPlaceholder,t[34]=m,t[35]=L,t[36]=B):B=t[36];let V;return t[37]!==C||t[38]!==u||t[39]!==i||t[40]!==s||t[41]!==c||t[42]!==o||t[43]!==a?(V=C.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:C.map(e=>(0,$.jsx)(vn,{definition:e,language:i,labels:u,savedForProject:a?.has(e.id)??!1,onPick:o,onDetail:s,onEdit:c},e.id))}),t[37]=C,t[38]=u,t[39]=i,t[40]=s,t[41]=c,t[42]=o,t[43]=a,t[44]=V):V=t[44],(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5`,children:[T.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:T.map(e=>{let{definition:t,lastRunAtMs:n}=e;return(0,$.jsxs)(`button`,{type:`button`,className:y(`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`,ct.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:t.title}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-[11px] text-fg-subtle`,children:nn(n,l,p)})]}),(0,$.jsx)(Be,{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}),D]}),F]}),B]}),V]})]})}function bn(e,t){return(t.startedAtMs??t.createdAtMs)-(e.startedAtMs??e.createdAtMs)}function xn(e){return[e.id,e]}function Sn(){return Date.now()}var Cn=(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,d,f,p,m,h,g,_,v,b,x,C,w,T,E,D,O;if(t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==o||t[4]!==n){f=S(r).workflows;let e;t[22]===n?e=t[23]:(e=rn(n),t[22]=n,t[23]=e),u=e;let s;t[24]===n?s=t[25]:(s=an(n),t[24]=n,t[25]=s),p=s;let c;t[26]===n?c=t[27]:(c=Wt(n),t[26]=n,t[27]=c),d=!!c;let l=n.startedAtMs??n.createdAtMs,k=Ct(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;v=`group border-b border-edge-subtle last:border-b-0`,_=`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`,D=`button`,t[31]!==o||t[32]!==n?(O=()=>o(n),t[31]=o,t[32]=n,t[33]=O):O=t[33],t[34]===Symbol.for(`react.memo_cache_sentinel`)?(h=y(`min-w-0 flex-1 text-left`,ct.focusRingPanel),t[34]=h):h=t[34];let M=f.taskOpenDetails,N;t[35]===n?N=t[36]:(N=Jt(n),t[35]=n,t[36]=N),g=`${M}: ${N}`,T=`flex min-w-0 items-start gap-3`;let P;t[37]===n.status?P=t[38]:(P=y(`mt-0.5 shrink-0 rounded-full px-2 py-0.5 text-[10px] font-semibold`,ne(n.status)),t[37]=n.status,t[38]=P),E=(0,$.jsx)(`span`,{className:P,children:f.status[n.status]??n.status}),m=`min-w-0 flex-1`;let F;t[39]===n?F=t[40]:(F=Jt(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=Yt(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=nn(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=k===`—`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,$.jsx)(`span`,{children:_e(f.taskElapsed,{duration:k})})]});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],C=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:_e(f.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,w=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)(z,{className:`size-3 shrink-0`,"aria-hidden":!0}),_e(f.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]=d,t[7]=f,t[8]=p,t[9]=m,t[10]=h,t[11]=g,t[12]=_,t[13]=v,t[14]=b,t[15]=x,t[16]=C,t[17]=w,t[18]=T,t[19]=E,t[20]=D,t[21]=O}else u=t[5],d=t[6],f=t[7],p=t[8],m=t[9],h=t[10],g=t[11],_=t[12],v=t[13],b=t[14],x=t[15],C=t[16],w=t[17],T=t[18],E=t[19],D=t[20],O=t[21];let k;t[58]!==m||t[59]!==b||t[60]!==x||t[61]!==C||t[62]!==w?(k=(0,$.jsxs)(`span`,{className:m,children:[b,x,C,w]}),t[58]=m,t[59]=b,t[60]=x,t[61]=C,t[62]=w,t[63]=k):k=t[63];let A;t[64]!==k||t[65]!==T||t[66]!==E?(A=(0,$.jsxs)(`div`,{className:T,children:[E,k]}),t[64]=k,t[65]=T,t[66]=E,t[67]=A):A=t[67];let j;t[68]!==h||t[69]!==g||t[70]!==A||t[71]!==D||t[72]!==O?(j=(0,$.jsx)(`button`,{type:D,onClick:O,className:h,"aria-label":g,children:A}),t[68]=h,t[69]=g,t[70]=A,t[71]=D,t[72]=O,t[73]=j):j=t[73];let M;t[74]!==f.rerun||t[75]!==l||t[76]!==p||t[77]!==n.id?(M=p?(0,$.jsx)(N,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>l(n.id),children:f.rerun}):null,t[74]=f.rerun,t[75]=l,t[76]=p,t[77]=n.id,t[78]=M):M=t[78];let P;t[79]!==d||t[80]!==f.continueInChat||t[81]!==s||t[82]!==n?(P=n.status===`succeeded`&&d?(0,$.jsx)(N,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>s(n),children:f.continueInChat}):null,t[79]=d,t[80]=f.continueInChat,t[81]=s,t[82]=n,t[83]=P):P=t[83];let F;t[84]!==u||t[85]!==f.cancel||t[86]!==c||t[87]!==n.id?(F=u?(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg text-xs text-red-600 dark:text-red-300`,onClick:()=>c(n.id),children:f.cancel}):null,t[84]=u,t[85]=f.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 L;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(dt,{className:`size-4`,"aria-hidden":!0}),t[92]=L):L=t[92];let R;t[93]!==f.taskOpenDetails||t[94]!==I?(R=(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":f.taskOpenDetails,onClick:I,children:L}),t[93]=f.taskOpenDetails,t[94]=I,t[95]=R):R=t[95];let B;t[96]!==M||t[97]!==P||t[98]!==F||t[99]!==R?(B=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5 pl-7 lg:pl-0`,children:[M,P,F,R]}),t[96]=M,t[97]=P,t[98]=F,t[99]=R,t[100]=B):B=t[100];let V;t[101]!==_||t[102]!==j||t[103]!==B?(V=(0,$.jsxs)(`div`,{className:_,children:[j,B]}),t[101]=_,t[102]=j,t[103]=B,t[104]=V):V=t[104];let H;return t[105]!==v||t[106]!==V?(H=(0,$.jsx)(`article`,{className:v,children:V}),t[105]=v,t[106]=V,t[107]=H):H=t[107],H});function wn(e){let t=(0,Q.c)(17),{vm:n}=e,{labels:r,language:i,loading:a,ownerAgentId:o,agentOptions:s,setOwnerAgentId:c,refreshAll:u}=n,p;t[0]!==s||t[1]!==r.agentFilterAria||t[2]!==i||t[3]!==o||t[4]!==c?(p=s.length>1?(0,$.jsx)(d,{value:o??``,"aria-label":r.agentFilterAria,onChange:e=>c(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:s.map(e=>(0,$.jsx)(f,{value:e.id,children:H(e,S(i).agentsSettings)},e.id))}):null,t[0]=s,t[1]=r.agentFilterAria,t[2]=i,t[3]=o,t[4]=c,t[5]=p):p=t[5];let m;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(_,{className:`size-4`,"aria-hidden":!0}),t[6]=m):m=t[6];let h;t[7]===r.addWorkflow?h=t[8]:(h=(0,$.jsx)(N,{asChild:!0,variant:`primary`,className:`h-9 rounded-lg`,children:(0,$.jsxs)(l,{to:`/workflows/new`,children:[m,r.addWorkflow]})}),t[7]=r.addWorkflow,t[8]=h);let g;t[9]!==r.refresh||t[10]!==a||t[11]!==u?(g=(0,$.jsx)(xt,{className:`size-9 shrink-0 p-0`,loading:a,label:r.refresh,onClick:u}),t[9]=r.refresh,t[10]=a,t[11]=u,t[12]=g):g=t[12];let v;return t[13]!==p||t[14]!==h||t[15]!==g?(v=(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[p,h,g]}),t[13]=p,t[14]=h,t[15]=g,t[16]=v):v=t[16],v}var Tn=new Set([`failed`,`timeout`,`cancelled`]),En=[{id:`runs`,icon:be},{id:`library`,icon:F}],Dn={failed:0,timeout:0,cancelled:0,running:1,queued:2,succeeded:3};function On(e){return Tn.has(e.status)}function kn(e,t){return t===`all`?!0:t===`attention`?On(e):e.status===t}function An(e){return[...e].sort((e,t)=>{let n=(Dn[e.status]??4)-(Dn[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 jn(e,t){return e===`Home`?`runs`:e===`End`?`library`:e===`ArrowLeft`||e===`ArrowRight`?t===`runs`?`library`:`runs`:null}function Mn(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(P,{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)(P,{className:`h-4 w-52 max-w-full`}),(0,$.jsx)(P,{className:`mt-2 h-3 w-36 max-w-full`})]}),(0,$.jsx)(P,{className:`hidden h-8 w-20 rounded-lg sm:block`})]}),e[1]=n):n=e[1],n}function Nn(e){let t=(0,Q.c)(27),{vm:n}=e,{language:r,localeTag:i,labels:a,hasToken:o,definitions:s,projectPresetDefinitionIds:c,runs:l,searchQuery:u,setSearchQuery:p,workflowFilterId:m,setWorkflowFilterId:h,triggerFilter:g,setTriggerFilter:_,statusFilter:b,setStatusFilter:x,clearRunFilters:S,pageTab:C,setPageTab:w,runLayout:T,setRunLayout:E,openRunDetails:D,openRunInChat:O,openDefinitionDetails:k,openWorkflowEditor:A,startWorkflow:j,actionError:M,loading:P,error:F,cancelRun:I,retryRun:L}=n,R=re(Ln),B=re(In),V=Date.now(),H=An(l.filter(On)),U;t[0]===b?U=t[1]:(U=e=>kn(e,b),t[0]=b,t[1]=U);let W=An(Zt(l,{searchQuery:u,workflowFilterId:m,triggerFilter:g}).filter(U)),G=!!(u||m||g!==`all`||b!==`all`),K,q;if(t[2]!==B||t[3]!==o||t[4]!==a.title||t[5]!==R||t[6]!==n?(K=()=>{if(!o){B();return}return R({startExtra:null,main:(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:a.title}),end:(0,$.jsx)(wn,{vm:n})}),()=>B()},q=[B,o,a.title,R,n],t[2]=B,t[3]=o,t[4]=a.title,t[5]=R,t[6]=n,t[7]=K,t[8]=q):(K=t[7],q=t[8]),(0,Z.useLayoutEffect)(K,q),!o){let e;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(Oe,{className:`size-10 text-accent-fg`,"aria-hidden":!0}),t[9]=e):e=t[9];let n;t[10]===a.title?n=t[11]:(n=(0,$.jsx)(`h1`,{className:`mt-4 text-xl font-semibold text-fg`,children:a.title}),t[10]=a.title,t[11]=n);let r;t[12]===a.needToken?r=t[13]:(r=(0,$.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-fg-muted`,children:a.needToken}),t[12]=a.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 ee=a.pageTabsAria,te=En.map(e=>{let{id:t,icon:n}=e;return(0,$.jsxs)(`button`,{id:`workflow-tab-${t}`,type:`button`,role:`tab`,"aria-selected":C===t,"aria-controls":`workflow-panel-${t}`,tabIndex:C===t?0:-1,draggable:!1,className:y(`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`,C===t?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),onClick:()=>w(t),onKeyDown:e=>{let n=jn(e.key,t);n&&(e.preventDefault(),w(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:a.pageTabs[t]}),t===`runs`&&H.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:H.length}):null]},t)}),ne;t[17]!==a.pageTabsAria||t[18]!==te?(ne=(0,$.jsx)(`nav`,{className:`-mx-1 flex gap-1 overflow-x-auto px-1 pb-1`,"aria-label":ee,role:`tablist`,children:te}),t[17]=a.pageTabsAria,t[18]=te,t[19]=ne):ne=t[19];let J;t[20]!==M||t[21]!==F?(J=M??F?(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:M??F}):null,t[20]=M,t[21]=F,t[22]=J):J=t[22];let Y=C===`runs`?(0,$.jsxs)(`div`,{id:`workflow-panel-runs`,role:`tabpanel`,"aria-labelledby":`workflow-tab-runs`,className:`flex flex-col gap-4 py-4`,children:[H.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)(z,{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:a.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:H.length})]}),(0,$.jsxs)(`p`,{className:`mt-1 truncate text-xs text-fg-muted`,children:[Jt(H[0]),` · `,nn(H[0].completedAtMs??H[0].createdAtMs,V,i)]})]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pl-7 lg:pl-0`,children:[(0,$.jsx)(N,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg text-xs`,onClick:()=>D(H[0]),children:a.attentionView}),(0,$.jsx)(N,{type:`button`,variant:`primary`,className:`h-8 rounded-lg text-xs`,onClick:()=>void L(H[0].id),children:a.rerun})]})]})}):null,(0,$.jsx)(`section`,{className:`flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base p-3`,"aria-label":a.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)(tt,{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:u,onChange:e=>p(e.target.value),placeholder:a.runsSearchPlaceholder,className:y(`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`,ct.focusRingPanel)})]}),(0,$.jsx)(d,{value:b,"aria-label":a.statusFilterAria,onChange:e=>x(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)(f,{value:e,children:a.runStatuses[e]},e))}),(0,$.jsxs)(d,{value:g,"aria-label":a.boardTriggerFilterAria,onChange:e=>_(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)(f,{value:`all`,children:a.boardTriggerFilterAll}),(0,$.jsx)(f,{value:`automation`,children:a.boardTriggerFilterAutomation}),(0,$.jsx)(f,{value:`webui`,children:a.boardTriggerFilterWebui}),(0,$.jsx)(f,{value:`chat`,children:a.boardTriggerFilterChat}),(0,$.jsx)(f,{value:`api`,children:a.boardTriggerFilterApi})]}),(0,$.jsxs)(d,{value:m,"aria-label":a.boardWorkflowFilterAria,onChange:e=>h(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)(f,{value:``,children:a.boardWorkflowFilterAll}),s.map(Fn)]}),G?(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-9 rounded-lg text-xs`,onClick:S,children:[(0,$.jsx)(v,{className:`size-3.5`,"aria-hidden":!0}),a.clearFilters]}):null,(0,$.jsxs)(`div`,{className:`ml-auto flex rounded-lg bg-surface-inset p-0.5`,role:`group`,"aria-label":a.layoutAria,children:[(0,$.jsxs)(`button`,{type:`button`,className:y(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,T===`list`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,ct.focusRingPanel),"aria-pressed":T===`list`,onClick:()=>E(`list`),children:[(0,$.jsx)(ye,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.list]}),(0,$.jsxs)(`button`,{type:`button`,className:y(`inline-flex h-8 items-center gap-1.5 rounded-md px-2.5 text-xs font-medium transition-colors`,T===`board`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`,ct.focusRingPanel),"aria-pressed":T===`board`,onClick:()=>E(`board`),children:[(0,$.jsx)(pt,{className:`size-3.5`,"aria-hidden":!0}),a.runLayouts.board]})]})]})}),T===`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:a.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:W.length})]}),P&&W.length===0?Array.from({length:4}).map(Pn):W.length>0?W.map(e=>(0,$.jsx)(Cn,{run:e,language:r,localeTag:i,nowMs:V,onOpen:D,onOpenChat:O,onCancel:e=>void I(e),onRetry:e=>void L(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)(Oe,{className:`size-8 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`h3`,{className:`mt-3 text-sm font-semibold text-fg`,children:G?a.noRunResultsTitle:a.noRunsTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-md text-xs leading-5 text-fg-muted`,children:G?a.noRunResultsHint:a.noRunsStartHint}),(0,$.jsx)(N,{type:`button`,variant:G?`secondary`:`primary`,className:`mt-4 h-9 rounded-lg text-xs`,onClick:G?S:()=>w(`library`),children:G?a.clearFilters:a.chooseWorkflow})]})]}):(0,$.jsx)(`div`,{className:`h-[min(72vh,48rem)] min-h-[24rem] w-full sm:min-h-[28rem]`,children:(0,$.jsx)(pn,{runs:W,language:r,localeTag:i,labels:{boardEmptyTitle:a.boardEmptyTitle,boardEmptyHint:a.boardEmptyHint,boardStart:a.chooseWorkflow,loading:a.loading},searchQuery:``,workflowFilterId:``,triggerFilter:`all`,selectedRunId:null,loading:P,onOpenRun:D,onOpenRunChat:O,onCancelRun:e=>void I(e),onRetryRun:e=>void L(e),onStart:()=>w(`library`)})})]}):(0,$.jsx)(`section`,{id:`workflow-panel-library`,role:`tabpanel`,"aria-labelledby":`workflow-tab-library`,className:`py-5`,children:(0,$.jsx)(yn,{definitions:s,runs:l,language:r,projectPresetDefinitionIds:c,onPick:j,onDetail:k,onEdit:A})}),ie;return t[23]!==J||t[24]!==Y||t[25]!==ne?(ie=(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 py-5 sm:px-5 xl:px-6`,children:[ne,J,Y]})}),t[23]=J,t[24]=Y,t[25]=ne,t[26]=ie):ie=t[26],ie}function Pn(e,t){return(0,$.jsx)(Mn,{},t)}function Fn(e){return(0,$.jsx)(f,{value:e.id,children:e.title},e.id)}function In(e){return e.clearPageHeader}function Ln(e){return e.setPageHeader}function Rn(){let e=(0,Q.c)(131),t=x(Wn),n;e[0]===t?n=e[1]:(n=S(t),e[0]=t,e[1]=n);let r=n.workflows,i=t===`zh`?`zh-CN`:`en-US`,s=b(Un),c=!!s,l=a(),[u,d]=o(),f;e[2]===u?f=e[3]:(f=u.get(`q`)??``,e[2]=u,e[3]=f);let p=f,m;e[4]===u?m=e[5]:(m=u.get(`wf`)?.trim()??``,e[4]=u,e[5]=m);let h=m,g;e[6]===u?g=e[7]:(g=u.get(`trigger`)?.trim()||`all`,e[6]=u,e[7]=g);let _=g,v,y,C,w,T;if(e[8]!==u){let t=u.get(`status`)?.trim()??``,n=u.get(`tab`)?.trim()??``,r=u.get(`layout`)?.trim()??``;v=u.get(`agent`)?.trim()??``,C=u.get(`projectId`)?.trim()||void 0,y=ue.has(n)?n:`runs`,w=Ne.has(r)?r:`list`,T=lt.has(t)?t:`all`,e[8]=u,e[9]=v,e[10]=y,e[11]=C,e[12]=w,e[13]=T}else v=e[9],y=e[10],C=e[11],w=e[12],T=e[13];let E=T,[D,O]=(0,Z.useState)(null),k;e[14]!==c||e[15]!==s?(k=c?[`workflow-agents`,s]:null,e[14]=c,e[15]=s,e[16]=k):k=e[16];let A;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(A={revalidateOnFocus:!1},e[17]=A):A=e[17];let j=M(k,De,A),N;bb0:{let e=j.data?.agents??[];if(v&&(e.length===0||e.some(e=>e.id===v))){N=v;break bb0}N=j.data?.defaultId}let P=N,F;e[18]!==c||e[19]!==s?(F=c?[`workflow-definitions`,s]:null,e[18]=c,e[19]=s,e[20]=F):F=e[20];let I;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(I={revalidateOnFocus:!1},e[21]=I):I=e[21];let R=M(F,bt,I),z;e[22]!==c||e[23]!==C||e[24]!==s?(z=c&&C?[`workflow-project-presets`,s,C]:null,e[22]=c,e[23]=C,e[24]=s,e[25]=z):z=e[25];let B;e[26]===C?B=e[27]:(B=()=>ht(C),e[26]=C,e[27]=B);let V;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(V={revalidateOnFocus:!1},e[28]=V):V=e[28];let H=M(z,B,V),U;e[29]!==c||e[30]!==P||e[31]!==C||e[32]!==s?(U=c&&P?[`workflow-runs`,s,P,C??``]:null,e[29]=c,e[30]=P,e[31]=C,e[32]=s,e[33]=U):U=e[33];let W;e[34]!==P||e[35]!==C?(W=()=>yt(100,{ownerAgentId:P,projectId:C}),e[34]=P,e[35]=C,e[36]=W):W=e[36];let G;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(G={revalidateOnFocus:!1,refreshInterval:Vn},e[37]=G):G=e[37];let K=M(U,W,G),q;e[38]===R.data?q=e[39]:(q=R.data??[],e[38]=R.data,e[39]=q);let ee=q,te;e[40]===K.data?te=e[41]:(te=K.data??[],e[40]=K.data,e[41]=te);let ne=te,J;e[42]===d?J=e[43]:(J=e=>{d(t=>{let n=new URLSearchParams(t);return e(n),n},{replace:!0})},e[42]=d,e[43]=J);let Y=J,re;e[44]===Y?re=e[45]:(re=e=>Y(t=>{let n=e.trim();n?t.set(`q`,n):t.delete(`q`)}),e[44]=Y,e[45]=re);let ie=re,ae;e[46]===Y?ae=e[47]:(ae=e=>Y(t=>{let n=e.trim();n?t.set(xe,n):t.delete(xe)}),e[46]=Y,e[47]=ae);let se=ae,ce;e[48]===Y?ce=e[49]:(ce=e=>Y(t=>{let n=e.trim();n?t.set(`wf`,n):t.delete(`wf`)}),e[48]=Y,e[49]=ce);let le=ce,de;e[50]===Y?de=e[51]:(de=e=>Y(t=>{e&&e!==`all`?t.set(He,e):t.delete(He)}),e[50]=Y,e[51]=de);let fe=de,pe;e[52]===Y?pe=e[53]:(pe=e=>Y(t=>{e===`runs`?t.delete(`tab`):t.set(`tab`,e)}),e[52]=Y,e[53]=pe);let he=pe,ge;e[54]===Y?ge=e[55]:(ge=e=>Y(t=>{e===`list`?t.delete(L):t.set(L,e)}),e[54]=Y,e[55]=ge);let _e=ge,ve;e[56]===Y?ve=e[57]:(ve=e=>Y(t=>{e===`all`?t.delete(et):t.set(et,e)}),e[56]=Y,e[57]=ve);let ye=ve,X;e[58]===Y?X=e[59]:(X=()=>Y(Bn),e[58]=Y,e[59]=X);let be=X,Se;if(e[60]!==P||e[61]!==C){let t=new URLSearchParams;P&&t.set(`agentId`,P),C&&t.set(`projectId`,C),Se=t.size?`?${t.toString()}`:``,e[60]=P,e[61]=C,e[62]=Se}else Se=e[62];let Ce=Se,we;e[63]!==l||e[64]!==Ce?(we=e=>l(`/workflows/${e.id}${Ce}`),e[63]=l,e[64]=Ce,e[65]=we):we=e[65];let Te=we,Ee=Te,Oe;e[66]!==l||e[67]!==Ce?(Oe=e=>{let t=new URLSearchParams(Ce.slice(1));e.metadata.source!==`user`&&t.set(`copy`,e.id),l(e.metadata.source===`user`?`/workflows/${e.id}/edit${Ce}`:`/workflows/new${t.size?`?${t.toString()}`:``}`)},e[66]=l,e[67]=Ce,e[68]=Oe):Oe=e[68];let ke=Oe,je;e[69]!==l||e[70]!==Ce?(je=e=>l(`/workflows/runs/${e.id}${Ce}`),e[69]=l,e[70]=Ce,e[71]=je):je=e[71];let Me=je,Pe;e[72]===l?Pe=e[73]:(Pe=e=>{let t=Wt(e);t&&l(oe(t))},e[72]=l,e[73]=Pe);let Fe=Pe,Ie;e[74]!==r.cancelFailed||e[75]!==P||e[76]!==K?(Ie=async e=>{try{await Ae(e,{ownerAgentId:P}),await K.mutate()}catch(e){let t=e;O(t instanceof Error?t.message:r.cancelFailed)}},e[74]=r.cancelFailed,e[75]=P,e[76]=K,e[77]=Ie):Ie=e[77];let Le=Ie,Re;e[78]!==r.retryFailed||e[79]!==l||e[80]!==P||e[81]!==Ce?(Re=async e=>{try{l(`/workflows/runs/${(await me(e,{ownerAgentId:P})).runId}${Ce}`)}catch(e){let t=e;O(t instanceof Error?t.message:r.retryFailed)}},e[78]=r.retryFailed,e[79]=l,e[80]=P,e[81]=Ce,e[82]=Re):Re=e[82];let ze=Re,Be,Ve;e[83]===K?(Be=e[84],Ve=e[85]):(Be=()=>{let e=()=>void K.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)}},Ve=[K],e[83]=K,e[84]=Be,e[85]=Ve),(0,Z.useEffect)(Be,Ve);let Ue;e[86]!==j||e[87]!==R||e[88]!==H||e[89]!==K?(Ue=()=>{Promise.all([j.mutate(),R.mutate(),H.mutate(),K.mutate()])},e[86]=j,e[87]=R,e[88]=H,e[89]=K,e[90]=Ue):Ue=e[90];let We=Ue,Ge=j.isLoading||R.isLoading||K.isLoading||H.isLoading,Ke=j.error?.message??R.error?.message??K.error?.message??H.error?.message??null,qe;e[91]===j.data?.agents?qe=e[92]:(qe=j.data?.agents??[],e[91]=j.data?.agents,e[92]=qe);let Je;e[93]===H.data?Je=e[94]:(Je=new Set((H.data??[]).map(zn)),e[93]=H.data,e[94]=Je);let Ye;return e[95]!==D||e[96]!==Le||e[97]!==be||e[98]!==ee||e[99]!==Ke||e[100]!==c||e[101]!==r||e[102]!==t||e[103]!==Ge||e[104]!==i||e[105]!==Te||e[106]!==Me||e[107]!==Fe||e[108]!==ke||e[109]!==P||e[110]!==y||e[111]!==C||e[112]!==We||e[113]!==ze||e[114]!==w||e[115]!==ne||e[116]!==p||e[117]!==se||e[118]!==he||e[119]!==_e||e[120]!==ie||e[121]!==ye||e[122]!==fe||e[123]!==le||e[124]!==Ee||e[125]!==E||e[126]!==qe||e[127]!==Je||e[128]!==_||e[129]!==h?(Ye={language:t,localeTag:i,labels:r,hasToken:c,searchQuery:p,setSearchQuery:ie,ownerAgentId:P,projectId:C,agentOptions:qe,setOwnerAgentId:se,workflowFilterId:h,setWorkflowFilterId:le,triggerFilter:_,setTriggerFilter:fe,statusFilter:E,setStatusFilter:ye,clearRunFilters:be,pageTab:y,setPageTab:he,runLayout:w,setRunLayout:_e,definitions:ee,projectPresetDefinitionIds:Je,runs:ne,openDefinitionDetails:Te,startWorkflow:Ee,openWorkflowEditor:ke,openRunDetails:Me,openRunInChat:Fe,actionError:D,loading:Ge,error:Ke,refreshAll:We,cancelRun:Le,retryRun:ze},e[95]=D,e[96]=Le,e[97]=be,e[98]=ee,e[99]=Ke,e[100]=c,e[101]=r,e[102]=t,e[103]=Ge,e[104]=i,e[105]=Te,e[106]=Me,e[107]=Fe,e[108]=ke,e[109]=P,e[110]=y,e[111]=C,e[112]=We,e[113]=ze,e[114]=w,e[115]=ne,e[116]=p,e[117]=se,e[118]=he,e[119]=_e,e[120]=ie,e[121]=ye,e[122]=fe,e[123]=le,e[124]=Ee,e[125]=E,e[126]=qe,e[127]=Je,e[128]=_,e[129]=h,e[130]=Ye):Ye=e[130],Ye}function zn(e){return e.definitionId}function Bn(e){e.delete(`q`),e.delete(`wf`),e.delete(He),e.delete(et)}function Vn(e){return e?.some(Hn)?3e3:0}function Hn(e){return e.status===`queued`||e.status===`running`}function Un(e){return e.conversationId}function Wn(e){return e.language}function Gn(){let e=(0,Q.c)(2),t=Rn(),n;return e[0]===t?n=e[1]:(n=(0,$.jsx)(Nn,{vm:t}),e[0]=t,e[1]=n),n}function Kn(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 qn(e){let t=(0,Q.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=wt(),t[0]=n):n=t[0];let r=n,i;return t[1]===e?i=t[2]:(i=(0,$.jsx)(Tt,{...e,language:r}),t[1]=e,t[2]=i),i}function Jn({initialSource:e,resetKey:t,fileName:n,language:r,readOnly:i=!0,error:a,onChange:o,allowImport:s=!1,className:c=`h-[28rem]`}){let l=Yn(r),d=J(e=>e.resolved)===`dark`,[f,p]=(0,Z.useState)(e),[m,g]=(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),g(e=>e+1)},[t]),(0,Z.useEffect)(()=>{let e=e=>{let t=C.current;t&&b(Xn(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(Xn((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)(ce,{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)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,disabled:!!a,onClick:()=>{try{D(`${JSON.stringify(JSON.parse(f),null,2)}\n`),g(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),g(e=>e+1)})}}),(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>S.current?.click(),children:[(0,$.jsx)(W,{className:`size-3.5`,"aria-hidden":!0}),l.import]})]}):null,(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>void j(f).then(e=>{e&&(v(!0),window.setTimeout(()=>v(!1),1500))}),children:[_?(0,$.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(Se,{className:`size-3.5`,"aria-hidden":!0}),_?l.copied:l.copy]}),(0,$.jsxs)(N,{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)(h,{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)(qn,{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 Yn(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 Xn(e){let t=typeof window>`u`?960:Math.max(280,window.innerHeight-96);return Math.min(t,Math.max(280,Math.round(e)))}function Zn(e){return Qn(e.name,e.graph,Kn(e))}function Qn(e,t,n){return{formatVersion:1,name:e,manifest:structuredClone(n),graph:structuredClone(t)}}function $n(e){return Qn(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 er(e,t){let n=lr(e),r=lr(t);if(n.length*r.length>25e4)return ur(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 tr(e){return`${JSON.stringify(e,null,2)}\n`}function nr(e){let t;try{t=JSON.parse(e)}catch(e){return{ok:!1,error:e instanceof Error?e.message:`Invalid JSON.`}}if(!or(t))return cr(`The source root must be a JSON object.`);if(t.formatVersion!==1)return cr(`formatVersion must be 1.`);if(typeof t.name!=`string`||!/^[a-z][a-z0-9_-]*$/.test(t.name))return cr(`name must use lowercase letters, numbers, underscores, or hyphens.`);if(!or(t.manifest))return cr(`manifest must be an object.`);let n=rr(t.manifest);if(n)return cr(n);if(!or(t.graph))return cr(`graph must be an object.`);if(t.graph.schemaVersion!==1)return cr(`graph.schemaVersion must be 1.`);if(!Array.isArray(t.graph.nodes))return cr(`graph.nodes must be an array.`);if(!Array.isArray(t.graph.edges))return cr(`graph.edges must be an array.`);for(let[e,n]of t.graph.nodes.entries()){let t=ir(n,e);if(t)return cr(t)}for(let[e,n]of t.graph.edges.entries()){let t=ar(n,e);if(t)return cr(t)}return{ok:!0,document:t}}function rr(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&&!or(e.defaults)?`manifest.defaults must be an object.`:null}function ir(e,t){return or(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`?!or(e.position)||!sr(e.position.x)||!sr(e.position.y)?`graph.nodes[${t}].position must contain finite x and y values.`:or(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 ar(e,t){if(!or(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 or(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function sr(e){return typeof e==`number`&&Number.isFinite(e)}function cr(e){return{ok:!1,error:e}}function lr(e){let t=e.split(`
|
|
2
|
-
`);return t.at(-1)===``&&t.pop(),t}function ur(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 dr(e){let t=(0,Q.c)(31),{comparison:n,language:r,onClose:i}=e,a;t[0]===n?a=t[1]:(a=n?er(n.before,n.after):[],t[0]=n,t[1]=a);let o=a,s;t[2]===o?s=t[3]:(s=o.filter(pr),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)(C,{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)(k,{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)(T,{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`,y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(v,{className:`size-4`}),t[14]=y):y=t[14];let b;t[15]===_?b=t[16]:(b=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":_,children:y})}),t[15]=_,t[16]=b);let x;t[17]!==g||t[18]!==b?(x=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[g,b]}),t[17]=g,t[18]=b,t[19]=x):x=t[19];let S;t[20]===o?S=t[21]:(S=o.map(fr),t[20]=o,t[21]=S);let w;t[22]===S?w=t[23]:(w=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto bg-surface-base py-3 font-mono text-xs leading-5`,children:S}),t[22]=S,t[23]=w);let j;t[24]!==x||t[25]!==w?(j=(0,$.jsxs)(D,{children:[d,(0,$.jsxs)(O,{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:[x,w]})]}),t[24]=x,t[25]=w,t[26]=j):j=t[26];let M;return t[27]!==j||t[28]!==l||t[29]!==u?(M=(0,$.jsx)(A,{open:l,onOpenChange:u,children:j}),t[27]=j,t[28]=l,t[29]=u,t[30]=M):M=t[30],M}function fr(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 pr(e){return e.kind!==`same`}function mr(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 hr(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 gr={padding:.24,minZoom:.45,maxZoom:1};function _r({language:e,ownerAgentId:t,saving:n,initialDraft:r,initialName:a,existingNames:o,saveConflict:c,onSave:u,onSaveAndStart:d,onClearSaveConflict:f,onReloadLatest:p}){let m=Ir(e),[h,g]=(0,Z.useState)(`my_workflow`),[_,v]=(0,Z.useState)(()=>kr()),[b,x]=(0,Z.useState)(()=>({title:m.untitled,description:``,tags:[`custom`]})),[S,C]=(0,Z.useState)(`agent-1`),[w,T,E]=Bt(_.nodes.map(e=>Dr(e,e.id===`agent-1`))),[D,O]=(0,Z.useState)(``),[k,A]=(0,Z.useState)(``),[j,M]=(0,Z.useState)(!1),[P,F]=(0,Z.useState)(null),[I,L]=(0,Z.useState)(null),[z,B]=(0,Z.useState)(!!r),[V,H]=(0,Z.useState)(null),[W,G]=(0,Z.useState)(`idle`),[q,ee]=(0,Z.useState)(0),[ne,J]=(0,Z.useState)([]),[Y,re]=(0,Z.useState)(null),ie=(0,Z.useRef)(``),ae=(0,Z.useRef)(``),oe=(0,Z.useRef)(void 0),se=(0,Z.useRef)(void 0),ce=(0,Z.useRef)(``),le=(0,Z.useRef)(!1),ue=(0,Z.useRef)(null),[de,fe]=(0,Z.useState)(0),[pe,me]=(0,Z.useState)(`canvas`),[he,ge]=(0,Z.useState)(``),[_e,ve]=(0,Z.useState)(0),[ye,X]=(0,Z.useState)(null),[be,xe]=(0,Z.useState)(null),[Se,Ce]=(0,Z.useState)(null),we=s(!!ye);i((0,Z.useCallback)(e=>{ye&&(e.preventDefault(),e.returnValue=``)},[ye])),(0,Z.useEffect)(()=>{we.state===`blocked`&&(window.confirm(e===`zh`?`源码仍有错误。要放弃这些修改吗?`:`The source still has errors. Discard these changes?`)?we.proceed():we.reset())},[we,e]),(0,Z.useEffect)(()=>{let e=`${r?.mode??`new`}:${r?.name??a}:${r?.baseRevision??0}:${r?.repairPrompt??``}`;if(ie.current===e)return;ie.current=e,g(r?.name??a),v(structuredClone(r?.graph??kr())),fe(e=>e+1),x(structuredClone(r?.manifest??{title:m.untitled,description:``,tags:[`custom`]})),C(r?.graph.nodes.find(e=>e.kind===`agent`)?.id??`agent-1`),O(r?.repairPrompt??``),F(null),L(null),B(!!r),A(``),H(null),ee(r?.baseRevision??0),J([]),re(null),oe.current=void 0,se.current=void 0,G(`idle`),me(`canvas`);let t=tr(Qn(r?.name??a,r?.graph??kr(),r?.manifest??{title:m.untitled,description:``,tags:[`custom`]}));ce.current=t,ge(t),ve(e=>e+1),X(null),xe(null),Ce(null)},[m.untitled,r,a]),(0,Z.useEffect)(()=>{r?.mode===`edit`&&Ee(r.name).then(J).catch(()=>J([]))},[r?.mode,r?.name]),(0,Z.useEffect)(()=>{if(!h.trim())return;let e=!0,t=window.setTimeout(()=>{R(h,_,b).then(t=>{e&&H(t)}).catch(()=>{e&&H(null)})},350);return()=>{e=!1,window.clearTimeout(t)}},[_,b,h]),(0,Z.useEffect)(()=>{if(!h.trim())return;G(`saving`);let e=window.setTimeout(()=>{U({id:oe.current,workflowName:h,graph:_,manifest:b,baseRevision:q,expectedUpdatedAtMs:se.current}).then(e=>{oe.current=e.id,se.current=e.updatedAtMs,G(`saved`)}).catch(()=>G(`error`))},900);return()=>window.clearTimeout(e)},[q,_,b,h]);let Te=(0,Z.useMemo)(()=>jr(_,P?.graph??null),[_,P?.graph]),De=(0,Z.useMemo)(()=>{if(!P)return _;let e=new Set(P.graph.nodes.map(e=>e.id)),t=_.nodes.filter(t=>!e.has(t.id));return{...P.graph,nodes:[...P.graph.nodes,...t]}},[_,P]);(0,Z.useLayoutEffect)(()=>{T(e=>{let t=new Map(e.map(e=>[e.id,e]));return De.nodes.map(e=>({...t.get(e.id),...Dr(e,e.id===S,Te.nodeStates.get(e.id))}))})},[De.nodes,Te.nodeStates,S,T]),(0,Z.useEffect)(()=>{let e=ue.current;if(!e||De.nodes.length===0)return;let t=window.requestAnimationFrame(()=>{e.fitView(gr)});return()=>window.cancelAnimationFrame(t)},[De.nodes.length,de]);let Ae=(0,Z.useMemo)(()=>De.edges.map(Or),[De.edges]),je=_.nodes.find(e=>e.id===S)??null,Me=(0,Z.useMemo)(()=>new Set(o),[o]),Ne=r?.mode!==`edit`&&Me.has(h),Fe=Ne?mr(h,Me):h,Ie=V?.valid===!0&&!Ne&&!n&&!j&&ye===null,ze=e=>{if(!(e===pe||P)&&!(e===`canvas`&&ye)){if(e===`source`){let e=tr(Qn(h,_,b));ce.current=e,ge(e),ve(e=>e+1),X(null)}me(e)}},Ve=t=>{ce.current=t;let n=nr(t);if(!n.ok){X(n.error);return}if(r?.mode===`edit`&&n.document.name!==r.name){X(e===`zh`?`已发布工作流的内部名称不能修改。`:`The internal name of a published workflow cannot be changed.`);return}X(null),H(null),g(n.document.name),v(structuredClone(n.document.graph)),x(structuredClone(n.document.manifest)),C(e=>n.document.graph.nodes.some(t=>t.id===e)?e:n.document.graph.nodes.find(e=>e.kind===`agent`)?.id??``),fe(e=>e+1)},He=e=>{if(g(e),pe!==`source`)return;let t=nr(ce.current);if(!t.ok)return;let n=tr({...t.document,name:e});ce.current=n,ge(n),ve(e=>e+1),Ve(n)},We=e=>{let t=Kn(e);if(g(e.name),v(structuredClone(e.graph)),x(t),ee(e.revision),X(null),pe===`source`){let n=tr(Qn(e.name,e.graph,t));ce.current=n,ge(n),ve(e=>e+1)}},Ge=(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})},[]),Ke=(0,Z.useCallback)(e=>{let t=e.filter(e=>e.type!==`select`);t.length!==0&&v(e=>({...e,edges:Nt(t,e.edges.map(Or)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),qe=(0,Z.useCallback)(e=>{!e.source||!e.target||v(t=>({...t,edges:Ft({...e,id:`edge-${crypto.randomUUID()}`},t.edges.map(Or)).map(e=>({id:e.id,source:e.source,target:e.target,sourcePort:e.sourceHandle===`true`||e.sourceHandle===`false`?e.sourceHandle:void 0}))}))},[]),Je=(0,Z.useCallback)((e,t)=>{v(n=>({...n,nodes:n.nodes.map(n=>n.id===e?t(n):n)}))},[]),Ye=e=>{let t=`${e}-${crypto.randomUUID().slice(0,8)}`,n=Ar(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]}}),fe(e=>e+1),C(t)},Xe=()=>{!je||je.kind===`input`||je.kind===`output`||(v(e=>({...e,nodes:e.nodes.filter(e=>e.id!==je.id),edges:e.edges.filter(e=>e.source!==je.id&&e.target!==je.id)})),fe(e=>e+1),C(``))},Ze=(0,Z.useCallback)(async()=>{if(D.trim()){M(!0);try{let n=await Pe({prompt:D,agentId:t,language:e===`zh`?`zh`:`en`,mode:r||_.nodes.length>3?`improve`:`create`,existingGraph:_}),i=r?.mode===`edit`?r.name:mr(n.name,Me);L(i===n.name?null:n.name),F(i===n.name?n:{...n,name:i}),B(!0),fe(e=>e+1),C(n.graph.nodes.find(e=>e.kind===`agent`)?.id??``)}finally{M(!1)}}},[D,Me,_,r,e,t]);(0,Z.useEffect)(()=>{let e=r?.repairPrompt?.trim();!e||D.trim()!==e||j||P||ae.current===e||(ae.current=e,Ze())},[D,Ze,j,r?.repairPrompt,P]);let Qe=()=>{F(null),L(null),C(_.nodes.find(e=>e.kind===`agent`)?.id??``),fe(e=>e+1)},et=async()=>{if(!(!P||n||le.current)){le.current=!0;try{let e=await u({name:P.name,graph:P.graph,manifest:P.manifest,expectedRevision:q});if(!e)return;We(e),H(P.validation),F(null),L(null),O(``),C(e.graph.nodes.find(e=>e.kind===`agent`)?.id??``),oe.current&&await at(oe.current).catch(()=>void 0)}catch{}finally{le.current=!1}}},tt=async e=>{if(!Ie||le.current)return;le.current=!0;let t={name:h,graph:_,manifest:b,expectedRevision:q};try{if(e)await d({...t,goal:k.trim()||b.description||h});else{let e=await u(t);if(!e)return;We(e)}oe.current&&await at(oe.current).catch(()=>void 0)}catch{return}finally{le.current=!1}},nt=async e=>{if(!(Y!==null||r?.mode!==`edit`)){re(e);try{let t=await _t(r.name,e,q);We(t),fe(e=>e+1),C(t.graph.nodes.find(e=>e.kind===`agent`)?.id??``),J(await Ee(r.name))}finally{re(null)}}},rt=async t=>{if(!(be!==null||r?.mode!==`edit`)){xe(t);try{Ce({before:tr(Zn(await Re(r.name,t))),after:tr(Qn(h,_,b)),beforeLabel:`v${t}`,afterLabel:e===`zh`?`当前草稿 · v${q}`:`Current draft · v${q}`})}finally{xe(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)(l,{to:`/workflows`,className:y(`inline-flex size-9 shrink-0 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,ct.focusRingPanel),"aria-label":e===`zh`?`返回工作流`:`Back to workflows`,children:(0,$.jsx)(K,{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:r?.mode===`edit`?m.editTitle:m.createTitle}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:m.subtitle})]}),z?(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":pe===t,disabled:!!P||t===`canvas`&&!!ye,className:y(`rounded-md px-3 py-1.5 text-xs font-medium disabled:cursor-not-allowed disabled:opacity-50`,pe===t?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`),onClick:()=>ze(t),children:t===`canvas`?e===`zh`?`画布`:`Canvas`:e===`zh`?`源码`:`Source`},t))}):null,(0,$.jsx)(`span`,{className:y(`text-xs`,W===`error`?`text-danger`:`text-fg-subtle`),children:W===`saving`?m.savingDraft:W===`saved`?m.savedDraft:W===`error`?m.draftError:``})]}),c?(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:c.code===`WORKFLOW_NAME_EXISTS`?e===`zh`?`内部名称“${c.name}”已被使用。`:`The internal name “${c.name}” is already in use.`:e===`zh`?`这个工作流已更新到版本 ${c.currentRevision}。`:`This workflow has changed to revision ${c.currentRevision}.`}),c.code===`WORKFLOW_NAME_EXISTS`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(N,{variant:`secondary`,className:`h-8`,onClick:()=>{He(c.suggestedName),f()},children:e===`zh`?`使用 ${c.suggestedName}`:`Use ${c.suggestedName}`}),(0,$.jsx)(l,{className:`text-sm font-medium text-accent-fg hover:underline`,to:`/workflows/${encodeURIComponent(c.name)}`,children:e===`zh`?`打开已有工作流`:`Open existing`})]}):(0,$.jsx)(N,{variant:`secondary`,className:`h-8`,onClick:p,children:e===`zh`?`加载最新版本`:`Load latest`})]}):null,!c&&Ne?(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)(N,{variant:`secondary`,className:`h-8`,onClick:()=>He(Fe),children:e===`zh`?`使用 ${Fe}`:`Use ${Fe}`})]}):null,!c&&!Ne&&I&&P?(0,$.jsx)(`div`,{className:`shrink-0 border-b border-accent/20 bg-accent/5 px-4 py-2 text-sm text-fg-muted`,children:e===`zh`?`“${I}”已存在,方案将保存为“${P.name}”。`:`“${I}” already exists. This proposal will be saved as “${P.name}”.`}):null,z?(0,$.jsxs)($.Fragment,{children:[pe===`source`?(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start overflow-y-auto bg-surface-base p-4`,children:(0,$.jsx)(Jn,{initialSource:he,resetKey:_e,fileName:`${h||`workflow`}.workflow.json`,language:e,readOnly:!1,error:ye,onChange:Ve,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)(N,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!P,onClick:()=>Ye(`agent`),children:[(0,$.jsx)(Le,{className:`size-3.5`}),m.addAgent]}),(0,$.jsxs)(N,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!P,onClick:()=>Ye(`decision`),children:[(0,$.jsx)(Oe,{className:`size-3.5`}),m.addDecision]}),(0,$.jsxs)(N,{variant:`secondary`,className:`h-8 rounded-lg text-xs`,disabled:!!P,onClick:()=>Ye(`merge`),children:[(0,$.jsx)(ut,{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)(Rt,{"aria-label":m.flowAria,nodes:w,edges:Ae,nodeTypes:wr,onNodesChange:E,onEdgesChange:Ke,onConnect:qe,nodesDraggable:!P,nodesConnectable:!P,onNodeClick:(e,t)=>C(t.id),onNodeDragStart:(e,t)=>C(t.id),onNodeDragStop:(e,t)=>Ge(t),onInit:e=>{ue.current=e,window.requestAnimationFrame(()=>{e.fitView(gr)})},fitView:!0,fitViewOptions:gr,minZoom:.25,maxZoom:1.5,deleteKeyCode:null,proOptions:{hideAttribution:!0},children:[(0,$.jsx)(Vt,{color:`var(--color-edge)`,gap:22,size:1}),(0,$.jsx)(Lt,{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:P?(0,$.jsx)(yr,{proposal:P,diff:Te,copy:m,saving:n,onAccept:()=>void et(),onReject:Qe}):(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:b.title??``,onChange:e=>x(t=>({...t,title:e.target.value})),className:Er}),(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:b.description??``,onChange:e=>x(t=>({...t,description:e.target.value})),className:`${Er} 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:r?.mode===`edit`,onChange:e=>g(Pr(e.target.value)),className:`${Er} disabled:cursor-not-allowed disabled:opacity-60`}),Ne?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-danger`,children:e===`zh`?`该内部名称已被使用,请换一个名称。`:`This internal name is already in use.`}):null,r?.mode===`edit`&&ne.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)($e,{className:`size-3.5`}),m.versions,` · v`,q]}),(0,$.jsx)(`div`,{className:`mt-2 space-y-1`,children:ne.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,` · `,ke(t.createdAtMs,e)]}),t.revision===q?(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)(N,{variant:`ghost`,className:`h-7 px-2 text-xs`,disabled:be!==null,onClick:()=>void rt(t.revision),children:be===t.revision?e===`zh`?`加载中…`:`Loading…`:e===`zh`?`对比`:`Compare`}),(0,$.jsxs)(N,{variant:`ghost`,className:`h-7 px-2 text-xs`,disabled:Y!==null,onClick:()=>void nt(t.revision),children:[(0,$.jsx)(it,{className:`size-3`}),Y===t.revision?m.restoring:m.restore]})]})]},t.revision))})]}):null]})]}),(0,$.jsx)(`div`,{className:`my-4 border-t border-edge`}),je?(0,$.jsx)(Tr,{node:je,copy:m,updateNode:Je,onDelete:Xe}):(0,$.jsx)(`div`,{className:`py-8 text-center text-sm text-fg-muted`,children:m.selectNode}),V&&!V.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:V.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:[pe===`canvas`?(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,$.jsx)(te,{className:`size-4 shrink-0 text-accent-fg`}),(0,$.jsx)(jt,{value:D,onChange:e=>O(e.target.value),suggestion:Mt(m.aiPlaceholder),onAcceptSuggestion:O,onKeyDown:e=>{e.key===`Enter`&&Ze()},placeholder:m.aiPlaceholder,className:`${Er} mt-0 flex-1`}),(0,$.jsx)(N,{variant:`secondary`,className:`h-10 shrink-0`,disabled:!!P||j||!D.trim(),onClick:()=>void Ze(),children:j?m.designing:m.applyWithAi})]}):(0,$.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-fg-muted`,children:ye?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:k,onChange:e=>A(e.target.value),placeholder:m.testGoal,className:`${Er} mt-0 w-52`}),(0,$.jsxs)(N,{variant:`secondary`,disabled:!Ie,onClick:()=>void tt(!1),children:[(0,$.jsx)(Ue,{className:`size-4`}),m.publish]}),(0,$.jsxs)(N,{variant:`primary`,disabled:!Ie,onClick:()=>void tt(!0),children:[(0,$.jsx)(Be,{className:`size-4`}),m.publishAndRun]})]})]})})]}):(0,$.jsx)(vr,{copy:m,prompt:D,generating:j,onPromptChange:O,onGenerate:()=>void Ze(),onManual:()=>B(!0)}),(0,$.jsx)(dr,{comparison:Se,language:e,onClose:()=>Ce(null)})]})}function vr(e){let t=(0,Q.c)(42),{copy:n,prompt:r,generating:i,onPromptChange:a,onGenerate:o,onManual:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`div`,{className:`flex size-11 items-center justify-center rounded-2xl bg-accent-soft text-accent-fg`,children:(0,$.jsx)(te,{className:`size-5`})}),t[0]=c):c=t[0];let l;t[1]===n.introTitle?l=t[2]:(l=(0,$.jsx)(`h2`,{className:`mt-5 text-2xl font-semibold text-fg`,children:n.introTitle}),t[1]=n.introTitle,t[2]=l);let u;t[3]===n.introDescription?u=t[4]:(u=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:n.introDescription}),t[3]=n.introDescription,t[4]=u);let d;t[5]===a?d=t[6]:(d=e=>a(e.target.value),t[5]=a,t[6]=d);let f;t[7]===n.introPlaceholder?f=t[8]:(f=Mt(n.introPlaceholder),t[7]=n.introPlaceholder,t[8]=f);let p;t[9]!==n.introPlaceholder||t[10]!==a||t[11]!==r||t[12]!==d||t[13]!==f?(p=(0,$.jsx)(At,{value:r,onChange:d,suggestion:f,onAcceptSuggestion:a,placeholder:n.introPlaceholder,className:`${Er} mt-6 h-auto min-h-32 resize-y py-3 text-base leading-6`}),t[9]=n.introPlaceholder,t[10]=a,t[11]=r,t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;if(t[15]!==n.examples||t[16]!==a){let e;t[18]===a?e=t[19]:(e=e=>(0,$.jsx)(`button`,{type:`button`,className:`rounded-full border border-edge bg-surface-panel px-3 py-1.5 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:()=>a(e),children:e},e),t[18]=a,t[19]=e),m=n.examples.map(e),t[15]=n.examples,t[16]=a,t[17]=m}else m=t[17];let h;t[20]===m?h=t[21]:(h=(0,$.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:m}),t[20]=m,t[21]=h);let g;t[22]!==i||t[23]!==r?(g=!r.trim()||i,t[22]=i,t[23]=r,t[24]=g):g=t[24];let _;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(te,{className:`size-4`}),t[25]=_):_=t[25];let v=i?n.designing:n.designWorkflow,y;t[26]!==o||t[27]!==v||t[28]!==g?(y=(0,$.jsxs)(N,{variant:`primary`,disabled:g,onClick:o,children:[_,v]}),t[26]=o,t[27]=v,t[28]=g,t[29]=y):y=t[29];let b;t[30]!==n.manualStart||t[31]!==s?(b=(0,$.jsx)(N,{variant:`ghost`,onClick:s,children:n.manualStart}),t[30]=n.manualStart,t[31]=s,t[32]=b):b=t[32];let x;t[33]!==y||t[34]!==b?(x=(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center gap-3`,children:[y,b]}),t[33]=y,t[34]=b,t[35]=x):x=t[35];let S;return t[36]!==x||t[37]!==l||t[38]!==u||t[39]!==p||t[40]!==h?(S=(0,$.jsx)(`section`,{className:`flex min-h-0 flex-1 items-center justify-center overflow-y-auto bg-surface-base px-5 py-10`,children:(0,$.jsxs)(`div`,{className:`w-full max-w-2xl`,children:[c,l,u,p,h,x]})}),t[36]=x,t[37]=l,t[38]=u,t[39]=p,t[40]=h,t[41]=S):S=t[41],S}function yr(e){let t=(0,Q.c)(74),{proposal:n,diff:r,copy:i,saving:a,onAccept:o,onReject:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,$.jsx)(te,{className:`size-4`})}),t[0]=c):c=t[0];let l;t[1]===i.proposalTitle?l=t[2]:(l=(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i.proposalTitle}),t[1]=i.proposalTitle,t[2]=l);let d;t[3]===i.proposalHint?d=t[4]:(d=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i.proposalHint}),t[3]=i.proposalHint,t[4]=d);let f;t[5]!==l||t[6]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[c,(0,$.jsxs)(`div`,{className:`min-w-0`,children:[l,d]})]}),t[5]=l,t[6]=d,t[7]=f):f=t[7];let p=n.manifest.title||n.name,m;t[8]===p?m=t[9]:(m=(0,$.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:p}),t[8]=p,t[9]=m);let h=n.explanation||n.manifest.description,g;t[10]===h?g=t[11]:(g=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:h}),t[10]=h,t[11]=g);let _;t[12]===i.added?_=t[13]:(_=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.added}),t[12]=i.added,t[13]=_);let y;t[14]===r.addedIds.length?y=t[15]:(y=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-success`,children:r.addedIds.length}),t[14]=r.addedIds.length,t[15]=y);let b;t[16]!==y||t[17]!==_?(b=(0,$.jsxs)(`div`,{className:`rounded-lg bg-success-soft p-2`,children:[_,y]}),t[16]=y,t[17]=_,t[18]=b):b=t[18];let x;t[19]===i.changed?x=t[20]:(x=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.changed}),t[19]=i.changed,t[20]=x);let S=r.changedIds.length+r.connectionChanges,C;t[21]===S?C=t[22]:(C=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-accent-fg`,children:S}),t[21]=S,t[22]=C);let w;t[23]!==x||t[24]!==C?(w=(0,$.jsxs)(`div`,{className:`rounded-lg bg-accent-soft p-2`,children:[x,C]}),t[23]=x,t[24]=C,t[25]=w):w=t[25];let T;t[26]===i.removed?T=t[27]:(T=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.removed}),t[26]=i.removed,t[27]=T);let E;t[28]===r.removedIds.length?E=t[29]:(E=(0,$.jsx)(`dd`,{className:`mt-1 font-semibold text-danger`,children:r.removedIds.length}),t[28]=r.removedIds.length,t[29]=E);let D;t[30]!==T||t[31]!==E?(D=(0,$.jsxs)(`div`,{className:`rounded-lg bg-danger/5 p-2`,children:[T,E]}),t[30]=T,t[31]=E,t[32]=D):D=t[32];let O;t[33]!==b||t[34]!==w||t[35]!==D?(O=(0,$.jsxs)(`dl`,{className:`mt-3 grid grid-cols-3 gap-2 text-center text-xs`,children:[b,w,D]}),t[33]=b,t[34]=w,t[35]=D,t[36]=O):O=t[36];let k;t[37]!==O||t[38]!==m||t[39]!==g?(k=(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-base/50 p-3`,children:[m,g,O]}),t[37]=O,t[38]=m,t[39]=g,t[40]=k):k=t[40];let A;t[41]!==i.assumptions||t[42]!==n.assumptions?(A=n.assumptions.length?(0,$.jsx)(xr,{title:i.assumptions,items:n.assumptions}):null,t[41]=i.assumptions,t[42]=n.assumptions,t[43]=A):A=t[43];let j;t[44]!==i.risks||t[45]!==n.risks?(j=n.risks.length?(0,$.jsx)(xr,{title:i.risks,items:n.risks}):null,t[44]=i.risks,t[45]=n.risks,t[46]=j):j=t[46];let M;t[47]!==i.permissions||t[48]!==n.permissionsSummary?(M=n.permissionsSummary.length?(0,$.jsx)(xr,{title:i.permissions,items:n.permissionsSummary}):null,t[47]=i.permissions,t[48]=n.permissionsSummary,t[49]=M):M=t[49];let P;t[50]!==n.validation.errors||t[51]!==n.validation.valid?(P=n.validation.valid?null:(0,$.jsx)(`div`,{className:`mt-4 rounded-xl border border-danger/30 bg-danger/5 p-3 text-xs text-danger`,children:n.validation.errors.slice(0,4).map(br)}),t[50]=n.validation.errors,t[51]=n.validation.valid,t[52]=P):P=t[52];let F=a||!n.validation.valid,I;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(u,{className:`size-4`}),t[53]=I):I=t[53];let L=a?i.savingProposal:i.acceptAndSave,R;t[54]!==o||t[55]!==F||t[56]!==L?(R=(0,$.jsxs)(N,{variant:`primary`,disabled:F,onClick:o,children:[I,L]}),t[54]=o,t[55]=F,t[56]=L,t[57]=R):R=t[57];let z;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(v,{className:`size-4`}),t[58]=z):z=t[58];let B;t[59]!==i.rejectProposal||t[60]!==s||t[61]!==a?(B=(0,$.jsxs)(N,{variant:`ghost`,disabled:a,onClick:s,children:[z,i.rejectProposal]}),t[59]=i.rejectProposal,t[60]=s,t[61]=a,t[62]=B):B=t[62];let V;t[63]!==R||t[64]!==B?(V=(0,$.jsxs)(`div`,{className:`mt-5 grid gap-2`,children:[R,B]}),t[63]=R,t[64]=B,t[65]=V):V=t[65];let H;return t[66]!==k||t[67]!==A||t[68]!==j||t[69]!==M||t[70]!==P||t[71]!==V||t[72]!==f?(H=(0,$.jsxs)(`section`,{children:[f,k,A,j,M,P,V]}),t[66]=k,t[67]=A,t[68]=j,t[69]=M,t[70]=P,t[71]=V,t[72]=f,t[73]=H):H=t[73],H}function br(e){return(0,$.jsxs)(`p`,{children:[`• `,e.message]},`${e.code}:${e.message}`)}function xr(e){let t=(0,Q.c)(9),{title:n,items:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(`h3`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=r.slice(0,4).map(Sr),t[2]=r,t[3]=a);let o;t[4]===a?o=t[5]:(o=(0,$.jsx)(`ul`,{className:`mt-2 space-y-1 text-xs leading-5 text-fg-muted`,children:a}),t[4]=a,t[5]=o);let s;return t[6]!==i||t[7]!==o?(s=(0,$.jsxs)(`section`,{className:`mt-4`,children:[i,o]}),t[6]=i,t[7]=o,t[8]=s):s=t[8],s}function Sr(e){return(0,$.jsxs)(`li`,{children:[`• `,e]},e)}function Cr(e){let t=(0,Q.c)(34),{data:n,selected:r}=e,i=n.workflowNode,a=n.diffState,o;t[0]===i.kind?o=t[1]:(o=i.kind===`input`?(0,$.jsx)(Ye,{}):i.kind===`agent`?(0,$.jsx)(Le,{}):i.kind===`decision`?(0,$.jsx)(Oe,{}):i.kind===`merge`?(0,$.jsx)(ut,{}):(0,$.jsx)(Be,{}),t[0]=i.kind,t[1]=o);let s=o,c=r?`border-accent ring-2 ring-accent/20`:`border-edge`,l=a===`added`&&`border-success ring-2 ring-success/15`,u=a===`changed`&&`border-accent ring-2 ring-accent/15`,d=a===`removed`&&`border-dashed border-danger opacity-55`,f;t[2]!==c||t[3]!==l||t[4]!==u||t[5]!==d?(f=y(`w-52 rounded-xl border bg-surface-panel p-3 shadow-surface transition-colors`,c,l,u,d),t[2]=c,t[3]=l,t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;t[7]===i.kind?p=t[8]:(p=i.kind===`input`?null:(0,$.jsx)(zt,{type:`target`,position:It.Left,className:`!size-2.5 !border-2 !border-surface-panel !bg-fg-subtle`}),t[7]=i.kind,t[8]=p);let m;t[9]===s?m=t[10]:(m=(0,$.jsx)(`span`,{className:`mt-0.5 [&>svg]:size-4 text-accent-fg`,children:s}),t[9]=s,t[10]=m);let h;t[11]===i.title?h=t[12]:(h=(0,$.jsx)(`strong`,{className:`block truncate text-sm font-medium text-fg`,children:i.title}),t[11]=i.title,t[12]=h);let g;t[13]!==i.description||t[14]!==i.kind?(g=i.description||Fr(i.kind),t[13]=i.description,t[14]=i.kind,t[15]=g):g=t[15];let _;t[16]===g?_=t[17]:(_=(0,$.jsx)(`span`,{className:`mt-1 block line-clamp-2 text-xs leading-4 text-fg-muted`,children:g}),t[16]=g,t[17]=_);let v;t[18]!==_||t[19]!==h?(v=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[h,_]}),t[18]=_,t[19]=h,t[20]=v):v=t[20];let b;t[21]===a?b=t[22]:(b=a?(0,$.jsx)(`span`,{className:y(`rounded-full px-1.5 py-0.5 text-[10px] font-medium`,a===`added`?`bg-success-soft text-success`:a===`removed`?`bg-danger/10 text-danger`:`bg-accent-soft text-accent-fg`),children:a===`added`?`+`:a===`removed`?`−`:`Δ`}):null,t[21]=a,t[22]=b);let x;t[23]!==v||t[24]!==b||t[25]!==m?(x=(0,$.jsxs)(`div`,{className:`flex items-start gap-2`,children:[m,v,b]}),t[23]=v,t[24]=b,t[25]=m,t[26]=x):x=t[26];let S;t[27]===i.kind?S=t[28]:(S=i.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(zt,{id:`true`,type:`source`,position:It.Right,style:{top:`38%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-success`}),(0,$.jsx)(zt,{id:`false`,type:`source`,position:It.Right,style:{top:`70%`},className:`!size-2.5 !border-2 !border-surface-panel !bg-danger`})]}):i.kind===`output`?null:(0,$.jsx)(zt,{type:`source`,position:It.Right,className:`!size-2.5 !border-2 !border-surface-panel !bg-accent`}),t[27]=i.kind,t[28]=S);let C;return t[29]!==x||t[30]!==S||t[31]!==f||t[32]!==p?(C=(0,$.jsxs)(`div`,{className:f,children:[p,x,S]}),t[29]=x,t[30]=S,t[31]=f,t[32]=p,t[33]=C):C=t[33],C}var wr={workflow:Cr};function Tr(e){let t=(0,Q.c)(71),{node:n,copy:r,updateNode:i,onDelete:a}=e,o;t[0]!==n.id||t[1]!==i?(o=e=>i(n.id,t=>({...t,...e})),t[0]=n.id,t[1]=i,t[2]=o):o=t[2];let s=o,c;t[3]!==n.id||t[4]!==i?(c=e=>i(n.id,t=>({...t,config:{...t.config,...e}})),t[3]=n.id,t[4]=i,t[5]=c):c=t[5];let l=c,u;t[6]===r.stepSettings?u=t[7]:(u=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.stepSettings}),t[6]=r.stepSettings,t[7]=u);let d;t[8]!==r.remove||t[9]!==n.kind||t[10]!==a?(d=n.kind!==`input`&&n.kind!==`output`?(0,$.jsxs)(N,{variant:`ghost`,className:`h-8 px-2 text-danger`,onClick:a,children:[(0,$.jsx)(We,{className:`size-3.5`}),r.remove]}):null,t[8]=r.remove,t[9]=n.kind,t[10]=a,t[11]=d):d=t[11];let f;t[12]!==u||t[13]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[u,d]}),t[12]=u,t[13]=d,t[14]=f):f=t[14];let m;t[15]===r.stepName?m=t[16]:(m=(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-title`,children:r.stepName}),t[15]=r.stepName,t[16]=m);let h;t[17]===s?h=t[18]:(h=e=>s({title:e.target.value}),t[17]=s,t[18]=h);let g;t[19]!==n.title||t[20]!==h?(g=(0,$.jsx)(`input`,{id:`node-title`,value:n.title,onChange:h,className:Er}),t[19]=n.title,t[20]=h,t[21]=g):g=t[21];let _;t[22]===r.stepPurpose?_=t[23]:(_=(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-description`,children:r.stepPurpose}),t[22]=r.stepPurpose,t[23]=_);let v=n.description??``,y;t[24]===s?y=t[25]:(y=e=>s({description:e.target.value}),t[24]=s,t[25]=y);let b;t[26]!==v||t[27]!==y?(b=(0,$.jsx)(`textarea`,{id:`node-description`,value:v,onChange:y,className:`${Er} min-h-16 resize-y`}),t[26]=v,t[27]=y,t[28]=b):b=t[28];let x;t[29]!==r.advanced||t[30]!==r.defaultModel||t[31]!==r.instructions||t[32]!==r.model||t[33]!==n.config||t[34]!==n.kind||t[35]!==l?(x=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:r.advanced}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-prompt`,children:r.instructions}),(0,$.jsx)(`textarea`,{id:`node-prompt`,value:String(n.config.prompt??``),onChange:e=>l({prompt:e.target.value}),className:`${Er} min-h-36 resize-y`}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`node-model`,children:r.model}),(0,$.jsx)(`input`,{id:`node-model`,value:String(n.config.model??``),onChange:e=>l({model:e.target.value||void 0}),placeholder:r.defaultModel,className:Er})]})}):null,t[29]=r.advanced,t[30]=r.defaultModel,t[31]=r.instructions,t[32]=r.model,t[33]=n.config,t[34]=n.kind,t[35]=l,t[36]=x):x=t[36];let S;t[37]!==r.compareValue||t[38]!==r.condition||t[39]!==r.contains||t[40]!==r.equals||t[41]!==r.exists||t[42]!==r.notEquals||t[43]!==r.valuePath||t[44]!==n.config||t[45]!==n.kind||t[46]!==l?(S=n.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`decision-path`,children:r.valuePath}),(0,$.jsx)(`input`,{id:`decision-path`,value:n.config.rule?.path??``,onChange:e=>l({rule:{...n.config.rule??{operator:`exists`},path:e.target.value}}),placeholder:`result.approved`,className:Er}),(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,id:`decision-operator-label`,children:r.condition}),(0,$.jsx)(p,{value:n.config.rule?.operator??`exists`,placeholder:r.condition,allowEmpty:!1,ariaLabelledBy:`decision-operator-label`,options:[{value:`exists`,label:r.exists},{value:`equals`,label:r.equals},{value:`not_equals`,label:r.notEquals},{value:`contains`,label:r.contains}],onChange:e=>l({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:r.compareValue}),(0,$.jsx)(`input`,{id:`decision-value`,value:String(n.config.rule?.value??``),onChange:e=>l({rule:{...n.config.rule,value:e.target.value}}),className:Er})]})]}):null,t[37]=r.compareValue,t[38]=r.condition,t[39]=r.contains,t[40]=r.equals,t[41]=r.exists,t[42]=r.notEquals,t[43]=r.valuePath,t[44]=n.config,t[45]=n.kind,t[46]=l,t[47]=S):S=t[47];let C;t[48]!==r.combineAs||t[49]!==r.listResults||t[50]!==r.namedResults||t[51]!==n.config||t[52]!==n.kind||t[53]!==l?(C=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:r.combineAs}),(0,$.jsx)(p,{value:String(n.config.mode??`object`),placeholder:r.combineAs,allowEmpty:!1,ariaLabelledBy:`merge-mode-label`,options:[{value:`object`,label:r.namedResults},{value:`array`,label:r.listResults}],onChange:e=>l({mode:e})})]}):null,t[48]=r.combineAs,t[49]=r.listResults,t[50]=r.namedResults,t[51]=n.config,t[52]=n.kind,t[53]=l,t[54]=C):C=t[54];let w;t[55]!==r.autoSummary||t[56]!==r.summaryTemplate||t[57]!==n.config||t[58]!==n.kind||t[59]!==l?(w=n.kind===`output`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`label`,{className:`mt-3 block text-xs font-medium text-fg`,htmlFor:`output-summary`,children:r.summaryTemplate}),(0,$.jsx)(`textarea`,{id:`output-summary`,value:String(n.config.summary??``),onChange:e=>l({summary:e.target.value||void 0}),placeholder:r.autoSummary,className:`${Er} min-h-20 resize-y`})]}):null,t[55]=r.autoSummary,t[56]=r.summaryTemplate,t[57]=n.config,t[58]=n.kind,t[59]=l,t[60]=w):w=t[60];let T;return t[61]!==b||t[62]!==x||t[63]!==S||t[64]!==C||t[65]!==w||t[66]!==f||t[67]!==m||t[68]!==g||t[69]!==_?(T=(0,$.jsxs)(`section`,{children:[f,m,g,_,b,x,S,C,w]}),t[61]=b,t[62]=x,t[63]=S,t[64]=C,t[65]=w,t[66]=f,t[67]=m,t[68]=g,t[69]=_,t[70]=T):T=t[70],T}var Er=`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 Dr(e,t=!1,n){return{id:e.id,type:`workflow`,position:e.position,selected:t,data:{workflowNode:e,diffState:n}}}function Or(e){return{id:e.id,source:e.source,target:e.target,sourceHandle:e.sourcePort===`true`||e.sourcePort===`false`?e.sourcePort:void 0,markerEnd:{type:Pt.ArrowClosed},style:{stroke:`var(--color-fg-subtle)`,strokeWidth:1.5}}}function kr(){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 Ar(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 jr(e,t){let n=new Map;if(!t)return{addedIds:[],changedIds:[],removedIds:[],connectionChanges:0,nodeStates:n};let r=new Map(e.nodes.map(e=>[e.id,e])),i=new Map(t.nodes.map(e=>[e.id,e])),a=t.nodes.filter(e=>!r.has(e.id)).map(e=>e.id),o=e.nodes.filter(e=>!i.has(e.id)).map(e=>e.id),s=t.nodes.filter(e=>{let t=r.get(e.id);return t?Mr(t)!==Mr(e):!1}).map(e=>e.id);a.forEach(e=>n.set(e,`added`)),s.forEach(e=>n.set(e,`changed`)),o.forEach(e=>n.set(e,`removed`));let c=new Set(e.edges.map(Nr)),l=new Set(t.edges.map(Nr));return{addedIds:a,changedIds:s,removedIds:o,connectionChanges:e.edges.filter(e=>!l.has(Nr(e))).length+t.edges.filter(e=>!c.has(Nr(e))).length,nodeStates:n}}function Mr(e){let{position:t,...n}=e;return JSON.stringify(n)}function Nr(e){return`${e.source}:${e.sourcePort??``}->${e.target}`}function Pr(e){return e.toLowerCase().replace(/[^a-z0-9_-]+/g,`_`).replace(/^_+/,``)}function Fr(e){return{input:`User input`,agent:`AI step`,decision:`Decision`,merge:`Combine`,output:`User result`}[e]}function Ir(e){return e===`zh`?{untitled:`未命名工作流`,editTitle:`编辑工作流`,createTitle:`创建工作流`,subtitle:`描述目标、确认方案,然后用示例测试。无需编写代码。`,close:`关闭`,savingDraft:`正在保存草稿…`,savedDraft:`草稿已保存`,draftError:`草稿保存失败`,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:`让 AI 提出修改`,testGoal:`用什么例子测试?`,publish:`保存`,publishAndRun:`保存并测试`,introTitle:`你希望这个工作流持续帮你完成什么?`,introDescription:`直接描述最终目标。AI 会先给出一份可理解的步骤方案,只有你确认后才会保存。`,introPlaceholder:`例如:每周整理项目进展,识别风险,并生成一份可以发给团队的周报。`,examples:[`研究一个主题并给出可靠结论`,`评审需求并生成实现计划`,`分析问题、定位原因并给出修复建议`],designWorkflow:`生成方案`,manualStart:`高级:手动搭建`,proposalTitle:`AI 提出的方案`,proposalHint:`绿色是新增,蓝色是修改,红色虚线是删除。确认前不会改变现有工作流。`,added:`新增`,changed:`修改`,removed:`删除`,assumptions:`方案假设`,risks:`需要留意`,permissions:`需要的权限`,acceptAndSave:`采用并保存`,savingProposal:`正在保存…`,rejectProposal:`不采用,返回修改`}:{untitled:`Untitled workflow`,editTitle:`Edit workflow`,createTitle:`Create workflow`,subtitle:`Describe the task, review the plan, then test it with an example. No code required.`,close:`Close`,savingDraft:`Saving draft…`,savedDraft:`Draft saved`,draftError:`Draft could not be saved`,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:`Designing…`,applyWithAi:`Ask AI to propose changes`,testGoal:`What example should we test?`,publish:`Save`,publishAndRun:`Save & test`,introTitle:`What should this workflow keep doing for you?`,introDescription:`Describe the task in plain language. AI will propose an understandable plan and will not save anything until you approve it.`,introPlaceholder:`For example: summarize project progress every week, identify risks, and produce a team-ready update.`,examples:[`Research a topic and deliver a reliable conclusion`,`Review a request and produce an implementation plan`,`Analyze an issue, find the cause, and recommend a fix`],designWorkflow:`Generate plan`,manualStart:`Advanced: build manually`,proposalTitle:`AI proposal`,proposalHint:`Green is added, blue is changed, and dashed red is removed. Nothing changes until you approve.`,added:`Added`,changed:`Changed`,removed:`Removed`,assumptions:`Assumptions`,risks:`Things to check`,permissions:`Required access`,acceptAndSave:`Accept & save`,savingProposal:`Saving…`,rejectProposal:`Reject and revise`}}function Lr(e){let t=(0,Q.c)(25),{projectId:n,language:r,value:i,onChange:a}=e,o=S(r).workflows,s=S(r).projectDetailPage.board.operationalStates,c;t[0]===n?c=t[1]:(c=n?[`workflow-context-project`,n]:null,t[0]=n,t[1]=c);let l;t[2]===n?l=t[3]:(l=()=>nt(n),t[2]=n,t[3]=l);let u;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(u={revalidateOnFocus:!1},t[4]=u):u=t[4];let d=M(c,l,u),f;t[5]===n?f=t[6]:(f=n?[`workflow-context-notes`,n]:null,t[5]=n,t[6]=f);let p;t[7]===n?p=t[8]:(p=()=>I({projectId:n,limit:100,sortBy:`updatedAt`,sortOrder:`desc`}),t[7]=n,t[8]=p);let m;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(m={revalidateOnFocus:!1},t[9]=m):m=t[9];let h=M(f,p,m),g;t[10]!==a||t[11]!==i?(g=e=>{a(i.some(t=>t.kind===e.kind&&t.id===e.id)?i.filter(t=>t.kind!==e.kind||t.id!==e.id):[...i,e])},t[10]=a,t[11]=i,t[12]=g):g=t[12];let y=g,b;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(_,{className:`size-3.5`,"aria-hidden":!0}),t[13]=b):b=t[13];let x;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(C,{className:`xopc-dialog-overlay fixed inset-0 z-50 bg-scrim backdrop-blur-[2px]`}),t[14]=x):x=t[14];let j;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(v,{className:`size-4`}),t[15]=j):j=t[15];let P=d.isLoading||h.isLoading?(0,$.jsx)(`div`,{className:`grid gap-3`,children:Array.from({length:6},Rr)}):d.error||h.error?(0,$.jsx)(`p`,{className:`rounded-xl border border-danger/30 bg-danger/5 p-4 text-sm text-danger`,children:o.contextPickerLoadFailed}):(0,$.jsxs)(`div`,{className:`space-y-6`,children:[(0,$.jsx)(zr,{title:o.contextTasks,icon:be,empty:o.contextTasksEmpty,items:(d.data?.tasks??[]).map(e=>({id:e.id,title:e.title,subtitle:s[e.operationalState]})),selected:i,kind:`task`,onToggle:y}),(0,$.jsx)(zr,{title:o.contextNotes,icon:Ke,empty:o.contextNotesEmpty,items:(h.data?.items??[]).map(e=>({id:e.id,title:e.title||o.contextUntitled,subtitle:e.snippet})),selected:i,kind:`note`,onToggle:y})]}),F;t[16]===P?F=t[17]:(F=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:P}),t[16]=P,t[17]=F);let L=o.contextPickerCount.replace(`{{count}}`,String(i.length)),R;t[18]===L?R=t[19]:(R=(0,$.jsx)(`span`,{className:`text-xs text-fg-muted`,children:L}),t[18]=L,t[19]=R);let z;t[20]===o.contextPickerDone?z=t[21]:(z=(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(N,{type:`button`,variant:`primary`,className:`h-9`,children:o.contextPickerDone})}),t[20]=o.contextPickerDone,t[21]=z);let B;return t[22]!==R||t[23]!==z?(B=(0,$.jsxs)(`footer`,{className:`flex shrink-0 items-center justify-between border-t border-edge px-5 py-3`,children:[R,z]}),t[22]=R,t[23]=z,t[24]=B):B=t[24],(0,$.jsxs)(A,{children:[(0,$.jsx)(w,{asChild:!0,children:(0,$.jsxs)(N,{type:`button`,variant:`secondary`,className:`h-9 w-full justify-between rounded-lg px-3 text-xs`,disabled:!n,children:[(0,$.jsx)(`span`,{children:o.contextPickerLabel}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1 text-fg-muted`,children:[i.length?o.contextPickerCount.replace(`{{count}}`,String(i.length)):o.contextPickerEmpty,b]})]})}),(0,$.jsxs)(D,{children:[x,(0,$.jsxs)(O,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-50 flex h-[min(42rem,calc(100vh-2rem))] w-[min(44rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-xl`,children:[(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(k,{className:`text-base font-semibold text-fg`,children:o.contextPickerTitle}),(0,$.jsx)(T,{className:`mt-1 text-xs text-fg-muted`,children:o.contextPickerDescription})]}),(0,$.jsx)(E,{asChild:!0,children:(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`size-8 p-0`,"aria-label":o.pickStartClose,children:j})})]}),F,B]})]})]})}function Rr(e,t){return(0,$.jsx)(P,{className:`h-14 rounded-xl`},t)}function zr(e){let t=(0,Q.c)(14),{title:n,icon:r,empty:i,items:a,selected:o,kind:s,onToggle:c}=e,l;t[0]===r?l=t[1]:(l=(0,$.jsx)(r,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),t[0]=r,t[1]=l);let d;t[2]!==l||t[3]!==n?(d=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[l,n]}),t[2]=l,t[3]=n,t[4]=d):d=t[4];let f;t[5]!==i||t[6]!==a||t[7]!==s||t[8]!==c||t[9]!==o?(f=a.length?(0,$.jsx)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:a.map(e=>{let t=o.some(t=>t.kind===s&&t.id===e.id);return(0,$.jsxs)(`button`,{type:`button`,className:y(`flex min-w-0 items-start gap-3 rounded-xl border p-3 text-left`,t?`border-accent bg-accent-soft`:`border-edge-subtle hover:bg-surface-hover`),"aria-pressed":t,onClick:()=>c({kind:s,id:e.id,role:s===`task`?`objective`:`reference`,title:e.title}),children:[(0,$.jsx)(`span`,{className:y(`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border`,t?`border-accent bg-accent text-on-accent`:`border-edge`),children:t?(0,$.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}):null}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[(0,$.jsx)(`strong`,{className:`block truncate text-sm font-medium text-fg`,children:e.title}),e.subtitle?(0,$.jsx)(`span`,{className:`mt-0.5 line-clamp-2 block text-xs text-fg-muted`,children:e.subtitle}):null]})]},e.id)})}):(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i}),t[5]=i,t[6]=a,t[7]=s,t[8]=c,t[9]=o,t[10]=f):f=t[10];let p;return t[11]!==d||t[12]!==f?(p=(0,$.jsxs)(`section`,{children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13],p}function Br(e){let t=(0,Q.c)(54),{graph:n,language:r,className:i}=e,a;t[0]===r?a=t[1]:(a=Gr(r),t[0]=r,t[1]=a);let o=a,[s,c]=(0,Z.useState)(n.nodes.find(Vr)?.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:Pt.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,b;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=y(`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]:(_=y(`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,x,S;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(d={hideAttribution:!0},x=(0,$.jsx)(Vt,{color:`var(--color-edge)`,gap:22,size:1}),S=(0,$.jsx)(Lt,{showInteractive:!1,className:`!border-edge !bg-surface-panel !shadow-surface`}),t[40]=d,t[41]=x,t[42]=S):(d=t[40],x=t[41],S=t[42]),t[43]!==f||t[44]!==u?(b=(0,$.jsx)(`div`,{className:`h-[22rem] min-h-72`,children:(0,$.jsxs)(Rt,{nodes:u,edges:f,nodeTypes:Wr,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,onNodeClick:a,fitView:!0,fitViewOptions:l,minZoom:.3,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:d,children:[x,S]})}),t[43]=f,t[44]=u,t[45]=b):b=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:Ur(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]=b}else m=t[23],h=t[24],g=t[25],_=t[26],v=t[27],b=t[28];if(m!==Symbol.for(`react.early_return_sentinel`))return m;let x;t[46]!==h||t[47]!==g?(x=(0,$.jsx)(`div`,{className:h,children:g}),t[46]=h,t[47]=g,t[48]=x):x=t[48];let S;return t[49]!==x||t[50]!==_||t[51]!==v||t[52]!==b?(S=(0,$.jsxs)(`section`,{className:_,"aria-label":v,children:[b,x]}),t[49]=x,t[50]=_,t[51]=v,t[52]=b,t[53]=S):S=t[53],S}function Vr(e){return e.kind===`agent`}function Hr(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=y(`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)(zt,{type:`target`,position:It.Left,className:`!invisible`}),t[2]=i.kind,t[3]=s);let c;t[4]===i.kind?c=t[5]:(c=Ur(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)(zt,{id:`true`,type:`source`,position:It.Right,style:{top:`38%`},className:`!invisible`}),(0,$.jsx)(zt,{id:`false`,type:`source`,position:It.Right,style:{top:`70%`},className:`!invisible`})]}):i.kind===`output`?null:(0,$.jsx)(zt,{type:`source`,position:It.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 Ur(e){return e===`input`?(0,$.jsx)(Ye,{className:`size-4`,"aria-hidden":!0}):e===`agent`?(0,$.jsx)(Le,{className:`size-4`,"aria-hidden":!0}):e===`decision`?(0,$.jsx)(Oe,{className:`size-4`,"aria-hidden":!0}):e===`merge`?(0,$.jsx)(ut,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(Be,{className:`size-4`,"aria-hidden":!0})}var Wr={definitionNode:Hr};function Gr(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 Kr(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=ti(i),t[0]=i,t[1]=d);let f=d,p;t[2]===r.nodes?p=t[3]:(p=new Map(r.nodes.map(Zr)),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:Pt.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=_,b;t[14]!==o||t[15]!==m?(b=o?m.get(o):void 0,t[14]=o,t[15]=m,t[16]=b):b=t[16];let x=b,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(Xr),t[20]=r.nodes,t[21]=w);let T=w,E,D;t[22]===r.nodes?(E=t[23],D=t[24]):(E=()=>{let e=r.nodes.find(Yr)??r.nodes.find(Jr)??[...r.nodes].reverse().find(qr);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)},D=[r.nodes],t[22]=r.nodes,t[23]=E,t[24]=D),(0,Z.useEffect)(E,D);let O;t[25]===f.title?O=t[26]:(O=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:f.title}),t[25]=f.title,t[26]=O);let k;t[27]===f.hint?k=t[28]:(k=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:f.hint}),t[27]=f.hint,t[28]=k);let A;t[29]!==O||t[30]!==k?(A=(0,$.jsxs)(`div`,{children:[O,k]}),t[29]=O,t[30]=k,t[31]=A):A=t[31];let j;t[32]!==f.repair||t[33]!==T||t[34]!==a?(j=T&&a?(0,$.jsxs)(N,{variant:`secondary`,className:`h-8 text-xs`,onClick:a,children:[(0,$.jsx)(it,{className:`size-3.5`}),f.repair]}):null,t[32]=f.repair,t[33]=T,t[34]=a,t[35]=j):j=t[35];let M;t[36]!==A||t[37]!==j?(M=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[A,j]}),t[36]=A,t[37]=j,t[38]=M):M=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,L;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(I={hideAttribution:!0},L=(0,$.jsx)(Vt,{color:`var(--color-edge)`,gap:22,size:1}),t[41]=I,t[42]=L):(I=t[41],L=t[42]);let R;t[43]!==v||t[44]!==g?(R=(0,$.jsx)(`div`,{className:`h-[28rem]`,children:(0,$.jsx)(Rt,{nodes:g,edges:v,nodeTypes:ei,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!0,onNodeClick:P,onInit:F,fitView:!0,minZoom:.3,maxZoom:1.25,panOnScroll:!0,zoomOnDoubleClick:!1,proOptions:I,children:L})}),t[43]=v,t[44]=g,t[45]=R):R=t[45];let B;t[46]!==f.status||t[47]!==x||t[48]!==C?(B=x?(0,$.jsxs)(`div`,{className:y(`flex items-start gap-2 border-t border-edge px-4 py-3 text-xs`,x.status===`error`?`text-danger`:`text-fg-muted`),children:[x.status===`error`?(0,$.jsx)(z,{className:`mt-0.5 size-3.5 shrink-0`}):x.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:x.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:x.error||x.resultPreview||f.status[x.status]})]})]}):null,t[46]=f.status,t[47]=x,t[48]=C,t[49]=B):B=t[49];let V;return t[50]!==M||t[51]!==R||t[52]!==B?(V=(0,$.jsxs)(`section`,{className:`mt-5 overflow-hidden rounded-2xl border border-edge bg-surface-base/35`,children:[M,R,B]}),t[50]=M,t[51]=R,t[52]=B,t[53]=V):V=t[53],V}function qr(e){return e.status===`done`}function Jr(e){return e.status===`error`}function Yr(e){return e.status===`running`}function Xr(e){return e.status===`error`}function Zr(e){return[e.id,e]}function Qr(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)(Ye,{}):i.kind===`agent`?(0,$.jsx)(Le,{}):i.kind===`decision`?(0,$.jsx)(Oe,{}):i.kind===`merge`?(0,$.jsx)(ut,{}):(0,$.jsx)(Be,{}),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=y(`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)(zt,{type:`target`,position:It.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)($r,{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 b;t[20]===i.description?b=t[21]:(b=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]=b);let x;t[22]===i.kind?x=t[23]:(x=i.kind===`decision`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(zt,{id:`true`,type:`source`,position:It.Right,className:`!invisible`}),(0,$.jsx)(zt,{id:`false`,type:`source`,position:It.Right,className:`!invisible`})]}):i.kind===`output`?null:(0,$.jsx)(zt,{type:`source`,position:It.Right,className:`!invisible`}),t[22]=i.kind,t[23]=x);let S;return t[24]!==v||t[25]!==b||t[26]!==x||t[27]!==p||t[28]!==m?(S=(0,$.jsxs)(`div`,{className:p,children:[m,v,b,x]}),t[24]=v,t[25]=b,t[26]=x,t[27]=p,t[28]=m,t[29]=S):S=t[29],S}function $r(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)(z,{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 ei={runNode:Qr};function ti(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 ni(e,t){return t.status[e]??e}function ri(e,t){return t.phaseStatus[e]??e}function ii(e,t){let{run:n}=e;return n.status===`succeeded`?_e(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:_e(t.runSummaryActive,{done:n.metrics.doneAgentCount,total:n.metrics.agentCount})}function ai(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 oi(e){return Y(e)}function si({view:e,comparison:t,loading:n,language:r,localeTag:i,activeTab:o,onTabChange:s,onCancel:c,onRetry:l,onReplay:d,onOpenRunId:f,ownerAgentId:p,onRepairWorkflow:_}){let v=S(r).workflows,b=ee(r),x=a(),[C,w]=(0,Z.useState)(!1),[T,E]=(0,Z.useState)(!1),[D,O]=(0,Z.useState)(null),[k,A]=(0,Z.useState)(!1),[M,F]=(0,Z.useState)(null),[I,L]=(0,Z.useState)(null),[,R]=(0,Z.useState)(0),z=e?.run.status,V=z?ae.has(z):!1;(0,Z.useEffect)(()=>{e?.run.id&&(w(!1),F(null))},[e?.run.id,V,z,e?.run.metrics.errorAgentCount]),(0,Z.useEffect)(()=>{if(!V)return;let e=window.setInterval(()=>R(e=>e+1),1e3);return()=>window.clearInterval(e)},[V]);let H=(0,Z.useMemo)(()=>e?mt(e):null,[e]),U=(0,Z.useMemo)(()=>H?ze(H):{phases:[],unphased:null},[H]),W=(0,Z.useMemo)(()=>D==null||!H?null:H.agents.find(e=>e.id===D)??null,[D,H]);(0,Z.useEffect)(()=>{H?.runId&&O((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=>{O(e.id)},[]),K=(0,Z.useMemo)(()=>e?se(e):[],[e]),te=e?ge(e.run.result):void 0,J=te?ki(te):null,Y=te?st(te):``,re=!!te,ie=(0,Z.useCallback)(async()=>{re&&await j(Y)&&(A(!0),window.setTimeout(()=>A(!1),1500))},[re,Y]),ce=(0,Z.useCallback)(()=>{if(!re||!e)return;let t=new Blob([Y],{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,Y,e]),le=(0,Z.useCallback)(()=>{if(!e)return;let t=oi(e);t&&x(oe(t))},[x,e]),ue=(0,Z.useCallback)(async t=>{if(e){F(null),L(t.id);try{Di(await Xe(e.run.id,t.id,{ownerAgentId:p}),t.name||t.id)}catch(e){F(e instanceof Error?e.message:String(e))}finally{L(null)}}},[p,e]),de=(0,Z.useCallback)(t=>{if(!e||!t.prompt)return;let n=oi(e);if(!n){j(t.prompt);return}x(oe(n,t.prompt))},[x,e]),fe=(0,Z.useCallback)(e=>{if(e.kind===`copy_result`){ie();return}if(e.kind===`open_artifact`){let t=ji(e.payload),n=J?.artifacts.find(e=>e.id===t||e.name===t);n&&ue(n);return}let t=ji(e.payload),n=J?.followUps.find(e=>e.id===t);if(n?.prompt){de(n);return}let r=Mi(e.payload);r&&de({id:e.id,title:e.label,prompt:r})},[ie,ue,de,J?.artifacts,J?.followUps]),me=(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);O(Number.isFinite(i)?i:r+1)},[e]),he=e?oi(e):null,ve=J?.actions.filter(e=>Ni(e,J))??[],ye=ve.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)(P,{className:`h-8 w-72 max-w-full`}),(0,$.jsx)(P,{className:`mt-4 h-28 rounded-2xl`}),(0,$.jsx)(P,{className:`mt-5 h-[28rem] rounded-2xl`})]})});if(!e||!H)return null;let{run:X}=e,be=e.controls.canCancel&&V,xe=V&&X.startedAtMs!=null?Ct(Date.now()-X.startedAtMs):Ct(X.metrics.durationMs??void 0),Se=ii(e,v),Ce=ai(e,v),we=e.controls.canRetry&&e.agents.some(e=>(e.status===`error`||e.status===`skipped`)&&e.prompt?.trim()),Te=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())),Ee=X.goal?.trim()||X.title,De=e.nodes.find(e=>e.status===`running`)??e.nodes.find(e=>e.status===`error`)??[...e.nodes].reverse().find(e=>e.status===`done`),Oe=De?.kind===`output`&&!De.error?te?.summary??De.resultPreview:null,ke=Oe??(De?De.error||(r===`zh`?`${De.status===`running`?`正在执行`:De.status===`done`?`刚刚完成`:`需要处理`}:${De.title}`:`${De.status===`running`?`Working on`:De.status===`done`?`Just completed`:`Needs attention`}: ${De.title}`):Se),Ae=K.length>0||!!Ce,Ne=(X.status===`failed`||X.status===`timeout`)&&!!_;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:Ee}),(0,$.jsx)(`span`,{className:y(`rounded-full px-2 py-0.5 text-xs font-medium`,ne(X.status)),children:ni(X.status,v)})]}),(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:Se}),Ce?(0,$.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-subtle`,children:Ce}):null,(0,$.jsxs)(`div`,{className:y(`mt-4 rounded-xl border px-3 py-2.5`,De?.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`}),Oe?(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)(g,{content:ke,compact:!0,className:`workflow-status-markdown`,codeCopy:!1,renderMermaid:!1})}):(0,$.jsx)(`p`,{className:`mt-1 text-sm font-medium text-fg`,children:ke})]})]})}),(0,$.jsxs)(`dl`,{className:`mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,$.jsx)(Ri,{label:v.metrics.startedAt,value:B(X.startedAtMs??X.createdAtMs,i)}),(0,$.jsx)(Ri,{label:v.metrics.duration,value:xe}),(0,$.jsx)(Ri,{label:v.metrics.agents,value:_e(v.agentProgress,{done:X.metrics.doneAgentCount,total:X.metrics.agentCount})}),(0,$.jsx)(Ri,{label:v.metrics.artifacts,value:String(X.metrics.artifactCount)})]})]}),(0,$.jsx)(li,{activeTab:o,onChange:s,labels:v,artifactCount:J?.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:v.resultTitle}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:v.resultReadyHint})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[he?(0,$.jsxs)(N,{variant:`primary`,className:`h-8 text-xs`,onClick:le,children:[(0,$.jsx)(q,{className:`size-3.5`,"aria-hidden":!0}),v.continueInChat]}):null,ve.map(e=>(0,$.jsx)(N,{variant:`secondary`,className:`h-8 text-xs`,onClick:()=>fe(e),children:e.label},e.id)),ye?null:(0,$.jsxs)(N,{variant:`secondary`,className:`h-8 text-xs`,onClick:ie,children:[k?(0,$.jsx)(u,{className:`size-3.5`,"aria-hidden":!0}):(0,$.jsx)(m,{className:`size-3.5`,"aria-hidden":!0}),k?v.copied:v.copyResult]}),(0,$.jsxs)(N,{variant:`secondary`,className:`h-8 text-xs`,onClick:ce,children:[(0,$.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),v.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)(je,{result:te,labels:b.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:v.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:v.recoveryActionsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:Ce})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Ne?(0,$.jsxs)(N,{variant:`primary`,onClick:_,children:[(0,$.jsx)(pe,{className:`size-4`,"aria-hidden":!0}),r===`zh`?`让 AI 修复`:`Fix with AI`]}):null,we?(0,$.jsxs)(N,{variant:`secondary`,onClick:()=>d(`failed_agents`),children:[(0,$.jsx)(it,{className:`size-4`,"aria-hidden":!0}),v.replayFailedAgents]}):null,Te?(0,$.jsxs)(N,{variant:`secondary`,onClick:()=>d(`failed_phases`),children:[(0,$.jsx)(it,{className:`size-4`,"aria-hidden":!0}),v.replayFailedPhases]}):null,e.controls.canRetry?(0,$.jsxs)(N,{variant:`secondary`,onClick:l,children:[(0,$.jsx)(it,{className:`size-4`,"aria-hidden":!0}),v.rerun]}):null]})]}),(0,$.jsx)(bi,{view:e,language:r})]}):null,J?(0,$.jsx)(Ei,{task:J,labels:v,downloadingArtifactId:I,downloadError:M,onCopyText:e=>void j(e),onDownloadArtifact:e=>void ue(e),onStartFollowUp:de,compact:!0}):null,be?(0,$.jsx)(`div`,{className:`flex justify-end`,children:(0,$.jsxs)(N,{variant:`secondary`,onClick:c,className:`text-red-600 dark:text-red-300`,children:[(0,$.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),v.cancel]})}):null]}):null,o===`process`?(0,$.jsxs)($.Fragment,{children:[e.run.metadata?.definition.graph?(0,$.jsx)(Kr,{graph:e.run.metadata.definition.graph,view:e,language:r,onRepair:_}):null,Ae?(0,$.jsx)(ci,{diagnostics:K,labels:v,hint:Ce,onOpenAgent:me}):null,(0,$.jsx)(ui,{snapshot:H,rollup:U,view:e,labels:v,cardLabels:b,isActive:V,processExpanded:C,logsExpanded:T,selectedAgentId:D,selectedAgent:W,durationText:xe,onToggleProcess:()=>w(e=>!e),onToggleLogs:()=>E(e=>!e),onSelectAgent:G}),(0,$.jsx)(gi,{view:e,comparison:t,labels:v,onOpenRunId:f}),(0,$.jsx)(_i,{view:e,labels:v})]}):null,o===`artifacts`?(0,$.jsx)(Ei,{task:J,labels:v,downloadingArtifactId:I,downloadError:M,onCopyText:e=>void j(e),onDownloadArtifact:e=>void ue(e),onStartFollowUp:de}):null,o===`source`&&X.metadata?.definition?(0,$.jsx)(Jn,{initialSource:tr($n(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 ci(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)(z,{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:hi(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)(N,{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 li(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)(Et,{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 ui(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?(_=_e(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 b;t[9]!==g||t[10]!==v?(b=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[g,v]}),t[9]=g,t[10]=v,t[11]=b):b=t[11];let x=c?`rotate-180`:null,S;t[12]===x?S=t[13]:(S=y(`size-4 shrink-0 text-fg-subtle transition-transform`,x),t[12]=x,t[13]=S);let C;t[14]===S?C=t[15]:(C=(0,$.jsx)(qe,{className:S,"aria-hidden":!0}),t[14]=S,t[15]=C);let w;t[16]!==p||t[17]!==c||t[18]!==b||t[19]!==C?(w=(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:[b,C]}),t[16]=p,t[17]=c,t[18]=b,t[19]=C,t[20]=w):w=t[20];let T;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=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)(ot,{snapshot:n,labels:o,logsExpanded:l,onToggleLogs:m,selectedAgentId:u,onSelectAgent:h}):(0,$.jsx)(Fe,{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:ri(e.status,a)})]})},e.id))}):null]}),(0,$.jsx)(di,{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]=T):T=t[33];let E;return t[34]!==w||t[35]!==T?(E=(0,$.jsxs)(`div`,{className:`mt-5 rounded-2xl border border-edge bg-surface-base/35`,children:[w,T]}),t[34]=w,t[35]=T,t[36]=E):E=t[36],E}function di(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=Qe(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 b;t[14]!==m||t[15]!==v?(b=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[m,v]}),t[14]=m,t[15]=v,t[16]=b):b=t[16];let x;t[17]===n.status?x=t[18]:(x=y(`rounded-full px-2 py-0.5 text-xs font-medium`,Li(n.status)),t[17]=n.status,t[18]=x);let S=i.agentStatus[n.status]??n.status,C;t[19]!==x||t[20]!==S?(C=(0,$.jsx)(`span`,{className:x,children:S}),t[19]=x,t[20]=S,t[21]=C):C=t[21];let w;t[22]!==b||t[23]!==C?(w=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[b,C]}),t[22]=b,t[23]=C,t[24]=w):w=t[24];let T;t[25]===i.agentOutputHeading?T=t[26]:(T=(0,$.jsx)(`h4`,{className:`text-xs font-semibold text-fg`,children:i.agentOutputHeading}),t[25]=i.agentOutputHeading,t[26]=T);let E=n.error?`font-mono text-rose-600 dark:text-rose-400`:`text-fg-muted`,D;t[27]===E?D=t[28]:(D=y(`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]!==T||t[33]!==O?(k=(0,$.jsxs)(`section`,{className:`mt-4 rounded-xl border border-edge-subtle bg-surface-base/60 p-3`,children:[T,O]}),t[32]=T,t[33]=O,t[34]=k):k=t[34];let A;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>s(mi),t[35]=A):A=t[35];let j=i.debugDetailsTitle,M=o&&`rotate-180`,N;t[36]===M?N=t[37]:(N=y(`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)(qe,{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(pi)})]}):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)(Pi,{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(fi)})]}):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]!==w||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:[w,k,L]}),t[53]=w,t[54]=k,t[55]=L,t[56]=R):R=t[56],R}function fi(e){return(0,$.jsx)(`div`,{className:`wrap-break-word`,children:e},e)}function pi(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 mi(e){return!e}function hi(e,t){return e.kind===`run_error`?e.code?_e(t.diagnosticsRunErrorWithCode,{code:e.code}):t.diagnosticsRunError:e.kind===`agent_error`?_e(t.diagnosticsAgentError,{agent:e.agentLabel??String(e.agentId??`—`)}):e.kind===`step_error`?_e(t.diagnosticsStepError,{agent:e.agentLabel??String(e.agentId??`—`),step:e.stepLabel??e.stepId??`—`}):_e(t.diagnosticsAgentSkipped,{agent:e.agentLabel??String(e.agentId??`—`)})}function gi(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=_e(i.replayLineageSummary,{scope:yi(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)(zi,{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)(zi,{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)(Ri,{label:i.replayFixedAgents,value:String(r.fixedAgentIds.length)}),(0,$.jsx)(Ri,{label:i.replayStillFailingAgents,value:String(r.stillFailingAgentIds.length)}),(0,$.jsx)(Ri,{label:i.replayDurationDelta,value:vi(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)(N,{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 _i(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)(zi,{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)(zi,{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 vi(e){return e==null?`—`:`${e>0?`+`:e<0?`-`:``}${Ct(Math.abs(e))}`}function yi(e,t){return e===`failed_phases`?t.replayScopeFailedPhases:t.replayScopeFailedAgents}function bi(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(Ti),s=n.nodes.filter(wi);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(Ci)}):null,s.length>0?(0,$.jsx)(`p`,{className:`mt-3 text-xs text-danger`,children:r===`zh`?`待修复:${s.map(Si).join(`、`)}`:`Needs repair: ${s.map(xi).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 xi(e){return e.title}function Si(e){return e.title}function Ci(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 wi(e){return e.status===`error`}function Ti(e){return e.status===`done`&&e.resultPreview?.trim()}function Ei(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=y(`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)(Oi,{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)(h,{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)(Oi,{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 g;return t[15]!==f||t[16]!==p||t[17]!==m?(g=(0,$.jsxs)(`div`,{className:f,children:[p,m]}),t[15]=f,t[16]=p,t[17]=m,t[18]=g):g=t[18],g}function Di(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n)}function Oi(e){let t=(0,Q.c)(10),{title:n,children:r,className:i}=e,a;t[0]===i?a=t[1]:(a=y(`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 ki(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 Ai(e){return e&&typeof e==`object`&&!Array.isArray(e)?e:null}function ji(e){if(typeof e==`string`)return e.trim()||null;let t=Ai(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 Mi(e){let t=Ai(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 Ni(e,t){if(e.kind===`copy_result`)return!0;let n=ji(e.payload);return e.kind===`open_artifact`?!!(n&&t.artifacts.some(e=>e.id===n||e.name===n)):e.kind===`start_followup`?!!(Mi(e.payload)||n&&t.followUps.some(e=>e.id===n&&e.prompt)):!!Mi(e.payload)}function Pi(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(Ii),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(Fi)}),t[19]=m,t[20]=h),h}function Fi(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 Ii(e){return!!e.value}function Li(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 Ri(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 zi(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 Bi(){let e=(0,Q.c)(8),t=b(Vi),[n]=o(),r;e[0]===n?r=e[1]:(r=n.get(`agentId`)?.trim()||void 0,e[0]=n,e[1]=r);let i=r,a;e[2]===t?a=e[3]:(a=t?[`workflow-route-agents`,t]:null,e[2]=t,e[3]=a);let s;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(s={revalidateOnFocus:!1},e[4]=s):s=e[4];let c=M(a,De,s),l=i??c.data?.defaultId,u;return e[5]!==c.isLoading||e[6]!==l?(u={ownerAgentId:l,loading:c.isLoading},e[5]=c.isLoading,e[6]=l,e[7]=u):u=e[7],u}function Vi(e){return e.conversationId}function Hi(e){let t=(0,Q.c)(19),n=b(Ui),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=M(r,bt,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 Ui(e){return e.conversationId}var Wi=()=>({goal:``,argValues:{},schemaInput:{},concurrency:``,maxSubagents:``});function Gi(){let{definitionId:e}=c(),[t,n]=o(),r=a(),i=x(e=>e.language),s=S(i).workflows,u=i===`zh`?`zh-CN`:`en-US`,p=re(e=>e.setPageHeader),m=re(e=>e.clearPageHeader),{ownerAgentId:h}=Bi(),g=t.get(`projectId`)?.trim()||void 0,_=t.get(`view`)===`source`?`source`:`canvas`,{definition:v,loading:y,error:b}=Hi(e),C=M(`workflow-project-options`,()=>Te({limit:100,sortBy:`updatedAt`,sortOrder:`desc`}),{revalidateOnFocus:!1}),w=M(g?[`workflow-project-presets`,g]:null,()=>ht(g),{revalidateOnFocus:!1}),T=M(h?[`workflow-detail-runs`,h,e,g??``]:null,()=>yt(100,{ownerAgentId:h,projectId:g}),{revalidateOnFocus:!1}),[E,D]=(0,Z.useState)(Wi),[O,k]=(0,Z.useState)([]),[A,j]=(0,Z.useState)(!1),[P,F]=(0,Z.useState)(!1),[I,L]=(0,Z.useState)(null),R=(0,Z.useRef)(void 0),z=(0,Z.useMemo)(()=>(T.data??[]).filter(e=>e.definitionId===v?.id).slice(0,6),[v?.id,T.data]),B=Dt(v,E),V=v?rt(v,i):null,H=w.data?.find(e=>e.definitionId===v?.id),U=!!H&&JSON.stringify(H?.contextRefs)===JSON.stringify(O);(0,Z.useEffect)(()=>{if(!g||!v||!w.data)return;let e=`${g}:${v.id}`;R.current!==e&&(R.current=e,k(H?.contextRefs??[]))},[v,g,H?.contextRefs,w.data]);let W=(0,Z.useCallback)(e=>{R.current=void 0,k([]),n(t=>{let n=new URLSearchParams(t);return e?n.set(`projectId`,e):n.delete(`projectId`),n},{replace:!0})},[n]),q=(0,Z.useCallback)(async()=>{if(!(!g||!v||P)){F(!0),L(null);try{let e=await G(g,v.id,O);await w.mutate(t=>[e,...(t??[]).filter(t=>t.definitionId!==e.definitionId)],{revalidate:!1})}catch(e){L(e instanceof Error?e.message:s.projectWorkflowSaveFailed)}finally{F(!1)}}},[O,v,s.projectWorkflowSaveFailed,g,w,P]),ee=(0,Z.useCallback)(async()=>{if(!(!g||!v||P)){F(!0),L(null);try{await fe(g,v.id),await w.mutate(e=>(e??[]).filter(e=>e.definitionId!==v.id),{revalidate:!1})}catch(e){L(e instanceof Error?e.message:s.projectWorkflowRemoveFailed)}finally{F(!1)}}},[v,s.projectWorkflowRemoveFailed,g,w,P]),te=new URLSearchParams({tab:`library`});h&&te.set(`agentId`,h),g&&te.set(`projectId`,g);let ne=`/workflows?${te.toString()}`,J=new URLSearchParams;h&&J.set(`agentId`,h),g&&J.set(`projectId`,g);let Y=J.size?`?${J.toString()}`:``,ie=e=>{n(t=>{let n=new URLSearchParams(t);return e===`source`?n.set(`view`,`source`):n.delete(`view`),n},{replace:!0})},ae=null;if(v){let e=new URLSearchParams;h&&e.set(`agentId`,h),g&&e.set(`projectId`,g),v.metadata.source!==`user`&&e.set(`copy`,v.id),ae=`${v.metadata.source===`user`?`/workflows/${v.id}/edit`:`/workflows/new`}${e.size?`?${e.toString()}`:``}`}(0,Z.useLayoutEffect)(()=>(p({startExtra:(0,$.jsx)(l,{to:ne,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":i===`zh`?`返回工作流库`:`Back to workflow library`,children:(0,$.jsx)(K,{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:v?.title??(i===`zh`?`工作流详情`:`Workflow details`)}),v?(0,$.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[v.metadata.source===`user`?s.badgeUser:s.badgeBuiltin,` · `,i===`zh`?`版本 ${v.revision}`:`Version ${v.revision}`]}):null]}),end:v&&ae?(0,$.jsx)(N,{asChild:!0,variant:`secondary`,className:`h-9 shrink-0`,children:(0,$.jsxs)(l,{to:ae,children:[v.metadata.source===`user`?(0,$.jsx)(St,{className:`size-4`,"aria-hidden":!0}):(0,$.jsx)(ve,{className:`size-4`,"aria-hidden":!0}),v.metadata.source===`user`?s.editWorkflow:s.copyAndEditWorkflow]})}):null}),()=>m()),[m,v,ae,s.badgeBuiltin,s.badgeUser,s.copyAndEditWorkflow,s.editWorkflow,i,ne,p]);let oe=(0,Z.useCallback)(async()=>{if(!(!v||!B.valid||A)){j(!0),L(null);try{r(`/workflows/runs/${(await Ge({definitionId:v.id,goal:E.goal.trim()||V?.description||v.title,input:Ot(v,E),agentId:h,projectId:g,contextRefs:O,concurrency:E.concurrency.trim()?Number(E.concurrency):void 0,maxSubagents:E.maxSubagents.trim()?Number(E.maxSubagents):void 0})).runId}${Y}`)}catch(e){L(e instanceof Error?e.message:s.startFailed)}finally{j(!1)}}},[O,v,B.valid,s.startFailed,V?.description,r,h,g,Y,E,A]);return y?(0,$.jsx)(Qi,{}):!v||!V?(0,$.jsx)($i,{message:b?.message??(i===`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 py-5 sm:px-6`,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:V.description}),(0,$.jsx)(`div`,{className:`flex rounded-lg bg-surface-base p-1`,role:`tablist`,"aria-label":i===`zh`?`工作流视图`:`Workflow view`,children:[`canvas`,`source`].map(e=>(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":_===e,className:`rounded-md px-3 py-1.5 text-xs font-medium ${_===e?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:text-fg`}`,onClick:()=>ie(e),children:e===`canvas`?i===`zh`?`画布`:`Canvas`:i===`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:_===`source`?(0,$.jsx)(Jn,{initialSource:tr(Zn(v)),resetKey:`${v.id}:${v.revision}`,fileName:`${v.name}.workflow.json`,language:i}):(0,$.jsx)(Br,{graph:v.graph,language:i,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:i===`zh`?`开始一次运行`:`Start a run`}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:V.whenToUse||V.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)(he,{className:`size-3.5 text-fg-subtle`,"aria-hidden":!0}),s.runProject]}),(0,$.jsxs)(d,{value:g??``,"aria-label":s.runProject,onChange:e=>W(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)(f,{value:``,children:s.runProjectNone}),(C.data?.items??[]).filter(e=>e.status!==`archived`&&e.status!==`cancelled`).map(e=>(0,$.jsx)(f,{value:e.id,children:e.name},e.id))]})]}),(0,$.jsx)(`div`,{className:`mt-3`,children:(0,$.jsx)(Lr,{projectId:g,language:i,value:O,onChange:k})}),g?(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,$.jsxs)(N,{type:`button`,variant:`ghost`,className:`h-8 flex-1 justify-start px-2 text-xs`,disabled:P||U,onClick:()=>void q(),children:[(0,$.jsx)(gt,{className:`size-3.5`,"aria-hidden":!0}),U?s.projectWorkflowSaved:H?s.updateProjectWorkflow:s.saveProjectWorkflow]}),H?(0,$.jsx)(N,{type:`button`,variant:`ghost`,className:`size-8 p-0 text-fg-muted`,disabled:P,"aria-label":s.removeProjectWorkflow,onClick:()=>void ee(),children:(0,$.jsx)(We,{className:`size-3.5`,"aria-hidden":!0})}):null]}):null,(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(kt,{definition:v,language:i,value:E,onChange:D,mode:`manual`,badgeLabel:s.readyToStart,aiAssist:{context:{surface:`workflow-start`,workflowId:v.id,workflowName:v.name,workflowTitle:v.title,workflowDescription:V.description}}})}),I?(0,$.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:I}):null,(0,$.jsxs)(N,{variant:`primary`,className:`mt-4 w-full`,disabled:!B.valid||A,onClick:()=>void oe(),children:[(0,$.jsx)(Be,{className:`size-4`,"aria-hidden":!0}),A?s.starting:s.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:i===`zh`?`最近运行`:`Recent runs`}),z.length?(0,$.jsx)(`div`,{className:`mt-3 grid gap-2 md:grid-cols-2 xl:grid-cols-3`,children:z.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}${Y}`),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:s.status[e.status]})]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:ke(e.createdAtMs,u)})]},e.id))}):(0,$.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,children:i===`zh`?`还没有运行记录。`:`No runs yet.`})]})]})})}function Ki(){let{definitionId:e}=c(),[t]=o(),n=a(),r=x(e=>e.language),{ownerAgentId:i}=Bi(),s=t.get(`copy`)?.trim()||void 0,l=t.get(`repairRun`)?.trim()||void 0,u=t.get(`projectId`)?.trim()||void 0,d=new URLSearchParams;i&&d.set(`agentId`,i),u&&d.set(`projectId`,u);let f=d.size?`?${d.toString()}`:``,{definition:p,definitions:m,loading:h,upsertDefinition:g,refreshDefinitions:_}=Hi(e??s),v=M(l&&i?[`workflow-repair-run`,l,i]:null,()=>Ie(l,{ownerAgentId:i}),{revalidateOnFocus:!1}),[y,b]=(0,Z.useState)(!1),[S,C]=(0,Z.useState)(null),[w,T]=(0,Z.useState)(null),E=(0,Z.useMemo)(()=>m.map(e=>e.name),[m]),D=(0,Z.useMemo)(()=>mr(`my_workflow`,E),[E]),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:Zi(p.name,m),graph:structuredClone(p.graph),manifest:Kn(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),C(null),T(null);try{let t=await le(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=hr(e);T(t),t||C(e instanceof Error?e.message:String(e))}finally{b(!1)}},[f,n,g]),A=(0,Z.useCallback)(async e=>{b(!0),C(null),T(null);try{let t=await le(e.name,e.graph,e.manifest,e.expectedRevision);await g(t),n(`/workflows/runs/${(await Ge({definitionId:t.id,goal:e.goal,input:{goal:e.goal},agentId:i,projectId:u})).runId}${f}`)}catch(e){let t=hr(e);throw T(t),t||C(e instanceof Error?e.message:String(e)),e}finally{b(!1)}},[f,n,i,u,g]);return h?(0,$.jsx)(Qi,{}):e&&!p?(0,$.jsx)($i,{message:r===`zh`?`没有找到这个工作流`:`Workflow not found`}):(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[S?(0,$.jsx)(`div`,{className:`border-b border-danger/30 bg-danger/5 px-4 py-2 text-sm text-danger`,children:S}):null,(0,$.jsx)(_r,{language:r,ownerAgentId:i,saving:y,initialDraft:O,initialName:D,existingNames:E,saveConflict:w,onSave:k,onSaveAndStart:A,onClearSaveConflict:()=>T(null),onReloadLatest:()=>{T(null),C(null),_()}})]})}function qi(){let e=(0,Q.c)(67),{runId:t}=c(),n=a(),[r]=o(),i=x(Xi),s;e[0]===i?s=e[1]:(s=S(i),e[0]=i,e[1]=s);let u=s.workflows,d=i===`zh`?`zh-CN`:`en-US`,f=re(Yi),p=re(Ji),{ownerAgentId:m}=Bi(),h=r.get(`projectId`)?.trim()||void 0,g;e[2]===m?g=e[3]:(g={ownerAgentId:m},e[2]=m,e[3]=g);let _=Ve(t,g),[v,y]=(0,Z.useState)(`process`),b=(0,Z.useRef)(!0),C;e[4]!==_.view?.run.metadata?.replay||e[5]!==m||e[6]!==t?(C=_.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]=C):C=e[7];let w;e[8]!==m||e[9]!==t?(w=()=>we(t,{ownerAgentId:m}),e[8]=m,e[9]=t,e[10]=w):w=e[10];let T;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(T={revalidateOnFocus:!1},e[11]=T):T=e[11];let E=M(C,w,T),D;e[12]===_.view?D=e[13]:(D=_.view?ae.has(_.view.run.status):!0,e[12]=_.view,e[13]=D);let O=D,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 N=`/workflows?${j.toString()}`,P,F;e[19]!==p||e[20]!==u.backToRuns||e[21]!==u.runDetailsTitle||e[22]!==_.view||e[23]!==N||e[24]!==f?(P=()=>(f({startExtra:(0,$.jsx)(l,{to:N,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)(K,{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()),F=[p,u.backToRuns,u.runDetailsTitle,_.view,N,f],e[19]=p,e[20]=u.backToRuns,e[21]=u.runDetailsTitle,e[22]=_.view,e[23]=N,e[24]=f,e[25]=P,e[26]=F):(P=e[25],F=e[26]),(0,Z.useLayoutEffect)(P,F);let I;e[27]!==n||e[28]!==m||e[29]!==h?(I=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]=I):I=e[30];let L=I,R;e[31]!==L||e[32]!==m||e[33]!==t?(R=async()=>{t&&L((await me(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 V(t,e,{ownerAgentId:m})).runId)},e[35]=L,e[36]=m,e[37]=t,e[38]=B):B=e[38];let H=B;if(!_.loading&&!_.view){let t=_.error instanceof Error?_.error.message:i===`zh`?`没有找到这次运行`:`Workflow run not found`,n;return e[39]===t?n=e[40]:(n=(0,$.jsx)($i,{message:t}),e[39]=t,e[40]=n),n}let U;e[41]!==_||e[42]!==m||e[43]!==t?(U=()=>t&&void Ae(t,{ownerAgentId:m}).then(()=>_.mutate()),e[41]=_,e[42]=m,e[43]=t,e[44]=U):U=e[44];let W;e[45]===z?W=e[46]:(W=()=>void z(),e[45]=z,e[46]=W);let G;e[47]===H?G=e[48]:(G=e=>void H(e),e[47]=H,e[48]=G);let q;e[49]!==_.view||e[50]!==n||e[51]!==m?(q=_.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]=q):q=e[52];let ee;return e[53]!==v||e[54]!==E.data||e[55]!==i||e[56]!==_.loading||e[57]!==_.view||e[58]!==d||e[59]!==L||e[60]!==m||e[61]!==y||e[62]!==U||e[63]!==W||e[64]!==G||e[65]!==q?(ee=(0,$.jsx)(si,{view:_.view,comparison:E.data,loading:_.loading,language:i,localeTag:d,activeTab:v,onTabChange:y,onCancel:U,onRetry:W,onReplay:G,onOpenRunId:L,ownerAgentId:m,onRepairWorkflow:q}),e[53]=v,e[54]=E.data,e[55]=i,e[56]=_.loading,e[57]=_.view,e[58]=d,e[59]=L,e[60]=m,e[61]=y,e[62]=U,e[63]=W,e[64]=G,e[65]=q,e[66]=ee):ee=e[66],ee}function Ji(e){return e.clearPageHeader}function Yi(e){return e.setPageHeader}function Xi(e){return e.language}function Zi(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 Qi(){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)(P,{className:`h-5 w-36`}),(0,$.jsx)(P,{className:`mt-5 h-9 w-80 max-w-full`}),(0,$.jsx)(P,{className:`mt-4 h-[28rem] rounded-xl`})]})}),e[0]=t):t=e[0],t}function $i(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)(N,{asChild:!0,variant:`secondary`,className:`mt-4`,children:(0,$.jsxs)(l,{to:`/workflows`,children:[(0,$.jsx)(K,{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{Gi as WorkflowDetailPage,Ki as WorkflowEditorPage,qi as WorkflowRunPage,Gn as WorkflowsPage};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { LocalVoiceModelDefinition } from './models.js';
|
|
2
|
-
export interface LocalVoiceFileProgress {
|
|
3
|
-
status: 'download';
|
|
4
|
-
file: string;
|
|
5
|
-
loaded: number;
|
|
6
|
-
total: number;
|
|
7
|
-
progress: number;
|
|
8
|
-
}
|
|
9
|
-
export declare function downloadLocalVoiceModelFiles(options: {
|
|
10
|
-
model: LocalVoiceModelDefinition;
|
|
11
|
-
destinationDir: string;
|
|
12
|
-
remoteHosts: readonly string[];
|
|
13
|
-
onProgress?: (progress: LocalVoiceFileProgress) => void;
|
|
14
|
-
}): Promise<void>;
|