@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
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ExecutionEventType } from '../execution/index.js';
|
|
2
|
+
import { WorkEventType } from '../work/index.js';
|
|
3
|
+
export const analyticsProjection = {
|
|
4
|
+
name: 'operator-analytics',
|
|
5
|
+
select: () => ({ key: 'global' }),
|
|
6
|
+
initial: () => ({ events: 0, workItems: 0, runs: 0, days: {} }),
|
|
7
|
+
project(previous, event) {
|
|
8
|
+
const day = event.occurredAt.slice(0, 10);
|
|
9
|
+
const bucket = previous.days[day] ?? { events: 0, workItems: 0, runs: 0 };
|
|
10
|
+
const workItems = event.eventType === WorkEventType.ItemCreated ? 1 : 0;
|
|
11
|
+
const runs = event.eventType === ExecutionEventType.RunStarted ? 1 : 0;
|
|
12
|
+
return {
|
|
13
|
+
events: previous.events + 1,
|
|
14
|
+
workItems: previous.workItems + workItems,
|
|
15
|
+
runs: previous.runs + runs,
|
|
16
|
+
days: {
|
|
17
|
+
...previous.days,
|
|
18
|
+
[day]: {
|
|
19
|
+
events: bucket.events + 1,
|
|
20
|
+
workItems: bucket.workItems + workItems,
|
|
21
|
+
runs: bucket.runs + runs,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { ActivityOutcomeKind } from '../activities/index.js';
|
|
2
|
+
import { agentTokenUsage, ExecutionEventType, RunStatus, selectRunExecutionEvent, } from '../execution/index.js';
|
|
3
|
+
import { isApprovalAwaitingSignalKind, OrchestrationEventType, orchestrationStatusTransitions, selectWorkflowOrchestrationEvent, WorkflowStatus, } from '../orchestration/index.js';
|
|
4
|
+
import { toWorkItemKey } from '../surfaces/index.js';
|
|
5
|
+
import { selectWorkEvent, WorkEventType } from '../work/index.js';
|
|
6
|
+
const conditionShape = {
|
|
7
|
+
ready: true,
|
|
8
|
+
active: true,
|
|
9
|
+
'needs-input': true,
|
|
10
|
+
error: true,
|
|
11
|
+
finished: true,
|
|
12
|
+
};
|
|
13
|
+
const conditions = Object.keys(conditionShape);
|
|
14
|
+
const BoardCondition = {
|
|
15
|
+
Ready: conditions[0],
|
|
16
|
+
Active: conditions[1],
|
|
17
|
+
NeedsInput: conditions[2],
|
|
18
|
+
Error: conditions[3],
|
|
19
|
+
Finished: conditions[4],
|
|
20
|
+
};
|
|
21
|
+
export const boardProjection = {
|
|
22
|
+
name: 'operator-board',
|
|
23
|
+
select: () => ({ key: 'global' }),
|
|
24
|
+
initial: () => ({ cards: {}, workflows: {}, runs: {}, children: {}, childRuns: {} }),
|
|
25
|
+
project(previous, envelope) {
|
|
26
|
+
const work = selectWorkEvent(envelope);
|
|
27
|
+
if (work !== null)
|
|
28
|
+
return projectWork(previous, work, envelope.occurredAt);
|
|
29
|
+
const workflow = selectWorkflowOrchestrationEvent(envelope);
|
|
30
|
+
if (workflow !== null)
|
|
31
|
+
return projectWorkflow(previous, workflow, envelope.occurredAt);
|
|
32
|
+
const run = selectRunExecutionEvent(envelope);
|
|
33
|
+
return run === null ? previous : projectRun(previous, run, envelope.occurredAt);
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
export function boardConditionCounts(view) {
|
|
37
|
+
return Object.values(view.cards).reduce((counts, card) => {
|
|
38
|
+
counts[card.condition] = (counts[card.condition] ?? 0) + 1;
|
|
39
|
+
return counts;
|
|
40
|
+
}, {});
|
|
41
|
+
}
|
|
42
|
+
function projectWork(view, event, occurredAt) {
|
|
43
|
+
const id = event.stream.id;
|
|
44
|
+
if (event.eventType === WorkEventType.ItemCreated) {
|
|
45
|
+
const card = {
|
|
46
|
+
workItemKey: toWorkItemKey(id),
|
|
47
|
+
workItemId: id,
|
|
48
|
+
objective: event.payload.objective,
|
|
49
|
+
condition: BoardCondition.Ready,
|
|
50
|
+
dwellSince: occurredAt,
|
|
51
|
+
runCount: 0,
|
|
52
|
+
totalTokens: 0,
|
|
53
|
+
inputTokens: 0,
|
|
54
|
+
outputTokens: 0,
|
|
55
|
+
cacheReadTokens: 0,
|
|
56
|
+
cacheWriteTokens: 0,
|
|
57
|
+
totalCostUsd: 0,
|
|
58
|
+
totalDurationMs: 0,
|
|
59
|
+
};
|
|
60
|
+
return { ...view, cards: { ...view.cards, [id]: card } };
|
|
61
|
+
}
|
|
62
|
+
const current = view.cards[id];
|
|
63
|
+
if (current === undefined)
|
|
64
|
+
return view;
|
|
65
|
+
if (event.eventType === WorkEventType.ObjectiveRevised)
|
|
66
|
+
return {
|
|
67
|
+
...view,
|
|
68
|
+
cards: { ...view.cards, [id]: { ...current, objective: event.payload.objective } },
|
|
69
|
+
};
|
|
70
|
+
if (event.eventType === WorkEventType.ItemFrozen)
|
|
71
|
+
return { ...view, cards: { ...view.cards, [id]: { ...current, frozen: true } } };
|
|
72
|
+
if (event.eventType === WorkEventType.ItemUnfrozen) {
|
|
73
|
+
const { frozen: _frozen, ...unfrozen } = current;
|
|
74
|
+
return { ...view, cards: { ...view.cards, [id]: unfrozen } };
|
|
75
|
+
}
|
|
76
|
+
if (event.eventType === WorkEventType.ItemClosed ||
|
|
77
|
+
event.eventType === WorkEventType.ItemCancelled) {
|
|
78
|
+
return {
|
|
79
|
+
...view,
|
|
80
|
+
cards: { ...view.cards, [id]: { ...current, condition: BoardCondition.Finished } },
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
// Deletion is a purge, not a lifecycle outcome — the card must disappear
|
|
84
|
+
// from the board entirely rather than settle into any condition column.
|
|
85
|
+
if (event.eventType === WorkEventType.ItemDeleted) {
|
|
86
|
+
const { [id]: _removed, ...cards } = view.cards;
|
|
87
|
+
return { ...view, cards };
|
|
88
|
+
}
|
|
89
|
+
return view;
|
|
90
|
+
}
|
|
91
|
+
function projectWorkflow(view, event, occurredAt) {
|
|
92
|
+
if (event.eventType === OrchestrationEventType.InstanceStarted) {
|
|
93
|
+
const workId = event.payload.workItemId;
|
|
94
|
+
const card = view.cards[workId];
|
|
95
|
+
if (card === undefined)
|
|
96
|
+
return view;
|
|
97
|
+
const workflows = { ...view.workflows, [event.stream.id]: workId };
|
|
98
|
+
if ('parentWorkflowInstanceId' in event.payload)
|
|
99
|
+
return {
|
|
100
|
+
...view,
|
|
101
|
+
workflows,
|
|
102
|
+
children: { ...view.children, [event.stream.id]: event.payload.entry },
|
|
103
|
+
};
|
|
104
|
+
return {
|
|
105
|
+
...view,
|
|
106
|
+
cards: {
|
|
107
|
+
...view.cards,
|
|
108
|
+
[workId]: {
|
|
109
|
+
...card,
|
|
110
|
+
workflowName: event.payload.workflowName,
|
|
111
|
+
stage: event.payload.entry,
|
|
112
|
+
dwellSince: occurredAt,
|
|
113
|
+
condition: BoardCondition.Ready,
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
workflows,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
if (view.children?.[event.stream.id] !== undefined)
|
|
120
|
+
return view;
|
|
121
|
+
const located = lookupWorkflowCard(view, event.stream.id);
|
|
122
|
+
if (located === undefined)
|
|
123
|
+
return view;
|
|
124
|
+
const { workId, card } = located;
|
|
125
|
+
// Closed/cancelled is terminal for a WorkItem — there is no reopen path
|
|
126
|
+
// (see work-item.spec.md) — so a workflow status event that arrives after
|
|
127
|
+
// closure (e.g. InstanceBlocked from the now-orphaned instance halting)
|
|
128
|
+
// must not resurrect the card out of Finished.
|
|
129
|
+
if (card.condition === BoardCondition.Finished)
|
|
130
|
+
return view;
|
|
131
|
+
// A new stage is always Ready regardless of the condition it inherits —
|
|
132
|
+
// Error from the prior stage's failed run, or whatever it held before the
|
|
133
|
+
// SignalAccepted that unblocked it — until a Run actually starts (Active)
|
|
134
|
+
// or a fresh SignalWaitStarted arrives (Needs Input).
|
|
135
|
+
if (event.eventType === OrchestrationEventType.StageEntered)
|
|
136
|
+
return {
|
|
137
|
+
...view,
|
|
138
|
+
cards: {
|
|
139
|
+
...view.cards,
|
|
140
|
+
[workId]: {
|
|
141
|
+
...card,
|
|
142
|
+
stage: event.payload.stage,
|
|
143
|
+
dwellSince: occurredAt,
|
|
144
|
+
condition: BoardCondition.Ready,
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
// Every event that changes a workflow instance's status is looked up from
|
|
149
|
+
// orchestrationStatusTransitions rather than hand-matched here, so a new
|
|
150
|
+
// status-changing event type added to the engine automatically reaches
|
|
151
|
+
// the board instead of silently sitting at whatever condition it had
|
|
152
|
+
// before — this is exactly the class of gap that let the card sit in
|
|
153
|
+
// Ready while GitHub's own label already said working.
|
|
154
|
+
const status = orchestrationStatusTransitions[event.eventType];
|
|
155
|
+
if (status === undefined)
|
|
156
|
+
return view;
|
|
157
|
+
const withCondition = { ...card, condition: boardConditionForStatus(status) };
|
|
158
|
+
if (event.eventType === OrchestrationEventType.SignalWaitStarted)
|
|
159
|
+
return {
|
|
160
|
+
...view,
|
|
161
|
+
cards: {
|
|
162
|
+
...view.cards,
|
|
163
|
+
[workId]: { ...withCondition, ...awaitingApprovalField(event.payload.signalKind) },
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
if (event.eventType === OrchestrationEventType.SignalAccepted)
|
|
167
|
+
return { ...view, cards: { ...view.cards, [workId]: withoutAwaitingApproval(withCondition) } };
|
|
168
|
+
return { ...view, cards: { ...view.cards, [workId]: withCondition } };
|
|
169
|
+
}
|
|
170
|
+
function boardConditionForStatus(status) {
|
|
171
|
+
switch (status) {
|
|
172
|
+
// Orchestration "active" means outstanding work, not a run in flight —
|
|
173
|
+
// the board's Active condition is reserved for RunStarted (below).
|
|
174
|
+
case WorkflowStatus.Active:
|
|
175
|
+
return BoardCondition.Ready;
|
|
176
|
+
case WorkflowStatus.Waiting:
|
|
177
|
+
case WorkflowStatus.Blocked:
|
|
178
|
+
return BoardCondition.NeedsInput;
|
|
179
|
+
case WorkflowStatus.Completed:
|
|
180
|
+
return BoardCondition.Finished;
|
|
181
|
+
case WorkflowStatus.Superseded:
|
|
182
|
+
return BoardCondition.Error;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function lookupWorkflowCard(view, streamId) {
|
|
186
|
+
const workId = view.workflows[streamId];
|
|
187
|
+
if (workId === undefined)
|
|
188
|
+
return undefined;
|
|
189
|
+
const card = view.cards[workId];
|
|
190
|
+
return card === undefined ? undefined : { workId, card };
|
|
191
|
+
}
|
|
192
|
+
function awaitingApprovalField(signalKind) {
|
|
193
|
+
return isApprovalAwaitingSignalKind(signalKind) ? { awaitingApproval: true } : {};
|
|
194
|
+
}
|
|
195
|
+
const runTerminalEventTypes = new Set([
|
|
196
|
+
ExecutionEventType.RunSucceeded,
|
|
197
|
+
ExecutionEventType.RunFailed,
|
|
198
|
+
ExecutionEventType.RunCancelled,
|
|
199
|
+
ExecutionEventType.RunAmbiguous,
|
|
200
|
+
]);
|
|
201
|
+
function terminalFinishedAt(event) {
|
|
202
|
+
if (event.eventType === ExecutionEventType.RunSucceeded ||
|
|
203
|
+
event.eventType === ExecutionEventType.RunFailed ||
|
|
204
|
+
event.eventType === ExecutionEventType.RunCancelled ||
|
|
205
|
+
event.eventType === ExecutionEventType.RunAmbiguous)
|
|
206
|
+
return event.payload.finishedAt;
|
|
207
|
+
return undefined;
|
|
208
|
+
}
|
|
209
|
+
// RunSucceeded is a transport-level fact only: the agent can still report
|
|
210
|
+
// a failed/blocked sentinel inside its outcome, so the board's condition
|
|
211
|
+
// must follow outcome.kind, not just the event type, or a failed/blocked
|
|
212
|
+
// run leaves the card silently stuck on the prior "active" condition.
|
|
213
|
+
function terminalRunFields(event) {
|
|
214
|
+
if (event.eventType === ExecutionEventType.RunSucceeded) {
|
|
215
|
+
const kind = event.payload.outcome.kind;
|
|
216
|
+
// A successful outcome means the runner has stopped, but does not decide
|
|
217
|
+
// the workflow's next state. Keep the workflow-owned condition until its
|
|
218
|
+
// next lifecycle event (ActivityRequested, SignalWaitStarted, or
|
|
219
|
+
// InstanceCompleted) changes it.
|
|
220
|
+
if (kind === ActivityOutcomeKind.Failed)
|
|
221
|
+
return { lastRunOutcome: kind, condition: BoardCondition.Error };
|
|
222
|
+
if (kind === ActivityOutcomeKind.Blocked)
|
|
223
|
+
return { lastRunOutcome: kind, condition: BoardCondition.NeedsInput };
|
|
224
|
+
return { lastRunOutcome: kind };
|
|
225
|
+
}
|
|
226
|
+
if (event.eventType === ExecutionEventType.RunFailed)
|
|
227
|
+
return { lastRunOutcome: RunStatus.Failed, condition: BoardCondition.Error };
|
|
228
|
+
if (event.eventType === ExecutionEventType.RunCancelled)
|
|
229
|
+
return { lastRunOutcome: RunStatus.Cancelled, condition: BoardCondition.Error };
|
|
230
|
+
if (event.eventType === ExecutionEventType.RunAmbiguous)
|
|
231
|
+
return { lastRunOutcome: RunStatus.Ambiguous, condition: BoardCondition.Error };
|
|
232
|
+
return undefined;
|
|
233
|
+
}
|
|
234
|
+
function projectRun(view, event, _occurredAt) {
|
|
235
|
+
if (event.eventType === ExecutionEventType.RunStarted)
|
|
236
|
+
return projectRunStarted(view, event);
|
|
237
|
+
const workId = view.runs[event.stream.id];
|
|
238
|
+
const card = workId === undefined ? undefined : view.cards[workId];
|
|
239
|
+
if (card === undefined || workId === undefined)
|
|
240
|
+
return view;
|
|
241
|
+
if (runTerminalEventTypes.has(event.eventType))
|
|
242
|
+
return projectRunTerminal(view, event, workId, card);
|
|
243
|
+
if (event.eventType === ExecutionEventType.RunRunnerResultReported)
|
|
244
|
+
return projectRunnerResult(view, workId, card, event.payload.agent?.metadata);
|
|
245
|
+
return view;
|
|
246
|
+
}
|
|
247
|
+
function projectRunTerminal(view, event, workId, card) {
|
|
248
|
+
const finishedAt = terminalFinishedAt(event);
|
|
249
|
+
const runDurationMs = card.activeRun === undefined || finishedAt === undefined
|
|
250
|
+
? 0
|
|
251
|
+
: Date.parse(finishedAt) - Date.parse(card.activeRun.startedAt);
|
|
252
|
+
const terminal = terminalRunFields(event);
|
|
253
|
+
// Same legacy-checkpoint tolerance as the `children` guard above: a
|
|
254
|
+
// checkpoint persisted before `childRuns` was added round-trips without
|
|
255
|
+
// it, and this is the first read of the field after a Run starts.
|
|
256
|
+
const isChildRun = view.childRuns?.[event.stream.id] === true;
|
|
257
|
+
return {
|
|
258
|
+
...view,
|
|
259
|
+
cards: {
|
|
260
|
+
...view.cards,
|
|
261
|
+
[workId]: {
|
|
262
|
+
...withoutActiveRun(card),
|
|
263
|
+
...(terminal === undefined ? {} : { lastRunOutcome: terminal.lastRunOutcome }),
|
|
264
|
+
...(terminal === undefined || isChildRun || terminal.condition === undefined
|
|
265
|
+
? {}
|
|
266
|
+
: { condition: terminal.condition }),
|
|
267
|
+
totalDurationMs: card.totalDurationMs + runDurationMs,
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
function projectRunStarted(view, event) {
|
|
273
|
+
const workId = view.workflows[event.payload.workflowInstanceId];
|
|
274
|
+
const card = workId === undefined ? undefined : view.cards[workId];
|
|
275
|
+
if (card === undefined || workId === undefined)
|
|
276
|
+
return view;
|
|
277
|
+
// Same legacy-checkpoint tolerance as the `children` guard in
|
|
278
|
+
// projectWorkflow: a RunStarted event reaches this field independently of
|
|
279
|
+
// that guard, so a checkpoint predating `children` must not crash here either.
|
|
280
|
+
const childAction = view.children?.[event.payload.workflowInstanceId];
|
|
281
|
+
const isChildRun = childAction !== undefined;
|
|
282
|
+
return {
|
|
283
|
+
...view,
|
|
284
|
+
runs: { ...view.runs, [event.stream.id]: workId },
|
|
285
|
+
...(isChildRun ? { childRuns: { ...view.childRuns, [event.stream.id]: true } } : {}),
|
|
286
|
+
cards: {
|
|
287
|
+
...view.cards,
|
|
288
|
+
[workId]: {
|
|
289
|
+
...(isChildRun ? card : withoutLastRunOutcome(withoutAwaitingApproval(card))),
|
|
290
|
+
runCount: card.runCount + 1,
|
|
291
|
+
...(isChildRun ? {} : { condition: BoardCondition.Active }),
|
|
292
|
+
lastRunAt: event.payload.startedAt,
|
|
293
|
+
activeRun: {
|
|
294
|
+
action: childAction ?? card.stage ?? event.payload.activity,
|
|
295
|
+
startedAt: event.payload.startedAt,
|
|
296
|
+
...(event.payload.runner?.name === undefined
|
|
297
|
+
? {}
|
|
298
|
+
: { runnerName: event.payload.runner.name }),
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
function projectRunnerResult(view, workId, card, metadata) {
|
|
305
|
+
const usage = agentTokenUsage(metadata);
|
|
306
|
+
return {
|
|
307
|
+
...view,
|
|
308
|
+
cards: {
|
|
309
|
+
...view.cards,
|
|
310
|
+
[workId]: {
|
|
311
|
+
...card,
|
|
312
|
+
totalTokens: card.totalTokens + usage.tokens,
|
|
313
|
+
inputTokens: (card.inputTokens ?? 0) + numeric(metadata, 'inputTokens'),
|
|
314
|
+
outputTokens: (card.outputTokens ?? 0) + numeric(metadata, 'outputTokens'),
|
|
315
|
+
cacheReadTokens: (card.cacheReadTokens ?? 0) + numeric(metadata, 'cacheReadTokens'),
|
|
316
|
+
cacheWriteTokens: (card.cacheWriteTokens ?? 0) + numeric(metadata, 'cacheWriteTokens'),
|
|
317
|
+
totalCostUsd: card.totalCostUsd + usage.costUsd,
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
function numeric(metadata, key) {
|
|
323
|
+
const value = metadata?.[key];
|
|
324
|
+
return typeof value === 'number' ? value : 0;
|
|
325
|
+
}
|
|
326
|
+
function withoutAwaitingApproval(card) {
|
|
327
|
+
const { awaitingApproval: _awaitingApproval, ...withoutApproval } = card;
|
|
328
|
+
return withoutApproval;
|
|
329
|
+
}
|
|
330
|
+
function withoutActiveRun(card) {
|
|
331
|
+
const { activeRun: _activeRun, ...withoutRun } = card;
|
|
332
|
+
return withoutRun;
|
|
333
|
+
}
|
|
334
|
+
function withoutLastRunOutcome(card) {
|
|
335
|
+
const { lastRunOutcome: _lastRunOutcome, ...withoutOutcome } = card;
|
|
336
|
+
return withoutOutcome;
|
|
337
|
+
}
|