cloving 1.3.0 → 1.4.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 +235 -206
- 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-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-settings.js +2 -2
- package/dist/src/broker/actor/authority-upgrades.d.ts +19 -2
- package/dist/src/broker/actor/authority-upgrades.js +7 -2
- 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/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 +2 -0
- package/dist/src/broker/effect-upgrade.js +8 -2
- package/dist/src/cli/arguments.d.ts +13 -0
- package/dist/src/cli/arguments.js +42 -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 +4 -1
- package/dist/src/cli/client.js +9 -3
- package/dist/src/cli/command-requests.d.ts +17 -0
- package/dist/src/cli/command-requests.js +43 -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 +14 -41
- package/dist/src/cli/config-file.d.ts +2 -2
- package/dist/src/cli/config-file.js +4 -2
- 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 +6 -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 +80 -0
- package/dist/src/cli/render.d.ts +1 -1
- package/dist/src/cli/render.js +17 -30
- 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 +2 -1
- package/dist/src/cli/runtime-arguments.js +7 -2
- 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/usage-render.d.ts +1 -0
- package/dist/src/cli/usage-render.js +28 -1
- package/dist/src/cli/usage.d.ts +1 -1
- package/dist/src/cli/usage.js +50 -7
- package/dist/src/cli/watch-actions.js +2 -2
- 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 +0 -5
- package/dist/src/cli/watch-header-view.js +8 -20
- package/dist/src/cli/watch-model.d.ts +4 -1
- package/dist/src/cli/watch-model.js +17 -11
- package/dist/src/cli/watch-page.js +12 -14
- 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 +2 -0
- package/dist/src/cli/watch-reads.js +17 -16
- package/dist/src/cli/watch-render.d.ts +14 -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 +6 -6
- package/dist/src/cli/watch-view.d.ts +0 -3
- package/dist/src/cli/watch-view.js +13 -13
- package/dist/src/cli.js +59 -5
- 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-schema.d.ts +9 -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 +204 -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 +2 -1
- package/dist/src/daemon/claude-worker.js +124 -122
- package/dist/src/daemon/daemon-adapters.d.ts +2 -0
- package/dist/src/daemon/daemon-adapters.js +26 -2
- package/dist/src/daemon/daemon-loops.d.ts +3 -1
- package/dist/src/daemon/daemon-loops.js +3 -1
- package/dist/src/daemon/daemon.js +14 -6
- package/dist/src/daemon/github-attach.d.ts +2 -0
- package/dist/src/daemon/github-attach.js +149 -0
- 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 +12 -2
- 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 +1 -1
- package/dist/src/daemon/issue-queue.js +16 -11
- 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-status.d.ts +9 -3
- package/dist/src/daemon/queue-status.js +17 -4
- 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/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-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 +8 -0
- package/dist/src/daemon/worker-profile.js +40 -0
- 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 +3 -5
- package/dist/src/doctor-report.js +6 -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 +40 -0
- package/dist/src/project-config.schema.json +40 -0
- package/dist/src/project-settings.d.ts +2 -2
- package/dist/src/project-settings.js +3 -1
- package/dist/src/queue-spend.d.ts +4 -0
- package/dist/src/queue-spend.js +21 -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 +6 -6
- package/dist/src/service/command-waits.d.ts +34 -0
- package/dist/src/service/command-waits.js +86 -0
- package/dist/src/service/expiry.js +2 -0
- package/dist/src/service/gateway.js +3 -1
- package/dist/src/service/queue-spend.d.ts +6 -0
- package/dist/src/service/queue-spend.js +68 -0
- package/dist/src/service/replies.d.ts +8 -1
- package/dist/src/service/replies.js +11 -0
- package/dist/src/service/run-handlers.js +22 -2
- 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 +4 -0
- package/dist/src/service/service.js +8 -8
- 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 +2 -0
- package/dist/src/service/worker-totals.js +1 -1
- 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 -1
- package/dist/src/storage/decision-snapshots.js +15 -1
- package/dist/src/storage/domain-changes.d.ts +2 -0
- package/dist/src/storage/domain-changes.js +3 -0
- package/dist/src/storage/domain-schema.d.ts +13 -1
- package/dist/src/storage/domain-schema.js +31 -4
- package/dist/src/storage/effect-schema.d.ts +1 -0
- package/dist/src/storage/effect-schema.js +5 -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-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/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 +32 -13
- package/dist/tools/self-host-project.js +13 -78
- package/dist/tools/self-host-runtime.js +1 -1
- package/dist/tools/self-host.js +42 -10
- 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-shape.d.ts +3 -0
- package/dist/tools/workflow-candidate-shape.js +90 -0
- package/dist/tools/workflow-candidate-source.js +15 -1
- 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 +16 -8
- package/templates/develop/README.md +12 -0
- package/templates/develop/develop/flow-tests.ts +37 -0
- package/templates/develop/develop/pull.ts +5 -1
- package/templates/develop/develop/refusal-tests.ts +77 -0
- package/templates/develop/develop/turn.ts +2 -1
- 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
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,4 @@
|
|
|
1
|
+
import { type ScheduleInvocation } from "./schedule-arguments.ts";
|
|
1
2
|
export type RunSource = {
|
|
2
3
|
readonly kind: "prompt";
|
|
3
4
|
readonly text: string;
|
|
@@ -10,7 +11,7 @@ export type RunSource = {
|
|
|
10
11
|
};
|
|
11
12
|
type DecisionCommand = "answer" | "approve" | "deny";
|
|
12
13
|
type RunCommand = "pause" | "resume" | "drop";
|
|
13
|
-
export type RuntimeInvocation = {
|
|
14
|
+
export type RuntimeInvocation = ScheduleInvocation | {
|
|
14
15
|
readonly kind: "report";
|
|
15
16
|
readonly since: number;
|
|
16
17
|
readonly json: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isRecordKey } from "../authority/commands.js";
|
|
2
|
+
import { scheduleInvocation, } from "./schedule-arguments.js";
|
|
2
3
|
const identifier = /^[A-Za-z0-9._:/-]{1,128}$/;
|
|
3
4
|
const decisionReference = /^[A-Za-z0-9._:/-]{1,256}$/;
|
|
4
5
|
const sha256Digest = /^sha256:[0-9a-f]{64}$/;
|
|
@@ -71,17 +72,21 @@ const shapes = new Map([
|
|
|
71
72
|
],
|
|
72
73
|
]);
|
|
73
74
|
export function isRuntimeCommand(command) {
|
|
74
|
-
return shapes.has(command);
|
|
75
|
+
return command === "schedule" || shapes.has(command);
|
|
75
76
|
}
|
|
76
77
|
export function runtimeInvocation(request) {
|
|
77
78
|
const shape = shapes.get(request.command);
|
|
78
|
-
if (
|
|
79
|
+
if (!isRuntimeCommand(request.command))
|
|
79
80
|
return "unknown-command";
|
|
80
81
|
const names = request.options.map((option) => option.name);
|
|
81
82
|
if (new Set(names).size !== names.length)
|
|
82
83
|
return "repeated-option";
|
|
83
84
|
if (names.includes("help"))
|
|
84
85
|
return { kind: "command-help", command: request.command };
|
|
86
|
+
if (request.command === "schedule")
|
|
87
|
+
return scheduleInvocation(request);
|
|
88
|
+
if (shape === undefined)
|
|
89
|
+
return "unknown-command";
|
|
85
90
|
return shapeFailure(shape, request) ?? shape.build(request);
|
|
86
91
|
}
|
|
87
92
|
function shapeFailure(shape, request) {
|
|
@@ -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
|
+
}
|
|
@@ -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
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. 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 read tools over stdio.\n schedule List, pause and resume workflow schedules.\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 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";
|
package/dist/src/cli/usage.js
CHANGED
|
@@ -13,6 +13,30 @@ A live lock waits at most ten seconds, then exits with settings-locked.
|
|
|
13
13
|
Private files, backups and temporary files have mode 0600. Changes require a service restart.
|
|
14
14
|
`;
|
|
15
15
|
export const commandUsage = {
|
|
16
|
+
mcp: `Usage: cloving mcp [--repository <directory>]
|
|
17
|
+
|
|
18
|
+
Serves cloving_status, cloving_questions and cloving_events as read tools over stdio.
|
|
19
|
+
The server binds to one repository at startup. It needs an existing Cloving service.
|
|
20
|
+
Standard output contains only JSON-RPC messages. Diagnostics use standard error.
|
|
21
|
+
`,
|
|
22
|
+
"red-green": `Usage: cloving red-green
|
|
23
|
+
|
|
24
|
+
Reads {"head":"<full commit ID>"} on standard input. Uses CLOVING_RED_GREEN to run
|
|
25
|
+
the changed tests on the merge base with origin/HEAD and then on the head.
|
|
26
|
+
Prints one JSON verdict. Verdicts exit with 0; invalid input and git errors exit with 1.
|
|
27
|
+
Uses temporary detached worktrees. CLOVING_COMMAND_SECONDS bounds each prepare or test command.
|
|
28
|
+
`,
|
|
29
|
+
init: `Usage: cloving init [--harness <name or path>] [--repository <directory>]
|
|
30
|
+
|
|
31
|
+
Starts the setup agent in the repository with the message "run \`cloving init-prompt\`".
|
|
32
|
+
Choose an installed harness at the terminal, or pass --harness to skip the question.
|
|
33
|
+
A name must have exactly one usable entry; shell:<name> selects a shell function or alias.
|
|
34
|
+
The selection is saved in private settings. The command returns the agent's exit status.
|
|
35
|
+
`,
|
|
36
|
+
"init-prompt": `Usage: cloving init-prompt [--repository <directory>]
|
|
37
|
+
|
|
38
|
+
Prints facts, rules and setup steps for an agent. Does not change settings, call a model or control the service.
|
|
39
|
+
`,
|
|
16
40
|
doctor: `Usage: cloving doctor [--json] [--repository <directory>]
|
|
17
41
|
|
|
18
42
|
Checks repository requirements without repairs, model turns or GitHub writes.
|
|
@@ -34,6 +58,15 @@ Success means a committed receipt. It does not mean completed work.
|
|
|
34
58
|
status: `Usage: cloving status [<run-id>] [--limit <n>] [--after <cursor>] [--json]
|
|
35
59
|
|
|
36
60
|
Lists the runs, or shows one run with its reason, evidence and next action.
|
|
61
|
+
`,
|
|
62
|
+
schedule: `Usage: cloving schedule [--json]
|
|
63
|
+
cloving schedule pause <workflowId> [--json]
|
|
64
|
+
cloving schedule resume <workflowId> [--json]
|
|
65
|
+
|
|
66
|
+
Lists interval schedules and their state. Pause stops new runs; an active run continues.
|
|
67
|
+
Three consecutive failed or blocked scheduled runs stop a schedule.
|
|
68
|
+
Resume clears failures and starts the next run one interval later.
|
|
69
|
+
Paused and stopped schedules survive a service restart.
|
|
37
70
|
`,
|
|
38
71
|
questions: `Usage: cloving questions [<run-id>] [--json]
|
|
39
72
|
|
|
@@ -90,10 +123,11 @@ Settings files: .cloving/config.json in the repository and <config>/cloving/proj
|
|
|
90
123
|
|
|
91
124
|
CLOVING_RUNTIME_DIR The path of the runtime directory. The default is ~/.local/state/cloving/<name>-<id>/run, if XDG_RUNTIME_DIR and XDG_STATE_HOME are not set. A recorded legacy adoption takes priority.
|
|
92
125
|
CLOVING_TICKET_COMMAND A JSON list of a command and its arguments. The command gets a ticket ID as its last argument and prints the ticket. The setting has no default, and a run with --ticket needs it.
|
|
93
|
-
CLOVING_NOTIFY_COMMAND A JSON list of a command and its arguments. Every 15 seconds, new decisions, blocked runs
|
|
126
|
+
CLOVING_NOTIFY_COMMAND A JSON list of a command and its arguments. Every 15 seconds, new decisions, blocked runs, failed runs and stopped schedules send JSON on standard input with no added argument. The setting has no default.
|
|
94
127
|
CLOVING_NEXT_COMMAND A JSON list of a command and its arguments. The command runs with no added argument and prints one ready ticket ID for --next. It must exclude the space-separated ticket IDs in CLOVING_SKIP_TICKETS. The setting has no default.
|
|
95
|
-
CLOVING_QUEUE_SECONDS A whole number from 10 to 3600 seconds between
|
|
128
|
+
CLOVING_QUEUE_SECONDS A whole number from 10 to 3600 seconds between checks for a declared workflow with queue: true; requires CLOVING_NEXT_COMMAND and CLOVING_TICKET_COMMAND when that workflow exists. Unset or no queue workflow means no queue. The queue stops after three runs in a row without a successful handoff; manual submissions to that workflow are refused with workflow-active when all lanes are busy.
|
|
96
129
|
CLOVING_QUEUE_LANES A whole number from 1 to 4; the default is 1. Requires CLOVING_QUEUE_SECONDS. Active tickets are refused with ticket-active. Needs #N sentences in the ticket's ## Dependencies section refuse admission with ticket-dependency-open while issue #N is open.
|
|
130
|
+
CLOVING_QUEUE_DAILY_SPEND_USD A positive finite USD number. Requires CLOVING_QUEUE_SECONDS. Holds new queue runs at 85 percent of the limit in the last 24 hours; active runs continue. Unset adds no spend limit.
|
|
97
131
|
CLOVING_WORKFLOW_FOLDER An absolute folder path; when set, it replaces the user workflow folder. The private setting workflows.folder sets it. The folder itself must not be a symbolic link.
|
|
98
132
|
CLOVING_SCHEDULES A JSON object mapping declared workflow IDs to {everySeconds, input}; replaces declaration schedules. Intervals are whole seconds from 60 to 86400. Unset keeps declaration schedules. Scheduled runs skip overlapping slots and retain their progress across restart.
|
|
99
133
|
CLOVING_SELF_UPDATE_SECONDS A whole number from 30 to 3600 seconds between checks of the own checkout; unset means no update. An update stops the daemon and restarts with new code. A change of package-lock.json needs the operator to update and install by hand.
|
|
@@ -115,31 +149,40 @@ Settings files: .cloving/config.json in the repository and <config>/cloving/proj
|
|
|
115
149
|
CLOVING_RELAY_ORIGIN The origin of the phone relay server. Only https origins are accepted. The default is https://cloving.ai.
|
|
116
150
|
CLOVING_OWNERSHIP_LEASE_SECONDS The time in seconds of the ownership lease of a started workflow step. The default is 15.
|
|
117
151
|
CLOVING_HOST_BOUND The largest number of queue messages that the workflow host handles at one time, from 1 to 64. The default is 8.
|
|
118
|
-
CLOVING_GH_COMMAND A JSON list of a command and its arguments for the GitHub CLI,
|
|
119
|
-
CLOVING_CHECK_COMMAND A JSON list of a command and its arguments that
|
|
120
|
-
|
|
121
|
-
|
|
152
|
+
CLOVING_GH_COMMAND A JSON list of a command and its arguments for the GitHub CLI, used by workflows for pull requests and issues. The watch board also uses it to read pull request status. The default is gh.
|
|
153
|
+
CLOVING_CHECK_COMMAND A JSON list of a command and its arguments that a workflow runs in the work tree before a merge. A merge does not occur if the command fails. The setting has no default, and with no setting the merge occurs with no check.
|
|
154
|
+
CLOVING_RED_GREEN A JSON object with test and testFiles, optional prepare, assertionPattern and skipPattern for cloving red-green. The project setting is checks.redGreen.
|
|
155
|
+
CLOVING_REQUIRED_CHECKS A JSON list of required check run names before a workflow merge. Unset requires all GitHub Actions checks; a repository with no CI can merge after 60 seconds. The latest run of each name decides. The CI wait limit is 90 minutes.
|
|
156
|
+
CLOVING_PRIVATE_TEXTS A JSON list of texts that workflows do not push in a file or in a commit message. An issue-posting workflow can require the list. The list adds to the path of the home folder, and the case of the letters does not matter. The setting has no default.
|
|
122
157
|
`,
|
|
123
158
|
};
|
|
124
159
|
export const usage = `Usage: cloving [--help] [--version]
|
|
125
160
|
cloving workflows list [--json] [--repository <directory>]
|
|
126
161
|
cloving workflows test [<id>] [--repository <directory>]
|
|
127
162
|
cloving workflows validate <manifest-path> [--input <json-file>] [--json]
|
|
163
|
+
cloving init [--harness <name or path>] [--repository <directory>]
|
|
164
|
+
cloving init-prompt [--repository <directory>]
|
|
128
165
|
cloving templates list [--json]
|
|
129
166
|
cloving templates show <name> [--json]
|
|
130
167
|
cloving templates copy <name> [--id <workflow-id>] [--json] [--repository <directory>]
|
|
168
|
+
cloving red-green
|
|
131
169
|
cloving <command> [--help]
|
|
132
170
|
|
|
133
171
|
Commands:
|
|
134
|
-
workflows list List
|
|
172
|
+
workflows list List project and user workflows and refusal codes.
|
|
135
173
|
workflows test Run project and user workflow tests without a service.
|
|
136
174
|
workflows validate Check a compiled workflow manifest, its artifacts and optional runtime input.
|
|
137
175
|
templates list List the workflow templates of the package.
|
|
138
176
|
templates show Show the decision points and the files of one template.
|
|
139
177
|
templates copy Copy one template into .cloving/workflows of the repository.
|
|
178
|
+
red-green Check assertion failure on the base and success on the head.
|
|
179
|
+
init Start the setup agent
|
|
180
|
+
init-prompt Print setup instructions for an agent.
|
|
140
181
|
doctor Check repository requirements before starting or submitting work.
|
|
141
182
|
run Submit one run of an admitted workflow.
|
|
142
183
|
status List the runs or show one run.
|
|
184
|
+
mcp Serve the read tools over stdio.
|
|
185
|
+
schedule List, pause and resume workflow schedules.
|
|
143
186
|
report Report loop facts and seven-day baselines.
|
|
144
187
|
questions List the pending decisions.
|
|
145
188
|
answer Answer one design question.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
2
|
import { send } from "./client.js";
|
|
3
3
|
import { watchCardForms } from "./watch-card-forms.js";
|
|
4
|
-
import { join } from "node:path";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
5
|
import { cardRunRequest } from "./watch-run-input.js";
|
|
6
6
|
export async function watchActions(runtimeDirectory) {
|
|
7
7
|
return {
|
|
8
8
|
runtimeDirectory,
|
|
9
|
-
forms: await watchCardForms(join(
|
|
9
|
+
forms: await watchCardForms(join(dirname(runtimeDirectory), "project")),
|
|
10
10
|
token: randomBytes(32).toString("hex"),
|
|
11
11
|
};
|
|
12
12
|
}
|