cloving 0.3.19 → 1.0.1
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/{LICENSE.md → LICENSE} +1 -1
- package/README.md +475 -182
- package/dist/src/authority/budgets.d.ts +12 -0
- package/dist/src/authority/budgets.js +42 -0
- package/dist/src/authority/commands.d.ts +7 -0
- package/dist/src/authority/commands.js +263 -0
- package/dist/src/authority/details.d.ts +28 -0
- package/dist/src/authority/details.js +33 -0
- package/dist/src/authority/dispatch-decision.d.ts +40 -0
- package/dist/src/authority/dispatch-decision.js +47 -0
- package/dist/src/authority/effect-requests.d.ts +2 -0
- package/dist/src/authority/effect-requests.js +139 -0
- package/dist/src/authority/effect-results.d.ts +4 -0
- package/dist/src/authority/effect-results.js +236 -0
- package/dist/src/authority/events.d.ts +2 -0
- package/dist/src/authority/events.js +45 -0
- package/dist/src/authority/gate-reduction.d.ts +8 -0
- package/dist/src/authority/gate-reduction.js +109 -0
- package/dist/src/authority/gates.d.ts +48 -0
- package/dist/src/authority/gates.js +77 -0
- package/dist/src/authority/history-state.d.ts +15 -0
- package/dist/src/authority/history-state.js +61 -0
- package/dist/src/authority/history.d.ts +13 -0
- package/dist/src/authority/history.js +37 -0
- package/dist/src/authority/instants.d.ts +3 -0
- package/dist/src/authority/instants.js +38 -0
- package/dist/src/authority/leases.d.ts +15 -0
- package/dist/src/authority/leases.js +113 -0
- package/dist/src/authority/operations.d.ts +101 -0
- package/dist/src/authority/operations.js +75 -0
- package/dist/src/authority/reconciliation.d.ts +27 -0
- package/dist/src/authority/reconciliation.js +147 -0
- package/dist/src/authority/reducer.d.ts +41 -0
- package/dist/src/authority/reducer.js +139 -0
- package/dist/src/authority/reduction-state.d.ts +36 -0
- package/dist/src/authority/reduction-state.js +68 -0
- package/dist/src/authority/reduction.d.ts +6 -0
- package/dist/src/authority/reduction.js +160 -0
- package/dist/src/authority/status-closure.d.ts +4 -0
- package/dist/src/authority/status-closure.js +57 -0
- package/dist/src/authority/status-effects.d.ts +17 -0
- package/dist/src/authority/status-effects.js +43 -0
- package/dist/src/authority/status-input.d.ts +45 -0
- package/dist/src/authority/status-input.js +9 -0
- package/dist/src/authority/status.d.ts +32 -0
- package/dist/src/authority/status.js +256 -0
- package/dist/src/authority/stop-sequence.d.ts +37 -0
- package/dist/src/authority/stop-sequence.js +91 -0
- package/dist/src/authority/transitions.d.ts +63 -0
- package/dist/src/authority/transitions.js +122 -0
- package/dist/src/broker/actor/adapter-calls.d.ts +13 -0
- package/dist/src/broker/actor/adapter-calls.js +34 -0
- package/dist/src/broker/actor/adapter-outcomes.d.ts +28 -0
- package/dist/src/broker/actor/adapter-outcomes.js +80 -0
- package/dist/src/broker/actor/authority-actor.d.ts +25 -0
- package/dist/src/broker/actor/authority-actor.js +169 -0
- package/dist/src/broker/actor/authority-changes.d.ts +31 -0
- package/dist/src/broker/actor/authority-changes.js +46 -0
- package/dist/src/broker/actor/authority-connection.d.ts +15 -0
- package/dist/src/broker/actor/authority-connection.js +44 -0
- package/dist/src/broker/actor/authority-conversion.d.ts +10 -0
- package/dist/src/broker/actor/authority-conversion.js +72 -0
- package/dist/src/broker/actor/authority-delivery.d.ts +13 -0
- package/dist/src/broker/actor/authority-delivery.js +162 -0
- package/dist/src/broker/actor/authority-logger.d.ts +2 -0
- package/dist/src/broker/actor/authority-logger.js +19 -0
- package/dist/src/broker/actor/authority-policy.d.ts +9 -0
- package/dist/src/broker/actor/authority-policy.js +11 -0
- package/dist/src/broker/actor/authority-queries.d.ts +45 -0
- package/dist/src/broker/actor/authority-queries.js +85 -0
- package/dist/src/broker/actor/authority-receipts.d.ts +28 -0
- package/dist/src/broker/actor/authority-receipts.js +84 -0
- package/dist/src/broker/actor/authority-release.d.ts +13 -0
- package/dist/src/broker/actor/authority-release.js +69 -0
- package/dist/src/broker/actor/authority-runtime.d.ts +60 -0
- package/dist/src/broker/actor/authority-runtime.js +204 -0
- package/dist/src/broker/actor/authority-session.d.ts +65 -0
- package/dist/src/broker/actor/authority-session.js +252 -0
- package/dist/src/broker/actor/authority-settings.d.ts +33 -0
- package/dist/src/broker/actor/authority-settings.js +63 -0
- package/dist/src/broker/actor/authority-upgrades.d.ts +16 -0
- package/dist/src/broker/actor/authority-upgrades.js +12 -0
- package/dist/src/broker/actor/authority-watchdog.d.ts +14 -0
- package/dist/src/broker/actor/authority-watchdog.js +41 -0
- package/dist/src/broker/actor/authority.d.ts +14 -0
- package/dist/src/broker/actor/authority.js +115 -0
- package/dist/src/broker/actor/delivery-intents.d.ts +68 -0
- package/dist/src/broker/actor/delivery-intents.js +77 -0
- package/dist/src/broker/actor/delivery-plan.d.ts +2 -0
- package/dist/src/broker/actor/delivery-plan.js +109 -0
- package/dist/src/broker/actor/delivery-results.d.ts +11 -0
- package/dist/src/broker/actor/delivery-results.js +63 -0
- package/dist/src/broker/actor/effect-delivery.d.ts +19 -0
- package/dist/src/broker/actor/effect-delivery.js +118 -0
- package/dist/src/broker/actor/effect-plan.d.ts +41 -0
- package/dist/src/broker/actor/effect-plan.js +173 -0
- package/dist/src/broker/actor/effect-queries.d.ts +27 -0
- package/dist/src/broker/actor/effect-queries.js +80 -0
- package/dist/src/broker/actor/effect-turn.d.ts +25 -0
- package/dist/src/broker/actor/effect-turn.js +84 -0
- package/dist/src/broker/actor/pin-check.d.ts +6 -0
- package/dist/src/broker/actor/pin-check.js +12 -0
- package/dist/src/broker/actor/runtime-parts.d.ts +23 -0
- package/dist/src/broker/actor/runtime-parts.js +34 -0
- package/dist/src/broker/actor/stop-plan.d.ts +20 -0
- package/dist/src/broker/actor/stop-plan.js +46 -0
- package/dist/src/broker/actor/stop-turn.d.ts +17 -0
- package/dist/src/broker/actor/stop-turn.js +42 -0
- package/dist/src/broker/actor/turn-draft.d.ts +31 -0
- package/dist/src/broker/actor/turn-draft.js +138 -0
- package/dist/src/broker/actor/turn-plan.d.ts +17 -0
- package/dist/src/broker/actor/turn-plan.js +136 -0
- package/dist/src/broker/actor/turn-refusals.d.ts +8 -0
- package/dist/src/broker/actor/turn-refusals.js +35 -0
- package/dist/src/broker/actor/turn-staging.d.ts +78 -0
- package/dist/src/broker/actor/turn-staging.js +34 -0
- package/dist/src/broker/actor/turn-state.d.ts +34 -0
- package/dist/src/broker/actor/turn-state.js +208 -0
- package/dist/src/broker/authority-admission.d.ts +21 -0
- package/dist/src/broker/authority-admission.js +70 -0
- package/dist/src/broker/authority-restore.d.ts +30 -0
- package/dist/src/broker/authority-restore.js +165 -0
- package/dist/src/broker/decision-restore.d.ts +16 -0
- package/dist/src/broker/decision-restore.js +158 -0
- package/dist/src/broker/decision-upgrade.d.ts +3 -0
- package/dist/src/broker/decision-upgrade.js +12 -0
- package/dist/src/broker/effect-restore.d.ts +20 -0
- package/dist/src/broker/effect-restore.js +111 -0
- package/dist/src/broker/effect-upgrade.d.ts +3 -0
- package/dist/src/broker/effect-upgrade.js +9 -0
- package/dist/src/broker/operation-digest.d.ts +1 -0
- package/dist/src/broker/operation-digest.js +4 -0
- package/dist/src/broker/socket-address.d.ts +9 -0
- package/dist/src/broker/socket-address.js +14 -0
- package/dist/src/broker/workflow-pin.d.ts +2 -0
- package/dist/src/broker/workflow-pin.js +5 -0
- package/dist/src/chats/destination.d.ts +4 -0
- package/dist/src/chats/destination.js +94 -0
- package/dist/src/chats/import.d.ts +13 -0
- package/dist/src/chats/import.js +71 -0
- package/dist/src/chats/normalize.d.ts +20 -0
- package/dist/src/chats/normalize.js +139 -0
- package/dist/src/chats/reader.d.ts +15 -0
- package/dist/src/chats/reader.js +87 -0
- package/dist/src/cli/arguments.d.ts +23 -0
- package/dist/src/cli/arguments.js +154 -0
- package/dist/src/cli/client.d.ts +15 -0
- package/dist/src/cli/client.js +122 -0
- package/dist/src/cli/commands.d.ts +14 -0
- package/dist/src/cli/commands.js +253 -0
- package/dist/src/cli/main.d.ts +1 -0
- package/dist/src/cli/main.js +80 -0
- package/dist/src/cli/render.d.ts +8 -0
- package/dist/src/cli/render.js +186 -0
- package/dist/src/cli/runtime-arguments.d.ts +73 -0
- package/dist/src/cli/runtime-arguments.js +248 -0
- package/dist/src/cli/runtime-directory.d.ts +4 -0
- package/dist/src/cli/runtime-directory.js +25 -0
- package/dist/src/cli/toolchain.d.ts +3 -0
- package/dist/src/cli/toolchain.js +74 -0
- package/dist/src/cli/usage.d.ts +4 -0
- package/dist/src/cli/usage.js +124 -0
- package/dist/src/cli/validate.d.ts +38 -0
- package/dist/src/cli/validate.js +116 -0
- package/dist/src/cli/watch-board-view.d.ts +22 -0
- package/dist/src/cli/watch-board-view.js +128 -0
- package/dist/src/cli/watch-board.d.ts +15 -0
- package/dist/src/cli/watch-board.js +174 -0
- package/dist/src/cli/watch-element.d.ts +11 -0
- package/dist/src/cli/watch-element.js +6 -0
- package/dist/src/cli/watch-model.d.ts +29 -0
- package/dist/src/cli/watch-model.js +261 -0
- package/dist/src/cli/watch-navigation.d.ts +9 -0
- package/dist/src/cli/watch-navigation.js +40 -0
- package/dist/src/cli/watch-page.d.ts +1 -0
- package/dist/src/cli/watch-page.js +272 -0
- package/dist/src/cli/watch-paths.d.ts +2 -0
- package/dist/src/cli/watch-paths.js +52 -0
- package/dist/src/cli/watch-phases.d.ts +7 -0
- package/dist/src/cli/watch-phases.js +148 -0
- package/dist/src/cli/watch-reads.d.ts +28 -0
- package/dist/src/cli/watch-reads.js +244 -0
- package/dist/src/cli/watch-render.d.ts +139 -0
- package/dist/src/cli/watch-render.js +95 -0
- package/dist/src/cli/watch-server.d.ts +10 -0
- package/dist/src/cli/watch-server.js +176 -0
- package/dist/src/cli/watch-stream.d.ts +11 -0
- package/dist/src/cli/watch-stream.js +128 -0
- package/dist/src/cli/watch-turn.d.ts +29 -0
- package/dist/src/cli/watch-turn.js +130 -0
- package/dist/src/cli/watch-view.d.ts +39 -0
- package/dist/src/cli/watch-view.js +223 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +62 -0
- package/dist/src/daemon/claude-turn.d.ts +28 -0
- package/dist/src/daemon/claude-turn.js +135 -0
- package/dist/src/daemon/claude-worker.d.ts +26 -0
- package/dist/src/daemon/claude-worker.js +224 -0
- package/dist/src/daemon/codex-stream.d.ts +4 -0
- package/dist/src/daemon/codex-stream.js +113 -0
- package/dist/src/daemon/daemon.d.ts +46 -0
- package/dist/src/daemon/daemon.js +186 -0
- package/dist/src/daemon/delivery-router.d.ts +10 -0
- package/dist/src/daemon/delivery-router.js +34 -0
- package/dist/src/daemon/github-calls.d.ts +29 -0
- package/dist/src/daemon/github-calls.js +127 -0
- package/dist/src/daemon/github-issue-methods.d.ts +3 -0
- package/dist/src/daemon/github-issue-methods.js +99 -0
- package/dist/src/daemon/github-issue-privacy.d.ts +6 -0
- package/dist/src/daemon/github-issue-privacy.js +131 -0
- package/dist/src/daemon/github-merge.d.ts +18 -0
- package/dist/src/daemon/github-merge.js +259 -0
- package/dist/src/daemon/github-methods.d.ts +5 -0
- package/dist/src/daemon/github-methods.js +198 -0
- package/dist/src/daemon/github-operation.d.ts +38 -0
- package/dist/src/daemon/github-operation.js +57 -0
- package/dist/src/daemon/github-worker.d.ts +17 -0
- package/dist/src/daemon/github-worker.js +281 -0
- package/dist/src/daemon/host-environment.d.ts +8 -0
- package/dist/src/daemon/host-environment.js +14 -0
- package/dist/src/daemon/issue-queue.d.ts +9 -0
- package/dist/src/daemon/issue-queue.js +163 -0
- package/dist/src/daemon/notify-message.d.ts +14 -0
- package/dist/src/daemon/notify-message.js +48 -0
- package/dist/src/daemon/notify.d.ts +12 -0
- package/dist/src/daemon/notify.js +161 -0
- package/dist/src/daemon/operation-journal.d.ts +42 -0
- package/dist/src/daemon/operation-journal.js +53 -0
- package/dist/src/daemon/ticket-registration.d.ts +33 -0
- package/dist/src/daemon/ticket-registration.js +177 -0
- package/dist/src/daemon/ticket-source.d.ts +17 -0
- package/dist/src/daemon/ticket-source.js +36 -0
- package/dist/src/daemon/work-tree.d.ts +26 -0
- package/dist/src/daemon/work-tree.js +206 -0
- package/dist/src/effect-authorization.d.ts +21 -0
- package/dist/src/effect-authorization.js +14 -0
- package/dist/src/execution-pin.d.ts +4 -0
- package/dist/src/execution-pin.js +68 -0
- package/dist/src/host/start-delivery.d.ts +41 -0
- package/dist/src/host/start-delivery.js +68 -0
- package/dist/src/host/step-bridge-host.d.ts +79 -0
- package/dist/src/host/step-bridge-host.js +205 -0
- package/dist/src/host/step-claims.d.ts +31 -0
- package/dist/src/host/step-claims.js +85 -0
- package/dist/src/host/world-host.d.ts +21 -0
- package/dist/src/host/world-host.js +51 -0
- package/dist/src/host/world-reconciliation.d.ts +37 -0
- package/dist/src/host/world-reconciliation.js +75 -0
- package/dist/src/host/world-runs.d.ts +14 -0
- package/dist/src/host/world-runs.js +61 -0
- package/dist/src/operation-identity.d.ts +7 -0
- package/dist/src/operation-identity.js +59 -0
- package/dist/src/protocol.d.ts +35 -0
- package/dist/src/protocol.js +64 -0
- package/dist/src/resource-files.d.ts +1 -0
- package/dist/src/resource-files.js +29 -0
- package/dist/src/service/changes.d.ts +11 -0
- package/dist/src/service/changes.js +32 -0
- package/dist/src/service/decision-handler.d.ts +9 -0
- package/dist/src/service/decision-handler.js +233 -0
- package/dist/src/service/event-handler.d.ts +10 -0
- package/dist/src/service/event-handler.js +70 -0
- package/dist/src/service/expiry.d.ts +13 -0
- package/dist/src/service/expiry.js +53 -0
- package/dist/src/service/gateway.d.ts +21 -0
- package/dist/src/service/gateway.js +120 -0
- package/dist/src/service/registry.d.ts +40 -0
- package/dist/src/service/registry.js +13 -0
- package/dist/src/service/replies.d.ts +26 -0
- package/dist/src/service/replies.js +56 -0
- package/dist/src/service/run-handlers.d.ts +4 -0
- package/dist/src/service/run-handlers.js +271 -0
- package/dist/src/service/service.d.ts +58 -0
- package/dist/src/service/service.js +212 -0
- package/dist/src/service/submission-handler.d.ts +4 -0
- package/dist/src/service/submission-handler.js +206 -0
- package/dist/src/service/transport.d.ts +16 -0
- package/dist/src/service/transport.js +141 -0
- package/dist/src/service/worker-port.d.ts +85 -0
- package/dist/src/service/worker-port.js +126 -0
- package/dist/src/step-bridge.d.ts +57 -0
- package/dist/src/step-bridge.js +4 -0
- package/dist/src/steps/decision-gate.d.ts +2 -0
- package/dist/src/steps/decision-gate.js +8 -0
- package/dist/src/steps/load-cycle.d.ts +10 -0
- package/dist/src/steps/load-cycle.js +11 -0
- package/dist/src/steps/protected-effect.d.ts +2 -0
- package/dist/src/steps/protected-effect.js +8 -0
- package/dist/src/storage/decision-rows.d.ts +54 -0
- package/dist/src/storage/decision-rows.js +72 -0
- package/dist/src/storage/decision-snapshots.d.ts +17 -0
- package/dist/src/storage/decision-snapshots.js +25 -0
- package/dist/src/storage/domain-changes.d.ts +48 -0
- package/dist/src/storage/domain-changes.js +213 -0
- package/dist/src/storage/domain-rows.d.ts +85 -0
- package/dist/src/storage/domain-rows.js +129 -0
- package/dist/src/storage/domain-schema.d.ts +32 -0
- package/dist/src/storage/domain-schema.js +193 -0
- package/dist/src/storage/effect-changes.d.ts +5 -0
- package/dist/src/storage/effect-changes.js +105 -0
- package/dist/src/storage/effect-rows.d.ts +67 -0
- package/dist/src/storage/effect-rows.js +74 -0
- package/dist/src/storage/effect-schema.d.ts +1 -0
- package/dist/src/storage/effect-schema.js +59 -0
- package/dist/src/storage/statements.d.ts +9 -0
- package/dist/src/storage/statements.js +8 -0
- package/dist/src/submission.d.ts +42 -0
- package/dist/src/submission.js +71 -0
- package/dist/src/turn-profile.d.ts +13 -0
- package/dist/src/turn-profile.js +100 -0
- package/dist/src/workflow-admission.d.ts +45 -0
- package/dist/src/workflow-admission.js +151 -0
- package/dist/src/workflow-contracts.d.ts +27 -0
- package/dist/src/workflow-contracts.js +88 -0
- package/dist/src/workflow-declaration.d.ts +11 -0
- package/dist/src/workflow-declaration.js +57 -0
- package/dist/src/workflow-resources.d.ts +8 -0
- package/dist/src/workflow-resources.js +14 -0
- package/dist/src/workflows.d.ts +5 -0
- package/dist/src/workflows.js +3 -0
- package/dist/tools/compile-workflows.d.ts +1 -0
- package/dist/tools/compile-workflows.js +33 -0
- package/dist/tools/self-host-processes.d.ts +10 -0
- package/dist/tools/self-host-processes.js +151 -0
- package/dist/tools/self-host-workflows.d.ts +15 -0
- package/dist/tools/self-host-workflows.js +78 -0
- package/dist/tools/self-host.d.ts +1 -0
- package/dist/tools/self-host.js +261 -0
- package/dist/tools/self-update-host.d.ts +6 -0
- package/dist/tools/self-update-host.js +41 -0
- package/dist/tools/self-update.d.ts +10 -0
- package/dist/tools/self-update.js +105 -0
- package/dist/tools/workflow-manifest.d.ts +3 -0
- package/dist/tools/workflow-manifest.js +34 -0
- package/dist/workflows/develop-prd.d.ts +7 -0
- package/dist/workflows/develop-prd.js +97 -0
- package/dist/workflows/develop-ticket.d.ts +15 -0
- package/dist/workflows/develop-ticket.js +301 -0
- package/dist/workflows/issue-labels.d.ts +14 -0
- package/dist/workflows/issue-labels.js +36 -0
- package/package.json +82 -75
- package/.DS_Store +0 -0
- package/.aider.chat.history.md +0 -16978
- package/.aider.input.history +0 -15
- package/.aider.tags.cache.v3/cache.db +0 -0
- package/.aider.tags.cache.v3/cache.db-shm +0 -0
- package/.aider.tags.cache.v3/cache.db-wal +0 -0
- package/.cursorrules +0 -77
- package/.github/workflows/auto-release.yml +0 -83
- package/.github/workflows/ci.yml +0 -32
- package/.github/workflows/npm-publish.yml +0 -34
- package/.gitignore +0 -67
- package/.husky/_/.gitignore +0 -1
- package/.husky/_/applypatch-msg +0 -2
- package/.husky/_/commit-msg +0 -2
- package/.husky/_/h +0 -22
- package/.husky/_/husky.sh +0 -9
- package/.husky/_/post-applypatch +0 -2
- package/.husky/_/post-checkout +0 -2
- package/.husky/_/post-commit +0 -2
- package/.husky/_/post-merge +0 -2
- package/.husky/_/post-rewrite +0 -2
- package/.husky/_/pre-applypatch +0 -2
- package/.husky/_/pre-auto-gc +0 -2
- package/.husky/_/pre-commit +0 -2
- package/.husky/_/pre-merge-commit +0 -2
- package/.husky/_/pre-push +0 -2
- package/.husky/_/pre-rebase +0 -2
- package/.husky/_/prepare-commit-msg +0 -2
- package/.husky/pre-commit +0 -1
- package/.husky/pre-push +0 -1
- package/.prettierrc.json +0 -7
- package/.tool-versions +0 -2
- package/SECURITY.md +0 -15
- package/cloving.json +0 -67
- package/dist/abstract_gpt/index.js +0 -55
- package/dist/cloving_gpt/adapters/Adapter.js +0 -2
- package/dist/cloving_gpt/adapters/azureopenai.js +0 -69
- package/dist/cloving_gpt/adapters/claude.js +0 -128
- package/dist/cloving_gpt/adapters/gemini.js +0 -135
- package/dist/cloving_gpt/adapters/gpt4all.js +0 -29
- package/dist/cloving_gpt/adapters/index.js +0 -2
- package/dist/cloving_gpt/adapters/mistral.js +0 -128
- package/dist/cloving_gpt/adapters/ollama.js +0 -128
- package/dist/cloving_gpt/adapters/openai.js +0 -100
- package/dist/cloving_gpt/index.js +0 -192
- package/dist/commands/analyze.js +0 -47
- package/dist/commands/chat.js +0 -14
- package/dist/commands/check.js +0 -7
- package/dist/commands/commit.js +0 -44
- package/dist/commands/config.js +0 -167
- package/dist/commands/describe.js +0 -235
- package/dist/commands/generate/code.js +0 -21
- package/dist/commands/generate/commit.js +0 -11
- package/dist/commands/generate/context.js +0 -82
- package/dist/commands/generate/docs.js +0 -11
- package/dist/commands/generate/documentation.js +0 -11
- package/dist/commands/generate/fizzbuzz.js +0 -35
- package/dist/commands/generate/init.js +0 -15
- package/dist/commands/generate/review.js +0 -11
- package/dist/commands/generate/sh.js +0 -95
- package/dist/commands/generate/shell.js +0 -11
- package/dist/commands/generate/unit_tests.js +0 -11
- package/dist/commands/init.js +0 -13
- package/dist/commands/models.js +0 -22
- package/dist/commands/project/build.js +0 -88
- package/dist/commands/project/complete.js +0 -12
- package/dist/commands/project/init.js +0 -82
- package/dist/commands/project/plan.js +0 -108
- package/dist/commands/proxy.js +0 -11
- package/dist/commands/review.js +0 -50
- package/dist/commands/tokens.js +0 -75
- package/dist/commands/unit_tests.js +0 -150
- package/dist/commands/update.js +0 -7
- package/dist/file2.js +0 -4
- package/dist/index.js +0 -134
- package/dist/managers/BlockManager.js +0 -120
- package/dist/managers/ChatManager.js +0 -653
- package/dist/managers/ChunkManager.js +0 -32
- package/dist/managers/CodeManager.js +0 -185
- package/dist/managers/CommitManager.js +0 -64
- package/dist/managers/DocsManager.js +0 -88
- package/dist/managers/DocumentationManager.js +0 -114
- package/dist/managers/InitManager.js +0 -230
- package/dist/managers/ProxyManager.js +0 -210
- package/dist/managers/ReviewManager.js +0 -131
- package/dist/managers/ShellManager.js +0 -163
- package/dist/managers/StreamManager.js +0 -308
- package/dist/managers/UnitTestManager.js +0 -243
- package/dist/managers/src/managers/ProxyManager.js +0 -1
- package/dist/newfile.js +0 -2
- package/dist/package.json +0 -86
- package/dist/utils/command_utils.js +0 -384
- package/dist/utils/config_utils.js +0 -249
- package/dist/utils/gitUtils.js +0 -42
- package/dist/utils/git_utils.js +0 -217
- package/dist/utils/modelUtils.js +0 -7
- package/dist/utils/model_utils.js +0 -7
- package/dist/utils/prompt_utils.js +0 -333
- package/dist/utils/prompts/CODEGEN_COULDNT_APPLY.md +0 -5
- package/dist/utils/prompts/CODEGEN_EXAMPLES.md +0 -82
- package/dist/utils/prompts/CODEGEN_INSTRUCTIONS.md +0 -43
- package/dist/utils/prompts/DOCS_INSTRUCTIONS.md +0 -9
- package/dist/utils/prompts/INIT_INSTRUCTIONS.md +0 -132
- package/dist/utils/prompts/REVIEW_INSTRUCTIONS.md +0 -49
- package/dist/utils/prompts/SHELL_INSTRUCTIONS.md +0 -15
- package/dist/utils/prompts/SPECIAL_FILES.md +0 -66
- package/dist/utils/prompts/index.js +0 -27
- package/dist/utils/string_utils.js +0 -505
- package/dist/utils/types.js +0 -2
- package/jest.config.js +0 -11
- package/src/cloving_gpt/adapters/azureopenai.ts +0 -83
- package/src/cloving_gpt/adapters/claude.ts +0 -140
- package/src/cloving_gpt/adapters/gemini.ts +0 -146
- package/src/cloving_gpt/adapters/index.ts +0 -43
- package/src/cloving_gpt/adapters/mistral.ts +0 -142
- package/src/cloving_gpt/adapters/ollama.ts +0 -136
- package/src/cloving_gpt/adapters/openai.ts +0 -113
- package/src/cloving_gpt/index.ts +0 -229
- package/src/commands/chat.ts +0 -12
- package/src/commands/config.ts +0 -192
- package/src/commands/generate/code.ts +0 -18
- package/src/commands/generate/commit.ts +0 -9
- package/src/commands/generate/context.ts +0 -93
- package/src/commands/generate/docs.ts +0 -9
- package/src/commands/generate/review.ts +0 -9
- package/src/commands/generate/shell.ts +0 -9
- package/src/commands/generate/unit_tests.ts +0 -9
- package/src/commands/init.ts +0 -9
- package/src/commands/models.ts +0 -21
- package/src/commands/proxy.ts +0 -9
- package/src/commands/tokens.ts +0 -82
- package/src/index.ts +0 -197
- package/src/managers/BlockManager.ts +0 -126
- package/src/managers/ChatManager.ts +0 -755
- package/src/managers/ChunkManager.ts +0 -31
- package/src/managers/CodeManager.ts +0 -226
- package/src/managers/CommitManager.ts +0 -71
- package/src/managers/DocsManager.ts +0 -101
- package/src/managers/InitManager.ts +0 -263
- package/src/managers/ProxyManager.ts +0 -240
- package/src/managers/ReviewManager.ts +0 -154
- package/src/managers/ShellManager.ts +0 -172
- package/src/managers/StreamManager.ts +0 -353
- package/src/managers/UnitTestManager.ts +0 -293
- package/src/utils/config_utils.ts +0 -271
- package/src/utils/git_utils.ts +0 -230
- package/src/utils/model_utils.ts +0 -3
- package/src/utils/prompt_utils.ts +0 -375
- package/src/utils/prompts/CODEGEN_COULDNT_APPLY.md +0 -5
- package/src/utils/prompts/CODEGEN_EXAMPLES.md +0 -82
- package/src/utils/prompts/CODEGEN_INSTRUCTIONS.md +0 -43
- package/src/utils/prompts/DOCS_INSTRUCTIONS.md +0 -9
- package/src/utils/prompts/INIT_INSTRUCTIONS.md +0 -132
- package/src/utils/prompts/REVIEW_INSTRUCTIONS.md +0 -49
- package/src/utils/prompts/SHELL_INSTRUCTIONS.md +0 -15
- package/src/utils/prompts/SPECIAL_FILES.md +0 -66
- package/src/utils/prompts/index.ts +0 -37
- package/src/utils/string_utils.ts +0 -552
- package/src/utils/types.ts +0 -127
- package/tests/commands/generate/unit_tests.test.ts +0 -27
- package/tests/utils/git_utils.test.ts +0 -116
- package/tests/utils/model_utils.test.ts +0 -27
- package/tests/utils/prompt_utils.test.ts +0 -33
- package/tests/utils/string_utils.test.ts +0 -560
- package/tsconfig.json +0 -14
- package/yarn.lock +0 -5823
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
const binding = "--expected-revision <n> --generation <n> --subject-digest <digest>";
|
|
2
|
+
export const commandUsage = {
|
|
3
|
+
run: `Usage: cloving run <workflow-id> (--prompt <text> | --ticket <id> | --next | --input <json-file>) [--command-id <id>] [--json]
|
|
4
|
+
|
|
5
|
+
Submits one run of an admitted workflow. Use exactly one input source.
|
|
6
|
+
With --ticket, the workflow gets the ticket ID and reads the ticket itself.
|
|
7
|
+
With --next (the same as --ticket next), develop-issue and develop-ticket select a ready ticket through CLOVING_NEXT_COMMAND.
|
|
8
|
+
Success means a committed receipt. It does not mean completed work.
|
|
9
|
+
`,
|
|
10
|
+
status: `Usage: cloving status [<run-id>] [--limit <n>] [--after <cursor>] [--json]
|
|
11
|
+
|
|
12
|
+
Lists the runs, or shows one run with its reason, evidence and next action.
|
|
13
|
+
`,
|
|
14
|
+
questions: `Usage: cloving questions [<run-id>] [--json]
|
|
15
|
+
|
|
16
|
+
Lists the pending decisions with the values that a decision command needs.
|
|
17
|
+
`,
|
|
18
|
+
answer: `Usage: cloving answer <decision-ref> --text <answer> ${binding} [--command-id <id>] [--json]
|
|
19
|
+
|
|
20
|
+
Records an answer to one design question.
|
|
21
|
+
`,
|
|
22
|
+
approve: `Usage: cloving approve <decision-ref> ${binding} [--command-id <id>] [--json]
|
|
23
|
+
|
|
24
|
+
Approves one pending approval.
|
|
25
|
+
`,
|
|
26
|
+
deny: `Usage: cloving deny <decision-ref> [--text <feedback>] ${binding} [--command-id <id>] [--json]
|
|
27
|
+
|
|
28
|
+
Denies one pending approval. The workflow continues with the denial.
|
|
29
|
+
A feedback text has at most 8000 bytes. The ticket workflow sends it to the next round.
|
|
30
|
+
`,
|
|
31
|
+
pause: `Usage: cloving pause <run-id> --expected-revision <n> [--command-id <id>] [--json]
|
|
32
|
+
|
|
33
|
+
Stops new dispatch for the run. Work in progress is not stopped at once.
|
|
34
|
+
`,
|
|
35
|
+
resume: `Usage: cloving resume <run-id> --expected-revision <n> [--command-id <id>] [--json]
|
|
36
|
+
|
|
37
|
+
Returns a paused run to the state that it paused from.
|
|
38
|
+
`,
|
|
39
|
+
drop: `Usage: cloving drop <run-id> --expected-revision <n> [--command-id <id>] [--json]
|
|
40
|
+
|
|
41
|
+
Cancels the run and its pending dispatch. It keeps the workspace and the evidence.
|
|
42
|
+
`,
|
|
43
|
+
events: `Usage: cloving events [<run-id>] [--after <sequence>] [--limit <n>] [--follow] [--json]
|
|
44
|
+
|
|
45
|
+
Prints the committed events after a sequence. With --json, each line is one event.
|
|
46
|
+
`,
|
|
47
|
+
watch: `Usage: cloving watch [--port <n>]
|
|
48
|
+
|
|
49
|
+
Serves a page on http://127.0.0.1:<port>/ that shows the runs live: the state,
|
|
50
|
+
the events, the work of the Claude worker and each pending decision.
|
|
51
|
+
The default port is 3663. The page is read only. Stop it with Control-C.
|
|
52
|
+
`,
|
|
53
|
+
start: `Usage: cloving start [--repository <directory>]
|
|
54
|
+
|
|
55
|
+
Starts the Cloving service for one git repository, with the workflow host,
|
|
56
|
+
the Claude worker and the watch page. The default repository is the current
|
|
57
|
+
directory. This command works in a development checkout of Cloving.
|
|
58
|
+
Stop it with Control-C.
|
|
59
|
+
|
|
60
|
+
The command reads these settings from the environment:
|
|
61
|
+
CLOVING_RUNTIME_DIR The path of the runtime directory. The default is ~/.local/state/cloving/run, if XDG_RUNTIME_DIR and XDG_STATE_HOME are not set.
|
|
62
|
+
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.
|
|
63
|
+
CLOVING_NOTIFY_COMMAND A JSON list of a command and its arguments. Every 15 seconds, new decisions, blocked runs and failed runs send JSON on standard input with no added argument. The setting has no default.
|
|
64
|
+
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. The setting has no default.
|
|
65
|
+
CLOVING_QUEUE_SECONDS A whole number from 10 to 3600 seconds between develop-issue queue checks; requires CLOVING_NEXT_COMMAND and CLOVING_TICKET_COMMAND. Unset means no queue. The queue stops after a failed, cancelled or unsuccessful run until restart; manual develop-issue submissions are refused with workflow-active while an issue run is active.
|
|
66
|
+
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.
|
|
67
|
+
CLOVING_CLAUDE_COMMAND A JSON list of a command and its arguments for the Claude worker. The default is the claude command with a limit of 5 USD for each turn.
|
|
68
|
+
CLOVING_PROFILES The path of a JSON file of operator-defined Claude turn profiles, read once at start. The setting has no default.
|
|
69
|
+
CLOVING_WORKER The worker for each turn: claude or codex. The default is claude. Other values stop the start with invalid-worker.
|
|
70
|
+
CLOVING_CODEX_COMMAND A JSON list of a command and its arguments, used only when CLOVING_WORKER is codex; CLOVING_CLAUDE_COMMAND is then ignored. The default is codex exec --json --dangerously-bypass-approvals-and-sandbox --skip-git-repo-check -, with no sandbox and no approval prompts.
|
|
71
|
+
CLOVING_WATCH_PORT The port number of the watch page. The value off starts no watch page. The default is 3663.
|
|
72
|
+
CLOVING_OWNERSHIP_LEASE_SECONDS The time in seconds of the ownership lease of a started workflow step. The default is 15.
|
|
73
|
+
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.
|
|
74
|
+
CLOVING_GH_COMMAND A JSON list of a command and its arguments for the GitHub CLI, which the workflow develop-issue uses for pull requests and develop-prd uses for issues. The default is gh.
|
|
75
|
+
CLOVING_CHECK_COMMAND A JSON list of a command and its arguments that the workflow develop-issue 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.
|
|
76
|
+
CLOVING_PRIVATE_TEXTS A JSON list of texts that the workflow develop-issue does not push in a file or in a commit message. The workflow develop-prd requires the list before posting an issue. The list adds to the path of the home folder, and the case of the letters does not matter. The setting has no default.
|
|
77
|
+
`,
|
|
78
|
+
};
|
|
79
|
+
export const usage = `Usage: cloving [--help] [--version]
|
|
80
|
+
cloving workflows validate <manifest-path> [--input <json-file>] [--json]
|
|
81
|
+
cloving <command> [--help]
|
|
82
|
+
|
|
83
|
+
Commands:
|
|
84
|
+
workflows validate Check a compiled workflow manifest, its artifacts and optional runtime input.
|
|
85
|
+
chats import Import explicitly selected Claude Code transcripts into private runtime files.
|
|
86
|
+
run Submit one run of an admitted workflow.
|
|
87
|
+
status List the runs or show one run.
|
|
88
|
+
questions List the pending decisions.
|
|
89
|
+
answer Answer one design question.
|
|
90
|
+
approve Approve one pending approval.
|
|
91
|
+
deny Deny one pending approval.
|
|
92
|
+
pause Stop new dispatch for a run.
|
|
93
|
+
resume Resume a paused run.
|
|
94
|
+
drop Cancel a run and keep its files.
|
|
95
|
+
events Print the committed events.
|
|
96
|
+
watch Serve a page that shows the runs live.
|
|
97
|
+
start Start the service for a repository.
|
|
98
|
+
|
|
99
|
+
The runtime commands need a Cloving service. CLOVING_RUNTIME_DIR names its runtime directory.
|
|
100
|
+
Use npm exec -- cloving ... for a project-local installation.
|
|
101
|
+
`;
|
|
102
|
+
export const chatsImportUsage = `Usage: cloving chats import [--] <path> [<path> ...]
|
|
103
|
+
|
|
104
|
+
Imports only the selected Claude Code JSONL files. Relative paths use the current directory.
|
|
105
|
+
This local command needs no service. It does not expand globs or scan directories.
|
|
106
|
+
The file limit is 10 MiB (10,485,760 bytes). Links and nonregular files are refused.
|
|
107
|
+
Private corpus.jsonl and coverage.json files go into a new import directory under the runtime directory's chats directory.
|
|
108
|
+
The runtime selection is CLOVING_RUNTIME_DIR, XDG_RUNTIME_DIR, XDG_STATE_HOME, then HOME.
|
|
109
|
+
Output contains only counts, fixed codes and an opaque import ID. Source paths stay in the private manifest.
|
|
110
|
+
Exit codes: 0 for complete coverage, 1 for refused sources or output failure, 2 for invalid usage.
|
|
111
|
+
`;
|
|
112
|
+
export const validateUsage = `Usage: cloving workflows validate <manifest-path> [--input <json-file>] [--json]
|
|
113
|
+
|
|
114
|
+
Checks 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.
|
|
115
|
+
|
|
116
|
+
Options:
|
|
117
|
+
--input <json-file> Validate this runtime input file.
|
|
118
|
+
--json Print one versioned JSON result on stdout.
|
|
119
|
+
|
|
120
|
+
Validation does not admit a run, dispatch effects, import workflow code or call a model.
|
|
121
|
+
|
|
122
|
+
Example:
|
|
123
|
+
cloving workflows validate cloving.workflow.json --input input.json
|
|
124
|
+
`;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type ExecutionManifest } from "../workflow-admission.ts";
|
|
2
|
+
export interface ValidationError {
|
|
3
|
+
readonly code: string;
|
|
4
|
+
readonly file: string;
|
|
5
|
+
readonly detail: string;
|
|
6
|
+
}
|
|
7
|
+
export type ValidationReport = {
|
|
8
|
+
readonly schemaVersion: 1;
|
|
9
|
+
readonly kind: "workflow-validation";
|
|
10
|
+
readonly status: "valid";
|
|
11
|
+
readonly workflow: {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly workflowId: string;
|
|
14
|
+
};
|
|
15
|
+
readonly pinnedIdentity: string;
|
|
16
|
+
readonly errors: readonly ValidationError[];
|
|
17
|
+
} | {
|
|
18
|
+
readonly schemaVersion: 1;
|
|
19
|
+
readonly kind: "workflow-validation";
|
|
20
|
+
readonly status: "rejected";
|
|
21
|
+
readonly errors: readonly ValidationError[];
|
|
22
|
+
};
|
|
23
|
+
export type CompiledAdmission = {
|
|
24
|
+
readonly kind: "admitted";
|
|
25
|
+
readonly manifest: ExecutionManifest;
|
|
26
|
+
} | {
|
|
27
|
+
readonly kind: "rejected";
|
|
28
|
+
readonly error: ValidationError;
|
|
29
|
+
};
|
|
30
|
+
export interface AdmissionRequest {
|
|
31
|
+
readonly file: string;
|
|
32
|
+
readonly capabilities: readonly string[];
|
|
33
|
+
}
|
|
34
|
+
export declare function validateWorkflow(directory: string, files: {
|
|
35
|
+
readonly manifest: string;
|
|
36
|
+
readonly input: string | null;
|
|
37
|
+
}): Promise<ValidationReport>;
|
|
38
|
+
export declare function admitCompiled(path: string, request: AdmissionRequest): Promise<CompiledAdmission>;
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, resolve } from "node:path";
|
|
4
|
+
import { pinnedIdentity } from "../execution-pin.js";
|
|
5
|
+
import { collectResources } from "../resource-files.js";
|
|
6
|
+
import { admitWorkflow, } from "../workflow-admission.js";
|
|
7
|
+
import { validateDevelopmentInput } from "../workflow-contracts.js";
|
|
8
|
+
import { observedToolchain, qualifiedToolchain } from "./toolchain.js";
|
|
9
|
+
const artifactNames = [
|
|
10
|
+
"client.mjs",
|
|
11
|
+
"flow.mjs",
|
|
12
|
+
"flow.mjs.__wf_tmp.js.debug.json",
|
|
13
|
+
"manifest.json",
|
|
14
|
+
"steps.mjs",
|
|
15
|
+
"steps.mjs.debug.json",
|
|
16
|
+
];
|
|
17
|
+
export async function validateWorkflow(directory, files) {
|
|
18
|
+
const { manifest, input } = files;
|
|
19
|
+
const errors = input === null ? [] : await inputErrors(resolve(directory, input), input);
|
|
20
|
+
const admission = await admitCompiled(resolve(directory, manifest), {
|
|
21
|
+
file: manifest,
|
|
22
|
+
capabilities: [],
|
|
23
|
+
});
|
|
24
|
+
if (admission.kind === "rejected")
|
|
25
|
+
errors.push(admission.error);
|
|
26
|
+
if (admission.kind === "rejected" || errors.length > 0)
|
|
27
|
+
return {
|
|
28
|
+
schemaVersion: 1,
|
|
29
|
+
kind: "workflow-validation",
|
|
30
|
+
status: "rejected",
|
|
31
|
+
errors,
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
schemaVersion: 1,
|
|
35
|
+
kind: "workflow-validation",
|
|
36
|
+
status: "valid",
|
|
37
|
+
workflow: {
|
|
38
|
+
name: admission.manifest.name,
|
|
39
|
+
workflowId: admission.manifest.workflowId,
|
|
40
|
+
},
|
|
41
|
+
pinnedIdentity: createHash("sha256")
|
|
42
|
+
.update(pinnedIdentity(admission.manifest))
|
|
43
|
+
.digest("hex"),
|
|
44
|
+
errors: [],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
async function inputErrors(path, file) {
|
|
48
|
+
const value = await readJson(path);
|
|
49
|
+
if (value === null)
|
|
50
|
+
return [{ code: "unreadable-input", file, detail: "json" }];
|
|
51
|
+
if (validateDevelopmentInput(value).kind === "valid")
|
|
52
|
+
return [];
|
|
53
|
+
return [{ code: "invalid-development-input", file, detail: "cycleId" }];
|
|
54
|
+
}
|
|
55
|
+
export async function admitCompiled(path, request) {
|
|
56
|
+
const { file, capabilities } = request;
|
|
57
|
+
const registration = fields(await readJson(path));
|
|
58
|
+
const artifacts = registration["artifacts"];
|
|
59
|
+
if (registration["schemaVersion"] !== 1 || typeof artifacts !== "string")
|
|
60
|
+
return rejected({
|
|
61
|
+
code: "invalid-manifest",
|
|
62
|
+
file,
|
|
63
|
+
detail: "schemaVersion or artifacts",
|
|
64
|
+
});
|
|
65
|
+
const root = dirname(path);
|
|
66
|
+
const directory = resolve(root, artifacts);
|
|
67
|
+
const digests = {};
|
|
68
|
+
const contents = {};
|
|
69
|
+
for (const name of artifactNames) {
|
|
70
|
+
const bytes = await readFile(resolve(directory, name)).catch(() => null);
|
|
71
|
+
if (bytes === null)
|
|
72
|
+
return rejected({ code: "missing-artifact", file, detail: name });
|
|
73
|
+
digests[name] = createHash("sha256").update(bytes).digest("hex");
|
|
74
|
+
contents[name] = bytes;
|
|
75
|
+
}
|
|
76
|
+
const declared = registration["resources"];
|
|
77
|
+
const toolchain = await observedToolchain(directory);
|
|
78
|
+
const result = admitWorkflow(registration, {
|
|
79
|
+
compiled: {
|
|
80
|
+
manifest: parseJson(contents["manifest.json"]?.toString("utf8") ?? ""),
|
|
81
|
+
artifacts: digests,
|
|
82
|
+
resources: await collectResources(root, Array.isArray(declared)
|
|
83
|
+
? declared.filter((item) => typeof item === "string")
|
|
84
|
+
: []),
|
|
85
|
+
toolchain,
|
|
86
|
+
},
|
|
87
|
+
policy: {
|
|
88
|
+
toolchain: await qualifiedToolchain(toolchain, directory),
|
|
89
|
+
capabilities,
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
if (result.kind === "rejected")
|
|
93
|
+
return rejected({ code: result.reason, file, detail: result.detail });
|
|
94
|
+
return result;
|
|
95
|
+
}
|
|
96
|
+
function rejected(error) {
|
|
97
|
+
return { kind: "rejected", error };
|
|
98
|
+
}
|
|
99
|
+
async function readJson(path) {
|
|
100
|
+
const text = await readFile(path, "utf8").catch(() => null);
|
|
101
|
+
return text === null ? null : parseJson(text);
|
|
102
|
+
}
|
|
103
|
+
function parseJson(text) {
|
|
104
|
+
try {
|
|
105
|
+
const value = JSON.parse(text);
|
|
106
|
+
return value;
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function fields(value) {
|
|
113
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
114
|
+
return {};
|
|
115
|
+
return Object.fromEntries(Object.entries(value));
|
|
116
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type Shown } from "./watch-element.ts";
|
|
2
|
+
import type { WatchCard, WatchWorkflow } from "./watch-render.ts";
|
|
3
|
+
export declare function cardStep(card: WatchCard, now: string): string;
|
|
4
|
+
export declare function cardReview(card: WatchCard): string;
|
|
5
|
+
export declare function CardReview(props: {
|
|
6
|
+
readonly card: WatchCard;
|
|
7
|
+
readonly workflowId: string;
|
|
8
|
+
}): Shown;
|
|
9
|
+
export declare function completionMark(card: WatchCard, workflowId: string): Shown;
|
|
10
|
+
export declare function Card(props: {
|
|
11
|
+
readonly card: WatchCard;
|
|
12
|
+
readonly workflowId: string;
|
|
13
|
+
readonly now: string;
|
|
14
|
+
}): Shown;
|
|
15
|
+
export declare function WorkflowList(props: {
|
|
16
|
+
readonly workflows: readonly WatchWorkflow[];
|
|
17
|
+
readonly selected: string | null;
|
|
18
|
+
}): Shown;
|
|
19
|
+
export declare function Board(props: {
|
|
20
|
+
readonly workflow: WatchWorkflow;
|
|
21
|
+
readonly now: string;
|
|
22
|
+
}): Shown;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { component, element } from "./watch-element.js";
|
|
2
|
+
import { watchHash } from "./watch-navigation.js";
|
|
3
|
+
export function cardStep(card, now) {
|
|
4
|
+
if (card.endedAt !== null)
|
|
5
|
+
return new Date(card.endedAt).toLocaleString();
|
|
6
|
+
const step = card.currentStep;
|
|
7
|
+
if (step === null)
|
|
8
|
+
return "";
|
|
9
|
+
if (step.startedAt === null)
|
|
10
|
+
return step.name;
|
|
11
|
+
const minutes = Math.max(0, Math.floor((Date.parse(now) - Date.parse(step.startedAt)) / 60000));
|
|
12
|
+
return `${step.name} · ${String(minutes)} min`;
|
|
13
|
+
}
|
|
14
|
+
export function cardReview(card) {
|
|
15
|
+
return [
|
|
16
|
+
card.round === null ? null : `round ${String(card.round)}`,
|
|
17
|
+
card.greptileScore === null ? null : `${String(card.greptileScore)}/5`,
|
|
18
|
+
card.pullRequestNumber === null
|
|
19
|
+
? null
|
|
20
|
+
: `#${String(card.pullRequestNumber)}`,
|
|
21
|
+
]
|
|
22
|
+
.filter((part) => part !== null)
|
|
23
|
+
.join(" · ");
|
|
24
|
+
}
|
|
25
|
+
export function CardReview(props) {
|
|
26
|
+
if (props.workflowId !== "develop-issue")
|
|
27
|
+
return null;
|
|
28
|
+
const review = cardReview(props.card);
|
|
29
|
+
if (review === "")
|
|
30
|
+
return null;
|
|
31
|
+
return element("span", {
|
|
32
|
+
class: "card-review",
|
|
33
|
+
children: review
|
|
34
|
+
.split(" · ")
|
|
35
|
+
.map((part, index) => [
|
|
36
|
+
index === 0 ? "" : " · ",
|
|
37
|
+
element("span", { class: "review-pill", children: part }),
|
|
38
|
+
]),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export function completionMark(card, workflowId) {
|
|
42
|
+
const mark = card.completionMark;
|
|
43
|
+
if (mark === null)
|
|
44
|
+
return null;
|
|
45
|
+
if (mark.laterRunId === null)
|
|
46
|
+
return element("span", { class: "completion-mark", children: mark.text });
|
|
47
|
+
return element("a", {
|
|
48
|
+
class: "completion-mark",
|
|
49
|
+
href: watchHash({ workflowId, runId: mark.laterRunId }),
|
|
50
|
+
children: mark.text,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
export function Card(props) {
|
|
54
|
+
const { card, workflowId, now } = props;
|
|
55
|
+
return element("article", {
|
|
56
|
+
class: "card",
|
|
57
|
+
children: [
|
|
58
|
+
element("a", {
|
|
59
|
+
class: "card-run",
|
|
60
|
+
href: watchHash({ workflowId, runId: card.runId }),
|
|
61
|
+
children: [
|
|
62
|
+
element("strong", { children: card.title ?? card.runId }),
|
|
63
|
+
element("span", {
|
|
64
|
+
class: card.endedAt === null && card.currentStep !== null
|
|
65
|
+
? "card-step active"
|
|
66
|
+
: "card-step",
|
|
67
|
+
children: cardStep(card, now),
|
|
68
|
+
}),
|
|
69
|
+
component(CardReview, { card, workflowId }),
|
|
70
|
+
element("span", {
|
|
71
|
+
class: "card-cost",
|
|
72
|
+
children: `${card.claudeCostUsd.toFixed(2)} USD`,
|
|
73
|
+
}),
|
|
74
|
+
card.decisionWaiting
|
|
75
|
+
? element("span", {
|
|
76
|
+
class: "decision-mark",
|
|
77
|
+
children: "! Decision waiting",
|
|
78
|
+
})
|
|
79
|
+
: null,
|
|
80
|
+
element("small", { children: card.runId }),
|
|
81
|
+
],
|
|
82
|
+
}),
|
|
83
|
+
completionMark(card, workflowId),
|
|
84
|
+
],
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
export function WorkflowList(props) {
|
|
88
|
+
return element("nav", {
|
|
89
|
+
class: "workflows",
|
|
90
|
+
"aria-label": "Workflows",
|
|
91
|
+
children: props.workflows.map((workflow) => element("a", {
|
|
92
|
+
key: workflow.workflowId,
|
|
93
|
+
href: watchHash({ workflowId: workflow.workflowId, runId: null }),
|
|
94
|
+
"aria-current": workflow.workflowId === props.selected ? "page" : undefined,
|
|
95
|
+
children: [
|
|
96
|
+
element("strong", { children: workflow.workflowId }),
|
|
97
|
+
element("span", {
|
|
98
|
+
children: `${String(workflow.activeCount)} active · ${String(workflow.waitingCount)} waiting`,
|
|
99
|
+
}),
|
|
100
|
+
],
|
|
101
|
+
})),
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
export function Board(props) {
|
|
105
|
+
const { workflow, now } = props;
|
|
106
|
+
return element("main", {
|
|
107
|
+
class: "board",
|
|
108
|
+
children: [
|
|
109
|
+
element("h2", { children: workflow.workflowId }),
|
|
110
|
+
element("div", {
|
|
111
|
+
class: "columns",
|
|
112
|
+
children: workflow.columns.map((column) => element("section", {
|
|
113
|
+
key: column.name,
|
|
114
|
+
class: column.name === "Stopped" ? "column stopped" : "column",
|
|
115
|
+
children: [
|
|
116
|
+
element("h3", { class: "column-name", children: column.name }),
|
|
117
|
+
column.cards.map((card) => component(Card, {
|
|
118
|
+
key: card.runId,
|
|
119
|
+
card,
|
|
120
|
+
workflowId: workflow.workflowId,
|
|
121
|
+
now,
|
|
122
|
+
})),
|
|
123
|
+
],
|
|
124
|
+
})),
|
|
125
|
+
}),
|
|
126
|
+
],
|
|
127
|
+
});
|
|
128
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { WatchCompletionMark, WatchRun, WatchStep, WatchWorkflow } from "./watch-render.ts";
|
|
2
|
+
export declare function completionMarkOf(run: WatchRun, candidates: readonly WatchRun[]): WatchCompletionMark | null;
|
|
3
|
+
export declare function activeRun(state: string): boolean;
|
|
4
|
+
export declare function recentRun(latestAt: string | null, now: string): boolean;
|
|
5
|
+
export declare function currentStepOf(events: readonly unknown[], workflowId: string): WatchStep;
|
|
6
|
+
export declare function roundOf(events: readonly unknown[]): number;
|
|
7
|
+
interface BoardInputs {
|
|
8
|
+
readonly workflows: readonly string[];
|
|
9
|
+
readonly updatedAt: string;
|
|
10
|
+
readonly summaries?: readonly unknown[];
|
|
11
|
+
readonly completionCandidates?: readonly WatchRun[];
|
|
12
|
+
}
|
|
13
|
+
export declare function boardsOf(inputs: BoardInputs, runs: readonly WatchRun[]): WatchWorkflow[];
|
|
14
|
+
export declare function startWorkflowOf(workflows: readonly WatchWorkflow[]): string | null;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { record } from "../protocol.js";
|
|
2
|
+
import { isInstant } from "../authority/instants.js";
|
|
3
|
+
import { issueSteps } from "./watch-phases.js";
|
|
4
|
+
const weekMilliseconds = 7 * 24 * 60 * 60 * 1000;
|
|
5
|
+
const terminalStates = ["completed", "failed", "cancelled"];
|
|
6
|
+
function eventTime(run, type) {
|
|
7
|
+
const recordedAt = run.events.find((event) => event.type === type)?.recordedAt;
|
|
8
|
+
return isInstant(recordedAt) ? Date.parse(recordedAt) : NaN;
|
|
9
|
+
}
|
|
10
|
+
export function completionMarkOf(run, candidates) {
|
|
11
|
+
if (run.workflowId !== "develop-issue" ||
|
|
12
|
+
run.state !== "completed" ||
|
|
13
|
+
run.outcome !== "blocked")
|
|
14
|
+
return null;
|
|
15
|
+
const completedAt = eventTime(run, "run.completed");
|
|
16
|
+
const later = candidates
|
|
17
|
+
.filter((candidate) => typeof run.ticketId === "string" &&
|
|
18
|
+
run.ticketId !== "" &&
|
|
19
|
+
candidate.ticketId === run.ticketId &&
|
|
20
|
+
candidate.runId !== run.runId &&
|
|
21
|
+
candidate.workflowId === "develop-issue" &&
|
|
22
|
+
candidate.state === "completed" &&
|
|
23
|
+
candidate.outcome === "handoff_requested")
|
|
24
|
+
.map((candidate) => ({
|
|
25
|
+
runId: candidate.runId,
|
|
26
|
+
createdAt: eventTime(candidate, "run.created"),
|
|
27
|
+
}))
|
|
28
|
+
.filter((candidate) => candidate.createdAt > completedAt)
|
|
29
|
+
.toSorted((first, second) => first.createdAt - second.createdAt ||
|
|
30
|
+
(first.runId < second.runId ? -1 : 1))[0];
|
|
31
|
+
return later === undefined
|
|
32
|
+
? { text: "Needs attention", laterRunId: null }
|
|
33
|
+
: { text: "Done in a later run", laterRunId: later.runId };
|
|
34
|
+
}
|
|
35
|
+
export function activeRun(state) {
|
|
36
|
+
return !terminalStates.includes(state);
|
|
37
|
+
}
|
|
38
|
+
export function recentRun(latestAt, now) {
|
|
39
|
+
const age = Date.parse(now) - Date.parse(latestAt ?? "");
|
|
40
|
+
return age >= 0 && age <= weekMilliseconds;
|
|
41
|
+
}
|
|
42
|
+
function stepNames(workflowId) {
|
|
43
|
+
return workflowId === "develop-issue"
|
|
44
|
+
? issueSteps.map((step) => step.name)
|
|
45
|
+
: ["Claude turn", "Your review"];
|
|
46
|
+
}
|
|
47
|
+
function operationOf(event) {
|
|
48
|
+
const payload = record(record(event)?.["payload"]);
|
|
49
|
+
try {
|
|
50
|
+
const operation = JSON.parse(String(payload?.["operationId"]));
|
|
51
|
+
return Array.isArray(operation) ? operation : [];
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function stepName(event, workflowId) {
|
|
58
|
+
const type = record(event)?.["type"];
|
|
59
|
+
if (workflowId !== "develop-issue" && type === "gate.opened")
|
|
60
|
+
return "Your review";
|
|
61
|
+
if (type !== "effect.requested")
|
|
62
|
+
return undefined;
|
|
63
|
+
if (workflowId !== "develop-issue")
|
|
64
|
+
return "Claude turn";
|
|
65
|
+
return issueSteps.find((step) => step.operation === operationOf(event)[4])
|
|
66
|
+
?.name;
|
|
67
|
+
}
|
|
68
|
+
function startedAt(event) {
|
|
69
|
+
const value = record(event)?.["recordedAt"];
|
|
70
|
+
return typeof value === "string" ? value : null;
|
|
71
|
+
}
|
|
72
|
+
function chronological(events) {
|
|
73
|
+
return events.toSorted((first, second) => Date.parse(startedAt(first) ?? "") - Date.parse(startedAt(second) ?? ""));
|
|
74
|
+
}
|
|
75
|
+
export function currentStepOf(events, workflowId) {
|
|
76
|
+
const event = chronological(events).findLast((item) => stepName(item, workflowId) !== undefined);
|
|
77
|
+
return {
|
|
78
|
+
name: stepName(event, workflowId) ?? stepNames(workflowId)[0] ?? "Claude turn",
|
|
79
|
+
startedAt: startedAt(event),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export function roundOf(events) {
|
|
83
|
+
const event = chronological(events).findLast((item) => record(item)?.["type"] === "effect.requested" &&
|
|
84
|
+
operationOf(item)[4] === "claude-turn");
|
|
85
|
+
const round = operationOf(event)[1];
|
|
86
|
+
return typeof round === "number" ? round : 1;
|
|
87
|
+
}
|
|
88
|
+
function columnOf(run, now) {
|
|
89
|
+
if (activeRun(run.state))
|
|
90
|
+
return run.currentStep.name;
|
|
91
|
+
if (!recentRun(run.latestAt, now))
|
|
92
|
+
return null;
|
|
93
|
+
if (run.state !== "completed" || run.outcome === "blocked")
|
|
94
|
+
return "Stopped";
|
|
95
|
+
return run.outcome === "handoff_requested" ? "Done" : null;
|
|
96
|
+
}
|
|
97
|
+
function cardOf(run, runs) {
|
|
98
|
+
const issue = run.workflowId === "develop-issue";
|
|
99
|
+
return {
|
|
100
|
+
runId: run.runId,
|
|
101
|
+
title: run.title,
|
|
102
|
+
completionMark: completionMarkOf(run, runs),
|
|
103
|
+
claudeCostUsd: run.claudeCostUsd,
|
|
104
|
+
currentStep: activeRun(run.state) ? run.currentStep : null,
|
|
105
|
+
endedAt: activeRun(run.state) ? null : run.latestAt,
|
|
106
|
+
decisionWaiting: run.decisions.length > 0,
|
|
107
|
+
round: issue ? run.round : null,
|
|
108
|
+
greptileScore: issue ? (run.reviews.at(-1)?.score ?? null) : null,
|
|
109
|
+
pullRequestNumber: issue ? (run.pullRequest?.number ?? null) : null,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function stepOrder(first, second) {
|
|
113
|
+
const waiting = Number(second.decisionWaiting) - Number(first.decisionWaiting);
|
|
114
|
+
if (waiting !== 0)
|
|
115
|
+
return waiting;
|
|
116
|
+
return (Date.parse(first.currentStep?.startedAt ?? "1970-01-01") -
|
|
117
|
+
Date.parse(second.currentStep?.startedAt ?? "1970-01-01"));
|
|
118
|
+
}
|
|
119
|
+
function latestTime(times) {
|
|
120
|
+
return (times
|
|
121
|
+
.filter((time) => time !== null)
|
|
122
|
+
.toSorted((first, second) => Date.parse(second) - Date.parse(first))[0] ??
|
|
123
|
+
null);
|
|
124
|
+
}
|
|
125
|
+
function summaryOf(value) {
|
|
126
|
+
const fields = record(value);
|
|
127
|
+
const pending = fields?.["pendingDecisions"];
|
|
128
|
+
const latest = fields?.["latestAt"];
|
|
129
|
+
return {
|
|
130
|
+
state: String(fields?.["state"]),
|
|
131
|
+
waiting: Array.isArray(pending) && pending.length > 0,
|
|
132
|
+
latestAt: typeof latest === "string" ? latest : null,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
export function boardsOf(inputs, runs) {
|
|
136
|
+
return inputs.workflows.map((workflowId) => {
|
|
137
|
+
const own = runs.filter((run) => run.workflowId === workflowId);
|
|
138
|
+
const summaries = inputs.summaries === undefined
|
|
139
|
+
? own.map((run) => ({
|
|
140
|
+
state: run.state,
|
|
141
|
+
waiting: run.decisions.length > 0,
|
|
142
|
+
latestAt: run.latestAt,
|
|
143
|
+
}))
|
|
144
|
+
: inputs.summaries
|
|
145
|
+
.filter((value) => record(value)?.["workflowId"] === workflowId)
|
|
146
|
+
.map(summaryOf);
|
|
147
|
+
const columns = [...stepNames(workflowId), "Done", "Stopped"].map((name) => {
|
|
148
|
+
const cards = own
|
|
149
|
+
.filter((run) => columnOf(run, inputs.updatedAt) === name)
|
|
150
|
+
.map((run) => cardOf(run, inputs.completionCandidates ?? runs));
|
|
151
|
+
return {
|
|
152
|
+
name,
|
|
153
|
+
cards: ["Done", "Stopped"].includes(name)
|
|
154
|
+
? cards
|
|
155
|
+
.toSorted((first, second) => Date.parse(second.endedAt ?? "") -
|
|
156
|
+
Date.parse(first.endedAt ?? ""))
|
|
157
|
+
.slice(0, 20)
|
|
158
|
+
: cards.toSorted(stepOrder),
|
|
159
|
+
};
|
|
160
|
+
});
|
|
161
|
+
return {
|
|
162
|
+
workflowId,
|
|
163
|
+
activeCount: summaries.filter((run) => activeRun(run.state)).length,
|
|
164
|
+
waitingCount: summaries.filter((run) => run.waiting).length,
|
|
165
|
+
latestAt: latestTime(summaries.map((run) => run.latestAt)),
|
|
166
|
+
columns,
|
|
167
|
+
};
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
export function startWorkflowOf(workflows) {
|
|
171
|
+
const waiting = workflows.filter((workflow) => workflow.waitingCount > 0);
|
|
172
|
+
return ((waiting.length > 0 ? waiting : workflows).toSorted((first, second) => Date.parse(second.latestAt ?? "1970-01-01") -
|
|
173
|
+
Date.parse(first.latestAt ?? "1970-01-01"))[0]?.workflowId ?? null);
|
|
174
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type WatchElement = {
|
|
2
|
+
readonly tag: string;
|
|
3
|
+
readonly props: Readonly<Record<string, unknown>>;
|
|
4
|
+
} | {
|
|
5
|
+
readonly content: () => Shown;
|
|
6
|
+
};
|
|
7
|
+
export type Shown = WatchElement | string | number | null | undefined | readonly Shown[];
|
|
8
|
+
export declare function element(tag: string, props: Readonly<Record<string, unknown>>): WatchElement;
|
|
9
|
+
export declare function component<Props>(type: (props: Props) => Shown, props: Props & {
|
|
10
|
+
readonly key?: string;
|
|
11
|
+
}): WatchElement;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { WatchDecision, WatchItem, WatchModel, WatchTurn } from "./watch-render.ts";
|
|
2
|
+
export declare function activityOf(line: string): WatchItem[];
|
|
3
|
+
export interface TurnRecords {
|
|
4
|
+
readonly key: string;
|
|
5
|
+
readonly started: unknown;
|
|
6
|
+
readonly result: unknown;
|
|
7
|
+
readonly lines: readonly string[];
|
|
8
|
+
readonly activeAt?: string | null;
|
|
9
|
+
}
|
|
10
|
+
export declare function turnOf(records: TurnRecords): WatchTurn;
|
|
11
|
+
export declare function decisionCommands(decision: unknown, client: string): WatchDecision;
|
|
12
|
+
export interface WatchInputs {
|
|
13
|
+
readonly workflows: readonly string[];
|
|
14
|
+
readonly summaries?: readonly unknown[];
|
|
15
|
+
readonly home: string;
|
|
16
|
+
readonly client: string;
|
|
17
|
+
readonly updatedAt: string;
|
|
18
|
+
readonly service: string;
|
|
19
|
+
readonly runs: readonly unknown[];
|
|
20
|
+
readonly completionCandidates?: readonly unknown[];
|
|
21
|
+
readonly decisions: readonly unknown[];
|
|
22
|
+
readonly turns: readonly WatchTurn[];
|
|
23
|
+
readonly githubRecords: readonly GithubRecords[];
|
|
24
|
+
}
|
|
25
|
+
export interface GithubRecords {
|
|
26
|
+
readonly started: unknown;
|
|
27
|
+
readonly result: unknown;
|
|
28
|
+
}
|
|
29
|
+
export declare function watchModel(inputs: WatchInputs): WatchModel;
|