cloving 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +329 -215
- package/dist/src/agent-harness-shell.d.ts +2 -1
- package/dist/src/agent-harness-shell.js +8 -5
- package/dist/src/authority/command-wait-checks.d.ts +8 -0
- package/dist/src/authority/command-wait-checks.js +88 -0
- package/dist/src/authority/command-wait-results.d.ts +15 -0
- package/dist/src/authority/command-wait-results.js +73 -0
- package/dist/src/authority/command-wait-view.d.ts +21 -0
- package/dist/src/authority/command-wait-view.js +34 -0
- package/dist/src/authority/command-waits.d.ts +39 -0
- package/dist/src/authority/command-waits.js +97 -0
- package/dist/src/authority/commands.js +22 -1
- package/dist/src/authority/dispatch-decision.d.ts +8 -0
- package/dist/src/authority/dispatch-decision.js +26 -1
- package/dist/src/authority/effect-requests.js +6 -3
- package/dist/src/authority/effect-results.js +4 -2
- package/dist/src/authority/history-state.d.ts +2 -0
- package/dist/src/authority/history-state.js +13 -1
- package/dist/src/authority/instants.d.ts +1 -0
- package/dist/src/authority/instants.js +21 -0
- package/dist/src/authority/reduction-state.d.ts +2 -0
- package/dist/src/authority/reduction-state.js +5 -0
- package/dist/src/authority/reduction.js +24 -0
- package/dist/src/authority/status-input.d.ts +2 -0
- package/dist/src/authority/status.d.ts +2 -0
- package/dist/src/authority/status.js +1 -0
- package/dist/src/authority/stop-sequence.d.ts +1 -0
- package/dist/src/authority/stop-sequence.js +2 -1
- package/dist/src/authority/transitions.d.ts +6 -4
- package/dist/src/authority/transitions.js +7 -0
- package/dist/src/broker/actor/authority-health.d.ts +9 -0
- package/dist/src/broker/actor/authority-health.js +24 -0
- package/dist/src/broker/actor/authority-queries.d.ts +2 -1
- package/dist/src/broker/actor/authority-queries.js +14 -5
- package/dist/src/broker/actor/authority-receipts.js +1 -1
- package/dist/src/broker/actor/authority-runtime.d.ts +4 -2
- package/dist/src/broker/actor/authority-runtime.js +29 -20
- package/dist/src/broker/actor/authority-session.d.ts +6 -19
- package/dist/src/broker/actor/authority-session.js +66 -88
- package/dist/src/broker/actor/authority-settings.d.ts +2 -1
- package/dist/src/broker/actor/authority-settings.js +6 -3
- package/dist/src/broker/actor/authority-upgrades.d.ts +23 -2
- package/dist/src/broker/actor/authority-upgrades.js +8 -2
- package/dist/src/broker/actor/authority-watchdog.d.ts +6 -2
- package/dist/src/broker/actor/authority-watchdog.js +31 -9
- package/dist/src/broker/actor/authority.js +3 -1
- package/dist/src/broker/actor/delivery-intents.js +2 -0
- package/dist/src/broker/actor/effect-delivery.d.ts +1 -1
- package/dist/src/broker/actor/effect-delivery.js +15 -2
- package/dist/src/broker/actor/effect-plan.js +11 -2
- package/dist/src/broker/actor/effect-queries.d.ts +4 -0
- package/dist/src/broker/actor/effect-queries.js +9 -1
- package/dist/src/broker/actor/effect-turn.js +2 -0
- package/dist/src/broker/actor/projection-memory.d.ts +43 -0
- package/dist/src/broker/actor/projection-memory.js +207 -0
- package/dist/src/broker/actor/runtime-parts.d.ts +5 -0
- package/dist/src/broker/actor/runtime-parts.js +8 -3
- package/dist/src/broker/actor/stop-plan.js +9 -3
- package/dist/src/broker/actor/stop-turn.d.ts +2 -0
- package/dist/src/broker/actor/stop-turn.js +24 -11
- package/dist/src/broker/actor/turn-draft.d.ts +1 -0
- package/dist/src/broker/actor/turn-draft.js +4 -0
- package/dist/src/broker/actor/turn-state.js +5 -1
- package/dist/src/broker/authority-admission.js +60 -0
- package/dist/src/broker/authority-restore.d.ts +2 -0
- package/dist/src/broker/authority-restore.js +35 -1
- package/dist/src/broker/command-wait-restore.d.ts +31 -0
- package/dist/src/broker/command-wait-restore.js +86 -0
- package/dist/src/broker/decision-restore.d.ts +1 -1
- package/dist/src/broker/decision-restore.js +1 -0
- package/dist/src/broker/effect-upgrade.d.ts +3 -0
- package/dist/src/broker/effect-upgrade.js +11 -2
- package/dist/src/cli/arguments.d.ts +13 -0
- package/dist/src/cli/arguments.js +43 -3
- package/dist/src/cli/chat-stores.d.ts +2 -0
- package/dist/src/cli/chat-stores.js +113 -0
- package/dist/src/cli/client.d.ts +7 -2
- package/dist/src/cli/client.js +13 -7
- package/dist/src/cli/command-requests.d.ts +46 -0
- package/dist/src/cli/command-requests.js +84 -0
- package/dist/src/cli/command-waits.d.ts +9 -0
- package/dist/src/cli/command-waits.js +51 -0
- package/dist/src/cli/commands.js +70 -88
- package/dist/src/cli/config-file.d.ts +2 -2
- package/dist/src/cli/config-file.js +4 -2
- package/dist/src/cli/config-notice.js +5 -2
- package/dist/src/cli/doctor-retention.d.ts +2 -0
- package/dist/src/cli/doctor-retention.js +93 -0
- package/dist/src/cli/doctor-workflows.d.ts +5 -2
- package/dist/src/cli/doctor-workflows.js +12 -7
- package/dist/src/cli/doctor.js +11 -9
- package/dist/src/cli/harness-probes.d.ts +2 -0
- package/dist/src/cli/harness-probes.js +1 -1
- package/dist/src/cli/harness-processes.d.ts +6 -0
- package/dist/src/cli/harness-processes.js +36 -0
- package/dist/src/cli/init-command.d.ts +9 -0
- package/dist/src/cli/init-command.js +52 -0
- package/dist/src/cli/init-prompt-command.d.ts +10 -0
- package/dist/src/cli/init-prompt-command.js +145 -0
- package/dist/src/cli/init-prompt.d.ts +35 -0
- package/dist/src/cli/init-prompt.js +74 -0
- package/dist/src/cli/init-selection.d.ts +13 -0
- package/dist/src/cli/init-selection.js +75 -0
- package/dist/src/cli/main.d.ts +2 -0
- package/dist/src/cli/main.js +37 -7
- package/dist/src/cli/mcp-server.d.ts +1 -0
- package/dist/src/cli/mcp-server.js +156 -0
- package/dist/src/cli/mcp-tools.d.ts +15 -0
- package/dist/src/cli/mcp-tools.js +242 -0
- package/dist/src/cli/queue-arguments.d.ts +15 -0
- package/dist/src/cli/queue-arguments.js +31 -0
- package/dist/src/cli/queue-render.d.ts +3 -0
- package/dist/src/cli/queue-render.js +26 -0
- package/dist/src/cli/reload-render.d.ts +2 -0
- package/dist/src/cli/reload-render.js +12 -0
- package/dist/src/cli/render.d.ts +1 -1
- package/dist/src/cli/render.js +54 -38
- package/dist/src/cli/report-ci-jobs.d.ts +23 -0
- package/dist/src/cli/report-ci-jobs.js +103 -0
- package/dist/src/cli/report-ci-usage.d.ts +9 -0
- package/dist/src/cli/report-ci-usage.js +185 -0
- package/dist/src/cli/report-ci.d.ts +13 -0
- package/dist/src/cli/report-ci.js +74 -0
- package/dist/src/cli/report-closures.d.ts +6 -0
- package/dist/src/cli/report-closures.js +97 -0
- package/dist/src/cli/report-flow.d.ts +7 -0
- package/dist/src/cli/report-flow.js +122 -0
- package/dist/src/cli/report-github-reader.d.ts +29 -0
- package/dist/src/cli/report-github-reader.js +157 -0
- package/dist/src/cli/report-github.d.ts +15 -8
- package/dist/src/cli/report-github.js +131 -150
- package/dist/src/cli/report-operator.d.ts +3 -0
- package/dist/src/cli/report-operator.js +40 -0
- package/dist/src/cli/report-ready.d.ts +3 -0
- package/dist/src/cli/report-ready.js +96 -0
- package/dist/src/cli/report-text.d.ts +9 -0
- package/dist/src/cli/report-text.js +33 -0
- package/dist/src/cli/report.d.ts +1 -0
- package/dist/src/cli/report.js +104 -27
- package/dist/src/cli/runtime-arguments.d.ts +18 -3
- package/dist/src/cli/runtime-arguments.js +29 -20
- package/dist/src/cli/schedule-arguments.d.ts +14 -0
- package/dist/src/cli/schedule-arguments.js +26 -0
- package/dist/src/cli/schedule-render.d.ts +22 -0
- package/dist/src/cli/schedule-render.js +73 -0
- package/dist/src/cli/terminal-text.d.ts +3 -0
- package/dist/src/cli/terminal-text.js +28 -0
- package/dist/src/cli/toolchain.d.ts +1 -0
- package/dist/src/cli/toolchain.js +1 -0
- package/dist/src/cli/usage-render.d.ts +1 -0
- package/dist/src/cli/usage-render.js +28 -1
- package/dist/src/cli/usage.d.ts +2 -2
- package/dist/src/cli/usage.js +89 -11
- package/dist/src/cli/watch-actions.js +2 -2
- package/dist/src/cli/watch-api-document.d.ts +430 -0
- package/dist/src/cli/watch-api-document.js +291 -0
- package/dist/src/cli/watch-api-run.d.ts +56 -0
- package/dist/src/cli/watch-api-run.js +112 -0
- package/dist/src/cli/watch-api.d.ts +17 -0
- package/dist/src/cli/watch-api.js +230 -0
- package/dist/src/cli/watch-board-view.js +19 -2
- package/dist/src/cli/watch-board.d.ts +4 -2
- package/dist/src/cli/watch-board.js +53 -43
- package/dist/src/cli/watch-card-forms.d.ts +1 -1
- package/dist/src/cli/watch-card-forms.js +11 -10
- package/dist/src/cli/watch-client.d.ts +1 -1
- package/dist/src/cli/watch-client.js +2 -11
- package/dist/src/cli/watch-header-view.d.ts +1 -5
- package/dist/src/cli/watch-header-view.js +17 -21
- package/dist/src/cli/watch-model.d.ts +5 -1
- package/dist/src/cli/watch-model.js +20 -11
- package/dist/src/cli/watch-page.js +15 -15
- package/dist/src/cli/watch-phases.d.ts +12 -3
- package/dist/src/cli/watch-phases.js +68 -11
- package/dist/src/cli/watch-pr-board.js +1 -1
- package/dist/src/cli/watch-pr-command.d.ts +1 -0
- package/dist/src/cli/watch-pull-request.js +18 -8
- package/dist/src/cli/watch-reads.d.ts +3 -0
- package/dist/src/cli/watch-reads.js +22 -20
- package/dist/src/cli/watch-render.d.ts +15 -0
- package/dist/src/cli/watch-run-input.d.ts +0 -1
- package/dist/src/cli/watch-run-input.js +0 -13
- package/dist/src/cli/watch-server.js +24 -10
- package/dist/src/cli/watch-view.d.ts +0 -3
- package/dist/src/cli/watch-view.js +13 -13
- package/dist/src/cli.js +73 -12
- package/dist/src/command-wait.d.ts +4 -0
- package/dist/src/command-wait.js +45 -0
- package/dist/src/configuration-change.d.ts +7 -0
- package/dist/src/configuration-change.js +14 -0
- package/dist/src/configuration-display.js +2 -0
- package/dist/src/configuration-schema.d.ts +14 -0
- package/dist/src/configuration-schema.js +6 -2
- package/dist/src/daemon/attachment-file.d.ts +6 -0
- package/dist/src/daemon/attachment-file.js +86 -0
- package/dist/src/daemon/attachments.d.ts +14 -0
- package/dist/src/daemon/attachments.js +17 -0
- package/dist/src/daemon/claude-recovery.d.ts +50 -0
- package/dist/src/daemon/claude-recovery.js +208 -0
- package/dist/src/daemon/claude-stream.d.ts +27 -0
- package/dist/src/daemon/claude-stream.js +63 -0
- package/dist/src/daemon/claude-turn.d.ts +11 -25
- package/dist/src/daemon/claude-turn.js +64 -81
- package/dist/src/daemon/claude-worker.d.ts +5 -4
- package/dist/src/daemon/claude-worker.js +127 -126
- package/dist/src/daemon/daemon-adapters.d.ts +9 -0
- package/dist/src/daemon/daemon-adapters.js +33 -5
- package/dist/src/daemon/daemon-loops.d.ts +5 -1
- package/dist/src/daemon/daemon-loops.js +18 -10
- package/dist/src/daemon/daemon.js +80 -61
- package/dist/src/daemon/github-attach.d.ts +2 -0
- package/dist/src/daemon/github-attach.js +222 -0
- package/dist/src/daemon/github-calls.js +1 -1
- package/dist/src/daemon/github-ci-filters.d.ts +6 -0
- package/dist/src/daemon/github-ci-filters.js +138 -0
- package/dist/src/daemon/github-ci-workflows.d.ts +10 -0
- package/dist/src/daemon/github-ci-workflows.js +148 -0
- package/dist/src/daemon/github-ci.js +22 -4
- package/dist/src/daemon/github-issue-methods.d.ts +2 -0
- package/dist/src/daemon/github-issue-methods.js +37 -2
- package/dist/src/daemon/github-merge-call.d.ts +2 -1
- package/dist/src/daemon/github-merge-call.js +10 -3
- package/dist/src/daemon/github-merge.js +52 -24
- package/dist/src/daemon/github-methods.js +18 -4
- package/dist/src/daemon/github-operation.d.ts +4 -0
- package/dist/src/daemon/github-operation.js +6 -0
- package/dist/src/daemon/github-worker.d.ts +4 -0
- package/dist/src/daemon/github-worker.js +6 -0
- package/dist/src/daemon/issue-queue.d.ts +4 -1
- package/dist/src/daemon/issue-queue.js +76 -78
- package/dist/src/daemon/merge-turns.d.ts +10 -0
- package/dist/src/daemon/merge-turns.js +37 -0
- package/dist/src/daemon/notify-events.d.ts +6 -0
- package/dist/src/daemon/notify-events.js +84 -0
- package/dist/src/daemon/notify-journal.js +1 -1
- package/dist/src/daemon/notify-message.d.ts +4 -1
- package/dist/src/daemon/notify-message.js +36 -0
- package/dist/src/daemon/notify.d.ts +1 -1
- package/dist/src/daemon/notify.js +5 -77
- package/dist/src/daemon/operation-journal.d.ts +1 -0
- package/dist/src/daemon/queue-control.d.ts +13 -0
- package/dist/src/daemon/queue-control.js +86 -0
- package/dist/src/daemon/queue-journal.d.ts +20 -0
- package/dist/src/daemon/queue-journal.js +89 -0
- package/dist/src/daemon/queue-status.d.ts +9 -3
- package/dist/src/daemon/queue-status.js +17 -4
- package/dist/src/daemon/record-archive.d.ts +19 -0
- package/dist/src/daemon/record-archive.js +82 -0
- package/dist/src/daemon/record-sweep.d.ts +24 -0
- package/dist/src/daemon/record-sweep.js +147 -0
- package/dist/src/daemon/resume-index-lock.d.ts +13 -0
- package/dist/src/daemon/resume-index-lock.js +160 -0
- package/dist/src/daemon/resume-worktree.d.ts +7 -0
- package/dist/src/daemon/resume-worktree.js +29 -0
- package/dist/src/daemon/retrying-turn.d.ts +2 -12
- package/dist/src/daemon/retrying-turn.js +98 -172
- package/dist/src/daemon/schedule-control.d.ts +26 -0
- package/dist/src/daemon/schedule-control.js +110 -0
- package/dist/src/daemon/schedule-journal.d.ts +2 -15
- package/dist/src/daemon/schedule-journal.js +67 -4
- package/dist/src/daemon/settings-reload.d.ts +26 -0
- package/dist/src/daemon/settings-reload.js +82 -0
- package/dist/src/daemon/ticket-registration.d.ts +2 -7
- package/dist/src/daemon/ticket-registration.js +15 -81
- package/dist/src/daemon/turn-attempt-journal.d.ts +38 -0
- package/dist/src/daemon/turn-attempt-journal.js +136 -0
- package/dist/src/daemon/turn-attempts.d.ts +47 -0
- package/dist/src/daemon/turn-attempts.js +166 -0
- package/dist/src/daemon/turn-details.d.ts +4 -0
- package/dist/src/daemon/turn-details.js +33 -0
- package/dist/src/daemon/turn-report.d.ts +8 -1
- package/dist/src/daemon/turn-report.js +39 -0
- package/dist/src/daemon/work-tree.d.ts +9 -0
- package/dist/src/daemon/work-tree.js +20 -0
- package/dist/src/daemon/worker-profile.d.ts +9 -0
- package/dist/src/daemon/worker-profile.js +44 -0
- package/dist/src/daemon/workflow-generations.d.ts +7 -4
- package/dist/src/daemon/workflow-generations.js +22 -14
- package/dist/src/daemon/workflow-reload.d.ts +41 -0
- package/dist/src/daemon/workflow-reload.js +244 -0
- package/dist/src/daemon/workflow-replay.d.ts +2 -1
- package/dist/src/daemon/workflow-replay.js +7 -3
- package/dist/src/daemon/workflow-schedules.d.ts +3 -0
- package/dist/src/daemon/workflow-schedules.js +98 -45
- package/dist/src/daemon/worktree-processes.d.ts +9 -0
- package/dist/src/daemon/worktree-processes.js +151 -0
- package/dist/src/doctor-report.d.ts +4 -6
- package/dist/src/doctor-report.js +8 -13
- package/dist/src/harness-start.d.ts +15 -0
- package/dist/src/harness-start.js +37 -0
- package/dist/src/host/command-wait.d.ts +38 -0
- package/dist/src/host/command-wait.js +115 -0
- package/dist/src/host/start-delivery.d.ts +5 -7
- package/dist/src/host/start-delivery.js +3 -15
- package/dist/src/host/step-bridge-host.d.ts +2 -0
- package/dist/src/host/step-bridge-host.js +21 -0
- package/dist/src/operation-identity.d.ts +1 -0
- package/dist/src/operation-identity.js +4 -0
- package/dist/src/private-config.schema.json +71 -0
- package/dist/src/project-config.schema.json +40 -0
- package/dist/src/project-settings.d.ts +16 -2
- package/dist/src/project-settings.js +35 -1
- package/dist/src/queue-spend.d.ts +4 -0
- package/dist/src/queue-spend.js +21 -0
- package/dist/src/queue-state.d.ts +26 -0
- package/dist/src/queue-state.js +34 -0
- package/dist/src/record-retention.d.ts +46 -0
- package/dist/src/record-retention.js +81 -0
- package/dist/src/relay/relay-service.d.ts +3 -0
- package/dist/src/relay/relay-service.js +5 -3
- package/dist/src/report-ci.d.ts +164 -0
- package/dist/src/report-ci.js +32 -0
- package/dist/src/report-effects.d.ts +15 -0
- package/dist/src/report-effects.js +212 -0
- package/dist/src/report-flow-types.d.ts +38 -0
- package/dist/src/report-flow-types.js +7 -0
- package/dist/src/report-flow.d.ts +43 -0
- package/dist/src/report-flow.js +193 -0
- package/dist/src/report-operator.d.ts +67 -0
- package/dist/src/report-operator.js +25 -0
- package/dist/src/report-quality.d.ts +221 -0
- package/dist/src/report-quality.js +94 -0
- package/dist/src/report-ready.d.ts +23 -0
- package/dist/src/report-ready.js +117 -0
- package/dist/src/report-statistics.d.ts +2 -1
- package/dist/src/report-statistics.js +40 -4
- package/dist/src/report.d.ts +588 -47
- package/dist/src/report.js +156 -41
- package/dist/src/schedule-progress.d.ts +33 -0
- package/dist/src/schedule-progress.js +45 -0
- package/dist/src/service/active-tickets.js +11 -6
- package/dist/src/service/command-waits.d.ts +34 -0
- package/dist/src/service/command-waits.js +86 -0
- package/dist/src/service/dispatcher.d.ts +4 -0
- package/dist/src/service/dispatcher.js +33 -0
- package/dist/src/service/expiry.js +2 -0
- package/dist/src/service/gateway.js +3 -1
- package/dist/src/service/queue-handlers.d.ts +4 -0
- package/dist/src/service/queue-handlers.js +32 -0
- package/dist/src/service/queue-spend.d.ts +6 -0
- package/dist/src/service/queue-spend.js +68 -0
- package/dist/src/service/registry.d.ts +28 -2
- package/dist/src/service/registry.js +48 -0
- package/dist/src/service/replies.d.ts +22 -8
- package/dist/src/service/replies.js +16 -2
- package/dist/src/service/run-handlers.js +37 -12
- package/dist/src/service/run-metadata.d.ts +15 -1
- package/dist/src/service/run-metadata.js +93 -8
- package/dist/src/service/service.d.ts +11 -3
- package/dist/src/service/service.js +22 -37
- package/dist/src/service/submission-handler.js +18 -4
- package/dist/src/service/worker-port.js +9 -1
- package/dist/src/service/worker-totals.d.ts +6 -0
- package/dist/src/service/worker-totals.js +8 -1
- package/dist/src/service/workflow-reload.d.ts +35 -0
- package/dist/src/service/workflow-reload.js +52 -0
- package/dist/src/step-bridge.d.ts +20 -0
- package/dist/src/steps/command-wait.d.ts +12 -0
- package/dist/src/steps/command-wait.js +26 -0
- package/dist/src/steps/open-decision-wait.d.ts +2 -0
- package/dist/src/steps/{decision-gate.js → open-decision-wait.js} +0 -7
- package/dist/src/steps/review-by-person.js +4 -1
- package/dist/src/steps/wait-for-command.d.ts +3 -0
- package/dist/src/steps/wait-for-command.js +17 -0
- package/dist/src/steps/wait-for-decision.js +1 -1
- package/dist/src/storage/command-wait-rows.d.ts +30 -0
- package/dist/src/storage/command-wait-rows.js +96 -0
- package/dist/src/storage/decision-snapshots.d.ts +8 -2
- package/dist/src/storage/decision-snapshots.js +16 -8
- package/dist/src/storage/domain-changes.d.ts +3 -1
- package/dist/src/storage/domain-changes.js +4 -0
- package/dist/src/storage/domain-schema.d.ts +16 -1
- package/dist/src/storage/domain-schema.js +35 -4
- package/dist/src/storage/effect-schema.d.ts +2 -0
- package/dist/src/storage/effect-schema.js +9 -0
- package/dist/src/storage/projection-changes.d.ts +12 -0
- package/dist/src/storage/projection-changes.js +194 -0
- package/dist/src/storage/projection-lookups.d.ts +7 -0
- package/dist/src/storage/projection-lookups.js +30 -0
- package/dist/src/testing-requests.d.ts +15 -0
- package/dist/src/testing-requests.js +93 -0
- package/dist/src/testing.d.ts +4 -10
- package/dist/src/testing.js +33 -86
- package/dist/src/worker-usage.d.ts +1 -0
- package/dist/src/worker-usage.js +3 -0
- package/dist/src/workflow-candidate.d.ts +1 -0
- package/dist/src/workflow-candidate.js +12 -1
- package/dist/src/workflow-contracts.d.ts +1 -0
- package/dist/src/workflow-contracts.js +9 -2
- package/dist/src/workflow-declaration.d.ts +1 -0
- package/dist/src/workflow-declaration.js +3 -0
- package/dist/src/workflow-discovery.d.ts +2 -13
- package/dist/src/workflow-discovery.js +1 -13
- package/dist/src/workflow-refusals.js +0 -1
- package/dist/src/workflows.d.ts +1 -1
- package/dist/src/workflows.js +1 -1
- package/dist/tools/compile-workflows.js +3 -0
- package/dist/tools/project-configuration.d.ts +7 -2
- package/dist/tools/project-configuration.js +30 -1
- package/dist/tools/red-green-command.d.ts +1 -0
- package/dist/tools/red-green-command.js +174 -0
- package/dist/tools/red-green-process.d.ts +10 -0
- package/dist/tools/red-green-process.js +59 -0
- package/dist/tools/self-host-processes.d.ts +2 -0
- package/dist/tools/self-host-processes.js +69 -26
- package/dist/tools/self-host-project.d.ts +2 -0
- package/dist/tools/self-host-project.js +30 -77
- package/dist/tools/self-host-runtime.js +1 -1
- package/dist/tools/self-host.js +76 -34
- package/dist/tools/template-command.d.ts +1 -0
- package/dist/tools/template-command.js +160 -0
- package/dist/tools/template-copy.d.ts +11 -0
- package/dist/tools/template-copy.js +130 -0
- package/dist/tools/template-files.d.ts +17 -0
- package/dist/tools/template-files.js +74 -0
- package/dist/tools/workflow-bundles.js +1 -0
- package/dist/tools/workflow-candidate-counts.js +2 -2
- package/dist/tools/workflow-candidate-program.d.ts +4 -2
- package/dist/tools/workflow-candidate-program.js +30 -11
- package/dist/tools/workflow-candidate-shape.d.ts +3 -0
- package/dist/tools/workflow-candidate-shape.js +90 -0
- package/dist/tools/workflow-candidate-source.d.ts +1 -0
- package/dist/tools/workflow-candidate-source.js +26 -4
- package/dist/tools/workflow-candidate-syntax.d.ts +2 -2
- package/dist/tools/workflow-candidate-syntax.js +24 -94
- package/dist/tools/workflow-command.js +1 -2
- package/dist/tools/workflow-folders.d.ts +2 -3
- package/dist/tools/workflow-folders.js +1 -1
- package/package.json +17 -9
- package/templates/develop/README.md +93 -4
- package/templates/develop/develop/flow-tests.ts +38 -1
- package/templates/develop/develop/interruption-tests.ts +157 -0
- package/templates/develop/develop/local.ts +1 -0
- package/templates/develop/develop/option-tests.ts +138 -9
- package/templates/develop/develop/pull.ts +5 -1
- package/templates/develop/develop/red-green.ts +55 -0
- package/templates/develop/develop/refusal-tests.ts +77 -0
- package/templates/develop/develop/report.ts +31 -11
- package/templates/develop/develop/round.ts +1 -0
- package/templates/develop/develop/scenarios.ts +27 -0
- package/templates/develop/develop/turn.ts +28 -7
- package/templates/develop/develop.declaration.json +1 -1
- package/templates/develop/develop.test.ts +4 -0
- package/templates/develop/template.json +29 -2
- package/templates/idea-to-issue/README.md +27 -0
- package/templates/idea-to-issue/idea-to-issue/effects.ts +52 -0
- package/templates/idea-to-issue/idea-to-issue/leave.ts +10 -0
- package/templates/idea-to-issue/idea-to-issue/next.ts +29 -0
- package/templates/idea-to-issue/idea-to-issue/post-person.ts +18 -0
- package/templates/idea-to-issue/idea-to-issue/post.ts +50 -0
- package/templates/idea-to-issue/idea-to-issue/queue.ts +27 -0
- package/templates/idea-to-issue/idea-to-issue/review.ts +42 -0
- package/templates/idea-to-issue/idea-to-issue/scenarios.ts +50 -0
- package/templates/idea-to-issue/idea-to-issue/turn.ts +40 -0
- package/templates/idea-to-issue/idea-to-issue.declaration.json +16 -0
- package/templates/idea-to-issue/idea-to-issue.test.ts +79 -0
- package/templates/idea-to-issue/idea-to-issue.ts +49 -0
- package/templates/idea-to-issue/template.json +81 -0
- package/templates/review-day/README.md +97 -0
- package/templates/review-day/review-day/critique.ts +58 -0
- package/templates/review-day/review-day/decision.ts +29 -0
- package/templates/review-day/review-day/facts.ts +69 -0
- package/templates/review-day/review-day/label.ts +29 -0
- package/templates/review-day/review-day/next.ts +28 -0
- package/templates/review-day/review-day/post.ts +27 -0
- package/templates/review-day/review-day/report.ts +98 -0
- package/templates/review-day/review-day/rules.ts +12 -0
- package/templates/review-day/review-day/scenarios.ts +76 -0
- package/templates/review-day/review-day/turn.ts +73 -0
- package/templates/review-day/review-day.declaration.json +16 -0
- package/templates/review-day/review-day.test.ts +362 -0
- package/templates/review-day/review-day.ts +37 -0
- package/templates/review-day/template.json +56 -0
- package/dist/src/cli/watch-start-view.d.ts +0 -18
- package/dist/src/cli/watch-start-view.js +0 -77
- package/dist/src/steps/decision-gate.d.ts +0 -3
- package/dist/workflows/develop-prd.d.ts +0 -7
- package/dist/workflows/develop-prd.js +0 -165
- package/dist/workflows/develop-ticket.d.ts +0 -9
- package/dist/workflows/develop-ticket.js +0 -207
- package/dist/workflows/issue-labels.d.ts +0 -16
- package/dist/workflows/issue-labels.js +0 -70
- package/dist/workflows/ticket-prompts.d.ts +0 -35
- package/dist/workflows/ticket-prompts.js +0 -147
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function isMetric(value) {
|
|
2
|
+
return typeof value["status"] === "string";
|
|
3
|
+
}
|
|
4
|
+
function sectionMetrics(section, prefix) {
|
|
5
|
+
return Object.fromEntries(Object.entries(section).flatMap(([name, value]) => isMetric(value)
|
|
6
|
+
? [[`${prefix}.${name}`, value]]
|
|
7
|
+
: Object.entries(value).map(([key, metric]) => [`${prefix}.${name}.${key}`, metric])));
|
|
8
|
+
}
|
|
9
|
+
export function textReport(report) {
|
|
10
|
+
const lines = [`Loop report ${JSON.stringify(report.window)}`];
|
|
11
|
+
const { jobLogs, ...quality } = report.quality;
|
|
12
|
+
const metrics = {
|
|
13
|
+
...report.metrics,
|
|
14
|
+
...sectionMetrics(quality, "quality"),
|
|
15
|
+
...sectionMetrics(report.ci, "ci"),
|
|
16
|
+
...sectionMetrics(report.operator, "operator"),
|
|
17
|
+
};
|
|
18
|
+
for (const [name, metric] of Object.entries(metrics)) {
|
|
19
|
+
lines.push(`${name}: ${metric.status === "unavailable" ? "unavailable" : String(metric.value)}`);
|
|
20
|
+
const baseline = metric.baseline;
|
|
21
|
+
lines.push(` history: ${baseline.history}; median: ${String(baseline.median)}; band: ${JSON.stringify(baseline.band)}${metric.mark === "outside" ? "; outside" : ""}`);
|
|
22
|
+
lines.push(` comparison value: ${String(metric.comparisonValue)}`);
|
|
23
|
+
lines.push(` evidence: ${JSON.stringify(metric.evidence)}`);
|
|
24
|
+
lines.push(` baseline evidence: ${JSON.stringify(baseline.evidence)}`);
|
|
25
|
+
}
|
|
26
|
+
lines.push(`Quality job logs: ${JSON.stringify(jobLogs)}`);
|
|
27
|
+
lines.push(`Run costs (USD): ${JSON.stringify(report.runCosts)}`);
|
|
28
|
+
lines.push(`Completed ticket costs (USD): ${JSON.stringify(report.completedTicketCosts)}`);
|
|
29
|
+
lines.push(`Semantics: ${JSON.stringify(report.semantics)}`);
|
|
30
|
+
lines.push(`Sources: ${JSON.stringify(report.sources)}`);
|
|
31
|
+
lines.push(`Coverage: ${JSON.stringify(report.coverage)}`);
|
|
32
|
+
return lines.join("\n") + "\n";
|
|
33
|
+
}
|
package/dist/src/cli/report.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { type Fields } from "../protocol.ts";
|
|
|
2
2
|
import { type ReportCompletion } from "../report.ts";
|
|
3
3
|
import type { WatchPrSettings } from "./watch-pr-settings.ts";
|
|
4
4
|
interface ReportEnvironment {
|
|
5
|
+
readonly now?: number;
|
|
5
6
|
readonly runtimeDirectory: string;
|
|
6
7
|
readonly workingDirectory: string;
|
|
7
8
|
readonly watchPr?: WatchPrSettings;
|
package/dist/src/cli/report.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { textReport } from "./report-text.js";
|
|
1
2
|
import { record } from "../protocol.js";
|
|
2
3
|
import { loopReport, } from "../report.js";
|
|
3
4
|
import { send } from "./client.js";
|
|
5
|
+
import { readReportFlow } from "./report-flow.js";
|
|
4
6
|
import { readReportGithub } from "./report-github.js";
|
|
5
7
|
function reportRecord(value, after) {
|
|
6
8
|
const event = record(value) ?? {};
|
|
@@ -22,6 +24,10 @@ function appendEvents(snapshot, values) {
|
|
|
22
24
|
snapshot.after = parsed.sequence;
|
|
23
25
|
if (snapshot.observedSince === null || parsed.at < snapshot.observedSince)
|
|
24
26
|
snapshot.observedSince = parsed.at;
|
|
27
|
+
if (["effect.requested", "effect.reported"].includes(String(parsed.event["type"])))
|
|
28
|
+
snapshot.effects.push({ ...parsed.event, at: parsed.at });
|
|
29
|
+
if (["run.started", "schedule.skipped"].includes(String(parsed.event["type"])))
|
|
30
|
+
snapshot.flowEvents.push(parsed.event);
|
|
25
31
|
const completion = reportCompletion(parsed.event);
|
|
26
32
|
if (completion === null)
|
|
27
33
|
continue;
|
|
@@ -36,6 +42,8 @@ async function daemonReport(runtime) {
|
|
|
36
42
|
latest: null,
|
|
37
43
|
observedSince: null,
|
|
38
44
|
completions: new Map(),
|
|
45
|
+
effects: [],
|
|
46
|
+
flowEvents: [],
|
|
39
47
|
};
|
|
40
48
|
for (;;) {
|
|
41
49
|
const reply = await send(runtime, {
|
|
@@ -57,6 +65,8 @@ async function daemonReport(runtime) {
|
|
|
57
65
|
if (snapshot.after >= snapshot.latest)
|
|
58
66
|
return {
|
|
59
67
|
completions: [...snapshot.completions.values()],
|
|
68
|
+
effects: snapshot.effects,
|
|
69
|
+
flowEvents: snapshot.flowEvents,
|
|
60
70
|
observedSince: snapshot.observedSince,
|
|
61
71
|
};
|
|
62
72
|
if (events.length < 1000)
|
|
@@ -78,11 +88,12 @@ async function runCost(runtime, runId) {
|
|
|
78
88
|
if (reply.kind === "error")
|
|
79
89
|
return { runId, turns: null };
|
|
80
90
|
const run = record(reply.result["run"]);
|
|
81
|
-
|
|
82
|
-
if (run?.["runId"] !== runId ||
|
|
83
|
-
!Array.isArray(turns) ||
|
|
84
|
-
!settledSpending(run))
|
|
91
|
+
if (run?.["runId"] !== runId)
|
|
85
92
|
return { runId, turns: null };
|
|
93
|
+
const turns = run["workerTurns"];
|
|
94
|
+
const ticket = runTicket(run);
|
|
95
|
+
if (!Array.isArray(turns) || !settledSpending(run))
|
|
96
|
+
return { runId, ...ticket, turns: null };
|
|
86
97
|
const parsed = turns.map((value) => {
|
|
87
98
|
const turn = record(value);
|
|
88
99
|
const operationId = turn?.["operationId"];
|
|
@@ -97,29 +108,14 @@ async function runCost(runtime, runId) {
|
|
|
97
108
|
});
|
|
98
109
|
return {
|
|
99
110
|
runId,
|
|
111
|
+
...ticket,
|
|
100
112
|
turns: parsed.some((turn) => turn === null)
|
|
101
113
|
? null
|
|
102
114
|
: parsed.filter((turn) => turn !== null),
|
|
103
115
|
};
|
|
104
116
|
}
|
|
105
|
-
function textReport(report) {
|
|
106
|
-
const lines = [`Loop report ${JSON.stringify(report["window"])}`];
|
|
107
|
-
for (const [name, value] of Object.entries(record(report["metrics"]) ?? {})) {
|
|
108
|
-
const metric = record(value) ?? {};
|
|
109
|
-
lines.push(`${name}: ${metric["status"] === "unavailable" ? "unavailable" : String(metric["value"])}`);
|
|
110
|
-
const baseline = record(metric["baseline"]) ?? {};
|
|
111
|
-
lines.push(` history: ${String(baseline["history"])}; median: ${String(baseline["median"])}; band: ${JSON.stringify(baseline["band"])}${metric["mark"] === "outside" ? "; outside" : ""}`);
|
|
112
|
-
lines.push(` comparison value: ${String(metric["comparisonValue"])}`);
|
|
113
|
-
lines.push(` evidence: ${JSON.stringify(metric["evidence"])}`);
|
|
114
|
-
lines.push(` baseline evidence: ${JSON.stringify(baseline["evidence"])}`);
|
|
115
|
-
}
|
|
116
|
-
lines.push(`Run costs (USD): ${JSON.stringify(report["runCosts"])}`);
|
|
117
|
-
lines.push(`Sources: ${JSON.stringify(report["sources"])}`);
|
|
118
|
-
lines.push(`Coverage: ${JSON.stringify(report["coverage"])}`);
|
|
119
|
-
return lines.join("\n") + "\n";
|
|
120
|
-
}
|
|
121
117
|
export async function reportCommand(invocation, environment) {
|
|
122
|
-
const now = Date.now();
|
|
118
|
+
const now = environment.now ?? Date.now();
|
|
123
119
|
const since = new Date(now - (invocation.since + 168) * 3_600_000).toISOString();
|
|
124
120
|
const settings = environment.watchPr === undefined ? {} : { settings: environment.watchPr };
|
|
125
121
|
const [daemonRead, githubRead] = await Promise.allSettled([
|
|
@@ -128,14 +124,25 @@ export async function reportCommand(invocation, environment) {
|
|
|
128
124
|
]);
|
|
129
125
|
const daemon = daemonRead.status === "fulfilled"
|
|
130
126
|
? daemonRead.value
|
|
131
|
-
: {
|
|
127
|
+
: {
|
|
128
|
+
completions: null,
|
|
129
|
+
effects: null,
|
|
130
|
+
flowEvents: null,
|
|
131
|
+
observedSince: null,
|
|
132
|
+
};
|
|
132
133
|
const github = githubRead.status === "fulfilled" ? { github: githubRead.value } : {};
|
|
133
|
-
const costs =
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
const costs = await reportCosts(environment.runtimeDirectory, {
|
|
135
|
+
completions: daemon.completions ?? [],
|
|
136
|
+
start: Date.parse(since),
|
|
137
|
+
end: now,
|
|
138
|
+
issues: githubRead.status === "fulfilled" ? githubRead.value.issues : null,
|
|
139
|
+
});
|
|
138
140
|
const calculated = loopReport({
|
|
141
|
+
flow: await readReportFlow(environment.runtimeDirectory, {
|
|
142
|
+
events: daemon.flowEvents,
|
|
143
|
+
start: Date.parse(since),
|
|
144
|
+
completions: daemon.completions,
|
|
145
|
+
}),
|
|
139
146
|
since: invocation.since,
|
|
140
147
|
now,
|
|
141
148
|
...daemon,
|
|
@@ -190,3 +197,73 @@ export function reportCompletion(event) {
|
|
|
190
197
|
throw new Error("invalid-report-event");
|
|
191
198
|
return { runId, sequence, at: Date.parse(at), outcome };
|
|
192
199
|
}
|
|
200
|
+
function runTicket(run) {
|
|
201
|
+
const ticketId = run?.["ticketId"];
|
|
202
|
+
return ticketId === null || (typeof ticketId === "string" && ticketId !== "")
|
|
203
|
+
? { ticketId }
|
|
204
|
+
: {};
|
|
205
|
+
}
|
|
206
|
+
async function ticketIndex(runtime) {
|
|
207
|
+
const index = new Map();
|
|
208
|
+
let after = "";
|
|
209
|
+
for (;;) {
|
|
210
|
+
const reply = await send(runtime, {
|
|
211
|
+
operation: "status",
|
|
212
|
+
parameters: { metadata: "tickets", after, limit: 500 },
|
|
213
|
+
});
|
|
214
|
+
if (reply.kind === "error")
|
|
215
|
+
throw new Error(reply.error.code);
|
|
216
|
+
const runs = reply.result["runs"];
|
|
217
|
+
if (!Array.isArray(runs))
|
|
218
|
+
throw new Error("invalid-report-ticket-index");
|
|
219
|
+
const latest = appendTicketIndex(index, { runs, after });
|
|
220
|
+
const next = reply.result["next"];
|
|
221
|
+
if (next === null)
|
|
222
|
+
return index;
|
|
223
|
+
if (typeof next !== "string" || next !== latest || next <= after)
|
|
224
|
+
throw new Error("invalid-report-ticket-cursor");
|
|
225
|
+
after = next;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
async function reportCosts(runtime, input) {
|
|
229
|
+
const ended = input.completions.filter((event) => event.at < input.end);
|
|
230
|
+
const costs = [];
|
|
231
|
+
for (const event of ended.filter((event) => event.at >= input.start))
|
|
232
|
+
costs.push(await runCost(runtime, event.runId));
|
|
233
|
+
const older = ended.filter((event) => event.at < input.start);
|
|
234
|
+
const tickets = new Set((input.issues ?? [])
|
|
235
|
+
.filter((issue) => issue.at >= input.start && issue.at < input.end)
|
|
236
|
+
.map((issue) => String(issue.evidence["issue"])));
|
|
237
|
+
if (older.length === 0 || tickets.size === 0)
|
|
238
|
+
return costs;
|
|
239
|
+
try {
|
|
240
|
+
const index = await ticketIndex(runtime);
|
|
241
|
+
for (const event of older) {
|
|
242
|
+
const ticketId = index.get(event.runId);
|
|
243
|
+
if (ticketId === undefined)
|
|
244
|
+
continue;
|
|
245
|
+
costs.push(ticketId !== null && tickets.has(ticketId)
|
|
246
|
+
? await runCost(runtime, event.runId)
|
|
247
|
+
: { runId: event.runId, ticketId, turns: null });
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
catch {
|
|
251
|
+
return costs;
|
|
252
|
+
}
|
|
253
|
+
return costs;
|
|
254
|
+
}
|
|
255
|
+
function appendTicketIndex(index, page) {
|
|
256
|
+
let latest = page.after;
|
|
257
|
+
for (const value of page.runs) {
|
|
258
|
+
const row = record(value);
|
|
259
|
+
const runId = row?.["runId"];
|
|
260
|
+
const ticketId = row?.["ticketId"];
|
|
261
|
+
if (typeof runId !== "string" ||
|
|
262
|
+
runId <= latest ||
|
|
263
|
+
!(ticketId === null || (typeof ticketId === "string" && ticketId !== "")))
|
|
264
|
+
throw new Error("invalid-report-ticket-index");
|
|
265
|
+
index.set(runId, ticketId);
|
|
266
|
+
latest = runId;
|
|
267
|
+
}
|
|
268
|
+
return latest;
|
|
269
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type ScheduleInvocation } from "./schedule-arguments.ts";
|
|
2
|
+
import { type QueueInvocation } from "./queue-arguments.ts";
|
|
1
3
|
export type RunSource = {
|
|
2
4
|
readonly kind: "prompt";
|
|
3
5
|
readonly text: string;
|
|
@@ -8,12 +10,15 @@ export type RunSource = {
|
|
|
8
10
|
readonly kind: "input";
|
|
9
11
|
readonly file: string;
|
|
10
12
|
};
|
|
11
|
-
type DecisionCommand = "answer" | "approve" | "deny";
|
|
12
|
-
type RunCommand = "pause" | "resume" | "drop";
|
|
13
|
-
export type RuntimeInvocation = {
|
|
13
|
+
export type DecisionCommand = "answer" | "approve" | "deny";
|
|
14
|
+
export type RunCommand = "pause" | "resume" | "drop";
|
|
15
|
+
export type RuntimeInvocation = ScheduleInvocation | QueueInvocation | {
|
|
14
16
|
readonly kind: "report";
|
|
15
17
|
readonly since: number;
|
|
16
18
|
readonly json: boolean;
|
|
19
|
+
} | {
|
|
20
|
+
readonly kind: "reload";
|
|
21
|
+
readonly json: boolean;
|
|
17
22
|
} | {
|
|
18
23
|
readonly kind: "command-help";
|
|
19
24
|
readonly command: string;
|
|
@@ -28,6 +33,7 @@ export type RuntimeInvocation = {
|
|
|
28
33
|
readonly runId: string | null;
|
|
29
34
|
readonly limit: number | null;
|
|
30
35
|
readonly after: string | null;
|
|
36
|
+
readonly active: boolean;
|
|
31
37
|
readonly json: boolean;
|
|
32
38
|
} | {
|
|
33
39
|
readonly kind: "questions";
|
|
@@ -72,6 +78,15 @@ export interface RuntimeRequest {
|
|
|
72
78
|
readonly options: readonly GivenOption[];
|
|
73
79
|
}
|
|
74
80
|
type Outcome = RuntimeInvocation | string;
|
|
81
|
+
export declare const argumentRules: {
|
|
82
|
+
identifier: RegExp;
|
|
83
|
+
decisionReference: RegExp;
|
|
84
|
+
sha256Digest: RegExp;
|
|
85
|
+
revisions: {
|
|
86
|
+
minimum: number;
|
|
87
|
+
maximum: number;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
75
90
|
export declare function isRuntimeCommand(command: string): boolean;
|
|
76
91
|
export declare function runtimeInvocation(request: RuntimeRequest): Outcome;
|
|
77
92
|
export {};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { isRecordKey } from "../authority/commands.js";
|
|
2
|
+
import { scheduleInvocation, } from "./schedule-arguments.js";
|
|
3
|
+
import { queueInvocation } from "./queue-arguments.js";
|
|
2
4
|
const identifier = /^[A-Za-z0-9._:/-]{1,128}$/;
|
|
3
5
|
const decisionReference = /^[A-Za-z0-9._:/-]{1,256}$/;
|
|
4
6
|
const sha256Digest = /^sha256:[0-9a-f]{64}$/;
|
|
@@ -8,6 +10,12 @@ const revisions = { minimum: 1, maximum: Number.MAX_SAFE_INTEGER };
|
|
|
8
10
|
const sequences = { minimum: 0, maximum: Number.MAX_SAFE_INTEGER };
|
|
9
11
|
const bindingOptions = ["expected-revision", "generation", "subject-digest"];
|
|
10
12
|
const mutationOptions = ["command-id", "json"];
|
|
13
|
+
export const argumentRules = {
|
|
14
|
+
identifier,
|
|
15
|
+
decisionReference,
|
|
16
|
+
sha256Digest,
|
|
17
|
+
revisions,
|
|
18
|
+
};
|
|
11
19
|
const shapes = new Map([
|
|
12
20
|
[
|
|
13
21
|
"run",
|
|
@@ -51,37 +59,37 @@ const shapes = new Map([
|
|
|
51
59
|
build: events,
|
|
52
60
|
},
|
|
53
61
|
],
|
|
62
|
+
["report", noSubjectShape(["since", "json"], report)],
|
|
54
63
|
[
|
|
55
|
-
"
|
|
56
|
-
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
build: report,
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
[
|
|
64
|
-
"watch",
|
|
65
|
-
{
|
|
66
|
-
subject: "none",
|
|
67
|
-
required: [],
|
|
68
|
-
allowed: () => ["port"],
|
|
69
|
-
build: watch,
|
|
70
|
-
},
|
|
64
|
+
"reload",
|
|
65
|
+
noSubjectShape(["json"], (request) => ({
|
|
66
|
+
kind: "reload",
|
|
67
|
+
json: given(request, "json"),
|
|
68
|
+
})),
|
|
71
69
|
],
|
|
70
|
+
["watch", noSubjectShape(["port"], watch)],
|
|
72
71
|
]);
|
|
72
|
+
function noSubjectShape(allowed, build) {
|
|
73
|
+
return { subject: "none", required: [], allowed: () => allowed, build };
|
|
74
|
+
}
|
|
73
75
|
export function isRuntimeCommand(command) {
|
|
74
|
-
return shapes.has(command);
|
|
76
|
+
return command === "schedule" || command === "queue" || shapes.has(command);
|
|
75
77
|
}
|
|
76
78
|
export function runtimeInvocation(request) {
|
|
77
79
|
const shape = shapes.get(request.command);
|
|
78
|
-
if (
|
|
80
|
+
if (!isRuntimeCommand(request.command))
|
|
79
81
|
return "unknown-command";
|
|
80
82
|
const names = request.options.map((option) => option.name);
|
|
81
83
|
if (new Set(names).size !== names.length)
|
|
82
84
|
return "repeated-option";
|
|
83
85
|
if (names.includes("help"))
|
|
84
86
|
return { kind: "command-help", command: request.command };
|
|
87
|
+
if (request.command === "schedule")
|
|
88
|
+
return scheduleInvocation(request);
|
|
89
|
+
if (request.command === "queue")
|
|
90
|
+
return queueInvocation(request);
|
|
91
|
+
if (shape === undefined)
|
|
92
|
+
return "unknown-command";
|
|
85
93
|
return shapeFailure(shape, request) ?? shape.build(request);
|
|
86
94
|
}
|
|
87
95
|
function shapeFailure(shape, request) {
|
|
@@ -118,7 +126,7 @@ function runCommandShape(command) {
|
|
|
118
126
|
}
|
|
119
127
|
function statusOptions(request) {
|
|
120
128
|
return request.positionals.length === 0
|
|
121
|
-
? ["limit", "after", "json"]
|
|
129
|
+
? ["active", "limit", "after", "json"]
|
|
122
130
|
: ["json"];
|
|
123
131
|
}
|
|
124
132
|
function eventOptions(request) {
|
|
@@ -192,8 +200,9 @@ function status(request) {
|
|
|
192
200
|
const after = matching(valueOf(request, "after"), identifier);
|
|
193
201
|
if (runId === invalid || limit === invalid || after === invalid)
|
|
194
202
|
return "invalid-option-value";
|
|
203
|
+
const active = given(request, "active");
|
|
195
204
|
const json = given(request, "json");
|
|
196
|
-
return { kind: "status", runId, limit, after, json };
|
|
205
|
+
return { kind: "status", runId, limit, after, active, json };
|
|
197
206
|
}
|
|
198
207
|
function watch(request) {
|
|
199
208
|
const port = whole(valueOf(request, "port"), { minimum: 0, maximum: 65535 });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ServiceRequest } from "../protocol.ts";
|
|
2
|
+
export interface ScheduleInvocation {
|
|
3
|
+
readonly kind: "schedule";
|
|
4
|
+
readonly action: "list" | "pause" | "resume";
|
|
5
|
+
readonly workflowId: string | null;
|
|
6
|
+
readonly json: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function scheduleInvocation(request: {
|
|
9
|
+
readonly positionals: readonly string[];
|
|
10
|
+
readonly options: readonly {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
}[];
|
|
13
|
+
}): ScheduleInvocation | string;
|
|
14
|
+
export declare function scheduleServiceRequest(invocation: ScheduleInvocation): ServiceRequest;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isRecordKey } from "../authority/commands.js";
|
|
2
|
+
export function scheduleInvocation(request) {
|
|
3
|
+
if (request.options.some((option) => option.name !== "json"))
|
|
4
|
+
return "unexpected-option";
|
|
5
|
+
const [action, workflowId] = request.positionals;
|
|
6
|
+
const json = request.options.some((option) => option.name === "json");
|
|
7
|
+
if (action === undefined)
|
|
8
|
+
return { kind: "schedule", action: "list", workflowId: null, json };
|
|
9
|
+
if (action !== "pause" && action !== "resume")
|
|
10
|
+
return "invalid-schedule-action";
|
|
11
|
+
if (workflowId === undefined)
|
|
12
|
+
return "missing-argument";
|
|
13
|
+
if (request.positionals.length > 2)
|
|
14
|
+
return "unexpected-argument";
|
|
15
|
+
if (!isRecordKey(workflowId))
|
|
16
|
+
return "invalid-option-value";
|
|
17
|
+
return { kind: "schedule", action, workflowId, json };
|
|
18
|
+
}
|
|
19
|
+
export function scheduleServiceRequest(invocation) {
|
|
20
|
+
return {
|
|
21
|
+
operation: "schedule",
|
|
22
|
+
parameters: invocation.workflowId === null
|
|
23
|
+
? { action: invocation.action }
|
|
24
|
+
: { action: invocation.action, workflowId: invocation.workflowId },
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Fields } from "../protocol.ts";
|
|
2
|
+
export declare function scheduleLines(result: Fields): readonly string[];
|
|
3
|
+
export interface ShownSchedule {
|
|
4
|
+
readonly workflowId: string;
|
|
5
|
+
readonly everySeconds: number;
|
|
6
|
+
readonly state: "active" | "paused" | "stopped";
|
|
7
|
+
readonly failuresInRow: number;
|
|
8
|
+
readonly nextAt: number | null;
|
|
9
|
+
readonly stoppedAt: number | null;
|
|
10
|
+
}
|
|
11
|
+
export declare function scheduleStatusLine(schedule: ShownSchedule, style?: "status" | "watch"): string;
|
|
12
|
+
export type ShownSchedules = readonly ShownSchedule[] | {
|
|
13
|
+
readonly status: "unavailable";
|
|
14
|
+
};
|
|
15
|
+
export declare function shownSchedules(value: unknown): ShownSchedules;
|
|
16
|
+
export declare function statusScheduleLines(value: unknown): readonly string[];
|
|
17
|
+
export declare function shownScheduled(value: unknown): {
|
|
18
|
+
readonly scheduled?: {
|
|
19
|
+
readonly slot: number;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare function scheduledText(value: unknown): string;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { record } from "../protocol.js";
|
|
2
|
+
function line(value) {
|
|
3
|
+
const schedule = record(value) ?? {};
|
|
4
|
+
const nextAt = schedule["nextAt"];
|
|
5
|
+
const runId = schedule["activeRunId"];
|
|
6
|
+
const activeRun = typeof runId === "string" ? runId : "none";
|
|
7
|
+
const next = typeof nextAt === "number" ? new Date(nextAt).toISOString() : "none";
|
|
8
|
+
return ` ${String(schedule["workflowId"])} every ${String(schedule["everySeconds"])} seconds ${String(schedule["state"])} next ${next} ${String(schedule["failuresInRow"])} failures in a row slot ${String(schedule["lastSlot"])} active run ${activeRun}`;
|
|
9
|
+
}
|
|
10
|
+
export function scheduleLines(result) {
|
|
11
|
+
if (result["kind"] === "schedule")
|
|
12
|
+
return [line(result["schedule"])];
|
|
13
|
+
const schedules = result["schedules"];
|
|
14
|
+
const lines = Array.isArray(schedules) ? schedules.map(line) : [];
|
|
15
|
+
return ["Schedules:", ...(lines.length === 0 ? [" none"] : lines)];
|
|
16
|
+
}
|
|
17
|
+
export function scheduleStatusLine(schedule, style = "status") {
|
|
18
|
+
const time = (at) => style === "watch"
|
|
19
|
+
? new Date(at).toLocaleString()
|
|
20
|
+
: new Date(at).toISOString();
|
|
21
|
+
const next = schedule.state === "active" && schedule.nextAt !== null
|
|
22
|
+
? `, next run at ${time(schedule.nextAt)}`
|
|
23
|
+
: "";
|
|
24
|
+
const stopped = schedule.state === "stopped" && schedule.stoppedAt !== null
|
|
25
|
+
? `, stopped at ${time(schedule.stoppedAt)}`
|
|
26
|
+
: "";
|
|
27
|
+
return `Schedule ${schedule.workflowId}: every ${String(schedule.everySeconds)} s, ${schedule.state}${next}${stopped}, ${String(schedule.failuresInRow)} failures in a row`;
|
|
28
|
+
}
|
|
29
|
+
export function shownSchedules(value) {
|
|
30
|
+
if (record(value)?.["status"] === "unavailable")
|
|
31
|
+
return { status: "unavailable" };
|
|
32
|
+
if (!Array.isArray(value))
|
|
33
|
+
return [];
|
|
34
|
+
return value.flatMap((entry) => {
|
|
35
|
+
const schedule = record(entry);
|
|
36
|
+
if (typeof schedule?.["workflowId"] !== "string" ||
|
|
37
|
+
typeof schedule["everySeconds"] !== "number" ||
|
|
38
|
+
typeof schedule["failuresInRow"] !== "number")
|
|
39
|
+
return [];
|
|
40
|
+
const state = schedule["state"];
|
|
41
|
+
if (state !== "active" && state !== "paused" && state !== "stopped")
|
|
42
|
+
return [];
|
|
43
|
+
const stamp = (value) => typeof value === "number" && Number.isFinite(new Date(value).getTime())
|
|
44
|
+
? value
|
|
45
|
+
: null;
|
|
46
|
+
return [
|
|
47
|
+
{
|
|
48
|
+
workflowId: schedule["workflowId"],
|
|
49
|
+
everySeconds: schedule["everySeconds"],
|
|
50
|
+
state,
|
|
51
|
+
failuresInRow: schedule["failuresInRow"],
|
|
52
|
+
nextAt: stamp(schedule["nextAt"]),
|
|
53
|
+
stoppedAt: stamp(schedule["stoppedAt"]),
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export function statusScheduleLines(value) {
|
|
59
|
+
const schedules = shownSchedules(value);
|
|
60
|
+
return "status" in schedules
|
|
61
|
+
? ["Schedules: unavailable"]
|
|
62
|
+
: schedules.map((schedule) => scheduleStatusLine(schedule));
|
|
63
|
+
}
|
|
64
|
+
export function shownScheduled(value) {
|
|
65
|
+
const slot = record(value)?.["slot"];
|
|
66
|
+
return typeof slot === "number" && Number.isSafeInteger(slot) && slot >= 0
|
|
67
|
+
? { scheduled: { slot } }
|
|
68
|
+
: {};
|
|
69
|
+
}
|
|
70
|
+
export function scheduledText(value) {
|
|
71
|
+
const { scheduled } = shownScheduled(value);
|
|
72
|
+
return scheduled === undefined ? "" : `scheduled ${String(scheduled.slot)}`;
|
|
73
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export function show(value) {
|
|
2
|
+
return typeof value === "string" ? value : JSON.stringify(value);
|
|
3
|
+
}
|
|
4
|
+
function escaped(character) {
|
|
5
|
+
return `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`;
|
|
6
|
+
}
|
|
7
|
+
const hiddenRanges = [
|
|
8
|
+
[0x00, 0x1f],
|
|
9
|
+
[0x7f, 0x9f],
|
|
10
|
+
[0x061c, 0x061c],
|
|
11
|
+
[0x200b, 0x200f],
|
|
12
|
+
[0x2028, 0x202e],
|
|
13
|
+
[0x2060, 0x2069],
|
|
14
|
+
[0xfeff, 0xfeff],
|
|
15
|
+
];
|
|
16
|
+
function hidden(character) {
|
|
17
|
+
const code = character.charCodeAt(0);
|
|
18
|
+
return hiddenRanges.some(([first, last]) => code >= first && code <= last);
|
|
19
|
+
}
|
|
20
|
+
export function oneLine(value) {
|
|
21
|
+
return Array.from(show(value), (character) => hidden(character) ? escaped(character) : character).join("");
|
|
22
|
+
}
|
|
23
|
+
export function visible(value) {
|
|
24
|
+
return show(value)
|
|
25
|
+
.split("\n")
|
|
26
|
+
.map((line) => Array.from(line, (character) => hidden(character) ? escaped(character) : character).join(""))
|
|
27
|
+
.join("\n ");
|
|
28
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ToolchainIdentity } from "../workflow-admission.ts";
|
|
2
2
|
export declare const supportedNodes: string;
|
|
3
|
+
export declare const clovingVersion: string;
|
|
3
4
|
export declare function supportedNode(version: string): boolean;
|
|
4
5
|
export declare function observedToolchain(start: string): Promise<ToolchainIdentity>;
|
|
5
6
|
export declare function qualifiedToolchain(observed: ToolchainIdentity, start: string): Promise<ToolchainIdentity>;
|
|
@@ -4,6 +4,7 @@ import { access, readFile, realpath } from "node:fs/promises";
|
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
5
|
import packageMetadata from "#package" with { type: "json" };
|
|
6
6
|
export const supportedNodes = packageMetadata.engines.node;
|
|
7
|
+
export const clovingVersion = packageMetadata.version;
|
|
7
8
|
export function supportedNode(version) {
|
|
8
9
|
const release = /^v(\d+)\.(\d+)\.(\d+)$/.exec(version);
|
|
9
10
|
if (release === null)
|
|
@@ -6,3 +6,4 @@ export declare function statusJson(result: Fields): Fields;
|
|
|
6
6
|
import { type Fields } from "../protocol.ts";
|
|
7
7
|
export declare function attemptText(attempt: WorkerAttemptUsage): string;
|
|
8
8
|
export declare function attemptTexts(value: unknown): readonly string[];
|
|
9
|
+
export declare function queueSpendLines(value: unknown): readonly string[];
|
|
@@ -60,8 +60,35 @@ export function attemptText(attempt) {
|
|
|
60
60
|
const kind = attempt.retryKind === undefined
|
|
61
61
|
? ""
|
|
62
62
|
: ` · retryKind: ${String(attempt.retryKind)}`;
|
|
63
|
-
|
|
63
|
+
const resumed = attempt.resumedAfter === undefined
|
|
64
|
+
? ""
|
|
65
|
+
: ` · resumedAfter: ${attempt.resumedAfter}`;
|
|
66
|
+
return `Attempt ${String(attempt.attempt)} · ${attempt.model ?? "Model not known"}${kind}${resumed} · ${priceText(attempt.costUsd, attempt.estimatedCostUsd)}`;
|
|
64
67
|
}
|
|
65
68
|
export function attemptTexts(value) {
|
|
66
69
|
return (attemptsOf(value) ?? []).map(attemptText);
|
|
67
70
|
}
|
|
71
|
+
export function queueSpendLines(value) {
|
|
72
|
+
const spend = record(value);
|
|
73
|
+
if (spend === undefined)
|
|
74
|
+
return [];
|
|
75
|
+
const spent = priceOf(spend["spentUsd"]);
|
|
76
|
+
const limit = priceOf(spend["limitUsd"]);
|
|
77
|
+
const unknown = Number(spend["unknownTurns"]);
|
|
78
|
+
const working = Number(spend["turnsInWork"]);
|
|
79
|
+
return [
|
|
80
|
+
`Spend: ${priceText(spent).replace(/ USD$/, "")} of ${priceText(limit)} in the last 24 hours`,
|
|
81
|
+
...(unknown > 0
|
|
82
|
+
? [`${String(unknown)} turn${unknown === 1 ? "" : "s"} with unknown cost`]
|
|
83
|
+
: []),
|
|
84
|
+
...(working > 0
|
|
85
|
+
? [`${String(working)} turn${working === 1 ? "" : "s"} in work`]
|
|
86
|
+
: []),
|
|
87
|
+
...(spend["holding"] === true
|
|
88
|
+
? ["Queue holds new runs for spend limit"]
|
|
89
|
+
: []),
|
|
90
|
+
...(spent !== null && limit !== null && spent > limit
|
|
91
|
+
? ["Spend is over the limit"]
|
|
92
|
+
: []),
|
|
93
|
+
];
|
|
94
|
+
}
|
package/dist/src/cli/usage.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const configUsage = "Usage: cloving config list [--json]\n cloving config get <field> [--json]\n cloving config set <field> <value> [--private] [--json]\n cloving config unset <field> [--private] [--json]\n\nReads and changes settings for the current repository; --repository selects another repository.\nValues use JSON when valid, otherwise text. Every change is checked before writing.\nFields use their default project or private file; --private selects the private file.\nlist and get show the effective source and hidden file values. Unconfigured values use defaults; null means no value.\nChanges keep the previous file as .bak and replace the file atomically under a lock.\nA live lock waits at most ten seconds, then exits with settings-locked.\nPrivate files, backups and temporary files have mode 0600.
|
|
1
|
+
export declare const configUsage = "Usage: cloving config list [--json]\n cloving config get <field> [--json]\n cloving config set <field> <value> [--private] [--json]\n cloving config unset <field> [--private] [--json]\n\nReads and changes settings for the current repository; --repository selects another repository.\nValues use JSON when valid, otherwise text. Every change is checked before writing.\nFields use their default project or private file; --private selects the private file.\nlist and get show the effective source and hidden file values. Unconfigured values use defaults; null means no value.\nChanges keep the previous file as .bak and replace the file atomically under a lock.\nA live lock waits at most ten seconds, then exits with settings-locked.\nPrivate files, backups and temporary files have mode 0600.\ncloving reload applies changes of profiles, fallbackModels, tokenPrices and workflows.folder. Other changes require a service restart.\n";
|
|
2
2
|
export declare const commandUsage: Readonly<Record<string, string>>;
|
|
3
|
-
export declare const usage = "Usage: cloving [--help] [--version]\n cloving workflows list [--json] [--repository <directory>]\n cloving workflows test [<id>] [--repository <directory>]\n cloving workflows validate <manifest-path> [--input <json-file>] [--json]\n cloving templates list [--json]\n cloving templates show <name> [--json]\n cloving templates copy <name> [--id <workflow-id>] [--json] [--repository <directory>]\n cloving <command> [--help]\n\nCommands:\n workflows list List
|
|
3
|
+
export declare const usage = "Usage: cloving [--help] [--version]\n cloving workflows list [--json] [--repository <directory>]\n cloving workflows test [<id>] [--repository <directory>]\n cloving workflows validate <manifest-path> [--input <json-file>] [--json]\n cloving init [--harness <name or path>] [--repository <directory>]\n cloving init-prompt [--repository <directory>]\n cloving templates list [--json]\n cloving templates show <name> [--json]\n cloving templates copy <name> [--id <workflow-id>] [--json] [--repository <directory>]\n cloving red-green\n cloving <command> [--help]\n\nCommands:\n workflows list List project and user workflows and refusal codes.\n workflows test Run project and user workflow tests without a service.\n workflows validate Check a compiled workflow manifest, its artifacts and optional runtime input.\n templates list List the workflow templates of the package.\n templates show Show the decision points and the files of one template.\n templates copy Copy one template into .cloving/workflows of the repository.\n red-green Check assertion failure on the base and success on the head.\n init Start the setup agent\n init-prompt Print setup instructions for an agent.\n doctor Check repository requirements before starting or submitting work.\n run Submit one run of an admitted workflow.\n status List the runs or show one run.\n mcp Serve the Cloving tools over stdio.\n schedule List, pause and resume workflow schedules.\n queue Show, resume and drain the queue.\n report Report loop facts and seven-day baselines.\n questions List the pending decisions.\n answer Answer one design question.\n approve Approve one pending approval.\n deny Deny one pending approval.\n pause Stop new dispatch for a run.\n resume Resume a paused run.\n drop Cancel a run and keep its files.\n events Print the committed events.\n watch Serve a page that shows the runs live.\n reload Check and compile the workflow files again.\n phone Show, list, remove and reset the connected phones.\n config Read and change repository settings.\n start Start the service for a repository.\n\nThe runtime commands need a Cloving service. They use the current git repository; --repository <directory> selects another repository. CLOVING_RUNTIME_DIR overrides its runtime directory.\nUse npm exec -- cloving ... for a project-local installation.\n";
|
|
4
4
|
export declare const validateUsage = "Usage: cloving workflows validate <manifest-path> [--input <json-file>] [--json]\n\nChecks a Cloving workflow manifest, its compiled SDK artifacts, declared resources and toolchain, and an optional runtime input file. Relative paths resolve against the current directory.\n\nOptions:\n --input <json-file> Validate this runtime input file.\n --json Print one versioned JSON result on stdout.\n\nValidation does not admit a run, dispatch effects, import workflow code or call a model.\n\nExample:\n cloving workflows validate cloving.workflow.json --input input.json\n";
|
|
5
5
|
export declare const phoneUsage = "Usage: cloving phone status [--json]\n cloving phone list [--json]\n cloving phone remove <device-id> [--json]\n cloving phone reset [--json]\n\nShows and changes the phones that answer the questions of this computer.\nstatus shows the registration with cloving.ai and the number of phones.\nlist shows each phone with its device ID, name, platform, state and pairing time.\nremove marks one phone removed on this computer, then asks cloving.ai to remove it. A failure at cloving.ai keeps the phone removed and shows a warning.\nreset removes the registration with cloving.ai, marks all phones removed and deletes phone/link.json and phone/daemon-keys.json.\nConnect a phone with the Connect a phone button of the watch page.\ncloving start runs the phone relay as a child process. With CLOVING_PHONE_RELAY=off, the relay does not start, and status says that the relay is off or not started.\n";
|