@xopcai/xopc 0.0.178 → 0.0.180
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-BzGX__8I.js → activity-store-DFKtQDgE.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BzxntcaZ.js → agent-avatar-dicebear-CcTvB_4W.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DgGj9bu6.js +2 -0
- package/dist/gateway/static/root/assets/{api-hi6f2Xtp.js → api-CUClAvuL.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-fTY1F7ac.js → app-management-settings-panel-Ib-cWKHM.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BZ-IxQfB.js → appearance-settings-CRSN8WuA.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-B5xahuT-.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-ZSLLG8wB.js → archive-plugin-BBF9zspN.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-D4YktqIF.js → attachment-load-D3QQfA7w.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-BUYrvMmD.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BIkPxfxj.js → binary-plugins-D78XOjJ3.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Q3v_YQom.js → block-editor-D_VVXlYX.js} +46 -46
- package/dist/gateway/static/root/assets/browser-settings-page-Cjw07q9h.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-M5lTEW1I.js → browser-workflow-inputs-_gu08MA4.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-B3T1KYk4.js → browser-workflows-page-58DBMXgG.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-D_dfVxHY.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-DE09c0VB.js → capability-presets-api-DhCn9rPv.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-LWWIYUT7.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-CFR5FBfS.js → channel-recipient-api-DYtoNV5A.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-Cyj5OunL.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-TEFnV0IG.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-B1mD-3pM.js → connector-logo-CxIXnifA.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-0TobCpBB.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-CwVSLL6N.js +1 -0
- package/dist/gateway/static/root/assets/desktop-pet-settings-BOIp4q0Z.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BYQJ2XUS.js → directory-picker-path-field-C8_lsW6S.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-BXcb8fwx.js → dreaming-settings-Da9FeWQl.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-O1Xu1r4Q.js → extension-debug-page-CMNnSJP6.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C2Jraq8l.js → extension-page-t0pJqLvM.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DcXQDTpG.js → extension-settings-page-aiR-tKnW.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-DmPIZrvg.js → gateway-config-api-CkyQBD6r.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BIZfAgfB.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BZEkOdPm.js → gateway-startup-retry-CSU7UvzG.js} +1 -1
- package/dist/gateway/static/root/assets/goals-settings-Dx9uTyWF.js +1 -0
- package/dist/gateway/static/root/assets/{heartbeat-settings-BtKu2NWT.js → heartbeat-settings-Cnr5ORXL.js} +1 -1
- package/dist/gateway/static/root/assets/{image-generation-api-05Gg8wsU.js → image-generation-api-BR6Kb77X.js} +1 -1
- package/dist/gateway/static/root/assets/index-B0Tdge_q.css +1 -0
- package/dist/gateway/static/root/assets/index-BA56bQ68.js +224 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CfmDR9Sc.js → keyboard-shortcuts-settings-D76uYKeQ.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DSUNtLHg.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-Df8BW1A_.js → local-apps-page-BsLnojTh.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CTwSy7yW.js → locale-store-BNC8HUCI.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-yI8kpQtO.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-B3FvKbaP.js → markdown-split-D6smTQWD.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DsjrvvB6.js → media-plugins-D1TmMF0A.js} +1 -1
- package/dist/gateway/static/root/assets/messages-H_iJjnEM.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-tuzIwy3c.js → notes-page-Vt-diFf0.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-BD297EZt.js +4 -0
- package/dist/gateway/static/root/assets/outcome-detail-page-C5i_ZR9a.js +1 -0
- package/dist/gateway/static/root/assets/{page-tabs-ke9s4nYi.js → page-tabs-BnSzIjH0.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Cp1eI4S9.js → preview-open-alternatives-CF12Eqi4.js} +1 -1
- package/dist/gateway/static/root/assets/product-delivery-BVG-eWQO.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-dXQCMAtH.js → product-open-page-Du0TE_CU.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-D1HGz7Dy.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-CqP2TnW-.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-BXdVJLS3.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-Bl30zjHc.js → save-bar-controls-B53UNtDM.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-DqhmXQKo.js → schedule-field-C3dIMN5q.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-DkUCy6vf.js → schema-form-BKvpxqof.js} +1 -1
- package/dist/gateway/static/root/assets/{schemas-DgQq6Z5S.js → schemas-C6onAggk.js} +2 -2
- package/dist/gateway/static/root/assets/sessions-page-CPAwDdl5.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-C-jGsoft.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-C6ZbNpdy.js → settings-form-section-kt6GIS32.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-Bk58_cr7.js → settings-loading-skeleton-85eUPcKz.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-k8iE_NdX.js → settings-page-Di5x6Xrc.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-DgFSya2e.js → settings-page-layout-CkkCee_x.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-B_KDlyZA.js → setup-status-panel-uxEE6gAB.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CV7nL_J9.js → share-preview-page-BtLEstaI.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-2mcsMWgn.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-ocDwsrEt.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-9_jfsFU5.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-kahBIHg0.js → skills-page.utils-C2SHvq8V.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-JV3-MG5F.js → system-settings-panel-CIJ66cUy.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DFLyzoLO.js → theme-store-ClDa_Bci.js} +1 -1
- package/dist/gateway/static/root/assets/time-picker-D0zAsHOo.js +1 -0
- package/dist/gateway/static/root/assets/{typed-models-lib-60Aqo-UJ.js → typed-models-lib-GsmwmB40.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-CnTkHDnw.js → use-channel-catalog-BQz3K7xj.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-Bn4BLg4W.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CNa8qUgS.js → voice-api-key-field-Blaxsbb3.js} +1 -1
- package/dist/gateway/static/root/assets/work-copy-Cwyan9Sn.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-iJ9RBSpu.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-CqTH7PQX.js +1 -0
- package/dist/gateway/static/root/assets/work-page-H3m99ccS.js +3 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-yV_x595t.js → workflow-run-setup-panel-CTG4RpRE.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-BxZSKMfv.js +11 -0
- package/dist/gateway/static/root/index.html +9 -10
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/outcomes.js +137 -0
- package/dist/packages/gateway-contract/src/product-delivery.js +1 -0
- package/dist/packages/gateway-contract/src/work-intake.js +85 -0
- package/dist/src/activity/service.d.ts +1 -0
- package/dist/src/activity/service.js +4 -1
- package/dist/src/agent/agent-manager.d.ts +4 -1
- package/dist/src/agent/agent-manager.js +21 -7
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
- package/dist/src/agent/code-intelligence/binary.js +1 -1
- package/dist/src/agent/context/execution-scope.d.ts +1 -1
- package/dist/src/agent/context/execution-scope.js +6 -4
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.d.ts +2 -0
- package/dist/src/agent/embedded/run-for-session.js +3 -1
- package/dist/src/agent/goals/post-turn.js +7 -6
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +6 -1
- package/dist/src/agent/inbound/turn-dispatcher.js +5 -2
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/lifecycle/timeout-wrapper.d.ts +2 -0
- package/dist/src/agent/lifecycle/timeout-wrapper.js +39 -9
- package/dist/src/agent/mcp/bundle-mcp-materialize.js +2 -2
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +6 -1
- package/dist/src/agent/mcp/bundle-mcp-types.d.ts +1 -1
- package/dist/src/agent/mcp/mcp-stdio-transport.js +1 -1
- package/dist/src/agent/mcp/mcp-transport-config.d.ts +2 -0
- package/dist/src/agent/mcp/mcp-transport-config.js +10 -3
- package/dist/src/agent/mcp/mcp-transport.d.ts +1 -0
- package/dist/src/agent/mcp/mcp-transport.js +5 -2
- package/dist/src/agent/memory/dreaming/config.js +1 -1
- package/dist/src/agent/memory/user-context-coordinator.d.ts +1 -0
- package/dist/src/agent/memory/user-context-coordinator.js +17 -1
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +1 -1
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +6 -2
- package/dist/src/agent/outcomes/{task-evaluation.d.ts → execution-evaluation.d.ts} +3 -3
- package/dist/src/agent/outcomes/{task-evaluation.js → execution-evaluation.js} +5 -5
- package/dist/src/agent/outcomes/execution-verifier.d.ts +29 -0
- package/dist/src/agent/outcomes/{task-verifier.js → execution-verifier.js} +4 -4
- package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -0
- package/dist/src/agent/service/direct-turn-helpers.js +1 -0
- package/dist/src/agent/service/process-direct-one-shot.d.ts +3 -0
- package/dist/src/agent/service/process-direct-one-shot.js +4 -1
- package/dist/src/agent/service/process-direct-streaming.js +3 -1
- package/dist/src/agent/service.d.ts +1 -0
- package/dist/src/agent/service.js +5 -2
- package/dist/src/agent/session/session-inspector.js +1 -1
- package/dist/src/agent/skills/config.js +6 -0
- package/dist/src/agent/skills/filesystem-watcher.d.ts +4 -0
- package/dist/src/agent/skills/filesystem-watcher.js +16 -7
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/index.d.ts +10 -7
- package/dist/src/agent/skills/index.js +56 -47
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/skills/skill-manager.d.ts +5 -2
- package/dist/src/agent/skills/skill-manager.js +10 -5
- package/dist/src/agent/skills/skill-sources.d.ts +18 -0
- package/dist/src/agent/skills/skill-sources.js +143 -0
- package/dist/src/agent/skills/types.d.ts +25 -2
- package/dist/src/agent/tools/delegate-tool.js +2 -1
- package/dist/src/agent/tools/executor.d.ts +2 -0
- package/dist/src/agent/tools/executor.js +18 -11
- package/dist/src/agent/tools/factory.js +18 -1
- package/dist/src/agent/tools/goal-tool.js +5 -3
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/managed-job-tool.d.ts +2 -0
- package/dist/src/agent/tools/managed-job-tool.js +160 -0
- package/dist/src/agent/tools/todo-tool.d.ts +5 -0
- package/dist/src/agent/tools/todo-tool.js +16 -4
- package/dist/src/agent/tools/update-plan-tool.d.ts +1 -0
- package/dist/src/agent/tools/update-plan-tool.js +6 -0
- package/dist/src/agent/workspace-runtime/registry.d.ts +3 -0
- package/dist/src/agent/workspace-runtime/registry.js +3 -1
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/auth/credentials.d.ts +9 -1
- package/dist/src/auth/credentials.js +112 -56
- package/dist/src/auth/model-credential-store.js +7 -22
- package/dist/src/auth/oauth-provider-lock.d.ts +5 -0
- package/dist/src/auth/oauth-provider-lock.js +91 -0
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/automations/domain/defaults.d.ts +8 -1
- package/dist/src/automations/domain/defaults.js +9 -2
- package/dist/src/automations/domain/index.js +2 -2
- package/dist/src/automations/domain/types.d.ts +33 -7
- package/dist/src/automations/domain/validation.d.ts +8 -0
- package/dist/src/automations/domain/validation.js +2 -0
- package/dist/src/automations/draft/automation-draft-validator.d.ts +2 -1
- package/dist/src/automations/index.js +2 -2
- package/dist/src/automations/service/action-executor.d.ts +2 -2
- package/dist/src/automations/service/action-executor.js +144 -34
- package/dist/src/automations/service/automation-service.d.ts +4 -0
- package/dist/src/automations/service/automation-service.js +197 -18
- package/dist/src/automations/storage/automation-run-repository.d.ts +1 -0
- package/dist/src/automations/storage/automation-run-repository.js +37 -7
- package/dist/src/automations/storage/index.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/browser/providers/cloakbrowser.js +2 -2
- package/dist/src/channels/attachments/voice-stt-webchat.d.ts +0 -3
- package/dist/src/channels/attachments/voice-stt-webchat.js +1 -24
- package/dist/src/chat-commands/builtins/goal.js +5 -4
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/goal.js +6 -5
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/tunnel.js +3 -3
- package/dist/src/cli/utils/oauth-login.js +1 -7
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/config/schema.d.ts +3 -0
- package/dist/src/config/schema.js +2 -1
- package/dist/src/connectors/learning-coordinator.js +7 -1
- package/dist/src/connectors/source-change-publisher.d.ts +17 -0
- package/dist/src/connectors/source-change-publisher.js +148 -0
- package/dist/src/discussions/analyzer.d.ts +35 -0
- package/dist/src/discussions/analyzer.js +127 -0
- package/dist/src/discussions/index.d.ts +7 -0
- package/dist/src/discussions/index.js +7 -0
- package/dist/src/discussions/live-worker.d.ts +33 -0
- package/dist/src/discussions/live-worker.js +148 -0
- package/dist/src/discussions/pipeline.d.ts +33 -0
- package/dist/src/discussions/pipeline.js +205 -0
- package/dist/src/discussions/project-inference.d.ts +13 -0
- package/dist/src/discussions/project-inference.js +19 -0
- package/dist/src/discussions/repository.d.ts +29 -0
- package/dist/src/discussions/repository.js +255 -0
- package/dist/src/discussions/service.d.ts +51 -0
- package/dist/src/discussions/service.js +335 -0
- package/dist/src/discussions/transcript.d.ts +3 -0
- package/dist/src/discussions/transcript.js +15 -0
- package/dist/src/discussions/types.d.ts +116 -0
- package/dist/src/discussions/types.js +10 -0
- package/dist/src/discussions/worker.d.ts +18 -0
- package/dist/src/discussions/worker.js +74 -0
- package/dist/src/extensions/activation-context.js +2 -1
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/extensions/sdk/testing.js +1 -1
- package/dist/src/gateway/agents-admin.js +3 -3
- package/dist/src/gateway/chat-stream/mapper.js +53 -3
- package/dist/src/gateway/chat-stream/protocol.d.ts +17 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/app.js +8 -3
- package/dist/src/gateway/hono/lib/config-payload.js +2 -2
- package/dist/src/gateway/hono/middleware/auth.js +2 -2
- package/dist/src/gateway/hono/middleware/logger.js +1 -1
- package/dist/src/gateway/hono/middleware/strict-rate-limit.js +1 -1
- package/dist/src/gateway/hono/oauth-async.js +1 -7
- package/dist/src/gateway/hono/oauth.js +1 -7
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -2
- package/dist/src/gateway/hono/routes/connectors.js +79 -0
- package/dist/src/gateway/hono/routes/discussions.d.ts +3 -0
- package/dist/src/gateway/hono/routes/discussions.js +177 -0
- package/dist/src/gateway/hono/routes/execution-receipts.d.ts +3 -0
- package/dist/src/gateway/hono/routes/execution-receipts.js +163 -0
- package/dist/src/gateway/hono/routes/exposure.js +1 -1
- package/dist/src/gateway/hono/routes/goals.js +3 -288
- package/dist/src/gateway/hono/routes/home.d.ts +2 -102
- package/dist/src/gateway/hono/routes/home.js +8 -424
- package/dist/src/gateway/hono/routes/index.js +6 -2
- package/dist/src/gateway/hono/routes/memory.js +7 -7
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/notes.js +30 -0
- package/dist/src/gateway/hono/routes/projects.js +8 -152
- package/dist/src/gateway/hono/routes/shares.js +1 -1
- package/dist/src/gateway/hono/routes/status.js +2 -2
- package/dist/src/gateway/hono/routes/tunnel.js +3 -3
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/hono/routes/work.d.ts +3 -0
- package/dist/src/gateway/hono/routes/work.js +207 -0
- package/dist/src/gateway/hono/routes/you.js +13 -15
- package/dist/src/gateway/index.js +2 -2
- package/dist/src/gateway/runtime-config.js +2 -2
- package/dist/src/gateway/security/audit.js +2 -2
- package/dist/src/gateway/security/index.js +1 -1
- package/dist/src/gateway/service/config-coordinator.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.js +46 -51
- package/dist/src/gateway/service.d.ts +8 -1
- package/dist/src/gateway/service.js +142 -15
- package/dist/src/goals/goal-queue-store.d.ts +1 -0
- package/dist/src/goals/goal-queue-store.js +5 -1
- package/dist/src/goals/goal-queue-types.d.ts +11 -1
- package/dist/src/goals/goal-runner.js +10 -6
- package/dist/src/goals/goal-service.d.ts +2 -15
- package/dist/src/goals/goal-service.js +9 -42
- package/dist/src/goals/goal-store.d.ts +1 -18
- package/dist/src/goals/goal-store.js +25 -231
- package/dist/src/goals/goal-workflow-judge.js +1 -1
- package/dist/src/goals/index.d.ts +0 -4
- package/dist/src/goals/index.js +1 -3
- package/dist/src/goals/types.d.ts +4 -66
- package/dist/src/notes/agent-context.js +1 -1
- package/dist/src/notes/service.d.ts +1 -0
- package/dist/src/notes/service.js +10 -1
- package/dist/src/notes/types.d.ts +1 -0
- package/dist/src/proactive/events/product-event-bridge.d.ts +7 -0
- package/dist/src/proactive/events/product-event-bridge.js +84 -0
- package/dist/src/proactive/execution/context.d.ts +27 -11
- package/dist/src/proactive/execution/context.js +259 -25
- package/dist/src/proactive/execution/repository.js +18 -5
- package/dist/src/proactive/execution/types.d.ts +7 -1
- package/dist/src/proactive/execution/worker.js +7 -6
- package/dist/src/proactive/inbox/repository.js +8 -2
- package/dist/src/proactive/index.d.ts +4 -2
- package/dist/src/proactive/index.js +5 -3
- package/dist/src/proactive/temporal/worker.d.ts +16 -0
- package/dist/src/proactive/temporal/worker.js +110 -0
- package/dist/src/projects/project-loop.js +3 -3
- package/dist/src/providers/auth-runtime/oauth.js +12 -0
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/share/share-zip.js +1 -1
- package/dist/src/share/site-proxy.js +1 -1
- package/dist/src/storage/sqlite/activity-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/activity-repository.js +4 -1
- package/dist/src/storage/sqlite/connector-sync-policy-repository.d.ts +20 -0
- package/dist/src/storage/sqlite/connector-sync-policy-repository.js +50 -0
- package/dist/src/storage/sqlite/execution-receipt-repository.d.ts +146 -0
- package/dist/src/storage/sqlite/execution-receipt-repository.js +235 -0
- package/dist/src/storage/sqlite/index.d.ts +4 -2
- package/dist/src/storage/sqlite/index.js +6 -4
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/knowledge-repository.js +9 -1
- package/dist/src/storage/sqlite/memory-records-repository.js +1 -1
- package/dist/src/storage/sqlite/migrations/075_connector_sync_policies.sql +13 -0
- package/dist/src/storage/sqlite/migrations/076_meeting_preparation_scenario.sql +29 -0
- package/dist/src/storage/sqlite/migrations/077_proactive_insight_fingerprints.sql +4 -0
- package/dist/src/storage/sqlite/migrations/078_discussion_captures.sql +64 -0
- package/dist/src/storage/sqlite/migrations/079_discussion_follow_up_scenario.sql +29 -0
- package/dist/src/storage/sqlite/migrations/080_task_outcome_context.sql +15 -0
- package/dist/src/storage/sqlite/migrations/081_project_monitoring_policies.sql +10 -0
- package/dist/src/storage/sqlite/migrations/082_one_click_live_discussions.sql +100 -0
- package/dist/src/storage/sqlite/migrations/083_session_task_plans.sql +9 -0
- package/dist/src/storage/sqlite/migrations/084_work_intake_lifecycle.sql +26 -0
- package/dist/src/storage/sqlite/migrations/085_task_outcome_projection.sql +19 -0
- package/dist/src/storage/sqlite/migrations/086_outcome_aggregates.sql +168 -0
- package/dist/src/storage/sqlite/migrations/087_context_snapshots.sql +21 -0
- package/dist/src/storage/sqlite/migrations/088_automation_execution_deadlines.sql +5 -0
- package/dist/src/storage/sqlite/migrations/089_automation_run_leases.sql +8 -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/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/notes-repository.js +9 -0
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +89 -44
- package/dist/src/storage/sqlite/session-repository.js +1 -1
- package/dist/src/storage/sqlite/session-task-plan-repository.d.ts +20 -0
- package/dist/src/storage/sqlite/session-task-plan-repository.js +77 -0
- package/dist/src/tui/backends/embedded-backend.d.ts +2 -0
- package/dist/src/tui/backends/embedded-backend.js +12 -8
- package/dist/src/tui/tui-backend.d.ts +2 -0
- package/dist/src/tui/tui-oauth-login.js +1 -7
- package/dist/src/tui/tui-picker-overlay.js +1 -0
- package/dist/src/tui/tui-picker-services.d.ts +1 -0
- package/dist/src/tui/tui-skills-autocomplete.d.ts +6 -2
- package/dist/src/tui/tui-skills-autocomplete.js +10 -6
- package/dist/src/tui/tui-startup-resources.d.ts +3 -1
- package/dist/src/tui/tui-startup-resources.js +4 -3
- package/dist/src/tui/tui.js +4 -1
- package/dist/src/tunnel/frpc-binary.js +1 -1
- package/dist/src/tunnel/frpc-extract.js +1 -1
- package/dist/src/tunnel/index.js +2 -2
- package/dist/src/user-context/context-compiler.d.ts +31 -0
- package/dist/src/user-context/context-compiler.js +51 -0
- package/dist/src/voice/local/model-files.js +1 -1
- package/dist/src/voice/stt/config.d.ts +4 -0
- package/dist/src/voice/stt/config.js +26 -0
- package/dist/src/voice/stt/index.d.ts +1 -0
- package/dist/src/voice/stt/index.js +2 -1
- package/dist/src/voice/stt/list-providers.js +1 -1
- package/dist/src/work/attention-governor.d.ts +20 -0
- package/dist/src/work/attention-governor.js +46 -0
- package/dist/src/work/execution-context.d.ts +16 -0
- package/dist/src/work/execution-context.js +66 -0
- package/dist/src/work/home-query-service.d.ts +147 -0
- package/dist/src/work/home-query-service.js +389 -0
- package/dist/src/work/index.d.ts +14 -0
- package/dist/src/work/index.js +15 -0
- package/dist/src/work/outcome-contract-definition.d.ts +8 -0
- package/dist/src/work/outcome-contract-definition.js +15 -0
- package/dist/src/work/outcome-execution-service.d.ts +27 -0
- package/dist/src/work/outcome-execution-service.js +60 -0
- package/dist/src/work/outcome-projection-service.d.ts +7 -0
- package/dist/src/work/outcome-projection-service.js +51 -0
- package/dist/src/work/outcome-receipt-service.d.ts +13 -0
- package/dist/src/work/outcome-receipt-service.js +55 -0
- package/dist/src/work/outcome-repository.d.ts +50 -0
- package/dist/src/work/outcome-repository.js +112 -0
- package/dist/src/work/outcome-run-coordinator.d.ts +25 -0
- package/dist/src/work/outcome-run-coordinator.js +117 -0
- package/dist/src/work/project-monitoring-service.d.ts +21 -0
- package/dist/src/work/project-monitoring-service.js +76 -0
- package/dist/src/work/project-operating-view-service.d.ts +10 -0
- package/dist/src/work/project-operating-view-service.js +46 -0
- package/dist/src/work/work-intake-repository.d.ts +49 -0
- package/dist/src/work/work-intake-repository.js +97 -0
- package/dist/src/work/work-intake-service.d.ts +26 -0
- package/dist/src/work/work-intake-service.js +171 -0
- package/dist/src/work/work-value-metrics-service.d.ts +4 -0
- package/dist/src/work/work-value-metrics-service.js +88 -0
- package/dist/src/work-items/work-item-service.d.ts +0 -2
- package/dist/src/work-items/work-item-service.js +0 -28
- package/dist/src/workflows/service/workflow-run-service.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.types.d.ts +3 -1
- package/dist/src/workflows/service/workflow-session-bridge.js +2 -2
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/agents-DC9F12Kw.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-5bKr05Fa.js +0 -1
- package/dist/gateway/static/root/assets/automation-suggestion-card-B7mxFRtf.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-Dg6dmt5g.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-BHoo6Rpq.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BlsqN8Fu.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DJeT8_B4.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-C4VVjYEm.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-vdf8kB16.js +0 -1
- package/dist/gateway/static/root/assets/circle-alert-BEjgurr2.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DNcrDThX.js +0 -2
- package/dist/gateway/static/root/assets/desktop-pet-B1urphOZ.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DTL6J3EP.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DmObBx9b.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-BRhmmBe9.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-C1k7_s_O.js +0 -4
- package/dist/gateway/static/root/assets/goals-config-api-Fwu1wjEP.js +0 -1
- package/dist/gateway/static/root/assets/goals-page-hOu9uA3q.js +0 -2
- package/dist/gateway/static/root/assets/goals-settings-DY-JjvHz.js +0 -1
- package/dist/gateway/static/root/assets/index-C0CGebQ1.js +0 -212
- package/dist/gateway/static/root/assets/index-eqq25gvV.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-EjsNT7nJ.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-Dswjlraa.js +0 -7
- package/dist/gateway/static/root/assets/messages-DP6tPKk-.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-DSh3-hMY.js +0 -4
- package/dist/gateway/static/root/assets/product-delivery-BTRT9kCS.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-D0QPRHR_.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-CI5Vz62F.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-S1jpzBS5.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CTm66k7h.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CU52AUVD.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DK6XK95e.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Bvv_u4ii.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BGHvVbay.js +0 -2
- package/dist/gateway/static/root/assets/time-picker-XwpxdZFr.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-DBCMk-Vn.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-C1UIdsCl.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-DEAQepB8.js +0 -1
- package/dist/gateway/static/root/assets/work-page-D5qYmCTq.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-yrK17ZZ5.js +0 -11
- package/dist/src/agent/outcomes/task-verifier.d.ts +0 -29
- package/dist/src/gateway/hono/routes/task-outcomes.d.ts +0 -3
- package/dist/src/gateway/hono/routes/task-outcomes.js +0 -109
- package/dist/src/goals/goal-contract-draft.d.ts +0 -15
- package/dist/src/goals/goal-contract-draft.js +0 -112
- package/dist/src/goals/goal-evidence-review.d.ts +0 -15
- package/dist/src/goals/goal-evidence-review.js +0 -89
- package/dist/src/storage/sqlite/task-outcome-repository.d.ts +0 -90
- package/dist/src/storage/sqlite/task-outcome-repository.js +0 -138
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,s as t}from"./locale-store-BNC8HUCI.js";import{a as n,i as r,l as i,n as a,o,r as s,s as c,t as l}from"./schemas-C6onAggk.js";import{co as u,do as d,lo as f,uo as p}from"./index-BA56bQ68.js";var m=l([`backlog`,`todo`,`in_progress`,`blocked`,`needs_input`,`in_review`,`done`,`cancelled`]),h=l([`urgent`,`high`,`normal`,`low`]),g=c({id:i(),projectId:i(),projectName:i(),title:i(),status:m,priority:h,nextAction:i().optional(),blockedReason:i().optional(),dueAt:o().optional(),completedAt:o().optional(),updatedAt:o()}),_=c({id:i(),kind:l([`agent_judgment`,`work_item`,`goal`,`connector_approval`,`goal_evidence`]),title:i(),detail:i().optional(),reason:l([`needs_input`,`in_review`,`blocked`,`overdue`,`due_soon`,`decision_needed`,`approval_required`]),urgency:l([`now`,`soon`]),href:i(),projectId:i().optional(),projectName:i().optional(),updatedAt:o(),judgment:c({inboxItemId:i(),whyNow:i(),impact:i(),workDone:i(),recommendation:i(),confidence:o(),valueScore:o().min(0).max(1).optional(),decision:c({question:i(),options:a(c({id:i(),label:i(),consequence:i()}))}).optional()}).optional(),response:r(`kind`,[c({kind:n(`connector_approval`),approvalId:i()}),c({kind:n(`goal_evidence`),goalId:i(),requirementId:i()})]).optional()}),v=c({id:i(),kind:l([`automation_run`,`workflow_run`]),runId:i(),title:i(),detail:i(),reason:l([`run_failed`,`run_timeout`]),href:i(),updatedAt:o(),sessionKey:i().optional()}),y=c({id:i(),name:i().optional(),trigger:i(),action:i(),nextRunAt:i()}),b=c({id:i(),definitionId:i(),title:i(),status:i(),sessionKey:i().optional(),createdAtMs:o(),startedAtMs:o().optional(),completedAtMs:o().optional()}),x=c({key:i(),name:i(),updatedAt:i().optional(),active:s()}),S=c({id:i(),kind:l([`work_item`,`workflow_run`,`automation_run`]),title:i(),href:i(),completedAt:o()}),C=c({briefing:c({generatedAt:o(),summary:i(),focus:a(_),progress:c({activeWorkCount:o(),activeWorkflowCount:o(),activeGoalCount:o(),movingCount:o()}),wins:a(S),nextScheduled:y.optional()}),decisions:a(_),attention:a(v),attentionPolicy:c({visibleDecisionCount:o().int().nonnegative(),suppressedDecisionCount:o().int().nonnegative(),visibleAttentionCount:o().int().nonnegative(),suppressedAttentionCount:o().int().nonnegative()}).default({visibleDecisionCount:0,suppressedDecisionCount:0,visibleAttentionCount:0,suppressedAttentionCount:0}),chats:c({running:a(x),recent:a(x)}),work:c({attentionCount:o(),overdueCount:o(),todayCount:o(),items:a(g),current:a(g),recentlyCompleted:a(g)}),workflowRuns:c({active:a(b),recent:a(b)}),upcomingAutomations:a(y),outcomes:c({running:a(d),needsUser:a(d),recentlyCompleted:a(d)}).default({running:[],needsUser:[],recentlyCompleted:[]}),recentOutcomes:a(p).default([])}).passthrough();c({northStar:c({weeklyTrustedProgress:o(),weeklyActiveUsers:o(),trustedProgressPerWeeklyActiveUser:o()}),intake:c({total:o(),proposed:o(),confirmed:o(),expired:o(),runNow:o(),createOnly:o(),queued:o(),pendingQueueRecovery:o(),confirmationRate:o(),queueRate:o()}),outcomes:c({total:o(),achieved:o(),partial:o(),notAchieved:o(),userCorrected:o(),achievementRate:o(),correctionRate:o(),trusted:o(),trustedRate:o()})});function w(e){return C.parse(e)}async function T(n){let r=await t(e(`/api/outcomes/${encodeURIComponent(n)}`));return{outcome:d.parse(r.outcome),receipts:p.array().parse(r.receipts)}}async function E(n,r){let i=await t(e(`/api/outcomes/${encodeURIComponent(n)}/actions`),{method:`POST`,body:JSON.stringify({action:r})});return d.parse(i.outcome)}async function D(n){let r=await t(e(`/api/work/intakes`),{method:`POST`,body:JSON.stringify({idempotencyKey:crypto.randomUUID(),objective:n})});return f.parse(r.proposal)}async function O(n){let r=await t(e(`/api/work/intakes/${encodeURIComponent(n)}/confirm`),{method:`POST`,body:JSON.stringify({executionMode:`run_now`})});return u.parse(r.work)}function k(n){return t(e(`/api/home${n?`?locale=${encodeURIComponent(n)}`:``}`)).then(w)}function A(n,r){return t(e(`/api/home/decisions/respond`),{method:`POST`,body:JSON.stringify({...n,decision:r})})}function j(n){return t(e(`/api/home/attention/acknowledge`),{method:`POST`,body:JSON.stringify(n)})}function M(n,r){return t(e(`/api/inbox/judgments/${encodeURIComponent(n)}/decisions`),{method:`POST`,body:JSON.stringify({choice:r})})}function N(n,r){return t(e(`/api/inbox/judgments/${encodeURIComponent(n)}/transition`),{method:`POST`,body:JSON.stringify(r===`snoozed`?{status:r,snoozedUntil:new Date(Date.now()+1440*60*1e3).toISOString()}:r===`resolved`?{status:r,resolution:`dismissed`}:{status:r})})}function P(n,r){return t(e(`/api/inbox/judgments/${encodeURIComponent(n)}/instructions`),{method:`POST`,body:JSON.stringify({instruction:r})})}function F(n){return t(e(`/api/home/attention/retry`),{method:`POST`,body:JSON.stringify(n)})}function I(e){return e===`zh`?{newWork:`交给 xopc`,dialogTitle:`现在想完成什么?`,dialogDescription:`xopc 会先理解目标、归属项目和下一步,由你确认后再建立工作。`,intentLabel:`告诉 xopc 你要做什么`,intentPlaceholder:`例如:整理这周的会议记录,提炼待办并给出下周优先级`,submit:`生成工作方案`,proposalTitle:`确认工作方案`,projectLabel:`归属项目`,outcomeLabel:`期望结果`,nextActionLabel:`第一步`,monitoringLabel:`主动跟进`,monitoringModes:{observe:`仅观察`,ask_before_action:`行动前询问`,auto_low_risk:`自动执行低风险操作`},existingProject:`已有项目`,newProject:`新项目`,editIntent:`返回修改`,confirmWork:`确认并建立工作`,needsAttention:`需要你处理`,runAttention:`运行异常`,running:`xopc 正在处理`,continue:`继续推进`,recent:`最近对话`,recentOutcomes:`最近完成`,evidenceCount:`项证据`,remainingCount:`项待继续`,projects:`长期项目`,emptyRunning:`当前没有正在处理的对话`,emptyContinue:`还没有需要继续推进的事项`,openChat:`打开对话`,whyNow:`为什么现在`,impact:`影响`,workDone:`AI 已完成`,recommendation:`建议`,snooze:`明天再看`,dismiss:`忽略`,feedbackPlaceholder:`告诉 AI:以后遇到这类情况应该怎样判断…`,applyFeedback:`调整后续判断`,outcomeStatuses:{running:`正在推进`,needs_user:`需要你`,completed:`已完成`},successDefinition:`怎样才算完成`,deliverables:`交付物`,constraints:`约束与边界`,approvalRequired:`需要你批准`,executionReceipts:`执行回执`,noDefinition:`系统正在进一步明确完成标准。未明确前不会把事情误判为已完成。`,noReceipts:`还没有执行回执。`,backToWork:`返回首页`,outcomeNotFound:`没有找到这个结果`,runOutcome:`开始推进`,pauseOutcome:`暂时暂停`,resumeOutcome:`继续推进`,cancelOutcome:`结束事项`,actionFailed:`操作失败,请重试。`,verificationStatuses:{passed:`已验证`,failed:`验证未通过`,unverified:`待验证`}}:{newWork:`Ask xopc`,dialogTitle:`What do you want to get done?`,dialogDescription:`xopc will clarify the outcome, project, and first action before creating the work.`,intentLabel:`Tell xopc what you need`,intentPlaceholder:`For example: summarize this week’s meeting notes and suggest next week’s priorities`,submit:`Prepare work plan`,proposalTitle:`Confirm work plan`,projectLabel:`Project`,outcomeLabel:`Desired outcome`,nextActionLabel:`First action`,monitoringLabel:`Proactive follow-up`,monitoringModes:{observe:`Observe only`,ask_before_action:`Ask before acting`,auto_low_risk:`Auto-run low-risk actions`},existingProject:`Existing project`,newProject:`New project`,editIntent:`Edit intent`,confirmWork:`Confirm and create`,needsAttention:`Needs your attention`,runAttention:`Run issues`,running:`xopc is working`,continue:`Continue`,recent:`Recent conversations`,recentOutcomes:`Recent outcomes`,evidenceCount:`evidence items`,remainingCount:`remaining`,projects:`Long-term projects`,emptyRunning:`No conversations are running`,emptyContinue:`No ongoing items yet`,openChat:`Open conversation`,whyNow:`Why now`,impact:`Impact`,workDone:`AI checked`,recommendation:`Recommendation`,snooze:`Tomorrow`,dismiss:`Dismiss`,feedbackPlaceholder:`Tell AI how to judge this kind of event next time…`,applyFeedback:`Update future judgments`,outcomeStatuses:{running:`In progress`,needs_user:`Needs you`,completed:`Completed`},successDefinition:`Definition of done`,deliverables:`Deliverables`,constraints:`Constraints and boundaries`,approvalRequired:`Your approval is required`,executionReceipts:`Execution receipts`,noDefinition:`xopc is still clarifying the completion criteria. It will not mark this done before they are explicit.`,noReceipts:`No execution receipts yet.`,backToWork:`Back to home`,outcomeNotFound:`This outcome was not found`,runOutcome:`Start working`,pauseOutcome:`Pause`,resumeOutcome:`Continue`,cancelOutcome:`End outcome`,actionFailed:`The action failed. Please try again.`,verificationStatuses:{passed:`Verified`,failed:`Verification failed`,unverified:`Not verified`}}}export{M as a,P as c,F as d,N as f,O as i,D as l,j as n,T as o,E as r,k as s,I as t,A as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{f as r,l as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./messages-H_iJjnEM.js";import{n as ee}from"./locale-store-BNC8HUCI.js";import{Ao as te,Bo as ne,Fl as s,Fo as re,Io as ie,Lo as ae,Mo as oe,Ms as se,Mt as ce,No as c,Oo as l,Ot as le,Po as u,Ps as ue,Ro as de,_u as d,eo as f,fc as p,iu as fe,jl as pe,jo as me,js as m,ko as he,nl as h,yu as ge,zl as _e,zo as g}from"./index-BA56bQ68.js";var _=e(t(),1),v=new Set([`completed`,`failed`,`canceled`]);function y(){return new Promise(e=>window.setTimeout(e,1200))}async function ve(e,t){let n=[],r=t.wait??y;for(let i=0;i<e.length&&!t.shouldStop?.();i+=1){let a=e[i];if(a)try{await t.grantDirectory(a.rootPath);let o=await t.startRun(a.rootPath);for(t.onRun(o,i,e.length);!v.has(o.status)&&!t.shouldStop?.();)await r(),o=await t.fetchRun(o.id),t.onRun(o,i,e.length);if(n.push(o),o.status===`canceled`||t.shouldStop?.())break}catch(e){if(t.onError?.(e,a,i),t.shouldStop?.())break}}return n}var b=n(),ye=[`folder_structure`,`recent_progress`,`next_steps`];function x(e){return e instanceof Error?e.message:String(e)}function S(){let e=ee(e=>e.language),t=o(e).onboarding.workDiscovery,n=o(e).chat.workingDirectory,v=i(),[y]=r(),S=y.get(`new`)===`1`,[C,w]=(0,_.useState)(`loading`),[T,E]=(0,_.useState)(null),[D,O]=(0,_.useState)(null),[k,A]=(0,_.useState)(!1),[j,M]=(0,_.useState)(null),[be,N]=(0,_.useState)(!1),[P,F]=(0,_.useState)(``),[I,L]=(0,_.useState)(!1),[R,z]=(0,_.useState)(()=>new Set),[B,xe]=(0,_.useState)([]),[V,H]=(0,_.useState)(()=>new Set),[Se,U]=(0,_.useState)([]),[W,Ce]=(0,_.useState)(!1),[G,K]=(0,_.useState)({current:0,total:0}),q=(0,_.useRef)(!1),J=(0,_.useCallback)(e=>{l.getState().updateDirectoryRun(e),O(e),e.status===`completed`?(z(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),w(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`)):e.status===`failed`||e.status===`canceled`?w(`error`):w(`running`)},[]),we=async()=>{A(!0),M(null);try{let e=await te();if(!e.length){M(t.noCandidates);return}xe(e),H(new Set([e[0].rootPath])),w(`candidates`)}catch(e){M(x(e))}finally{A(!1)}},Te=e=>{H(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Ee=(0,_.useCallback)((e,t,n)=>{l.getState().updateDirectoryRun(e),O(e),K({current:t+1,total:n}),U(n=>{let r=[...n];return r[t]=e,r}),w(`running`)},[]),De=(0,_.useCallback)(e=>{U(t=>t.map(t=>t?.id===e.id?e:t))},[]),Oe=async()=>{let e=B.filter(e=>V.has(e.rootPath));if(!e.length)return;A(!0),M(null),U([]),K({current:1,total:e.length}),Ce(!0),q.current=!1;let n=!1;try{let r=await ve(e,{grantDirectory:u,startRun:de,fetchRun:c,shouldStop:()=>q.current,onRun:(e,t,r)=>{Ee(e,t,r),n||(n=!0,l.getState().scanPersonalContext(e.id))},onError:(n,r,i)=>{K({current:i+1,total:e.length}),M(t.folderAnalysisFailed.replace(`{{folder}}`,r.displayName).replace(`{{error}}`,x(n)))}});if(q.current)return;let i=r.find(e=>e.status===`completed`)??r.at(-1);i?J(i):w(`candidates`)}catch(e){M(x(e)),w(`candidates`)}finally{Ce(!1),A(!1)}},Y=ce({onPicked:(0,_.useCallback)(async e=>{A(!0),M(null);try{E(await re(e)),w(`consent`)}catch(e){M(x(e)),w(`intro`)}finally{A(!1)}},[])});(0,_.useEffect)(()=>{let e=!1;return oe().then(async({enabled:t,state:n})=>{if(!e){if(!t){v(`/chat`,{replace:!0});return}if(!S&&n.activeRunId)try{let t=await c(n.activeRunId);e||J(t);return}catch{}e||w(`intro`)}}).catch(t=>{e||(M(x(t)),w(`intro`))}),()=>{e=!0}},[J,v,S]),(0,_.useEffect)(()=>{if(!D||C!==`running`||W)return;let e=!1,t=async()=>{try{let t=await c(D.id);e||J(t)}catch{}},n=window.setInterval(()=>void t(),1200),r=e=>{let n=e.detail;(!n?.runId||n.runId===D.id)&&t()};for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.addEventListener(e,r);return()=>{e=!0,window.clearInterval(n);for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.removeEventListener(e,r)}},[J,W,C,D]);let ke=async()=>{A(!0);try{await me()}finally{v(`/chat`,{replace:!0})}},Ae=async()=>{if(T){A(!0),M(null),U([]),K({current:0,total:0});try{await u(T.canonicalRootPath);let e=await de(T.canonicalRootPath);J(e),l.getState().scanPersonalContext(e.id)}catch(e){M(x(e)),w(`consent`)}finally{A(!1)}}},X=(e,t)=>{let n=t?`?draft=${encodeURIComponent(t)}`:``;v(`/chat/${encodeURIComponent(e)}${n}`)},je=e=>{O(e),N(!1),L(!1),z(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),e.status===`completed`?w(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?w(`error`):w(`running`)},Me=async()=>{D&&(q.current=!0,J(await he(D.id)))},Z=async(t,n)=>{if(!D)return;await ae(D.id,t.id).catch(()=>{});let r=n?`${e===`zh`?`先帮我评估这个方向,不要修改文件:`:`First assess this direction without changing files:`}\n\n${t.actionPrompt}`:t.actionPrompt;X(D.sessionKey,r)},Ne=async()=>{if(D){A(!0),M(null);try{let e=D.result?.profileCandidates??[],t=await g((e.length>0?await ne(D.id,e.map(e=>({id:e.id,status:R.has(e.id)?`accepted`:`rejected`}))):D).id,`confirmed`);O(t),De(t),w(`recommendation`)}catch(e){M(x(e))}finally{A(!1)}}},Q=async e=>{if(!(!D||!P.trim())){A(!0),M(null);try{let t=await g(D.id,e,P.trim());O(t),X(t.sessionKey,P.trim())}catch(e){M(x(e)),A(!1)}}},Pe=async()=>{if(D){A(!0);try{X((await g(D.id,`dismissed`)).sessionKey)}catch(e){M(x(e)),A(!1)}}},$=D?.result?.suggestions.find(e=>e.id===D.result?.primarySuggestionId)??D?.result?.suggestions[0],Fe=D?.result?.suggestions.filter(e=>e.id!==$?.id)??[],Ie=e=>e===`command`?t.riskCommand:e===`file_write`?t.riskFileWrite:t.riskAnalysis,Le=Se.filter(e=>e?.status===`completed`),Re=Le.length>1?(0,b.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,b.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:t.analysisResults}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Le.map(e=>{let t=B.find(t=>t.rootPath===e.rootPath)?.displayName??e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return(0,b.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-sm font-medium transition ${e.id===D?.id?`bg-accent text-white`:`bg-surface-muted text-fg hover:bg-surface-hover`}`,onClick:()=>je(e),children:t},e.id)})})]}):null;return(0,b.jsxs)(`div`,{className:`flex min-h-full flex-1 flex-col bg-surface-base`,children:[(0,b.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[40rem] flex-1 flex-col px-5 py-10 sm:px-8 sm:py-16`,children:[(0,b.jsx)(`div`,{className:`mb-10 flex items-center justify-center`,children:(0,b.jsx)(se,{className:`size-11`})}),C===`loading`?(0,b.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,b.jsx)(f,{className:`mx-auto h-8 w-64`}),(0,b.jsx)(f,{className:`mx-auto h-4 w-full max-w-lg`}),(0,b.jsx)(f,{className:`mx-auto size-4/5 max-w-md`}),(0,b.jsx)(f,{className:`mt-8 h-12 w-full rounded-xl`})]}):null,C===`intro`?(0,b.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,b.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.title}),(0,b.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:t.subtitle})]}),(0,b.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[(0,b.jsxs)(m,{type:`button`,className:`h-12 w-full gap-2 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void we(),disabled:k||Y.picking,children:[k?(0,b.jsx)(h,{className:`size-4 animate-spin`}):(0,b.jsx)(p,{className:`size-4`}),t.quickScan]}),(0,b.jsxs)(m,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:Y.pick,disabled:k||Y.picking,children:[Y.picking?(0,b.jsx)(h,{className:`size-4 animate-spin`}):(0,b.jsx)(s,{className:`size-4`}),t.chooseFolderManually]}),(0,b.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`span`,{children:t.quickScanNote})]}),j?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null]}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void ke(),disabled:k,children:t.skip})]}):null,C===`candidates`?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-candidates-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.candidatesTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.candidatesSubtitle})]}),(0,b.jsx)(`div`,{className:`mt-7 space-y-2`,children:B.map((e,n)=>{let r=V.has(e.rootPath);return(0,b.jsxs)(`button`,{type:`button`,"aria-pressed":r,className:`flex w-full items-start gap-3 rounded-xl border p-4 text-left transition ${r?`border-accent bg-accent-soft/45`:`border-edge bg-surface-panel hover:border-edge-strong`}`,onClick:()=>Te(e.rootPath),children:[(0,b.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border ${r?`border-accent bg-accent text-white`:`border-edge bg-surface-base text-transparent`}`,children:(0,b.jsx)(a,{className:`size-3.5`})}),(0,b.jsx)(s,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,b.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),n===0?(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:t.recommendedCandidate}):null]}),(0,b.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,b.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,b.jsx)(`span`,{children:e.projectKind===`coding`?t.codingProject:e.projectKind===`general`?t.generalProject:t.unknownProject}),e.branch?(0,b.jsx)(`span`,{children:t.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,b.jsx)(`span`,{children:t.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,b.jsxs)(`div`,{className:`mt-5 flex items-start gap-2 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`span`,{children:t.multiFolderPrivacyNote})]}),j?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null,(0,b.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(m,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:k||V.size===0,onClick:()=>void Oe(),children:[k?(0,b.jsx)(h,{className:`mr-2 size-4 animate-spin`}):null,t.analyzeSelected.replace(`{{count}}`,String(V.size))]}),(0,b.jsx)(m,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:k,onClick:Y.pick,children:t.chooseFolderManually})]}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>w(`intro`),children:t.back})]}):null,C===`consent`&&T?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.selectedTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.selectedSubtitle})]}),(0,b.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,b.jsx)(s,{className:`size-5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:T.displayName}),(0,b.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:T.canonicalRootPath})]}),(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:T.projectKind===`coding`?t.codingProject:T.projectKind===`general`?t.generalProject:t.unknownProject})]}),(0,b.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle bg-surface-base/60 p-4 sm:grid-cols-2`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.localFingerprint}),(0,b.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:T.fingerprint.branch?t.branchValue.replace(`{{branch}}`,T.fingerprint.branch):t.noGitBranch})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.recentActivity}),(0,b.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:t.changedFiles.replace(`{{count}}`,String(T.fingerprint.changedFileCount))})]}),T.fingerprint.recentAreas.length>0?(0,b.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.recentAreas}),(0,b.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:T.fingerprint.recentAreas.map(e=>(0,b.jsx)(`code`,{className:`rounded-md bg-surface-muted px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,b.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(_e,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.willRead}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.willReadValue})]})]}),(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(ue,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.willIgnore}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.willIgnoreValue})]})]}),(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:T.remoteModel?t.providerDisclosure.replace(`{{provider}}`,T.provider):t.localDisclosure})]})]})]}),j?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null,(0,b.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(m,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:k,onClick:()=>void Ae(),children:[k?(0,b.jsx)(h,{className:`mr-2 size-4 animate-spin`}):null,t.startAnalysis]}),(0,b.jsx)(m,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:k,onClick:Y.pick,children:t.changeFolder})]}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void ke(),children:t.skip})]}):null,C===`running`&&D?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.analyzingTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.analyzingSubtitle}),G.total>1?(0,b.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:t.analyzingFolderProgress.replace(`{{current}}`,String(G.current)).replace(`{{total}}`,String(G.total))}):null]}),(0,b.jsx)(`div`,{className:`mt-9 rounded-xl border border-edge bg-surface-panel px-5 py-2`,children:ye.map((e,n)=>{let r=Math.max(0,ye.indexOf(D.stage??`folder_structure`)),i=n<r,o=n===r;return(0,b.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,b.jsx)(`span`,{className:`flex size-7 items-center justify-center rounded-full ${i?`bg-accent text-white`:o?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-subtle`}`,children:i?(0,b.jsx)(a,{className:`size-4`}):o?(0,b.jsx)(h,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,b.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`})}),(0,b.jsx)(`span`,{className:o||i?`text-sm font-medium text-fg`:`text-sm text-fg-muted`,children:t.stages[e]})]},e)})}),(0,b.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:D.rootPath}),(0,b.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3`,children:[(0,b.jsx)(m,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:()=>v(`/chat`),children:t.continueInBackground}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void Me(),children:t.cancelAnalysis})]})]}):null,C===`recognition`&&D?.result?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-recognition-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:t.recognitionEyebrow}),(0,b.jsx)(`h1`,{id:`work-discovery-recognition-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:D.result.lowConfidence?t.lowConfidenceTitle:t.recognitionTitle})]}),Re,(0,b.jsxs)(`div`,{className:`mt-7 rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/45 via-surface-panel to-surface-panel p-5 sm:p-6`,children:[(0,b.jsx)(`p`,{className:`text-base font-medium leading-7 text-fg`,children:D.result.projectSummary}),(0,b.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:D.result.currentState}),!D.result.lowConfidence&&$?.evidence.length?(0,b.jsx)(`ul`,{className:`mt-5 space-y-2 border-t border-edge-subtle pt-4`,children:$.evidence.slice(0,3).map((e,t)=>(0,b.jsxs)(`li`,{className:`flex gap-2 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(pe,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`span`,{children:[e.path?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${$.id}-recognition-${t}`))}):null]}),D.result.workThreads?.length?(0,b.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.workThreadsTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.workThreadsSubtitle}),(0,b.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle`,children:D.result.workThreads.map(e=>(0,b.jsxs)(`div`,{className:`py-3 first:pt-0 last:pb-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:e.horizon===`current`?t.workThreadCurrent:e.horizon===`ongoing`?t.workThreadOngoing:t.workThreadLongTerm}),(0,b.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title})]}),(0,b.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:e.summary})]},e.id))})]}):null,D.result.profileCandidates?.length?(0,b.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.profileCandidatesTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.profileCandidatesSubtitle}),(0,b.jsx)(`div`,{className:`mt-3 space-y-2`,children:D.result.profileCandidates.map(e=>(0,b.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg px-2 py-2 hover:bg-surface-muted`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 rounded border-edge accent-accent`,checked:R.has(e.id),onChange:()=>z(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})}),(0,b.jsx)(`span`,{className:`text-sm leading-5 text-fg`,children:e.statement})]},e.id))})]}):null,D.result.lowConfidence?(0,b.jsxs)(`div`,{className:`mt-5`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium leading-6 text-fg`,children:D.result.contextQuestion}),(0,b.jsx)(`textarea`,{value:P,onChange:e=>F(e.target.value),placeholder:t.correctionPlaceholder,className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,b.jsx)(m,{className:`mt-3 w-full bg-accent text-white hover:bg-accent-hover`,disabled:k||!P.trim(),onClick:()=>void Q(`different_goal`),children:t.continueWithCorrection})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(m,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:k,onClick:()=>void Ne(),children:[k?(0,b.jsx)(h,{className:`size-4 animate-spin`}):(0,b.jsx)(a,{className:`size-4`}),t.confirmUnderstanding]}),(0,b.jsx)(m,{variant:`secondary`,className:`h-11 flex-1`,disabled:k,onClick:()=>N(e=>!e),children:t.notQuiteRight})]}),be?(0,b.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`work-discovery-correction`,children:t.correctionLabel}),(0,b.jsx)(`textarea`,{id:`work-discovery-correction`,value:P,onChange:e=>F(e.target.value),placeholder:t.correctionPlaceholder,className:`mt-2 min-h-24 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,b.jsx)(m,{variant:`ghost`,disabled:k||!P.trim(),onClick:()=>void Q(`different_goal`),children:t.differentGoal}),(0,b.jsx)(m,{variant:`primary`,disabled:k||!P.trim(),onClick:()=>void Q(`corrected`),children:t.useCorrection})]})]}):null]}),j?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null,(0,b.jsx)(`button`,{type:`button`,disabled:k,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:()=>void Pe(),children:t.openConversation})]}):null,C===`recommendation`&&D?.result&&$?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:t.understandingConfirmed}),(0,b.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:t.primaryRecommendationTitle})]}),Re,(0,b.jsx)(`article`,{className:`mt-7 rounded-2xl border border-accent/30 bg-surface-panel p-5 sm:p-6`,children:(0,b.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,b.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,b.jsx)(d,{className:`size-5`})}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:$.title}),(0,b.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:$.rationale}),(0,b.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:[(0,b.jsx)(fe,{className:`size-3.5`}),t.estimatedMinutes.replace(`{{count}}`,String($.estimatedMinutes))]}),(0,b.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:Ie($.risk)})]}),(0,b.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.expectedOutcome}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:$.expectedOutcome})]}),(0,b.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,b.jsx)(m,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void Z($,!1),children:t.startRecommendedAction}),(0,b.jsx)(m,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void Z($,!0),children:t.explainFirst})]})]})]})}),Fe.length>0?(0,b.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,b.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between py-2 text-sm font-medium text-fg-muted hover:text-fg`,onClick:()=>L(e=>!e),children:[t.otherDirections,(0,b.jsx)(ge,{className:`size-4 transition-transform ${I?`rotate-180`:``}`})]}),I?(0,b.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:Fe.map(e=>(0,b.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void Z(e,!0),children:[(0,b.jsx)(d,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,b.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedOutcome})]})]},e.id))}):null]}):null,(0,b.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,b.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>X(D.sessionKey),children:t.doSomethingElse}),(0,b.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>{N(!0),w(`recognition`)},children:t.correctUnderstanding})]})]}):null,C===`error`&&D?(0,b.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,b.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,b.jsx)(ue,{className:`size-5`})}),(0,b.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:t.errorTitle}),(0,b.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:D.errorMessage}),(0,b.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsx)(m,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void ie(D.id).then(J),children:t.retry}),(0,b.jsx)(m,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{O(null),E(null),w(`intro`)},children:t.chooseDifferent})]}),(0,b.jsx)(`button`,{type:`button`,className:`mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>X(D.sessionKey),children:t.openConversation})]}):null]}),Y.hasNativePicker?null:(0,b.jsx)(le,{open:Y.modalOpen,onOpenChange:Y.setModalOpen,initialAbsolutePath:T?.canonicalRootPath,onConfirm:Y.confirmPick,wd:n})]})}export{S as WorkDiscoveryPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,f as a,l as o,t as s}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as c}from"./cn-JdwAhgNB.js";import{t as ee}from"./messages-H_iJjnEM.js";import{n as te}from"./locale-store-BNC8HUCI.js";import{Bc as ne,Cc as re,Do as l,Et as ie,Gl as ae,Iu as u,Js as d,O as f,Pa as p,Su as oe,Yl as se,Zc as ce,a as le,as as m,c as ue,d as de,eo as h,f as fe,ht as g,is as _,jc as pe,jl as me,js as v,l as y,mu as he,o as ge,p as b,qs as _e,wc as ve,zl as x}from"./index-BA56bQ68.js";var S=n(),C=e(t(),1),w=r();function ye(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function T(e){return e?g(new Date(e)):``}function be(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function xe(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:e.kind===`note`?`/notes/${encodeURIComponent(e.targetId)}`:`#`}function E(e){let t=(0,S.c)(7),{label:n,children:r}=e,i;t[0]===n?i=t[1]:(i=(0,w.jsx)(`dt`,{className:`text-xs leading-5 text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,w.jsx)(`dd`,{className:`min-w-0 overflow-hidden break-words text-sm leading-5 text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,w.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-start gap-3 py-2.5 first:pt-0 last:pb-0`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function D(e){let t=(0,S.c)(9),{events:n,t:r}=e;if(!n.length){let e;return t[0]===r.detail.noActivity?e=t[1]:(e=(0,w.jsx)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted`,children:r.detail.noActivity}),t[0]=r.detail.noActivity,t[1]=e),e}let i;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,w.jsxs)(`article`,{className:`relative grid grid-cols-[0.75rem_minmax(0,1fr)] gap-3 py-3 first:pt-1`,children:[(0,w.jsx)(`span`,{className:`relative z-10 mt-1.5 size-3 rounded-full border-2 border-surface-base bg-fg-disabled`,"aria-hidden":!0}),(0,w.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-baseline justify-between gap-x-4 gap-y-0.5`,children:[(0,w.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r.eventTypes[e.type]??e.type}),(0,w.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:T(e.createdAt)})]})]},e.id),t[5]=r,t[6]=e),i=n.map(e),t[2]=n,t[3]=r,t[4]=i}else i=t[4];let a;return t[7]===i?a=t[8]:(a=(0,w.jsx)(`div`,{className:`relative grid gap-0 before:absolute before:bottom-3 before:left-[5px] before:top-3 before:w-px before:bg-edge`,children:i}),t[7]=i,t[8]=a),a}function O(e){return new Set(e.toLowerCase().split(/[^a-z0-9\u4e00-\u9fff]+/).filter(e=>e.length>=2))}function k(e,t,n){let r=t?.projectKind,i=[e.title,e.description,e.nextAction,e.blockedReason,e.status,e.priority,t?.name,t?.description,r].filter(Boolean).join(` `),a=[n.title,n.description,n.metadata.whenToUse,...n.metadata.tags??[]].filter(Boolean).join(` `),o=O(i),s=0;for(let e of O(a))o.has(e)&&(s+=3);let c=a.toLowerCase();return(e.status===`blocked`||e.status===`needs_input`)&&/debug|diagnos|review|audit|fix|检查|排查|修复/.test(c)&&(s+=8),e.status===`in_review`&&/review|audit|check|验收|评审|检查/.test(c)&&(s+=6),e.attachments?.length&&/analy|extract|summar|review|整理|分析|总结/.test(c)&&(s+=5),r===`coding`&&/code|repo|test|pr|review|代码|仓库|测试/.test(c)&&(s+=5),s}function A(e,t,n){return[...n].sort((n,r)=>k(e,t,r)-k(e,t,n)||n.title.localeCompare(r.title))}function j(){let{workItemId:e=``}=i(),t=o(),[n]=a(),r=ee(te(e=>e.language)),g=r.projectDetailPage.workItems,[S,O]=(0,C.useState)(null),[j,M]=(0,C.useState)(null),[Se,N]=(0,C.useState)([]),[P,Ce]=(0,C.useState)([]),[F,I]=(0,C.useState)(``),[L,R]=(0,C.useState)(``),[z,B]=(0,C.useState)(!0),[V,H]=(0,C.useState)(!1),[U,W]=(0,C.useState)(null),G=(0,C.useRef)(null),K=l(e=>e.setPageHeader),q=l(e=>e.clearPageHeader),J=(0,C.useMemo)(()=>S?`/projects/${encodeURIComponent(S.projectId)}/work-items`:`/projects`,[S]),Y=(0,C.useMemo)(()=>ie(n.get(`returnTo`),J,[`/projects`,`/chat`]),[J,n]),X=(0,C.useCallback)(async()=>{if(e){B(!0),W(null);try{let[t,n]=await Promise.all([ue(e),y(e).catch(()=>({events:[]}))]);O(t.item),R(t.item.nextAction||t.item.title),N(n.events);let[r,i]=await Promise.all([p(t.item.projectId).catch(()=>null),f().catch(()=>[])]),a=A(t.item,r,i);M(r),Ce(a),I(e=>e||a[0]?.id||``)}catch(e){W(e instanceof Error?e.message:String(e))}finally{B(!1)}}},[e]);(0,C.useEffect)(()=>{X()},[X]);let we=(0,C.useCallback)(async()=>{if(S){H(!0),W(null);try{let e=await de(S.id);O(e.item),t(`/chat/${encodeURIComponent(e.session.key)}`)}catch(e){W(e instanceof Error?e.message:String(e))}finally{H(!1)}}},[S,t]),Z=(0,C.useCallback)(async e=>{N((await y(e).catch(()=>({events:[]}))).events)},[]),Te=(0,C.useCallback)(async()=>{if(!(!S||!F)){H(!0),W(null);try{let e=await fe(S.id,{definitionId:F,goal:L.trim()||S.nextAction||S.title});O(e.item),await Z(e.item.id),t(`/workflows?run=${encodeURIComponent(e.runId)}`)}catch(e){W(e instanceof Error?e.message:String(e))}finally{H(!1)}}},[S,t,Z,F,L]),Ee=(0,C.useCallback)(async e=>{if(!(!S||!e.length)){H(!0),W(null);try{let t=await b(S.id,e);O(t.item),await Z(t.item.id)}catch(e){W(e instanceof Error?e.message:String(e))}finally{H(!1)}}},[S,Z]),De=(0,C.useCallback)(async e=>{if(S){H(!0),W(null);try{let t=await le(S.id,e.id);O(t.item),await Z(t.item.id)}catch(e){W(e instanceof Error?e.message:String(e))}finally{H(!1)}}},[S,Z]),Oe=(0,C.useCallback)(async e=>{if(S){W(null);try{await ge(S.id,e)}catch(e){W(e instanceof Error?e.message:String(e))}}},[S]),Q=(0,C.useMemo)(()=>S?P.filter(e=>k(S,j,e)>0).slice(0,3):[],[S,j,P]),$=(0,C.useMemo)(()=>(0,w.jsxs)(v,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:()=>void X(),children:[(0,w.jsx)(ve,{className:`size-3.5`,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`hidden sm:inline`,children:g.refreshShort})]}),[X,g.refreshShort]);return(0,C.useLayoutEffect)(()=>(K({startExtra:(0,w.jsx)(s,{to:Y,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":Y.startsWith(`/chat`)?r.sidebar.back:j?.name?g.detail.backToProject.replace(`{{name}}`,j.name):g.detail.backToProjects,children:(0,w.jsx)(u,{className:`size-4`,"aria-hidden":!0})}),main:(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,w.jsx)(oe,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:j?.name||S?.projectId||g.detail.loading})]}),(0,w.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:g.detail.description})]}),end:$}),()=>q()),[Y,q,$,S?.projectId,z,r.sidebar.back,j?.name,K,g]),z?(0,w.jsxs)(`main`,{className:`mx-auto grid w-full max-w-6xl flex-1 gap-6 px-4 py-6 sm:px-6 lg:grid-cols-[minmax(0,1fr)_17rem] lg:px-8`,"aria-busy":!0,children:[(0,w.jsxs)(`div`,{className:`grid content-start gap-5`,children:[(0,w.jsx)(h,{className:`h-7 w-3/4`}),(0,w.jsx)(h,{className:`h-24 w-full`}),(0,w.jsx)(h,{className:`h-48 w-full`})]}),(0,w.jsx)(h,{className:`hidden h-72 w-full lg:block`})]}):S?(0,w.jsxs)(`main`,{className:`mx-auto grid w-full max-w-6xl flex-1 content-start gap-6 px-4 py-6 sm:px-6 lg:grid-cols-[minmax(0,1fr)_17rem] lg:px-8 lg:py-8`,children:[(0,w.jsxs)(`article`,{className:`min-w-0 rounded-lg border border-edge-subtle bg-surface-panel p-5 shadow-surface sm:p-7 lg:col-start-1 lg:row-start-1`,children:[U?(0,w.jsx)(`div`,{className:`mb-5 rounded-md border border-danger/30 bg-danger-soft px-3 py-2 text-sm text-danger`,children:U}):null,(0,w.jsx)(`h1`,{className:`break-words text-xl font-semibold tracking-tight text-fg`,children:S.title}),(0,w.jsxs)(`section`,{className:`mt-7`,children:[(0,w.jsx)(`h2`,{className:`text-xs font-medium text-fg-subtle`,children:g.create.descriptionLabel}),(0,w.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-fg-muted`,children:S.description||g.detail.noDescription})]}),S.blockedReason?(0,w.jsxs)(`section`,{className:`mt-7 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-4 py-3.5`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-red-700 dark:text-red-300`,children:[(0,w.jsx)(_e,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,w.jsx)(`h2`,{children:g.blockedReason})]}),(0,w.jsx)(`p`,{className:`mt-2 pl-6 text-sm leading-relaxed text-fg`,children:S.blockedReason})]}):null,(0,w.jsxs)(`section`,{className:`mt-7 border-t border-edge-subtle pt-6`,children:[(0,w.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:g.nextAction}),(0,w.jsx)(`p`,{className:`mt-2 text-base leading-relaxed text-fg`,children:S.nextAction||g.noNextAction}),(0,w.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:(0,w.jsxs)(v,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3 text-sm`,disabled:V,onClick:we,children:[(0,w.jsx)(ce,{className:`size-4`,"aria-hidden":!0}),g.detail.startChat]})})]}),(0,w.jsxs)(`details`,{className:`group mt-6 border-t border-edge-subtle pt-5`,children:[(0,w.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-start gap-3 rounded-md px-1 py-1 text-left hover:text-fg [&::-webkit-details-marker]:hidden`,children:[(0,w.jsx)(me,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,w.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:g.detail.workflowTitle}),(0,w.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:g.detail.workflowHint})]}),(0,w.jsx)(`span`,{className:`mt-0.5 text-xs text-fg-subtle transition-transform group-open:rotate-180`,"aria-hidden":!0,children:`⌄`})]}),(0,w.jsxs)(`div`,{className:`ml-7 mt-4 grid max-w-xl gap-3`,children:[(0,w.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-fg-subtle`,children:[g.detail.workflowTemplate,(0,w.jsxs)(_,{className:`h-9 rounded-md border border-edge bg-surface-base px-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:F,disabled:V||P.length===0,onChange:e=>I(e.target.value),children:[P.length===0?(0,w.jsx)(m,{value:``,children:g.detail.noWorkflowTemplates}):null,P.map(e=>(0,w.jsx)(m,{value:e.id,children:e.title},e.id))]})]}),Q.length?(0,w.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[g.detail.recommendedWorkflows,`: `,Q.map(e=>e.title).join(` · `)]}):null,(0,w.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-fg-subtle`,children:[g.detail.workflowGoal,(0,w.jsx)(`textarea`,{className:`min-h-20 resize-y rounded-md border border-edge bg-surface-base p-2.5 text-sm font-normal leading-relaxed text-fg outline-none focus:border-accent`,value:L,disabled:V,onChange:e=>R(e.target.value)})]}),(0,w.jsx)(`div`,{children:(0,w.jsxs)(v,{type:`button`,variant:`secondary`,className:`h-9 rounded-lg px-3 text-sm`,disabled:V||!F,onClick:Te,children:[(0,w.jsx)(re,{className:`size-4`,"aria-hidden":!0}),g.detail.startWorkflow]})}),P.length?null:(0,w.jsx)(`p`,{className:`text-xs text-fg-muted`,children:g.detail.noWorkflowTemplates})]})]})]}),(0,w.jsxs)(`aside`,{className:`min-w-0 self-start rounded-lg border border-edge-subtle bg-surface-panel px-4 py-4 lg:sticky lg:top-20 lg:col-start-2 lg:row-span-2 lg:row-start-1`,children:[(0,w.jsxs)(`section`,{children:[(0,w.jsx)(`h2`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-subtle`,children:g.detail.properties}),(0,w.jsxs)(`dl`,{className:`mt-3 divide-y divide-edge-subtle`,children:[(0,w.jsx)(E,{label:g.detail.status,children:(0,w.jsx)(`span`,{className:c(`inline-flex rounded-full px-2 py-0.5 text-xs font-medium`,ye(S.status)),children:g.statuses[S.status]})}),(0,w.jsx)(E,{label:g.create.priorityLabel,children:g.priorities[S.priority]}),(0,w.jsx)(E,{label:g.detail.project,children:(0,w.jsxs)(s,{to:J,className:`flex w-full min-w-0 max-w-full items-center gap-1.5 overflow-hidden font-medium text-accent hover:text-accent-fg`,children:[(0,w.jsx)(he,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`block min-w-0 flex-1 truncate`,children:j?.name||S.projectId})]})}),(0,w.jsx)(E,{label:g.updated,children:T(S.updatedAt)}),S.archivedAt?(0,w.jsx)(E,{label:g.detail.archived,children:T(S.archivedAt)}):null]})]}),(0,w.jsxs)(`section`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,w.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,w.jsx)(ne,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,w.jsx)(`span`,{className:`truncate`,children:g.attachments.title}),S.attachments?.length?(0,w.jsx)(`span`,{className:`text-xs font-normal text-fg-subtle`,children:S.attachments.length}):null]}),(0,w.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,disabled:V,title:g.attachments.add,"aria-label":g.attachments.add,onClick:()=>G.current?.click(),children:(0,w.jsx)(pe,{className:`size-4`,"aria-hidden":!0})}),(0,w.jsx)(`input`,{ref:G,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{Ee(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),(0,w.jsx)(`div`,{className:`mt-3 grid gap-2`,children:S.attachments?.length?S.attachments.map(e=>(0,w.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md bg-surface-base px-2 py-2 text-sm`,children:[(0,w.jsx)(x,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,w.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,w.jsx)(`div`,{className:`truncate font-medium text-fg`,children:e.fileName}),(0,w.jsx)(`div`,{className:`truncate text-xs text-fg-subtle`,children:be(e.size)})]}),(0,w.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:g.attachments.download,"aria-label":g.attachments.download,disabled:V,onClick:()=>void Oe(e),children:(0,w.jsx)(se,{className:`size-3.5`,"aria-hidden":!0})}),(0,w.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:g.attachments.remove,"aria-label":g.attachments.remove,disabled:V,onClick:()=>void De(e),children:(0,w.jsx)(d,{className:`size-3.5`,"aria-hidden":!0})})]},e.id)):(0,w.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:g.attachments.empty})})]}),(0,w.jsxs)(`section`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,w.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:g.detail.links}),(0,w.jsx)(`div`,{className:`mt-2 grid gap-1 text-sm`,children:S.links?.length?S.links.map(e=>(0,w.jsxs)(s,{to:xe(e),className:`flex min-w-0 items-center justify-between gap-2 rounded-md px-1 py-1.5 hover:bg-surface-hover`,children:[(0,w.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,w.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[g.linkKinds[e.kind],(0,w.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,w.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:g.detail.noLinks})})]})]}),(0,w.jsxs)(`section`,{className:`min-w-0 lg:col-start-1 lg:row-start-2`,children:[(0,w.jsxs)(`div`,{className:`mb-3 flex items-center gap-2`,children:[(0,w.jsx)(x,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,w.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:g.detail.activity})]}),(0,w.jsx)(D,{events:Se,t:g})]})]}):(0,w.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,children:[(0,w.jsxs)(s,{to:Y,className:`inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,w.jsx)(u,{className:`size-4`,"aria-hidden":!0}),Y.startsWith(`/chat`)?r.sidebar.back:g.detail.backToProjects]}),(0,w.jsx)(`div`,{className:`mt-5 rounded-lg border border-danger/30 bg-danger-soft px-4 py-3 text-sm text-danger`,children:U||g.detail.notFound})]})}export{j as WorkItemDetailPage};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{l as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-H_iJjnEM.js";import{n as l,o as u,r as d}from"./locale-store-BNC8HUCI.js";import{n as f}from"./activity-store-DFKtQDgE.js";import{a as p,c as m,d as h,f as g,i as _,l as v,n as y,s as b,t as x,u as S}from"./work-copy-Cwyan9Sn.js";import{$c as C,Do as w,Go as T,Ho as E,Js as D,Ko as O,Ps as k,Uo as A,Vo as j,Vu as M,Wo as N,_u as P,bu as ee,cc as te,eo as F,gu as ne,ht as I,iu as L,jc as re,js as R,mu as ie,nl as z,qo as ae,qs as B,yl as V}from"./index-BA56bQ68.js";var H=e(t(),1),U=n();function W(e){try{return decodeURIComponent(e).trim()||null}catch{return null}}function G(e){if(!e)return null;let t=e.split(/[?#]/,1)[0],n=/^\/chat\/([^/]+)\/?$/.exec(t);if(n){let e=W(n[1]);return!e||e===`new`?null:{kind:`session`,id:e}}return null}async function K(e,t){let n=`/api/sessions/${encodeURIComponent(e.id)}?limit=1`;try{return(await u(d(n),{signal:t})).status===404?`missing`:`available`}catch(e){if(t?.aborted)throw e;return`available`}}var q=r(),J=3,Y={info:{Icon:V,className:`text-accent-fg bg-accent-soft`},success:{Icon:ie,className:`text-success bg-success-soft`},warning:{Icon:B,className:`text-warning bg-warning-soft`},error:{Icon:ne,className:`text-danger bg-danger-soft`}};function oe(e,t){let n=Math.max(0,Math.round((Date.now()-e)/1e3));if(n<60)return t===`zh`?`刚刚`:`Just now`;let r=Math.round(n/60);if(r<60)return t===`zh`?`${r} 分钟前`:`${r}m ago`;let i=Math.round(r/60);if(i<24)return t===`zh`?`${i} 小时前`:`${i}h ago`;let a=Math.round(i/24);return t===`zh`?`${a} 天前`:`${a}d ago`}function se(e){let t=(0,U.c)(55),{item:n,targetAvailability:r}=e,i=l(Z),o;t[0]===i?o=t[1]:(o=c(i),t[0]=i,t[1]=o);let u=o.projectsPage.workHome,d=f(X),{Icon:p,className:m}=Y[n.tone],h;t[2]===m?h=t[3]:(h=s(`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg`,m),t[2]=m,t[3]=h);let g;t[4]!==p||t[5]!==n.status?(g=n.status===`running`?(0,q.jsx)(z,{className:`size-3.5 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,q.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),t[4]=p,t[5]=n.status,t[6]=g):g=t[6];let _;t[7]!==h||t[8]!==g?(_=(0,q.jsx)(`div`,{className:h,children:g}),t[7]=h,t[8]=g,t[9]=_):_=t[9];let v;t[10]===n.title?v=t[11]:(v=(0,q.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-medium leading-5 text-fg`,children:n.title}),t[10]=n.title,t[11]=v);let y;t[12]!==u.activityUnread||t[13]!==n.read?(y=n.read?null:(0,q.jsx)(`span`,{className:`mt-1.5 size-1.5 shrink-0 rounded-full bg-accent`,"aria-label":u.activityUnread}),t[12]=u.activityUnread,t[13]=n.read,t[14]=y):y=t[14];let b;t[15]!==v||t[16]!==y?(b=(0,q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[v,y]}),t[15]=v,t[16]=y,t[17]=b):b=t[17];let x;t[18]===n.message?x=t[19]:(x=n.message?(0,q.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.message}):null,t[18]=n.message,t[19]=x);let S;t[20]===n.source?S=t[21]:(S=n.source?(0,q.jsx)(`span`,{className:`max-w-48 truncate`,children:n.source}):null,t[20]=n.source,t[21]=S);let C;t[22]!==n.updatedAt||t[23]!==i?(C=oe(n.updatedAt,i),t[22]=n.updatedAt,t[23]=i,t[24]=C):C=t[24];let w;t[25]===C?w=t[26]:(w=(0,q.jsx)(`span`,{children:C}),t[25]=C,t[26]=w);let T;t[27]===n.occurrences?T=t[28]:(T=n.occurrences>1?(0,q.jsxs)(`span`,{children:[`×`,n.occurrences]}):null,t[27]=n.occurrences,t[28]=T);let E;t[29]!==u.activityCheckingRelated||t[30]!==u.activityRelatedMissing||t[31]!==u.activityViewRelated||t[32]!==n.href||t[33]!==r?(E=n.href&&r===`available`?(0,q.jsxs)(a,{to:n.href,className:`inline-flex items-center gap-0.5 font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u.activityViewRelated,(0,q.jsx)(P,{className:`size-3`,"aria-hidden":!0})]}):n.href&&r===`checking`?(0,q.jsx)(F,{className:`h-3 w-20 rounded`,"aria-label":u.activityCheckingRelated}):n.href&&r===`missing`?(0,q.jsx)(`span`,{className:`font-medium text-fg-subtle`,role:`status`,children:u.activityRelatedMissing}):null,t[29]=u.activityCheckingRelated,t[30]=u.activityRelatedMissing,t[31]=u.activityViewRelated,t[32]=n.href,t[33]=r,t[34]=E):E=t[34];let D;t[35]!==w||t[36]!==T||t[37]!==E||t[38]!==S?(D=(0,q.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] text-fg-subtle`,children:[S,w,T,E]}),t[35]=w,t[36]=T,t[37]=E,t[38]=S,t[39]=D):D=t[39];let O;t[40]!==D||t[41]!==b||t[42]!==x?(O=(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,x,D]}),t[40]=D,t[41]=b,t[42]=x,t[43]=O):O=t[43];let A;t[44]!==n.id||t[45]!==d?(A=()=>d(n.id),t[44]=n.id,t[45]=d,t[46]=A):A=t[46];let j;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,q.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),t[47]=j):j=t[47];let M;t[48]!==u.activityRemove||t[49]!==A?(M=(0,q.jsx)(`button`,{type:`button`,className:`rounded-md p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-hover hover:text-fg group-hover:opacity-100 focus:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":u.activityRemove,onClick:A,children:j}),t[48]=u.activityRemove,t[49]=A,t[50]=M):M=t[50];let N;return t[51]!==O||t[52]!==M||t[53]!==_?(N=(0,q.jsxs)(`article`,{className:`group flex items-start gap-3 border-t border-edge-subtle px-1 py-3 first:border-t-0`,children:[_,O,M]}),t[51]=O,t[52]=M,t[53]=_,t[54]=N):N=t[54],N}function X(e){return e.remove}function Z(e){return e.language}function ce(){let e=(0,U.c)(14),t=c(l(ve)).projectsPage.workHome,n=f(_e),r=f(ge),i=f(he),[a,s]=(0,H.useState)(!1),u;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(u={},e[0]=u):u=e[0];let[d,p]=(0,H.useState)(u),m;e[1]===n?m=e[2]:(m=n.filter(me),e[1]=n,e[2]=m);let h=m.length,g;e[3]===n?g=e[4]:(g=n.filter($),e[3]=n,e[4]=g);let _=g.length,v;e[5]!==a||e[6]!==n?(v=a?n:n.slice(0,J),e[5]=a,e[6]=n,e[7]=v):v=e[7];let y=v,b;e[8]===n?b=e[9]:(b=[...new Set(n.flatMap(pe))].sort().join(`
|
|
2
|
+
`),e[8]=n,e[9]=b);let x=b,S,C;e[10]===x?(S=e[11],C=e[12]):(S=()=>{let e=new AbortController,t=new Map((x?x.split(`
|
|
3
|
+
`):[]).flatMap(fe));return p(Object.fromEntries([...t.keys()].map(de))),Promise.all([...t].map(async t=>{let[n,r]=t,i=await K(r,e.signal);e.signal.aborted||p(e=>({...e,[n]:i}))})).catch(ue),()=>e.abort()},C=[x],e[10]=x,e[11]=S,e[12]=C),(0,H.useEffect)(S,C);let w;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,q.jsx)(M,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),e[13]=w):w=e[13],(0,q.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,"aria-labelledby":`workbench-activity-title`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,q.jsx)(`div`,{children:(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[w,(0,q.jsx)(`h2`,{id:`workbench-activity-title`,className:`text-sm font-semibold text-fg`,children:t.activityTitle}),h>0?(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:[(0,q.jsx)(z,{className:`size-3 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),h,` `,t.running]}):_>0?(0,q.jsxs)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[_,` `,t.activityNew]}):null]})}),a&&n.length>0?(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[_>0?(0,q.jsxs)(R,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:r,children:[(0,q.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),t.activityMarkRead]}):null,n.some(le)?(0,q.jsxs)(R,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-fg-muted`,onClick:i,children:[(0,q.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),t.activityClearFinished]}):null]}):null]}),n.length>0?(0,q.jsxs)(`div`,{className:`mt-3 px-1`,children:[y.map(e=>(0,q.jsx)(se,{item:e,targetAvailability:e.href&&G(e.href)?d[e.href]??`checking`:`available`},e.id)),n.length>J?(0,q.jsx)(`div`,{className:`border-t border-edge-subtle py-2 text-center`,children:(0,q.jsx)(R,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>s(Q),children:a?t.activityShowLess:t.activityShowAll.replace(`{{count}}`,String(n.length))})}):null]}):(0,q.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-sm text-fg-muted`,children:[(0,q.jsx)(L,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,q.jsx)(`p`,{children:t.activityEmpty})]})]})}function Q(e){return!e}function le(e){return e.status===`done`}function ue(){}function de(e){return[e,`checking`]}function fe(e){let t=G(e);return t?[[e,t]]:[]}function pe(e){return e.href&&G(e.href)?[e.href]:[]}function $(e){return!e.read}function me(e){return e.status===`running`}function he(e){return e.clearFinished}function ge(e){return e.markAllRead}function _e(e){return e.items}function ve(e){return e.language}function ye(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function be(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:I(n)}function xe(e){let t=(0,U.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,q.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function Se(e){let t=(0,U.c)(15),{outcome:n,statusLabel:r}=e,i=`/work/${encodeURIComponent(n.id)}`,o;t[0]===n.objective?o=t[1]:(o=(0,q.jsx)(`h3`,{className:`line-clamp-2 text-sm font-semibold text-fg`,children:n.objective}),t[0]=n.objective,t[1]=o);let s;t[2]===n.updatedAt?s=t[3]:(s=be(n.updatedAt,``),t[2]=n.updatedAt,t[3]=s);let c;t[4]===s?c=t[5]:(c=(0,q.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:s}),t[4]=s,t[5]=c);let l;t[6]!==o||t[7]!==c?(l=(0,q.jsxs)(`div`,{className:`min-w-0`,children:[o,c]}),t[6]=o,t[7]=c,t[8]=l):l=t[8];let u;t[9]===r?u=t[10]:(u=(0,q.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:r}),t[9]=r,t[10]=u);let d;return t[11]!==i||t[12]!==l||t[13]!==u?(d=(0,q.jsxs)(a,{to:i,className:`group flex items-start justify-between gap-3 rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[l,u]}),t[11]=i,t[12]=l,t[13]=u,t[14]=d):d=t[14],d}function Ce(e){let t=(0,U.c)(16),{receipt:n,evidenceLabel:r,remainingLabel:i}=e,o=n.outcomeId?`/work/${encodeURIComponent(n.outcomeId)}`:n.projectId?`/projects/${encodeURIComponent(n.projectId)}`:`/chat/${encodeURIComponent(n.sessionKey)}`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,q.jsx)(ie,{className:`mt-0.5 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===n.objective?c=t[2]:(c=(0,q.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:n.objective}),t[1]=n.objective,t[2]=c);let l;t[3]===n.summary?l=t[4]:(l=(0,q.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.summary}),t[3]=n.summary,t[4]=l);let u=n.remainingWork.length>0?` · ${n.remainingWork.length} ${i}`:``,d;t[5]!==r||t[6]!==n.evidence.length||t[7]!==u?(d=(0,q.jsxs)(`p`,{className:`mt-2 text-[11px] text-fg-subtle`,children:[n.evidence.length,` `,r,u]}),t[5]=r,t[6]=n.evidence.length,t[7]=u,t[8]=d):d=t[8];let f;t[9]!==c||t[10]!==l||t[11]!==d?(f=(0,q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[s,(0,q.jsxs)(`div`,{className:`min-w-0`,children:[c,l,d]})]}),t[9]=c,t[10]=l,t[11]=d,t[12]=f):f=t[12];let p;return t[13]!==o||t[14]!==f?(p=(0,q.jsx)(a,{to:o,className:`block rounded-xl border border-edge-subtle px-3 py-3 hover:bg-surface-hover/55`,children:f}),t[13]=o,t[14]=f,t[15]=p):p=t[15],p}function we(){let e=(0,U.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,q.jsx)(F,{className:`h-20 rounded-2xl`}),(0,q.jsx)(F,{className:`h-72 rounded-2xl`}),(0,q.jsx)(F,{className:`h-44 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Te(e){let t=(0,U.c)(15),{chat:n,statusLabel:r}=e,i=`/chat/${encodeURIComponent(n.key)}`,o;t[0]===n.name?o=t[1]:(o=(0,q.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:n.name}),t[0]=n.name,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,q.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:r}),t[2]=r,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;t[7]===n.updatedAt?l=t[8]:(l=be(n.updatedAt,``),t[7]=n.updatedAt,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,q.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:l}),t[9]=l,t[10]=u);let d;return t[11]!==i||t[12]!==c||t[13]!==u?(d=(0,q.jsxs)(a,{to:i,className:`group block rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[c,u]}),t[11]=i,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function Ee(e){let t=(0,U.c)(27),{item:n,kindLabel:r,reasonLabel:i,approveLabel:o,denyLabel:s,busy:c,onRespond:l}=e,u;t[0]===n.title?u=t[1]:(u=(0,q.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=u);let d=n.projectName||r,f;t[2]===d?f=t[3]:(f=(0,q.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==u||t[5]!==f?(p=(0,q.jsxs)(`div`,{className:`min-w-0`,children:[u,f]}),t[4]=u,t[5]=f,t[6]=p):p=t[6];let m;t[7]===i?m=t[8]:(m=(0,q.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-panel/80 px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:i}),t[7]=i,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[p,m]}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===n.detail?g=t[13]:(g=n.detail?(0,q.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.detail}):null,t[12]=n.detail,t[13]=g);let _;t[14]!==n.href||t[15]!==h||t[16]!==g?(_=(0,q.jsxs)(a,{to:n.href,className:`group block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[h,g]}),t[14]=n.href,t[15]=h,t[16]=g,t[17]=_):_=t[17];let v;t[18]!==o||t[19]!==c||t[20]!==s||t[21]!==n.response||t[22]!==l?(v=n.response?(0,q.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2 border-t border-warning/20 pt-3`,children:[(0,q.jsx)(R,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`deny`),children:s}),(0,q.jsx)(R,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`approve`),children:o})]}):null,t[18]=o,t[19]=c,t[20]=s,t[21]=n.response,t[22]=l,t[23]=v):v=t[23];let y;return t[24]!==_||t[25]!==v?(y=(0,q.jsxs)(`article`,{className:`rounded-xl border border-warning/35 bg-warning-soft/25 p-3.5 transition-colors hover:bg-warning-soft/40`,children:[_,v]}),t[24]=_,t[25]=v,t[26]=y):y=t[26],y}function De(e){let t=(0,U.c)(65),{item:n,labels:r,busy:i,onDecide:a,onSnooze:o,onDismiss:s,onInstruct:c}=e,[l,u]=(0,H.useState)(``),d=n.judgment,f;t[0]===n.title?f=t[1]:(f=(0,q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=f);let p;t[2]===n.detail?p=t[3]:(p=(0,q.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:n.detail}),t[2]=n.detail,t[3]=p);let m;t[4]!==f||t[5]!==p?(m=(0,q.jsxs)(`div`,{className:`min-w-0`,children:[f,p]}),t[4]=f,t[5]=p,t[6]=m):m=t[6];let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,q.jsx)(te,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[7]=h):h=t[7];let g;t[8]===m?g=t[9]:(g=(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[m,h]}),t[8]=m,t[9]=g);let _;t[10]!==d.whyNow||t[11]!==r.whyNow?(_=[r.whyNow,d.whyNow],t[10]=d.whyNow,t[11]=r.whyNow,t[12]=_):_=t[12];let v;t[13]!==d.impact||t[14]!==r.impact?(v=[r.impact,d.impact],t[13]=d.impact,t[14]=r.impact,t[15]=v):v=t[15];let y;t[16]!==d.workDone||t[17]!==r.workDone?(y=[r.workDone,d.workDone],t[16]=d.workDone,t[17]=r.workDone,t[18]=y):y=t[18];let b;t[19]!==d.recommendation||t[20]!==r.recommendation?(b=[r.recommendation,d.recommendation],t[19]=d.recommendation,t[20]=r.recommendation,t[21]=b):b=t[21];let x;t[22]!==_||t[23]!==v||t[24]!==y||t[25]!==b?(x=(0,q.jsx)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[_,v,y,b].map(Oe)}),t[22]=_,t[23]=v,t[24]=y,t[25]=b,t[26]=x):x=t[26];let S;t[27]!==i||t[28]!==d.decision||t[29]!==a?(S=d.decision?(0,q.jsxs)(`div`,{className:`mt-4`,children:[(0,q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:d.decision.question}),(0,q.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:d.decision.options.map(e=>(0,q.jsxs)(R,{type:`button`,variant:`secondary`,className:`h-auto min-h-9 flex-col items-start px-3 py-2 text-left`,disabled:i,title:e.consequence,onClick:()=>a(e.id),children:[(0,q.jsx)(`span`,{children:e.label}),(0,q.jsx)(`span`,{className:`text-[10px] font-normal text-fg-muted`,children:e.consequence})]},e.id))})]}):null,t[27]=i,t[28]=d.decision,t[29]=a,t[30]=S):S=t[30];let C;t[31]!==i||t[32]!==r.snooze||t[33]!==o?(C=(0,q.jsx)(R,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:i,onClick:o,children:r.snooze}),t[31]=i,t[32]=r.snooze,t[33]=o,t[34]=C):C=t[34];let w;t[35]!==i||t[36]!==r.dismiss||t[37]!==s?(w=(0,q.jsx)(R,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:i,onClick:s,children:r.dismiss}),t[35]=i,t[36]=r.dismiss,t[37]=s,t[38]=w):w=t[38];let T;t[39]!==C||t[40]!==w?(T=(0,q.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 border-t border-edge-subtle pt-3`,children:[C,w]}),t[39]=C,t[40]=w,t[41]=T):T=t[41];let E;t[42]!==l||t[43]!==c?(E=e=>{e.preventDefault();let t=l.trim();t&&(c(t),u(``))},t[42]=l,t[43]=c,t[44]=E):E=t[44];let D;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>u(e.target.value),t[45]=D):D=t[45];let O;t[46]!==l||t[47]!==r.feedbackPlaceholder?(O=(0,q.jsx)(`input`,{className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-base px-3 py-2 text-xs text-fg outline-none focus:border-accent`,value:l,onChange:D,placeholder:r.feedbackPlaceholder}),t[46]=l,t[47]=r.feedbackPlaceholder,t[48]=O):O=t[48];let k;t[49]!==i||t[50]!==l?(k=i||!l.trim(),t[49]=i,t[50]=l,t[51]=k):k=t[51];let A;t[52]!==r.applyFeedback||t[53]!==k?(A=(0,q.jsx)(R,{type:`submit`,variant:`secondary`,className:`h-9 px-3`,disabled:k,children:r.applyFeedback}),t[52]=r.applyFeedback,t[53]=k,t[54]=A):A=t[54];let j;t[55]!==E||t[56]!==O||t[57]!==A?(j=(0,q.jsxs)(`form`,{className:`mt-3 flex gap-2`,onSubmit:E,children:[O,A]}),t[55]=E,t[56]=O,t[57]=A,t[58]=j):j=t[58];let M;return t[59]!==x||t[60]!==S||t[61]!==T||t[62]!==j||t[63]!==g?(M=(0,q.jsxs)(`article`,{className:`rounded-xl border border-accent/25 bg-accent-soft/15 p-4`,children:[g,x,S,T,j]}),t[59]=x,t[60]=S,t[61]=T,t[62]=j,t[63]=g,t[64]=M):M=t[64],M}function Oe(e){let[t,n]=e;return(0,q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 p-3`,children:[(0,q.jsx)(`p`,{className:`text-[11px] font-medium text-fg-subtle`,children:t}),(0,q.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg`,children:n})]},t)}function ke(e){let t=(0,U.c)(32),{item:n,statusLabel:r,retryLabel:i,viewLabel:o,acknowledgeLabel:s,busy:c,onView:l,onRetry:u,onAcknowledge:d}=e,f;t[0]===n.title?f=t[1]:(f=(0,q.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=f);let p;t[2]===r?p=t[3]:(p=(0,q.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-panel/80 px-2 py-0.5 text-[11px] font-medium text-danger`,children:r}),t[2]=r,t[3]=p);let m;t[4]!==f||t[5]!==p?(m=(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[f,p]}),t[4]=f,t[5]=p,t[6]=m):m=t[6];let h;t[7]===n.detail?h=t[8]:(h=(0,q.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:n.detail}),t[7]=n.detail,t[8]=h);let g;t[9]!==n.href||t[10]!==m||t[11]!==h?(g=(0,q.jsxs)(a,{to:n.href,className:`block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[m,h]}),t[9]=n.href,t[10]=m,t[11]=h,t[12]=g):g=t[12];let _;t[13]!==s||t[14]!==c||t[15]!==d?(_=(0,q.jsx)(R,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:c,onClick:d,children:s}),t[13]=s,t[14]=c,t[15]=d,t[16]=_):_=t[16];let v;t[17]!==c||t[18]!==l||t[19]!==o?(v=(0,q.jsx)(R,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:c,onClick:l,children:o}),t[17]=c,t[18]=l,t[19]=o,t[20]=v):v=t[20];let y;t[21]!==c||t[22]!==u||t[23]!==i?(y=(0,q.jsx)(R,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:c,onClick:u,children:i}),t[21]=c,t[22]=u,t[23]=i,t[24]=y):y=t[24];let b;t[25]!==_||t[26]!==v||t[27]!==y?(b=(0,q.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2 border-t border-danger/15 pt-3`,children:[_,v,y]}),t[25]=_,t[26]=v,t[27]=y,t[28]=b):b=t[28];let x;return t[29]!==g||t[30]!==b?(x=(0,q.jsxs)(`article`,{className:`rounded-xl border border-danger/25 bg-danger-soft/35 p-3.5`,children:[g,b]}),t[29]=g,t[30]=b,t[31]=x):x=t[31],x}function Ae(){let e=l(e=>e.language),t=c(e).projectsPage,n=x(e),r=i(),o=w(e=>e.setPageHeader),s=w(e=>e.clearPageHeader),[u,d]=(0,H.useState)(null),[f,D]=(0,H.useState)(!0),[M,P]=(0,H.useState)(null),[F,I]=(0,H.useState)(!1),[L,z]=(0,H.useState)(``),[B,V]=(0,H.useState)(null),[U,W]=(0,H.useState)(!1),[G,K]=(0,H.useState)(null),[J,Y]=(0,H.useState)(null),[oe,se]=(0,H.useState)(null),X=(0,H.useCallback)(async(t=!1)=>{t&&D(!0),P(null);try{d(await b(e))}catch(e){P(e instanceof Error?e.message:String(e))}finally{D(!1)}},[e]);(0,H.useEffect)(()=>{X(!0)},[X]),(0,H.useEffect)(()=>{let e,t=t=>{e!==void 0&&window.clearTimeout(e),e=window.setTimeout(()=>{e=void 0,X()},t)},n=()=>t(100),r=()=>t(750),i=[`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`workflow-run-updated`,`workflow-run-error`],a=[`session-updated`,`session-transcript-updated`];return i.forEach(e=>window.addEventListener(e,n)),a.forEach(e=>window.addEventListener(e,r)),()=>{i.forEach(e=>window.removeEventListener(e,n)),a.forEach(e=>window.removeEventListener(e,r)),e!==void 0&&window.clearTimeout(e)}},[X]);let Z=(0,H.useMemo)(()=>u?.decisions??[],[u]),Q=(0,H.useMemo)(()=>u?.attention??[],[u]),le=(0,H.useCallback)(async e=>{e.preventDefault();let t=L.trim();if(t){W(!0),K(null);try{V(await v(t))}catch(e){K(e instanceof Error?e.message:String(e))}finally{W(!1)}}},[L]),ue=(0,H.useCallback)(async()=>{if(B){W(!0),K(null);try{let e=await _(B.id);I(!1),z(``),V(null),await X(),r(`/work/${encodeURIComponent(e.outcomeId)}`)}catch(e){K(e instanceof Error?e.message:String(e))}finally{W(!1)}}},[X,r,B]),de=(0,H.useCallback)(()=>{V(null),K(null)},[]),fe=(0,H.useMemo)(()=>(0,q.jsxs)(R,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>I(!0),children:[(0,q.jsx)(re,{className:`size-4`,"aria-hidden":!0}),n.newWork]}),[n.newWork]),pe=(0,H.useCallback)(async(e,t)=>{if(e.response){Y(e.id),P(null);try{await S(e.response,t),await X()}catch(e){P(e instanceof Error?e.message:String(e))}finally{Y(null)}}},[X]),$=(0,H.useCallback)(async(e,t)=>{Y(e.id),P(null);try{await t(),await X()}catch(e){P(e instanceof Error?e.message:String(e))}finally{Y(null)}},[X]),me=(0,H.useCallback)(async(e,t)=>{se(e.id),P(null);try{await t({kind:e.kind,runId:e.runId}),await X()}catch(e){P(e instanceof Error?e.message:String(e))}finally{se(null)}},[X]);return(0,H.useLayoutEffect)(()=>(o({startExtra:null,main:(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),(0,q.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:t.workHome.subtitle})]}),end:fe}),()=>s()),[s,fe,o,t.title,t.workHome.subtitle]),(0,q.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[1200px] flex-1 flex-col gap-7 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,q.jsx)(j,{open:F,onOpenChange:e=>{I(e),e||de()},children:(0,q.jsxs)(O,{children:[(0,q.jsx)(T,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,q.jsxs)(A,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,q.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(ae,{className:`text-base font-semibold text-fg`,children:n.dialogTitle}),(0,q.jsx)(N,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:n.dialogDescription})]}),(0,q.jsx)(E,{asChild:!0,children:(0,q.jsx)(R,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:t.cancel,"aria-label":t.cancel,children:(0,q.jsx)(k,{className:`size-4`,"aria-hidden":!0})})})]}),B?(0,q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,q.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.proposalTitle}),(0,q.jsxs)(`dl`,{className:`mt-4 space-y-3 text-sm`,children:[(0,q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-3`,children:[(0,q.jsx)(`dt`,{className:`text-xs font-medium text-fg-subtle`,children:n.outcomeLabel}),(0,q.jsx)(`dd`,{className:`mt-1 leading-6 text-fg`,children:B.objective})]}),(0,q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-3`,children:[(0,q.jsx)(`dt`,{className:`text-xs font-medium text-fg-subtle`,children:n.nextActionLabel}),(0,q.jsx)(`dd`,{className:`mt-1 space-y-1 leading-6 text-fg`,children:B.outcomeContract.deliverables.map(e=>(0,q.jsxs)(`p`,{children:[`· `,e]},e))})]}),B.outcomeContract.acceptanceCriteria.length>0?(0,q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base p-3`,children:[(0,q.jsx)(`dt`,{className:`text-xs font-medium text-fg-subtle`,children:n.confirmWork}),(0,q.jsx)(`dd`,{className:`mt-1 space-y-1 leading-6 text-fg`,children:B.outcomeContract.acceptanceCriteria.map(e=>(0,q.jsxs)(`p`,{children:[`· `,e]},e))})]}):null]})]}),(0,q.jsxs)(`div`,{className:`flex shrink-0 justify-between gap-2 border-t border-edge px-5 py-4`,children:[(0,q.jsx)(R,{type:`button`,variant:`ghost`,disabled:U,onClick:de,children:n.editIntent}),(0,q.jsxs)(R,{type:`button`,variant:`primary`,className:`min-w-36`,disabled:U,onClick:()=>void ue(),children:[(0,q.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),n.confirmWork]})]})]}):(0,q.jsxs)(`form`,{onSubmit:e=>void le(e),className:`flex min-h-0 flex-1 flex-col`,children:[(0,q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,children:[(0,q.jsx)(`label`,{htmlFor:`new-work-outcome`,className:`mb-2 shrink-0 text-sm font-medium text-fg`,children:n.intentLabel}),(0,q.jsx)(`textarea`,{id:`new-work-outcome`,className:`min-h-32 w-full flex-1 resize-none rounded-xl border border-edge bg-surface-base p-3 text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,value:L,onChange:e=>z(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},placeholder:n.intentPlaceholder,maxLength:12e3,autoFocus:!0}),(0,q.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,q.jsx)(`span`,{children:t.workHome.submitShortcut}),(0,q.jsxs)(`span`,{className:`tabular-nums`,children:[L.length.toLocaleString(),` / `,12e3.toLocaleString()]})]})]}),(0,q.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,q.jsx)(E,{asChild:!0,children:(0,q.jsx)(R,{type:`button`,variant:`ghost`,children:t.cancel})}),(0,q.jsxs)(R,{type:`submit`,variant:`primary`,className:`min-w-32`,disabled:!L.trim()||U,children:[(0,q.jsx)(te,{className:`size-4`,"aria-hidden":!0}),n.submit]})]})]}),G?(0,q.jsx)(`p`,{className:`shrink-0 border-t border-danger/20 bg-danger-soft px-5 py-2 text-xs text-danger`,children:G}):null]})]})}),M?(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,q.jsx)(`span`,{children:M}),(0,q.jsx)(R,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void X(),children:t.workHome.retry})]}):null,f?(0,q.jsx)(we,{}):u?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`section`,{className:`border-b border-edge-subtle pb-5`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:t.workHome.briefingTitle}),(0,q.jsx)(`h2`,{className:`mt-1 text-xl font-semibold tracking-tight text-fg`,children:u.decisions.length+u.attention.length>0?ye(t.workHome.todaySummary,{attention:u.decisions.length+u.attention.length,moving:u.briefing.progress.movingCount+u.chats.running.length}):ye(t.workHome.todaySummaryClear,{moving:u.briefing.progress.movingCount+u.chats.running.length})}),u.briefing.summary?(0,q.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-fg-muted`,children:u.briefing.summary}):null]}),u.outcomes.running.length===0&&u.outcomes.needsUser.length===0&&u.workflowRuns.active.length===0&&u.decisions.length===0&&u.attention.length===0&&u.chats.running.length===0&&u.chats.recent.length===0&&u.upcomingAutomations.length===0?(0,q.jsxs)(`section`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,q.jsx)(C,{className:`mx-auto size-6 text-accent`,"aria-hidden":!0}),(0,q.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:t.workHome.emptyTitle}),(0,q.jsx)(`p`,{className:`mx-auto mt-1 max-w-lg text-sm leading-6 text-fg-muted`,children:t.workHome.emptyBody}),(0,q.jsxs)(`div`,{className:`mt-4 flex justify-center gap-2`,children:[(0,q.jsx)(R,{type:`button`,variant:`primary`,onClick:()=>r(`/chat/new`),children:t.workHome.startChat}),(0,q.jsx)(R,{type:`button`,variant:`secondary`,onClick:()=>I(!0),children:n.newWork})]})]}):null,(0,q.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 space-y-6`,children:[Q.length>0?(0,q.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(ne,{className:`size-4 text-danger`,"aria-hidden":!0}),(0,q.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.runAttention}),(0,q.jsx)(xe,{children:Q.length.toLocaleString()})]}),(0,q.jsx)(`div`,{className:`mt-4 space-y-2`,children:Q.map(e=>(0,q.jsx)(ke,{item:e,statusLabel:e.reason===`run_timeout`?t.workHome.attentionTimeout:t.workHome.attentionFailed,retryLabel:t.workHome.attentionRetry,viewLabel:t.workHome.attentionView,acknowledgeLabel:t.workHome.attentionAcknowledge,busy:oe===e.id,onView:()=>r(e.href),onRetry:()=>void me(e,h),onAcknowledge:()=>void me(e,y)},e.id))})]}):null,Z.length>0?(0,q.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(ne,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,q.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.needsAttention}),(0,q.jsx)(xe,{children:Z.length.toLocaleString()})]}),(0,q.jsx)(`div`,{className:`mt-4 space-y-2`,children:Z.map(e=>e.kind===`agent_judgment`&&e.judgment?(0,q.jsx)(De,{item:e,labels:n,busy:J===e.id,onDecide:t=>void $(e,()=>p(e.judgment.inboxItemId,t)),onSnooze:()=>void $(e,()=>g(e.judgment.inboxItemId,`snoozed`)),onDismiss:()=>void $(e,()=>g(e.judgment.inboxItemId,`resolved`)),onInstruct:t=>void $(e,()=>m(e.judgment.inboxItemId,t))},e.id):(0,q.jsx)(Ee,{item:e,kindLabel:t.workHome.decisionKinds[e.kind],reasonLabel:t.workHome.decisionReasons[e.reason],approveLabel:t.workHome.approve,denyLabel:t.workHome.deny,busy:J===e.id,onRespond:t=>void pe(e,t)},e.id))})]}):(0,q.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,q.jsx)(`span`,{className:`flex size-5 items-center justify-center rounded-full bg-success-soft text-xs text-success`,"aria-hidden":!0,children:`✓`}),t.workHome.nothingNeedsYou]}),u.outcomes.needsUser.length>0?(0,q.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(ne,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,q.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.needsAttention}),(0,q.jsx)(xe,{children:u.outcomes.needsUser.length.toLocaleString()})]}),(0,q.jsx)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:u.outcomes.needsUser.map(e=>(0,q.jsx)(Se,{outcome:e,statusLabel:n.outcomeStatuses.needs_user},e.id))})]}):null,(0,q.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(te,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,q.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.running}),(0,q.jsx)(xe,{children:u.outcomes.running.length.toLocaleString()})]}),(0,q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[u.outcomes.running.map(e=>(0,q.jsx)(Se,{outcome:e,statusLabel:n.outcomeStatuses.running},e.id)),u.outcomes.running.length===0?(0,q.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:n.emptyRunning}):null]})]}),u.chats.recent.length>0?(0,q.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,q.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,q.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.recent})}),(0,q.jsx)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:u.chats.recent.slice(0,6).map(e=>(0,q.jsx)(Te,{chat:e,statusLabel:n.openChat},e.key))})]}):null]}),(0,q.jsxs)(`aside`,{className:`min-w-0 space-y-4`,"aria-label":t.workHome.nowTitle,children:[(0,q.jsx)(`div`,{className:`px-1`,children:(0,q.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.workHome.nowTitle})}),u.upcomingAutomations.length>0?(0,q.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(ee,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.workHome.scheduled})]}),(0,q.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle`,children:u.upcomingAutomations.slice(0,3).map(e=>(0,q.jsxs)(a,{to:`/automations`,className:`flex items-center justify-between gap-3 rounded-lg px-1 py-3 text-sm hover:bg-surface-hover/55`,children:[(0,q.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.name||e.action}),(0,q.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:be(e.nextRunAt,t.never)})]},e.id))})]}):null,u.recentOutcomes.length>0?(0,q.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(ie,{className:`size-4 text-success`,"aria-hidden":!0}),(0,q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.recentOutcomes})]}),(0,q.jsx)(`div`,{className:`mt-3 space-y-2`,children:u.recentOutcomes.slice(0,3).map(e=>(0,q.jsx)(Ce,{receipt:e,evidenceLabel:n.evidenceCount,remainingLabel:n.remainingCount},e.runId))})]}):null,(0,q.jsx)(ce,{}),u.briefing.wins.length>0?(0,q.jsxs)(a,{to:u.briefing.wins[0].href,className:`flex items-center justify-between gap-3 rounded-xl px-2 py-2 text-sm text-fg-muted hover:bg-surface-hover/55 hover:text-fg`,children:[(0,q.jsx)(`span`,{children:ye(t.workHome.completedSummary,{count:u.briefing.wins.length})}),(0,q.jsxs)(`span`,{className:`shrink-0 text-xs font-medium text-accent`,children:[t.workHome.viewLatestResult,` →`]})]}):null]})]})]}):null]})}export{Ae as WorkPage};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./messages-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./messages-H_iJjnEM.js";import{o,r as s}from"./locale-store-BNC8HUCI.js";import{Go as c,H as l,Ho as u,Ji as d,Ko as f,Ps as p,Qs as m,Uo as h,Vo as g,Vs as _,Wl as v,as as y,cc as b,ft as x,gl as S,is as C,js as w,oc as T,pt as E,q as D,qo as O,rt as k,uc as A,wc as j,yu as M}from"./index-BA56bQ68.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
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 o(s(`/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=``,c=``,l=``;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=>{c+=e,t.onDelta?.(e)},onThinkingDelta:e=>{l+=e,t.onThinkingDelta?.(e)}});n!==null&&(c=n)}}if(e)break}if(a.trim()){let e=L(a,{onDelta:e=>{c+=e,t.onDelta?.(e)},onThinkingDelta:e=>{l+=e,t.onThinkingDelta?.(e)}});e!==null&&(c=e)}let u=c.trim();if(!u)throw Error(`AI returned an empty suggestion`);return{text:u,thinking:l.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:a,fieldLabel:o,scenario:s,format:u,intent:f,locale:b,context:x,disabled:C,className:w,showLabel:T}=e,E=s===void 0?`generic.text`:s,O=u===void 0?`plain`:u,k=f===void 0?`improve`:f,j=T===void 0?!0:T,[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]===b?me=t[1]:(me=ne(b),t[0]=b,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]!==a||t[25]!==o||t[26]!==O||t[27]!==fe||t[28]!==k||t[29]!==b||t[30]!==E?(Ee=async e=>{ae(`edit`),K(!0),ue.current=!0,await fe({intent:k,scenario:E,input:e,locale:b,field:{id:a,label:o,format:O},context:x})},t[23]=x,t[24]=a,t[25]=o,t[26]=O,t[27]=fe,t[28]=k,t[29]=b,t[30]=E,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=!j&&`size-7 p-0`,Ge;t[62]!==w||t[63]!==We?(Ge=i(`h-7 gap-1 px-2 text-xs`,We,w),t[62]=w,t[63]=We,t[64]=Ge):Ge=t[64];let Ke=C||Y,qe;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,z.jsx)(A,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=qe):qe=t[65];let Je=j?Z.buttonTitle:null,Ye;t[66]!==Z.buttonTitle||t[67]!==ke||t[68]!==Ge||t[69]!==Ke||t[70]!==Je?(Ye=(0,z.jsxs)(c,{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=i(`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)(_,{className:$e}),t[76]=$e,t[77]=et);let tt;t[78]===Z.title?tt=t[79]:(tt=(0,z.jsx)(p,{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)(h,{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)(l,{asChild:!0,children:(0,z.jsx)(c,{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=i(`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)(D,{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=i(`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)(g,{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-muted 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]!==O||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:O===`markdown`?(0,z.jsx)(m,{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]=O,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=i(`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)(D,{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=i(`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)(g,{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-muted 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=i(`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=i(`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)(S,{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-muted/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=i(`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]!==O||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}):O===`markdown`?(0,z.jsx)(m,{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]=O,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)(c,{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)(c,{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)(d,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,z.jsx)(A,{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)(c,{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)(c,{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)(c,{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)(v,{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-panel 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)(y,{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)(M,{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:f(t.argValues)}function ae(e,t,n){let r=a(t).workflows;if(!e)return r.noInputSummary;let i=w(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 o=Object.values(n.argValues).map(e=>e.trim()).filter(Boolean),s=n.goal.trim()||i.description;return s&&o.unshift(s),o.length>0?o.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:(j[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=j[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:o,onArgValuesChange:s,goal:c,onGoalChange:l,examplePrompts:u,showGoal:d,inputClassName:f,aiAssist:p}=e,m;t[0]===u?m=t[1]:(m=u===void 0?[]:u,t[0]=u,t[1]=m);let h=m,g=d===void 0?!0:d,_,v,y,b,x,S,C;if(t[2]!==p||t[3]!==o||t[4]!==h||t[5]!==c||t[6]!==f||t[7]!==r||t[8]!==s||t[9]!==l||t[10]!==g||t[11]!==n){y=a(r).workflows;let e=j[n]??[];v=e.length>0;let u=i(`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),d;t[19]!==o||t[20]!==s||t[21]!==l?(d=e=>{E(e,l,e=>{s(e(o))})},t[19]=o,t[20]=s,t[21]=l,t[22]=d):d=t[22],_=d,b=`flex flex-col gap-3`,x=e.map(e=>{let t=K(y.args,e.labelKey),a=K(y.args,e.placeholderKey),c=o[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:c,onApply:t=>s({...o,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:p.argScenario??`workflow.arg`,locale:r,context:{...p.context,workflowName:n,workflowArgs:o,fieldKey:e.key},disabled:p.disabled,showLabel:!1}):null]}),e.multiline?(0,z.jsx)(`textarea`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:i(u,`min-h-20 resize-y`)}):(0,z.jsx)(`input`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:u})]},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:c,onApply:l,fieldId:`workflow.goal`,fieldLabel:y.goalLabel,scenario:p.goalScenario??`cron.workflowGoal`,locale:r,context:{...p.context,workflowName:n,workflowArgs:o},disabled:p.disabled,showLabel:!1}):null]}),(0,z.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),placeholder:y.goalPlaceholder,className:i(u,`min-h-20 resize-y`)})]}):null,t[2]=p,t[3]=o,t[4]=h,t[5]=c,t[6]=f,t[7]=r,t[8]=s,t[9]=l,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 T;return t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==C||t[32]!==w?(T=(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]=T):T=t[33],T}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:a,onValidChange:o}){let s=(0,N.useMemo)(()=>H(e),[e]),[c,l]=(0,N.useState)(!1),[u,d]=(0,N.useState)(()=>JSON.stringify(t,null,2)),[f,p]=(0,N.useState)(null);if(s.length===0)return null;let m=(e,r)=>{let i={...t,[e]:r};(r===``||r===void 0)&&delete i[e],n(i),c&&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),o?.(!1);return}p(null),n(t),o?.(!0,t)}catch{p(r.rawJsonInvalid),o?.(!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=!c;l(e),e&&(d(JSON.stringify(t,null,2)),p(null),o?.(!0))},children:r.rawJson})]}),c?(0,z.jsxs)(`div`,{className:`mt-3`,children:[(0,z.jsx)(`textarea`,{value:u,onChange:e=>h(e.target.value),spellCheck:!1,className:i(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:s.map(e=>(0,z.jsx)(ue,{field:e,value:t[e.key],labels:r,aiAssist:a,allValues:t,onChange:t=>m(e.key,t)},e.key))})]})}function ue(e){let t=(0,P.c)(30),{field:n,value:r,labels:a,aiAssist:o,allValues:s,onChange:c}=e,l=n.schema.title||n.key,u=typeof n.schema.description==`string`?n.schema.description:void 0,d=Array.isArray(n.schema.type)?n.schema.type[0]:n.schema.type,f;t[0]===n.schema.enum?f=t[1]:(f=Array.isArray(n.schema.enum)?n.schema.enum:[],t[0]=n.schema.enum,t[1]=f);let p=f,m=!!o&&!p.length&&(d===`string`||!d),h=String(l),g=n.required?` *`:``,_;t[2]!==h||t[3]!==g?(_=(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg`,children:[h,g]}),t[2]=h,t[3]=g,t[4]=_):_=t[4];let v;t[5]!==o||t[6]!==s||t[7]!==n.key||t[8]!==n.schema||t[9]!==c||t[10]!==m||t[11]!==l||t[12]!==r?(v=m&&o?(0,z.jsx)(B,{value:typeof r==`string`?r:r==null?``:String(r),onApply:c,fieldId:`workflow.schema.${n.key}`,fieldLabel:String(l),scenario:o.scenario??`workflow.arg`,locale:o.locale,context:{...o.context,fieldKey:n.key,fieldSchema:n.schema,inputValues:s},disabled:o.disabled,showLabel:!1}):null,t[5]=o,t[6]=s,t[7]=n.key,t[8]=n.schema,t[9]=c,t[10]=m,t[11]=l,t[12]=r,t[13]=v):v=t[13];let y;t[14]!==_||t[15]!==v?(y=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[_,v]}),t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===u?b=t[18]:(b=u?(0,z.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-subtle`,children:u}):null,t[17]=u,t[18]=b);let x;t[19]!==u||t[20]!==p||t[21]!==a||t[22]!==c||t[23]!==d||t[24]!==r?(x=p.length>0?(0,z.jsxs)(k,{value:r==null?``:String(r),onChange:e=>c(e.target.value),className:q,children:[(0,z.jsx)(O,{value:``}),p.map(de)]}):d===`boolean`?(0,z.jsxs)(k,{value:typeof r==`boolean`?String(r):``,onChange:e=>c(e.target.value===``?void 0:e.target.value===`true`),className:q,children:[(0,z.jsx)(O,{value:``}),(0,z.jsx)(O,{value:`true`,children:a.booleanTrue}),(0,z.jsx)(O,{value:`false`,children:a.booleanFalse})]}):d===`number`||d===`integer`?(0,z.jsx)(`input`,{type:`number`,value:typeof r==`number`||typeof r==`string`?String(r):``,onChange:e=>c(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=>c(e.target.value),className:i(q,u&&u.length>80?`min-h-20 resize-y`:`min-h-10 resize-y`)}),t[19]=u,t[20]=p,t[21]=a,t[22]=c,t[23]=d,t[24]=r,t[25]=x):x=t[25];let S;return t[26]!==y||t[27]!==b||t[28]!==x?(S=(0,z.jsxs)(`div`,{className:`block`,children:[y,b,x]}),t[26]=y,t[27]=b,t[28]=x,t[29]=S):S=t[29],S}function de(e){return(0,z.jsx)(O,{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:o,onChange:s,aiAssist:c,inputClassName:l,onValidityChange:u}=e,d;t[0]===r?d=t[1]:(d=a(r),t[0]=r,t[1]=d);let f=d.workflows,p;t[2]!==n||t[3]!==r?(p=w(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,T,E,D,O,k,A,j;if(t[9]!==c||t[10]!==n||t[11]!==v||t[12]!==b||t[13]!==l||t[14]!==f||t[15]!==r||t[16]!==m.description||t[17]!==s||t[18]!==u||t[19]!==h||t[20]!==o){E=Symbol.for(`react.early_return_sentinel`);bb0:{let e=i(`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`,l),a;t[31]!==n||t[32]!==s||t[33]!==u||t[34]!==h?(a=(e,t)=>{let r=t===void 0?h:t;s(e),u?.(G(n,e,r))},t[31]=n,t[32]=s,t[33]=u,t[34]=h,t[35]=a):a=t[35];let d=a,p;t[36]!==d||t[37]!==o?(p=e=>d({...o,goal:e}),t[36]=d,t[37]=o,t[38]=p):p=t[38];let _=p,y;t[39]!==d||t[40]!==o?(y=e=>d({...o,schemaInput:e}),t[39]=d,t[40]=o,t[41]=y):y=t[41];let w=y,M;t[42]!==d||t[43]!==o?(M=e=>d({...o,argValues:e}),t[42]=d,t[43]=o,t[44]=M):M=t[44];let N=M,P;if(t[45]!==_||t[46]!==w||t[47]!==o.schemaInput?(P=e=>{if(e.field===`goal`){_(e.text);return}w({...o.schemaInput,[e.field]:e.text})},t[45]=_,t[46]=w,t[47]=o.schemaInput,t[48]=P):P=t[48],x=P,!b){let e;t[49]!==c||t[50]!==n.id||t[51]!==n.name||t[52]!==n.title||t[53]!==m.description?(e=c?{disabled:c.disabled,argScenario:c.inputScenario??`workflow.arg`,goalScenario:c.goalScenario??`workflow.goal`,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,t[49]=c,t[50]=n.id,t[51]=n.name,t[52]=n.title,t[53]=m.description,t[54]=e):e=t[54];let i;t[55]!==n.name||t[56]!==v||t[57]!==l||t[58]!==r||t[59]!==N||t[60]!==_||t[61]!==e||t[62]!==o.argValues||t[63]!==o.goal?(i=(0,z.jsx)(ce,{workflowName:n.name,language:r,argValues:o.argValues,onArgValuesChange:N,goal:o.goal,onGoalChange:_,examplePrompts:v,inputClassName:l,aiAssist:e}),t[55]=n.name,t[56]=v,t[57]=l,t[58]=r,t[59]=N,t[60]=_,t[61]=e,t[62]=o.argValues,t[63]=o.goal,t[64]=i):i=t[64],E=i;break bb0}C=`flex flex-col gap-3`,t[65]!==c||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]!==u||t[75]!==w||t[76]!==o?(T=n.inputSchema?(0,z.jsx)(le,{schema:n.inputSchema,value:o.schemaInput,onChange:w,onValidChange:(e,t)=>{g(e),u?.(G(n,t?{...o,schemaInput:t}:o,e))},aiAssist:c?{locale:r,disabled:c.disabled,scenario:c.inputScenario??`workflow.arg`,context:{...c.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]=c,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]=u,t[75]=w,t[76]=o,t[77]=T):T=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]!==c||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]!==o.goal||t[89]!==o.schemaInput?(I=c?(0,z.jsx)(B,{value:o.goal,onApply:_,fieldId:`workflow.goal`,fieldLabel:f.goalLabel,scenario:c.goalScenario??`workflow.goal`,locale:r,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description,workflowInput:o.schemaInput},disabled:c.disabled,showLabel:!1}):null,t[80]=c,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]=o.goal,t[89]=o.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],D=o.goal,t[94]===_?O=t[95]:(O=e=>_(e.target.value),t[94]=_,t[95]=O),k=f.goalPlaceholder,A=i(e,`min-h-20 resize-y`)}t[9]=c,t[10]=n,t[11]=v,t[12]=b,t[13]=l,t[14]=f,t[15]=r,t[16]=m.description,t[17]=s,t[18]=u,t[19]=h,t[20]=o,t[21]=x,t[22]=S,t[23]=C,t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=k,t[29]=A,t[30]=j}else x=t[21],S=t[22],C=t[23],T=t[24],E=t[25],D=t[26],O=t[27],k=t[28],A=t[29],j=t[30];if(E!==Symbol.for(`react.early_return_sentinel`))return E;let M;t[96]!==D||t[97]!==O||t[98]!==k||t[99]!==A?(M=(0,z.jsx)(`textarea`,{value:D,onChange:O,placeholder:k,className:A}),t[96]=D,t[97]=O,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]!==T||t[111]!==F||t[112]!==I?(L=(0,z.jsxs)(`div`,{className:C,children:[T,F,I]}),t[109]=C,t[110]=T,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?b(t.agentScaleExact,{count:n.min}):b(t.agentScaleRange,{min:n.min,max:n.max}):b(t.agentScaleExact,{count:e.defaults.maxSubagents})}function fe(e){let t=(0,P.c)(41),{definition:n,language:r,value:o,onChange:s,mode:c,badgeLabel:l,aiAssist:d,inputClassName:f,showTimeout:p,defaultAdvancedOpen:m,onValidityChange:h}=e,g=p===void 0?!1:p,_=m===void 0?!1:m,v=a(r).workflows,[y,E]=(0,N.useState)(_),D;t[0]!==n||t[1]!==r?(D=w(n,r),t[0]=n,t[1]=r,t[2]=D):D=t[2];let O=D,k;t[3]!==n.defaults||t[4]!==o.concurrency?(k=o.concurrency.trim()?Number(o.concurrency):n.defaults.concurrency,t[3]=n.defaults,t[4]=o.concurrency,t[5]=k):k=t[5];let A=k,j;t[6]!==n.defaults||t[7]!==o.maxSubagents?(j=o.maxSubagents.trim()?Number(o.maxSubagents):n.defaults.maxSubagents,t[6]=n.defaults,t[7]=o.maxSubagents,t[8]=j):j=t[8];let M=j,F;t[9]!==n||t[10]!==r||t[11]!==o?(F=ae(n,r,o),t[9]=n,t[10]=r,t[11]=o,t[12]=F):F=t[12];let I=F,L=l??v.readyToStart,R;t[13]!==s||t[14]!==o?(R=e=>s({...o,...e}),t[13]=s,t[14]=o,t[15]=R):R=t[15];let ee=R,te=c===`automation`&&`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,ne;t[16]===te?ne=t[17]:(ne=i(`space-y-4`,te),t[16]=te,t[17]=ne);let B=I||O.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)(T,{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)(u,{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)(C,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[22]=H):H=t[22];let U;t[23]!==s||t[24]!==o?(U=e=>s({...o,...e}),t[23]=s,t[24]=o,t[25]=U):U=t[25];let W;t[26]===h?W=t[27]:(W=e=>{h?.(e)},t[26]=h,t[27]=W);let G;t[28]!==d||t[29]!==n||t[30]!==f||t[31]!==r||t[32]!==U||t[33]!==W||t[34]!==o?(G=(0,z.jsx)(Y,{definition:n,language:r,value:o,onChange:U,onValidityChange:W,aiAssist:d,inputClassName:f}),t[28]=d,t[29]=n,t[30]=f,t[31]=r,t[32]=U,t[33]=W,t[34]=o,t[35]=G):G=t[35];let K;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(K=()=>E(pe),t[36]=K):K=t[36];let oe=v.advancedSettings,se=y&&`rotate-180`,ce;t[37]===se?ce=t[38]:(ce=i(`size-4 transition-transform`,se),t[37]=se,t[38]=ce);let q;return t[39]===ce?q=t[40]:(q=(0,z.jsx)(S,{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:v.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:b(v.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,v)})]}),(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:b(v.runLimitsSummary,{concurrency:A,max:M})})]})]}),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)(x,{className:`size-3.5`,"aria-hidden":!0}),v.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]}),y?(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:o.concurrency,onChange:e=>ee({concurrency:e.target.value}),placeholder:b(v.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:o.maxSubagents,onChange:e=>ee({maxSubagents:e.target.value}),placeholder:b(v.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`}),g?(0,z.jsx)(`input`,{value:o.timeoutSeconds??``,onChange:e=>ee({timeoutSeconds:e.target.value}),placeholder:b(v.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};
|
|
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 o(s(`/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=``,c=``,l=``;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=>{c+=e,t.onDelta?.(e)},onThinkingDelta:e=>{l+=e,t.onThinkingDelta?.(e)}});n!==null&&(c=n)}}if(e)break}if(a.trim()){let e=L(a,{onDelta:e=>{c+=e,t.onDelta?.(e)},onThinkingDelta:e=>{l+=e,t.onThinkingDelta?.(e)}});e!==null&&(c=e)}let u=c.trim();if(!u)throw Error(`AI returned an empty suggestion`);return{text:u,thinking:l.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:a,fieldLabel:o,scenario:s,format:l,intent:m,locale:_,context:y,disabled:x,className:S,showLabel:C}=e,E=s===void 0?`generic.text`:s,D=l===void 0?`plain`:l,k=m===void 0?`improve`:m,A=C===void 0?!0:C,[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]===_?me=t[1]:(me=ne(_),t[0]=_,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]!==y||t[24]!==a||t[25]!==o||t[26]!==D||t[27]!==fe||t[28]!==k||t[29]!==_||t[30]!==E?(Ee=async e=>{ae(`edit`),K(!0),ue.current=!0,await fe({intent:k,scenario:E,input:e,locale:_,field:{id:a,label:o,format:D},context:y})},t[23]=y,t[24]=a,t[25]=o,t[26]=D,t[27]=fe,t[28]=k,t[29]=_,t[30]=E,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=!A&&`size-7 p-0`,Ge;t[62]!==S||t[63]!==We?(Ge=i(`h-7 gap-1 px-2 text-xs`,We,S),t[62]=S,t[63]=We,t[64]=Ge):Ge=t[64];let Ke=x||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=A?Z.buttonTitle:null,Ye;t[66]!==Z.buttonTitle||t[67]!==ke||t[68]!==Ge||t[69]!==Ke||t[70]!==Je?(Ye=(0,z.jsxs)(w,{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=i(`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)(c,{className:$e}),t[76]=$e,t[77]=et);let tt;t[78]===Z.title?tt=t[79]:(tt=(0,z.jsx)(O,{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)(p,{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)(u,{asChild:!0,children:(0,z.jsx)(w,{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=i(`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)(T,{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=i(`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)(v,{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-muted 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]!==D||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:D===`markdown`?(0,z.jsx)(d,{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]=D,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=i(`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)(T,{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=i(`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)(v,{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-muted 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=i(`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=i(`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)(M,{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-muted/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=i(`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]!==D||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}):D===`markdown`?(0,z.jsx)(d,{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]=D,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)(w,{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)(w,{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)(w,{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)(w,{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)(w,{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-panel 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)(f,{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)(g,{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:l(t.argValues)}function ae(e,t,n){let r=a(t).workflows;if(!e)return r.noInputSummary;let i=E(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 o=Object.values(n.argValues).map(e=>e.trim()).filter(Boolean),s=n.goal.trim()||i.description;return s&&o.unshift(s),o.length>0?o.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:(k[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=k[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:o,onArgValuesChange:s,goal:c,onGoalChange:l,examplePrompts:u,showGoal:d,inputClassName:f,aiAssist:p}=e,m;t[0]===u?m=t[1]:(m=u===void 0?[]:u,t[0]=u,t[1]=m);let h=m,g=d===void 0?!0:d,_,v,y,b,S,C,w;if(t[2]!==p||t[3]!==o||t[4]!==h||t[5]!==c||t[6]!==f||t[7]!==r||t[8]!==s||t[9]!==l||t[10]!==g||t[11]!==n){y=a(r).workflows;let e=k[n]??[];v=e.length>0;let u=i(`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),d;t[19]!==o||t[20]!==s||t[21]!==l?(d=e=>{x(e,l,e=>{s(e(o))})},t[19]=o,t[20]=s,t[21]=l,t[22]=d):d=t[22],_=d,b=`flex flex-col gap-3`,S=e.map(e=>{let t=K(y.args,e.labelKey),a=K(y.args,e.placeholderKey),c=o[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:c,onApply:t=>s({...o,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:p.argScenario??`workflow.arg`,locale:r,context:{...p.context,workflowName:n,workflowArgs:o,fieldKey:e.key},disabled:p.disabled,showLabel:!1}):null]}),e.multiline?(0,z.jsx)(`textarea`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:i(u,`min-h-20 resize-y`)}):(0,z.jsx)(`input`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:u})]},e.key)}),C=v&&h.length>0?(0,z.jsx)(se,{examples:h,labels:y,onSelect:_}):null,w=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:c,onApply:l,fieldId:`workflow.goal`,fieldLabel:y.goalLabel,scenario:p.goalScenario??`cron.workflowGoal`,locale:r,context:{...p.context,workflowName:n,workflowArgs:o},disabled:p.disabled,showLabel:!1}):null]}),(0,z.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),placeholder:y.goalPlaceholder,className:i(u,`min-h-20 resize-y`)})]}):null,t[2]=p,t[3]=o,t[4]=h,t[5]=c,t[6]=f,t[7]=r,t[8]=s,t[9]=l,t[10]=g,t[11]=n,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=S,t[17]=C,t[18]=w}else _=t[12],v=t[13],y=t[14],b=t[15],S=t[16],C=t[17],w=t[18];let T;t[23]!==_||t[24]!==h||t[25]!==v||t[26]!==y?(T=!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]=T):T=t[27];let E;return t[28]!==b||t[29]!==S||t[30]!==C||t[31]!==w||t[32]!==T?(E=(0,z.jsxs)(`div`,{className:b,children:[S,C,w,T]}),t[28]=b,t[29]=S,t[30]=C,t[31]=w,t[32]=T,t[33]=E):E=t[33],E}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:a,onValidChange:o}){let s=(0,N.useMemo)(()=>H(e),[e]),[c,l]=(0,N.useState)(!1),[u,d]=(0,N.useState)(()=>JSON.stringify(t,null,2)),[f,p]=(0,N.useState)(null);if(s.length===0)return null;let m=(e,r)=>{let i={...t,[e]:r};(r===``||r===void 0)&&delete i[e],n(i),c&&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),o?.(!1);return}p(null),n(t),o?.(!0,t)}catch{p(r.rawJsonInvalid),o?.(!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=!c;l(e),e&&(d(JSON.stringify(t,null,2)),p(null),o?.(!0))},children:r.rawJson})]}),c?(0,z.jsxs)(`div`,{className:`mt-3`,children:[(0,z.jsx)(`textarea`,{value:u,onChange:e=>h(e.target.value),spellCheck:!1,className:i(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:s.map(e=>(0,z.jsx)(ue,{field:e,value:t[e.key],labels:r,aiAssist:a,allValues:t,onChange:t=>m(e.key,t)},e.key))})]})}function ue(e){let t=(0,P.c)(30),{field:n,value:r,labels:a,aiAssist:o,allValues:s,onChange:c}=e,l=n.schema.title||n.key,u=typeof n.schema.description==`string`?n.schema.description:void 0,d=Array.isArray(n.schema.type)?n.schema.type[0]:n.schema.type,f;t[0]===n.schema.enum?f=t[1]:(f=Array.isArray(n.schema.enum)?n.schema.enum:[],t[0]=n.schema.enum,t[1]=f);let p=f,m=!!o&&!p.length&&(d===`string`||!d),h=String(l),g=n.required?` *`:``,_;t[2]!==h||t[3]!==g?(_=(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg`,children:[h,g]}),t[2]=h,t[3]=g,t[4]=_):_=t[4];let v;t[5]!==o||t[6]!==s||t[7]!==n.key||t[8]!==n.schema||t[9]!==c||t[10]!==m||t[11]!==l||t[12]!==r?(v=m&&o?(0,z.jsx)(B,{value:typeof r==`string`?r:r==null?``:String(r),onApply:c,fieldId:`workflow.schema.${n.key}`,fieldLabel:String(l),scenario:o.scenario??`workflow.arg`,locale:o.locale,context:{...o.context,fieldKey:n.key,fieldSchema:n.schema,inputValues:s},disabled:o.disabled,showLabel:!1}):null,t[5]=o,t[6]=s,t[7]=n.key,t[8]=n.schema,t[9]=c,t[10]=m,t[11]=l,t[12]=r,t[13]=v):v=t[13];let b;t[14]!==_||t[15]!==v?(b=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[_,v]}),t[14]=_,t[15]=v,t[16]=b):b=t[16];let x;t[17]===u?x=t[18]:(x=u?(0,z.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-subtle`,children:u}):null,t[17]=u,t[18]=x);let S;t[19]!==u||t[20]!==p||t[21]!==a||t[22]!==c||t[23]!==d||t[24]!==r?(S=p.length>0?(0,z.jsxs)(C,{value:r==null?``:String(r),onChange:e=>c(e.target.value),className:q,children:[(0,z.jsx)(y,{value:``}),p.map(de)]}):d===`boolean`?(0,z.jsxs)(C,{value:typeof r==`boolean`?String(r):``,onChange:e=>c(e.target.value===``?void 0:e.target.value===`true`),className:q,children:[(0,z.jsx)(y,{value:``}),(0,z.jsx)(y,{value:`true`,children:a.booleanTrue}),(0,z.jsx)(y,{value:`false`,children:a.booleanFalse})]}):d===`number`||d===`integer`?(0,z.jsx)(`input`,{type:`number`,value:typeof r==`number`||typeof r==`string`?String(r):``,onChange:e=>c(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=>c(e.target.value),className:i(q,u&&u.length>80?`min-h-20 resize-y`:`min-h-10 resize-y`)}),t[19]=u,t[20]=p,t[21]=a,t[22]=c,t[23]=d,t[24]=r,t[25]=S):S=t[25];let w;return t[26]!==b||t[27]!==x||t[28]!==S?(w=(0,z.jsxs)(`div`,{className:`block`,children:[b,x,S]}),t[26]=b,t[27]=x,t[28]=S,t[29]=w):w=t[29],w}function de(e){return(0,z.jsx)(y,{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:o,onChange:s,aiAssist:c,inputClassName:l,onValidityChange:u}=e,d;t[0]===r?d=t[1]:(d=a(r),t[0]=r,t[1]=d);let f=d.workflows,p;t[2]!==n||t[3]!==r?(p=E(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,D,O,k,A,j;if(t[9]!==c||t[10]!==n||t[11]!==v||t[12]!==b||t[13]!==l||t[14]!==f||t[15]!==r||t[16]!==m.description||t[17]!==s||t[18]!==u||t[19]!==h||t[20]!==o){T=Symbol.for(`react.early_return_sentinel`);bb0:{let e=i(`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`,l),a;t[31]!==n||t[32]!==s||t[33]!==u||t[34]!==h?(a=(e,t)=>{let r=t===void 0?h:t;s(e),u?.(G(n,e,r))},t[31]=n,t[32]=s,t[33]=u,t[34]=h,t[35]=a):a=t[35];let d=a,p;t[36]!==d||t[37]!==o?(p=e=>d({...o,goal:e}),t[36]=d,t[37]=o,t[38]=p):p=t[38];let _=p,y;t[39]!==d||t[40]!==o?(y=e=>d({...o,schemaInput:e}),t[39]=d,t[40]=o,t[41]=y):y=t[41];let E=y,M;t[42]!==d||t[43]!==o?(M=e=>d({...o,argValues:e}),t[42]=d,t[43]=o,t[44]=M):M=t[44];let N=M,P;if(t[45]!==_||t[46]!==E||t[47]!==o.schemaInput?(P=e=>{if(e.field===`goal`){_(e.text);return}E({...o.schemaInput,[e.field]:e.text})},t[45]=_,t[46]=E,t[47]=o.schemaInput,t[48]=P):P=t[48],x=P,!b){let e;t[49]!==c||t[50]!==n.id||t[51]!==n.name||t[52]!==n.title||t[53]!==m.description?(e=c?{disabled:c.disabled,argScenario:c.inputScenario??`workflow.arg`,goalScenario:c.goalScenario??`workflow.goal`,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,t[49]=c,t[50]=n.id,t[51]=n.name,t[52]=n.title,t[53]=m.description,t[54]=e):e=t[54];let i;t[55]!==n.name||t[56]!==v||t[57]!==l||t[58]!==r||t[59]!==N||t[60]!==_||t[61]!==e||t[62]!==o.argValues||t[63]!==o.goal?(i=(0,z.jsx)(ce,{workflowName:n.name,language:r,argValues:o.argValues,onArgValuesChange:N,goal:o.goal,onGoalChange:_,examplePrompts:v,inputClassName:l,aiAssist:e}),t[55]=n.name,t[56]=v,t[57]=l,t[58]=r,t[59]=N,t[60]=_,t[61]=e,t[62]=o.argValues,t[63]=o.goal,t[64]=i):i=t[64],T=i;break bb0}C=`flex flex-col gap-3`,t[65]!==c||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]!==u||t[75]!==E||t[76]!==o?(w=n.inputSchema?(0,z.jsx)(le,{schema:n.inputSchema,value:o.schemaInput,onChange:E,onValidChange:(e,t)=>{g(e),u?.(G(n,t?{...o,schemaInput:t}:o,e))},aiAssist:c?{locale:r,disabled:c.disabled,scenario:c.inputScenario??`workflow.arg`,context:{...c.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]=c,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]=u,t[75]=E,t[76]=o,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]!==c||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]!==o.goal||t[89]!==o.schemaInput?(I=c?(0,z.jsx)(B,{value:o.goal,onApply:_,fieldId:`workflow.goal`,fieldLabel:f.goalLabel,scenario:c.goalScenario??`workflow.goal`,locale:r,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description,workflowInput:o.schemaInput},disabled:c.disabled,showLabel:!1}):null,t[80]=c,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]=o.goal,t[89]=o.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],D=o.goal,t[94]===_?O=t[95]:(O=e=>_(e.target.value),t[94]=_,t[95]=O),k=f.goalPlaceholder,A=i(e,`min-h-20 resize-y`)}t[9]=c,t[10]=n,t[11]=v,t[12]=b,t[13]=l,t[14]=f,t[15]=r,t[16]=m.description,t[17]=s,t[18]=u,t[19]=h,t[20]=o,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=D,t[27]=O,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],D=t[26],O=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]!==D||t[97]!==O||t[98]!==k||t[99]!==A?(M=(0,z.jsx)(`textarea`,{value:D,onChange:O,placeholder:k,className:A}),t[96]=D,t[97]=O,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?D(t.agentScaleExact,{count:n.min}):D(t.agentScaleRange,{min:n.min,max:n.max}):D(t.agentScaleExact,{count:e.defaults.maxSubagents})}function fe(e){let t=(0,P.c)(41),{definition:n,language:r,value:o,onChange:s,mode:c,badgeLabel:l,aiAssist:u,inputClassName:d,showTimeout:f,defaultAdvancedOpen:p,onValidityChange:h}=e,g=f===void 0?!1:f,v=p===void 0?!1:p,y=a(r).workflows,[b,x]=(0,N.useState)(v),C;t[0]!==n||t[1]!==r?(C=E(n,r),t[0]=n,t[1]=r,t[2]=C):C=t[2];let w=C,T;t[3]!==n.defaults||t[4]!==o.concurrency?(T=o.concurrency.trim()?Number(o.concurrency):n.defaults.concurrency,t[3]=n.defaults,t[4]=o.concurrency,t[5]=T):T=t[5];let O=T,k;t[6]!==n.defaults||t[7]!==o.maxSubagents?(k=o.maxSubagents.trim()?Number(o.maxSubagents):n.defaults.maxSubagents,t[6]=n.defaults,t[7]=o.maxSubagents,t[8]=k):k=t[8];let j=k,F;t[9]!==n||t[10]!==r||t[11]!==o?(F=ae(n,r,o),t[9]=n,t[10]=r,t[11]=o,t[12]=F):F=t[12];let I=F,L=l??y.readyToStart,R;t[13]!==s||t[14]!==o?(R=e=>s({...o,...e}),t[13]=s,t[14]=o,t[15]=R):R=t[15];let ee=R,te=c===`automation`&&`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,ne;t[16]===te?ne=t[17]:(ne=i(`space-y-4`,te),t[16]=te,t[17]=ne);let B=I||w.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)(S,{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)(_,{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)(A,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[22]=H):H=t[22];let U;t[23]!==s||t[24]!==o?(U=e=>s({...o,...e}),t[23]=s,t[24]=o,t[25]=U):U=t[25];let W;t[26]===h?W=t[27]:(W=e=>{h?.(e)},t[26]=h,t[27]=W);let G;t[28]!==u||t[29]!==n||t[30]!==d||t[31]!==r||t[32]!==U||t[33]!==W||t[34]!==o?(G=(0,z.jsx)(Y,{definition:n,language:r,value:o,onChange:U,onValidityChange:W,aiAssist:u,inputClassName:d}),t[28]=u,t[29]=n,t[30]=d,t[31]=r,t[32]=U,t[33]=W,t[34]=o,t[35]=G):G=t[35];let K;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(K=()=>x(pe),t[36]=K):K=t[36];let oe=y.advancedSettings,se=b&&`rotate-180`,ce;t[37]===se?ce=t[38]:(ce=i(`size-4 transition-transform`,se),t[37]=se,t[38]=ce);let q;return t[39]===ce?q=t[40]:(q=(0,z.jsx)(M,{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:y.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:D(y.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,y)})]}),(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:D(y.runLimitsSummary,{concurrency:O,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)(m,{className:`size-3.5`,"aria-hidden":!0}),y.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]}),b?(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:o.concurrency,onChange:e=>ee({concurrency:e.target.value}),placeholder:D(y.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:o.maxSubagents,onChange:e=>ee({maxSubagents:e.target.value}),placeholder:D(y.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`}),g?(0,z.jsx)(`input`,{value:o.timeoutSeconds??``,onChange:e=>ee({timeoutSeconds:e.target.value}),placeholder:D(y.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};
|