@atolis-hq/wake 0.2.96 → 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 -2365
- 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,503 +0,0 @@
|
|
|
1
|
-
import { buildStagePrompt } from '../runner/stage-prompt.js';
|
|
2
|
-
import { runAgentCliCommand } from '../runner/cli-command.js';
|
|
3
|
-
import { emitRuntimeEvent, runnerRuntimeEvent } from '../runner/runtime-events.js';
|
|
4
|
-
import { writeRunnerTranscript } from '../runner/transcripts.js';
|
|
5
|
-
import { createAgentExecution } from '../../core/live-execution.js';
|
|
6
|
-
import { parseRunnerResult } from '../../domain/schema.js';
|
|
7
|
-
const CODEX_CLI_NAME = 'Codex';
|
|
8
|
-
function buildCodexExecPrefixArgs(input) {
|
|
9
|
-
return [
|
|
10
|
-
'--ask-for-approval',
|
|
11
|
-
'never',
|
|
12
|
-
...(input.reasoningEffort === undefined
|
|
13
|
-
? []
|
|
14
|
-
: ['-c', `model_reasoning_effort="${input.reasoningEffort}"`]),
|
|
15
|
-
'exec',
|
|
16
|
-
'--json',
|
|
17
|
-
'--skip-git-repo-check',
|
|
18
|
-
'--sandbox',
|
|
19
|
-
input.sandboxMode,
|
|
20
|
-
'--cd',
|
|
21
|
-
input.cwd,
|
|
22
|
-
'--model',
|
|
23
|
-
input.model,
|
|
24
|
-
];
|
|
25
|
-
}
|
|
26
|
-
export function buildCodexExecArgs(input) {
|
|
27
|
-
const prompt = buildCodexPromptText(input);
|
|
28
|
-
return [...buildCodexExecPrefixArgs(input), prompt];
|
|
29
|
-
}
|
|
30
|
-
export function buildCodexPromptText(input) {
|
|
31
|
-
return input.harnessPrompt === undefined
|
|
32
|
-
? input.prompt
|
|
33
|
-
: `${input.harnessPrompt}\n\n${input.prompt}`;
|
|
34
|
-
}
|
|
35
|
-
export function buildCodexResumeArgs(input) {
|
|
36
|
-
const prompt = buildCodexPromptText(input);
|
|
37
|
-
return [...buildCodexExecPrefixArgs(input), 'resume', input.sessionId, prompt];
|
|
38
|
-
}
|
|
39
|
-
function compactLogValue(value) {
|
|
40
|
-
return value.replace(/\s+/g, ' ').trim();
|
|
41
|
-
}
|
|
42
|
-
export function formatCodexRunLogLine(input) {
|
|
43
|
-
const parts = [
|
|
44
|
-
'[codex-run]',
|
|
45
|
-
`phase=${input.phase}`,
|
|
46
|
-
`runId=${input.runId}`,
|
|
47
|
-
`cli=Codex`,
|
|
48
|
-
...(input.model === undefined ? [] : [`model=${input.model}`]),
|
|
49
|
-
`repo=${input.repo}`,
|
|
50
|
-
`issueNumber=${input.issueNumber}`,
|
|
51
|
-
`action=${input.action}`,
|
|
52
|
-
`recentEventIds=${input.recentEventIds.length > 0 ? input.recentEventIds.join(',') : '(none)'}`,
|
|
53
|
-
...(input.workspacePath === undefined
|
|
54
|
-
? []
|
|
55
|
-
: [`workspacePath=${compactLogValue(input.workspacePath)}`]),
|
|
56
|
-
...(input.sessionId === undefined ? [] : [`sessionId=${input.sessionId}`]),
|
|
57
|
-
...(input.exitCode === undefined ? [] : [`exitCode=${input.exitCode}`]),
|
|
58
|
-
];
|
|
59
|
-
return parts.join(' ');
|
|
60
|
-
}
|
|
61
|
-
export function extractCodexExecResult(stdout) {
|
|
62
|
-
let result;
|
|
63
|
-
let sessionId;
|
|
64
|
-
let turns = 0;
|
|
65
|
-
let inputTokens = 0;
|
|
66
|
-
let outputTokens = 0;
|
|
67
|
-
let cachedInputTokens = 0;
|
|
68
|
-
let sawUsage = false;
|
|
69
|
-
for (const line of stdout.split(/\r?\n/).filter((entry) => entry.trim().length > 0)) {
|
|
70
|
-
const event = JSON.parse(line);
|
|
71
|
-
if (event.type === 'thread.started' && typeof event.thread_id === 'string') {
|
|
72
|
-
sessionId = event.thread_id;
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
if (event.type === 'item.completed') {
|
|
76
|
-
const item = event.item;
|
|
77
|
-
if (item?.type === 'agent_message' && typeof item.text === 'string') {
|
|
78
|
-
result = item.text;
|
|
79
|
-
}
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
if (event.type === 'turn.completed') {
|
|
83
|
-
const usage = event.usage;
|
|
84
|
-
if (usage !== undefined) {
|
|
85
|
-
sawUsage = true;
|
|
86
|
-
turns += 1;
|
|
87
|
-
// Each `turn.completed` reports that turn's own usage (an exec run can
|
|
88
|
-
// make several model turns via tool calls), so accumulate across turns
|
|
89
|
-
// rather than keeping only the last one - otherwise a multi-turn run's
|
|
90
|
-
// reported usage undercounts the actual spend (#135).
|
|
91
|
-
inputTokens += typeof usage.input_tokens === 'number' ? usage.input_tokens : 0;
|
|
92
|
-
outputTokens += typeof usage.output_tokens === 'number' ? usage.output_tokens : 0;
|
|
93
|
-
// OpenAI's Responses API reports cached prompt tokens nested under
|
|
94
|
-
// input_tokens_details.cached_tokens; unverified against a live Codex
|
|
95
|
-
// success response (this environment's Codex quota was exhausted while
|
|
96
|
-
// this adapter was written), so it is read defensively and simply
|
|
97
|
-
// omitted if absent rather than assumed to exist.
|
|
98
|
-
const inputTokensDetails = usage.input_tokens_details;
|
|
99
|
-
if (typeof inputTokensDetails?.cached_tokens === 'number') {
|
|
100
|
-
cachedInputTokens += inputTokensDetails.cached_tokens;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
if (result === undefined) {
|
|
106
|
-
throw new Error('Codex exec JSONL stream did not include a final agent message.');
|
|
107
|
-
}
|
|
108
|
-
const tokenUsage = sawUsage
|
|
109
|
-
? {
|
|
110
|
-
inputTokens,
|
|
111
|
-
outputTokens,
|
|
112
|
-
turns,
|
|
113
|
-
...(cachedInputTokens > 0 ? { cacheReadInputTokens: cachedInputTokens } : {}),
|
|
114
|
-
}
|
|
115
|
-
: undefined;
|
|
116
|
-
return {
|
|
117
|
-
result,
|
|
118
|
-
...(sessionId === undefined ? {} : { sessionId }),
|
|
119
|
-
...(tokenUsage === undefined ? {} : { tokenUsage }),
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
// Codex exec emits a JSONL stream even on failure (unlike a bare CLI crash,
|
|
123
|
-
// which produces no JSON at all). Reading the structured `message` field off
|
|
124
|
-
// `error`/`turn.failed` events is more reliable than grepping the raw stdout
|
|
125
|
-
// blob, and it is also the string that carries the actual reset-time hint
|
|
126
|
-
// (e.g. "...or try again at 2:29 PM") that quota-backoff needs.
|
|
127
|
-
export function extractCodexErrorMessage(stdout) {
|
|
128
|
-
for (const line of stdout.split(/\r?\n/)) {
|
|
129
|
-
const trimmed = line.trim();
|
|
130
|
-
if (trimmed.length === 0) {
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
let event;
|
|
134
|
-
try {
|
|
135
|
-
event = JSON.parse(trimmed);
|
|
136
|
-
}
|
|
137
|
-
catch {
|
|
138
|
-
continue;
|
|
139
|
-
}
|
|
140
|
-
if (event.type === 'error' && typeof event.message === 'string') {
|
|
141
|
-
return event.message;
|
|
142
|
-
}
|
|
143
|
-
if (event.type === 'turn.failed') {
|
|
144
|
-
const error = event.error;
|
|
145
|
-
if (typeof error?.message === 'string') {
|
|
146
|
-
return error.message;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return undefined;
|
|
151
|
-
}
|
|
152
|
-
export function classifyCodexCliFailure(input) {
|
|
153
|
-
if (input.timedOut) {
|
|
154
|
-
return 'infra';
|
|
155
|
-
}
|
|
156
|
-
const structuredMessage = extractCodexErrorMessage(input.stdout);
|
|
157
|
-
const text = (structuredMessage ?? `${input.stderr}\n${input.stdout}`).toLowerCase();
|
|
158
|
-
if (text.includes('missing bearer or basic authentication')) {
|
|
159
|
-
return 'infra';
|
|
160
|
-
}
|
|
161
|
-
if (text.includes('usage limit') ||
|
|
162
|
-
text.includes('rate limit') ||
|
|
163
|
-
text.includes('quota') ||
|
|
164
|
-
text.includes('billing') ||
|
|
165
|
-
text.includes('credit') ||
|
|
166
|
-
text.includes('too many requests') ||
|
|
167
|
-
text.includes('unauthorized') ||
|
|
168
|
-
text.includes('authentication') ||
|
|
169
|
-
text.includes('not logged in') ||
|
|
170
|
-
text.includes('login required')) {
|
|
171
|
-
return 'quota';
|
|
172
|
-
}
|
|
173
|
-
return 'infra';
|
|
174
|
-
}
|
|
175
|
-
function resolveModel(input) {
|
|
176
|
-
return input.settings.model;
|
|
177
|
-
}
|
|
178
|
-
function readSandboxLogBreadcrumb() {
|
|
179
|
-
const containerName = process.env.WAKE_SANDBOX_CONTAINER_NAME;
|
|
180
|
-
if (containerName === undefined || containerName.length === 0) {
|
|
181
|
-
return null;
|
|
182
|
-
}
|
|
183
|
-
return {
|
|
184
|
-
text: `Sandbox logs: docker logs --tail 200 ${containerName}`,
|
|
185
|
-
metadata: {
|
|
186
|
-
sandboxContainerName: containerName,
|
|
187
|
-
},
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
function resolveSandboxMode(input) {
|
|
191
|
-
return input.workspaceMode === 'branch' ? 'danger-full-access' : 'workspace-write';
|
|
192
|
-
}
|
|
193
|
-
// Codex uses shell execution rather than Claude Code's named tools (Read/Glob/Grep).
|
|
194
|
-
// For read-only stages, override the tool capability note so the agent is told what it
|
|
195
|
-
// can actually use instead of Claude-specific tool names it does not have.
|
|
196
|
-
export function buildCodexToolCapabilityNote(input) {
|
|
197
|
-
if (input.workspaceMode !== 'read-only') {
|
|
198
|
-
return undefined;
|
|
199
|
-
}
|
|
200
|
-
const note = 'You may read the repository using standard shell commands (cat, ls, find, grep, head, tail) and git status. ' +
|
|
201
|
-
'The workspace-write sandbox prevents write and edit operations — do not attempt to modify files.';
|
|
202
|
-
return input.mode === 'resume' ? `Reminder: this is still a planning-only stage. ${note}` : note;
|
|
203
|
-
}
|
|
204
|
-
export function createCodexRunner(options) {
|
|
205
|
-
const runner = {
|
|
206
|
-
async start(input) {
|
|
207
|
-
return createAgentExecution(input, (liveInput) => runner.run(liveInput));
|
|
208
|
-
},
|
|
209
|
-
async run(input) {
|
|
210
|
-
const priorSessionId = input.projection.wake.sessionId;
|
|
211
|
-
const priorSessionCli = input.projection.wake.sessionCli;
|
|
212
|
-
const isResume = priorSessionId !== undefined && priorSessionCli === CODEX_CLI_NAME;
|
|
213
|
-
const runMode = isResume ? 'resume' : 'start';
|
|
214
|
-
const toolCapabilityNote = buildCodexToolCapabilityNote({
|
|
215
|
-
...(input.workspaceMode === undefined ? {} : { workspaceMode: input.workspaceMode }),
|
|
216
|
-
mode: runMode,
|
|
217
|
-
});
|
|
218
|
-
const stagePrompt = await buildStagePrompt({
|
|
219
|
-
action: input.action,
|
|
220
|
-
projection: input.projection,
|
|
221
|
-
mode: runMode,
|
|
222
|
-
config: input.config,
|
|
223
|
-
...(input.workspaceMode === undefined ? {} : { workspaceMode: input.workspaceMode }),
|
|
224
|
-
...(input.mergeConflictDetected === true ? { mergeConflictDetected: true } : {}),
|
|
225
|
-
...(input.upstreamChanges === undefined ? {} : { upstreamChanges: input.upstreamChanges }),
|
|
226
|
-
...(input.preExistingUncommittedChanges === true
|
|
227
|
-
? { preExistingUncommittedChanges: true }
|
|
228
|
-
: {}),
|
|
229
|
-
...(toolCapabilityNote !== undefined || input.promptContextOverrides !== undefined
|
|
230
|
-
? {
|
|
231
|
-
contextOverrides: {
|
|
232
|
-
...input.promptContextOverrides,
|
|
233
|
-
...(toolCapabilityNote === undefined ? {} : { toolCapabilityNote }),
|
|
234
|
-
},
|
|
235
|
-
}
|
|
236
|
-
: {}),
|
|
237
|
-
});
|
|
238
|
-
const model = resolveModel({
|
|
239
|
-
action: input.action,
|
|
240
|
-
settings: options.settings,
|
|
241
|
-
});
|
|
242
|
-
const cwd = input.workspacePath ?? options.cwd;
|
|
243
|
-
const sandboxMode = resolveSandboxMode({
|
|
244
|
-
...(input.workspaceMode === undefined ? {} : { workspaceMode: input.workspaceMode }),
|
|
245
|
-
});
|
|
246
|
-
const promptText = buildCodexPromptText({
|
|
247
|
-
prompt: stagePrompt.prompt,
|
|
248
|
-
harnessPrompt: stagePrompt.harnessPrompt,
|
|
249
|
-
});
|
|
250
|
-
const promptTranscriptPath = await writeRunnerTranscript({
|
|
251
|
-
config: input.config,
|
|
252
|
-
projection: input.projection,
|
|
253
|
-
runId: input.runId,
|
|
254
|
-
action: input.action,
|
|
255
|
-
cli: CODEX_CLI_NAME,
|
|
256
|
-
kind: 'prompt',
|
|
257
|
-
text: promptText,
|
|
258
|
-
});
|
|
259
|
-
console.log(formatCodexRunLogLine({
|
|
260
|
-
phase: 'start',
|
|
261
|
-
runId: input.runId,
|
|
262
|
-
action: input.action,
|
|
263
|
-
issueNumber: input.projection.issue.number,
|
|
264
|
-
repo: input.projection.issue.repo,
|
|
265
|
-
recentEventIds: input.recentEvents.map((event) => event.eventId),
|
|
266
|
-
model,
|
|
267
|
-
...(input.workspacePath === undefined ? {} : { workspacePath: input.workspacePath }),
|
|
268
|
-
...(isResume ? { sessionId: priorSessionId } : {}),
|
|
269
|
-
}));
|
|
270
|
-
const result = await runAgentCliCommand({
|
|
271
|
-
command: options.command,
|
|
272
|
-
args: isResume
|
|
273
|
-
? buildCodexResumeArgs({
|
|
274
|
-
model,
|
|
275
|
-
prompt: promptText,
|
|
276
|
-
cwd,
|
|
277
|
-
sandboxMode,
|
|
278
|
-
sessionId: priorSessionId,
|
|
279
|
-
...(options.settings.reasoningEffort === undefined
|
|
280
|
-
? {}
|
|
281
|
-
: { reasoningEffort: options.settings.reasoningEffort }),
|
|
282
|
-
})
|
|
283
|
-
: buildCodexExecArgs({
|
|
284
|
-
model,
|
|
285
|
-
prompt: promptText,
|
|
286
|
-
cwd,
|
|
287
|
-
sandboxMode,
|
|
288
|
-
...(options.settings.reasoningEffort === undefined
|
|
289
|
-
? {}
|
|
290
|
-
: { reasoningEffort: options.settings.reasoningEffort }),
|
|
291
|
-
}),
|
|
292
|
-
cwd,
|
|
293
|
-
timeoutMs: options.settings.timeoutMs,
|
|
294
|
-
...(input.cancellationSignal === undefined
|
|
295
|
-
? {}
|
|
296
|
-
: { cancellationSignal: input.cancellationSignal }),
|
|
297
|
-
onProcessStart: async (identity) => {
|
|
298
|
-
await input.onProcessStart?.(identity);
|
|
299
|
-
await emitRuntimeEvent(input.onRuntimeEvent, runnerRuntimeEvent({
|
|
300
|
-
type: 'agent.process.started',
|
|
301
|
-
runId: input.runId,
|
|
302
|
-
projection: input.projection,
|
|
303
|
-
routing: input.routing,
|
|
304
|
-
cli: CODEX_CLI_NAME,
|
|
305
|
-
model,
|
|
306
|
-
payload: { pid: identity.pid, processStartedAt: identity.processStartedAt },
|
|
307
|
-
}));
|
|
308
|
-
},
|
|
309
|
-
});
|
|
310
|
-
const responseTranscriptPath = await writeRunnerTranscript({
|
|
311
|
-
config: input.config,
|
|
312
|
-
projection: input.projection,
|
|
313
|
-
runId: input.runId,
|
|
314
|
-
action: input.action,
|
|
315
|
-
cli: CODEX_CLI_NAME,
|
|
316
|
-
kind: 'response',
|
|
317
|
-
text: result.stdout,
|
|
318
|
-
});
|
|
319
|
-
if (result.exitCode !== 0 || result.timedOut || result.stdout.trim().length === 0) {
|
|
320
|
-
const sandboxLog = readSandboxLogBreadcrumb();
|
|
321
|
-
const failureClass = classifyCodexCliFailure({
|
|
322
|
-
stdout: result.stdout,
|
|
323
|
-
stderr: result.stderr,
|
|
324
|
-
timedOut: result.timedOut,
|
|
325
|
-
});
|
|
326
|
-
const structuredMessage = result.timedOut
|
|
327
|
-
? undefined
|
|
328
|
-
: extractCodexErrorMessage(result.stdout);
|
|
329
|
-
console.error(formatCodexRunLogLine({
|
|
330
|
-
phase: 'failure',
|
|
331
|
-
runId: input.runId,
|
|
332
|
-
action: input.action,
|
|
333
|
-
issueNumber: input.projection.issue.number,
|
|
334
|
-
repo: input.projection.issue.repo,
|
|
335
|
-
recentEventIds: input.recentEvents.map((event) => event.eventId),
|
|
336
|
-
model,
|
|
337
|
-
...(input.workspacePath === undefined ? {} : { workspacePath: input.workspacePath }),
|
|
338
|
-
exitCode: result.exitCode,
|
|
339
|
-
}));
|
|
340
|
-
await emitRuntimeEvent(input.onRuntimeEvent, runnerRuntimeEvent({
|
|
341
|
-
type: 'agent.process.exited',
|
|
342
|
-
runId: input.runId,
|
|
343
|
-
projection: input.projection,
|
|
344
|
-
routing: input.routing,
|
|
345
|
-
cli: CODEX_CLI_NAME,
|
|
346
|
-
model,
|
|
347
|
-
payload: { exitCode: result.exitCode, timedOut: result.timedOut },
|
|
348
|
-
}));
|
|
349
|
-
return {
|
|
350
|
-
result: [
|
|
351
|
-
result.timedOut
|
|
352
|
-
? `Codex runner timed out after ${options.settings.timeoutMs}ms and was killed`
|
|
353
|
-
: structuredMessage !== undefined
|
|
354
|
-
? `Codex runner failed: ${structuredMessage}`
|
|
355
|
-
: result.stdout.trim().length === 0
|
|
356
|
-
? 'Codex runner produced no output'
|
|
357
|
-
: 'Codex runner failed',
|
|
358
|
-
result.stderr,
|
|
359
|
-
sandboxLog?.text,
|
|
360
|
-
'FAILED',
|
|
361
|
-
]
|
|
362
|
-
.filter((part) => part !== undefined && part.length > 0)
|
|
363
|
-
.join('\n'),
|
|
364
|
-
model,
|
|
365
|
-
cli: CODEX_CLI_NAME,
|
|
366
|
-
failureClass,
|
|
367
|
-
metadata: {
|
|
368
|
-
stdout: result.stdout,
|
|
369
|
-
stderr: result.stderr,
|
|
370
|
-
exitCode: result.exitCode,
|
|
371
|
-
failureClass,
|
|
372
|
-
...(promptTranscriptPath === undefined ? {} : { promptTranscriptPath }),
|
|
373
|
-
...(responseTranscriptPath === undefined ? {} : { responseTranscriptPath }),
|
|
374
|
-
...(sandboxLog?.metadata ?? {}),
|
|
375
|
-
},
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
const parsed = extractCodexExecResult(result.stdout);
|
|
379
|
-
const sandboxLog = readSandboxLogBreadcrumb();
|
|
380
|
-
const rawEvents = result.stdout
|
|
381
|
-
.split(/\r?\n/)
|
|
382
|
-
.filter((line) => line.trim().length > 0)
|
|
383
|
-
.map((line) => JSON.parse(line));
|
|
384
|
-
for (const raw of rawEvents) {
|
|
385
|
-
if (raw.type === 'thread.started' && typeof raw.thread_id === 'string') {
|
|
386
|
-
await emitRuntimeEvent(input.onRuntimeEvent, runnerRuntimeEvent({
|
|
387
|
-
type: 'agent.session.started',
|
|
388
|
-
runId: input.runId,
|
|
389
|
-
projection: input.projection,
|
|
390
|
-
routing: input.routing,
|
|
391
|
-
cli: CODEX_CLI_NAME,
|
|
392
|
-
model,
|
|
393
|
-
sessionId: raw.thread_id,
|
|
394
|
-
payload: { raw },
|
|
395
|
-
}));
|
|
396
|
-
}
|
|
397
|
-
else if (raw.type === 'turn.completed') {
|
|
398
|
-
await emitRuntimeEvent(input.onRuntimeEvent, runnerRuntimeEvent({
|
|
399
|
-
type: 'agent.turn.completed',
|
|
400
|
-
runId: input.runId,
|
|
401
|
-
projection: input.projection,
|
|
402
|
-
routing: input.routing,
|
|
403
|
-
cli: CODEX_CLI_NAME,
|
|
404
|
-
model,
|
|
405
|
-
...(parsed.sessionId === undefined ? {} : { sessionId: parsed.sessionId }),
|
|
406
|
-
payload: { raw },
|
|
407
|
-
}));
|
|
408
|
-
}
|
|
409
|
-
else if (raw.type === 'item.completed') {
|
|
410
|
-
await emitRuntimeEvent(input.onRuntimeEvent, runnerRuntimeEvent({
|
|
411
|
-
type: 'agent.progress',
|
|
412
|
-
runId: input.runId,
|
|
413
|
-
projection: input.projection,
|
|
414
|
-
routing: input.routing,
|
|
415
|
-
cli: CODEX_CLI_NAME,
|
|
416
|
-
model,
|
|
417
|
-
...(parsed.sessionId === undefined ? {} : { sessionId: parsed.sessionId }),
|
|
418
|
-
payload: { raw },
|
|
419
|
-
}));
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
if (parsed.tokenUsage !== undefined) {
|
|
423
|
-
await emitRuntimeEvent(input.onRuntimeEvent, runnerRuntimeEvent({
|
|
424
|
-
type: 'agent.usage.updated',
|
|
425
|
-
runId: input.runId,
|
|
426
|
-
projection: input.projection,
|
|
427
|
-
routing: input.routing,
|
|
428
|
-
cli: CODEX_CLI_NAME,
|
|
429
|
-
model,
|
|
430
|
-
...(parsed.sessionId === undefined ? {} : { sessionId: parsed.sessionId }),
|
|
431
|
-
payload: { tokenUsage: parsed.tokenUsage },
|
|
432
|
-
}));
|
|
433
|
-
}
|
|
434
|
-
console.log(formatCodexRunLogLine({
|
|
435
|
-
phase: 'success',
|
|
436
|
-
runId: input.runId,
|
|
437
|
-
action: input.action,
|
|
438
|
-
issueNumber: input.projection.issue.number,
|
|
439
|
-
repo: input.projection.issue.repo,
|
|
440
|
-
recentEventIds: input.recentEvents.map((event) => event.eventId),
|
|
441
|
-
model,
|
|
442
|
-
...(input.workspacePath === undefined ? {} : { workspacePath: input.workspacePath }),
|
|
443
|
-
...(parsed.sessionId === undefined ? {} : { sessionId: parsed.sessionId }),
|
|
444
|
-
}));
|
|
445
|
-
await emitRuntimeEvent(input.onRuntimeEvent, runnerRuntimeEvent({
|
|
446
|
-
type: 'agent.process.exited',
|
|
447
|
-
runId: input.runId,
|
|
448
|
-
projection: input.projection,
|
|
449
|
-
routing: input.routing,
|
|
450
|
-
cli: CODEX_CLI_NAME,
|
|
451
|
-
model,
|
|
452
|
-
...(parsed.sessionId === undefined ? {} : { sessionId: parsed.sessionId }),
|
|
453
|
-
payload: { exitCode: result.exitCode, timedOut: result.timedOut },
|
|
454
|
-
}));
|
|
455
|
-
return {
|
|
456
|
-
result: parsed.result,
|
|
457
|
-
model,
|
|
458
|
-
cli: CODEX_CLI_NAME,
|
|
459
|
-
...(parseRunnerResult(parsed.result).status === 'FAILED'
|
|
460
|
-
? { failureClass: 'task' }
|
|
461
|
-
: {}),
|
|
462
|
-
...(parsed.sessionId === undefined ? {} : { session_id: parsed.sessionId }),
|
|
463
|
-
...(parsed.tokenUsage === undefined ? {} : { tokenUsage: parsed.tokenUsage }),
|
|
464
|
-
metadata: {
|
|
465
|
-
stdout: result.stdout,
|
|
466
|
-
stderr: result.stderr,
|
|
467
|
-
raw: rawEvents,
|
|
468
|
-
skipApproval: stagePrompt.skipApproval,
|
|
469
|
-
allowAutoApproval: stagePrompt.allowAutoApproval,
|
|
470
|
-
...(promptTranscriptPath === undefined ? {} : { promptTranscriptPath }),
|
|
471
|
-
...(responseTranscriptPath === undefined ? {} : { responseTranscriptPath }),
|
|
472
|
-
...(sandboxLog?.metadata ?? {}),
|
|
473
|
-
},
|
|
474
|
-
};
|
|
475
|
-
},
|
|
476
|
-
async smoke() {
|
|
477
|
-
const result = await runAgentCliCommand({
|
|
478
|
-
command: options.command,
|
|
479
|
-
args: buildCodexExecArgs({
|
|
480
|
-
model: options.settings.smokeModel,
|
|
481
|
-
prompt: options.settings.smokePrompt,
|
|
482
|
-
cwd: options.cwd,
|
|
483
|
-
sandboxMode: 'danger-full-access',
|
|
484
|
-
...(options.settings.reasoningEffort === undefined
|
|
485
|
-
? {}
|
|
486
|
-
: { reasoningEffort: options.settings.reasoningEffort }),
|
|
487
|
-
}),
|
|
488
|
-
cwd: options.cwd,
|
|
489
|
-
});
|
|
490
|
-
const parsed = result.exitCode === 0 && result.stdout.trim().length > 0
|
|
491
|
-
? extractCodexExecResult(result.stdout)
|
|
492
|
-
: undefined;
|
|
493
|
-
return {
|
|
494
|
-
text: parsed?.result ?? '',
|
|
495
|
-
...(parsed?.sessionId === undefined ? {} : { sessionId: parsed.sessionId }),
|
|
496
|
-
stdout: result.stdout,
|
|
497
|
-
stderr: result.stderr,
|
|
498
|
-
exitCode: result.exitCode,
|
|
499
|
-
};
|
|
500
|
-
},
|
|
501
|
-
};
|
|
502
|
-
return runner;
|
|
503
|
-
}
|