lastlight 0.1.8 → 0.2.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 +265 -118
- package/agent-context/rules.md +62 -9
- package/agent-context/security.md +69 -0
- package/config/default.yaml +89 -0
- package/deploy/.env.production.example +20 -2
- package/deploy/entrypoint.sh +16 -17
- package/deploy/native/README.md +160 -0
- package/deploy/native/install.sh +110 -0
- package/deploy/native/lastlight.env.example +95 -0
- package/deploy/native/lastlight.service +50 -0
- package/deploy/sandbox-entrypoint.sh +59 -42
- package/dist/admin/auth.d.ts +1 -1
- package/dist/admin/auth.js +3 -1
- package/dist/admin/auth.js.map +1 -1
- package/dist/admin/chat-session-reader.d.ts +11 -14
- package/dist/admin/chat-session-reader.js +27 -51
- package/dist/admin/chat-session-reader.js.map +1 -1
- package/dist/admin/docker.d.ts +37 -0
- package/dist/admin/docker.js +86 -1
- package/dist/admin/docker.js.map +1 -1
- package/dist/admin/index.js +38 -3
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/log-search.test.d.ts +1 -0
- package/dist/admin/log-search.test.js +78 -0
- package/dist/admin/log-search.test.js.map +1 -0
- package/dist/admin/routes.d.ts +52 -3
- package/dist/admin/routes.js +780 -63
- package/dist/admin/routes.js.map +1 -1
- package/dist/admin/routes.test.js +680 -14
- package/dist/admin/routes.test.js.map +1 -1
- package/dist/admin/server-logs.test.d.ts +1 -0
- package/dist/admin/server-logs.test.js +58 -0
- package/dist/admin/server-logs.test.js.map +1 -0
- package/dist/admin/sessions.d.ts +26 -39
- package/dist/admin/sessions.js +86 -310
- package/dist/admin/sessions.js.map +1 -1
- package/dist/admin/sessions.test.d.ts +1 -0
- package/dist/admin/sessions.test.js +78 -0
- package/dist/admin/sessions.test.js.map +1 -0
- package/dist/admin/version.d.ts +15 -0
- package/dist/admin/version.js +73 -0
- package/dist/admin/version.js.map +1 -0
- package/dist/admin/version.test.d.ts +1 -0
- package/dist/admin/version.test.js +71 -0
- package/dist/admin/version.test.js.map +1 -0
- package/dist/cli-config.d.ts +55 -0
- package/dist/cli-config.js +119 -0
- package/dist/cli-config.js.map +1 -0
- package/dist/cli-config.test.d.ts +1 -0
- package/dist/cli-config.test.js +92 -0
- package/dist/cli-config.test.js.map +1 -0
- package/dist/cli-format.d.ts +19 -0
- package/dist/cli-format.js +107 -0
- package/dist/cli-format.js.map +1 -0
- package/dist/cli-server.d.ts +73 -0
- package/dist/cli-server.js +347 -0
- package/dist/cli-server.js.map +1 -0
- package/dist/cli-server.test.d.ts +1 -0
- package/dist/cli-server.test.js +38 -0
- package/dist/cli-server.test.js.map +1 -0
- package/dist/cli-timeline.d.ts +35 -0
- package/dist/cli-timeline.js +373 -0
- package/dist/cli-timeline.js.map +1 -0
- package/dist/cli-timeline.test.d.ts +1 -0
- package/dist/cli-timeline.test.js +104 -0
- package/dist/cli-timeline.test.js.map +1 -0
- package/dist/cli.d.ts +0 -19
- package/dist/cli.js +910 -194
- package/dist/cli.js.map +1 -1
- package/dist/config-overlay.test.d.ts +1 -0
- package/dist/config-overlay.test.js +112 -0
- package/dist/config-overlay.test.js.map +1 -0
- package/dist/config-resolve.d.ts +28 -0
- package/dist/config-resolve.js +47 -0
- package/dist/config-resolve.js.map +1 -0
- package/dist/config-resolve.test.d.ts +1 -0
- package/dist/config-resolve.test.js +68 -0
- package/dist/config-resolve.test.js.map +1 -0
- package/dist/config.d.ts +62 -49
- package/dist/config.js +452 -76
- package/dist/config.js.map +1 -1
- package/dist/config.test.js +201 -32
- package/dist/config.test.js.map +1 -1
- package/dist/connectors/github-webhook.js +83 -5
- package/dist/connectors/github-webhook.js.map +1 -1
- package/dist/connectors/github-webhook.test.d.ts +1 -0
- package/dist/connectors/github-webhook.test.js +156 -0
- package/dist/connectors/github-webhook.test.js.map +1 -0
- package/dist/connectors/messaging/session-manager.d.ts +18 -0
- package/dist/connectors/messaging/session-manager.js +83 -2
- package/dist/connectors/messaging/session-manager.js.map +1 -1
- package/dist/connectors/messaging/session-manager.test.d.ts +1 -0
- package/dist/connectors/messaging/session-manager.test.js +144 -0
- package/dist/connectors/messaging/session-manager.test.js.map +1 -0
- package/dist/connectors/slack/connector.d.ts +9 -0
- package/dist/connectors/slack/connector.js +15 -0
- package/dist/connectors/slack/connector.js.map +1 -1
- package/dist/connectors/slack/mrkdwn.js +81 -0
- package/dist/connectors/slack/mrkdwn.js.map +1 -1
- package/dist/connectors/slack/mrkdwn.test.js +49 -0
- package/dist/connectors/slack/mrkdwn.test.js.map +1 -1
- package/dist/connectors/types.d.ts +1 -1
- package/dist/cron/fanout.d.ts +33 -0
- package/dist/cron/fanout.js +55 -0
- package/dist/cron/fanout.js.map +1 -0
- package/dist/cron/fanout.test.d.ts +1 -0
- package/dist/cron/fanout.test.js +73 -0
- package/dist/cron/fanout.test.js.map +1 -0
- package/dist/cron/jobs.d.ts +5 -0
- package/dist/cron/jobs.js +10 -3
- package/dist/cron/jobs.js.map +1 -1
- package/dist/cron/scheduler.d.ts +12 -0
- package/dist/cron/scheduler.js +27 -1
- package/dist/cron/scheduler.js.map +1 -1
- package/dist/engine/agent-executor.d.ts +158 -0
- package/dist/engine/agent-executor.js +1140 -0
- package/dist/engine/agent-executor.js.map +1 -0
- package/dist/engine/agent-executor.test.d.ts +1 -0
- package/dist/engine/agent-executor.test.js +395 -0
- package/dist/engine/agent-executor.test.js.map +1 -0
- package/dist/engine/chat-runner.d.ts +123 -0
- package/dist/engine/chat-runner.js +379 -0
- package/dist/engine/chat-runner.js.map +1 -0
- package/dist/engine/chat-runner.test.d.ts +1 -0
- package/dist/engine/chat-runner.test.js +104 -0
- package/dist/engine/chat-runner.test.js.map +1 -0
- package/dist/engine/chat-skills.d.ts +45 -0
- package/dist/engine/chat-skills.js +184 -0
- package/dist/engine/chat-skills.js.map +1 -0
- package/dist/engine/chat-skills.test.d.ts +1 -0
- package/dist/engine/chat-skills.test.js +20 -0
- package/dist/engine/chat-skills.test.js.map +1 -0
- package/dist/engine/chat.d.ts +20 -23
- package/dist/engine/chat.js +251 -155
- package/dist/engine/chat.js.map +1 -1
- package/dist/engine/chat.test.d.ts +1 -0
- package/dist/engine/chat.test.js +42 -0
- package/dist/engine/chat.test.js.map +1 -0
- package/dist/engine/classifier.d.ts +35 -2
- package/dist/engine/classifier.js +170 -31
- package/dist/engine/classifier.js.map +1 -1
- package/dist/engine/classifier.test.d.ts +1 -0
- package/dist/engine/classifier.test.js +115 -0
- package/dist/engine/classifier.test.js.map +1 -0
- package/dist/engine/dispatcher.d.ts +60 -0
- package/dist/engine/dispatcher.js +601 -0
- package/dist/engine/dispatcher.js.map +1 -0
- package/dist/engine/dispatcher.test.d.ts +1 -0
- package/dist/engine/dispatcher.test.js +511 -0
- package/dist/engine/dispatcher.test.js.map +1 -0
- package/dist/engine/event-shim.d.ts +117 -0
- package/dist/engine/event-shim.js +435 -0
- package/dist/engine/event-shim.js.map +1 -0
- package/dist/engine/event-shim.test.d.ts +1 -0
- package/dist/engine/event-shim.test.js +194 -0
- package/dist/engine/event-shim.test.js.map +1 -0
- package/dist/engine/git-auth.d.ts +13 -17
- package/dist/engine/git-auth.js +99 -42
- package/dist/engine/git-auth.js.map +1 -1
- package/dist/engine/git-auth.test.d.ts +1 -0
- package/dist/engine/git-auth.test.js +117 -0
- package/dist/engine/git-auth.test.js.map +1 -0
- package/dist/engine/github-app-client.d.ts +7 -0
- package/dist/engine/github-app-client.js +16 -0
- package/dist/engine/github-app-client.js.map +1 -0
- package/dist/engine/github-app-client.test.d.ts +1 -0
- package/dist/engine/github-app-client.test.js +44 -0
- package/dist/engine/github-app-client.test.js.map +1 -0
- package/dist/engine/github-tools.d.ts +12 -0
- package/dist/engine/github-tools.js +261 -0
- package/dist/engine/github-tools.js.map +1 -0
- package/dist/engine/github.d.ts +1027 -43
- package/dist/engine/github.js +153 -14
- package/dist/engine/github.js.map +1 -1
- package/dist/engine/llm.d.ts +47 -0
- package/dist/engine/llm.js +221 -0
- package/dist/engine/llm.js.map +1 -0
- package/dist/engine/llm.test.d.ts +1 -0
- package/dist/engine/llm.test.js +189 -0
- package/dist/engine/llm.test.js.map +1 -0
- package/dist/engine/profiles.d.ts +249 -0
- package/dist/engine/profiles.js +42 -0
- package/dist/engine/profiles.js.map +1 -0
- package/dist/engine/router.d.ts +12 -6
- package/dist/engine/router.js +339 -81
- package/dist/engine/router.js.map +1 -1
- package/dist/engine/router.test.js +428 -78
- package/dist/engine/router.test.js.map +1 -1
- package/dist/engine/screen.d.ts +41 -0
- package/dist/engine/screen.js +93 -0
- package/dist/engine/screen.js.map +1 -0
- package/dist/engine/screen.test.d.ts +1 -0
- package/dist/engine/screen.test.js +82 -0
- package/dist/engine/screen.test.js.map +1 -0
- package/dist/index.js +423 -437
- package/dist/index.js.map +1 -1
- package/dist/managed-repos.d.ts +7 -9
- package/dist/managed-repos.js +12 -15
- package/dist/managed-repos.js.map +1 -1
- package/dist/managed-repos.test.js +24 -19
- package/dist/managed-repos.test.js.map +1 -1
- package/dist/notify/index.d.ts +15 -0
- package/dist/notify/index.js +6 -0
- package/dist/notify/index.js.map +1 -0
- package/dist/notify/model.d.ts +57 -0
- package/dist/notify/model.js +89 -0
- package/dist/notify/model.js.map +1 -0
- package/dist/notify/model.test.d.ts +1 -0
- package/dist/notify/model.test.js +109 -0
- package/dist/notify/model.test.js.map +1 -0
- package/dist/notify/notifier.d.ts +17 -0
- package/dist/notify/notifier.js +87 -0
- package/dist/notify/notifier.js.map +1 -0
- package/dist/notify/notifier.test.d.ts +1 -0
- package/dist/notify/notifier.test.js +100 -0
- package/dist/notify/notifier.test.js.map +1 -0
- package/dist/notify/render.d.ts +21 -0
- package/dist/notify/render.js +59 -0
- package/dist/notify/render.js.map +1 -0
- package/dist/notify/render.test.d.ts +1 -0
- package/dist/notify/render.test.js +65 -0
- package/dist/notify/render.test.js.map +1 -0
- package/dist/notify/transports/github.d.ts +26 -0
- package/dist/notify/transports/github.js +26 -0
- package/dist/notify/transports/github.js.map +1 -0
- package/dist/notify/transports/slack.d.ts +26 -0
- package/dist/notify/transports/slack.js +28 -0
- package/dist/notify/transports/slack.js.map +1 -0
- package/dist/notify/transports.test.d.ts +1 -0
- package/dist/notify/transports.test.js +71 -0
- package/dist/notify/transports.test.js.map +1 -0
- package/dist/notify/types.d.ts +95 -0
- package/dist/notify/types.js +16 -0
- package/dist/notify/types.js.map +1 -0
- package/dist/sandbox/docker-compose.test.d.ts +1 -0
- package/dist/sandbox/docker-compose.test.js +128 -0
- package/dist/sandbox/docker-compose.test.js.map +1 -0
- package/dist/sandbox/docker.d.ts +97 -9
- package/dist/sandbox/docker.js +192 -41
- package/dist/sandbox/docker.js.map +1 -1
- package/dist/sandbox/docker.test.d.ts +1 -0
- package/dist/sandbox/docker.test.js +137 -0
- package/dist/sandbox/docker.test.js.map +1 -0
- package/dist/sandbox/egress-allowlist.d.ts +69 -0
- package/dist/sandbox/egress-allowlist.js +164 -0
- package/dist/sandbox/egress-allowlist.js.map +1 -0
- package/dist/sandbox/egress-allowlist.test.d.ts +1 -0
- package/dist/sandbox/egress-allowlist.test.js +65 -0
- package/dist/sandbox/egress-allowlist.test.js.map +1 -0
- package/dist/sandbox/egress-firewall-config.d.ts +127 -0
- package/dist/sandbox/egress-firewall-config.js +434 -0
- package/dist/sandbox/egress-firewall-config.js.map +1 -0
- package/dist/sandbox/egress-firewall-config.test.d.ts +1 -0
- package/dist/sandbox/egress-firewall-config.test.js +244 -0
- package/dist/sandbox/egress-firewall-config.test.js.map +1 -0
- package/dist/sandbox/images.d.ts +23 -0
- package/dist/sandbox/images.js +55 -0
- package/dist/sandbox/images.js.map +1 -0
- package/dist/sandbox/index.d.ts +82 -3
- package/dist/sandbox/index.js +223 -93
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/index.test.d.ts +1 -0
- package/dist/sandbox/index.test.js +157 -0
- package/dist/sandbox/index.test.js.map +1 -0
- package/dist/session-log.d.ts +63 -0
- package/dist/session-log.js +290 -0
- package/dist/session-log.js.map +1 -0
- package/dist/session-log.test.d.ts +1 -0
- package/dist/session-log.test.js +85 -0
- package/dist/session-log.test.js.map +1 -0
- package/dist/setup.d.ts +31 -12
- package/dist/setup.js +516 -174
- package/dist/setup.js.map +1 -1
- package/dist/setup.test.js +138 -6
- package/dist/setup.test.js.map +1 -1
- package/dist/state/approval-store.d.ts +86 -0
- package/dist/state/approval-store.js +140 -0
- package/dist/state/approval-store.js.map +1 -0
- package/dist/state/build-assets.d.ts +50 -0
- package/dist/state/build-assets.js +154 -0
- package/dist/state/build-assets.js.map +1 -0
- package/dist/state/build-assets.test.d.ts +1 -0
- package/dist/state/build-assets.test.js +106 -0
- package/dist/state/build-assets.test.js.map +1 -0
- package/dist/state/db.d.ts +65 -333
- package/dist/state/db.js +112 -835
- package/dist/state/db.js.map +1 -1
- package/dist/state/db.test.js +127 -91
- package/dist/state/db.test.js.map +1 -1
- package/dist/state/execution-store.d.ts +257 -0
- package/dist/state/execution-store.js +527 -0
- package/dist/state/execution-store.js.map +1 -0
- package/dist/state/migrate.d.ts +15 -0
- package/dist/state/migrate.js +175 -0
- package/dist/state/migrate.js.map +1 -0
- package/dist/state/workflow-run-store.d.ts +195 -0
- package/dist/state/workflow-run-store.js +363 -0
- package/dist/state/workflow-run-store.js.map +1 -0
- package/dist/state/workflow-run-store.test.d.ts +1 -0
- package/dist/state/workflow-run-store.test.js +264 -0
- package/dist/state/workflow-run-store.test.js.map +1 -0
- package/dist/telemetry/index.d.ts +38 -0
- package/dist/telemetry/index.js +253 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/index.test.d.ts +1 -0
- package/dist/telemetry/index.test.js +73 -0
- package/dist/telemetry/index.test.js.map +1 -0
- package/dist/telemetry/pi-events.d.ts +12 -0
- package/dist/telemetry/pi-events.js +134 -0
- package/dist/telemetry/pi-events.js.map +1 -0
- package/dist/telemetry/pi-events.test.d.ts +1 -0
- package/dist/telemetry/pi-events.test.js +69 -0
- package/dist/telemetry/pi-events.test.js.map +1 -0
- package/dist/workflows/dag.d.ts +13 -1
- package/dist/workflows/dag.js +7 -3
- package/dist/workflows/dag.js.map +1 -1
- package/dist/workflows/dag.test.js +22 -0
- package/dist/workflows/dag.test.js.map +1 -1
- package/dist/workflows/golden-build.test.d.ts +1 -0
- package/dist/workflows/golden-build.test.js +45 -0
- package/dist/workflows/golden-build.test.js.map +1 -0
- package/dist/workflows/loader-overlay.test.d.ts +1 -0
- package/dist/workflows/loader-overlay.test.js +101 -0
- package/dist/workflows/loader-overlay.test.js.map +1 -0
- package/dist/workflows/loader.d.ts +36 -11
- package/dist/workflows/loader.js +311 -87
- package/dist/workflows/loader.js.map +1 -1
- package/dist/workflows/loader.test.js +114 -10
- package/dist/workflows/loader.test.js.map +1 -1
- package/dist/workflows/loop-eval.js +2 -0
- package/dist/workflows/loop-eval.js.map +1 -1
- package/dist/workflows/loop-eval.test.js +14 -0
- package/dist/workflows/loop-eval.test.js.map +1 -1
- package/dist/workflows/phase-executor.d.ts +145 -0
- package/dist/workflows/phase-executor.js +691 -0
- package/dist/workflows/phase-executor.js.map +1 -0
- package/dist/workflows/phase-executor.test.d.ts +1 -0
- package/dist/workflows/phase-executor.test.js +434 -0
- package/dist/workflows/phase-executor.test.js.map +1 -0
- package/dist/workflows/phase-ref.d.ts +44 -0
- package/dist/workflows/phase-ref.js +78 -0
- package/dist/workflows/phase-ref.js.map +1 -0
- package/dist/workflows/phase-ref.test.d.ts +1 -0
- package/dist/workflows/phase-ref.test.js +24 -0
- package/dist/workflows/phase-ref.test.js.map +1 -0
- package/dist/workflows/resume.d.ts +5 -11
- package/dist/workflows/resume.js +88 -7
- package/dist/workflows/resume.js.map +1 -1
- package/dist/workflows/runner.d.ts +34 -27
- package/dist/workflows/runner.js +252 -930
- package/dist/workflows/runner.js.map +1 -1
- package/dist/workflows/runner.test.js +346 -35
- package/dist/workflows/runner.test.js.map +1 -1
- package/dist/workflows/schema.d.ts +52 -10
- package/dist/workflows/schema.js +147 -7
- package/dist/workflows/schema.js.map +1 -1
- package/dist/workflows/simple.d.ts +67 -3
- package/dist/workflows/simple.js +248 -87
- package/dist/workflows/simple.js.map +1 -1
- package/dist/workflows/simple.test.d.ts +1 -0
- package/dist/workflows/simple.test.js +107 -0
- package/dist/workflows/simple.test.js.map +1 -0
- package/dist/workflows/templates.d.ts +29 -0
- package/dist/workflows/templates.js +42 -4
- package/dist/workflows/templates.js.map +1 -1
- package/dist/workflows/templates.test.js +103 -0
- package/dist/workflows/templates.test.js.map +1 -1
- package/dist/workflows/triggers.d.ts +21 -0
- package/dist/workflows/triggers.js +44 -0
- package/dist/workflows/triggers.js.map +1 -0
- package/dist/workflows/verdict.d.ts +19 -0
- package/dist/workflows/verdict.js +30 -0
- package/dist/workflows/verdict.js.map +1 -0
- package/dist/workflows/verdict.test.d.ts +1 -0
- package/dist/workflows/verdict.test.js +44 -0
- package/dist/workflows/verdict.test.js.map +1 -0
- package/dist/worktree/manager.d.ts +1 -1
- package/dist/worktree/manager.js +14 -14
- package/dist/worktree/manager.js.map +1 -1
- package/dist/worktree/manager.test.d.ts +1 -0
- package/dist/worktree/manager.test.js +87 -0
- package/dist/worktree/manager.test.js.map +1 -0
- package/docker-compose.yml +206 -5
- package/package.json +19 -7
- package/sandbox.Dockerfile +97 -18
- package/skills/README.md +40 -0
- package/skills/browser-qa/SKILL.md +193 -0
- package/skills/browser-qa/scripts/agent-browser.mjs +380 -0
- package/skills/building/SKILL.md +95 -0
- package/skills/chat/SKILL.md +30 -11
- package/skills/code-review/SKILL.md +59 -0
- package/skills/debug-production/SKILL.md +108 -0
- package/skills/demo/SKILL.md +194 -0
- package/skills/demo/scripts/compose-demo.sh +205 -0
- package/skills/issue-answer/SKILL.md +90 -0
- package/skills/issue-comment/SKILL.md +38 -24
- package/skills/issue-triage/SKILL.md +103 -37
- package/skills/issue-triage/references/AGENT-BRIEF.md +61 -0
- package/skills/pr-comment/SKILL.md +64 -0
- package/skills/pr-review/SKILL.md +65 -49
- package/skills/qa-test/SKILL.md +97 -0
- package/skills/repo-health/SKILL.md +48 -45
- package/skills/security-feedback/SKILL.md +173 -0
- package/skills/security-feedback/references/templates.md +77 -0
- package/skills/security-review/SKILL.md +213 -0
- package/skills/security-review/references/issue-format.md +302 -0
- package/skills/verify/SKILL.md +118 -0
- package/workflows/answer.yaml +37 -0
- package/workflows/build.yaml +32 -22
- package/workflows/cron-security.yaml +6 -0
- package/workflows/demo.yaml +55 -0
- package/workflows/explore.yaml +9 -0
- package/workflows/pr-comment.yaml +16 -0
- package/workflows/pr-fix.yaml +3 -0
- package/workflows/pr-review.yaml +4 -1
- package/workflows/prompts/answer.md +67 -0
- package/workflows/prompts/architect.md +24 -7
- package/workflows/prompts/demo.md +100 -0
- package/workflows/prompts/executor.md +29 -20
- package/workflows/prompts/explore-ask.md +51 -22
- package/workflows/prompts/explore-publish.md +2 -2
- package/workflows/prompts/explore-read.md +24 -10
- package/workflows/prompts/explore-synthesize.md +15 -8
- package/workflows/prompts/fix.md +9 -10
- package/workflows/prompts/guardrails.md +26 -8
- package/workflows/prompts/pr-fix.md +6 -7
- package/workflows/prompts/pr.md +11 -10
- package/workflows/prompts/qa-browser.md +95 -0
- package/workflows/prompts/qa-synth.md +44 -0
- package/workflows/prompts/qa-test.md +60 -0
- package/workflows/prompts/re-reviewer.md +8 -9
- package/workflows/prompts/reviewer.md +10 -9
- package/workflows/prompts/verify-browser.md +93 -0
- package/workflows/prompts/verify-synth.md +44 -0
- package/workflows/prompts/verify.md +63 -0
- package/workflows/qa-test.yaml +87 -0
- package/workflows/security-feedback.yaml +25 -0
- package/workflows/security-review.yaml +29 -0
- package/workflows/verify.yaml +85 -0
- package/deploy/mcp-config.tmpl.json +0 -14
- package/dist/cron/rate-limits.d.ts +0 -26
- package/dist/cron/rate-limits.js +0 -193
- package/dist/cron/rate-limits.js.map +0 -1
- package/dist/engine/executor.d.ts +0 -75
- package/dist/engine/executor.js +0 -292
- package/dist/engine/executor.js.map +0 -1
- package/mcp-github-app/package.json +0 -18
- package/mcp-github-app/src/auth.js +0 -66
- package/mcp-github-app/src/github.js +0 -371
- package/mcp-github-app/src/index.js +0 -534
- package/skills/devops/webhook-subscriptions/SKILL.md +0 -180
- package/skills/github/DESCRIPTION.md +0 -3
- package/skills/github/codebase-inspection/SKILL.md +0 -115
- package/skills/github/github-auth/SKILL.md +0 -54
- package/skills/github/github-auth/scripts/gh-env.sh +0 -66
- package/skills/github/github-code-review/SKILL.md +0 -480
- package/skills/github/github-code-review/references/review-output-template.md +0 -74
- package/skills/github/github-issues/SKILL.md +0 -369
- package/skills/github/github-issues/templates/bug-report.md +0 -35
- package/skills/github/github-issues/templates/feature-request.md +0 -31
- package/skills/github/github-pr-workflow/SKILL.md +0 -395
- package/skills/github/github-pr-workflow/references/ci-troubleshooting.md +0 -183
- package/skills/github/github-pr-workflow/references/conventional-commits.md +0 -71
- package/skills/github/github-pr-workflow/templates/pr-body-bugfix.md +0 -35
- package/skills/github/github-pr-workflow/templates/pr-body-feature.md +0 -33
- package/skills/github/github-repo-management/SKILL.md +0 -515
- package/skills/github/github-repo-management/references/github-api-cheatsheet.md +0 -161
- package/skills/github-orchestrator/SKILL.md +0 -103
- package/skills/mcp/DESCRIPTION.md +0 -3
- package/skills/mcp/mcporter/SKILL.md +0 -122
- package/skills/mcp/native-mcp/SKILL.md +0 -356
- package/skills/software-development/architect/SKILL.md +0 -154
- package/skills/software-development/assure-guardrails/SKILL.md +0 -239
- package/skills/software-development/plan/SKILL.md +0 -64
- package/skills/software-development/requesting-code-review/SKILL.md +0 -291
- package/skills/software-development/subagent-driven-development/SKILL.md +0 -433
- package/skills/software-development/systematic-debugging/SKILL.md +0 -366
- package/skills/software-development/test-driven-development/SKILL.md +0 -342
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apply the full SQLite schema for the harness state DB.
|
|
3
|
+
*
|
|
4
|
+
* Centralized here (rather than on a store) because the three stores
|
|
5
|
+
* (`WorkflowRunStore` / `ApprovalStore` / `ExecutionStore`) all share a
|
|
6
|
+
* single `Database` connection and assume the schema already exists. `StateDb`
|
|
7
|
+
* is the construction root and calls this once at boot; tests that exercise a
|
|
8
|
+
* store directly construct a raw `Database`, call `migrate()`, then build the
|
|
9
|
+
* store on top.
|
|
10
|
+
*
|
|
11
|
+
* Every statement is idempotent (`IF NOT EXISTS` / additive `ALTER` guarded by
|
|
12
|
+
* try/catch) so it is safe to run on an existing DB.
|
|
13
|
+
*/
|
|
14
|
+
export function migrate(db) {
|
|
15
|
+
db.exec(`
|
|
16
|
+
CREATE TABLE IF NOT EXISTS executions (
|
|
17
|
+
id TEXT PRIMARY KEY,
|
|
18
|
+
trigger_type TEXT NOT NULL,
|
|
19
|
+
trigger_id TEXT NOT NULL,
|
|
20
|
+
skill TEXT NOT NULL,
|
|
21
|
+
repo TEXT,
|
|
22
|
+
issue_number INTEGER,
|
|
23
|
+
started_at TEXT NOT NULL,
|
|
24
|
+
finished_at TEXT,
|
|
25
|
+
success INTEGER,
|
|
26
|
+
error TEXT,
|
|
27
|
+
turns INTEGER,
|
|
28
|
+
duration_ms INTEGER
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
CREATE INDEX IF NOT EXISTS idx_executions_trigger ON executions(trigger_type, trigger_id);
|
|
32
|
+
CREATE INDEX IF NOT EXISTS idx_executions_skill ON executions(skill, started_at);
|
|
33
|
+
|
|
34
|
+
CREATE TABLE IF NOT EXISTS workflow_runs (
|
|
35
|
+
id TEXT PRIMARY KEY,
|
|
36
|
+
workflow_name TEXT NOT NULL,
|
|
37
|
+
trigger_id TEXT NOT NULL,
|
|
38
|
+
repo TEXT,
|
|
39
|
+
issue_number INTEGER,
|
|
40
|
+
current_phase TEXT NOT NULL,
|
|
41
|
+
phase_history TEXT NOT NULL DEFAULT '[]',
|
|
42
|
+
status TEXT NOT NULL DEFAULT 'running',
|
|
43
|
+
context TEXT,
|
|
44
|
+
started_at TEXT NOT NULL,
|
|
45
|
+
updated_at TEXT NOT NULL,
|
|
46
|
+
finished_at TEXT
|
|
47
|
+
);
|
|
48
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_trigger ON workflow_runs(trigger_id, status);
|
|
49
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_status ON workflow_runs(status);
|
|
50
|
+
-- Dashboard's workflow-runs list query is ORDER BY started_at DESC
|
|
51
|
+
-- LIMIT 20, often with optional workflow_name / status filters and a
|
|
52
|
+
-- companion COUNT(*). It polls every 5s, so it's worth a covering
|
|
53
|
+
-- index — without one this is a full-table sort.
|
|
54
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_started_at ON workflow_runs(started_at DESC);
|
|
55
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_name_started ON workflow_runs(workflow_name, started_at DESC);
|
|
56
|
+
|
|
57
|
+
CREATE TABLE IF NOT EXISTS cron_overrides (
|
|
58
|
+
name TEXT PRIMARY KEY,
|
|
59
|
+
enabled INTEGER NOT NULL DEFAULT 1,
|
|
60
|
+
schedule TEXT,
|
|
61
|
+
updated_at TEXT NOT NULL,
|
|
62
|
+
updated_by TEXT
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
CREATE TABLE IF NOT EXISTS workflow_overrides (
|
|
66
|
+
name TEXT PRIMARY KEY,
|
|
67
|
+
enabled INTEGER NOT NULL DEFAULT 1,
|
|
68
|
+
updated_at TEXT NOT NULL,
|
|
69
|
+
updated_by TEXT
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
CREATE TABLE IF NOT EXISTS workflow_approvals (
|
|
73
|
+
id TEXT PRIMARY KEY,
|
|
74
|
+
workflow_run_id TEXT NOT NULL,
|
|
75
|
+
gate TEXT NOT NULL,
|
|
76
|
+
summary TEXT NOT NULL,
|
|
77
|
+
status TEXT NOT NULL DEFAULT 'pending',
|
|
78
|
+
requested_by TEXT,
|
|
79
|
+
responded_by TEXT,
|
|
80
|
+
response TEXT,
|
|
81
|
+
responded_at TEXT,
|
|
82
|
+
created_at TEXT NOT NULL
|
|
83
|
+
);
|
|
84
|
+
CREATE INDEX IF NOT EXISTS idx_approvals_workflow ON workflow_approvals(workflow_run_id);
|
|
85
|
+
CREATE INDEX IF NOT EXISTS idx_approvals_status ON workflow_approvals(status);
|
|
86
|
+
`);
|
|
87
|
+
// Mutable phase-to-phase state for features like the socratic explore
|
|
88
|
+
// loop that accumulate data across reply-gate pauses.
|
|
89
|
+
try {
|
|
90
|
+
db.exec(`ALTER TABLE workflow_runs ADD COLUMN scratch TEXT`);
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// Column already exists — ignore
|
|
94
|
+
}
|
|
95
|
+
// Restart attempt counter — bumped each time resumeOrphanedWorkflows
|
|
96
|
+
// re-dispatches a still-'running' row at boot. Acts as a circuit
|
|
97
|
+
// breaker so an OOM-on-restart loop can't churn forever.
|
|
98
|
+
try {
|
|
99
|
+
db.exec(`ALTER TABLE workflow_runs ADD COLUMN restart_count INTEGER NOT NULL DEFAULT 0`);
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
// Column already exists — ignore
|
|
103
|
+
}
|
|
104
|
+
// Gate flavor: 'approve' (explicit approve/reject) vs 'reply' (resolves
|
|
105
|
+
// on any free-form reply in the same thread — used by the socratic
|
|
106
|
+
// explore loop).
|
|
107
|
+
try {
|
|
108
|
+
db.exec(`ALTER TABLE workflow_approvals ADD COLUMN kind TEXT NOT NULL DEFAULT 'approve'`);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
// Column already exists — ignore
|
|
112
|
+
}
|
|
113
|
+
// Artifact (handoff doc) filename a gate is asking the reviewer to approve,
|
|
114
|
+
// e.g. 'architect-plan.md'. Lets the focused approval view open the right
|
|
115
|
+
// doc. Nullable — most gates carry no artifact. Additive, safe on existing DBs.
|
|
116
|
+
try {
|
|
117
|
+
db.exec(`ALTER TABLE workflow_approvals ADD COLUMN artifact TEXT`);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// Column already exists — ignore
|
|
121
|
+
}
|
|
122
|
+
// Add session_id column to executions so the dashboard can resolve a
|
|
123
|
+
// phase click to its agent session log. Additive — safe on existing DBs.
|
|
124
|
+
try {
|
|
125
|
+
db.exec(`ALTER TABLE executions ADD COLUMN session_id TEXT`);
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
// Column already exists — ignore
|
|
129
|
+
}
|
|
130
|
+
// Per-execution runtime usage metrics, captured from the OpenCode
|
|
131
|
+
// step_finish events. Lets the dashboard show cost / tokens per phase
|
|
132
|
+
// and lets us aggregate spend later. All additive, safe on existing DBs.
|
|
133
|
+
for (const col of [
|
|
134
|
+
"cost_usd REAL",
|
|
135
|
+
"input_tokens INTEGER",
|
|
136
|
+
"cache_creation_input_tokens INTEGER",
|
|
137
|
+
"cache_read_input_tokens INTEGER",
|
|
138
|
+
"output_tokens INTEGER",
|
|
139
|
+
"api_duration_ms INTEGER",
|
|
140
|
+
"stop_reason TEXT",
|
|
141
|
+
// Links a phase execution to its owning workflow_run. Dedup and
|
|
142
|
+
// "already running / done" checks scope to this column so a fresh
|
|
143
|
+
// re-trigger of the same workflow on the same issue creates new
|
|
144
|
+
// executions instead of reusing the old run's rows.
|
|
145
|
+
"workflow_run_id TEXT",
|
|
146
|
+
// Final assistant text for a phase execution. Populated only for
|
|
147
|
+
// loop iterations whose output is referenced by `scratch.<key>
|
|
148
|
+
// .lastOutputExecutionId` — keeps the inlined LLM output out of
|
|
149
|
+
// `workflow_runs.scratch` (which is read on every list query)
|
|
150
|
+
// while still being available to the runner's resume path.
|
|
151
|
+
"output_text TEXT",
|
|
152
|
+
// JSON map of agentic-pi extensions active for this execution
|
|
153
|
+
// (file-search / github / web-search → {status, mode?, provider?,
|
|
154
|
+
// toolCount?, reason?}). Surfaced in the dashboard phase-detail panel.
|
|
155
|
+
"extension_status TEXT",
|
|
156
|
+
// JSON object of agentic-pi's skill-loading status for this execution
|
|
157
|
+
// ({status, discovered, skills[], mappedPaths, noSkills}). The skill-
|
|
158
|
+
// loading counterpart to extension_status; surfaced in the same panel.
|
|
159
|
+
"skills_status TEXT",
|
|
160
|
+
]) {
|
|
161
|
+
try {
|
|
162
|
+
db.exec(`ALTER TABLE executions ADD COLUMN ${col}`);
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
// Column already exists — ignore
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
try {
|
|
169
|
+
db.exec(`CREATE INDEX IF NOT EXISTS idx_executions_workflow_run ON executions(workflow_run_id, skill)`);
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
// Index already exists — ignore
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=migrate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../src/state/migrate.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,OAAO,CAAC,EAAqB;IAC3C,EAAE,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEP,CAAC,CAAC;IAEH,sEAAsE;IACtE,sDAAsD;IACtD,IAAI,CAAC;QACH,EAAE,CAAC,IAAI,CAAC,mDAAmD,CAAC,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,iCAAiC;IACnC,CAAC;IAED,qEAAqE;IACrE,iEAAiE;IACjE,yDAAyD;IACzD,IAAI,CAAC;QACH,EAAE,CAAC,IAAI,CAAC,+EAA+E,CAAC,CAAC;IAC3F,CAAC;IAAC,MAAM,CAAC;QACP,iCAAiC;IACnC,CAAC;IAED,wEAAwE;IACxE,mEAAmE;IACnE,iBAAiB;IACjB,IAAI,CAAC;QACH,EAAE,CAAC,IAAI,CAAC,gFAAgF,CAAC,CAAC;IAC5F,CAAC;IAAC,MAAM,CAAC;QACP,iCAAiC;IACnC,CAAC;IAED,4EAA4E;IAC5E,0EAA0E;IAC1E,gFAAgF;IAChF,IAAI,CAAC;QACH,EAAE,CAAC,IAAI,CAAC,yDAAyD,CAAC,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,iCAAiC;IACnC,CAAC;IAED,qEAAqE;IACrE,yEAAyE;IACzE,IAAI,CAAC;QACH,EAAE,CAAC,IAAI,CAAC,mDAAmD,CAAC,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACP,iCAAiC;IACnC,CAAC;IAED,kEAAkE;IAClE,sEAAsE;IACtE,yEAAyE;IACzE,KAAK,MAAM,GAAG,IAAI;QAChB,eAAe;QACf,sBAAsB;QACtB,qCAAqC;QACrC,iCAAiC;QACjC,uBAAuB;QACvB,yBAAyB;QACzB,kBAAkB;QAClB,gEAAgE;QAChE,kEAAkE;QAClE,gEAAgE;QAChE,oDAAoD;QACpD,sBAAsB;QACtB,iEAAiE;QACjE,+DAA+D;QAC/D,gEAAgE;QAChE,8DAA8D;QAC9D,2DAA2D;QAC3D,kBAAkB;QAClB,8DAA8D;QAC9D,kEAAkE;QAClE,uEAAuE;QACvE,uBAAuB;QACvB,sEAAsE;QACtE,sEAAsE;QACtE,uEAAuE;QACvE,oBAAoB;KACrB,EAAE,CAAC;QACF,IAAI,CAAC;YACH,EAAE,CAAC,IAAI,CAAC,qCAAqC,GAAG,EAAE,CAAC,CAAC;QACtD,CAAC;QAAC,MAAM,CAAC;YACP,iCAAiC;QACnC,CAAC;IACH,CAAC;IACD,IAAI,CAAC;QACH,EAAE,CAAC,IAAI,CACL,8FAA8F,CAC/F,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,gCAAgC;IAClC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import type Database from "better-sqlite3";
|
|
2
|
+
import type { ApprovalStore } from "./approval-store.js";
|
|
3
|
+
export interface PhaseHistoryEntry {
|
|
4
|
+
phase: string;
|
|
5
|
+
timestamp: string;
|
|
6
|
+
success: boolean;
|
|
7
|
+
summary?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface WorkflowRun {
|
|
10
|
+
id: string;
|
|
11
|
+
workflowName: string;
|
|
12
|
+
triggerId: string;
|
|
13
|
+
repo?: string;
|
|
14
|
+
issueNumber?: number;
|
|
15
|
+
currentPhase: string;
|
|
16
|
+
phaseHistory: PhaseHistoryEntry[];
|
|
17
|
+
status: "running" | "paused" | "succeeded" | "failed" | "cancelled";
|
|
18
|
+
context?: Record<string, unknown>;
|
|
19
|
+
/**
|
|
20
|
+
* Mutable phase-to-phase state, merged at the top level by
|
|
21
|
+
* `mergeScratch`. Distinct from `context` (which is the immutable trigger
|
|
22
|
+
* input) — used by features like the socratic explore loop to accumulate
|
|
23
|
+
* Q&A across reply-gate pauses.
|
|
24
|
+
*/
|
|
25
|
+
scratch?: Record<string, unknown>;
|
|
26
|
+
/**
|
|
27
|
+
* Number of times `resumeOrphanedWorkflows` has re-dispatched this run
|
|
28
|
+
* after a harness restart. Bounded by a small limit so a run that
|
|
29
|
+
* crashes the host (e.g. agent OOM) is marked failed instead of
|
|
30
|
+
* retried forever.
|
|
31
|
+
*/
|
|
32
|
+
restartCount?: number;
|
|
33
|
+
startedAt: string;
|
|
34
|
+
updatedAt: string;
|
|
35
|
+
finishedAt?: string;
|
|
36
|
+
}
|
|
37
|
+
/** A non-agent phase marker folded into an atomic lifecycle op. */
|
|
38
|
+
export interface PhaseMarker {
|
|
39
|
+
phase: string;
|
|
40
|
+
summary?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Aggregate root for a workflow run's lifecycle. Owns the `workflow_runs`
|
|
44
|
+
* table (including the `phase_history` JSON column) and the named, atomic
|
|
45
|
+
* transitions a run moves through: create → pause-for-approval →
|
|
46
|
+
* resume/finish, plus gate resolution and the socratic reply append.
|
|
47
|
+
*
|
|
48
|
+
* Carved out of the old `StateDb` god-class (issue #97). The deepening: every
|
|
49
|
+
* multi-step mutation that previously lived as an un-guarded read-modify-write
|
|
50
|
+
* chain in `index.ts` / `admin/routes.ts` / `phase-executor.ts` is now a
|
|
51
|
+
* single named operation wrapped in ONE `better-sqlite3` transaction — a throw
|
|
52
|
+
* partway through rolls the whole thing back, so a run can never be left
|
|
53
|
+
* marked `running` with its gate unresolved (the hazard the issue calls out).
|
|
54
|
+
*
|
|
55
|
+
* Constructed with an injected {@link ApprovalStore}: an approval has no life
|
|
56
|
+
* independent of its run, so the cross-table ops call the approval store's
|
|
57
|
+
* single-table writes from inside this store's transaction. Both stores MUST
|
|
58
|
+
* be built from the same `Database` — better-sqlite3 transactions are
|
|
59
|
+
* per-connection.
|
|
60
|
+
*
|
|
61
|
+
* The long-running re-dispatch (`dispatchWorkflow`, which spawns a Docker
|
|
62
|
+
* sandbox for minutes) is deliberately NOT part of any transaction here —
|
|
63
|
+
* better-sqlite3 transactions are synchronous. The atomic boundary is the DB
|
|
64
|
+
* mutations only; the caller dispatches after the transaction commits.
|
|
65
|
+
*/
|
|
66
|
+
export declare class WorkflowRunStore {
|
|
67
|
+
private db;
|
|
68
|
+
private approvals;
|
|
69
|
+
constructor(db: Database.Database, deps: {
|
|
70
|
+
approvals: ApprovalStore;
|
|
71
|
+
});
|
|
72
|
+
/** Create a new workflow run record */
|
|
73
|
+
createRun(run: Omit<WorkflowRun, "phaseHistory" | "updatedAt">): void;
|
|
74
|
+
/**
|
|
75
|
+
* Top-level merge of `patch` into the workflow run's scratch state.
|
|
76
|
+
* Loop iterations can append to `scratch.socratic.qa` without clobbering
|
|
77
|
+
* other keys.
|
|
78
|
+
*
|
|
79
|
+
* Throws if `patch` is not JSON-serializable (e.g. it contains a BigInt) —
|
|
80
|
+
* which is exactly how the atomic ops prove their rollback: a poison patch
|
|
81
|
+
* makes `JSON.stringify` throw mid-transaction.
|
|
82
|
+
*/
|
|
83
|
+
mergeScratch(id: string, patch: Record<string, unknown>): void;
|
|
84
|
+
/**
|
|
85
|
+
* Update the current phase and append to phase history. This is the single
|
|
86
|
+
* seam through which all phase-history writes flow (issue #97 defers the
|
|
87
|
+
* full `phase_history`/`executions` reconciliation to a follow-up, but
|
|
88
|
+
* routes every write through here so that future change touches one method
|
|
89
|
+
* instead of ~10 call sites).
|
|
90
|
+
*/
|
|
91
|
+
appendPhase(id: string, phase: string, entry: PhaseHistoryEntry): void;
|
|
92
|
+
/** Get a single workflow run by ID */
|
|
93
|
+
getRun(id: string): WorkflowRun | null;
|
|
94
|
+
/** Find the most recent active (running or paused) workflow run for a trigger */
|
|
95
|
+
getByTrigger(triggerId: string): WorkflowRun | null;
|
|
96
|
+
/** List all active (running or paused) workflow runs */
|
|
97
|
+
listActive(): WorkflowRun[];
|
|
98
|
+
/** List recent workflow runs, ordered by start time descending */
|
|
99
|
+
listRecent(limit?: number): WorkflowRun[];
|
|
100
|
+
/**
|
|
101
|
+
* List workflow runs with pagination + filters. Returns the page slice
|
|
102
|
+
* AND the post-filter total so the dashboard knows how many remain.
|
|
103
|
+
*
|
|
104
|
+
* - sinceIso filters `started_at >= sinceIso` (used for the header date range).
|
|
105
|
+
* - workflowName filters by exact `workflow_name`.
|
|
106
|
+
* - statuses filters to one of the workflow statuses (`running`, `paused`,
|
|
107
|
+
* `succeeded`, `failed`, `cancelled`). Used for the dashboard's "live"
|
|
108
|
+
* filter, which maps to ['running','paused'].
|
|
109
|
+
*/
|
|
110
|
+
list(opts?: {
|
|
111
|
+
limit?: number;
|
|
112
|
+
offset?: number;
|
|
113
|
+
sinceIso?: string;
|
|
114
|
+
workflowName?: string;
|
|
115
|
+
statuses?: string[];
|
|
116
|
+
}): {
|
|
117
|
+
runs: WorkflowRun[];
|
|
118
|
+
total: number;
|
|
119
|
+
};
|
|
120
|
+
/** Distinct workflow_name values, sorted alphabetically. */
|
|
121
|
+
distinctNames(): string[];
|
|
122
|
+
/**
|
|
123
|
+
* Mark a workflow run as finished. Plain status flip when called with just
|
|
124
|
+
* `{ error }`; when a `terminalMarker` is supplied (the runner's
|
|
125
|
+
* `on_success.set_phase`), the phase-history append and the status flip
|
|
126
|
+
* happen in ONE transaction so the dashboard never sees the terminal phase
|
|
127
|
+
* without the finished status, or vice versa.
|
|
128
|
+
*/
|
|
129
|
+
finishRun(id: string, status: "succeeded" | "failed" | "cancelled", opts?: {
|
|
130
|
+
error?: string;
|
|
131
|
+
terminalMarker?: PhaseMarker;
|
|
132
|
+
}): void;
|
|
133
|
+
private flipFinished;
|
|
134
|
+
/** Cancel a workflow run */
|
|
135
|
+
cancelRun(id: string): void;
|
|
136
|
+
/** Pause a workflow run (waiting for approval) */
|
|
137
|
+
setPaused(id: string): void;
|
|
138
|
+
/** Resume a paused workflow run (set back to running) */
|
|
139
|
+
setRunning(id: string): void;
|
|
140
|
+
/**
|
|
141
|
+
* Increment the restart counter and return the new value. Used by
|
|
142
|
+
* `resumeOrphanedWorkflows` to enforce a retry budget so a run that
|
|
143
|
+
* crashes the host (agent OOM, etc.) eventually self-terminates instead
|
|
144
|
+
* of being re-dispatched on every boot.
|
|
145
|
+
*/
|
|
146
|
+
incrementRestartCount(id: string): number;
|
|
147
|
+
private deserialize;
|
|
148
|
+
/**
|
|
149
|
+
* Resolve a socratic reply gate and resume the run, atomically: the reply
|
|
150
|
+
* gate flips `pending → approved` (recording the reply text), the caller's
|
|
151
|
+
* scratch patch merges in, and the run goes back to `running` — all in one
|
|
152
|
+
* transaction. A throw anywhere rolls the whole thing back, so the run can
|
|
153
|
+
* never be left `running` with its gate unresolved or its reply lost (the
|
|
154
|
+
* hazard issue #97 calls out).
|
|
155
|
+
*
|
|
156
|
+
* The reply-gate resolve is guarded by `kind = 'reply' AND status = 'pending'`
|
|
157
|
+
* (see {@link ApprovalStore.resolveReplyGate}); if it changes zero rows —
|
|
158
|
+
* because a racing reply already resolved the gate — this throws and the
|
|
159
|
+
* transaction aborts, which is the double-reply concurrency guard.
|
|
160
|
+
*
|
|
161
|
+
* The caller (`index.ts`) computes the explore-domain `scratch.socratic.qa`
|
|
162
|
+
* patch and passes it in; the generic store stays ignorant of that shape.
|
|
163
|
+
*/
|
|
164
|
+
/**
|
|
165
|
+
* Pause a run for an approval gate, atomically: create the pending approval,
|
|
166
|
+
* optionally merge a scratch patch (loops persist their iteration state
|
|
167
|
+
* here), append the `waiting_approval` phase marker, and flip the run to
|
|
168
|
+
* `paused` — all in one transaction. Covers the standard post-phase gate,
|
|
169
|
+
* the reviewer-loop gate, and the interactive generic-loop gate.
|
|
170
|
+
*
|
|
171
|
+
* The marker is appended BEFORE the approval insert so that an insert
|
|
172
|
+
* failure provably rolls back the phase-history write (the injected
|
|
173
|
+
* ApprovalStore participates in the same transaction); ordering is invisible
|
|
174
|
+
* outside the transaction.
|
|
175
|
+
*/
|
|
176
|
+
pauseForApproval(runId: string, approval: Parameters<ApprovalStore["create"]>[0], marker: PhaseMarker, scratchPatch?: Record<string, unknown>): void;
|
|
177
|
+
/**
|
|
178
|
+
* Approve a gate and resume its run, atomically. Reads the approval to find
|
|
179
|
+
* its run, records the `approved` response, and flips the run back to
|
|
180
|
+
* `running` in one transaction; returns the run so the caller can dispatch.
|
|
181
|
+
* Used by the GitHub/Slack path (`index.ts`), which validates the dispatch
|
|
182
|
+
* target BEFORE calling this so the flip to `running` is always followed by a
|
|
183
|
+
* dispatch. The dashboard path does NOT use this — it can't prove a dispatch
|
|
184
|
+
* will follow before responding, so it records the approval and lets
|
|
185
|
+
* `resumeWorkflow` flip the run only as part of an actual dispatch.
|
|
186
|
+
*/
|
|
187
|
+
resolveGateAndResume(approvalId: string, responder: string): WorkflowRun | null;
|
|
188
|
+
/**
|
|
189
|
+
* Reject a gate and fail its run, atomically: record the `rejected` response
|
|
190
|
+
* (with reason) and flip the run to `failed` in one transaction. Returns the
|
|
191
|
+
* run (or null if the approval's run was already gone).
|
|
192
|
+
*/
|
|
193
|
+
resolveGateAndFail(approvalId: string, responder: string, reason?: string): WorkflowRun | null;
|
|
194
|
+
resolveReplyGateAndResume(runId: string, approvalId: string, replyText: string, responder: string, scratchPatch: Record<string, unknown>): WorkflowRun | null;
|
|
195
|
+
}
|