hivehq 2.0.0
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/CHANGELOG.md +592 -0
- package/LICENSE +208 -0
- package/LICENSE.BSL +101 -0
- package/NOTICE +15 -0
- package/README.en.md +451 -0
- package/README.md +329 -0
- package/SECURITY.md +59 -0
- package/TRADEMARK.md +41 -0
- package/assets/hive-hero.png +0 -0
- package/assets/hive-team-view.png +0 -0
- package/assets/logo.png +0 -0
- package/assets/qq-group.jpg +0 -0
- package/dist/bin/team +7 -0
- package/dist/bin/team.cmd +3 -0
- package/dist/src/cli/hive-remote.d.ts +46 -0
- package/dist/src/cli/hive-remote.js +257 -0
- package/dist/src/cli/hive-update.d.ts +75 -0
- package/dist/src/cli/hive-update.js +215 -0
- package/dist/src/cli/hive.d.ts +78 -0
- package/dist/src/cli/hive.js +336 -0
- package/dist/src/cli/team.d.ts +38 -0
- package/dist/src/cli/team.js +762 -0
- package/dist/src/server/agent-command-resolver.d.ts +17 -0
- package/dist/src/server/agent-command-resolver.js +106 -0
- package/dist/src/server/agent-exit-classification.d.ts +6 -0
- package/dist/src/server/agent-exit-classification.js +6 -0
- package/dist/src/server/agent-launch-cache.d.ts +20 -0
- package/dist/src/server/agent-launch-cache.js +75 -0
- package/dist/src/server/agent-launch-resolver.d.ts +4 -0
- package/dist/src/server/agent-launch-resolver.js +38 -0
- package/dist/src/server/agent-manager-support.d.ts +36 -0
- package/dist/src/server/agent-manager-support.js +318 -0
- package/dist/src/server/agent-manager.d.ts +54 -0
- package/dist/src/server/agent-manager.js +104 -0
- package/dist/src/server/agent-run-bootstrap.d.ts +83 -0
- package/dist/src/server/agent-run-bootstrap.js +101 -0
- package/dist/src/server/agent-run-exit-handler.d.ts +8 -0
- package/dist/src/server/agent-run-exit-handler.js +32 -0
- package/dist/src/server/agent-run-start-context.d.ts +24 -0
- package/dist/src/server/agent-run-start-context.js +1 -0
- package/dist/src/server/agent-run-starter.d.ts +30 -0
- package/dist/src/server/agent-run-starter.js +155 -0
- package/dist/src/server/agent-run-store.d.ts +51 -0
- package/dist/src/server/agent-run-store.js +137 -0
- package/dist/src/server/agent-run-sync.d.ts +10 -0
- package/dist/src/server/agent-run-sync.js +32 -0
- package/dist/src/server/agent-runtime-active-run.d.ts +3 -0
- package/dist/src/server/agent-runtime-active-run.js +10 -0
- package/dist/src/server/agent-runtime-close.d.ts +5 -0
- package/dist/src/server/agent-runtime-close.js +36 -0
- package/dist/src/server/agent-runtime-contract.d.ts +48 -0
- package/dist/src/server/agent-runtime-contract.js +1 -0
- package/dist/src/server/agent-runtime-flow-adapter.d.ts +10 -0
- package/dist/src/server/agent-runtime-flow-adapter.js +14 -0
- package/dist/src/server/agent-runtime-list-runs.d.ts +3 -0
- package/dist/src/server/agent-runtime-list-runs.js +18 -0
- package/dist/src/server/agent-runtime-ports.d.ts +22 -0
- package/dist/src/server/agent-runtime-ports.js +1 -0
- package/dist/src/server/agent-runtime-stop-run.d.ts +4 -0
- package/dist/src/server/agent-runtime-stop-run.js +19 -0
- package/dist/src/server/agent-runtime-types.d.ts +5 -0
- package/dist/src/server/agent-runtime-types.js +1 -0
- package/dist/src/server/agent-runtime.d.ts +10 -0
- package/dist/src/server/agent-runtime.js +143 -0
- package/dist/src/server/agent-session-store.d.ts +7 -0
- package/dist/src/server/agent-session-store.js +45 -0
- package/dist/src/server/agent-startup-instructions.d.ts +20 -0
- package/dist/src/server/agent-startup-instructions.js +36 -0
- package/dist/src/server/agent-stdin-dispatcher.d.ts +52 -0
- package/dist/src/server/agent-stdin-dispatcher.js +224 -0
- package/dist/src/server/agent-tokens.d.ts +15 -0
- package/dist/src/server/agent-tokens.js +25 -0
- package/dist/src/server/app-state-store.d.ts +10 -0
- package/dist/src/server/app-state-store.js +12 -0
- package/dist/src/server/app.d.ts +20 -0
- package/dist/src/server/app.js +211 -0
- package/dist/src/server/claude-command-defaults.d.ts +1 -0
- package/dist/src/server/claude-command-defaults.js +5 -0
- package/dist/src/server/claude-session-coordinator.d.ts +10 -0
- package/dist/src/server/claude-session-coordinator.js +68 -0
- package/dist/src/server/claude-session-support.d.ts +1 -0
- package/dist/src/server/claude-session-support.js +1 -0
- package/dist/src/server/command-preset-defaults.d.ts +11 -0
- package/dist/src/server/command-preset-defaults.js +63 -0
- package/dist/src/server/command-preset-store.d.ts +49 -0
- package/dist/src/server/command-preset-store.js +83 -0
- package/dist/src/server/cron-util.d.ts +7 -0
- package/dist/src/server/cron-util.js +19 -0
- package/dist/src/server/dispatch-ledger-serializer.d.ts +15 -0
- package/dist/src/server/dispatch-ledger-serializer.js +14 -0
- package/dist/src/server/dispatch-ledger-store.d.ts +108 -0
- package/dist/src/server/dispatch-ledger-store.js +241 -0
- package/dist/src/server/env-sync-message.d.ts +9 -0
- package/dist/src/server/env-sync-message.js +29 -0
- package/dist/src/server/feature-flags.d.ts +42 -0
- package/dist/src/server/feature-flags.js +24 -0
- package/dist/src/server/fs-browse.d.ts +40 -0
- package/dist/src/server/fs-browse.js +306 -0
- package/dist/src/server/fs-pick-folder.d.ts +25 -0
- package/dist/src/server/fs-pick-folder.js +115 -0
- package/dist/src/server/fs-sandbox.d.ts +15 -0
- package/dist/src/server/fs-sandbox.js +56 -0
- package/dist/src/server/hive-team-guidance.d.ts +39 -0
- package/dist/src/server/hive-team-guidance.js +295 -0
- package/dist/src/server/http-errors.d.ts +22 -0
- package/dist/src/server/http-errors.js +44 -0
- package/dist/src/server/live-run-registry.d.ts +22 -0
- package/dist/src/server/live-run-registry.js +52 -0
- package/dist/src/server/local-request-guard.d.ts +3 -0
- package/dist/src/server/local-request-guard.js +41 -0
- package/dist/src/server/machine-name.d.ts +2 -0
- package/dist/src/server/machine-name.js +13 -0
- package/dist/src/server/marketplace-store.d.ts +38 -0
- package/dist/src/server/marketplace-store.js +85 -0
- package/dist/src/server/message-log-store.d.ts +51 -0
- package/dist/src/server/message-log-store.js +90 -0
- package/dist/src/server/open-target-commands.d.ts +54 -0
- package/dist/src/server/open-target-commands.js +204 -0
- package/dist/src/server/orchestrator-autostart.d.ts +42 -0
- package/dist/src/server/orchestrator-autostart.js +114 -0
- package/dist/src/server/orchestrator-launch.d.ts +24 -0
- package/dist/src/server/orchestrator-launch.js +71 -0
- package/dist/src/server/package-version.d.ts +17 -0
- package/dist/src/server/package-version.js +32 -0
- package/dist/src/server/path-canonicalization.d.ts +3 -0
- package/dist/src/server/path-canonicalization.js +29 -0
- package/dist/src/server/platform-path.d.ts +4 -0
- package/dist/src/server/platform-path.js +26 -0
- package/dist/src/server/post-start-input-writer.d.ts +6 -0
- package/dist/src/server/post-start-input-writer.js +242 -0
- package/dist/src/server/preset-launch-support.d.ts +6 -0
- package/dist/src/server/preset-launch-support.js +98 -0
- package/dist/src/server/pty-output-bus.d.ts +8 -0
- package/dist/src/server/pty-output-bus.js +32 -0
- package/dist/src/server/recovery-summary.d.ts +15 -0
- package/dist/src/server/recovery-summary.js +92 -0
- package/dist/src/server/remote-audit-store.d.ts +51 -0
- package/dist/src/server/remote-audit-store.js +108 -0
- package/dist/src/server/remote-config-keys.d.ts +17 -0
- package/dist/src/server/remote-config-keys.js +27 -0
- package/dist/src/server/remote-control-constants.d.ts +30 -0
- package/dist/src/server/remote-control-constants.js +29 -0
- package/dist/src/server/remote-device-session.d.ts +40 -0
- package/dist/src/server/remote-device-session.js +22 -0
- package/dist/src/server/remote-device-store.d.ts +36 -0
- package/dist/src/server/remote-device-store.js +67 -0
- package/dist/src/server/remote-frame-bridge.d.ts +102 -0
- package/dist/src/server/remote-frame-bridge.js +791 -0
- package/dist/src/server/remote-gateway-client.d.ts +14 -0
- package/dist/src/server/remote-gateway-client.js +36 -0
- package/dist/src/server/remote-loopback-auth.d.ts +6 -0
- package/dist/src/server/remote-loopback-auth.js +112 -0
- package/dist/src/server/remote-pairing-tunnel.d.ts +59 -0
- package/dist/src/server/remote-pairing-tunnel.js +146 -0
- package/dist/src/server/remote-pairing.d.ts +58 -0
- package/dist/src/server/remote-pairing.js +237 -0
- package/dist/src/server/remote-tunnel.d.ts +113 -0
- package/dist/src/server/remote-tunnel.js +514 -0
- package/dist/src/server/report-outbox-store.d.ts +36 -0
- package/dist/src/server/report-outbox-store.js +33 -0
- package/dist/src/server/restart-policy-support.d.ts +30 -0
- package/dist/src/server/restart-policy-support.js +21 -0
- package/dist/src/server/restart-policy.d.ts +18 -0
- package/dist/src/server/restart-policy.js +77 -0
- package/dist/src/server/role-template-store.d.ts +45 -0
- package/dist/src/server/role-template-store.js +76 -0
- package/dist/src/server/role-templates.d.ts +7 -0
- package/dist/src/server/role-templates.js +54 -0
- package/dist/src/server/route-helpers.d.ts +9 -0
- package/dist/src/server/route-helpers.js +61 -0
- package/dist/src/server/route-types.d.ts +121 -0
- package/dist/src/server/route-types.js +1 -0
- package/dist/src/server/routes-dispatches.d.ts +2 -0
- package/dist/src/server/routes-dispatches.js +54 -0
- package/dist/src/server/routes-fs.d.ts +2 -0
- package/dist/src/server/routes-fs.js +24 -0
- package/dist/src/server/routes-marketplace.d.ts +2 -0
- package/dist/src/server/routes-marketplace.js +54 -0
- package/dist/src/server/routes-open-workspace.d.ts +2 -0
- package/dist/src/server/routes-open-workspace.js +47 -0
- package/dist/src/server/routes-remote.d.ts +2 -0
- package/dist/src/server/routes-remote.js +166 -0
- package/dist/src/server/routes-runtime.d.ts +2 -0
- package/dist/src/server/routes-runtime.js +79 -0
- package/dist/src/server/routes-settings.d.ts +2 -0
- package/dist/src/server/routes-settings.js +213 -0
- package/dist/src/server/routes-tasks.d.ts +2 -0
- package/dist/src/server/routes-tasks.js +47 -0
- package/dist/src/server/routes-team-memory.d.ts +2 -0
- package/dist/src/server/routes-team-memory.js +154 -0
- package/dist/src/server/routes-team-recall.d.ts +2 -0
- package/dist/src/server/routes-team-recall.js +119 -0
- package/dist/src/server/routes-team.d.ts +2 -0
- package/dist/src/server/routes-team.js +351 -0
- package/dist/src/server/routes-ui.d.ts +2 -0
- package/dist/src/server/routes-ui.js +17 -0
- package/dist/src/server/routes-version.d.ts +2 -0
- package/dist/src/server/routes-version.js +6 -0
- package/dist/src/server/routes-workflow-schedules.d.ts +2 -0
- package/dist/src/server/routes-workflow-schedules.js +58 -0
- package/dist/src/server/routes-workflows.d.ts +2 -0
- package/dist/src/server/routes-workflows.js +83 -0
- package/dist/src/server/routes-workspace-memory-dreams.d.ts +2 -0
- package/dist/src/server/routes-workspace-memory-dreams.js +105 -0
- package/dist/src/server/routes-workspace-memory.d.ts +2 -0
- package/dist/src/server/routes-workspace-memory.js +215 -0
- package/dist/src/server/routes-workspaces.d.ts +2 -0
- package/dist/src/server/routes-workspaces.js +177 -0
- package/dist/src/server/routes.d.ts +6 -0
- package/dist/src/server/routes.js +55 -0
- package/dist/src/server/runtime-database.d.ts +3 -0
- package/dist/src/server/runtime-database.js +41 -0
- package/dist/src/server/runtime-message-builders.d.ts +7 -0
- package/dist/src/server/runtime-message-builders.js +60 -0
- package/dist/src/server/runtime-restart-policy.d.ts +18 -0
- package/dist/src/server/runtime-restart-policy.js +12 -0
- package/dist/src/server/runtime-store-contract.d.ts +162 -0
- package/dist/src/server/runtime-store-contract.js +1 -0
- package/dist/src/server/runtime-store-dream.d.ts +23 -0
- package/dist/src/server/runtime-store-dream.js +16 -0
- package/dist/src/server/runtime-store-helpers.d.ts +115 -0
- package/dist/src/server/runtime-store-helpers.js +411 -0
- package/dist/src/server/runtime-store-memory.d.ts +33 -0
- package/dist/src/server/runtime-store-memory.js +37 -0
- package/dist/src/server/runtime-store-remote.d.ts +5 -0
- package/dist/src/server/runtime-store-remote.js +45 -0
- package/dist/src/server/runtime-store-workflows.d.ts +6 -0
- package/dist/src/server/runtime-store-workflows.js +108 -0
- package/dist/src/server/runtime-store.d.ts +4 -0
- package/dist/src/server/runtime-store.js +165 -0
- package/dist/src/server/session-capture-claude.d.ts +34 -0
- package/dist/src/server/session-capture-claude.js +103 -0
- package/dist/src/server/session-capture-codex.d.ts +6 -0
- package/dist/src/server/session-capture-codex.js +108 -0
- package/dist/src/server/session-capture-gemini.d.ts +5 -0
- package/dist/src/server/session-capture-gemini.js +81 -0
- package/dist/src/server/session-capture-opencode.d.ts +22 -0
- package/dist/src/server/session-capture-opencode.js +75 -0
- package/dist/src/server/session-capture.d.ts +77 -0
- package/dist/src/server/session-capture.js +123 -0
- package/dist/src/server/settings-store.d.ts +22 -0
- package/dist/src/server/settings-store.js +22 -0
- package/dist/src/server/sqlite-schema-v10.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v10.js +13 -0
- package/dist/src/server/sqlite-schema-v11.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v11.js +10 -0
- package/dist/src/server/sqlite-schema-v12.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v12.js +21 -0
- package/dist/src/server/sqlite-schema-v13.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v13.js +4 -0
- package/dist/src/server/sqlite-schema-v14.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v14.js +84 -0
- package/dist/src/server/sqlite-schema-v15.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v15.js +73 -0
- package/dist/src/server/sqlite-schema-v16.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v16.js +6 -0
- package/dist/src/server/sqlite-schema-v17.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v17.js +15 -0
- package/dist/src/server/sqlite-schema-v18.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v18.js +6 -0
- package/dist/src/server/sqlite-schema-v19.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v19.js +17 -0
- package/dist/src/server/sqlite-schema-v20.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v20.js +20 -0
- package/dist/src/server/sqlite-schema-v21.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v21.js +20 -0
- package/dist/src/server/sqlite-schema-v22.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v22.js +27 -0
- package/dist/src/server/sqlite-schema-v23.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v23.js +43 -0
- package/dist/src/server/sqlite-schema-v24.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v24.js +34 -0
- package/dist/src/server/sqlite-schema-v25.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v25.js +127 -0
- package/dist/src/server/sqlite-schema-v26.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v26.js +56 -0
- package/dist/src/server/sqlite-schema-v27.d.ts +6 -0
- package/dist/src/server/sqlite-schema-v27.js +92 -0
- package/dist/src/server/sqlite-schema-v28.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v28.js +19 -0
- package/dist/src/server/sqlite-schema-v5.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v5.js +61 -0
- package/dist/src/server/sqlite-schema-v7.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v7.js +70 -0
- package/dist/src/server/sqlite-schema-v8.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v8.js +6 -0
- package/dist/src/server/sqlite-schema-v9.d.ts +2 -0
- package/dist/src/server/sqlite-schema-v9.js +6 -0
- package/dist/src/server/sqlite-schema.d.ts +3 -0
- package/dist/src/server/sqlite-schema.js +353 -0
- package/dist/src/server/startup-command-parser.d.ts +20 -0
- package/dist/src/server/startup-command-parser.js +72 -0
- package/dist/src/server/system-message.d.ts +8 -0
- package/dist/src/server/system-message.js +8 -0
- package/dist/src/server/task-deps.d.ts +32 -0
- package/dist/src/server/task-deps.js +40 -0
- package/dist/src/server/tasks-file-watcher.d.ts +47 -0
- package/dist/src/server/tasks-file-watcher.js +200 -0
- package/dist/src/server/tasks-file.d.ts +23 -0
- package/dist/src/server/tasks-file.js +101 -0
- package/dist/src/server/tasks-websocket-server.d.ts +8 -0
- package/dist/src/server/tasks-websocket-server.js +95 -0
- package/dist/src/server/team-authz.d.ts +13 -0
- package/dist/src/server/team-authz.js +53 -0
- package/dist/src/server/team-autostaff.d.ts +16 -0
- package/dist/src/server/team-autostaff.js +16 -0
- package/dist/src/server/team-list-enrichment.d.ts +22 -0
- package/dist/src/server/team-list-enrichment.js +40 -0
- package/dist/src/server/team-list-serializer.d.ts +2 -0
- package/dist/src/server/team-list-serializer.js +11 -0
- package/dist/src/server/team-memory-digest.d.ts +52 -0
- package/dist/src/server/team-memory-digest.js +200 -0
- package/dist/src/server/team-memory-dream-applier.d.ts +5 -0
- package/dist/src/server/team-memory-dream-applier.js +234 -0
- package/dist/src/server/team-memory-dream-http-serializers.d.ts +13 -0
- package/dist/src/server/team-memory-dream-http-serializers.js +12 -0
- package/dist/src/server/team-memory-dream-ops.d.ts +40 -0
- package/dist/src/server/team-memory-dream-ops.js +153 -0
- package/dist/src/server/team-memory-dream-reverter.d.ts +22 -0
- package/dist/src/server/team-memory-dream-reverter.js +221 -0
- package/dist/src/server/team-memory-dream-run-store.d.ts +23 -0
- package/dist/src/server/team-memory-dream-run-store.js +211 -0
- package/dist/src/server/team-memory-dream-runner.d.ts +37 -0
- package/dist/src/server/team-memory-dream-runner.js +178 -0
- package/dist/src/server/team-memory-dream-scheduler.d.ts +32 -0
- package/dist/src/server/team-memory-dream-scheduler.js +115 -0
- package/dist/src/server/team-memory-dream-store.d.ts +19 -0
- package/dist/src/server/team-memory-dream-store.js +16 -0
- package/dist/src/server/team-memory-dream-types.d.ts +104 -0
- package/dist/src/server/team-memory-dream-types.js +23 -0
- package/dist/src/server/team-memory-export.d.ts +22 -0
- package/dist/src/server/team-memory-export.js +220 -0
- package/dist/src/server/team-memory-feature.d.ts +12 -0
- package/dist/src/server/team-memory-feature.js +12 -0
- package/dist/src/server/team-memory-http-serializers.d.ts +102 -0
- package/dist/src/server/team-memory-http-serializers.js +46 -0
- package/dist/src/server/team-memory-injection.d.ts +31 -0
- package/dist/src/server/team-memory-injection.js +49 -0
- package/dist/src/server/team-memory-store.d.ts +116 -0
- package/dist/src/server/team-memory-store.js +513 -0
- package/dist/src/server/team-operations.d.ts +102 -0
- package/dist/src/server/team-operations.js +387 -0
- package/dist/src/server/team-recall-store.d.ts +38 -0
- package/dist/src/server/team-recall-store.js +205 -0
- package/dist/src/server/terminal-flow-control.d.ts +19 -0
- package/dist/src/server/terminal-flow-control.js +116 -0
- package/dist/src/server/terminal-input-profile.d.ts +10 -0
- package/dist/src/server/terminal-input-profile.js +9 -0
- package/dist/src/server/terminal-protocol.d.ts +29 -0
- package/dist/src/server/terminal-protocol.js +47 -0
- package/dist/src/server/terminal-state-mirror.d.ts +21 -0
- package/dist/src/server/terminal-state-mirror.js +67 -0
- package/dist/src/server/terminal-stream-hub.d.ts +9 -0
- package/dist/src/server/terminal-stream-hub.js +192 -0
- package/dist/src/server/terminal-ws-server.d.ts +6 -0
- package/dist/src/server/terminal-ws-server.js +115 -0
- package/dist/src/server/ui-auth-helpers.d.ts +4 -0
- package/dist/src/server/ui-auth-helpers.js +28 -0
- package/dist/src/server/ui-auth.d.ts +8 -0
- package/dist/src/server/ui-auth.js +32 -0
- package/dist/src/server/version-service.d.ts +16 -0
- package/dist/src/server/version-service.js +72 -0
- package/dist/src/server/webhook-notifier.d.ts +34 -0
- package/dist/src/server/webhook-notifier.js +47 -0
- package/dist/src/server/websocket-upgrade-safety.d.ts +10 -0
- package/dist/src/server/websocket-upgrade-safety.js +35 -0
- package/dist/src/server/windows-command-line.d.ts +3 -0
- package/dist/src/server/windows-command-line.js +9 -0
- package/dist/src/server/windows-filename.d.ts +2 -0
- package/dist/src/server/windows-filename.js +33 -0
- package/dist/src/server/worker-output-tracker.d.ts +14 -0
- package/dist/src/server/worker-output-tracker.js +50 -0
- package/dist/src/server/workflow-cli-policy.d.ts +60 -0
- package/dist/src/server/workflow-cli-policy.js +110 -0
- package/dist/src/server/workflow-dispatch-awaiter.d.ts +12 -0
- package/dist/src/server/workflow-dispatch-awaiter.js +80 -0
- package/dist/src/server/workflow-feature.d.ts +15 -0
- package/dist/src/server/workflow-feature.js +15 -0
- package/dist/src/server/workflow-http-serializers.d.ts +64 -0
- package/dist/src/server/workflow-http-serializers.js +58 -0
- package/dist/src/server/workflow-output-schema.d.ts +18 -0
- package/dist/src/server/workflow-output-schema.js +41 -0
- package/dist/src/server/workflow-run-log-store.d.ts +19 -0
- package/dist/src/server/workflow-run-log-store.js +45 -0
- package/dist/src/server/workflow-run-store.d.ts +50 -0
- package/dist/src/server/workflow-run-store.js +103 -0
- package/dist/src/server/workflow-runner.d.ts +147 -0
- package/dist/src/server/workflow-runner.js +411 -0
- package/dist/src/server/workflow-schedule-create.d.ts +14 -0
- package/dist/src/server/workflow-schedule-create.js +41 -0
- package/dist/src/server/workflow-schedule-store.d.ts +43 -0
- package/dist/src/server/workflow-schedule-store.js +112 -0
- package/dist/src/server/workflow-scheduler.d.ts +36 -0
- package/dist/src/server/workflow-scheduler.js +97 -0
- package/dist/src/server/workflow-script-loader.d.ts +34 -0
- package/dist/src/server/workflow-script-loader.js +106 -0
- package/dist/src/server/workspace-path-validation.d.ts +1 -0
- package/dist/src/server/workspace-path-validation.js +42 -0
- package/dist/src/server/workspace-shell-runtime.d.ts +35 -0
- package/dist/src/server/workspace-shell-runtime.js +228 -0
- package/dist/src/server/workspace-store-contract.d.ts +32 -0
- package/dist/src/server/workspace-store-contract.js +1 -0
- package/dist/src/server/workspace-store-hydration.d.ts +5 -0
- package/dist/src/server/workspace-store-hydration.js +76 -0
- package/dist/src/server/workspace-store-mutations.d.ts +14 -0
- package/dist/src/server/workspace-store-mutations.js +48 -0
- package/dist/src/server/workspace-store-support.d.ts +33 -0
- package/dist/src/server/workspace-store-support.js +36 -0
- package/dist/src/server/workspace-store.d.ts +5 -0
- package/dist/src/server/workspace-store.js +153 -0
- package/dist/src/shared/fs-browse.d.ts +1 -0
- package/dist/src/shared/fs-browse.js +1 -0
- package/dist/src/shared/open-targets.d.ts +20 -0
- package/dist/src/shared/open-targets.js +36 -0
- package/dist/src/shared/path-input.d.ts +12 -0
- package/dist/src/shared/path-input.js +22 -0
- package/dist/src/shared/remote-bridge-routing.d.ts +19 -0
- package/dist/src/shared/remote-bridge-routing.js +141 -0
- package/dist/src/shared/remote-crypto.d.ts +138 -0
- package/dist/src/shared/remote-crypto.js +427 -0
- package/dist/src/shared/remote-pairing-code.d.ts +7 -0
- package/dist/src/shared/remote-pairing-code.js +47 -0
- package/dist/src/shared/remote-protocol.d.ts +160 -0
- package/dist/src/shared/remote-protocol.js +526 -0
- package/dist/src/shared/team-memory.d.ts +11 -0
- package/dist/src/shared/team-memory.js +10 -0
- package/dist/src/shared/team-recall.d.ts +1 -0
- package/dist/src/shared/team-recall.js +1 -0
- package/dist/src/shared/types.d.ts +66 -0
- package/dist/src/shared/types.js +1 -0
- package/dist/vendor/marketplace/en/LICENSE +21 -0
- package/dist/vendor/marketplace/en/SOURCES.md +12 -0
- package/dist/vendor/marketplace/en/academic/academic-anthropologist.md +125 -0
- package/dist/vendor/marketplace/en/academic/academic-geographer.md +127 -0
- package/dist/vendor/marketplace/en/academic/academic-historian.md +123 -0
- package/dist/vendor/marketplace/en/academic/academic-narratologist.md +118 -0
- package/dist/vendor/marketplace/en/academic/academic-psychologist.md +118 -0
- package/dist/vendor/marketplace/en/design/design-brand-guardian.md +322 -0
- package/dist/vendor/marketplace/en/design/design-image-prompt-engineer.md +236 -0
- package/dist/vendor/marketplace/en/design/design-inclusive-visuals-specialist.md +71 -0
- package/dist/vendor/marketplace/en/design/design-ui-designer.md +383 -0
- package/dist/vendor/marketplace/en/design/design-ux-architect.md +469 -0
- package/dist/vendor/marketplace/en/design/design-ux-researcher.md +329 -0
- package/dist/vendor/marketplace/en/design/design-visual-storyteller.md +149 -0
- package/dist/vendor/marketplace/en/design/design-whimsy-injector.md +438 -0
- package/dist/vendor/marketplace/en/engineering/engineering-ai-data-remediation-engineer.md +211 -0
- package/dist/vendor/marketplace/en/engineering/engineering-ai-engineer.md +146 -0
- package/dist/vendor/marketplace/en/engineering/engineering-autonomous-optimization-architect.md +107 -0
- package/dist/vendor/marketplace/en/engineering/engineering-backend-architect.md +235 -0
- package/dist/vendor/marketplace/en/engineering/engineering-cms-developer.md +536 -0
- package/dist/vendor/marketplace/en/engineering/engineering-code-reviewer.md +76 -0
- package/dist/vendor/marketplace/en/engineering/engineering-codebase-onboarding-engineer.md +173 -0
- package/dist/vendor/marketplace/en/engineering/engineering-data-engineer.md +306 -0
- package/dist/vendor/marketplace/en/engineering/engineering-database-optimizer.md +176 -0
- package/dist/vendor/marketplace/en/engineering/engineering-devops-automator.md +376 -0
- package/dist/vendor/marketplace/en/engineering/engineering-email-intelligence-engineer.md +353 -0
- package/dist/vendor/marketplace/en/engineering/engineering-embedded-firmware-engineer.md +173 -0
- package/dist/vendor/marketplace/en/engineering/engineering-feishu-integration-developer.md +598 -0
- package/dist/vendor/marketplace/en/engineering/engineering-filament-optimization-specialist.md +283 -0
- package/dist/vendor/marketplace/en/engineering/engineering-frontend-developer.md +225 -0
- package/dist/vendor/marketplace/en/engineering/engineering-git-workflow-master.md +84 -0
- package/dist/vendor/marketplace/en/engineering/engineering-incident-response-commander.md +444 -0
- package/dist/vendor/marketplace/en/engineering/engineering-minimal-change-engineer.md +207 -0
- package/dist/vendor/marketplace/en/engineering/engineering-mobile-app-builder.md +493 -0
- package/dist/vendor/marketplace/en/engineering/engineering-rapid-prototyper.md +462 -0
- package/dist/vendor/marketplace/en/engineering/engineering-security-engineer.md +304 -0
- package/dist/vendor/marketplace/en/engineering/engineering-senior-developer.md +176 -0
- package/dist/vendor/marketplace/en/engineering/engineering-software-architect.md +81 -0
- package/dist/vendor/marketplace/en/engineering/engineering-solidity-smart-contract-engineer.md +522 -0
- package/dist/vendor/marketplace/en/engineering/engineering-sre.md +90 -0
- package/dist/vendor/marketplace/en/engineering/engineering-technical-writer.md +393 -0
- package/dist/vendor/marketplace/en/engineering/engineering-threat-detection-engineer.md +534 -0
- package/dist/vendor/marketplace/en/engineering/engineering-voice-ai-integration-engineer.md +561 -0
- package/dist/vendor/marketplace/en/engineering/engineering-wechat-mini-program-developer.md +350 -0
- package/dist/vendor/marketplace/en/finance/finance-bookkeeper-controller.md +260 -0
- package/dist/vendor/marketplace/en/finance/finance-financial-analyst.md +234 -0
- package/dist/vendor/marketplace/en/finance/finance-fpa-analyst.md +263 -0
- package/dist/vendor/marketplace/en/finance/finance-investment-researcher.md +272 -0
- package/dist/vendor/marketplace/en/finance/finance-tax-strategist.md +239 -0
- package/dist/vendor/marketplace/en/game-development/blender/blender-addon-engineer.md +234 -0
- package/dist/vendor/marketplace/en/game-development/game-audio-engineer.md +264 -0
- package/dist/vendor/marketplace/en/game-development/game-designer.md +167 -0
- package/dist/vendor/marketplace/en/game-development/godot/godot-gameplay-scripter.md +334 -0
- package/dist/vendor/marketplace/en/game-development/godot/godot-multiplayer-engineer.md +297 -0
- package/dist/vendor/marketplace/en/game-development/godot/godot-shader-developer.md +266 -0
- package/dist/vendor/marketplace/en/game-development/level-designer.md +208 -0
- package/dist/vendor/marketplace/en/game-development/narrative-designer.md +243 -0
- package/dist/vendor/marketplace/en/game-development/roblox-studio/roblox-avatar-creator.md +297 -0
- package/dist/vendor/marketplace/en/game-development/roblox-studio/roblox-experience-designer.md +305 -0
- package/dist/vendor/marketplace/en/game-development/roblox-studio/roblox-systems-scripter.md +325 -0
- package/dist/vendor/marketplace/en/game-development/technical-artist.md +229 -0
- package/dist/vendor/marketplace/en/game-development/unity/unity-architect.md +271 -0
- package/dist/vendor/marketplace/en/game-development/unity/unity-editor-tool-developer.md +310 -0
- package/dist/vendor/marketplace/en/game-development/unity/unity-multiplayer-engineer.md +321 -0
- package/dist/vendor/marketplace/en/game-development/unity/unity-shader-graph-artist.md +269 -0
- package/dist/vendor/marketplace/en/game-development/unreal-engine/unreal-multiplayer-architect.md +313 -0
- package/dist/vendor/marketplace/en/game-development/unreal-engine/unreal-systems-engineer.md +310 -0
- package/dist/vendor/marketplace/en/game-development/unreal-engine/unreal-technical-artist.md +256 -0
- package/dist/vendor/marketplace/en/game-development/unreal-engine/unreal-world-builder.md +273 -0
- package/dist/vendor/marketplace/en/integrations/mcp-memory/backend-architect-with-memory.md +247 -0
- package/dist/vendor/marketplace/en/manifest.json +1869 -0
- package/dist/vendor/marketplace/en/marketing/marketing-agentic-search-optimizer.md +311 -0
- package/dist/vendor/marketplace/en/marketing/marketing-ai-citation-strategist.md +170 -0
- package/dist/vendor/marketplace/en/marketing/marketing-app-store-optimizer.md +321 -0
- package/dist/vendor/marketplace/en/marketing/marketing-baidu-seo-specialist.md +226 -0
- package/dist/vendor/marketplace/en/marketing/marketing-bilibili-content-strategist.md +199 -0
- package/dist/vendor/marketplace/en/marketing/marketing-book-co-author.md +110 -0
- package/dist/vendor/marketplace/en/marketing/marketing-carousel-growth-engine.md +199 -0
- package/dist/vendor/marketplace/en/marketing/marketing-china-ecommerce-operator.md +283 -0
- package/dist/vendor/marketplace/en/marketing/marketing-china-market-localization-strategist.md +283 -0
- package/dist/vendor/marketplace/en/marketing/marketing-content-creator.md +54 -0
- package/dist/vendor/marketplace/en/marketing/marketing-cross-border-ecommerce.md +259 -0
- package/dist/vendor/marketplace/en/marketing/marketing-douyin-strategist.md +149 -0
- package/dist/vendor/marketplace/en/marketing/marketing-growth-hacker.md +54 -0
- package/dist/vendor/marketplace/en/marketing/marketing-instagram-curator.md +113 -0
- package/dist/vendor/marketplace/en/marketing/marketing-kuaishou-strategist.md +223 -0
- package/dist/vendor/marketplace/en/marketing/marketing-linkedin-content-creator.md +214 -0
- package/dist/vendor/marketplace/en/marketing/marketing-livestream-commerce-coach.md +305 -0
- package/dist/vendor/marketplace/en/marketing/marketing-podcast-strategist.md +277 -0
- package/dist/vendor/marketplace/en/marketing/marketing-private-domain-operator.md +308 -0
- package/dist/vendor/marketplace/en/marketing/marketing-reddit-community-builder.md +123 -0
- package/dist/vendor/marketplace/en/marketing/marketing-seo-specialist.md +321 -0
- package/dist/vendor/marketplace/en/marketing/marketing-short-video-editing-coach.md +412 -0
- package/dist/vendor/marketplace/en/marketing/marketing-social-media-strategist.md +125 -0
- package/dist/vendor/marketplace/en/marketing/marketing-tiktok-strategist.md +125 -0
- package/dist/vendor/marketplace/en/marketing/marketing-twitter-engager.md +126 -0
- package/dist/vendor/marketplace/en/marketing/marketing-video-optimization-specialist.md +119 -0
- package/dist/vendor/marketplace/en/marketing/marketing-wechat-official-account.md +145 -0
- package/dist/vendor/marketplace/en/marketing/marketing-weibo-strategist.md +240 -0
- package/dist/vendor/marketplace/en/marketing/marketing-xiaohongshu-specialist.md +138 -0
- package/dist/vendor/marketplace/en/marketing/marketing-zhihu-strategist.md +162 -0
- package/dist/vendor/marketplace/en/paid-media/paid-media-auditor.md +71 -0
- package/dist/vendor/marketplace/en/paid-media/paid-media-creative-strategist.md +71 -0
- package/dist/vendor/marketplace/en/paid-media/paid-media-paid-social-strategist.md +71 -0
- package/dist/vendor/marketplace/en/paid-media/paid-media-ppc-strategist.md +71 -0
- package/dist/vendor/marketplace/en/paid-media/paid-media-programmatic-buyer.md +71 -0
- package/dist/vendor/marketplace/en/paid-media/paid-media-search-query-analyst.md +71 -0
- package/dist/vendor/marketplace/en/paid-media/paid-media-tracking-specialist.md +71 -0
- package/dist/vendor/marketplace/en/product/product-behavioral-nudge-engine.md +80 -0
- package/dist/vendor/marketplace/en/product/product-feedback-synthesizer.md +119 -0
- package/dist/vendor/marketplace/en/product/product-manager.md +469 -0
- package/dist/vendor/marketplace/en/product/product-sprint-prioritizer.md +154 -0
- package/dist/vendor/marketplace/en/product/product-trend-researcher.md +159 -0
- package/dist/vendor/marketplace/en/project-management/project-management-experiment-tracker.md +198 -0
- package/dist/vendor/marketplace/en/project-management/project-management-jira-workflow-steward.md +230 -0
- package/dist/vendor/marketplace/en/project-management/project-management-project-shepherd.md +194 -0
- package/dist/vendor/marketplace/en/project-management/project-management-studio-operations.md +200 -0
- package/dist/vendor/marketplace/en/project-management/project-management-studio-producer.md +203 -0
- package/dist/vendor/marketplace/en/project-management/project-manager-senior.md +135 -0
- package/dist/vendor/marketplace/en/sales/sales-account-strategist.md +227 -0
- package/dist/vendor/marketplace/en/sales/sales-coach.md +271 -0
- package/dist/vendor/marketplace/en/sales/sales-deal-strategist.md +180 -0
- package/dist/vendor/marketplace/en/sales/sales-discovery-coach.md +225 -0
- package/dist/vendor/marketplace/en/sales/sales-engineer.md +182 -0
- package/dist/vendor/marketplace/en/sales/sales-outbound-strategist.md +201 -0
- package/dist/vendor/marketplace/en/sales/sales-pipeline-analyst.md +267 -0
- package/dist/vendor/marketplace/en/sales/sales-proposal-strategist.md +217 -0
- package/dist/vendor/marketplace/en/spatial-computing/macos-spatial-metal-engineer.md +337 -0
- package/dist/vendor/marketplace/en/spatial-computing/terminal-integration-specialist.md +70 -0
- package/dist/vendor/marketplace/en/spatial-computing/visionos-spatial-engineer.md +54 -0
- package/dist/vendor/marketplace/en/spatial-computing/xr-cockpit-interaction-specialist.md +32 -0
- package/dist/vendor/marketplace/en/spatial-computing/xr-immersive-developer.md +32 -0
- package/dist/vendor/marketplace/en/spatial-computing/xr-interface-architect.md +32 -0
- package/dist/vendor/marketplace/en/specialized/accounts-payable-agent.md +185 -0
- package/dist/vendor/marketplace/en/specialized/agentic-identity-trust.md +387 -0
- package/dist/vendor/marketplace/en/specialized/agents-orchestrator.md +367 -0
- package/dist/vendor/marketplace/en/specialized/automation-governance-architect.md +216 -0
- package/dist/vendor/marketplace/en/specialized/blockchain-security-auditor.md +463 -0
- package/dist/vendor/marketplace/en/specialized/compliance-auditor.md +158 -0
- package/dist/vendor/marketplace/en/specialized/corporate-training-designer.md +192 -0
- package/dist/vendor/marketplace/en/specialized/customer-service.md +398 -0
- package/dist/vendor/marketplace/en/specialized/data-consolidation-agent.md +60 -0
- package/dist/vendor/marketplace/en/specialized/government-digital-presales-consultant.md +363 -0
- package/dist/vendor/marketplace/en/specialized/healthcare-customer-service.md +389 -0
- package/dist/vendor/marketplace/en/specialized/healthcare-marketing-compliance.md +395 -0
- package/dist/vendor/marketplace/en/specialized/hospitality-guest-services.md +603 -0
- package/dist/vendor/marketplace/en/specialized/hr-onboarding.md +451 -0
- package/dist/vendor/marketplace/en/specialized/identity-graph-operator.md +260 -0
- package/dist/vendor/marketplace/en/specialized/language-translator.md +264 -0
- package/dist/vendor/marketplace/en/specialized/legal-billing-time-tracking.md +569 -0
- package/dist/vendor/marketplace/en/specialized/legal-client-intake.md +492 -0
- package/dist/vendor/marketplace/en/specialized/legal-document-review.md +454 -0
- package/dist/vendor/marketplace/en/specialized/loan-officer-assistant.md +555 -0
- package/dist/vendor/marketplace/en/specialized/lsp-index-engineer.md +314 -0
- package/dist/vendor/marketplace/en/specialized/real-estate-buyer-seller.md +596 -0
- package/dist/vendor/marketplace/en/specialized/recruitment-specialist.md +509 -0
- package/dist/vendor/marketplace/en/specialized/report-distribution-agent.md +65 -0
- package/dist/vendor/marketplace/en/specialized/retail-customer-returns.md +566 -0
- package/dist/vendor/marketplace/en/specialized/sales-data-extraction-agent.md +67 -0
- package/dist/vendor/marketplace/en/specialized/sales-outreach.md +425 -0
- package/dist/vendor/marketplace/en/specialized/specialized-chief-of-staff.md +279 -0
- package/dist/vendor/marketplace/en/specialized/specialized-civil-engineer.md +356 -0
- package/dist/vendor/marketplace/en/specialized/specialized-cultural-intelligence-strategist.md +88 -0
- package/dist/vendor/marketplace/en/specialized/specialized-developer-advocate.md +317 -0
- package/dist/vendor/marketplace/en/specialized/specialized-document-generator.md +55 -0
- package/dist/vendor/marketplace/en/specialized/specialized-french-consulting-market.md +192 -0
- package/dist/vendor/marketplace/en/specialized/specialized-korean-business-navigator.md +216 -0
- package/dist/vendor/marketplace/en/specialized/specialized-mcp-builder.md +248 -0
- package/dist/vendor/marketplace/en/specialized/specialized-model-qa.md +488 -0
- package/dist/vendor/marketplace/en/specialized/specialized-salesforce-architect.md +180 -0
- package/dist/vendor/marketplace/en/specialized/specialized-workflow-architect.md +597 -0
- package/dist/vendor/marketplace/en/specialized/study-abroad-advisor.md +282 -0
- package/dist/vendor/marketplace/en/specialized/supply-chain-strategist.md +582 -0
- package/dist/vendor/marketplace/en/support/support-analytics-reporter.md +365 -0
- package/dist/vendor/marketplace/en/support/support-executive-summary-generator.md +212 -0
- package/dist/vendor/marketplace/en/support/support-finance-tracker.md +442 -0
- package/dist/vendor/marketplace/en/support/support-infrastructure-maintainer.md +618 -0
- package/dist/vendor/marketplace/en/support/support-legal-compliance-checker.md +588 -0
- package/dist/vendor/marketplace/en/support/support-support-responder.md +585 -0
- package/dist/vendor/marketplace/en/testing/testing-accessibility-auditor.md +316 -0
- package/dist/vendor/marketplace/en/testing/testing-api-tester.md +306 -0
- package/dist/vendor/marketplace/en/testing/testing-evidence-collector.md +210 -0
- package/dist/vendor/marketplace/en/testing/testing-performance-benchmarker.md +268 -0
- package/dist/vendor/marketplace/en/testing/testing-reality-checker.md +236 -0
- package/dist/vendor/marketplace/en/testing/testing-test-results-analyzer.md +305 -0
- package/dist/vendor/marketplace/en/testing/testing-tool-evaluator.md +394 -0
- package/dist/vendor/marketplace/en/testing/testing-workflow-optimizer.md +450 -0
- package/dist/vendor/marketplace/zh/LICENSE +22 -0
- package/dist/vendor/marketplace/zh/SOURCES.md +12 -0
- package/dist/vendor/marketplace/zh/academic/academic-anthropologist.md +124 -0
- package/dist/vendor/marketplace/zh/academic/academic-geographer.md +126 -0
- package/dist/vendor/marketplace/zh/academic/academic-historian.md +122 -0
- package/dist/vendor/marketplace/zh/academic/academic-narratologist.md +117 -0
- package/dist/vendor/marketplace/zh/academic/academic-psychologist.md +117 -0
- package/dist/vendor/marketplace/zh/academic/academic-study-planner.md +214 -0
- package/dist/vendor/marketplace/zh/design/design-brand-guardian.md +321 -0
- package/dist/vendor/marketplace/zh/design/design-image-prompt-engineer.md +255 -0
- package/dist/vendor/marketplace/zh/design/design-inclusive-visuals-specialist.md +177 -0
- package/dist/vendor/marketplace/zh/design/design-ui-designer.md +382 -0
- package/dist/vendor/marketplace/zh/design/design-ux-architect.md +482 -0
- package/dist/vendor/marketplace/zh/design/design-ux-researcher.md +328 -0
- package/dist/vendor/marketplace/zh/design/design-visual-storyteller.md +159 -0
- package/dist/vendor/marketplace/zh/design/design-whimsy-injector.md +453 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-ai-data-remediation-engineer.md +209 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-ai-engineer.md +161 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-autonomous-optimization-architect.md +115 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-backend-architect.md +234 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-cms-developer.md +534 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-code-reviewer.md +172 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-codebase-onboarding-engineer.md +172 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-data-engineer.md +324 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-database-optimizer.md +175 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-devops-automator.md +375 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-dingtalk-integration-developer.md +574 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-email-intelligence-engineer.md +349 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-embedded-firmware-engineer.md +168 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-embedded-linux-driver-engineer.md +255 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-feishu-integration-developer.md +597 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-filament-optimization-specialist.md +283 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-fpga-digital-design-engineer.md +227 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-frontend-developer.md +224 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-git-workflow-master.md +220 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-incident-response-commander.md +465 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-iot-solution-architect.md +220 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-mechanical-design-engineer.md +311 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-minimal-change-engineer.md +206 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-mobile-app-builder.md +434 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-pc-host-engineer.md +231 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-rapid-prototyper.md +461 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-security-engineer.md +303 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-senior-developer.md +177 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-software-architect.md +200 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-solidity-smart-contract-engineer.md +541 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-sre.md +233 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-technical-writer.md +409 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-threat-detection-engineer.md +553 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-voice-ai-integration-engineer.md +560 -0
- package/dist/vendor/marketplace/zh/engineering/engineering-wechat-mini-program-developer.md +288 -0
- package/dist/vendor/marketplace/zh/finance/finance-bookkeeper-controller.md +271 -0
- package/dist/vendor/marketplace/zh/finance/finance-financial-analyst.md +244 -0
- package/dist/vendor/marketplace/zh/finance/finance-financial-forecaster.md +213 -0
- package/dist/vendor/marketplace/zh/finance/finance-fpa-analyst.md +272 -0
- package/dist/vendor/marketplace/zh/finance/finance-fraud-detector.md +241 -0
- package/dist/vendor/marketplace/zh/finance/finance-investment-researcher.md +283 -0
- package/dist/vendor/marketplace/zh/finance/finance-invoice-manager.md +242 -0
- package/dist/vendor/marketplace/zh/finance/finance-tax-strategist.md +250 -0
- package/dist/vendor/marketplace/zh/game-development/blender/blender-addon-engineer.md +233 -0
- package/dist/vendor/marketplace/zh/game-development/game-audio-engineer.md +265 -0
- package/dist/vendor/marketplace/zh/game-development/game-designer.md +168 -0
- package/dist/vendor/marketplace/zh/game-development/godot/godot-gameplay-scripter.md +335 -0
- package/dist/vendor/marketplace/zh/game-development/godot/godot-multiplayer-engineer.md +296 -0
- package/dist/vendor/marketplace/zh/game-development/godot/godot-shader-developer.md +267 -0
- package/dist/vendor/marketplace/zh/game-development/level-designer.md +209 -0
- package/dist/vendor/marketplace/zh/game-development/narrative-designer.md +244 -0
- package/dist/vendor/marketplace/zh/game-development/roblox-studio/roblox-avatar-creator.md +298 -0
- package/dist/vendor/marketplace/zh/game-development/roblox-studio/roblox-experience-designer.md +306 -0
- package/dist/vendor/marketplace/zh/game-development/roblox-studio/roblox-systems-scripter.md +325 -0
- package/dist/vendor/marketplace/zh/game-development/technical-artist.md +230 -0
- package/dist/vendor/marketplace/zh/game-development/unity/unity-architect.md +272 -0
- package/dist/vendor/marketplace/zh/game-development/unity/unity-editor-tool-developer.md +300 -0
- package/dist/vendor/marketplace/zh/game-development/unity/unity-multiplayer-engineer.md +238 -0
- package/dist/vendor/marketplace/zh/game-development/unity/unity-shader-graph-artist.md +270 -0
- package/dist/vendor/marketplace/zh/game-development/unreal-engine/unreal-multiplayer-architect.md +314 -0
- package/dist/vendor/marketplace/zh/game-development/unreal-engine/unreal-systems-engineer.md +311 -0
- package/dist/vendor/marketplace/zh/game-development/unreal-engine/unreal-technical-artist.md +256 -0
- package/dist/vendor/marketplace/zh/game-development/unreal-engine/unreal-world-builder.md +274 -0
- package/dist/vendor/marketplace/zh/hr/hr-performance-reviewer.md +248 -0
- package/dist/vendor/marketplace/zh/hr/hr-recruiter.md +232 -0
- package/dist/vendor/marketplace/zh/legal/legal-contract-reviewer.md +240 -0
- package/dist/vendor/marketplace/zh/legal/legal-policy-writer.md +308 -0
- package/dist/vendor/marketplace/zh/manifest.json +2181 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-agentic-search-optimizer.md +312 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-ai-citation-strategist.md +169 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-app-store-optimizer.md +319 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-baidu-seo-specialist.md +220 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-bilibili-strategist.md +194 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-book-co-author.md +109 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-carousel-growth-engine.md +215 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-china-ecommerce-operator.md +277 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-china-market-localization-strategist.md +282 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-content-creator.md +145 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-cross-border-ecommerce.md +260 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-daily-news-briefing.md +303 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-douyin-strategist.md +150 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-ecommerce-operator.md +216 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-growth-hacker.md +121 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-instagram-curator.md +179 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-knowledge-commerce-strategist.md +384 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-kuaishou-strategist.md +182 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-linkedin-content-creator.md +232 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-livestream-commerce-coach.md +303 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-podcast-strategist.md +278 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-private-domain-operator.md +309 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-reddit-community-builder.md +127 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-seo-specialist.md +298 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-short-video-editing-coach.md +413 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-social-media-strategist.md +118 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-tiktok-strategist.md +124 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-twitter-engager.md +132 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-video-optimization-specialist.md +128 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-wechat-official-account.md +158 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-wechat-operator.md +156 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-weibo-strategist.md +241 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-weixin-channels-strategist.md +297 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-xiaohongshu-operator.md +139 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-xiaohongshu-specialist.md +151 -0
- package/dist/vendor/marketplace/zh/marketing/marketing-zhihu-strategist.md +175 -0
- package/dist/vendor/marketplace/zh/paid-media/paid-media-auditor.md +170 -0
- package/dist/vendor/marketplace/zh/paid-media/paid-media-creative-strategist.md +173 -0
- package/dist/vendor/marketplace/zh/paid-media/paid-media-paid-social-strategist.md +180 -0
- package/dist/vendor/marketplace/zh/paid-media/paid-media-ppc-strategist.md +180 -0
- package/dist/vendor/marketplace/zh/paid-media/paid-media-programmatic-buyer.md +177 -0
- package/dist/vendor/marketplace/zh/paid-media/paid-media-search-query-analyst.md +182 -0
- package/dist/vendor/marketplace/zh/paid-media/paid-media-tracking-specialist.md +199 -0
- package/dist/vendor/marketplace/zh/product/product-behavioral-nudge-engine.md +246 -0
- package/dist/vendor/marketplace/zh/product/product-feedback-synthesizer.md +175 -0
- package/dist/vendor/marketplace/zh/product/product-manager.md +474 -0
- package/dist/vendor/marketplace/zh/product/product-sprint-prioritizer.md +133 -0
- package/dist/vendor/marketplace/zh/product/product-trend-researcher.md +143 -0
- package/dist/vendor/marketplace/zh/project-management/project-management-experiment-tracker.md +206 -0
- package/dist/vendor/marketplace/zh/project-management/project-management-jira-workflow-steward.md +249 -0
- package/dist/vendor/marketplace/zh/project-management/project-management-project-shepherd.md +202 -0
- package/dist/vendor/marketplace/zh/project-management/project-management-studio-operations.md +208 -0
- package/dist/vendor/marketplace/zh/project-management/project-management-studio-producer.md +211 -0
- package/dist/vendor/marketplace/zh/project-management/project-manager-senior.md +135 -0
- package/dist/vendor/marketplace/zh/sales/sales-account-strategist.md +243 -0
- package/dist/vendor/marketplace/zh/sales/sales-coach.md +291 -0
- package/dist/vendor/marketplace/zh/sales/sales-deal-strategist.md +204 -0
- package/dist/vendor/marketplace/zh/sales/sales-discovery-coach.md +230 -0
- package/dist/vendor/marketplace/zh/sales/sales-engineer.md +200 -0
- package/dist/vendor/marketplace/zh/sales/sales-outbound-strategist.md +208 -0
- package/dist/vendor/marketplace/zh/sales/sales-pipeline-analyst.md +284 -0
- package/dist/vendor/marketplace/zh/sales/sales-proposal-strategist.md +233 -0
- package/dist/vendor/marketplace/zh/spatial-computing/macos-spatial-metal-engineer.md +337 -0
- package/dist/vendor/marketplace/zh/spatial-computing/terminal-integration-specialist.md +236 -0
- package/dist/vendor/marketplace/zh/spatial-computing/visionos-spatial-engineer.md +282 -0
- package/dist/vendor/marketplace/zh/spatial-computing/xr-cockpit-interaction-specialist.md +220 -0
- package/dist/vendor/marketplace/zh/spatial-computing/xr-immersive-developer.md +229 -0
- package/dist/vendor/marketplace/zh/spatial-computing/xr-interface-architect.md +253 -0
- package/dist/vendor/marketplace/zh/specialized/accounts-payable-agent.md +212 -0
- package/dist/vendor/marketplace/zh/specialized/agentic-identity-trust.md +388 -0
- package/dist/vendor/marketplace/zh/specialized/agents-orchestrator.md +366 -0
- package/dist/vendor/marketplace/zh/specialized/automation-governance-architect.md +215 -0
- package/dist/vendor/marketplace/zh/specialized/blockchain-security-auditor.md +484 -0
- package/dist/vendor/marketplace/zh/specialized/compliance-auditor.md +172 -0
- package/dist/vendor/marketplace/zh/specialized/corporate-training-designer.md +191 -0
- package/dist/vendor/marketplace/zh/specialized/data-consolidation-agent.md +327 -0
- package/dist/vendor/marketplace/zh/specialized/gaokao-college-advisor.md +333 -0
- package/dist/vendor/marketplace/zh/specialized/government-digital-presales-consultant.md +362 -0
- package/dist/vendor/marketplace/zh/specialized/healthcare-customer-service.md +388 -0
- package/dist/vendor/marketplace/zh/specialized/healthcare-marketing-compliance.md +394 -0
- package/dist/vendor/marketplace/zh/specialized/hospitality-guest-services.md +597 -0
- package/dist/vendor/marketplace/zh/specialized/hr-onboarding.md +450 -0
- package/dist/vendor/marketplace/zh/specialized/identity-graph-operator.md +270 -0
- package/dist/vendor/marketplace/zh/specialized/language-translator.md +275 -0
- package/dist/vendor/marketplace/zh/specialized/legal-billing-time-tracking.md +566 -0
- package/dist/vendor/marketplace/zh/specialized/legal-client-intake.md +487 -0
- package/dist/vendor/marketplace/zh/specialized/legal-document-review.md +452 -0
- package/dist/vendor/marketplace/zh/specialized/livestock-archive-auditor.md +135 -0
- package/dist/vendor/marketplace/zh/specialized/loan-officer-assistant.md +549 -0
- package/dist/vendor/marketplace/zh/specialized/lsp-index-engineer.md +334 -0
- package/dist/vendor/marketplace/zh/specialized/prompt-engineer.md +176 -0
- package/dist/vendor/marketplace/zh/specialized/real-estate-buyer-seller.md +594 -0
- package/dist/vendor/marketplace/zh/specialized/recruitment-specialist.md +508 -0
- package/dist/vendor/marketplace/zh/specialized/report-distribution-agent.md +354 -0
- package/dist/vendor/marketplace/zh/specialized/retail-customer-returns.md +564 -0
- package/dist/vendor/marketplace/zh/specialized/sales-data-extraction-agent.md +159 -0
- package/dist/vendor/marketplace/zh/specialized/specialized-ai-policy-writer.md +217 -0
- package/dist/vendor/marketplace/zh/specialized/specialized-chief-of-staff.md +278 -0
- package/dist/vendor/marketplace/zh/specialized/specialized-civil-engineer.md +355 -0
- package/dist/vendor/marketplace/zh/specialized/specialized-cultural-intelligence-strategist.md +168 -0
- package/dist/vendor/marketplace/zh/specialized/specialized-developer-advocate.md +334 -0
- package/dist/vendor/marketplace/zh/specialized/specialized-document-generator.md +346 -0
- package/dist/vendor/marketplace/zh/specialized/specialized-french-consulting-market.md +191 -0
- package/dist/vendor/marketplace/zh/specialized/specialized-korean-business-navigator.md +215 -0
- package/dist/vendor/marketplace/zh/specialized/specialized-mcp-builder.md +351 -0
- package/dist/vendor/marketplace/zh/specialized/specialized-meeting-assistant.md +236 -0
- package/dist/vendor/marketplace/zh/specialized/specialized-model-qa.md +507 -0
- package/dist/vendor/marketplace/zh/specialized/specialized-pricing-optimizer.md +254 -0
- package/dist/vendor/marketplace/zh/specialized/specialized-risk-assessor.md +240 -0
- package/dist/vendor/marketplace/zh/specialized/specialized-salesforce-architect.md +179 -0
- package/dist/vendor/marketplace/zh/specialized/specialized-workflow-architect.md +596 -0
- package/dist/vendor/marketplace/zh/specialized/study-abroad-advisor.md +281 -0
- package/dist/vendor/marketplace/zh/specialized/technical-translator-agent.md +167 -0
- package/dist/vendor/marketplace/zh/specialized/zk-steward.md +228 -0
- package/dist/vendor/marketplace/zh/supply-chain/supply-chain-inventory-forecaster.md +212 -0
- package/dist/vendor/marketplace/zh/supply-chain/supply-chain-route-optimizer.md +224 -0
- package/dist/vendor/marketplace/zh/supply-chain/supply-chain-strategist.md +581 -0
- package/dist/vendor/marketplace/zh/supply-chain/supply-chain-vendor-evaluator.md +232 -0
- package/dist/vendor/marketplace/zh/support/support-analytics-reporter.md +364 -0
- package/dist/vendor/marketplace/zh/support/support-executive-summary-generator.md +217 -0
- package/dist/vendor/marketplace/zh/support/support-finance-tracker.md +447 -0
- package/dist/vendor/marketplace/zh/support/support-infrastructure-maintainer.md +623 -0
- package/dist/vendor/marketplace/zh/support/support-legal-compliance-checker.md +587 -0
- package/dist/vendor/marketplace/zh/support/support-recruitment-specialist.md +508 -0
- package/dist/vendor/marketplace/zh/support/support-support-responder.md +584 -0
- package/dist/vendor/marketplace/zh/testing/testing-accessibility-auditor.md +329 -0
- package/dist/vendor/marketplace/zh/testing/testing-api-tester.md +305 -0
- package/dist/vendor/marketplace/zh/testing/testing-embedded-qa-engineer.md +258 -0
- package/dist/vendor/marketplace/zh/testing/testing-evidence-collector.md +153 -0
- package/dist/vendor/marketplace/zh/testing/testing-performance-benchmarker.md +196 -0
- package/dist/vendor/marketplace/zh/testing/testing-reality-checker.md +235 -0
- package/dist/vendor/marketplace/zh/testing/testing-test-results-analyzer.md +313 -0
- package/dist/vendor/marketplace/zh/testing/testing-tool-evaluator.md +402 -0
- package/dist/vendor/marketplace/zh/testing/testing-workflow-optimizer.md +458 -0
- package/package.json +131 -0
- package/scripts/postinstall-native-artifacts.mjs +113 -0
- package/web/dist/assets/AddWorkerDialog-BU2Fn-Mx.js +2 -0
- package/web/dist/assets/AddWorkspaceFlow-BV04MkRt.js +1 -0
- package/web/dist/assets/FirstRunWizard-DS4IYOrd.js +1 -0
- package/web/dist/assets/MarketplaceDrawer-CIQ2B6Fx.js +76 -0
- package/web/dist/assets/TaskGraphDrawer-BPMcRocd.js +1 -0
- package/web/dist/assets/WhatsNewDialog-DEgVY_LD.js +1 -0
- package/web/dist/assets/WorkerModal-DiCcTPpc.js +1 -0
- package/web/dist/assets/WorkflowsDrawer-M2CgAJWK.js +1 -0
- package/web/dist/assets/WorkspaceMemoryDrawer-ClJIqWck.js +1 -0
- package/web/dist/assets/WorkspaceTaskDrawer-gjvXuZ2K.js +1 -0
- package/web/dist/assets/addon-clipboard-wHJhZAA4.js +1 -0
- package/web/dist/assets/addon-fit-DX4qG4td.js +1 -0
- package/web/dist/assets/addon-unicode11-Bt8F3D7-.js +7 -0
- package/web/dist/assets/addon-web-links-DIbG5aQx.js +1 -0
- package/web/dist/assets/addon-webgl-DCtw1yLn.js +64 -0
- package/web/dist/assets/finder-C4Jmsb0B.png +0 -0
- package/web/dist/assets/ghostty-D-Js4rdm.png +0 -0
- package/web/dist/assets/index-bOMtwrkA.js +73 -0
- package/web/dist/assets/index-i9YgsMdD.css +1 -0
- package/web/dist/assets/path-join-7MR1s7b1.js +1 -0
- package/web/dist/assets/search-CmzeVhy0.js +1 -0
- package/web/dist/assets/xterm-B-qIQCd3.js +16 -0
- package/web/dist/assets/zed-C5BQT8X3.png +0 -0
- package/web/dist/bilibili.ico +0 -0
- package/web/dist/cli-icons/claude.png +0 -0
- package/web/dist/cli-icons/codex.png +0 -0
- package/web/dist/cli-icons/gemini.png +0 -0
- package/web/dist/cli-icons/hermes.png +0 -0
- package/web/dist/cli-icons/opencode.svg +18 -0
- package/web/dist/icons/apple-touch-icon-180.png +0 -0
- package/web/dist/icons/icon-192.png +0 -0
- package/web/dist/icons/icon-32.png +0 -0
- package/web/dist/icons/icon-512-maskable.png +0 -0
- package/web/dist/icons/icon-512.png +0 -0
- package/web/dist/index.html +39 -0
- package/web/dist/logo.png +0 -0
- package/web/dist/manifest.webmanifest +60 -0
- package/web/dist/screenshots/wide-overview.png +0 -0
- package/web/dist/sounds/LICENSE-KENNEY.txt +22 -0
- package/web/dist/sounds/hive-beacon.ogg +0 -0
- package/web/dist/sounds/hive-cascade.ogg +0 -0
- package/web/dist/sounds/hive-chime.ogg +0 -0
- package/web/dist/sounds/hive-ping.ogg +0 -0
- package/web/dist/sounds/hive-resolve.ogg +0 -0
- package/web/dist/sounds/hive-soft.ogg +0 -0
- package/web/dist/sw.js +99 -0
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { cpus } from 'node:os';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { assertWindowsSafeFilename } from './windows-filename.js';
|
|
5
|
+
import { resolveWorkflowCli } from './workflow-cli-policy.js';
|
|
6
|
+
import { buildSchemaInstruction, extractJsonBlock } from './workflow-output-schema.js';
|
|
7
|
+
import { loadWorkflowScriptFile, loadWorkflowScriptSource } from './workflow-script-loader.js';
|
|
8
|
+
import { getWorkflowAgentId } from './workspace-store-support.js';
|
|
9
|
+
// TIER 2 #2 + #11 — runtime caps. Match Claude Code's documented caps
|
|
10
|
+
// (1000 lifetime calls, min(16, cores-2) concurrent) so scripts copied
|
|
11
|
+
// from CC docs behave the same way. The duration default is Hive's own
|
|
12
|
+
// choice; CC docs don't specify one but workflows that run >60min are
|
|
13
|
+
// almost always a runaway loop in practice.
|
|
14
|
+
const DEFAULT_MAX_AGENTS_PER_RUN = 1000;
|
|
15
|
+
const DEFAULT_MAX_DURATION_MS = 60 * 60 * 1000;
|
|
16
|
+
const DEFAULT_MAX_CONCURRENT_AGENTS = Math.min(16, Math.max(2, cpus().length - 2));
|
|
17
|
+
const BUILT_IN_WORKER_ROLES = new Set(['coder', 'reviewer', 'tester', 'custom']);
|
|
18
|
+
const isBuiltInWorkerRole = (value) => BUILT_IN_WORKER_ROLES.has(value);
|
|
19
|
+
const buildModelArgs = (_cli, model) => {
|
|
20
|
+
if (!model?.trim())
|
|
21
|
+
return [];
|
|
22
|
+
/* All supported CLIs (claude / codex / opencode / gemini / hermes) accept
|
|
23
|
+
`--model <id>` as a positional flag. Keeping the mapping centralised
|
|
24
|
+
here so future CLI quirks (e.g. opencode wanting `-m` instead) can
|
|
25
|
+
be patched without touching the runner body. */
|
|
26
|
+
return ['--model', model];
|
|
27
|
+
};
|
|
28
|
+
const toNestedWorkflowFilename = (scriptName) => {
|
|
29
|
+
const trimmed = scriptName.trim();
|
|
30
|
+
if (!trimmed)
|
|
31
|
+
throw new Error('workflow(scriptName): scriptName must be a non-empty string');
|
|
32
|
+
const filename = trimmed.toLowerCase().endsWith('.ts') ? trimmed : `${trimmed}.ts`;
|
|
33
|
+
assertWindowsSafeFilename(filename);
|
|
34
|
+
return filename;
|
|
35
|
+
};
|
|
36
|
+
export const createWorkflowRunner = (deps) => {
|
|
37
|
+
const { store, workflowRunStore, awaiter, dispatchPort, resolveWorkspacePath, roleTemplateResolver, logStore, getWorkflowCliPolicy, } = deps;
|
|
38
|
+
const stoppedRuns = new Set();
|
|
39
|
+
// In-memory map: runId → triggering agent. Lost on restart; the spec already
|
|
40
|
+
// doesn't auto-resume interrupted runs, so this is consistent.
|
|
41
|
+
const triggeringAgentByRun = new Map();
|
|
42
|
+
const executeWorkflow = async (run, loaded, args, hivePort) => {
|
|
43
|
+
const workspaceId = run.workspaceId;
|
|
44
|
+
const workflowAgentId = getWorkflowAgentId(workspaceId);
|
|
45
|
+
let stepCounter = 0;
|
|
46
|
+
const spawnedWorkers = [];
|
|
47
|
+
// Read the CLI policy once per run so a 1000-way fan-out doesn't hit the
|
|
48
|
+
// app_state table per agent() call.
|
|
49
|
+
const cliPolicy = getWorkflowCliPolicy();
|
|
50
|
+
// TIER 2 #2 + #11 — runtime caps. Per-run agent ceiling, per-call
|
|
51
|
+
// concurrency throttle, and a hard wall-clock budget. meta can
|
|
52
|
+
// override the defaults per script. The budget timer arms here and
|
|
53
|
+
// gets cleared in the finally branch so a fast-completing run
|
|
54
|
+
// doesn't leave a dangling timer in the event loop.
|
|
55
|
+
const maxAgents = typeof loaded.meta.maxAgentCalls === 'number' && loaded.meta.maxAgentCalls > 0
|
|
56
|
+
? loaded.meta.maxAgentCalls
|
|
57
|
+
: DEFAULT_MAX_AGENTS_PER_RUN;
|
|
58
|
+
const maxDurationMs = typeof loaded.meta.maxDurationMs === 'number' && loaded.meta.maxDurationMs > 0
|
|
59
|
+
? loaded.meta.maxDurationMs
|
|
60
|
+
: DEFAULT_MAX_DURATION_MS;
|
|
61
|
+
// Simple semaphore — a FIFO queue of resolvers. Each acquire() returns
|
|
62
|
+
// a release() callback that pumps the next waiter. Default
|
|
63
|
+
// concurrency is min(16, cores-2), matching CC's documented cap;
|
|
64
|
+
// intentionally shared across all parallel/pipeline calls in this
|
|
65
|
+
// run so nested fan-outs don't blow through the cap.
|
|
66
|
+
const concurrencyLimit = DEFAULT_MAX_CONCURRENT_AGENTS;
|
|
67
|
+
let inFlight = 0;
|
|
68
|
+
const waitQueue = [];
|
|
69
|
+
const acquireSlot = async () => {
|
|
70
|
+
if (inFlight < concurrencyLimit) {
|
|
71
|
+
inFlight++;
|
|
72
|
+
return () => {
|
|
73
|
+
inFlight--;
|
|
74
|
+
waitQueue.shift()?.();
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
await new Promise((resolve) => waitQueue.push(resolve));
|
|
78
|
+
inFlight++;
|
|
79
|
+
return () => {
|
|
80
|
+
inFlight--;
|
|
81
|
+
waitQueue.shift()?.();
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
// R1/R2 auto-rounding: a phase('Find') called twice in the same run gets
|
|
85
|
+
// rendered as "Find" then "Find R2" etc. Mirrors Claude Code's /workflows
|
|
86
|
+
// view — keeps the UI readable when a workflow loops phases.
|
|
87
|
+
const phaseEntryCount = new Map();
|
|
88
|
+
let currentPhaseTitle = null;
|
|
89
|
+
const phase = (title) => {
|
|
90
|
+
const trimmed = (title ?? '').toString().trim() || 'default';
|
|
91
|
+
const next = (phaseEntryCount.get(trimmed) ?? 0) + 1;
|
|
92
|
+
phaseEntryCount.set(trimmed, next);
|
|
93
|
+
currentPhaseTitle = next > 1 ? `${trimmed} R${next}` : trimmed;
|
|
94
|
+
workflowRunStore.updateRun(run.id, { phase: currentPhaseTitle });
|
|
95
|
+
};
|
|
96
|
+
const agent = async (prompt, opts = {}) => {
|
|
97
|
+
// TIER 2 #11 — hard ceiling so a runaway `while (true) await agent()`
|
|
98
|
+
// can't spawn unbounded PTY subprocesses. The check is BEFORE the
|
|
99
|
+
// step counter increments so the error message names the cap, not
|
|
100
|
+
// the over-cap step.
|
|
101
|
+
if (stepCounter >= maxAgents) {
|
|
102
|
+
throw new Error(`Workflow agent cap exceeded: ${maxAgents} calls (set meta.maxAgentCalls to raise)`);
|
|
103
|
+
}
|
|
104
|
+
const myStep = ++stepCounter;
|
|
105
|
+
// TIER 2 #4 — resolve agentType. If it's a built-in WorkerRole
|
|
106
|
+
// (coder/reviewer/tester/custom) we honour it directly with the
|
|
107
|
+
// CLI default. Otherwise look up a workspace custom role template
|
|
108
|
+
// by name: on hit we clone its command + args; on miss we throw a
|
|
109
|
+
// clear error (silent fallback to 'coder' would mask typos and
|
|
110
|
+
// make the Hive-distinctive custom-role library invisible).
|
|
111
|
+
const requestedType = opts.agentType ?? 'coder';
|
|
112
|
+
let role;
|
|
113
|
+
let command;
|
|
114
|
+
let templateArgs = [];
|
|
115
|
+
if (typeof requestedType === 'string' && !isBuiltInWorkerRole(requestedType)) {
|
|
116
|
+
const template = roleTemplateResolver.findByName(requestedType);
|
|
117
|
+
if (!template) {
|
|
118
|
+
throw new Error(`Workflow agentType '${requestedType}' is not a built-in role (coder/reviewer/tester/custom) and no matching role template exists in this workspace. ` +
|
|
119
|
+
`Create one via Add Worker → custom role, or use a built-in role.`);
|
|
120
|
+
}
|
|
121
|
+
/* Templates can carry roleType='orchestrator' for the system-level
|
|
122
|
+
Orchestrator template; that's not a valid workflow worker role,
|
|
123
|
+
so we collapse it to 'custom'. Anything else maps through as-is. */
|
|
124
|
+
role = template.roleType === 'orchestrator' ? 'custom' : template.roleType;
|
|
125
|
+
command = resolveWorkflowCli({
|
|
126
|
+
...(opts.cli !== undefined ? { requestedCli: opts.cli } : {}),
|
|
127
|
+
isCustomTemplate: true,
|
|
128
|
+
templateDefaultCommand: template.defaultCommand,
|
|
129
|
+
policy: cliPolicy,
|
|
130
|
+
});
|
|
131
|
+
templateArgs = template.defaultArgs;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
role = requestedType;
|
|
135
|
+
command = resolveWorkflowCli({
|
|
136
|
+
...(opts.cli !== undefined ? { requestedCli: opts.cli } : {}),
|
|
137
|
+
isCustomTemplate: false,
|
|
138
|
+
policy: cliPolicy,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
const name = opts.label ?? `${requestedType}-${myStep}-${randomUUID()}`;
|
|
142
|
+
/* Model flag goes AFTER the template's own args so an explicit
|
|
143
|
+
opts.model overrides any --model the template baked in. */
|
|
144
|
+
const launchArgs = [...templateArgs, ...buildModelArgs(command, opts.model)];
|
|
145
|
+
// TIER 2 #2 — semaphore. Holding the slot across the full
|
|
146
|
+
// dispatch+await means a parallel(100) fan-out gets paced at
|
|
147
|
+
// min(16, cores-2) concurrent PTYs instead of 100 simultaneous
|
|
148
|
+
// process spawns.
|
|
149
|
+
const releaseSlot = await acquireSlot();
|
|
150
|
+
const worker = store.addWorkerWithLaunch(workspaceId, { name, role, ephemeral: true, spawnedBy: 'workflow' }, { command, args: launchArgs });
|
|
151
|
+
spawnedWorkers.push(worker.id);
|
|
152
|
+
try {
|
|
153
|
+
await store.startAgent(workspaceId, worker.id, { hivePort });
|
|
154
|
+
const dispatchPrompt = opts.outputSchema
|
|
155
|
+
? prompt + buildSchemaInstruction(opts.outputSchema)
|
|
156
|
+
: prompt;
|
|
157
|
+
const dispatch = await store.dispatchTaskByWorkerName(workspaceId, name, dispatchPrompt, {
|
|
158
|
+
fromAgentId: workflowAgentId,
|
|
159
|
+
hivePort,
|
|
160
|
+
workflowRunId: run.id,
|
|
161
|
+
stepIndex: myStep,
|
|
162
|
+
...(currentPhaseTitle ? { phase: currentPhaseTitle } : {}),
|
|
163
|
+
label: opts.label ?? name,
|
|
164
|
+
});
|
|
165
|
+
const report = await awaiter.awaitReport(dispatch.id, opts.timeoutMs);
|
|
166
|
+
// Structured output: hand back the parsed object, or { text } on a
|
|
167
|
+
// parse miss so the script can still branch (treating an absent field
|
|
168
|
+
// as the safe default).
|
|
169
|
+
if (opts.outputSchema) {
|
|
170
|
+
return extractJsonBlock(report.text) ?? { text: report.text };
|
|
171
|
+
}
|
|
172
|
+
return report.text;
|
|
173
|
+
}
|
|
174
|
+
finally {
|
|
175
|
+
try {
|
|
176
|
+
store.deleteWorker(workspaceId, worker.id);
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
/* idempotent — worker may already be gone via cascade or boot cleanup */
|
|
180
|
+
}
|
|
181
|
+
const idx = spawnedWorkers.indexOf(worker.id);
|
|
182
|
+
if (idx !== -1)
|
|
183
|
+
spawnedWorkers.splice(idx, 1);
|
|
184
|
+
releaseSlot();
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
// TIER 1 #3 — per-item rejections become null (preserves the
|
|
188
|
+
// documented contract: callers use `.filter(Boolean)` patterns), BUT
|
|
189
|
+
// if the run is being stopped we re-throw so the outer catch handles
|
|
190
|
+
// it as `status='stopped'` instead of silently completing with a
|
|
191
|
+
// result array full of nulls. Per-item failures still get logged so
|
|
192
|
+
// they're not entirely invisible (TIER 2 #3 will pipe these into the
|
|
193
|
+
// run timeline via log()).
|
|
194
|
+
const catchPerItem = (value) => {
|
|
195
|
+
if (stoppedRuns.has(run.id))
|
|
196
|
+
throw value;
|
|
197
|
+
console.warn(`[workflow ${loaded.meta.name}] item failed:`, value);
|
|
198
|
+
return null;
|
|
199
|
+
};
|
|
200
|
+
const parallel = async (thunks) => {
|
|
201
|
+
return Promise.all(thunks.map((thunk) => thunk().catch((err) => catchPerItem(err))));
|
|
202
|
+
};
|
|
203
|
+
const pipeline = async (items, ...stages) => {
|
|
204
|
+
return Promise.all(items.map((item, index) => {
|
|
205
|
+
let chain = Promise.resolve(item);
|
|
206
|
+
for (const stage of stages) {
|
|
207
|
+
chain = chain.then((prev) => stage(prev, item, index));
|
|
208
|
+
}
|
|
209
|
+
return chain.catch((err) => catchPerItem(err));
|
|
210
|
+
}));
|
|
211
|
+
};
|
|
212
|
+
const log = (message) => {
|
|
213
|
+
// TIER 2 #3 — persist + still echo to stdout for server-log
|
|
214
|
+
// visibility. Authors expect `log()` to surface in the Drawer's
|
|
215
|
+
// narrator lane and in the orchestrator's completion reminder.
|
|
216
|
+
// The console.log retains the server-side breadcrumb for ops.
|
|
217
|
+
const text = typeof message === 'string' ? message : String(message);
|
|
218
|
+
try {
|
|
219
|
+
logStore.append(run.id, text);
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
console.error('[hive] swallowed:workflow.log.append', error);
|
|
223
|
+
}
|
|
224
|
+
console.log(`[workflow ${loaded.meta.name}] ${text}`);
|
|
225
|
+
};
|
|
226
|
+
// Nested workflow: look up a sibling script in the same .hive/workflows/
|
|
227
|
+
// directory and run it through THIS runner instance. The child run gets
|
|
228
|
+
// its own row in workflow_runs and shares the dispatch-await machinery
|
|
229
|
+
// (so its `agent()` calls work the same way the parent's do).
|
|
230
|
+
//
|
|
231
|
+
// TIER 1 #7 — when the parent was fired inline (`team workflow run
|
|
232
|
+
// --stdin`), its scriptPath is the synthetic token `<inline>` /
|
|
233
|
+
// `<inline:name>`. `dirname('<inline>')` collapses to `.` and the
|
|
234
|
+
// child would resolve against the runtime's CWD — wrong directory,
|
|
235
|
+
// reliably broken. Detect the synthetic prefix and fall back to the
|
|
236
|
+
// workspace's `.hive/workflows/` directory, which is the canonical
|
|
237
|
+
// sibling-script location.
|
|
238
|
+
const isSyntheticParentPath = run.scriptPath.startsWith('<inline');
|
|
239
|
+
const workflow = async (scriptName, childArgs) => {
|
|
240
|
+
if (typeof scriptName !== 'string' || !scriptName.trim()) {
|
|
241
|
+
throw new Error('workflow(scriptName): scriptName must be a non-empty string');
|
|
242
|
+
}
|
|
243
|
+
const filename = toNestedWorkflowFilename(scriptName);
|
|
244
|
+
const childPath = isSyntheticParentPath
|
|
245
|
+
? join(resolveWorkspacePath(workspaceId), '.hive', 'workflows', filename)
|
|
246
|
+
: join(dirname(run.scriptPath), filename);
|
|
247
|
+
return runWorkflow({
|
|
248
|
+
workspaceId,
|
|
249
|
+
scriptPath: childPath,
|
|
250
|
+
hivePort,
|
|
251
|
+
// TIER 2 #5 — stamp the parent run id so the UI can render the
|
|
252
|
+
// nested workflow tree.
|
|
253
|
+
parentRunId: run.id,
|
|
254
|
+
...(childArgs !== undefined ? { args: childArgs } : {}),
|
|
255
|
+
});
|
|
256
|
+
};
|
|
257
|
+
// TIER 2 #11 — wall-clock budget timer. Triggers stopRun on
|
|
258
|
+
// expiry, which routes through the same path as a user-initiated
|
|
259
|
+
// stop (in-flight awaiters reject; outer catch records 'stopped').
|
|
260
|
+
// The setTimeout is unref'd so a forgotten timer can't keep the
|
|
261
|
+
// Node process alive after shutdown. stopRun is declared further
|
|
262
|
+
// down the file but exists by the time this timer fires, so the
|
|
263
|
+
// closure reference is safe.
|
|
264
|
+
const budgetTimer = setTimeout(() => {
|
|
265
|
+
log(`[hive] maxDurationMs (${maxDurationMs}ms) exceeded — stopping run`);
|
|
266
|
+
stopRun(run.id);
|
|
267
|
+
}, maxDurationMs);
|
|
268
|
+
budgetTimer.unref?.();
|
|
269
|
+
try {
|
|
270
|
+
const factory = new Function(`${loaded.compiledFunctionSource}; return __wf`);
|
|
271
|
+
const fn = factory();
|
|
272
|
+
const returnValue = await fn(agent, parallel, pipeline, phase, log, workflow, args);
|
|
273
|
+
// TIER 1 #2 — if stop was called DURING the run, parallel/pipeline may
|
|
274
|
+
// have caught the cancel rejections (one per in-flight thunk) before
|
|
275
|
+
// the per-item catch could re-throw, e.g. when the user stops AFTER
|
|
276
|
+
// the inner Promise.all has already started but BEFORE any thunk
|
|
277
|
+
// rejects. In that race we'd otherwise write 'completed' with a
|
|
278
|
+
// degraded result (often a list of nulls), which both lies to the UI
|
|
279
|
+
// and lies to the orchestrator's completion notification. Check the
|
|
280
|
+
// marker after fn returns and record the truth instead.
|
|
281
|
+
if (stoppedRuns.has(run.id)) {
|
|
282
|
+
stoppedRuns.delete(run.id);
|
|
283
|
+
workflowRunStore.updateRun(run.id, {
|
|
284
|
+
status: 'stopped',
|
|
285
|
+
finishedAt: Date.now(),
|
|
286
|
+
error: 'Stopped by user',
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
stoppedRuns.delete(run.id);
|
|
291
|
+
// M10: capture the script's return value so the UI can render a single
|
|
292
|
+
// canonical "Result" panel and the orchestrator notification can quote
|
|
293
|
+
// it. `undefined` (no explicit return) stays null on the row.
|
|
294
|
+
workflowRunStore.updateRun(run.id, {
|
|
295
|
+
status: 'completed',
|
|
296
|
+
finishedAt: Date.now(),
|
|
297
|
+
...(returnValue !== undefined ? { result: returnValue } : {}),
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
catch (error) {
|
|
302
|
+
const wasStopped = stoppedRuns.has(run.id);
|
|
303
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
304
|
+
workflowRunStore.updateRun(run.id, {
|
|
305
|
+
status: wasStopped ? 'stopped' : 'failed',
|
|
306
|
+
finishedAt: Date.now(),
|
|
307
|
+
error: wasStopped ? 'Stopped by user' : message,
|
|
308
|
+
});
|
|
309
|
+
stoppedRuns.delete(run.id);
|
|
310
|
+
}
|
|
311
|
+
finally {
|
|
312
|
+
clearTimeout(budgetTimer);
|
|
313
|
+
// Belt-and-suspenders: dismiss any ephemeral worker still alive. The
|
|
314
|
+
// per-call try/finally should already have cleaned each one up; this is
|
|
315
|
+
// an idempotent safety net for unexpected paths.
|
|
316
|
+
for (const workerId of spawnedWorkers.splice(0)) {
|
|
317
|
+
try {
|
|
318
|
+
store.deleteWorker(workspaceId, workerId);
|
|
319
|
+
}
|
|
320
|
+
catch {
|
|
321
|
+
/* swallow */
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
// Notify the triggering agent (orchestrator) that the run reached a
|
|
325
|
+
// terminal state. Mirrors Claude Code's <task-notification> envelope.
|
|
326
|
+
const triggeredByAgentId = triggeringAgentByRun.get(run.id);
|
|
327
|
+
triggeringAgentByRun.delete(run.id);
|
|
328
|
+
if (triggeredByAgentId && deps.onRunFinished) {
|
|
329
|
+
const finalRecord = workflowRunStore.getRun(run.id);
|
|
330
|
+
if (finalRecord) {
|
|
331
|
+
try {
|
|
332
|
+
deps.onRunFinished({ runId: run.id, triggeredByAgentId, finalRecord });
|
|
333
|
+
}
|
|
334
|
+
catch (error) {
|
|
335
|
+
console.error('[hive] swallowed:workflow.onRunFinished', error);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
const buildCreateInput = (input, loaded) => {
|
|
342
|
+
const createInput = {
|
|
343
|
+
workspaceId: input.workspaceId,
|
|
344
|
+
scriptPath: input.scriptPath,
|
|
345
|
+
name: loaded.meta.name,
|
|
346
|
+
scriptHash: loaded.scriptHash,
|
|
347
|
+
};
|
|
348
|
+
if (input.args !== undefined)
|
|
349
|
+
createInput.args = input.args;
|
|
350
|
+
if (input.parentRunId !== undefined)
|
|
351
|
+
createInput.parentRunId = input.parentRunId;
|
|
352
|
+
return createInput;
|
|
353
|
+
};
|
|
354
|
+
const rememberTrigger = (runId, triggeredByAgentId) => {
|
|
355
|
+
if (triggeredByAgentId)
|
|
356
|
+
triggeringAgentByRun.set(runId, triggeredByAgentId);
|
|
357
|
+
};
|
|
358
|
+
const runWorkflow = async (input) => {
|
|
359
|
+
const loaded = await loadWorkflowScriptFile(input.scriptPath);
|
|
360
|
+
const run = workflowRunStore.createRun(buildCreateInput(input, loaded));
|
|
361
|
+
rememberTrigger(run.id, input.triggeredByAgentId);
|
|
362
|
+
await executeWorkflow(run, loaded, input.args, input.hivePort);
|
|
363
|
+
const finalized = workflowRunStore.getRun(run.id);
|
|
364
|
+
if (!finalized)
|
|
365
|
+
throw new Error(`workflow run vanished mid-flight: ${run.id}`);
|
|
366
|
+
return finalized;
|
|
367
|
+
};
|
|
368
|
+
const startWorkflow = async (input) => {
|
|
369
|
+
const loaded = await loadWorkflowScriptFile(input.scriptPath);
|
|
370
|
+
const run = workflowRunStore.createRun(buildCreateInput(input, loaded));
|
|
371
|
+
rememberTrigger(run.id, input.triggeredByAgentId);
|
|
372
|
+
queueMicrotask(() => {
|
|
373
|
+
executeWorkflow(run, loaded, input.args, input.hivePort).catch((error) => {
|
|
374
|
+
console.error('[hive] swallowed:workflow.background', error);
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
return run;
|
|
378
|
+
};
|
|
379
|
+
const startWorkflowInline = async (input) => {
|
|
380
|
+
const scriptPath = input.scriptPath ?? '<inline>';
|
|
381
|
+
const loaded = await loadWorkflowScriptSource(input.source, scriptPath);
|
|
382
|
+
const run = workflowRunStore.createRun(buildCreateInput({ ...input, scriptPath }, loaded));
|
|
383
|
+
rememberTrigger(run.id, input.triggeredByAgentId);
|
|
384
|
+
queueMicrotask(() => {
|
|
385
|
+
executeWorkflow(run, loaded, input.args, input.hivePort).catch((error) => {
|
|
386
|
+
console.error('[hive] swallowed:workflow.background', error);
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
return run;
|
|
390
|
+
};
|
|
391
|
+
const stopRun = (runId) => {
|
|
392
|
+
const current = workflowRunStore.getRun(runId);
|
|
393
|
+
if (!current || current.status !== 'running')
|
|
394
|
+
return false;
|
|
395
|
+
stoppedRuns.add(runId);
|
|
396
|
+
// Cancel every open workflow dispatch tied to this run; this rejects the
|
|
397
|
+
// runner's pending `awaitReport` promises, which propagates up the
|
|
398
|
+
// executeWorkflow try → its catch sets status='stopped'.
|
|
399
|
+
for (const dispatchId of dispatchPort.listOpenDispatchIdsForRun(runId)) {
|
|
400
|
+
awaiter.notifyCancel(dispatchId, 'Stopped by user');
|
|
401
|
+
}
|
|
402
|
+
// If the script had no in-flight agent() call when stop was requested,
|
|
403
|
+
// the workflow may simply continue to its natural end. We still record
|
|
404
|
+
// the intent so a subsequent agent() call rejects immediately. To make
|
|
405
|
+
// single-step or no-agent() scripts also reflect 'stopped', mark the row
|
|
406
|
+
// synchronously as a hint to UI — the runner will overwrite to 'stopped'
|
|
407
|
+
// (or 'completed' if it really did finish) when executeWorkflow exits.
|
|
408
|
+
return true;
|
|
409
|
+
};
|
|
410
|
+
return { runWorkflow, startWorkflow, startWorkflowInline, stopRun };
|
|
411
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { createWorkflowScheduleStore } from './workflow-schedule-store.js';
|
|
2
|
+
type ScheduleStore = ReturnType<typeof createWorkflowScheduleStore>;
|
|
3
|
+
export interface PersistWorkflowScheduleInput {
|
|
4
|
+
workspacePath: string;
|
|
5
|
+
scheduleStore: ScheduleStore;
|
|
6
|
+
workspaceId: string;
|
|
7
|
+
source: string;
|
|
8
|
+
name: string;
|
|
9
|
+
cron: string;
|
|
10
|
+
nextRunAt: number;
|
|
11
|
+
args?: unknown;
|
|
12
|
+
}
|
|
13
|
+
export declare const persistWorkflowSchedule: (input: PersistWorkflowScheduleInput) => Promise<import("./workflow-schedule-store.js").WorkflowScheduleRecord>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { BadRequestError } from './http-errors.js';
|
|
5
|
+
import { getWindowsFilenameError } from './windows-filename.js';
|
|
6
|
+
// Agent-scheduled workflows persist their inline source to a file under
|
|
7
|
+
// <workspace>/.hive/workflows/ so the existing file-based scheduler can load
|
|
8
|
+
// it at fire time — no orchestrator is in the loop when cron fires, so the
|
|
9
|
+
// source must outlive the request. The file is agent-managed and is
|
|
10
|
+
// intentionally NOT surfaced in the UI (workflows are agent-authored, not a
|
|
11
|
+
// human script library).
|
|
12
|
+
const toScriptFilename = (nameRaw) => {
|
|
13
|
+
const slug = nameRaw
|
|
14
|
+
.trim()
|
|
15
|
+
.toLowerCase()
|
|
16
|
+
.replace(/\.ts$/, '')
|
|
17
|
+
.replace(/[^a-z0-9._-]+/g, '-')
|
|
18
|
+
.replace(/^-+|-+$/g, '');
|
|
19
|
+
if (!slug) {
|
|
20
|
+
throw new BadRequestError('schedule name must contain at least one alphanumeric character');
|
|
21
|
+
}
|
|
22
|
+
const windowsNameProbe = `${slug}.ts`;
|
|
23
|
+
const filenameError = getWindowsFilenameError(windowsNameProbe);
|
|
24
|
+
if (filenameError)
|
|
25
|
+
throw new BadRequestError(`Invalid workflow schedule name: ${filenameError}`);
|
|
26
|
+
return `${slug}-${randomUUID()}.ts`;
|
|
27
|
+
};
|
|
28
|
+
export const persistWorkflowSchedule = async (input) => {
|
|
29
|
+
const filename = toScriptFilename(input.name);
|
|
30
|
+
const dir = join(input.workspacePath, '.hive', 'workflows');
|
|
31
|
+
await mkdir(dir, { recursive: true });
|
|
32
|
+
const scriptPath = join(dir, filename);
|
|
33
|
+
await writeFile(scriptPath, input.source, 'utf8');
|
|
34
|
+
return input.scheduleStore.create({
|
|
35
|
+
workspaceId: input.workspaceId,
|
|
36
|
+
scriptPath,
|
|
37
|
+
cron: input.cron,
|
|
38
|
+
nextRunAt: input.nextRunAt,
|
|
39
|
+
...(input.args !== undefined ? { args: input.args } : {}),
|
|
40
|
+
});
|
|
41
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { Database } from 'better-sqlite3';
|
|
2
|
+
export interface WorkflowScheduleRecord {
|
|
3
|
+
id: string;
|
|
4
|
+
workspaceId: string;
|
|
5
|
+
scriptPath: string;
|
|
6
|
+
cron: string;
|
|
7
|
+
args: unknown;
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
lastRunAt: number | null;
|
|
10
|
+
nextRunAt: number;
|
|
11
|
+
createdAt: number;
|
|
12
|
+
updatedAt: number;
|
|
13
|
+
}
|
|
14
|
+
interface CreateInput {
|
|
15
|
+
workspaceId: string;
|
|
16
|
+
scriptPath: string;
|
|
17
|
+
cron: string;
|
|
18
|
+
nextRunAt: number;
|
|
19
|
+
args?: unknown;
|
|
20
|
+
enabled?: boolean;
|
|
21
|
+
}
|
|
22
|
+
interface UpdateInput {
|
|
23
|
+
cron?: string;
|
|
24
|
+
args?: unknown;
|
|
25
|
+
enabled?: boolean;
|
|
26
|
+
lastRunAt?: number;
|
|
27
|
+
nextRunAt?: number;
|
|
28
|
+
}
|
|
29
|
+
export declare const createWorkflowScheduleStore: (db: Database) => {
|
|
30
|
+
create: (input: CreateInput) => WorkflowScheduleRecord;
|
|
31
|
+
update: (id: string, input: UpdateInput) => void;
|
|
32
|
+
get: (id: string) => WorkflowScheduleRecord | undefined;
|
|
33
|
+
listForWorkspace: (workspaceId: string) => WorkflowScheduleRecord[];
|
|
34
|
+
listDueSchedules: (now: number) => WorkflowScheduleRecord[];
|
|
35
|
+
deleteSchedule: (id: string) => void;
|
|
36
|
+
claimDueSchedule: (input: {
|
|
37
|
+
id: string;
|
|
38
|
+
expectedNextRunAt: number;
|
|
39
|
+
newNextRunAt: number;
|
|
40
|
+
lastRunAt: number;
|
|
41
|
+
}) => boolean;
|
|
42
|
+
};
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
const parseArgs = (value) => {
|
|
3
|
+
if (!value)
|
|
4
|
+
return null;
|
|
5
|
+
try {
|
|
6
|
+
return JSON.parse(value);
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const toRecord = (row) => ({
|
|
13
|
+
id: row.id,
|
|
14
|
+
workspaceId: row.workspace_id,
|
|
15
|
+
scriptPath: row.script_path,
|
|
16
|
+
cron: row.cron,
|
|
17
|
+
args: parseArgs(row.args),
|
|
18
|
+
enabled: row.enabled === 1,
|
|
19
|
+
lastRunAt: row.last_run_at,
|
|
20
|
+
nextRunAt: row.next_run_at,
|
|
21
|
+
createdAt: row.created_at,
|
|
22
|
+
updatedAt: row.updated_at,
|
|
23
|
+
});
|
|
24
|
+
export const createWorkflowScheduleStore = (db) => {
|
|
25
|
+
const create = (input) => {
|
|
26
|
+
const now = Date.now();
|
|
27
|
+
const record = {
|
|
28
|
+
id: randomUUID(),
|
|
29
|
+
workspaceId: input.workspaceId,
|
|
30
|
+
scriptPath: input.scriptPath,
|
|
31
|
+
cron: input.cron,
|
|
32
|
+
args: input.args ?? null,
|
|
33
|
+
enabled: input.enabled ?? true,
|
|
34
|
+
lastRunAt: null,
|
|
35
|
+
nextRunAt: input.nextRunAt,
|
|
36
|
+
createdAt: now,
|
|
37
|
+
updatedAt: now,
|
|
38
|
+
};
|
|
39
|
+
db.prepare(`INSERT INTO workflow_schedules (
|
|
40
|
+
id, workspace_id, script_path, cron, args, enabled,
|
|
41
|
+
last_run_at, next_run_at, created_at, updated_at
|
|
42
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(record.id, record.workspaceId, record.scriptPath, record.cron, record.args === null ? null : JSON.stringify(record.args), record.enabled ? 1 : 0, record.lastRunAt, record.nextRunAt, record.createdAt, record.updatedAt);
|
|
43
|
+
return record;
|
|
44
|
+
};
|
|
45
|
+
const update = (id, input) => {
|
|
46
|
+
const sets = [];
|
|
47
|
+
const values = [];
|
|
48
|
+
if (input.cron !== undefined) {
|
|
49
|
+
sets.push('cron = ?');
|
|
50
|
+
values.push(input.cron);
|
|
51
|
+
}
|
|
52
|
+
if (input.args !== undefined) {
|
|
53
|
+
sets.push('args = ?');
|
|
54
|
+
values.push(input.args === null ? null : JSON.stringify(input.args));
|
|
55
|
+
}
|
|
56
|
+
if (input.enabled !== undefined) {
|
|
57
|
+
sets.push('enabled = ?');
|
|
58
|
+
values.push(input.enabled ? 1 : 0);
|
|
59
|
+
}
|
|
60
|
+
if (input.lastRunAt !== undefined) {
|
|
61
|
+
sets.push('last_run_at = ?');
|
|
62
|
+
values.push(input.lastRunAt);
|
|
63
|
+
}
|
|
64
|
+
if (input.nextRunAt !== undefined) {
|
|
65
|
+
sets.push('next_run_at = ?');
|
|
66
|
+
values.push(input.nextRunAt);
|
|
67
|
+
}
|
|
68
|
+
if (sets.length === 0)
|
|
69
|
+
return;
|
|
70
|
+
sets.push('updated_at = ?');
|
|
71
|
+
values.push(Date.now());
|
|
72
|
+
values.push(id);
|
|
73
|
+
db.prepare(`UPDATE workflow_schedules SET ${sets.join(', ')} WHERE id = ?`).run(...values);
|
|
74
|
+
};
|
|
75
|
+
const get = (id) => {
|
|
76
|
+
const row = db.prepare('SELECT * FROM workflow_schedules WHERE id = ?').get(id);
|
|
77
|
+
return row ? toRecord(row) : undefined;
|
|
78
|
+
};
|
|
79
|
+
const listForWorkspace = (workspaceId) => db
|
|
80
|
+
.prepare('SELECT * FROM workflow_schedules WHERE workspace_id = ? ORDER BY created_at DESC, id DESC')
|
|
81
|
+
.all(workspaceId).map(toRecord);
|
|
82
|
+
// Enabled schedules whose next_run_at has arrived — the scheduler queries
|
|
83
|
+
// this every tick and fires each.
|
|
84
|
+
const listDueSchedules = (now) => db
|
|
85
|
+
.prepare('SELECT * FROM workflow_schedules WHERE enabled = 1 AND next_run_at <= ? ORDER BY next_run_at')
|
|
86
|
+
.all(now).map(toRecord);
|
|
87
|
+
const deleteSchedule = (id) => {
|
|
88
|
+
db.prepare('DELETE FROM workflow_schedules WHERE id = ?').run(id);
|
|
89
|
+
};
|
|
90
|
+
// TIER 1 #5 — compare-and-swap claim. If two scheduler ticks see the same
|
|
91
|
+
// due schedule (overlapping setInterval invocations, slow esbuild
|
|
92
|
+
// transpile in startWorkflow, or future multi-process), only the one
|
|
93
|
+
// whose UPDATE matches the still-original next_run_at wins. Returns
|
|
94
|
+
// true if the caller may proceed to fire the workflow.
|
|
95
|
+
const claimDueSchedule = (input) => {
|
|
96
|
+
const result = db
|
|
97
|
+
.prepare(`UPDATE workflow_schedules
|
|
98
|
+
SET next_run_at = ?, last_run_at = ?, updated_at = ?
|
|
99
|
+
WHERE id = ? AND next_run_at = ?`)
|
|
100
|
+
.run(input.newNextRunAt, input.lastRunAt, Date.now(), input.id, input.expectedNextRunAt);
|
|
101
|
+
return result.changes === 1;
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
create,
|
|
105
|
+
update,
|
|
106
|
+
get,
|
|
107
|
+
listForWorkspace,
|
|
108
|
+
listDueSchedules,
|
|
109
|
+
deleteSchedule,
|
|
110
|
+
claimDueSchedule,
|
|
111
|
+
};
|
|
112
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { WorkflowRunRecord } from './workflow-run-store.js';
|
|
2
|
+
import type { RunWorkflowInput } from './workflow-runner.js';
|
|
3
|
+
import type { createWorkflowScheduleStore } from './workflow-schedule-store.js';
|
|
4
|
+
type ScheduleStore = ReturnType<typeof createWorkflowScheduleStore>;
|
|
5
|
+
export interface WorkflowSchedulerDeps {
|
|
6
|
+
schedules: ScheduleStore;
|
|
7
|
+
startWorkflow: (input: RunWorkflowInput) => Promise<WorkflowRunRecord>;
|
|
8
|
+
/** Defensive guard against orphan schedules (TIER 1 #4). The workspace
|
|
9
|
+
* delete cascade clears workflow_schedules in the same transaction so
|
|
10
|
+
* fresh orphans cannot appear; this port catches any pre-existing or
|
|
11
|
+
* externally-introduced orphan and self-heals by deleting the schedule
|
|
12
|
+
* before it can fire and crash startWorkflow → re-fire next tick. */
|
|
13
|
+
workspaceExists?: (workspaceId: string) => boolean;
|
|
14
|
+
/** HivePort to pass into every fired workflow. Resolved lazily so the
|
|
15
|
+
* scheduler doesn't need to be reconstructed when the runtime listens
|
|
16
|
+
* on a different port (e.g. tests using port 0). */
|
|
17
|
+
getHivePort?: () => string;
|
|
18
|
+
/** Test seam: defaults to cron-parser. Returns next fire time in ms-epoch. */
|
|
19
|
+
computeNextRunAt?: (cron: string, after: Date) => number;
|
|
20
|
+
/** Experimental workflow gate. When provided and returns false, ticks fire
|
|
21
|
+
* nothing (scheduled runs are held, not dropped — they fire once re-enabled).
|
|
22
|
+
* Omitted → no gate (the scheduler unit tests rely on this default). */
|
|
23
|
+
isWorkflowEnabled?: () => boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface WorkflowScheduler {
|
|
26
|
+
/** Run one tick using the given `now` (ms-epoch). For both production and tests. */
|
|
27
|
+
tick: (now?: number) => Promise<void>;
|
|
28
|
+
/** Arm a setInterval that calls tick() every `tickIntervalMs`. Returns void. */
|
|
29
|
+
start: (input?: {
|
|
30
|
+
tickIntervalMs?: number;
|
|
31
|
+
}) => void;
|
|
32
|
+
/** Clear the timer. Idempotent. */
|
|
33
|
+
close: () => void;
|
|
34
|
+
}
|
|
35
|
+
export declare const createWorkflowScheduler: (deps: WorkflowSchedulerDeps) => WorkflowScheduler;
|
|
36
|
+
export {};
|