@atolis-hq/wake 0.2.97 → 0.3.1
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 +5 -5
- package/dist/src/activities/agent/agent-activity-definition.js +26 -0
- package/dist/src/activities/agent/agent-activity.js +171 -0
- package/dist/src/activities/agent/agent-result.js +149 -0
- package/dist/src/activities/contracts/activity.js +10 -0
- package/dist/src/activities/contracts/config.js +2 -0
- package/dist/src/activities/contracts/event-schema.js +302 -0
- package/dist/src/activities/contracts/events.js +42 -0
- package/dist/src/activities/contracts/identifiers.js +29 -0
- package/dist/src/activities/contracts/registry.js +71 -0
- package/dist/src/activities/contracts/streams.js +17 -0
- package/dist/src/activities/contracts/vocabulary.js +58 -0
- package/dist/src/activities/index.js +21 -0
- package/dist/src/activities/pr/activity-support.js +111 -0
- package/dist/src/activities/pr/application.js +158 -0
- package/dist/src/activities/pr/approve.js +85 -0
- package/dist/src/activities/pr/capability.js +11 -0
- package/dist/src/activities/pr/decision-claim.js +76 -0
- package/dist/src/activities/pr/event-drafts.js +66 -0
- package/dist/src/activities/pr/intent.js +37 -0
- package/dist/src/activities/pr/merge-authority-gate.js +14 -0
- package/dist/src/activities/pr/merge.js +110 -0
- package/dist/src/activities/pr/policy.js +135 -0
- package/dist/src/activities/pr/projection.js +130 -0
- package/dist/src/activities/pr/vocabulary.js +30 -0
- package/dist/src/activities/review/authorization.js +22 -0
- package/dist/src/activities/review/contracts.js +22 -0
- package/dist/src/activities/review/signals.js +3 -0
- package/dist/src/bootstrap/analytics-projection.js +26 -0
- package/dist/src/bootstrap/board-projection.js +337 -0
- package/dist/src/bootstrap/composition-root.js +382 -0
- package/dist/src/bootstrap/config/load-config.js +51 -0
- package/dist/src/bootstrap/config/root-schema.js +134 -0
- package/dist/src/bootstrap/external-ref.js +12 -0
- package/dist/src/bootstrap/fake-provider-files.js +44 -0
- package/dist/src/bootstrap/fake-scenarios.js +22 -0
- package/dist/src/bootstrap/index.js +48 -0
- package/dist/src/bootstrap/initialise.js +436 -0
- package/dist/src/bootstrap/paths.js +15 -0
- package/dist/src/bootstrap/projection-runtime.js +27 -0
- package/dist/src/bootstrap/runner-quota-reporter.js +21 -0
- package/dist/src/bootstrap/runner-registry.js +30 -0
- package/dist/src/bootstrap/schedule-checkpoint-store.js +49 -0
- package/dist/src/bootstrap/self-update-application.js +195 -0
- package/dist/src/bootstrap/self-update-failure-log.js +33 -0
- package/dist/src/bootstrap/source-update-port.js +47 -0
- package/dist/src/bootstrap/status-publish-activity.js +42 -0
- package/dist/src/bootstrap/surface-api-applications.js +325 -0
- package/dist/src/bootstrap/surface-api-execution-applications.js +95 -0
- package/dist/src/bootstrap/surface-api-metadata.js +12 -0
- package/dist/src/bootstrap/surface-api-projection-pages.js +22 -0
- package/dist/src/bootstrap/surface-api-run-context.js +5 -0
- package/dist/src/bootstrap/surface-api-transcripts.js +57 -0
- package/dist/src/bootstrap/surface-api-work-applications.js +199 -0
- package/dist/src/bootstrap/surface-applications.js +7 -0
- package/dist/src/bootstrap/surface-cli-applications.js +701 -0
- package/dist/src/bootstrap/update-ledger.js +61 -0
- package/dist/src/bootstrap/update-maintenance-lease.js +176 -0
- package/dist/src/{version.js → bootstrap/version.js} +35 -51
- package/dist/src/control-plane/application/advance-once.js +184 -0
- package/dist/src/control-plane/application/control-plane-projection.js +42 -0
- package/dist/src/control-plane/application/control-plane-service.js +42 -0
- package/dist/src/control-plane/application/intake-pipeline.js +29 -0
- package/dist/src/control-plane/application/runner-control-service.js +66 -0
- package/dist/src/control-plane/application/runner-pipeline.js +57 -0
- package/dist/src/control-plane/application/schedule-service.js +47 -0
- package/dist/src/control-plane/application/work-cancellation-policy.js +31 -0
- package/dist/src/control-plane/contracts/commands.js +10 -0
- package/dist/src/control-plane/contracts/config.js +22 -0
- package/dist/src/control-plane/contracts/events.js +81 -0
- package/dist/src/control-plane/contracts/streams.js +5 -0
- package/dist/src/control-plane/domain/dispatch-policy.js +15 -0
- package/dist/src/control-plane/domain/quota-policy.js +26 -0
- package/dist/src/control-plane/domain/runner-quota.js +35 -0
- package/dist/src/control-plane/domain/schedule-policy.js +46 -0
- package/dist/src/control-plane/index.js +20 -0
- package/dist/src/control-plane/infrastructure/intake-host.js +24 -0
- package/dist/src/control-plane/infrastructure/resident-host.js +45 -0
- package/dist/src/control-plane/infrastructure/tick-host.js +35 -0
- package/dist/src/execution/application/activation-claim.js +50 -0
- package/dist/src/execution/application/active-run-cancellation.js +14 -0
- package/dist/src/execution/application/execution-activity.js +97 -0
- package/dist/src/execution/application/execution-projection.js +17 -0
- package/dist/src/execution/application/execution-service.js +372 -0
- package/dist/src/execution/application/execution-validation.js +26 -0
- package/dist/src/execution/application/recovery-service.js +212 -0
- package/dist/src/execution/application/run-lifecycle.js +115 -0
- package/dist/src/execution/application/run-liveness-service.js +80 -0
- package/dist/src/execution/application/run-repository.js +27 -0
- package/dist/src/execution/contracts/commands.js +1 -0
- package/dist/src/execution/contracts/config.js +35 -0
- package/dist/src/execution/contracts/control-plane.js +1 -0
- package/dist/src/execution/contracts/event-factory.js +53 -0
- package/dist/src/execution/contracts/events.js +274 -0
- package/dist/src/execution/contracts/identifiers.js +5 -0
- package/dist/src/execution/contracts/liveness.js +1 -0
- package/dist/src/execution/contracts/results.js +1 -0
- package/dist/src/execution/contracts/runner.js +15 -0
- package/dist/src/execution/contracts/streams.js +10 -0
- package/dist/src/execution/contracts/views.js +1 -0
- package/dist/src/execution/contracts/vocabulary.js +43 -0
- package/dist/src/execution/contracts/workspace.js +1 -0
- package/dist/src/execution/domain/run-result.js +34 -0
- package/dist/src/execution/domain/run.js +142 -0
- package/dist/src/execution/index.js +31 -0
- package/dist/src/execution/infrastructure/agent-runner-adapter.js +114 -0
- package/dist/src/execution/infrastructure/process-execution.js +29 -0
- package/dist/src/execution/infrastructure/prompt-templates.js +42 -0
- package/dist/src/execution/infrastructure/runners/claude.js +120 -0
- package/dist/src/execution/infrastructure/runners/codex.js +143 -0
- package/dist/src/execution/infrastructure/runners/command.js +4 -0
- package/dist/src/execution/infrastructure/runners/cursor.js +69 -0
- package/dist/src/execution/infrastructure/runners/fake-scenarios.js +99 -0
- package/dist/src/execution/infrastructure/runners/fake.js +65 -0
- package/dist/src/execution/infrastructure/runners/registry.js +26 -0
- package/dist/src/execution/infrastructure/transcript-store.js +223 -0
- package/dist/src/execution/infrastructure/transcripts.js +11 -0
- package/dist/src/execution/infrastructure/workspace/fake-workspace.js +19 -0
- package/dist/src/execution/infrastructure/workspace/git-workspace.js +241 -0
- package/dist/src/integrations/application/agent-run-publication-reactor.js +111 -0
- package/dist/src/integrations/application/artifact-registration-reactor.js +159 -0
- package/dist/src/integrations/application/poll-service.js +25 -0
- package/dist/src/integrations/application/terminal-agent-run-report.js +40 -0
- package/dist/src/integrations/application/work-admission.js +31 -0
- package/dist/src/integrations/application/work-conclusion.js +19 -0
- package/dist/src/integrations/contracts/artifact-events.js +60 -0
- package/dist/src/integrations/contracts/artifact-vocabulary.js +9 -0
- package/dist/src/integrations/contracts/config.js +14 -0
- package/dist/src/integrations/contracts/identifiers.js +5 -0
- package/dist/src/integrations/contracts/intake-rules.js +14 -0
- package/dist/src/integrations/contracts/intake.js +1 -0
- package/dist/src/integrations/contracts/outcome-vocabulary.js +7 -0
- package/dist/src/integrations/contracts/provider.js +37 -0
- package/dist/src/integrations/contracts/streams.js +10 -0
- package/dist/src/integrations/delivery/application/delivery-outcome-reactor.js +75 -0
- package/dist/src/integrations/delivery/application/delivery-projector.js +165 -0
- package/dist/src/integrations/delivery/application/delivery-service.js +173 -0
- package/dist/src/integrations/delivery/contracts/commands.js +1 -0
- package/dist/src/integrations/delivery/contracts/config.js +1 -0
- package/dist/src/integrations/delivery/contracts/event-factory.js +18 -0
- package/dist/src/integrations/delivery/contracts/events.js +86 -0
- package/dist/src/integrations/delivery/contracts/intents.js +89 -0
- package/dist/src/integrations/delivery/contracts/views.js +1 -0
- package/dist/src/integrations/delivery/contracts/vocabulary.js +22 -0
- package/dist/src/integrations/fake/durable-delivery-provider.js +48 -0
- package/dist/src/integrations/fake/external-sink.js +9 -0
- package/dist/src/integrations/fake/external-source.js +44 -0
- package/dist/src/integrations/fake/inbound-translator.js +130 -0
- package/dist/src/integrations/fake/provider.js +95 -0
- package/dist/src/integrations/github/application/agent-context-reader.js +54 -0
- package/dist/src/integrations/github/application/agent-run-comment.js +94 -0
- package/dist/src/integrations/github/application/comment-history-reader.js +43 -0
- package/dist/src/integrations/github/application/inbound-context.js +10 -0
- package/dist/src/integrations/github/application/inbound-review-signals.js +159 -0
- package/dist/src/integrations/github/application/inbound-translator.js +231 -0
- package/dist/src/integrations/github/application/inbound-watch-gate-signals.js +84 -0
- package/dist/src/integrations/github/application/intake-policy.js +23 -0
- package/dist/src/integrations/github/application/outbound-translator.js +47 -0
- package/dist/src/integrations/github/application/poll-service.js +29 -0
- package/dist/src/integrations/github/application/pull-request-translation.js +10 -0
- package/dist/src/integrations/github/application/resource-links.js +8 -0
- package/dist/src/integrations/github/application/review-command-translator.js +16 -0
- package/dist/src/integrations/github/application/wake-labels.js +95 -0
- package/dist/src/integrations/github/contracts/config.js +47 -0
- package/dist/src/integrations/github/contracts/events.js +127 -0
- package/dist/src/integrations/github/contracts/external-key.js +19 -0
- package/dist/src/integrations/github/contracts/payloads.js +9 -0
- package/dist/src/integrations/github/contracts/vocabulary.js +55 -0
- package/dist/src/integrations/github/index.js +31 -0
- package/dist/src/integrations/github/infrastructure/client-reads.js +214 -0
- package/dist/src/integrations/github/infrastructure/client.js +132 -0
- package/dist/src/integrations/github/infrastructure/content-fingerprint.js +10 -0
- package/dist/src/integrations/github/infrastructure/delivery.js +31 -0
- package/dist/src/integrations/github/infrastructure/etag-cache.js +56 -0
- package/dist/src/integrations/github/infrastructure/gh-auth.js +19 -0
- package/dist/src/integrations/github/infrastructure/issue-source.js +109 -0
- package/dist/src/integrations/github/infrastructure/pr-source.js +186 -0
- package/dist/src/integrations/github/infrastructure/review-source.js +70 -0
- package/dist/src/integrations/github/infrastructure/source.js +108 -0
- package/dist/src/integrations/github/provider.js +96 -0
- package/dist/src/integrations/index.js +30 -0
- package/dist/src/kernel/contracts/checkpoint-store.js +1 -0
- package/dist/src/kernel/contracts/clock.js +1 -0
- package/dist/src/kernel/contracts/commands.js +1 -0
- package/dist/src/kernel/contracts/event-journal.js +2 -0
- package/dist/src/kernel/contracts/event-schema.js +54 -0
- package/dist/src/kernel/contracts/events.js +11 -0
- package/dist/src/kernel/contracts/id-generator.js +1 -0
- package/dist/src/kernel/contracts/identifiers.js +8 -0
- package/dist/src/kernel/contracts/projection-store.js +1 -0
- package/dist/src/kernel/contracts/relations.js +1 -0
- package/dist/src/kernel/contracts/schema.js +17 -0
- package/dist/src/kernel/contracts/vocabulary.js +6 -0
- package/dist/src/kernel/domain/event-envelope.js +29 -0
- package/dist/src/kernel/domain/match-mode.js +11 -0
- package/dist/src/kernel/domain/relation.js +10 -0
- package/dist/src/kernel/index.js +17 -0
- package/dist/src/{lib/clock.js → kernel/infrastructure/system-clock.js} +3 -3
- package/dist/src/kernel/infrastructure/ulid-id-generator.js +9 -0
- package/dist/src/main.js +137 -1030
- package/dist/src/orchestration/application/accept-activity-outcome.js +25 -0
- package/dist/src/orchestration/application/accept-signal.js +35 -0
- package/dist/src/orchestration/application/advance-workflow.js +160 -0
- package/dist/src/orchestration/application/coordination-claims.js +107 -0
- package/dist/src/orchestration/application/group-budget-recorder.js +43 -0
- package/dist/src/orchestration/application/orchestration-projection.js +20 -0
- package/dist/src/orchestration/application/orchestration-repository.js +36 -0
- package/dist/src/orchestration/application/orchestration-service.js +82 -0
- package/dist/src/orchestration/application/request-child.js +118 -0
- package/dist/src/orchestration/application/signal-reactor.js +17 -0
- package/dist/src/orchestration/application/start-workflow.js +51 -0
- package/dist/src/orchestration/application/watch-reactor.js +82 -0
- package/dist/src/orchestration/contracts/activity-outcome.js +18 -0
- package/dist/src/orchestration/contracts/commands.js +1 -0
- package/dist/src/orchestration/contracts/config.js +128 -0
- package/dist/src/orchestration/contracts/event-decoder.js +263 -0
- package/dist/src/orchestration/contracts/events.js +41 -0
- package/dist/src/orchestration/contracts/identifiers.js +35 -0
- package/dist/src/orchestration/contracts/streams.js +38 -0
- package/dist/src/orchestration/contracts/views.js +1 -0
- package/dist/src/orchestration/contracts/vocabulary.js +30 -0
- package/dist/src/orchestration/domain/activation-policy.js +55 -0
- package/dist/src/orchestration/domain/approval-defaults.js +17 -0
- package/dist/src/orchestration/domain/child-policy.js +63 -0
- package/dist/src/orchestration/domain/compiler.js +162 -0
- package/dist/src/orchestration/domain/coordination-events.js +25 -0
- package/dist/src/orchestration/domain/decision-events.js +47 -0
- package/dist/src/orchestration/domain/interpreter.js +49 -0
- package/dist/src/orchestration/domain/operator-retry-policy.js +34 -0
- package/dist/src/orchestration/domain/retry-policy.js +26 -0
- package/dist/src/orchestration/domain/signal-policy.js +120 -0
- package/dist/src/orchestration/domain/supplemental-policy.js +61 -0
- package/dist/src/orchestration/domain/transition.js +55 -0
- package/dist/src/orchestration/domain/workflow-graph.js +41 -0
- package/dist/src/orchestration/domain/workflow-instance-events.js +236 -0
- package/dist/src/orchestration/domain/workflow-instance.js +41 -0
- package/dist/src/orchestration/domain/workflow-selector.js +21 -0
- package/dist/src/orchestration/index.js +19 -0
- package/dist/src/persistence/application/projection-runner.js +79 -0
- package/dist/src/persistence/filesystem/file-checkpoint-store.js +35 -0
- package/dist/src/persistence/filesystem/file-event-journal.js +143 -0
- package/dist/src/persistence/filesystem/file-lock.js +91 -0
- package/dist/src/persistence/filesystem/file-projection-store.js +64 -0
- package/dist/src/persistence/index.js +8 -0
- package/dist/src/persistence/memory/in-memory-checkpoint-store.js +14 -0
- package/dist/src/persistence/memory/in-memory-event-journal.js +88 -0
- package/dist/src/persistence/memory/in-memory-projection-store.js +17 -0
- package/dist/src/resources/application/lookup-projections.js +48 -0
- package/dist/src/resources/application/resource-lookup.js +16 -0
- package/dist/src/resources/application/resource-projections.js +81 -0
- package/dist/src/resources/application/resource-repository.js +18 -0
- package/dist/src/resources/application/resource-service.js +83 -0
- package/dist/src/resources/contracts/commands.js +1 -0
- package/dist/src/resources/contracts/config.js +2 -0
- package/dist/src/resources/contracts/events.js +83 -0
- package/dist/src/resources/contracts/identifiers.js +15 -0
- package/dist/src/resources/contracts/streams.js +6 -0
- package/dist/src/resources/contracts/views.js +1 -0
- package/dist/src/resources/contracts/vocabulary.js +67 -0
- package/dist/src/resources/domain/correlation.js +8 -0
- package/dist/src/resources/domain/resource.js +58 -0
- package/dist/src/resources/index.js +14 -0
- package/dist/src/surfaces/api/contracts/activities.js +1 -0
- package/dist/src/surfaces/api/contracts/board.js +2 -0
- package/dist/src/surfaces/api/contracts/common.js +46 -0
- package/dist/src/surfaces/api/contracts/control-plane.js +5 -0
- package/dist/src/surfaces/api/contracts/events.js +1 -0
- package/dist/src/surfaces/api/contracts/execution.js +1 -0
- package/dist/src/surfaces/api/contracts/index.js +13 -0
- package/dist/src/surfaces/api/contracts/observability.js +1 -0
- package/dist/src/surfaces/api/contracts/orchestration.js +1 -0
- package/dist/src/surfaces/api/contracts/resources.js +1 -0
- package/dist/src/surfaces/api/contracts/status.js +1 -0
- package/dist/src/surfaces/api/contracts/system.js +1 -0
- package/dist/src/surfaces/api/contracts/transport-values.js +39 -0
- package/dist/src/surfaces/api/contracts/work.js +17 -0
- package/dist/src/surfaces/api/http-server.js +121 -0
- package/dist/src/surfaces/api/presenters/activities.js +1 -0
- package/dist/src/surfaces/api/presenters/board.js +3 -0
- package/dist/src/surfaces/api/presenters/control-plane.js +1 -0
- package/dist/src/surfaces/api/presenters/events.js +1 -0
- package/dist/src/surfaces/api/presenters/execution.js +59 -0
- package/dist/src/surfaces/api/presenters/observability.js +1 -0
- package/dist/src/surfaces/api/presenters/orchestration.js +19 -0
- package/dist/src/surfaces/api/presenters/resources.js +15 -0
- package/dist/src/surfaces/api/presenters/status.js +3 -0
- package/dist/src/surfaces/api/presenters/system.js +14 -0
- package/dist/src/surfaces/api/presenters/work.js +16 -0
- package/dist/src/surfaces/api/problem-details.js +9 -0
- package/dist/src/surfaces/api/router.js +13 -0
- package/dist/src/surfaces/api/routes/activities.js +1 -0
- package/dist/src/surfaces/api/routes/applications.js +1 -0
- package/dist/src/surfaces/api/routes/commands.js +82 -0
- package/dist/src/surfaces/api/routes/control-plane.js +6 -0
- package/dist/src/surfaces/api/routes/events.js +1 -0
- package/dist/src/surfaces/api/routes/execution.js +8 -0
- package/dist/src/surfaces/api/routes/index.js +18 -0
- package/dist/src/surfaces/api/routes/observability.js +1 -0
- package/dist/src/surfaces/api/routes/orchestration.js +1 -0
- package/dist/src/surfaces/api/routes/pagination.js +78 -0
- package/dist/src/surfaces/api/routes/read.js +135 -0
- package/dist/src/surfaces/api/routes/resources.js +1 -0
- package/dist/src/surfaces/api/routes/responses.js +67 -0
- package/dist/src/surfaces/api/routes/system.js +1 -0
- package/dist/src/surfaces/api/routes/work.js +9 -0
- package/dist/src/surfaces/cli/commands/api.js +1 -0
- package/dist/src/surfaces/cli/commands/audit.js +10 -0
- package/dist/src/surfaces/cli/commands/correlate.js +2 -0
- package/dist/src/surfaces/cli/commands/doctor.js +6 -0
- package/dist/src/surfaces/cli/commands/init.js +39 -0
- package/dist/src/surfaces/cli/commands/sandbox-entrypoint.js +33 -0
- package/dist/src/surfaces/cli/commands/sandbox-setup.js +29 -0
- package/dist/src/surfaces/cli/commands/sandbox.js +105 -0
- package/dist/src/surfaces/cli/commands/self-update.js +38 -0
- package/dist/src/surfaces/cli/commands/smoke.js +16 -0
- package/dist/src/surfaces/cli/commands/start.js +1 -0
- package/dist/src/surfaces/cli/commands/stop.js +13 -0
- package/dist/src/surfaces/cli/commands/tick.js +1 -0
- package/dist/src/surfaces/cli/commands/ui.js +2 -0
- package/dist/src/surfaces/cli/commands/validate-state.js +5 -0
- package/dist/src/surfaces/cli/infrastructure/docker-cli.js +221 -0
- package/dist/src/surfaces/cli/infrastructure/process-log.js +86 -0
- package/dist/src/surfaces/cli/main.js +140 -0
- package/dist/src/surfaces/cli/usage.js +33 -0
- package/dist/src/surfaces/contracts/config.js +34 -0
- package/dist/src/surfaces/index.js +47 -0
- package/dist/src/surfaces/web-assets/assets/index-Bfn4FwZG.css +1 -0
- package/dist/src/surfaces/web-assets/assets/index-ipB6JPGU.js +1090 -0
- package/dist/src/surfaces/web-assets/index.html +13 -0
- package/dist/src/surfaces/web-host/asset-source.js +1 -0
- package/dist/src/surfaces/web-host/packaged-assets.js +44 -0
- package/dist/src/work/application/work-projection.js +59 -0
- package/dist/src/work/application/work-repository.js +18 -0
- package/dist/src/work/application/work-service.js +117 -0
- package/dist/src/work/contracts/commands.js +1 -0
- package/dist/src/work/contracts/config.js +2 -0
- package/dist/src/work/contracts/events.js +103 -0
- package/dist/src/work/contracts/identifiers.js +5 -0
- package/dist/src/work/contracts/streams.js +6 -0
- package/dist/src/work/contracts/views.js +1 -0
- package/dist/src/work/contracts/vocabulary.js +6 -0
- package/dist/src/work/domain/work-item.js +89 -0
- package/dist/src/work/index.js +11 -0
- package/docker/Dockerfile +10 -6
- package/docker/Dockerfile.packaged +3 -3
- package/package.json +29 -4
- package/prompts/implement.md +2 -2
- package/dist/src/adapters/claude/claude-runner.js +0 -529
- package/dist/src/adapters/codex/codex-runner.js +0 -503
- package/dist/src/adapters/cursor/cursor-runner.js +0 -418
- package/dist/src/adapters/docker/docker-cli.js +0 -150
- package/dist/src/adapters/fake/fake-artifact-verifier.js +0 -14
- package/dist/src/adapters/fake/fake-github-pull-request-activity-source.js +0 -77
- package/dist/src/adapters/fake/fake-resource-index.js +0 -21
- package/dist/src/adapters/fake/fake-runner.js +0 -77
- package/dist/src/adapters/fake/fake-ticketing-system.js +0 -185
- package/dist/src/adapters/fake/fake-workspace-manager.js +0 -81
- package/dist/src/adapters/fs/resource-index.js +0 -126
- package/dist/src/adapters/fs/self-update-ledger.js +0 -17
- package/dist/src/adapters/fs/state-store.js +0 -775
- package/dist/src/adapters/git/git-workspace-manager.js +0 -289
- package/dist/src/adapters/github/github-artifact-verifier.js +0 -38
- package/dist/src/adapters/github/github-auth.js +0 -16
- package/dist/src/adapters/github/github-client.js +0 -249
- package/dist/src/adapters/github/github-etag-cache.js +0 -57
- package/dist/src/adapters/github/github-issues-work-source.js +0 -692
- package/dist/src/adapters/github/github-pull-request-activity-source.js +0 -584
- package/dist/src/adapters/github/github-pull-request-merge-actor.js +0 -45
- package/dist/src/adapters/http/ui-assets.js +0 -1188
- package/dist/src/adapters/http/ui-data.js +0 -1107
- package/dist/src/adapters/http/ui-server.js +0 -458
- package/dist/src/adapters/runner/cli-command.js +0 -73
- package/dist/src/adapters/runner/prompt-templates.js +0 -76
- package/dist/src/adapters/runner/runner-cli-adapter.js +0 -112
- package/dist/src/adapters/runner/runner-registry.js +0 -139
- package/dist/src/adapters/runner/runtime-events.js +0 -32
- package/dist/src/adapters/runner/stage-prompt.js +0 -268
- package/dist/src/adapters/runner/transcripts.js +0 -25
- package/dist/src/cli/audit-command.js +0 -36
- package/dist/src/cli/correlate-command.js +0 -62
- package/dist/src/cli/doctor-command.js +0 -48
- package/dist/src/cli/init-command.js +0 -18
- package/dist/src/cli/sandbox-command.js +0 -258
- package/dist/src/cli/sandbox-entrypoint-command.js +0 -88
- package/dist/src/cli/sandbox-exec-logging.js +0 -7
- package/dist/src/cli/sandbox-resume.js +0 -79
- package/dist/src/cli/sandbox-setup-command.js +0 -31
- package/dist/src/cli/scaffold-assets.js +0 -100
- package/dist/src/cli/self-update-command.js +0 -198
- package/dist/src/cli/startup-preflight.js +0 -134
- package/dist/src/cli/stop-command.js +0 -46
- package/dist/src/cli/ui-command.js +0 -27
- package/dist/src/config/defaults.js +0 -10
- package/dist/src/config/discover-config-files.js +0 -11
- package/dist/src/config/load-config.js +0 -69
- package/dist/src/config/split-config.js +0 -14
- package/dist/src/core/active-run-recovery.js +0 -44
- package/dist/src/core/approval-intents.js +0 -16
- package/dist/src/core/audit-events.js +0 -82
- package/dist/src/core/control-plane.js +0 -192
- package/dist/src/core/event-builders.js +0 -153
- package/dist/src/core/event-resolver.js +0 -249
- package/dist/src/core/lifecycle-service.js +0 -8
- package/dist/src/core/live-execution.js +0 -81
- package/dist/src/core/outbox.js +0 -198
- package/dist/src/core/policy-engine.js +0 -389
- package/dist/src/core/projection-updater.js +0 -693
- package/dist/src/core/quota-backoff.js +0 -69
- package/dist/src/core/run-lease.js +0 -38
- package/dist/src/core/scheduled-workflow-source.js +0 -199
- package/dist/src/core/sink-router.js +0 -107
- package/dist/src/core/stale-run-reconciler.js +0 -352
- package/dist/src/core/tick-runner.js +0 -2442
- package/dist/src/core/workspace-cleanup.js +0 -117
- package/dist/src/domain/branch-naming.js +0 -14
- package/dist/src/domain/custom-commands.js +0 -58
- package/dist/src/domain/event-types.js +0 -158
- package/dist/src/domain/manual-labels.js +0 -1
- package/dist/src/domain/resource-uri.js +0 -38
- package/dist/src/domain/runner-routing.js +0 -127
- package/dist/src/domain/runtime-events.js +0 -36
- package/dist/src/domain/schema.js +0 -1233
- package/dist/src/domain/sources.js +0 -16
- package/dist/src/domain/stages.js +0 -36
- package/dist/src/domain/work-item-labels.js +0 -48
- package/dist/src/domain/work-item-lifecycle.js +0 -10
- package/dist/src/domain/work-item-status.js +0 -33
- package/dist/src/domain/workflows.js +0 -159
- package/dist/src/lib/deep-merge.js +0 -14
- package/dist/src/lib/detached-process-logging.js +0 -46
- package/dist/src/lib/event-log.js +0 -21
- package/dist/src/lib/format.js +0 -41
- package/dist/src/lib/json-file.js +0 -23
- package/dist/src/lib/lock.js +0 -181
- package/dist/src/lib/log-rotation.js +0 -42
- package/dist/src/lib/paths.js +0 -52
- package/dist/src/lib/process-identity.js +0 -54
- package/dist/src/lib/state-health.js +0 -30
- package/dist/src/lib/work-id.js +0 -19
- package/dist/src/lib/yaml-file.js +0 -20
- package/templates/SETUP.md +0 -115
- /package/dist/src/{core → activities/pr}/contracts.js +0 -0
- /package/dist/src/{domain/types.js → control-plane/contracts/views.js} +0 -0
|
@@ -1,418 +0,0 @@
|
|
|
1
|
-
import { parseRunnerResult } from '../../domain/schema.js';
|
|
2
|
-
import { buildStagePrompt } from '../runner/stage-prompt.js';
|
|
3
|
-
import { runAgentCliCommand } from '../runner/cli-command.js';
|
|
4
|
-
import { emitRuntimeEvent, runnerRuntimeEvent } from '../runner/runtime-events.js';
|
|
5
|
-
import { writeRunnerTranscript } from '../runner/transcripts.js';
|
|
6
|
-
import { createAgentExecution } from '../../core/live-execution.js';
|
|
7
|
-
const CURSOR_CLI_NAME = 'Cursor';
|
|
8
|
-
export function buildCursorAgentArgs(input) {
|
|
9
|
-
const fullPrompt = buildCursorPromptText(input);
|
|
10
|
-
return [
|
|
11
|
-
'agent',
|
|
12
|
-
'-p',
|
|
13
|
-
'--output-format',
|
|
14
|
-
'json',
|
|
15
|
-
'--model',
|
|
16
|
-
input.model,
|
|
17
|
-
'--trust',
|
|
18
|
-
...(input.mode !== undefined ? ['--mode', input.mode] : []),
|
|
19
|
-
...(input.force === true ? ['--force'] : []),
|
|
20
|
-
...(input.resumeSessionId !== undefined ? [`--resume=${input.resumeSessionId}`] : []),
|
|
21
|
-
fullPrompt,
|
|
22
|
-
];
|
|
23
|
-
}
|
|
24
|
-
export function buildCursorPromptText(input) {
|
|
25
|
-
return input.harnessPrompt === undefined
|
|
26
|
-
? input.prompt
|
|
27
|
-
: `${input.harnessPrompt}\n\n${input.prompt}`;
|
|
28
|
-
}
|
|
29
|
-
export function buildCursorResumeArgs(input) {
|
|
30
|
-
return ['agent', '--resume=' + input.sessionId];
|
|
31
|
-
}
|
|
32
|
-
function compactLogValue(value) {
|
|
33
|
-
return value.replace(/\s+/g, ' ').trim();
|
|
34
|
-
}
|
|
35
|
-
export function formatCursorRunLogLine(input) {
|
|
36
|
-
const parts = [
|
|
37
|
-
'[cursor-run]',
|
|
38
|
-
`phase=${input.phase}`,
|
|
39
|
-
`runId=${input.runId}`,
|
|
40
|
-
`cli=Cursor`,
|
|
41
|
-
...(input.model === undefined ? [] : [`model=${input.model}`]),
|
|
42
|
-
`repo=${input.repo}`,
|
|
43
|
-
`issueNumber=${input.issueNumber}`,
|
|
44
|
-
`action=${input.action}`,
|
|
45
|
-
`recentEventIds=${input.recentEventIds.length > 0 ? input.recentEventIds.join(',') : '(none)'}`,
|
|
46
|
-
...(input.workspacePath === undefined
|
|
47
|
-
? []
|
|
48
|
-
: [`workspacePath=${compactLogValue(input.workspacePath)}`]),
|
|
49
|
-
...(input.sessionId === undefined ? [] : [`sessionId=${input.sessionId}`]),
|
|
50
|
-
...(input.exitCode === undefined ? [] : [`exitCode=${input.exitCode}`]),
|
|
51
|
-
];
|
|
52
|
-
return parts.join(' ');
|
|
53
|
-
}
|
|
54
|
-
// Verified against a live `cursor-agent agent -p --output-format json` call
|
|
55
|
-
// (run through the wake-sandbox container, since the host `cursor` binary
|
|
56
|
-
// here is the desktop app, not the CLI). Cursor's usage keys are camelCase
|
|
57
|
-
// and different names from both Claude's and Codex's snake_case fields, e.g.:
|
|
58
|
-
// {"usage":{"inputTokens":5945,"outputTokens":32,"cacheReadTokens":6020,"cacheWriteTokens":0}}
|
|
59
|
-
// No cost field was present in that response, so costUsd stays unset for Cursor.
|
|
60
|
-
function extractCursorTokenUsage(parsed) {
|
|
61
|
-
const usage = parsed.usage;
|
|
62
|
-
if (usage === undefined) {
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
const inputTokens = typeof usage.inputTokens === 'number' ? usage.inputTokens : undefined;
|
|
66
|
-
const outputTokens = typeof usage.outputTokens === 'number' ? usage.outputTokens : undefined;
|
|
67
|
-
if (inputTokens === undefined || outputTokens === undefined) {
|
|
68
|
-
return undefined;
|
|
69
|
-
}
|
|
70
|
-
const cacheReadInputTokens = typeof usage.cacheReadTokens === 'number' ? usage.cacheReadTokens : undefined;
|
|
71
|
-
const cacheCreationInputTokens = typeof usage.cacheWriteTokens === 'number' ? usage.cacheWriteTokens : undefined;
|
|
72
|
-
return {
|
|
73
|
-
inputTokens,
|
|
74
|
-
outputTokens,
|
|
75
|
-
...(cacheCreationInputTokens === undefined ? {} : { cacheCreationInputTokens }),
|
|
76
|
-
...(cacheReadInputTokens === undefined ? {} : { cacheReadInputTokens }),
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
export function extractCursorAgentResult(stdout) {
|
|
80
|
-
const trimmed = stdout.trim();
|
|
81
|
-
if (trimmed.length === 0) {
|
|
82
|
-
throw new Error('Cursor agent produced no output.');
|
|
83
|
-
}
|
|
84
|
-
const parsed = JSON.parse(trimmed);
|
|
85
|
-
const result = typeof parsed.result === 'string' ? parsed.result : undefined;
|
|
86
|
-
if (result === undefined) {
|
|
87
|
-
throw new Error('Cursor agent JSON output did not include a result field.');
|
|
88
|
-
}
|
|
89
|
-
const sessionId = typeof parsed.session_id === 'string' ? parsed.session_id : undefined;
|
|
90
|
-
const isError = typeof parsed.is_error === 'boolean' ? parsed.is_error : undefined;
|
|
91
|
-
const tokenUsage = extractCursorTokenUsage(parsed);
|
|
92
|
-
return {
|
|
93
|
-
result,
|
|
94
|
-
...(sessionId !== undefined ? { sessionId } : {}),
|
|
95
|
-
...(isError !== undefined ? { isError } : {}),
|
|
96
|
-
...(tokenUsage !== undefined ? { tokenUsage } : {}),
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
export function classifyCursorCliFailure(input) {
|
|
100
|
-
if (input.timedOut) {
|
|
101
|
-
return 'infra';
|
|
102
|
-
}
|
|
103
|
-
// Cursor JSON output signals a handled task-level error
|
|
104
|
-
if (input.isError === true) {
|
|
105
|
-
return 'task';
|
|
106
|
-
}
|
|
107
|
-
const text = `${input.stderr}\n${input.stdout}`.toLowerCase();
|
|
108
|
-
if (text.includes('rate limit') ||
|
|
109
|
-
text.includes('usage limit') ||
|
|
110
|
-
text.includes('quota') ||
|
|
111
|
-
text.includes('billing') ||
|
|
112
|
-
text.includes('unauthorized') ||
|
|
113
|
-
text.includes('authentication') ||
|
|
114
|
-
text.includes('api key') ||
|
|
115
|
-
text.includes('too many requests')) {
|
|
116
|
-
return 'quota';
|
|
117
|
-
}
|
|
118
|
-
return 'infra';
|
|
119
|
-
}
|
|
120
|
-
// Cursor uses --mode ask for read-only stages, which already enforces
|
|
121
|
-
// the constraint at the CLI boundary. The capability note explains to the agent
|
|
122
|
-
// what tools are available in ask mode versus the default agent mode.
|
|
123
|
-
export function buildCursorToolCapabilityNote(input) {
|
|
124
|
-
if (input.workspaceMode !== 'read-only') {
|
|
125
|
-
return undefined;
|
|
126
|
-
}
|
|
127
|
-
const note = 'You are running in read-only ask mode. You can read and explore the repository but cannot modify files. ' +
|
|
128
|
-
'Use your available file-reading and search tools to understand the codebase.';
|
|
129
|
-
return input.mode === 'resume' ? `Reminder: this is still a planning-only stage. ${note}` : note;
|
|
130
|
-
}
|
|
131
|
-
function resolveCursorMode(input) {
|
|
132
|
-
return input.workspaceMode === 'read-only' ? 'ask' : undefined;
|
|
133
|
-
}
|
|
134
|
-
function resolveModel(input) {
|
|
135
|
-
return input.settings.model;
|
|
136
|
-
}
|
|
137
|
-
function readSandboxLogBreadcrumb() {
|
|
138
|
-
const containerName = process.env.WAKE_SANDBOX_CONTAINER_NAME;
|
|
139
|
-
if (containerName === undefined || containerName.length === 0) {
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
return {
|
|
143
|
-
text: `Sandbox logs: docker logs --tail 200 ${containerName}`,
|
|
144
|
-
metadata: {
|
|
145
|
-
sandboxContainerName: containerName,
|
|
146
|
-
},
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
export function createCursorRunner(options) {
|
|
150
|
-
const runner = {
|
|
151
|
-
async start(input) {
|
|
152
|
-
return createAgentExecution(input, (liveInput) => runner.run(liveInput));
|
|
153
|
-
},
|
|
154
|
-
async run(input) {
|
|
155
|
-
const priorSessionId = input.projection.wake.sessionId;
|
|
156
|
-
const priorSessionCli = input.projection.wake.sessionCli;
|
|
157
|
-
const isResume = priorSessionId !== undefined && priorSessionCli === CURSOR_CLI_NAME;
|
|
158
|
-
const cursorMode = resolveCursorMode({
|
|
159
|
-
...(input.workspaceMode === undefined ? {} : { workspaceMode: input.workspaceMode }),
|
|
160
|
-
});
|
|
161
|
-
const toolCapabilityNote = buildCursorToolCapabilityNote({
|
|
162
|
-
...(input.workspaceMode === undefined ? {} : { workspaceMode: input.workspaceMode }),
|
|
163
|
-
mode: isResume ? 'resume' : 'start',
|
|
164
|
-
});
|
|
165
|
-
const stagePrompt = await buildStagePrompt({
|
|
166
|
-
action: input.action,
|
|
167
|
-
projection: input.projection,
|
|
168
|
-
mode: isResume ? 'resume' : 'start',
|
|
169
|
-
config: input.config,
|
|
170
|
-
...(input.workspaceMode === undefined ? {} : { workspaceMode: input.workspaceMode }),
|
|
171
|
-
...(input.mergeConflictDetected === true ? { mergeConflictDetected: true } : {}),
|
|
172
|
-
...(input.upstreamChanges === undefined ? {} : { upstreamChanges: input.upstreamChanges }),
|
|
173
|
-
...(input.preExistingUncommittedChanges === true
|
|
174
|
-
? { preExistingUncommittedChanges: true }
|
|
175
|
-
: {}),
|
|
176
|
-
...(toolCapabilityNote !== undefined || input.promptContextOverrides !== undefined
|
|
177
|
-
? {
|
|
178
|
-
contextOverrides: {
|
|
179
|
-
...input.promptContextOverrides,
|
|
180
|
-
...(toolCapabilityNote === undefined ? {} : { toolCapabilityNote }),
|
|
181
|
-
},
|
|
182
|
-
}
|
|
183
|
-
: {}),
|
|
184
|
-
});
|
|
185
|
-
const model = resolveModel({ action: input.action, settings: options.settings });
|
|
186
|
-
const cwd = input.workspacePath ?? options.cwd;
|
|
187
|
-
const promptText = buildCursorPromptText({
|
|
188
|
-
prompt: stagePrompt.prompt,
|
|
189
|
-
harnessPrompt: stagePrompt.harnessPrompt,
|
|
190
|
-
});
|
|
191
|
-
const promptTranscriptPath = await writeRunnerTranscript({
|
|
192
|
-
config: input.config,
|
|
193
|
-
projection: input.projection,
|
|
194
|
-
runId: input.runId,
|
|
195
|
-
action: input.action,
|
|
196
|
-
cli: CURSOR_CLI_NAME,
|
|
197
|
-
kind: 'prompt',
|
|
198
|
-
text: promptText,
|
|
199
|
-
});
|
|
200
|
-
console.log(formatCursorRunLogLine({
|
|
201
|
-
phase: 'start',
|
|
202
|
-
runId: input.runId,
|
|
203
|
-
action: input.action,
|
|
204
|
-
issueNumber: input.projection.issue.number,
|
|
205
|
-
repo: input.projection.issue.repo,
|
|
206
|
-
recentEventIds: input.recentEvents.map((event) => event.eventId),
|
|
207
|
-
model,
|
|
208
|
-
...(input.workspacePath === undefined ? {} : { workspacePath: input.workspacePath }),
|
|
209
|
-
...(isResume ? { sessionId: priorSessionId } : {}),
|
|
210
|
-
}));
|
|
211
|
-
const result = await runAgentCliCommand({
|
|
212
|
-
command: options.command,
|
|
213
|
-
args: buildCursorAgentArgs({
|
|
214
|
-
model,
|
|
215
|
-
prompt: promptText,
|
|
216
|
-
...(cursorMode !== undefined ? { mode: cursorMode } : {}),
|
|
217
|
-
force: cursorMode === undefined,
|
|
218
|
-
...(isResume ? { resumeSessionId: priorSessionId } : {}),
|
|
219
|
-
}),
|
|
220
|
-
cwd,
|
|
221
|
-
timeoutMs: options.settings.timeoutMs,
|
|
222
|
-
...(input.cancellationSignal === undefined
|
|
223
|
-
? {}
|
|
224
|
-
: { cancellationSignal: input.cancellationSignal }),
|
|
225
|
-
onProcessStart: async (identity) => {
|
|
226
|
-
await input.onProcessStart?.(identity);
|
|
227
|
-
await emitRuntimeEvent(input.onRuntimeEvent, runnerRuntimeEvent({
|
|
228
|
-
type: 'agent.process.started',
|
|
229
|
-
runId: input.runId,
|
|
230
|
-
projection: input.projection,
|
|
231
|
-
routing: input.routing,
|
|
232
|
-
cli: CURSOR_CLI_NAME,
|
|
233
|
-
model,
|
|
234
|
-
payload: { pid: identity.pid, processStartedAt: identity.processStartedAt },
|
|
235
|
-
}));
|
|
236
|
-
},
|
|
237
|
-
});
|
|
238
|
-
const responseTranscriptPath = await writeRunnerTranscript({
|
|
239
|
-
config: input.config,
|
|
240
|
-
projection: input.projection,
|
|
241
|
-
runId: input.runId,
|
|
242
|
-
action: input.action,
|
|
243
|
-
cli: CURSOR_CLI_NAME,
|
|
244
|
-
kind: 'response',
|
|
245
|
-
text: result.stdout,
|
|
246
|
-
});
|
|
247
|
-
if (result.exitCode !== 0 || result.timedOut || result.stdout.trim().length === 0) {
|
|
248
|
-
const sandboxLog = readSandboxLogBreadcrumb();
|
|
249
|
-
const failureClass = classifyCursorCliFailure({
|
|
250
|
-
stdout: result.stdout,
|
|
251
|
-
stderr: result.stderr,
|
|
252
|
-
timedOut: result.timedOut,
|
|
253
|
-
});
|
|
254
|
-
console.error(formatCursorRunLogLine({
|
|
255
|
-
phase: 'failure',
|
|
256
|
-
runId: input.runId,
|
|
257
|
-
action: input.action,
|
|
258
|
-
issueNumber: input.projection.issue.number,
|
|
259
|
-
repo: input.projection.issue.repo,
|
|
260
|
-
recentEventIds: input.recentEvents.map((event) => event.eventId),
|
|
261
|
-
model,
|
|
262
|
-
...(input.workspacePath === undefined ? {} : { workspacePath: input.workspacePath }),
|
|
263
|
-
exitCode: result.exitCode,
|
|
264
|
-
}));
|
|
265
|
-
await emitRuntimeEvent(input.onRuntimeEvent, runnerRuntimeEvent({
|
|
266
|
-
type: 'agent.process.exited',
|
|
267
|
-
runId: input.runId,
|
|
268
|
-
projection: input.projection,
|
|
269
|
-
routing: input.routing,
|
|
270
|
-
cli: CURSOR_CLI_NAME,
|
|
271
|
-
model,
|
|
272
|
-
payload: { exitCode: result.exitCode, timedOut: result.timedOut },
|
|
273
|
-
}));
|
|
274
|
-
return {
|
|
275
|
-
result: [
|
|
276
|
-
result.timedOut
|
|
277
|
-
? `Cursor runner timed out after ${options.settings.timeoutMs}ms and was killed`
|
|
278
|
-
: result.stdout.trim().length === 0
|
|
279
|
-
? 'Cursor runner produced no output'
|
|
280
|
-
: 'Cursor runner failed',
|
|
281
|
-
result.stderr,
|
|
282
|
-
sandboxLog?.text,
|
|
283
|
-
'FAILED',
|
|
284
|
-
]
|
|
285
|
-
.filter((part) => part !== undefined && part.length > 0)
|
|
286
|
-
.join('\n'),
|
|
287
|
-
model,
|
|
288
|
-
cli: CURSOR_CLI_NAME,
|
|
289
|
-
failureClass,
|
|
290
|
-
metadata: {
|
|
291
|
-
stdout: result.stdout,
|
|
292
|
-
stderr: result.stderr,
|
|
293
|
-
exitCode: result.exitCode,
|
|
294
|
-
failureClass,
|
|
295
|
-
...(promptTranscriptPath === undefined ? {} : { promptTranscriptPath }),
|
|
296
|
-
...(responseTranscriptPath === undefined ? {} : { responseTranscriptPath }),
|
|
297
|
-
...(sandboxLog?.metadata ?? {}),
|
|
298
|
-
},
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
let parsed;
|
|
302
|
-
try {
|
|
303
|
-
parsed = extractCursorAgentResult(result.stdout);
|
|
304
|
-
}
|
|
305
|
-
catch (err) {
|
|
306
|
-
const sandboxLog = readSandboxLogBreadcrumb();
|
|
307
|
-
return {
|
|
308
|
-
result: [`Cursor runner output could not be parsed: ${String(err)}`, 'FAILED']
|
|
309
|
-
.filter((part) => part.length > 0)
|
|
310
|
-
.join('\n'),
|
|
311
|
-
model,
|
|
312
|
-
cli: CURSOR_CLI_NAME,
|
|
313
|
-
failureClass: 'infra',
|
|
314
|
-
metadata: {
|
|
315
|
-
stdout: result.stdout,
|
|
316
|
-
stderr: result.stderr,
|
|
317
|
-
parseError: String(err),
|
|
318
|
-
...(promptTranscriptPath === undefined ? {} : { promptTranscriptPath }),
|
|
319
|
-
...(responseTranscriptPath === undefined ? {} : { responseTranscriptPath }),
|
|
320
|
-
...(sandboxLog?.metadata ?? {}),
|
|
321
|
-
},
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
const sandboxLog = readSandboxLogBreadcrumb();
|
|
325
|
-
await emitRuntimeEvent(input.onRuntimeEvent, runnerRuntimeEvent({
|
|
326
|
-
type: 'agent.progress',
|
|
327
|
-
runId: input.runId,
|
|
328
|
-
projection: input.projection,
|
|
329
|
-
routing: input.routing,
|
|
330
|
-
cli: CURSOR_CLI_NAME,
|
|
331
|
-
model,
|
|
332
|
-
...(parsed.sessionId === undefined ? {} : { sessionId: parsed.sessionId }),
|
|
333
|
-
payload: { message: 'Cursor agent result received', raw: parsed },
|
|
334
|
-
}));
|
|
335
|
-
if (parsed.tokenUsage !== undefined) {
|
|
336
|
-
await emitRuntimeEvent(input.onRuntimeEvent, runnerRuntimeEvent({
|
|
337
|
-
type: 'agent.usage.updated',
|
|
338
|
-
runId: input.runId,
|
|
339
|
-
projection: input.projection,
|
|
340
|
-
routing: input.routing,
|
|
341
|
-
cli: CURSOR_CLI_NAME,
|
|
342
|
-
model,
|
|
343
|
-
...(parsed.sessionId === undefined ? {} : { sessionId: parsed.sessionId }),
|
|
344
|
-
payload: { tokenUsage: parsed.tokenUsage },
|
|
345
|
-
}));
|
|
346
|
-
}
|
|
347
|
-
console.log(formatCursorRunLogLine({
|
|
348
|
-
phase: 'success',
|
|
349
|
-
runId: input.runId,
|
|
350
|
-
action: input.action,
|
|
351
|
-
issueNumber: input.projection.issue.number,
|
|
352
|
-
repo: input.projection.issue.repo,
|
|
353
|
-
recentEventIds: input.recentEvents.map((event) => event.eventId),
|
|
354
|
-
model,
|
|
355
|
-
...(input.workspacePath === undefined ? {} : { workspacePath: input.workspacePath }),
|
|
356
|
-
...(parsed.sessionId === undefined ? {} : { sessionId: parsed.sessionId }),
|
|
357
|
-
}));
|
|
358
|
-
await emitRuntimeEvent(input.onRuntimeEvent, runnerRuntimeEvent({
|
|
359
|
-
type: 'agent.process.exited',
|
|
360
|
-
runId: input.runId,
|
|
361
|
-
projection: input.projection,
|
|
362
|
-
routing: input.routing,
|
|
363
|
-
cli: CURSOR_CLI_NAME,
|
|
364
|
-
model,
|
|
365
|
-
...(parsed.sessionId === undefined ? {} : { sessionId: parsed.sessionId }),
|
|
366
|
-
payload: { exitCode: result.exitCode, timedOut: result.timedOut },
|
|
367
|
-
}));
|
|
368
|
-
return {
|
|
369
|
-
result: parsed.result,
|
|
370
|
-
model,
|
|
371
|
-
cli: CURSOR_CLI_NAME,
|
|
372
|
-
...(parseRunnerResult(parsed.result).status === 'FAILED'
|
|
373
|
-
? { failureClass: 'task' }
|
|
374
|
-
: {}),
|
|
375
|
-
...(parsed.sessionId === undefined ? {} : { session_id: parsed.sessionId }),
|
|
376
|
-
...(parsed.tokenUsage === undefined ? {} : { tokenUsage: parsed.tokenUsage }),
|
|
377
|
-
metadata: {
|
|
378
|
-
stdout: result.stdout,
|
|
379
|
-
stderr: result.stderr,
|
|
380
|
-
raw: parsed,
|
|
381
|
-
skipApproval: stagePrompt.skipApproval,
|
|
382
|
-
allowAutoApproval: stagePrompt.allowAutoApproval,
|
|
383
|
-
...(promptTranscriptPath === undefined ? {} : { promptTranscriptPath }),
|
|
384
|
-
...(responseTranscriptPath === undefined ? {} : { responseTranscriptPath }),
|
|
385
|
-
...(sandboxLog?.metadata ?? {}),
|
|
386
|
-
},
|
|
387
|
-
};
|
|
388
|
-
},
|
|
389
|
-
async smoke() {
|
|
390
|
-
const result = await runAgentCliCommand({
|
|
391
|
-
command: options.command,
|
|
392
|
-
args: buildCursorAgentArgs({
|
|
393
|
-
model: options.settings.smokeModel,
|
|
394
|
-
prompt: options.settings.smokePrompt,
|
|
395
|
-
force: true,
|
|
396
|
-
}),
|
|
397
|
-
cwd: options.cwd,
|
|
398
|
-
});
|
|
399
|
-
let parsed;
|
|
400
|
-
if (result.exitCode === 0 && result.stdout.trim().length > 0) {
|
|
401
|
-
try {
|
|
402
|
-
parsed = extractCursorAgentResult(result.stdout);
|
|
403
|
-
}
|
|
404
|
-
catch {
|
|
405
|
-
parsed = undefined;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
return {
|
|
409
|
-
text: parsed?.result ?? '',
|
|
410
|
-
...(parsed?.sessionId === undefined ? {} : { sessionId: parsed.sessionId }),
|
|
411
|
-
stdout: result.stdout,
|
|
412
|
-
stderr: result.stderr,
|
|
413
|
-
exitCode: result.exitCode,
|
|
414
|
-
};
|
|
415
|
-
},
|
|
416
|
-
};
|
|
417
|
-
return runner;
|
|
418
|
-
}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
import { createInterface } from 'node:readline';
|
|
2
|
-
import { scrubSecrets } from '../../cli/sandbox-exec-logging.js';
|
|
3
|
-
function buildStopArgs(containerName, timeoutSeconds) {
|
|
4
|
-
return [
|
|
5
|
-
'stop',
|
|
6
|
-
...(timeoutSeconds !== undefined ? ['--time', String(timeoutSeconds)] : []),
|
|
7
|
-
containerName,
|
|
8
|
-
];
|
|
9
|
-
}
|
|
10
|
-
const DOCKER_LOG_MAX_SIZE = '10m';
|
|
11
|
-
const DOCKER_LOG_MAX_FILE = '3';
|
|
12
|
-
function buildRunArgs(input) {
|
|
13
|
-
return [
|
|
14
|
-
'run',
|
|
15
|
-
'-d',
|
|
16
|
-
'--log-opt',
|
|
17
|
-
`max-size=${DOCKER_LOG_MAX_SIZE}`,
|
|
18
|
-
'--log-opt',
|
|
19
|
-
`max-file=${DOCKER_LOG_MAX_FILE}`,
|
|
20
|
-
'--name',
|
|
21
|
-
input.containerName,
|
|
22
|
-
'-v',
|
|
23
|
-
`${input.wakeRoot}:${input.containerMountPath}`,
|
|
24
|
-
'-v',
|
|
25
|
-
`${input.containerHomeRoot}:${input.containerHomeMountPath}`,
|
|
26
|
-
...(input.extraMounts ?? []).flatMap((mount) => [
|
|
27
|
-
'-v',
|
|
28
|
-
`${mount.source}:${mount.target}${mount.readOnly === true ? ':ro' : ''}`,
|
|
29
|
-
]),
|
|
30
|
-
// Auto-started by wake sandbox-entrypoint; the UI binds 0.0.0.0 inside the
|
|
31
|
-
// container so this published port can reach it (127.0.0.1 inside the
|
|
32
|
-
// container would not be reachable via docker's port-forwarding NAT).
|
|
33
|
-
...(input.ui?.enabled === true
|
|
34
|
-
? [
|
|
35
|
-
'-p',
|
|
36
|
-
`127.0.0.1:${input.ui.port}:${input.ui.port}`,
|
|
37
|
-
'-e',
|
|
38
|
-
'WAKE_UI_ENABLED=true',
|
|
39
|
-
'-e',
|
|
40
|
-
`WAKE_UI_PORT=${input.ui.port}`,
|
|
41
|
-
...(input.ui.token !== undefined ? ['-e', `WAKE_UI_TOKEN=${input.ui.token}`] : []),
|
|
42
|
-
...(input.ui.tunnel?.enabled === true
|
|
43
|
-
? [
|
|
44
|
-
'-e',
|
|
45
|
-
'WAKE_UI_TUNNEL_ENABLED=true',
|
|
46
|
-
'-e',
|
|
47
|
-
input.ui.tunnel.authToken !== undefined
|
|
48
|
-
? `NGROK_AUTHTOKEN=${input.ui.tunnel.authToken}`
|
|
49
|
-
: 'NGROK_AUTHTOKEN',
|
|
50
|
-
]
|
|
51
|
-
: []),
|
|
52
|
-
]
|
|
53
|
-
: []),
|
|
54
|
-
...(input.start?.enabled === true ? ['-e', 'WAKE_START_ENABLED=true'] : []),
|
|
55
|
-
input.image,
|
|
56
|
-
];
|
|
57
|
-
}
|
|
58
|
-
export function createDockerCli(deps) {
|
|
59
|
-
return {
|
|
60
|
-
async inspectContainerImage(containerName) {
|
|
61
|
-
return (await deps.inspectContainerImage?.(containerName)) ?? null;
|
|
62
|
-
},
|
|
63
|
-
async build(input) {
|
|
64
|
-
const buildArgFlags = Object.entries(input.buildArgs ?? {}).flatMap(([key, value]) => [
|
|
65
|
-
'--build-arg',
|
|
66
|
-
`${key}=${value}`,
|
|
67
|
-
]);
|
|
68
|
-
await deps.run([
|
|
69
|
-
'build',
|
|
70
|
-
'-t',
|
|
71
|
-
input.image,
|
|
72
|
-
'-f',
|
|
73
|
-
input.dockerfile,
|
|
74
|
-
...buildArgFlags,
|
|
75
|
-
input.contextDir,
|
|
76
|
-
]);
|
|
77
|
-
},
|
|
78
|
-
async up(input) {
|
|
79
|
-
const imageExists = await deps.inspectImage(input.image);
|
|
80
|
-
if (!imageExists) {
|
|
81
|
-
throw new Error('Sandbox image not found. Run `wake sandbox build` first.');
|
|
82
|
-
}
|
|
83
|
-
const containerState = await deps.inspectContainer(input.containerName);
|
|
84
|
-
if (containerState === 'running') {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (containerState === 'stopped') {
|
|
88
|
-
await deps.run(['start', input.containerName]);
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
await deps.run(buildRunArgs(input));
|
|
92
|
-
},
|
|
93
|
-
async update(input) {
|
|
94
|
-
const imageExists = await deps.inspectImage(input.image);
|
|
95
|
-
if (!imageExists) {
|
|
96
|
-
throw new Error('Sandbox image not found. Run `wake sandbox build` first.');
|
|
97
|
-
}
|
|
98
|
-
const containerState = await deps.inspectContainer(input.containerName);
|
|
99
|
-
if (containerState === 'running' || containerState === 'stopped') {
|
|
100
|
-
if (containerState === 'running') {
|
|
101
|
-
await deps.run(buildStopArgs(input.containerName, input.stopTimeoutSeconds));
|
|
102
|
-
}
|
|
103
|
-
await deps.run(['rm', input.containerName]);
|
|
104
|
-
}
|
|
105
|
-
await deps.run(buildRunArgs(input));
|
|
106
|
-
},
|
|
107
|
-
async down(containerName, options) {
|
|
108
|
-
await deps.run(buildStopArgs(containerName, options?.timeoutSeconds));
|
|
109
|
-
},
|
|
110
|
-
async exec(containerName, command, options) {
|
|
111
|
-
const interactive = options?.interactive ?? false;
|
|
112
|
-
await deps.run(command.length > 0
|
|
113
|
-
? ['exec', interactive ? '-it' : '-i', containerName, ...command]
|
|
114
|
-
: ['exec', '-it', containerName, 'bash']);
|
|
115
|
-
},
|
|
116
|
-
/**
|
|
117
|
-
* Runs `docker exec -i <containerName> <command>` with piped (not
|
|
118
|
-
* inherited) stdio, line-buffers stdout/stderr, scrubs secrets from each
|
|
119
|
-
* line, and forwards it to the caller's handlers in real time. Used by
|
|
120
|
-
* `sandbox exec` so live output is observed and redacted on the host
|
|
121
|
-
* instead of being wrapped by a mounted in-container script.
|
|
122
|
-
*/
|
|
123
|
-
async execCaptured(containerName, command, handlers) {
|
|
124
|
-
if (deps.spawnExec === undefined) {
|
|
125
|
-
throw new Error('docker cli adapter was not configured with spawnExec');
|
|
126
|
-
}
|
|
127
|
-
const args = ['exec', '-i', containerName, ...command];
|
|
128
|
-
const child = deps.spawnExec(args);
|
|
129
|
-
const stdoutReader = createInterface({ input: child.stdout });
|
|
130
|
-
stdoutReader.on('line', (line) => handlers.onStdout(scrubSecrets(line)));
|
|
131
|
-
const stderrReader = createInterface({ input: child.stderr });
|
|
132
|
-
stderrReader.on('line', (line) => handlers.onStderr(scrubSecrets(line)));
|
|
133
|
-
await new Promise((resolveExec, reject) => {
|
|
134
|
-
child.on('error', reject);
|
|
135
|
-
child.on('close', (exitCode) => {
|
|
136
|
-
stdoutReader.close();
|
|
137
|
-
stderrReader.close();
|
|
138
|
-
if (exitCode === 0) {
|
|
139
|
-
resolveExec();
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
reject(new Error(`docker ${args.join(' ')} failed with exit code ${exitCode ?? 1}`));
|
|
143
|
-
});
|
|
144
|
-
});
|
|
145
|
-
},
|
|
146
|
-
async logs(containerName, tailLines) {
|
|
147
|
-
await deps.run(['logs', '--tail', String(tailLines), containerName]);
|
|
148
|
-
},
|
|
149
|
-
};
|
|
150
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Permanent test harness. `verifies` is the allowlist of URLs this fake
|
|
3
|
-
* treats as legitimate, mapped to the resourceUri they resolve to — anything
|
|
4
|
-
* not listed fails verification, exercising the "malformed claim" path.
|
|
5
|
-
*/
|
|
6
|
-
export function createFakeArtifactVerifier(options) {
|
|
7
|
-
const byUrl = new Map(options.verifies.map((entry) => [entry.url, entry.resourceUri]));
|
|
8
|
-
return {
|
|
9
|
-
async verify(artifact) {
|
|
10
|
-
const resourceUri = byUrl.get(artifact.url);
|
|
11
|
-
return resourceUri === undefined ? null : { resourceUri };
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { createEventEnvelope, createUnkeyedEventEnvelope } from '../../lib/event-log.js';
|
|
2
|
-
/** Permanent test harness — zero-token equivalent of the real GitHub PR activity source. */
|
|
3
|
-
export function createFakeGitHubPullRequestActivitySource(options) {
|
|
4
|
-
const now = options.now ?? (() => new Date());
|
|
5
|
-
return {
|
|
6
|
-
async pollEvents(input) {
|
|
7
|
-
const nowIso = now().toISOString();
|
|
8
|
-
const watched = new Set((input?.watch ?? []).map((ref) => ref.resourceUri));
|
|
9
|
-
const events = [];
|
|
10
|
-
for (const pr of options.prs) {
|
|
11
|
-
const resourceUri = `github:pr:${pr.repo}#${pr.number}`;
|
|
12
|
-
if (!watched.has(resourceUri)) {
|
|
13
|
-
events.push(createUnkeyedEventEnvelope({
|
|
14
|
-
eventId: `fake-pr-seen-${pr.repo}-${pr.number}`,
|
|
15
|
-
streamScope: 'global-intake',
|
|
16
|
-
direction: 'inbound',
|
|
17
|
-
sourceSystem: 'fake-github-pr',
|
|
18
|
-
sourceEventType: 'pr.seen',
|
|
19
|
-
sourceRefs: { repo: pr.repo, resourceUri },
|
|
20
|
-
occurredAt: nowIso,
|
|
21
|
-
ingestedAt: nowIso,
|
|
22
|
-
trigger: 'context-only',
|
|
23
|
-
payload: { pr: { number: pr.number, author: pr.author, headRef: pr.headRef } },
|
|
24
|
-
}));
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
for (const comment of pr.comments) {
|
|
28
|
-
events.push(createUnkeyedEventEnvelope({
|
|
29
|
-
eventId: `fake-pr-comment-${pr.repo}-${pr.number}-${comment.id}`,
|
|
30
|
-
streamScope: 'work-item',
|
|
31
|
-
direction: 'inbound',
|
|
32
|
-
sourceSystem: 'fake-github-pr',
|
|
33
|
-
sourceEventType: 'pr.comment.created',
|
|
34
|
-
sourceRefs: { repo: pr.repo, commentId: comment.id, resourceUri },
|
|
35
|
-
occurredAt: nowIso,
|
|
36
|
-
ingestedAt: nowIso,
|
|
37
|
-
trigger: 'context-only',
|
|
38
|
-
payload: {
|
|
39
|
-
comment: {
|
|
40
|
-
id: comment.id,
|
|
41
|
-
body: comment.body,
|
|
42
|
-
author: { login: comment.author },
|
|
43
|
-
createdAt: nowIso,
|
|
44
|
-
updatedAt: nowIso,
|
|
45
|
-
resourceUri,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
derivedHints: { botAuthoredComment: false },
|
|
49
|
-
}));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return events;
|
|
53
|
-
},
|
|
54
|
-
async deliverIntent(input) {
|
|
55
|
-
const publishedAt = now().toISOString();
|
|
56
|
-
return [
|
|
57
|
-
createEventEnvelope({
|
|
58
|
-
eventId: `${input.event.eventId}-published`,
|
|
59
|
-
workItemKey: input.event.workItemKey,
|
|
60
|
-
streamScope: 'work-item',
|
|
61
|
-
direction: 'outbound',
|
|
62
|
-
sourceSystem: 'fake-github-pr',
|
|
63
|
-
sourceEventType: 'pr.comment.reply.published',
|
|
64
|
-
sourceRefs: { ...input.event.sourceRefs, sink: 'fake-github-pr' },
|
|
65
|
-
occurredAt: publishedAt,
|
|
66
|
-
ingestedAt: publishedAt,
|
|
67
|
-
trigger: 'context-only',
|
|
68
|
-
payload: {
|
|
69
|
-
intentEventId: input.event.eventId,
|
|
70
|
-
kind: input.event.payload.kind,
|
|
71
|
-
body: input.event.payload.body,
|
|
72
|
-
},
|
|
73
|
-
}),
|
|
74
|
-
];
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* In-memory ResourceIndex test fake. Permanent test harness (per repo
|
|
3
|
-
* convention: fakes are passed on purpose, never a default that materializes
|
|
4
|
-
* when a caller forgets to wire one in), not a fallback baked into core/.
|
|
5
|
-
* Production always uses the disk-backed `createResourceIndex` from
|
|
6
|
-
* `src/adapters/fs/resource-index.ts`.
|
|
7
|
-
*/
|
|
8
|
-
export function createFakeResourceIndex() {
|
|
9
|
-
const entries = new Map();
|
|
10
|
-
return {
|
|
11
|
-
async resolve(resourceUri) {
|
|
12
|
-
return entries.get(resourceUri);
|
|
13
|
-
},
|
|
14
|
-
async register(resourceUri, workItemKey) {
|
|
15
|
-
entries.set(resourceUri, workItemKey);
|
|
16
|
-
},
|
|
17
|
-
async retract(resourceUri) {
|
|
18
|
-
entries.delete(resourceUri);
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
}
|