@apralabs/apra-fleet 0.3.6 → 0.4.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/README.md +245 -257
- package/dist/agents/backlog-groomer.md +287 -0
- package/dist/agents/deployer.md +52 -11
- package/dist/agents/doer.md +32 -7
- package/dist/agents/integ-test-runner.md +151 -61
- package/dist/agents/plan-reviewer.md +74 -17
- package/dist/agents/planner.md +94 -14
- package/dist/agents/regression-test-runner.md +216 -0
- package/dist/agents/reviewer.md +21 -6
- package/dist/agents/schemas/backlog-groomer-input.json +35 -0
- package/dist/agents/schemas/backlog-groomer-output.json +164 -0
- package/dist/agents/schemas/integ-test-runner-output.json +34 -0
- package/dist/agents/schemas/regression-test-runner-input.json +15 -0
- package/dist/agents/schemas/regression-test-runner-output.json +50 -0
- package/dist/agents/schemas/reviewer-output.json +4 -0
- package/dist/cli/agent-transform.d.ts +1 -0
- package/dist/cli/agent-transform.d.ts.map +1 -1
- package/dist/cli/agent-transform.js +77 -0
- package/dist/cli/agent-transform.js.map +1 -1
- package/dist/cli/auth.d.ts +3 -0
- package/dist/cli/auth.d.ts.map +1 -1
- package/dist/cli/auth.js +181 -5
- package/dist/cli/auth.js.map +1 -1
- package/dist/cli/config.d.ts +5 -1
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +7 -1
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/dolt-install.d.ts +91 -0
- package/dist/cli/dolt-install.d.ts.map +1 -0
- package/dist/cli/dolt-install.js +334 -0
- package/dist/cli/dolt-install.js.map +1 -0
- package/dist/cli/install-guard.d.ts +29 -0
- package/dist/cli/install-guard.d.ts.map +1 -0
- package/dist/cli/install-guard.js +153 -0
- package/dist/cli/install-guard.js.map +1 -0
- package/dist/cli/install.d.ts +44 -3
- package/dist/cli/install.d.ts.map +1 -1
- package/dist/cli/install.js +604 -108
- package/dist/cli/install.js.map +1 -1
- package/dist/cli/join.d.ts +12 -0
- package/dist/cli/join.d.ts.map +1 -0
- package/dist/cli/join.js +87 -0
- package/dist/cli/join.js.map +1 -0
- package/dist/cli/register-member.d.ts +2 -0
- package/dist/cli/register-member.d.ts.map +1 -0
- package/dist/cli/register-member.js +193 -0
- package/dist/cli/register-member.js.map +1 -0
- package/dist/cli/restart.d.ts +2 -0
- package/dist/cli/restart.d.ts.map +1 -0
- package/dist/cli/restart.js +7 -0
- package/dist/cli/restart.js.map +1 -0
- package/dist/cli/spoke.d.ts +35 -0
- package/dist/cli/spoke.d.ts.map +1 -0
- package/dist/cli/spoke.js +212 -0
- package/dist/cli/spoke.js.map +1 -0
- package/dist/cli/start.d.ts +2 -0
- package/dist/cli/start.d.ts.map +1 -0
- package/dist/cli/start.js +92 -0
- package/dist/cli/start.js.map +1 -0
- package/dist/cli/status.d.ts +2 -0
- package/dist/cli/status.d.ts.map +1 -0
- package/dist/cli/status.js +83 -0
- package/dist/cli/status.js.map +1 -0
- package/dist/cli/stop.d.ts +2 -0
- package/dist/cli/stop.d.ts.map +1 -0
- package/dist/cli/stop.js +51 -0
- package/dist/cli/stop.js.map +1 -0
- package/dist/cli/uninstall.d.ts.map +1 -1
- package/dist/cli/uninstall.js +109 -9
- package/dist/cli/uninstall.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +10 -1
- package/dist/cli/update.js.map +1 -1
- package/dist/cli/workflow-assets.d.ts +37 -0
- package/dist/cli/workflow-assets.d.ts.map +1 -0
- package/dist/cli/workflow-assets.js +144 -0
- package/dist/cli/workflow-assets.js.map +1 -0
- package/dist/cli/workflow.d.ts +75 -0
- package/dist/cli/workflow.d.ts.map +1 -0
- package/dist/cli/workflow.js +397 -0
- package/dist/cli/workflow.js.map +1 -0
- package/dist/hub-service/activity.d.ts +30 -0
- package/dist/hub-service/activity.d.ts.map +1 -0
- package/dist/hub-service/activity.js +20 -0
- package/dist/hub-service/activity.js.map +1 -0
- package/dist/hub-service/audit-log.d.ts +19 -0
- package/dist/hub-service/audit-log.d.ts.map +1 -0
- package/dist/hub-service/audit-log.js +13 -0
- package/dist/hub-service/audit-log.js.map +1 -0
- package/dist/hub-service/db/pool.d.ts +19 -0
- package/dist/hub-service/db/pool.d.ts.map +1 -0
- package/dist/hub-service/db/pool.js +53 -0
- package/dist/hub-service/db/pool.js.map +1 -0
- package/dist/hub-service/enrollment.d.ts +29 -0
- package/dist/hub-service/enrollment.d.ts.map +1 -0
- package/dist/hub-service/enrollment.js +48 -0
- package/dist/hub-service/enrollment.js.map +1 -0
- package/dist/hub-service/envelope-routes.d.ts +46 -0
- package/dist/hub-service/envelope-routes.d.ts.map +1 -0
- package/dist/hub-service/envelope-routes.js +94 -0
- package/dist/hub-service/envelope-routes.js.map +1 -0
- package/dist/hub-service/handlers/installers.d.ts +14 -0
- package/dist/hub-service/handlers/installers.d.ts.map +1 -0
- package/dist/hub-service/handlers/installers.js +8 -0
- package/dist/hub-service/handlers/installers.js.map +1 -0
- package/dist/hub-service/http-server.d.ts +31 -0
- package/dist/hub-service/http-server.d.ts.map +1 -0
- package/dist/hub-service/http-server.js +711 -0
- package/dist/hub-service/http-server.js.map +1 -0
- package/dist/hub-service/hub-jwt.d.ts +30 -0
- package/dist/hub-service/hub-jwt.d.ts.map +1 -0
- package/dist/hub-service/hub-jwt.js +105 -0
- package/dist/hub-service/hub-jwt.js.map +1 -0
- package/dist/hub-service/jwt-revocation.d.ts +20 -0
- package/dist/hub-service/jwt-revocation.d.ts.map +1 -0
- package/dist/hub-service/jwt-revocation.js +18 -0
- package/dist/hub-service/jwt-revocation.js.map +1 -0
- package/dist/hub-service/machines.d.ts +16 -0
- package/dist/hub-service/machines.d.ts.map +1 -0
- package/dist/hub-service/machines.js +14 -0
- package/dist/hub-service/machines.js.map +1 -0
- package/dist/hub-service/main.d.ts +3 -0
- package/dist/hub-service/main.d.ts.map +1 -0
- package/dist/hub-service/main.js +64 -0
- package/dist/hub-service/main.js.map +1 -0
- package/dist/hub-service/member-tokens.d.ts +11 -0
- package/dist/hub-service/member-tokens.d.ts.map +1 -0
- package/dist/hub-service/member-tokens.js +49 -0
- package/dist/hub-service/member-tokens.js.map +1 -0
- package/dist/hub-service/member-view.d.ts +20 -0
- package/dist/hub-service/member-view.d.ts.map +1 -0
- package/dist/hub-service/member-view.js +76 -0
- package/dist/hub-service/member-view.js.map +1 -0
- package/dist/hub-service/members.d.ts +44 -0
- package/dist/hub-service/members.d.ts.map +1 -0
- package/dist/hub-service/members.js +25 -0
- package/dist/hub-service/members.js.map +1 -0
- package/dist/hub-service/presence.d.ts +40 -0
- package/dist/hub-service/presence.d.ts.map +1 -0
- package/dist/hub-service/presence.js +44 -0
- package/dist/hub-service/presence.js.map +1 -0
- package/dist/hub-service/project-view.d.ts +12 -0
- package/dist/hub-service/project-view.d.ts.map +1 -0
- package/dist/hub-service/project-view.js +34 -0
- package/dist/hub-service/project-view.js.map +1 -0
- package/dist/hub-service/projects.d.ts +48 -0
- package/dist/hub-service/projects.d.ts.map +1 -0
- package/dist/hub-service/projects.js +80 -0
- package/dist/hub-service/projects.js.map +1 -0
- package/dist/hub-service/relay-queue.d.ts +115 -0
- package/dist/hub-service/relay-queue.d.ts.map +1 -0
- package/dist/hub-service/relay-queue.js +148 -0
- package/dist/hub-service/relay-queue.js.map +1 -0
- package/dist/hub-service/session-jwt.d.ts +10 -0
- package/dist/hub-service/session-jwt.d.ts.map +1 -0
- package/dist/hub-service/session-jwt.js +69 -0
- package/dist/hub-service/session-jwt.js.map +1 -0
- package/dist/hub-service/usage.d.ts +40 -0
- package/dist/hub-service/usage.d.ts.map +1 -0
- package/dist/hub-service/usage.js +25 -0
- package/dist/hub-service/usage.js.map +1 -0
- package/dist/hub-service/users.d.ts +56 -0
- package/dist/hub-service/users.d.ts.map +1 -0
- package/dist/hub-service/users.js +72 -0
- package/dist/hub-service/users.js.map +1 -0
- package/dist/hub-service/workspaces.d.ts +20 -0
- package/dist/hub-service/workspaces.d.ts.map +1 -0
- package/dist/hub-service/workspaces.js +10 -0
- package/dist/hub-service/workspaces.js.map +1 -0
- package/dist/index.js +179 -132
- package/dist/index.js.map +1 -1
- package/dist/os/linux.d.ts +13 -0
- package/dist/os/linux.d.ts.map +1 -1
- package/dist/os/linux.js +62 -3
- package/dist/os/linux.js.map +1 -1
- package/dist/os/os-commands.d.ts +10 -0
- package/dist/os/os-commands.d.ts.map +1 -1
- package/dist/os/windows.d.ts +1 -0
- package/dist/os/windows.d.ts.map +1 -1
- package/dist/os/windows.js +21 -1
- package/dist/os/windows.js.map +1 -1
- package/dist/paths.d.ts +23 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +29 -0
- package/dist/paths.js.map +1 -1
- package/dist/providers/agy.d.ts +9 -2
- package/dist/providers/agy.d.ts.map +1 -1
- package/dist/providers/agy.js +127 -14
- package/dist/providers/agy.js.map +1 -1
- package/dist/providers/claude.d.ts +6 -2
- package/dist/providers/claude.d.ts.map +1 -1
- package/dist/providers/claude.js +248 -9
- package/dist/providers/claude.js.map +1 -1
- package/dist/providers/codex.d.ts +3 -2
- package/dist/providers/codex.d.ts.map +1 -1
- package/dist/providers/codex.js +7 -0
- package/dist/providers/codex.js.map +1 -1
- package/dist/providers/copilot.d.ts +3 -2
- package/dist/providers/copilot.d.ts.map +1 -1
- package/dist/providers/copilot.js +8 -1
- package/dist/providers/copilot.js.map +1 -1
- package/dist/providers/gemini.d.ts +3 -2
- package/dist/providers/gemini.d.ts.map +1 -1
- package/dist/providers/gemini.js +11 -1
- package/dist/providers/gemini.js.map +1 -1
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +3 -0
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/none.d.ts +51 -0
- package/dist/providers/none.d.ts.map +1 -0
- package/dist/providers/none.js +103 -0
- package/dist/providers/none.js.map +1 -0
- package/dist/providers/opencode.d.ts +4 -2
- package/dist/providers/opencode.d.ts.map +1 -1
- package/dist/providers/opencode.js +49 -0
- package/dist/providers/opencode.js.map +1 -1
- package/dist/providers/provider.d.ts +79 -1
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/provider.js +10 -0
- package/dist/providers/provider.js.map +1 -1
- package/dist/services/agent-provisioner.d.ts +3 -3
- package/dist/services/agent-provisioner.d.ts.map +1 -1
- package/dist/services/agent-provisioner.js +12 -5
- package/dist/services/agent-provisioner.js.map +1 -1
- package/dist/services/auth-socket.d.ts.map +1 -1
- package/dist/services/auth-socket.js +2 -0
- package/dist/services/auth-socket.js.map +1 -1
- package/dist/services/budget-awareness.d.ts +130 -0
- package/dist/services/budget-awareness.d.ts.map +1 -0
- package/dist/services/budget-awareness.js +129 -0
- package/dist/services/budget-awareness.js.map +1 -0
- package/dist/services/cloud-sync.d.ts +35 -0
- package/dist/services/cloud-sync.d.ts.map +1 -0
- package/dist/services/cloud-sync.js +90 -0
- package/dist/services/cloud-sync.js.map +1 -0
- package/dist/services/context-admission.d.ts +82 -0
- package/dist/services/context-admission.d.ts.map +1 -0
- package/dist/services/context-admission.js +136 -0
- package/dist/services/context-admission.js.map +1 -0
- package/dist/services/event-bus.d.ts +27 -0
- package/dist/services/event-bus.d.ts.map +1 -0
- package/dist/services/event-bus.js +20 -0
- package/dist/services/event-bus.js.map +1 -0
- package/dist/services/file-chunker.d.ts +38 -0
- package/dist/services/file-chunker.d.ts.map +1 -0
- package/dist/services/file-chunker.js +63 -0
- package/dist/services/file-chunker.js.map +1 -0
- package/dist/services/file-transfer-relay.d.ts +55 -0
- package/dist/services/file-transfer-relay.d.ts.map +1 -0
- package/dist/services/file-transfer-relay.js +115 -0
- package/dist/services/file-transfer-relay.js.map +1 -0
- package/dist/services/github-app.d.ts.map +1 -1
- package/dist/services/github-app.js +1 -0
- package/dist/services/github-app.js.map +1 -1
- package/dist/services/http-transport.d.ts +25 -0
- package/dist/services/http-transport.d.ts.map +1 -0
- package/dist/services/http-transport.js +371 -0
- package/dist/services/http-transport.js.map +1 -0
- package/dist/services/hub-client.d.ts +69 -0
- package/dist/services/hub-client.d.ts.map +1 -0
- package/dist/services/hub-client.js +217 -0
- package/dist/services/hub-client.js.map +1 -0
- package/dist/services/jwt.d.ts +17 -0
- package/dist/services/jwt.d.ts.map +1 -0
- package/dist/services/jwt.js +70 -0
- package/dist/services/jwt.js.map +1 -0
- package/dist/services/known-sessions.d.ts +8 -0
- package/dist/services/known-sessions.d.ts.map +1 -0
- package/dist/services/known-sessions.js +40 -0
- package/dist/services/known-sessions.js.map +1 -0
- package/dist/services/model-pricing.d.ts +36 -0
- package/dist/services/model-pricing.d.ts.map +1 -0
- package/dist/services/model-pricing.js +108 -0
- package/dist/services/model-pricing.js.map +1 -0
- package/dist/services/orphan-recovery.d.ts +56 -0
- package/dist/services/orphan-recovery.d.ts.map +1 -0
- package/dist/services/orphan-recovery.js +111 -0
- package/dist/services/orphan-recovery.js.map +1 -0
- package/dist/services/pending-responses.d.ts +23 -0
- package/dist/services/pending-responses.d.ts.map +1 -0
- package/dist/services/pending-responses.js +52 -0
- package/dist/services/pending-responses.js.map +1 -0
- package/dist/services/registry.d.ts +4 -1
- package/dist/services/registry.d.ts.map +1 -1
- package/dist/services/registry.js +3 -0
- package/dist/services/registry.js.map +1 -1
- package/dist/services/relay-context.d.ts +23 -0
- package/dist/services/relay-context.d.ts.map +1 -0
- package/dist/services/relay-context.js +8 -0
- package/dist/services/relay-context.js.map +1 -0
- package/dist/services/relay-executor.d.ts +68 -0
- package/dist/services/relay-executor.d.ts.map +1 -0
- package/dist/services/relay-executor.js +70 -0
- package/dist/services/relay-executor.js.map +1 -0
- package/dist/services/relay-request.d.ts +65 -0
- package/dist/services/relay-request.d.ts.map +1 -0
- package/dist/services/relay-request.js +129 -0
- package/dist/services/relay-request.js.map +1 -0
- package/dist/services/relay-strategy.d.ts +19 -0
- package/dist/services/relay-strategy.d.ts.map +1 -0
- package/dist/services/relay-strategy.js +111 -0
- package/dist/services/relay-strategy.js.map +1 -0
- package/dist/services/service-manager/index.d.ts +5 -0
- package/dist/services/service-manager/index.d.ts.map +1 -0
- package/dist/services/service-manager/index.js +66 -0
- package/dist/services/service-manager/index.js.map +1 -0
- package/dist/services/service-manager/linux.d.ts +10 -0
- package/dist/services/service-manager/linux.d.ts.map +1 -0
- package/dist/services/service-manager/linux.js +97 -0
- package/dist/services/service-manager/linux.js.map +1 -0
- package/dist/services/service-manager/macos.d.ts +10 -0
- package/dist/services/service-manager/macos.d.ts.map +1 -0
- package/dist/services/service-manager/macos.js +94 -0
- package/dist/services/service-manager/macos.js.map +1 -0
- package/dist/services/service-manager/types.d.ts +18 -0
- package/dist/services/service-manager/types.d.ts.map +1 -0
- package/dist/services/service-manager/types.js +5 -0
- package/dist/services/service-manager/types.js.map +1 -0
- package/dist/services/service-manager/windows.d.ts +10 -0
- package/dist/services/service-manager/windows.d.ts.map +1 -0
- package/dist/services/service-manager/windows.js +73 -0
- package/dist/services/service-manager/windows.js.map +1 -0
- package/dist/services/session-registry.d.ts +70 -0
- package/dist/services/session-registry.d.ts.map +1 -0
- package/dist/services/session-registry.js +91 -0
- package/dist/services/session-registry.js.map +1 -0
- package/dist/services/singleton.d.ts +15 -0
- package/dist/services/singleton.d.ts.map +1 -0
- package/dist/services/singleton.js +98 -0
- package/dist/services/singleton.js.map +1 -0
- package/dist/services/sprint-coordination.d.ts +168 -0
- package/dist/services/sprint-coordination.d.ts.map +1 -0
- package/dist/services/sprint-coordination.js +564 -0
- package/dist/services/sprint-coordination.js.map +1 -0
- package/dist/services/ssh.d.ts.map +1 -1
- package/dist/services/ssh.js +70 -3
- package/dist/services/ssh.js.map +1 -1
- package/dist/services/stall/log-path-resolver.d.ts.map +1 -1
- package/dist/services/stall/log-path-resolver.js +8 -1
- package/dist/services/stall/log-path-resolver.js.map +1 -1
- package/dist/services/stall/stall-detector.d.ts.map +1 -1
- package/dist/services/stall/stall-detector.js +39 -7
- package/dist/services/stall/stall-detector.js.map +1 -1
- package/dist/services/stall/stall-poller.d.ts +16 -0
- package/dist/services/stall/stall-poller.d.ts.map +1 -1
- package/dist/services/stall/stall-poller.js +136 -18
- package/dist/services/stall/stall-poller.js.map +1 -1
- package/dist/services/strategy.d.ts.map +1 -1
- package/dist/services/strategy.js +55 -5
- package/dist/services/strategy.js.map +1 -1
- package/dist/services/substitution-engine.d.ts +20 -0
- package/dist/services/substitution-engine.d.ts.map +1 -0
- package/dist/services/substitution-engine.js +92 -0
- package/dist/services/substitution-engine.js.map +1 -0
- package/dist/services/task-cleanup.d.ts.map +1 -1
- package/dist/services/task-cleanup.js +1 -9
- package/dist/services/task-cleanup.js.map +1 -1
- package/dist/services/token-issuer.d.ts +47 -0
- package/dist/services/token-issuer.d.ts.map +1 -0
- package/dist/services/token-issuer.js +63 -0
- package/dist/services/token-issuer.js.map +1 -0
- package/dist/services/tool-registry.d.ts +3 -0
- package/dist/services/tool-registry.d.ts.map +1 -0
- package/dist/services/tool-registry.js +139 -0
- package/dist/services/tool-registry.js.map +1 -0
- package/dist/services/user-config.d.ts +14 -0
- package/dist/services/user-config.d.ts.map +1 -1
- package/dist/services/user-config.js +55 -0
- package/dist/services/user-config.js.map +1 -1
- package/dist/services/vcs/types.d.ts +44 -0
- package/dist/services/vcs/types.d.ts.map +1 -1
- package/dist/skills/fleet-sprint-cli/SKILL.md +103 -0
- package/dist/skills/pm/cost.md +3 -0
- package/dist/skills/pm/doer-reviewer-loop.md +3 -0
- package/dist/tools/check-status.d.ts.map +1 -1
- package/dist/tools/check-status.js +8 -2
- package/dist/tools/check-status.js.map +1 -1
- package/dist/tools/child-id-allocator.d.ts +45 -0
- package/dist/tools/child-id-allocator.d.ts.map +1 -0
- package/dist/tools/child-id-allocator.js +62 -0
- package/dist/tools/child-id-allocator.js.map +1 -0
- package/dist/tools/cloud-control.d.ts +2 -2
- package/dist/tools/compose-permissions.d.ts +12 -4
- package/dist/tools/compose-permissions.d.ts.map +1 -1
- package/dist/tools/compose-permissions.js +55 -4
- package/dist/tools/compose-permissions.js.map +1 -1
- package/dist/tools/dolt-push-mutex.d.ts +44 -0
- package/dist/tools/dolt-push-mutex.d.ts.map +1 -0
- package/dist/tools/dolt-push-mutex.js +83 -0
- package/dist/tools/dolt-push-mutex.js.map +1 -0
- package/dist/tools/execute-command.d.ts +11 -1
- package/dist/tools/execute-command.d.ts.map +1 -1
- package/dist/tools/execute-command.js +22 -5
- package/dist/tools/execute-command.js.map +1 -1
- package/dist/tools/execute-prompt.d.ts +72 -12
- package/dist/tools/execute-prompt.d.ts.map +1 -1
- package/dist/tools/execute-prompt.js +962 -71
- package/dist/tools/execute-prompt.js.map +1 -1
- package/dist/tools/get-member-model-pricing.d.ts +21 -0
- package/dist/tools/get-member-model-pricing.d.ts.map +1 -0
- package/dist/tools/get-member-model-pricing.js +29 -0
- package/dist/tools/get-member-model-pricing.js.map +1 -0
- package/dist/tools/list-members.d.ts.map +1 -1
- package/dist/tools/list-members.js +39 -7
- package/dist/tools/list-members.js.map +1 -1
- package/dist/tools/member-detail.d.ts +1 -1
- package/dist/tools/member-detail.d.ts.map +1 -1
- package/dist/tools/member-detail.js +8 -2
- package/dist/tools/member-detail.js.map +1 -1
- package/dist/tools/member-reservation.d.ts +29 -0
- package/dist/tools/member-reservation.d.ts.map +1 -0
- package/dist/tools/member-reservation.js +71 -0
- package/dist/tools/member-reservation.js.map +1 -0
- package/dist/tools/provision-vcs-auth.d.ts +7 -7
- package/dist/tools/provision-vcs-auth.js +1 -1
- package/dist/tools/provision-vcs-auth.js.map +1 -1
- package/dist/tools/register-member.d.ts +17 -5
- package/dist/tools/register-member.d.ts.map +1 -1
- package/dist/tools/register-member.js +144 -5
- package/dist/tools/register-member.js.map +1 -1
- package/dist/tools/remove-member.d.ts +1 -1
- package/dist/tools/report-status.d.ts +33 -0
- package/dist/tools/report-status.d.ts.map +1 -0
- package/dist/tools/report-status.js +44 -0
- package/dist/tools/report-status.js.map +1 -0
- package/dist/tools/respond-to-message.d.ts +21 -0
- package/dist/tools/respond-to-message.d.ts.map +1 -0
- package/dist/tools/respond-to-message.js +23 -0
- package/dist/tools/respond-to-message.js.map +1 -0
- package/dist/tools/send-files.d.ts +3 -0
- package/dist/tools/send-files.d.ts.map +1 -1
- package/dist/tools/send-files.js +88 -8
- package/dist/tools/send-files.js.map +1 -1
- package/dist/tools/send-message.d.ts +27 -0
- package/dist/tools/send-message.d.ts.map +1 -0
- package/dist/tools/send-message.js +46 -0
- package/dist/tools/send-message.js.map +1 -0
- package/dist/tools/shutdown-server.d.ts +2 -0
- package/dist/tools/shutdown-server.d.ts.map +1 -1
- package/dist/tools/shutdown-server.js +19 -0
- package/dist/tools/shutdown-server.js.map +1 -1
- package/dist/tools/update-member.d.ts +8 -8
- package/dist/tools/update-member.d.ts.map +1 -1
- package/dist/tools/update-member.js +11 -1
- package/dist/tools/update-member.js.map +1 -1
- package/dist/types.d.ts +15 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/agent-helpers.d.ts +2 -1
- package/dist/utils/agent-helpers.d.ts.map +1 -1
- package/dist/utils/agent-helpers.js +7 -2
- package/dist/utils/agent-helpers.js.map +1 -1
- package/dist/utils/pid-helpers.d.ts +15 -0
- package/dist/utils/pid-helpers.d.ts.map +1 -1
- package/dist/utils/pid-helpers.js +23 -0
- package/dist/utils/pid-helpers.js.map +1 -1
- package/dist/utils/process-utils.d.ts +3 -0
- package/dist/utils/process-utils.d.ts.map +1 -0
- package/dist/utils/process-utils.js +42 -0
- package/dist/utils/process-utils.js.map +1 -0
- package/dist/utils/prompt-errors.d.ts +2 -1
- package/dist/utils/prompt-errors.d.ts.map +1 -1
- package/dist/utils/prompt-errors.js +13 -3
- package/dist/utils/prompt-errors.js.map +1 -1
- package/dist/utils/workspace-trust.d.ts +24 -0
- package/dist/utils/workspace-trust.d.ts.map +1 -0
- package/dist/utils/workspace-trust.js +35 -0
- package/dist/utils/workspace-trust.js.map +1 -0
- package/dist/workflows/auto-sprint.js +450 -87
- package/package.json +35 -7
- package/packages/apra-fleet-client/package.json +26 -0
- package/packages/apra-fleet-client/src/client/api.mjs +396 -0
- package/packages/apra-fleet-client/src/client/client.mjs +146 -0
- package/packages/apra-fleet-client/src/client/errors.mjs +71 -0
- package/packages/apra-fleet-client/src/client/factory.mjs +65 -0
- package/packages/apra-fleet-client/src/client/server-resolution.mjs +265 -0
- package/packages/apra-fleet-client/src/client/transport.mjs +327 -0
- package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +287 -0
- package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +89 -0
- package/packages/apra-fleet-se/apra-pm/agents/deployer.md +139 -0
- package/packages/apra-fleet-se/apra-pm/agents/doer.md +225 -0
- package/packages/apra-fleet-se/apra-pm/agents/harvester.md +169 -0
- package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +316 -0
- package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +188 -0
- package/packages/apra-fleet-se/apra-pm/agents/planner.md +239 -0
- package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +216 -0
- package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +174 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/backlog-groomer-input.json +35 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/backlog-groomer-output.json +164 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/ci-watcher-input.json +26 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/ci-watcher-output.json +18 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/deployer-input.json +19 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/deployer-output.json +17 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-input.json +25 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-output.json +22 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/harvester-input.json +31 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/harvester-output.json +18 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/integ-test-runner-input.json +20 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/integ-test-runner-output.json +61 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-input.json +15 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-output.json +30 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-input.json +15 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-output.json +50 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/reviewer-input.json +25 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/reviewer-output.json +38 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +402 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/beads.md +142 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +157 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/doer-reviewer-loop.md +300 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +121 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/simple-sprint.md +65 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/sprint.md +327 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/worktrees.md +92 -0
- package/packages/apra-fleet-se/apra-pm/version.json +3 -0
- package/packages/apra-fleet-se/bin/cli.mjs +857 -0
- package/packages/apra-fleet-se/bin/serve.mjs +383 -0
- package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +178 -0
- package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +914 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-safety-guard.mjs +177 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/README.md +191 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/coach-role-design.md +151 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-tier2-runbook.md +127 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/fleet-sprint-diagram.md +94 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/stabilization-log.md +1125 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-literal-guard.mjs +72 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-recovery-path-b.mjs +339 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-recovery-tier2.mjs +360 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-recovery.mjs +363 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +1244 -0
- package/packages/apra-fleet-se/fleet-sprint/errors.mjs +572 -0
- package/packages/apra-fleet-se/fleet-sprint/full-db-fetch-guard.mjs +118 -0
- package/packages/apra-fleet-se/fleet-sprint/runner.js +9447 -0
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +103 -0
- package/packages/apra-fleet-se/fleet-sprint/sprint-lock.mjs +140 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +435 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +68 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/bitbucket.mjs +53 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/dolt.mjs +146 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/generic-git.mjs +176 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +222 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +218 -0
- package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +882 -0
- package/packages/apra-fleet-se/package.json +28 -0
- package/packages/apra-fleet-se/workflow.json +1 -0
- package/packages/apra-fleet-workflow/package.json +30 -0
- package/packages/apra-fleet-workflow/src/viewer/command-output-cap.mjs +112 -0
- package/packages/apra-fleet-workflow/src/viewer/debounced-writer.mjs +153 -0
- package/packages/apra-fleet-workflow/src/viewer/html-utils.mjs +31 -0
- package/packages/apra-fleet-workflow/src/viewer/index.mjs +1325 -0
- package/packages/apra-fleet-workflow/src/viewer/lean-state.mjs +237 -0
- package/packages/apra-fleet-workflow/src/viewer/run-state-paths.mjs +130 -0
- package/packages/apra-fleet-workflow/src/viewer/sprint-state-paths.mjs +29 -0
- package/packages/apra-fleet-workflow/src/workflow/engine.mjs +200 -0
- package/packages/apra-fleet-workflow/src/workflow/errors.mjs +146 -0
- package/packages/apra-fleet-workflow/src/workflow/index.mjs +1723 -0
- package/packages/apra-fleet-workflow/src/workflow/journal.mjs +291 -0
- package/packages/apra-fleet-workflow/src/workflow/pricing.mjs +99 -0
- package/packages/apra-fleet-workflow/src/workflow/vetting.mjs +111 -0
- package/scripts/agy-transcript-reader.js +1 -0
- package/scripts/fleet-statusline.sh +17 -13
- package/skills/fleet/SKILL.md +37 -2
- package/skills/fleet/beads.md +14 -7
- package/skills/fleet/permissions.md +50 -0
- package/skills/fleet/profiles/base-dev.json +1 -0
- package/skills/fleet/profiles/base-reviewer.json +1 -0
- package/skills/fleet/profiles/node.json +2 -2
- package/version.json +1 -1
- package/scripts/agy-settings-merge.js +0 -27
- /package/{dist → packages/apra-fleet-se/apra-pm}/agents/_shared/GRAPH-SEMANTICS.md +0 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
// apra-fleet-eft.27.1: lean list-state transform for the dashboard's GET
|
|
2
|
+
// /state endpoint.
|
|
3
|
+
//
|
|
4
|
+
// Problem (apra-fleet-eft.27): a live 449-activity sprint measured a 116 MB
|
|
5
|
+
// GET /state payload per poll (85 MB of it pure duplication -- the same bead
|
|
6
|
+
// descriptions and command outputs embedded again and again by every `bd`
|
|
7
|
+
// command activity). Parsing + rendering that on the main thread produced a
|
|
8
|
+
// 49634 ms long task and made the dashboard effectively unusable.
|
|
9
|
+
//
|
|
10
|
+
// This module is a pure, dependency-free transform: it never touches the
|
|
11
|
+
// live `state` object the viewer mutates in place (src/viewer/index.mjs),
|
|
12
|
+
// nor the full-fidelity snapshots persisted to the configured
|
|
13
|
+
// state-snapshot directory and running/<runId>.json (those stay complete,
|
|
14
|
+
// unchanged, for audit/resume/History-view purposes) -- it only shapes what
|
|
15
|
+
// GET /state sends over the wire for the LIVE polling view.
|
|
16
|
+
//
|
|
17
|
+
// Two independent passes, both fully generic (no extension-specific
|
|
18
|
+
// field/namespace knowledge, so this stays workflow-agnostic per the parent
|
|
19
|
+
// bug's fix direction):
|
|
20
|
+
//
|
|
21
|
+
// 1. leanifyState(): walks state.tree and state.extensions and
|
|
22
|
+
// (a) merges known "heavy" fields (description/output/error/input/
|
|
23
|
+
// transcript/stdout/stderr -- the exact fields the bug's payload
|
|
24
|
+
// anatomy pointed at) into a single short `summary` field, and
|
|
25
|
+
// (b) caps every OTHER remaining string (msg, label, command, ...) at
|
|
26
|
+
// a hard length regardless of field name, as a generic safety net.
|
|
27
|
+
// Descriptions and agent transcripts are therefore never embedded in
|
|
28
|
+
// list state -- only short summaries survive.
|
|
29
|
+
// 2. dedupeStrings(): a second, independent pass that replaces any string
|
|
30
|
+
// value repeated 2+ times anywhere in the (already-leaned) payload with
|
|
31
|
+
// a small `{ $ref: <index> }` marker into a shared `_strings` table
|
|
32
|
+
// sent once, so remaining repeats (e.g. the same short label/member/
|
|
33
|
+
// title appearing on many activities) are never sent twice. Fully
|
|
34
|
+
// reversible via resolveStringRefs() -- the client-side counterpart
|
|
35
|
+
// embedded into the served page (src/viewer/index.mjs HTML_TEMPLATE).
|
|
36
|
+
|
|
37
|
+
export const DEFAULT_SUMMARY_MAX_CHARS = 200;
|
|
38
|
+
export const DEFAULT_MAX_INLINE_STRING_CHARS = 400;
|
|
39
|
+
export const DEFAULT_DEDUP_MIN_LENGTH = 24;
|
|
40
|
+
|
|
41
|
+
// The exact fields the bug's payload anatomy identified as the source of
|
|
42
|
+
// duplication: full bead descriptions and full `bd`/agent command
|
|
43
|
+
// input/output/error text. Checked in this priority order when more than
|
|
44
|
+
// one is present on the same object (e.g. a failed activity carrying both
|
|
45
|
+
// `error` and `output`) -- the most diagnostically useful one wins the
|
|
46
|
+
// single `summary` field.
|
|
47
|
+
export const HEAVY_FIELD_NAMES = ['error', 'output', 'input', 'description', 'transcript', 'stdout', 'stderr'];
|
|
48
|
+
|
|
49
|
+
/** Truncates a string to `maxChars`, appending an ellipsis marker when cut. */
|
|
50
|
+
export function truncate(str, maxChars) {
|
|
51
|
+
if (typeof str !== 'string') return str;
|
|
52
|
+
if (str.length <= maxChars) return str;
|
|
53
|
+
return str.slice(0, maxChars) + '...';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Merges any HEAVY_FIELD_NAMES present on a plain object into a single
|
|
57
|
+
// short `summary` field and deletes the originals. Non-object input, and
|
|
58
|
+
// objects with none of these fields, pass through unchanged (a fresh
|
|
59
|
+
// shallow copy is only made when there's actually something to remove, so
|
|
60
|
+
// this stays cheap on the common case).
|
|
61
|
+
//
|
|
62
|
+
// apra-fleet-eft.38 (reopened): a `command` activity's output/error already
|
|
63
|
+
// carries <field>Truncated + <field>ByteLength markers by the time it gets
|
|
64
|
+
// here (command-output-cap.mjs capped it BEFORE storage, at activity:end --
|
|
65
|
+
// see src/viewer/index.mjs). Every OTHER activity type (most notably `agent`,
|
|
66
|
+
// whose full LLM response text is never capped at storage time, only here at
|
|
67
|
+
// the wire-shaping stage) had no such markers, so the dashboard's 'more...'
|
|
68
|
+
// control had nothing to key off of and never rendered for them. This now
|
|
69
|
+
// stamps the same <field>Truncated/<field>ByteLength pair onto ANY heavy
|
|
70
|
+
// field this function strips down to `summary`, whenever that field's full
|
|
71
|
+
// text does not survive intact inline (either it's a secondary heavy field --
|
|
72
|
+
// e.g. `output` when `error` already claimed the one `summary` slot -- that
|
|
73
|
+
// gets dropped entirely, or it's the summary source itself but longer than
|
|
74
|
+
// the summary cap). GET /activities/:id/output (src/viewer/index.mjs) falls
|
|
75
|
+
// back to the live in-memory state.tree for any id not already in
|
|
76
|
+
// command-output-cap.mjs's own store, so these markers are always backed by
|
|
77
|
+
// a real fetchable full text. Markers a field already carries (the `command`
|
|
78
|
+
// case above) are left untouched, never overwritten with a lesser byte count.
|
|
79
|
+
function summarizeHeavyFields(obj, maxChars) {
|
|
80
|
+
if (!obj || typeof obj !== 'object' || Array.isArray(obj)) return obj;
|
|
81
|
+
const present = HEAVY_FIELD_NAMES.filter((key) =>
|
|
82
|
+
Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === 'string' && obj[key].length > 0
|
|
83
|
+
);
|
|
84
|
+
if (present.length === 0) return obj;
|
|
85
|
+
|
|
86
|
+
const out = { ...obj };
|
|
87
|
+
const summaryKey = present[0];
|
|
88
|
+
const heavyValue = out[summaryKey];
|
|
89
|
+
|
|
90
|
+
for (const key of present) {
|
|
91
|
+
const full = out[key];
|
|
92
|
+
const survivesIntactAsSummary = key === summaryKey && full.length <= maxChars;
|
|
93
|
+
const truncatedKey = `${key}Truncated`;
|
|
94
|
+
const byteLengthKey = `${key}ByteLength`;
|
|
95
|
+
if (!survivesIntactAsSummary && !Object.prototype.hasOwnProperty.call(out, truncatedKey)) {
|
|
96
|
+
out[truncatedKey] = true;
|
|
97
|
+
out[byteLengthKey] = Buffer.byteLength(full, 'utf8');
|
|
98
|
+
}
|
|
99
|
+
delete out[key];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (!Object.prototype.hasOwnProperty.call(out, 'summary')) {
|
|
103
|
+
out.summary = truncate(heavyValue, maxChars);
|
|
104
|
+
}
|
|
105
|
+
return out;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function leanifyDeep(value, opts) {
|
|
109
|
+
if (Array.isArray(value)) return value.map((v) => leanifyDeep(v, opts));
|
|
110
|
+
if (value && typeof value === 'object') {
|
|
111
|
+
const summarized = summarizeHeavyFields(value, opts.summaryMaxChars);
|
|
112
|
+
const out = {};
|
|
113
|
+
for (const [k, v] of Object.entries(summarized)) {
|
|
114
|
+
out[k] = leanifyDeep(v, opts);
|
|
115
|
+
}
|
|
116
|
+
return out;
|
|
117
|
+
}
|
|
118
|
+
// Generic safety net: ANY remaining string, under ANY field name
|
|
119
|
+
// (log messages, labels, commands, future extension fields we don't
|
|
120
|
+
// yet know the name of), is capped -- list state must never embed an
|
|
121
|
+
// unbounded blob regardless of what it's called.
|
|
122
|
+
if (typeof value === 'string') return truncate(value, opts.maxInlineStringChars);
|
|
123
|
+
return value;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Returns a new state object whose `tree` and `extensions` have been
|
|
128
|
+
* stripped of heavy/unbounded string content (see module doc). Every other
|
|
129
|
+
* top-level field (status, stats, runId, ...) is passed through
|
|
130
|
+
* unchanged -- those are already small and fixed-shape.
|
|
131
|
+
*
|
|
132
|
+
* @param {object} state
|
|
133
|
+
* @param {object} [opts]
|
|
134
|
+
* @param {number} [opts.summaryMaxChars]
|
|
135
|
+
* @param {number} [opts.maxInlineStringChars]
|
|
136
|
+
*/
|
|
137
|
+
export function leanifyState(state, opts = {}) {
|
|
138
|
+
const summaryMaxChars = opts.summaryMaxChars ?? DEFAULT_SUMMARY_MAX_CHARS;
|
|
139
|
+
const maxInlineStringChars = opts.maxInlineStringChars ?? DEFAULT_MAX_INLINE_STRING_CHARS;
|
|
140
|
+
const walkOpts = { summaryMaxChars, maxInlineStringChars };
|
|
141
|
+
return {
|
|
142
|
+
...state,
|
|
143
|
+
tree: leanifyDeep(state.tree ?? [], walkOpts),
|
|
144
|
+
extensions: leanifyDeep(state.extensions ?? {}, walkOpts)
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Replaces every string value that occurs 2+ times anywhere within `value`
|
|
150
|
+
* (arrays/objects walked recursively) with a `{ $ref: <index> }` marker into
|
|
151
|
+
* a shared table of unique strings, sent once. Strings shorter than
|
|
152
|
+
* `minLength` are left inline (not worth a reference indirection). Returns
|
|
153
|
+
* `{ value, table }`; `table[$ref]` recovers the original string. Pure and
|
|
154
|
+
* side-effect-free -- safe to call on any JSON-compatible value.
|
|
155
|
+
*
|
|
156
|
+
* @param {any} value
|
|
157
|
+
* @param {object} [opts]
|
|
158
|
+
* @param {number} [opts.minLength]
|
|
159
|
+
*/
|
|
160
|
+
export function dedupeStrings(value, opts = {}) {
|
|
161
|
+
const minLength = opts.minLength ?? DEFAULT_DEDUP_MIN_LENGTH;
|
|
162
|
+
|
|
163
|
+
const counts = new Map();
|
|
164
|
+
(function count(v) {
|
|
165
|
+
if (Array.isArray(v)) { v.forEach(count); return; }
|
|
166
|
+
if (v && typeof v === 'object') { Object.values(v).forEach(count); return; }
|
|
167
|
+
if (typeof v === 'string' && v.length >= minLength) {
|
|
168
|
+
counts.set(v, (counts.get(v) || 0) + 1);
|
|
169
|
+
}
|
|
170
|
+
})(value);
|
|
171
|
+
|
|
172
|
+
const table = [];
|
|
173
|
+
const indexOf = new Map();
|
|
174
|
+
function refFor(str) {
|
|
175
|
+
if (indexOf.has(str)) return indexOf.get(str);
|
|
176
|
+
const idx = table.length;
|
|
177
|
+
table.push(str);
|
|
178
|
+
indexOf.set(str, idx);
|
|
179
|
+
return idx;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function replace(v) {
|
|
183
|
+
if (Array.isArray(v)) return v.map(replace);
|
|
184
|
+
if (v && typeof v === 'object') {
|
|
185
|
+
const out = {};
|
|
186
|
+
for (const [k, val] of Object.entries(v)) out[k] = replace(val);
|
|
187
|
+
return out;
|
|
188
|
+
}
|
|
189
|
+
if (typeof v === 'string' && v.length >= minLength && (counts.get(v) || 0) >= 2) {
|
|
190
|
+
return { $ref: refFor(v) };
|
|
191
|
+
}
|
|
192
|
+
return v;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
return { value: replace(value), table };
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Inverse of dedupeStrings(): walks `value`, replacing every
|
|
200
|
+
* `{ $ref: <index> }` marker with `table[<index>]`. A plain object/array
|
|
201
|
+
* containing no such markers (e.g. a frozen History-view state that never
|
|
202
|
+
* went through dedupeStrings()) round-trips unchanged, so this is always
|
|
203
|
+
* safe to apply defensively. This exact source is embedded verbatim into
|
|
204
|
+
* the served page's client-side <script> (via .toString(), the same
|
|
205
|
+
* pattern html-utils.mjs's escapeHtml() uses) so the browser can undo the
|
|
206
|
+
* same transform.
|
|
207
|
+
*
|
|
208
|
+
* @param {any} value
|
|
209
|
+
* @param {Array<string>} table
|
|
210
|
+
*/
|
|
211
|
+
export function resolveStringRefs(value, table) {
|
|
212
|
+
if (Array.isArray(value)) return value.map((v) => resolveStringRefs(v, table));
|
|
213
|
+
if (value && typeof value === 'object') {
|
|
214
|
+
const keys = Object.keys(value);
|
|
215
|
+
if (keys.length === 1 && keys[0] === '$ref' && typeof value.$ref === 'number') {
|
|
216
|
+
return table[value.$ref];
|
|
217
|
+
}
|
|
218
|
+
const out = {};
|
|
219
|
+
for (const [k, v] of Object.entries(value)) out[k] = resolveStringRefs(v, table);
|
|
220
|
+
return out;
|
|
221
|
+
}
|
|
222
|
+
return value;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Convenience one-shot: leanify then dedupe, returning a single
|
|
227
|
+
* JSON.stringify-ready object (the shared string table is embedded under
|
|
228
|
+
* `_strings`). This is what GET /state serves.
|
|
229
|
+
*
|
|
230
|
+
* @param {object} state
|
|
231
|
+
* @param {object} [opts] - forwarded to leanifyState()/dedupeStrings().
|
|
232
|
+
*/
|
|
233
|
+
export function buildListStatePayload(state, opts = {}) {
|
|
234
|
+
const leaned = leanifyState(state, opts);
|
|
235
|
+
const { value, table } = dedupeStrings(leaned, opts);
|
|
236
|
+
return { ...value, _strings: table };
|
|
237
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* apra-fleet-eft.2.3 (renamed under eft.37.1): path resolution for the
|
|
3
|
+
* continuous per-run state file, keyed by run id (NOT the HHMMSS key used by
|
|
4
|
+
* the crash-safety snapshot net, which collides across days -- see
|
|
5
|
+
* src/viewer/index.mjs persistState()).
|
|
6
|
+
*
|
|
7
|
+
* This module is domain-neutral core: it knows about "workflow runs", not
|
|
8
|
+
* about the auto-sprint domain. auto-sprint is one workflow that happens to
|
|
9
|
+
* run on top of it.
|
|
10
|
+
*
|
|
11
|
+
* Layout, under the SERVICE data directory (never the repo checkout, so a
|
|
12
|
+
* `git status`/`git clean` in the working tree never touches it):
|
|
13
|
+
* <serviceDataDir>/running/<runId>.json - live run, in-place overwrite
|
|
14
|
+
* <serviceDataDir>/old_runs/<runId>.json - terminal run, moved (not copied) here
|
|
15
|
+
*
|
|
16
|
+
* `<serviceDataDir>` reuses the SAME ~/.apra-fleet/data convention (honoring
|
|
17
|
+
* APRA_FLEET_DATA_DIR) as the fleet client's server-resolution module, so
|
|
18
|
+
* there is exactly one "where does apra-fleet keep its runtime state" answer
|
|
19
|
+
* across the whole codebase rather than a second, viewer-local one.
|
|
20
|
+
*/
|
|
21
|
+
import path from 'node:path';
|
|
22
|
+
import fs from 'node:fs';
|
|
23
|
+
import { getFleetDataDir } from '@apralabs/apra-fleet-client/server-resolution';
|
|
24
|
+
|
|
25
|
+
/** @returns {string} <serviceDataDir>/running -- live, in-place-overwritten run state files. */
|
|
26
|
+
export function getRunningRunsDir(env = process.env) {
|
|
27
|
+
return path.join(getFleetDataDir(env), 'running');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** @returns {string} <serviceDataDir>/old_runs -- terminal run state files, moved (not copied) here. */
|
|
31
|
+
export function getOldRunsDir(env = process.env) {
|
|
32
|
+
return path.join(getFleetDataDir(env), 'old_runs');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* apra-fleet-4ul / apra-fleet-cvb.3: sanitize a runId for use as a SINGLE
|
|
37
|
+
* flat filename component. A path separator in `runId` (e.g. a branch-name-
|
|
38
|
+
* shaped runId like 'fix/fleet-sprint-stabilization' -- the pre-k7b.1
|
|
39
|
+
* fallback for a launch with no supervisor-minted sprintId) previously
|
|
40
|
+
* nested straight through an unsanitized `path.join`, so
|
|
41
|
+
* `old_runs/<runId>.json` silently became a NESTED
|
|
42
|
+
* `old_runs/fix/fleet-sprint-stabilization.json` instead of a flat file at
|
|
43
|
+
* the path every reader (watchdog.mjs's hasTerminalState(), this module's
|
|
44
|
+
* own getTerminalRunStatePath() reader branch) actually checks -- causing a
|
|
45
|
+
* cleanly-finished sprint to misclassify as CRASHED (apra-fleet-4ul).
|
|
46
|
+
*
|
|
47
|
+
* This is a defense-in-depth BACKSTOP at the lowest layer that turns a runId
|
|
48
|
+
* into a filename: every current launch/relaunch path already keys off the
|
|
49
|
+
* ledger's own sprintId (apra-fleet-k7b.1, src/supervisor/api.mjs's
|
|
50
|
+
* launch()), never a branch name, but this guarantees NO caller -- current
|
|
51
|
+
* or future, this module or a caller three layers up -- can ever again
|
|
52
|
+
* write a nested old_runs//running file, regardless of what string it
|
|
53
|
+
* passes as runId.
|
|
54
|
+
* @param {string} runId
|
|
55
|
+
* @returns {string} `runId` with every '/' or '\' replaced by '_'.
|
|
56
|
+
*/
|
|
57
|
+
export function sanitizeRunIdForFilename(runId) {
|
|
58
|
+
return String(runId).replace(/[\\/]+/g, '_');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @param {string} runId - stable per-run id (e.g. a caller-supplied runId or a
|
|
63
|
+
* generated UUID), NOT an HHMMSS-style clock key, which collides across two
|
|
64
|
+
* runs started in the same second on different days.
|
|
65
|
+
* @returns {string} path to the run's live state file: <serviceDataDir>/running/<runId>.json
|
|
66
|
+
* (runId is sanitized -- apra-fleet-4ul/cvb.3 -- so this is always a FLAT
|
|
67
|
+
* file directly under running/, never nested).
|
|
68
|
+
*/
|
|
69
|
+
export function getRunningRunStatePath(runId, env = process.env) {
|
|
70
|
+
if (!runId) {
|
|
71
|
+
throw new TypeError('getRunningRunStatePath requires a runId');
|
|
72
|
+
}
|
|
73
|
+
return path.join(getRunningRunsDir(env), `${sanitizeRunIdForFilename(runId)}.json`);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Resolve the terminal-state file path for a run.
|
|
78
|
+
*
|
|
79
|
+
* As a READER: returns the existing file, checking old_runs/ first (by the
|
|
80
|
+
* SANITIZED, always-flat key -- every write this module itself performs
|
|
81
|
+
* lands there) and then falling back to the legacy directory (read-only) so
|
|
82
|
+
* history for runs that terminated before this rename still loads.
|
|
83
|
+
*
|
|
84
|
+
* apra-fleet-4ul / apra-fleet-cvb.3: as a FINAL read-only fallback, also
|
|
85
|
+
* checks the raw, UNSANITIZED path built directly from `runId` -- this is
|
|
86
|
+
* what makes a pre-existing, already-on-disk LEGACY terminal record (written
|
|
87
|
+
* before this sanitize existed, under a slash-nested branch-name key) still
|
|
88
|
+
* discoverable, so a sprint that actually finished cleanly under one of
|
|
89
|
+
* those legacy runIds keeps classifying FINISHED, not CRASHED. Only
|
|
90
|
+
* consulted when the raw runId actually differs from its sanitized form (a
|
|
91
|
+
* normal, separator-free runId has no legacy nested variant to check, so
|
|
92
|
+
* this adds no extra fs.existsSync for the common case).
|
|
93
|
+
*
|
|
94
|
+
* As a WRITE target: for a fresh runId neither location exists yet, so this
|
|
95
|
+
* returns the canonical, SANITIZED old_runs/<runId>.json destination -- new
|
|
96
|
+
* terminal writes always land in old_runs/ as a flat file, never nested and
|
|
97
|
+
* never in the legacy directory.
|
|
98
|
+
*
|
|
99
|
+
* @param {string} runId
|
|
100
|
+
* @returns {string} path to the run's terminal state file.
|
|
101
|
+
*/
|
|
102
|
+
export function getTerminalRunStatePath(runId, env = process.env) {
|
|
103
|
+
if (!runId) {
|
|
104
|
+
throw new TypeError('getTerminalRunStatePath requires a runId');
|
|
105
|
+
}
|
|
106
|
+
const safeRunId = sanitizeRunIdForFilename(runId);
|
|
107
|
+
const oldRunsPath = path.join(getOldRunsDir(env), `${safeRunId}.json`);
|
|
108
|
+
if (fs.existsSync(oldRunsPath)) {
|
|
109
|
+
return oldRunsPath;
|
|
110
|
+
}
|
|
111
|
+
// BOUNDARY-COMPAT: terminal run state written by pre-runId releases lives
|
|
112
|
+
// under the legacy old_sprints/ directory. Resolve it read-only so history
|
|
113
|
+
// for runs that terminated before this rename still loads; this branch
|
|
114
|
+
// never creates or writes that directory -- fresh terminal writes always
|
|
115
|
+
// go to old_runs/ (returned below). Remove one release after the se
|
|
116
|
+
// consumers stop producing legacy files.
|
|
117
|
+
const legacyTerminalPath = path.join(getFleetDataDir(env), 'old_sprints', `${safeRunId}.json`);
|
|
118
|
+
if (fs.existsSync(legacyTerminalPath)) {
|
|
119
|
+
return legacyTerminalPath;
|
|
120
|
+
}
|
|
121
|
+
// apra-fleet-4ul / apra-fleet-cvb.3: legacy, pre-sanitize nested write --
|
|
122
|
+
// see this function's doc comment above.
|
|
123
|
+
if (safeRunId !== runId) {
|
|
124
|
+
const legacyNestedOldRunsPath = path.join(getOldRunsDir(env), `${runId}.json`);
|
|
125
|
+
if (fs.existsSync(legacyNestedOldRunsPath)) {
|
|
126
|
+
return legacyNestedOldRunsPath;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return oldRunsPath;
|
|
130
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BOUNDARY-COMPAT (apra-fleet-eft.37.1 / M1a): thin re-export shim for the
|
|
3
|
+
* pre-runId subpath '@apralabs/apra-fleet-workflow/viewer/sprint-state-paths'.
|
|
4
|
+
*
|
|
5
|
+
* The domain-neutral implementation now lives in run-state-paths.mjs and speaks
|
|
6
|
+
* "runs" (getRunningRunStatePath/getTerminalRunStatePath) instead of "sprints".
|
|
7
|
+
* This module keeps the old subpath and the old sprint-named exports resolvable
|
|
8
|
+
* so the apra-fleet-se supervisor consumers (watchdog/proxy/history-view) keep
|
|
9
|
+
* working until M1b (eft.37.2) migrates them to the run-state-paths API. Delete
|
|
10
|
+
* this shim once eft.37.2 lands and no consumer imports the sprint-* names.
|
|
11
|
+
*/
|
|
12
|
+
import {
|
|
13
|
+
getRunningRunsDir,
|
|
14
|
+
getOldRunsDir,
|
|
15
|
+
getRunningRunStatePath,
|
|
16
|
+
getTerminalRunStatePath,
|
|
17
|
+
} from './run-state-paths.mjs';
|
|
18
|
+
|
|
19
|
+
/** @deprecated use getRunningRunsDir from run-state-paths.mjs */
|
|
20
|
+
export const getRunningSprintsDir = getRunningRunsDir;
|
|
21
|
+
|
|
22
|
+
/** @deprecated use getOldRunsDir from run-state-paths.mjs */
|
|
23
|
+
export const getOldSprintsDir = getOldRunsDir;
|
|
24
|
+
|
|
25
|
+
/** @deprecated use getRunningRunStatePath from run-state-paths.mjs */
|
|
26
|
+
export const getRunningSprintStatePath = getRunningRunStatePath;
|
|
27
|
+
|
|
28
|
+
/** @deprecated use getTerminalRunStatePath from run-state-paths.mjs */
|
|
29
|
+
export const getOldSprintStatePath = getTerminalRunStatePath;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import * as fs from 'fs/promises';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { pathToFileURL } from 'url';
|
|
4
|
+
import { randomUUID } from 'crypto';
|
|
5
|
+
import { VettingEngine } from './vetting.mjs';
|
|
6
|
+
import { JournalWriter, loadJournal, resolveJournalWritePath } from './journal.mjs';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Loads and runs user-authored workflow scripts.
|
|
10
|
+
*
|
|
11
|
+
* TRUST MODEL: workflow scripts are TRUSTED code. They are loaded as real ES
|
|
12
|
+
* modules via dynamic `import()` and execute with full Node.js privileges
|
|
13
|
+
* (filesystem, network, child processes, `process.env`, dynamic `import()`,
|
|
14
|
+
* etc.) -- there is no sandbox. Only run scripts you trust, the same way you
|
|
15
|
+
* would trust any other Node.js module you `import`. See
|
|
16
|
+
* docs/apra-fleet-workflow-architecture.md section 3 for details.
|
|
17
|
+
* `VettingEngine` (vetting.mjs) is an advisory lint that surfaces
|
|
18
|
+
* risky-looking patterns as warnings; it is NOT a security boundary and does
|
|
19
|
+
* not block execution unless a caller explicitly opts into strict mode.
|
|
20
|
+
*/
|
|
21
|
+
export class WorkflowEngine {
|
|
22
|
+
/**
|
|
23
|
+
* @param {import('./index.mjs').FleetWorkflow} workflowApi
|
|
24
|
+
*/
|
|
25
|
+
constructor(workflowApi) {
|
|
26
|
+
this.wf = workflowApi;
|
|
27
|
+
this.vetting = new VettingEngine();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Load a workflow script as a real ES module and run it.
|
|
32
|
+
*
|
|
33
|
+
* The module must export an entry point function as one of `main`,
|
|
34
|
+
* `run`, or `default` (checked in that order) -- this is the
|
|
35
|
+
* standardized pattern all workflow scripts in this repo (examples/*,
|
|
36
|
+
* auto-sprint's runner.js, test fixtures) follow. The entry point is
|
|
37
|
+
* invoked with a single `context` argument (the object returned by
|
|
38
|
+
* `workflowApi.createContext()`), exposing `agent`, `command`,
|
|
39
|
+
* `parallel`, `sequential`, `pipeline`, `transform`, `log`, `phase`,
|
|
40
|
+
* `group`, `endGroup`, `publishState`, `args`, `budget`, etc. Scripts
|
|
41
|
+
* access these via the `context` parameter (e.g.
|
|
42
|
+
* `export async function main(context) { const { agent, log } = context; ... }`)
|
|
43
|
+
* rather than via injected bare globals -- there is no global injection
|
|
44
|
+
* anymore now that scripts are real ES modules.
|
|
45
|
+
*
|
|
46
|
+
* @param {string} scriptPath
|
|
47
|
+
* @param {any} args
|
|
48
|
+
* @param {boolean|{strictVetting?: boolean, journal?: boolean|string|{path:string}, resumeJournal?: string}} [vettingOpts] -
|
|
49
|
+
* Either a plain options object, or -- for backward compatibility with
|
|
50
|
+
* the old `forceOverrideRisk` boolean parameter -- a boolean, which is
|
|
51
|
+
* now a no-op (vetting never blocks by default, so there is nothing
|
|
52
|
+
* left to "force override"). Recognized object fields:
|
|
53
|
+
* - `strictVetting` (boolean): opts in to blocking execution of
|
|
54
|
+
* high-risk scripts.
|
|
55
|
+
* - `journal` (apra-fleet-unw.11, F6): opts in to persisting this run's
|
|
56
|
+
* `activity:start`/`activity:end`/`end` events as an append-only
|
|
57
|
+
* JSONL journal (see journal.mjs). `true` -> default path
|
|
58
|
+
* `.fleet-workflow/journal-<runId>.jsonl`; a string or
|
|
59
|
+
* `{ path: string }` -> explicit path. OFF BY DEFAULT: omitting this
|
|
60
|
+
* (and `resumeJournal`) produces zero journal-related I/O and zero
|
|
61
|
+
* change to emitted event shapes.
|
|
62
|
+
* - `resumeJournal` (string path): resumes a previous (possibly
|
|
63
|
+
* crashed) run from an existing journal file. For each
|
|
64
|
+
* `agent()`/`command()` call, a deterministic activity key (sequence
|
|
65
|
+
* index within the run + call type + a hash of the dispatched
|
|
66
|
+
* prompt/command text + member) is looked up in the journal; a
|
|
67
|
+
* matching COMPLETED (successful) record is returned directly
|
|
68
|
+
* without dispatching to the fleet. The FIRST mismatch or missing
|
|
69
|
+
* entry stops replay and switches to live execution from that point
|
|
70
|
+
* onward (partial replay, not all-or-nothing -- Claude-CLI style).
|
|
71
|
+
* Journal records that were started but never finished (a crash
|
|
72
|
+
* mid-dispatch) are surfaced via a `journal:ambiguous` event and a
|
|
73
|
+
* console warning as possibly-double-dispatched; they are never
|
|
74
|
+
* auto-resolved (true idempotency requires fleet-server-side keys,
|
|
75
|
+
* descoped -- see plan.md). Unless `journal` is also given, the
|
|
76
|
+
* resumed run continues writing to the SAME file it resumed from.
|
|
77
|
+
*/
|
|
78
|
+
async executeFile(scriptPath, args = {}, vettingOpts = {}) {
|
|
79
|
+
const fullPath = path.resolve(scriptPath);
|
|
80
|
+
const opts = typeof vettingOpts === 'boolean' ? {} : (vettingOpts || {});
|
|
81
|
+
const strictVetting = typeof vettingOpts === 'boolean' ? false : !!opts.strictVetting;
|
|
82
|
+
|
|
83
|
+
const source = await fs.readFile(fullPath, 'utf-8');
|
|
84
|
+
const vettingResult = await this.vetting.assessRisk(source);
|
|
85
|
+
if (vettingResult.riskScore > 0) {
|
|
86
|
+
console.warn(`[VettingEngine] Script flagged with risk score ${vettingResult.riskScore}/100 (advisory only -- workflow scripts run with full Node privileges and must be trusted; see docs/apra-fleet-workflow-architecture.md).`);
|
|
87
|
+
vettingResult.warnings.forEach(w => console.warn(` - WARNING: ${w}`));
|
|
88
|
+
|
|
89
|
+
if (strictVetting && vettingResult.riskScore > 50) {
|
|
90
|
+
throw new Error(`Workflow script rejected by VettingEngine in strict mode (Risk: ${vettingResult.riskScore}). Vetting is advisory-only by default (not a security boundary); pass { strictVetting: true } only if you want this check to be enforced.`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const moduleUrl = pathToFileURL(fullPath).href;
|
|
95
|
+
const mod = await import(moduleUrl);
|
|
96
|
+
|
|
97
|
+
const entry = mod.main || mod.run || mod.default;
|
|
98
|
+
if (typeof entry !== 'function') {
|
|
99
|
+
throw new Error(`[WorkflowEngine] ${fullPath} does not export a main(context)/run(context)/default(context) function. Workflow scripts must export one of these as their entry point.`);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// (apra-fleet-unw.9, F11) Each executeFile() call gets its own
|
|
103
|
+
// isolated per-run context -- args, phase, group, budget -- via
|
|
104
|
+
// FleetWorkflow.runWithContext(), instead of mutating shared
|
|
105
|
+
// `this.wf.args`/`this.wf.currentPhase` instance state. This is what
|
|
106
|
+
// makes two concurrent executeFile() calls against the same
|
|
107
|
+
// FleetWorkflow instance safe: they no longer stomp on each other's
|
|
108
|
+
// args or phase attribution. See the runStorage comment in
|
|
109
|
+
// src/workflow/index.mjs for the full mechanism.
|
|
110
|
+
//
|
|
111
|
+
// (apra-fleet-unw.10) A `runId` is generated here (rather than left
|
|
112
|
+
// to runWithContext()'s internal default) so it's known up front and
|
|
113
|
+
// can be attached to the `end` event emitted from the `finally`
|
|
114
|
+
// block below on BOTH the success and failure/throw paths -- this is
|
|
115
|
+
// what lets the dashboard viewer (src/viewer/index.mjs) finally
|
|
116
|
+
// leave its perpetual "LIVE" state and transition to DONE/FAILED,
|
|
117
|
+
// and is also the runId a script's own `requestStop()`-triggered
|
|
118
|
+
// CancelledError (errors.mjs) will carry.
|
|
119
|
+
const runId = randomUUID();
|
|
120
|
+
|
|
121
|
+
// (apra-fleet-unw.11, F6) Journal setup. `journalEnabled` gates
|
|
122
|
+
// EVERYTHING journal-related in FleetWorkflow (the per-run activity
|
|
123
|
+
// sequence counter, replay-key computation) so that a normal call
|
|
124
|
+
// with neither `journal` nor `resumeJournal` set is byte-for-byte
|
|
125
|
+
// identical, in behavior and in emitted event shape, to before this
|
|
126
|
+
// feature existed (acceptance criterion #4).
|
|
127
|
+
const journalEnabled = !!(opts.journal || opts.resumeJournal);
|
|
128
|
+
let replay = null;
|
|
129
|
+
if (opts.resumeJournal) {
|
|
130
|
+
const resumePath = path.resolve(opts.resumeJournal);
|
|
131
|
+
const loaded = await loadJournal(resumePath);
|
|
132
|
+
replay = { completedByKey: loaded.completedByKey, diverged: false };
|
|
133
|
+
|
|
134
|
+
// Ambiguity guard: surface (never auto-resolve) any activity
|
|
135
|
+
// that was dispatched but never recorded as finished in the
|
|
136
|
+
// journal being resumed from -- most likely because the prior
|
|
137
|
+
// run crashed mid-dispatch. True idempotency requires
|
|
138
|
+
// fleet-server-side keys and is explicitly descoped (plan.md).
|
|
139
|
+
for (const ambiguousRecord of loaded.ambiguous) {
|
|
140
|
+
console.warn(
|
|
141
|
+
`[Journal] Ambiguous activity from a previous run (started but never recorded as finished -- ` +
|
|
142
|
+
`possibly double-dispatched on resume): id=${ambiguousRecord.id} type=${ambiguousRecord.type} ` +
|
|
143
|
+
`member=${ambiguousRecord.member} label=${ambiguousRecord.label || 'none'}`
|
|
144
|
+
);
|
|
145
|
+
this.wf.emit('journal:ambiguous', { runId, resumedFrom: resumePath, activity: ambiguousRecord });
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const journalWritePath = journalEnabled ? resolveJournalWritePath(opts, runId) : null;
|
|
150
|
+
let journalWriter = null;
|
|
151
|
+
if (journalWritePath) {
|
|
152
|
+
journalWriter = new JournalWriter(this.wf, { runId, filePath: journalWritePath });
|
|
153
|
+
await journalWriter.init();
|
|
154
|
+
await journalWriter.writeRunStart({ scriptPath: fullPath, args });
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
let status = 'success';
|
|
158
|
+
let result;
|
|
159
|
+
let error;
|
|
160
|
+
try {
|
|
161
|
+
result = await this.wf.runWithContext(args, entry, { runId, journalEnabled, replay });
|
|
162
|
+
return result;
|
|
163
|
+
} catch (err) {
|
|
164
|
+
console.error('[WorkflowEngine] Execution Failed:', err);
|
|
165
|
+
error = err;
|
|
166
|
+
status = err && err.code === 'CANCELLED' ? 'cancelled' : 'failed';
|
|
167
|
+
throw err;
|
|
168
|
+
} finally {
|
|
169
|
+
this.wf.emit('end', {
|
|
170
|
+
runId,
|
|
171
|
+
status,
|
|
172
|
+
result: status === 'success' ? result : undefined,
|
|
173
|
+
error: error
|
|
174
|
+
? { message: error.message, code: error.code, name: error.name }
|
|
175
|
+
: undefined
|
|
176
|
+
});
|
|
177
|
+
if (journalWriter) {
|
|
178
|
+
await journalWriter.close();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* REMOVED: inline-string execution. Workflow scripts are now loaded as
|
|
185
|
+
* real ES modules via `import()`, which requires an actual module (a
|
|
186
|
+
* file on disk, or a `data:`/`blob:` URL you construct yourself) rather
|
|
187
|
+
* than an arbitrary source string handed to an `AsyncFunction`
|
|
188
|
+
* constructor -- that constructor-based path (and the export-stripping
|
|
189
|
+
* regex it depended on) has been removed entirely. Write the script to a
|
|
190
|
+
* file and call `executeFile(path, args)` instead.
|
|
191
|
+
*/
|
|
192
|
+
async executeSource() {
|
|
193
|
+
throw new Error(
|
|
194
|
+
'[WorkflowEngine] executeSource() has been removed: workflow scripts are now loaded as real ES ' +
|
|
195
|
+
'modules via import(), which requires an actual module (a file, or a data:/blob: URL you construct ' +
|
|
196
|
+
'yourself) rather than an inline source string. Write the script to a file and call ' +
|
|
197
|
+
'executeFile(path, args) instead.'
|
|
198
|
+
);
|
|
199
|
+
}
|
|
200
|
+
}
|