@atolis-hq/wake 0.2.97 → 0.3.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/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 +434 -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/templates/SETUP.md +7 -7
- 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/dist/src/{core → activities/pr}/contracts.js +0 -0
- /package/dist/src/{domain/types.js → control-plane/contracts/views.js} +0 -0
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export async function runDoctorCommand(config, deps) {
|
|
2
|
-
const failures = [...(await deps.collectPreflightFailures(config))];
|
|
3
|
-
const notices = [];
|
|
4
|
-
if (config.sources.github.enabled) {
|
|
5
|
-
try {
|
|
6
|
-
await deps.resolveGitHubToken();
|
|
7
|
-
}
|
|
8
|
-
catch (error) {
|
|
9
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
10
|
-
failures.push(`GitHub token could not be resolved: ${message}`);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
if (await deps.hasDockerfile(deps.wakeRoot)) {
|
|
14
|
-
const reachable = await deps.dockerReachable();
|
|
15
|
-
if (!reachable) {
|
|
16
|
-
failures.push('Docker daemon is not reachable');
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
const imageExists = await deps.inspectImage(deps.image);
|
|
20
|
-
if (!imageExists) {
|
|
21
|
-
failures.push(`sandbox image "${deps.image}" not found — run \`wake sandbox build\``);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
try {
|
|
26
|
-
if (await deps.containerRunning()) {
|
|
27
|
-
const sandboxVersion = await deps.execVersionInContainer();
|
|
28
|
-
if (sandboxVersion !== '' && sandboxVersion !== deps.installedVersion) {
|
|
29
|
-
notices.push(`sandbox is running version ${sandboxVersion}, installed CLI is ${deps.installedVersion} — run \`wake sandbox build && wake sandbox update\` to sync`);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
catch (error) {
|
|
34
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
35
|
-
notices.push(`could not check sandbox version: ${message}`);
|
|
36
|
-
}
|
|
37
|
-
try {
|
|
38
|
-
const driftedFiles = await deps.diffPromptsAndDockerfile();
|
|
39
|
-
for (const file of driftedFiles) {
|
|
40
|
-
notices.push(`${file} differs from the currently-shipped default (not auto-overwritten)`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
catch (error) {
|
|
44
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
45
|
-
notices.push(`could not check prompt/Dockerfile drift: ${message}`);
|
|
46
|
-
}
|
|
47
|
-
return { failures, notices };
|
|
48
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { resolve } from 'node:path';
|
|
2
|
-
import { assertEmptyDirectory, scaffoldWakeHome } from './scaffold-assets.js';
|
|
3
|
-
export async function runInitCommand(input) {
|
|
4
|
-
const positionalArgs = input.args.filter((arg) => arg !== '--dev' && arg !== '--packaged');
|
|
5
|
-
const wakeRoot = resolve(input.cwd, positionalArgs[0] ?? '.');
|
|
6
|
-
const devModeOverride = input.args.includes('--dev')
|
|
7
|
-
? 'source'
|
|
8
|
-
: input.args.includes('--packaged')
|
|
9
|
-
? 'packaged'
|
|
10
|
-
: undefined;
|
|
11
|
-
await assertEmptyDirectory(wakeRoot);
|
|
12
|
-
await scaffoldWakeHome({
|
|
13
|
-
wakeRoot,
|
|
14
|
-
repoRoot: input.repoRoot,
|
|
15
|
-
...(devModeOverride === undefined ? {} : { devModeOverride }),
|
|
16
|
-
});
|
|
17
|
-
return { wakeRoot };
|
|
18
|
-
}
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import { access, mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
|
-
import { posix, resolve } from 'node:path';
|
|
3
|
-
import { createRunnerCliAdapter } from '../adapters/runner/runner-cli-adapter.js';
|
|
4
|
-
import { runSandboxResumeCommand } from './sandbox-resume.js';
|
|
5
|
-
import { runSelfUpdateCommand, runSelfUpdateLoop } from './self-update-command.js';
|
|
6
|
-
import { runStopCommand } from './stop-command.js';
|
|
7
|
-
import { resolveWakeVersion, wakeVersion } from '../version.js';
|
|
8
|
-
async function ensureDockerfile(input) {
|
|
9
|
-
const targetPath = resolve(input.wakeRoot, 'docker', 'Dockerfile');
|
|
10
|
-
try {
|
|
11
|
-
await access(targetPath);
|
|
12
|
-
return; // already present — user-owned, never overwritten
|
|
13
|
-
}
|
|
14
|
-
catch {
|
|
15
|
-
// fall through to write it
|
|
16
|
-
}
|
|
17
|
-
const mode = input.devMode ?? 'packaged';
|
|
18
|
-
const templatePath = resolve(input.packagedTemplatesRoot, mode === 'source' ? 'Dockerfile' : 'Dockerfile.packaged');
|
|
19
|
-
const content = await readFile(templatePath, 'utf8');
|
|
20
|
-
await mkdir(resolve(input.wakeRoot, 'docker'), { recursive: true });
|
|
21
|
-
await writeFile(targetPath, content, 'utf8');
|
|
22
|
-
}
|
|
23
|
-
async function ensureContainerHomeMountParents(input) {
|
|
24
|
-
for (const mount of input.extraMounts) {
|
|
25
|
-
const relativeTarget = posix.relative(input.containerHomeMountPath, mount.target);
|
|
26
|
-
if (relativeTarget.length === 0 || relativeTarget === '.' || relativeTarget.startsWith('..')) {
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
const parentRelativeTarget = posix.dirname(relativeTarget);
|
|
30
|
-
await mkdir(resolve(input.containerHomeRoot, parentRelativeTarget), {
|
|
31
|
-
recursive: true,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
const sandboxSubcommands = [
|
|
36
|
-
['build', 'Generate docker/Dockerfile (if missing) and build the sandbox image'],
|
|
37
|
-
['up', 'Start the sandbox container'],
|
|
38
|
-
['update', 'Recreate the sandbox container from the current image'],
|
|
39
|
-
['down', 'Stop and remove the sandbox container'],
|
|
40
|
-
['stop', 'Stop the resident loop gracefully, then the container'],
|
|
41
|
-
['self-update', 'Pull the latest tag and rebuild (source dev.mode only)'],
|
|
42
|
-
['setup', 'Run interactive first-time setup inside the container'],
|
|
43
|
-
['exec', 'Run a command inside the sandbox container'],
|
|
44
|
-
['logs', 'Print sandbox container logs'],
|
|
45
|
-
['resume', 'Resume a previous agent session inside the sandbox'],
|
|
46
|
-
];
|
|
47
|
-
export function printSandboxUsage(stream) {
|
|
48
|
-
const width = Math.max(...sandboxSubcommands.map(([name]) => name.length));
|
|
49
|
-
stream.write([
|
|
50
|
-
'Usage: wake sandbox <subcommand>',
|
|
51
|
-
'',
|
|
52
|
-
'Subcommands:',
|
|
53
|
-
...sandboxSubcommands.map(([name, description]) => ` ${name.padEnd(width)} ${description}`),
|
|
54
|
-
'',
|
|
55
|
-
].join('\n'));
|
|
56
|
-
}
|
|
57
|
-
function readFlag(name, args) {
|
|
58
|
-
const index = args.indexOf(name);
|
|
59
|
-
if (index === -1) {
|
|
60
|
-
return undefined;
|
|
61
|
-
}
|
|
62
|
-
return args[index + 1];
|
|
63
|
-
}
|
|
64
|
-
function uiDockerInput(config) {
|
|
65
|
-
return {
|
|
66
|
-
enabled: config.ui.enabled,
|
|
67
|
-
port: config.ui.port,
|
|
68
|
-
token: config.ui.token,
|
|
69
|
-
tunnel: config.ui.tunnel,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
function startDockerInput(config) {
|
|
73
|
-
return {
|
|
74
|
-
enabled: config.sandbox.start.enabled,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
export async function runSandboxCommand(input) {
|
|
78
|
-
const subcommand = input.args[0];
|
|
79
|
-
if (subcommand === undefined ||
|
|
80
|
-
subcommand === '--help' ||
|
|
81
|
-
subcommand === '-h' ||
|
|
82
|
-
subcommand === 'help') {
|
|
83
|
-
printSandboxUsage(process.stdout);
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (subcommand === 'build') {
|
|
87
|
-
const repoRoot = input.config.dev?.repoRoot;
|
|
88
|
-
if (repoRoot === undefined || repoRoot.length === 0) {
|
|
89
|
-
throw new Error('Sandbox build requires config.dev.repoRoot');
|
|
90
|
-
}
|
|
91
|
-
const effectiveDevMode = input.config.dev?.mode ?? 'packaged';
|
|
92
|
-
const buildVersion = effectiveDevMode === 'source' ? resolveWakeVersion({ repoRoot }) : wakeVersion;
|
|
93
|
-
await ensureDockerfile({
|
|
94
|
-
wakeRoot: input.wakeRoot,
|
|
95
|
-
devMode: effectiveDevMode,
|
|
96
|
-
packagedTemplatesRoot: input.packagedTemplatesRoot,
|
|
97
|
-
});
|
|
98
|
-
await input.docker.build({
|
|
99
|
-
image: input.config.sandbox.image,
|
|
100
|
-
dockerfile: resolve(input.wakeRoot, 'docker', 'Dockerfile'),
|
|
101
|
-
contextDir: repoRoot,
|
|
102
|
-
buildArgs: effectiveDevMode === 'packaged'
|
|
103
|
-
? { WAKE_VERSION: buildVersion }
|
|
104
|
-
: { WAKE_BUILD_TAG: buildVersion },
|
|
105
|
-
});
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
if (subcommand === 'up') {
|
|
109
|
-
await ensureContainerHomeMountParents({
|
|
110
|
-
containerHomeRoot: input.containerHomeRoot,
|
|
111
|
-
containerHomeMountPath: input.config.sandbox.containerHomeMountPath,
|
|
112
|
-
extraMounts: input.config.sandbox.extraMounts,
|
|
113
|
-
});
|
|
114
|
-
await input.docker.up({
|
|
115
|
-
image: input.config.sandbox.image,
|
|
116
|
-
containerName: input.config.sandbox.containerName,
|
|
117
|
-
wakeRoot: input.wakeRoot,
|
|
118
|
-
containerHomeRoot: input.containerHomeRoot,
|
|
119
|
-
containerMountPath: input.config.sandbox.containerMountPath,
|
|
120
|
-
containerHomeMountPath: input.config.sandbox.containerHomeMountPath,
|
|
121
|
-
extraMounts: input.config.sandbox.extraMounts,
|
|
122
|
-
ui: uiDockerInput(input.config),
|
|
123
|
-
start: startDockerInput(input.config),
|
|
124
|
-
});
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
if (subcommand === 'update') {
|
|
128
|
-
await ensureContainerHomeMountParents({
|
|
129
|
-
containerHomeRoot: input.containerHomeRoot,
|
|
130
|
-
containerHomeMountPath: input.config.sandbox.containerHomeMountPath,
|
|
131
|
-
extraMounts: input.config.sandbox.extraMounts,
|
|
132
|
-
});
|
|
133
|
-
await input.docker.update({
|
|
134
|
-
image: input.config.sandbox.image,
|
|
135
|
-
containerName: input.config.sandbox.containerName,
|
|
136
|
-
wakeRoot: input.wakeRoot,
|
|
137
|
-
containerHomeRoot: input.containerHomeRoot,
|
|
138
|
-
containerMountPath: input.config.sandbox.containerMountPath,
|
|
139
|
-
containerHomeMountPath: input.config.sandbox.containerHomeMountPath,
|
|
140
|
-
extraMounts: input.config.sandbox.extraMounts,
|
|
141
|
-
ui: uiDockerInput(input.config),
|
|
142
|
-
start: startDockerInput(input.config),
|
|
143
|
-
});
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
if (subcommand === 'down') {
|
|
147
|
-
await input.docker.down(input.config.sandbox.containerName);
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
if (subcommand === 'stop') {
|
|
151
|
-
await runStopCommand({
|
|
152
|
-
args: input.args.slice(1),
|
|
153
|
-
stateStore: input.stateStore,
|
|
154
|
-
...(input.recoverActiveRuns === undefined
|
|
155
|
-
? {}
|
|
156
|
-
: { recoverActiveRuns: input.recoverActiveRuns }),
|
|
157
|
-
docker: input.docker,
|
|
158
|
-
containerName: input.config.sandbox.containerName,
|
|
159
|
-
sleep: input.sleep,
|
|
160
|
-
logger: input.logger,
|
|
161
|
-
});
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
if (subcommand === 'self-update') {
|
|
165
|
-
const repoRoot = input.config.dev?.repoRoot;
|
|
166
|
-
if (repoRoot === undefined || repoRoot.length === 0) {
|
|
167
|
-
throw new Error('Sandbox self-update requires config.dev.repoRoot');
|
|
168
|
-
}
|
|
169
|
-
if (input.selfUpdate === undefined) {
|
|
170
|
-
throw new Error('Sandbox self-update requires dev.mode: "source". For a packaged install, update instead with:\n' +
|
|
171
|
-
' npm install -g @atolis-hq/wake@latest && wake sandbox build && wake sandbox update');
|
|
172
|
-
}
|
|
173
|
-
const selfUpdateArgs = input.args.slice(1);
|
|
174
|
-
const runSelfUpdate = selfUpdateArgs.includes('--loop')
|
|
175
|
-
? runSelfUpdateLoop
|
|
176
|
-
: runSelfUpdateCommand;
|
|
177
|
-
await runSelfUpdate({
|
|
178
|
-
args: selfUpdateArgs,
|
|
179
|
-
repoRoot,
|
|
180
|
-
imageRepository: input.config.sandbox.imageRepository,
|
|
181
|
-
containerName: input.config.sandbox.containerName,
|
|
182
|
-
stateStore: input.stateStore,
|
|
183
|
-
...(input.recoverActiveRuns === undefined
|
|
184
|
-
? {}
|
|
185
|
-
: { recoverActiveRuns: input.recoverActiveRuns }),
|
|
186
|
-
docker: input.docker,
|
|
187
|
-
git: input.selfUpdate.git,
|
|
188
|
-
issueReporter: input.selfUpdate.issueReporter,
|
|
189
|
-
readLedger: input.selfUpdate.readLedger,
|
|
190
|
-
writeLedger: input.selfUpdate.writeLedger,
|
|
191
|
-
sleep: input.sleep,
|
|
192
|
-
logger: {
|
|
193
|
-
info: input.logger.info,
|
|
194
|
-
error: input.logger.error ?? input.logger.info,
|
|
195
|
-
},
|
|
196
|
-
wakeRoot: input.wakeRoot,
|
|
197
|
-
containerHomeRoot: input.containerHomeRoot,
|
|
198
|
-
containerMountPath: input.config.sandbox.containerMountPath,
|
|
199
|
-
containerHomeMountPath: input.config.sandbox.containerHomeMountPath,
|
|
200
|
-
dockerfilePath: resolve(repoRoot, 'docker', 'Dockerfile'),
|
|
201
|
-
ui: uiDockerInput(input.config),
|
|
202
|
-
start: startDockerInput(input.config),
|
|
203
|
-
});
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
if (subcommand === 'setup') {
|
|
207
|
-
const setupCommand = input.config.dev?.mode === 'source'
|
|
208
|
-
? ['node', '/app/dist/src/main.js', 'sandbox-setup']
|
|
209
|
-
: ['wake', 'sandbox-setup'];
|
|
210
|
-
await input.docker.exec(input.config.sandbox.containerName, setupCommand, {
|
|
211
|
-
interactive: true,
|
|
212
|
-
});
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
if (subcommand === 'exec') {
|
|
216
|
-
const commandArgs = input.args.slice(1);
|
|
217
|
-
const wrappedCommand = commandArgs[0] === '--' ? commandArgs.slice(1) : commandArgs;
|
|
218
|
-
if (wrappedCommand.length === 0) {
|
|
219
|
-
// No command given: drop into an interactive shell with a real TTY,
|
|
220
|
-
// same as `docker exec -it ... bash`. That's a genuine interactive
|
|
221
|
-
// use case, so it stays on the inherited-stdio path rather than the
|
|
222
|
-
// piped/scrubbed one below (which would break TTY behavior).
|
|
223
|
-
await input.docker.exec(input.config.sandbox.containerName, []);
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
await input.docker.execCaptured(input.config.sandbox.containerName, wrappedCommand, {
|
|
227
|
-
onStdout: (line) => input.logger.info(line),
|
|
228
|
-
onStderr: (line) => (input.logger.error ?? input.logger.info)(line),
|
|
229
|
-
});
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
if (subcommand === 'logs') {
|
|
233
|
-
const tailLines = Number.parseInt(readFlag('--tail', input.args) ?? '200', 10);
|
|
234
|
-
await input.docker.logs(input.config.sandbox.containerName, Number.isFinite(tailLines) && tailLines > 0 ? tailLines : 200);
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
if (subcommand === 'resume') {
|
|
238
|
-
const realEntry = Object.values(input.config.runners).find((e) => e.kind !== 'fake');
|
|
239
|
-
if (realEntry === undefined) {
|
|
240
|
-
throw new Error('Sandbox resume requires a real runner entry (`claude` or `codex`) in config.runners.');
|
|
241
|
-
}
|
|
242
|
-
const runnerAdapter = createRunnerCliAdapter({
|
|
243
|
-
entry: realEntry,
|
|
244
|
-
cwd: process.cwd(),
|
|
245
|
-
});
|
|
246
|
-
await runSandboxResumeCommand({
|
|
247
|
-
args: input.args.slice(1),
|
|
248
|
-
config: input.config,
|
|
249
|
-
docker: input.docker,
|
|
250
|
-
wakeRoot: input.wakeRoot,
|
|
251
|
-
containerHomeRoot: input.containerHomeRoot,
|
|
252
|
-
buildResumeCommand: runnerAdapter.buildResumeCommand,
|
|
253
|
-
logger: input.logger,
|
|
254
|
-
});
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
throw new Error(`Unknown sandbox command: ${subcommand}`.trimEnd());
|
|
258
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { createWakePaths } from '../lib/paths.js';
|
|
2
|
-
// The entrypoint always runs against the fixed in-container mount point
|
|
3
|
-
// (/wake), so a literal wakeRoot here is safe.
|
|
4
|
-
const CONTROL_PLANE_UI_URL_FILE = createWakePaths('/wake').controlPlaneUiUrlFile;
|
|
5
|
-
const DEFAULT_UI_PORT = '4317';
|
|
6
|
-
const DEFAULT_START_RESTART_DELAY_SECONDS = 10;
|
|
7
|
-
/**
|
|
8
|
-
* Resolves how to invoke the wake CLI from inside the container.
|
|
9
|
-
*
|
|
10
|
-
* Source-mode images (docker/Dockerfile) bake `WAKE_MAIN_JS` at build time,
|
|
11
|
-
* pointing at the compiled entrypoint under /app. Packaged-mode images
|
|
12
|
-
* (docker/Dockerfile.packaged) have no /app directory at all — the CLI is
|
|
13
|
-
* installed globally via npm and exposed as a `wake` binary on PATH, so the
|
|
14
|
-
* absence of WAKE_MAIN_JS is the signal to invoke it bare.
|
|
15
|
-
*/
|
|
16
|
-
function resolveWakeInvocation(env) {
|
|
17
|
-
const mainJs = env.WAKE_MAIN_JS;
|
|
18
|
-
return mainJs !== undefined
|
|
19
|
-
? { command: 'node', argsPrefix: [mainJs] }
|
|
20
|
-
: { command: 'wake', argsPrefix: [] };
|
|
21
|
-
}
|
|
22
|
-
async function discoverAndWriteNgrokUrl(deps) {
|
|
23
|
-
await deps.removeFile(CONTROL_PLANE_UI_URL_FILE);
|
|
24
|
-
const publicUrl = await deps.discoverNgrokUrl();
|
|
25
|
-
if (publicUrl !== undefined) {
|
|
26
|
-
await deps.writeFile(CONTROL_PLANE_UI_URL_FILE, `${publicUrl}\n`);
|
|
27
|
-
deps.log(`wake ui: ngrok tunnel available at ${publicUrl}`);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
deps.log('wake ui: ngrok tunnel started but public URL was not discovered; see /wake/.wake/logs/ngrok.log');
|
|
31
|
-
}
|
|
32
|
-
async function superviseWakeStart(deps, restartDelaySeconds) {
|
|
33
|
-
for (;;) {
|
|
34
|
-
deps.log('wake start: starting resident loop');
|
|
35
|
-
const { command, argsPrefix } = resolveWakeInvocation(deps.env);
|
|
36
|
-
// --no-sandbox: this already IS the sandbox — docker/Dockerfile is
|
|
37
|
-
// bind-mounted at /wake, so without this the process's own
|
|
38
|
-
// dispatchMainCommand would see it and try to auto-delegate into
|
|
39
|
-
// `docker exec`, which doesn't exist inside the container itself.
|
|
40
|
-
const { pid } = deps.spawnDetached(command, [...argsPrefix, 'start', '--wake-root', '/wake', '--no-sandbox'], { logFile: '/wake/.wake/logs/start.log' });
|
|
41
|
-
await deps.writeFile('/wake/.wake/logs/start.pid', String(pid));
|
|
42
|
-
const exitCode = await deps.waitForExit(pid);
|
|
43
|
-
deps.log(`wake start: resident loop exited with status ${exitCode}; restarting in ${restartDelaySeconds}s`);
|
|
44
|
-
await deps.sleep(restartDelaySeconds * 1000);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
export async function runSandboxEntrypointCommand(deps) {
|
|
48
|
-
const { env } = deps;
|
|
49
|
-
await deps.ensureDir('/wake/.wake/logs');
|
|
50
|
-
if (env.WAKE_UI_ENABLED === 'true') {
|
|
51
|
-
const port = env.WAKE_UI_PORT ?? DEFAULT_UI_PORT;
|
|
52
|
-
deps.log(`wake ui: starting on 0.0.0.0:${port}`);
|
|
53
|
-
const { command, argsPrefix } = resolveWakeInvocation(env);
|
|
54
|
-
// --no-sandbox: same reason as the `wake start` spawn below — without
|
|
55
|
-
// it, this process would try to `docker exec` itself from inside the
|
|
56
|
-
// container it's already running in.
|
|
57
|
-
const uiArgs = [
|
|
58
|
-
...argsPrefix,
|
|
59
|
-
'ui',
|
|
60
|
-
'--wake-root',
|
|
61
|
-
'/wake',
|
|
62
|
-
'--host',
|
|
63
|
-
'0.0.0.0',
|
|
64
|
-
'--port',
|
|
65
|
-
port,
|
|
66
|
-
'--no-sandbox',
|
|
67
|
-
];
|
|
68
|
-
if (env.WAKE_UI_TOKEN) {
|
|
69
|
-
uiArgs.push('--token', env.WAKE_UI_TOKEN);
|
|
70
|
-
}
|
|
71
|
-
deps.spawnDetached(command, uiArgs, { logFile: '/wake/.wake/logs/ui.log' });
|
|
72
|
-
if (env.WAKE_UI_TUNNEL_ENABLED === 'true') {
|
|
73
|
-
if (env.NGROK_AUTHTOKEN) {
|
|
74
|
-
const { pid } = deps.spawnDetached('ngrok', ['config', 'add-authtoken', env.NGROK_AUTHTOKEN], { logFile: '/wake/.wake/logs/ngrok.log' });
|
|
75
|
-
await deps.waitForExit(pid);
|
|
76
|
-
}
|
|
77
|
-
deps.log(`wake ui: starting ngrok tunnel for 127.0.0.1:${port}`);
|
|
78
|
-
deps.spawnDetached('ngrok', ['http', `127.0.0.1:${port}`, '--log=stdout'], {
|
|
79
|
-
logFile: '/wake/.wake/logs/ngrok.log',
|
|
80
|
-
});
|
|
81
|
-
void discoverAndWriteNgrokUrl(deps);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
if (env.WAKE_START_ENABLED === 'true') {
|
|
85
|
-
const restartDelaySeconds = Number(env.WAKE_START_RESTART_DELAY_SECONDS ?? DEFAULT_START_RESTART_DELAY_SECONDS);
|
|
86
|
-
void superviseWakeStart(deps, restartDelaySeconds);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
const ENV_SECRET_PATTERN = /([A-Za-z0-9_]*(?:TOKEN|SECRET|PASSWORD|PASS|KEY)[A-Za-z0-9_]*=)[^\s]+/gi;
|
|
2
|
-
const GITHUB_TOKEN_PATTERN = /(?:gho|ghp|github_pat)_[A-Za-z0-9_]+/g;
|
|
3
|
-
export function scrubSecrets(line) {
|
|
4
|
-
return line
|
|
5
|
-
.replace(ENV_SECRET_PATTERN, '$1[REDACTED]')
|
|
6
|
-
.replace(GITHUB_TOKEN_PATTERN, '[REDACTED]');
|
|
7
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { stdin as input, stdout as output } from 'node:process';
|
|
2
|
-
import { createInterface } from 'node:readline/promises';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { listRunRecords } from '../adapters/fs/state-store.js';
|
|
5
|
-
function shellQuote(value) {
|
|
6
|
-
return `'${value.replaceAll("'", `'\\''`)}'`;
|
|
7
|
-
}
|
|
8
|
-
function buildCwdWrappedShellCommand(cwd, command) {
|
|
9
|
-
const shellCommand = `cd ${shellQuote(cwd)} && ${command.map(shellQuote).join(' ')}`;
|
|
10
|
-
return ['sh', '-c', shellCommand];
|
|
11
|
-
}
|
|
12
|
-
function readFlag(name, args) {
|
|
13
|
-
const index = args.indexOf(name);
|
|
14
|
-
if (index === -1) {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
return args[index + 1];
|
|
18
|
-
}
|
|
19
|
-
function compareRunRecordsDescending(left, right) {
|
|
20
|
-
const leftTimestamp = left.finishedAt ?? left.startedAt;
|
|
21
|
-
const rightTimestamp = right.finishedAt ?? right.startedAt;
|
|
22
|
-
return rightTimestamp.localeCompare(leftTimestamp);
|
|
23
|
-
}
|
|
24
|
-
export async function promptResumeSelection(options) {
|
|
25
|
-
if (options.length === 0) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
for (const [index, option] of options.entries()) {
|
|
29
|
-
output.write(`${index + 1}. ${option.label}\n`);
|
|
30
|
-
}
|
|
31
|
-
const rl = createInterface({ input, output });
|
|
32
|
-
try {
|
|
33
|
-
const answer = (await rl.question('Select a resume target: ')).trim();
|
|
34
|
-
const selection = Number.parseInt(answer, 10);
|
|
35
|
-
if (!Number.isInteger(selection) || selection < 1 || selection > options.length) {
|
|
36
|
-
return null;
|
|
37
|
-
}
|
|
38
|
-
return options[selection - 1] ?? null;
|
|
39
|
-
}
|
|
40
|
-
finally {
|
|
41
|
-
rl.close();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export async function chooseResumeTarget(input) {
|
|
45
|
-
const options = (await listRunRecords(input.wakeRoot))
|
|
46
|
-
.filter((record) => record.sessionId !== undefined)
|
|
47
|
-
.sort(compareRunRecordsDescending)
|
|
48
|
-
.map((record) => ({
|
|
49
|
-
label: `${record.repo}#${record.issueNumber} · ${record.action} · ${record.finishedAt ?? record.startedAt}`,
|
|
50
|
-
value: {
|
|
51
|
-
sessionId: record.sessionId,
|
|
52
|
-
workspacePath: join(input.wakeRoot, 'workspaces', record.repo.replace(/[\\/]/g, '__'), String(record.issueNumber)),
|
|
53
|
-
},
|
|
54
|
-
}));
|
|
55
|
-
const selected = await input.select(options);
|
|
56
|
-
return selected?.value ?? null;
|
|
57
|
-
}
|
|
58
|
-
export async function runSandboxResumeCommand(input) {
|
|
59
|
-
const sessionId = input.args[0];
|
|
60
|
-
const explicitCwd = readFlag('--cwd', input.args);
|
|
61
|
-
const target = sessionId !== undefined
|
|
62
|
-
? explicitCwd === undefined
|
|
63
|
-
? null
|
|
64
|
-
: { sessionId, workspacePath: explicitCwd }
|
|
65
|
-
: await chooseResumeTarget({
|
|
66
|
-
wakeRoot: input.wakeRoot,
|
|
67
|
-
select: input.select ?? promptResumeSelection,
|
|
68
|
-
});
|
|
69
|
-
if (target === null) {
|
|
70
|
-
if (sessionId !== undefined && explicitCwd === undefined) {
|
|
71
|
-
throw new Error('Sandbox resume requires --cwd when a session ID is provided.');
|
|
72
|
-
}
|
|
73
|
-
throw new Error('No resumable sandbox session selected.');
|
|
74
|
-
}
|
|
75
|
-
await input.docker.execCaptured(input.config.sandbox.containerName, buildCwdWrappedShellCommand(target.workspacePath, input.buildResumeCommand({ sessionId: target.sessionId })), {
|
|
76
|
-
onStdout: (line) => input.logger.info(line),
|
|
77
|
-
onStderr: (line) => (input.logger.error ?? input.logger.info)(line),
|
|
78
|
-
});
|
|
79
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export async function runSandboxSetupCommand(deps) {
|
|
2
|
-
deps.log('Wake sandbox setup starting.');
|
|
3
|
-
await deps.prepareCodexHome();
|
|
4
|
-
await deps.ensureSshKey();
|
|
5
|
-
if (await deps.prompt('Configure GitHub auth? [y/N]')) {
|
|
6
|
-
deps.log('Optional best practice: sign in with a dedicated GitHub identity for Wake-managed agent work, rather than your main personal account. Make sure it has only the repository access Wake needs.');
|
|
7
|
-
await deps.runInteractive('gh', ['auth', 'login']);
|
|
8
|
-
await deps.runInteractive('gh', ['auth', 'setup-git']);
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
deps.log('Skipping GitHub auth setup.');
|
|
12
|
-
}
|
|
13
|
-
if (await deps.prompt('Configure Claude auth? [y/N]')) {
|
|
14
|
-
await deps.runInteractive('claude', ['auth', 'login', '--claudeai']);
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
deps.log('Skipping Claude auth setup.');
|
|
18
|
-
}
|
|
19
|
-
if (await deps.prompt('Configure Codex auth? [y/N]')) {
|
|
20
|
-
await deps.runInteractive('codex', ['login', '--device-auth']);
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
deps.log('Skipping Codex auth setup.');
|
|
24
|
-
}
|
|
25
|
-
if (await deps.prompt('Configure Cursor auth? [y/N]')) {
|
|
26
|
-
await deps.runInteractive('agent', ['login']);
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
deps.log('Skipping Cursor auth setup.');
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { access, chmod, copyFile, mkdir, readFile, readdir, writeFile } from 'node:fs/promises';
|
|
2
|
-
import { basename, dirname, join, resolve } from 'node:path';
|
|
3
|
-
import { createDefaultWakeConfig } from '../config/defaults.js';
|
|
4
|
-
import { splitWakeConfig } from '../config/split-config.js';
|
|
5
|
-
import { writeYamlFile } from '../lib/yaml-file.js';
|
|
6
|
-
import { createWakePaths } from '../lib/paths.js';
|
|
7
|
-
async function listPromptFileNames(repoRoot) {
|
|
8
|
-
const entries = await readdir(join(repoRoot, 'prompts'));
|
|
9
|
-
return entries.filter((name) => name.endsWith('.md')).sort();
|
|
10
|
-
}
|
|
11
|
-
function sanitizeContainerName(name) {
|
|
12
|
-
const sanitized = name
|
|
13
|
-
.toLowerCase()
|
|
14
|
-
.replace(/[^a-z0-9_.-]+/g, '-')
|
|
15
|
-
.replace(/-+/g, '-')
|
|
16
|
-
.replace(/^[-._]+|[-._]+$/g, '');
|
|
17
|
-
return sanitized.length > 0 ? sanitized : 'wake';
|
|
18
|
-
}
|
|
19
|
-
export async function detectDevMode(repoRoot) {
|
|
20
|
-
try {
|
|
21
|
-
await access(join(repoRoot, 'src', 'main.ts'));
|
|
22
|
-
await access(join(repoRoot, 'tsconfig.json'));
|
|
23
|
-
return 'source';
|
|
24
|
-
}
|
|
25
|
-
catch {
|
|
26
|
-
return 'packaged';
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export async function assertEmptyDirectory(targetDir) {
|
|
30
|
-
try {
|
|
31
|
-
const entries = await readdir(targetDir);
|
|
32
|
-
if (entries.length > 0) {
|
|
33
|
-
throw new Error(`wake init requires an empty directory: ${targetDir}`);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
const code = error.code;
|
|
38
|
-
if (code === 'ENOENT') {
|
|
39
|
-
await mkdir(targetDir, { recursive: true });
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
throw error;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
async function copyAssets(repoRoot, sourceDir, targetDir, fileNames) {
|
|
46
|
-
await mkdir(targetDir, { recursive: true });
|
|
47
|
-
await Promise.all(fileNames.map(async (fileName) => {
|
|
48
|
-
const sourceFile = join(repoRoot, sourceDir, fileName);
|
|
49
|
-
const targetFile = join(targetDir, fileName);
|
|
50
|
-
await mkdir(dirname(targetFile), { recursive: true });
|
|
51
|
-
if (fileName.endsWith('.sh')) {
|
|
52
|
-
const script = await readFile(sourceFile, 'utf8');
|
|
53
|
-
await writeFile(targetFile, script.replaceAll('\r\n', '\n'), 'utf8');
|
|
54
|
-
await chmod(targetFile, 0o755);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
await copyFile(sourceFile, targetFile);
|
|
58
|
-
}));
|
|
59
|
-
}
|
|
60
|
-
export async function scaffoldWakeHome(input) {
|
|
61
|
-
const wakeRoot = resolve(input.wakeRoot);
|
|
62
|
-
const repoRoot = resolve(input.repoRoot);
|
|
63
|
-
const devMode = input.devModeOverride ?? (await detectDevMode(repoRoot));
|
|
64
|
-
const defaults = createDefaultWakeConfig(wakeRoot);
|
|
65
|
-
const config = {
|
|
66
|
-
...defaults,
|
|
67
|
-
sandbox: {
|
|
68
|
-
...defaults.sandbox,
|
|
69
|
-
containerName: `wake-sandbox-${sanitizeContainerName(basename(wakeRoot))}`,
|
|
70
|
-
},
|
|
71
|
-
dev: {
|
|
72
|
-
repoRoot,
|
|
73
|
-
mode: devMode,
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
const paths = createWakePaths(wakeRoot);
|
|
77
|
-
const runtimeDirectories = [
|
|
78
|
-
paths.dataRoot,
|
|
79
|
-
join(paths.dataRoot, 'events'),
|
|
80
|
-
join(paths.dataRoot, 'state'),
|
|
81
|
-
join(paths.dataRoot, 'runs'),
|
|
82
|
-
join(paths.dataRoot, 'sources'),
|
|
83
|
-
join(paths.dataRoot, 'repos'),
|
|
84
|
-
join(paths.dataRoot, 'locks'),
|
|
85
|
-
join(paths.dataRoot, 'logs'),
|
|
86
|
-
join(paths.dataRoot, 'control'),
|
|
87
|
-
join(paths.dataRoot, 'container-home'),
|
|
88
|
-
join(paths.dataRoot, 'transcripts'),
|
|
89
|
-
paths.workspaceRoot,
|
|
90
|
-
];
|
|
91
|
-
await Promise.all(runtimeDirectories.map((directoryPath) => mkdir(directoryPath, { recursive: true })));
|
|
92
|
-
const { infra, workflow } = splitWakeConfig(config);
|
|
93
|
-
const promptFileNames = await listPromptFileNames(repoRoot);
|
|
94
|
-
await Promise.all([
|
|
95
|
-
copyAssets(repoRoot, 'prompts', join(wakeRoot, 'prompts'), promptFileNames),
|
|
96
|
-
copyFile(join(repoRoot, 'templates', 'SETUP.md'), join(wakeRoot, 'SETUP.md')),
|
|
97
|
-
writeYamlFile(join(wakeRoot, 'config.yaml'), infra),
|
|
98
|
-
writeYamlFile(join(wakeRoot, 'config.workflows.yaml'), workflow),
|
|
99
|
-
]);
|
|
100
|
-
}
|