@yemi33/minions 0.1.2448 → 0.1.2449
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/bin/cli-api-client.js +1 -1
- package/bin/install-internal-minions.js +1382 -44
- package/bin/install-layout.js +150 -0
- package/bin/minions.js +460 -167
- package/dashboard/docs/typography.md +65 -12
- package/dashboard/js/command-center.js +58 -4
- package/dashboard/js/detail-panel.js +36 -0
- package/dashboard/js/memory-panel.js +59 -12
- package/dashboard/js/qa.js +179 -20
- package/dashboard/js/refresh.js +148 -12
- package/dashboard/js/render-dispatch.js +3 -4
- package/dashboard/js/render-inbox.js +2 -2
- package/dashboard/js/render-other.js +3 -3
- package/dashboard/js/render-pipelines.js +14 -0
- package/dashboard/js/render-plans.js +57 -9
- package/dashboard/js/render-prd.js +132 -23
- package/dashboard/js/render-prs.js +195 -166
- package/dashboard/js/render-schedules.js +63 -3
- package/dashboard/js/render-utils.js +3 -3
- package/dashboard/js/render-watches.js +19 -3
- package/dashboard/js/render-work-items.js +238 -30
- package/dashboard/js/settings.js +205 -54
- package/dashboard/js/utils.js +51 -1
- package/dashboard/pages/home.html +1 -1
- package/dashboard/pages/qa.html +1 -16
- package/dashboard/pages/work.html +40 -0
- package/dashboard/shared/cc-limits.js +79 -0
- package/dashboard/shared/pr-filters.js +21 -38
- package/dashboard/shared/project-git-summary.js +1 -1
- package/dashboard/shared/record-filters.js +169 -0
- package/dashboard/shared/watches-source.js +1 -1
- package/dashboard/shared/welcome-popup.js +1 -1
- package/dashboard/shared/wi-filters.js +302 -0
- package/dashboard/slim/body.html +1 -0
- package/dashboard/slim/js/command-send.js +26 -0
- package/dashboard/slim/js/modals-tiles.js +380 -39
- package/dashboard/slim/js/status.js +13 -21
- package/dashboard/slim/layout.html +1 -0
- package/dashboard/slim/panel-bootstrap.js +6 -2
- package/dashboard/slim/styles.css +38 -0
- package/dashboard/styles.css +159 -55
- package/dashboard-build.js +13 -2
- package/dashboard.js +956 -423
- package/docs/README.md +11 -6
- package/docs/api-errors.md +2 -2
- package/docs/architecture-review-2026-07-09.md +1 -1
- package/docs/architecture.excalidraw +2 -2
- package/docs/auto-discovery.md +18 -9
- package/docs/branch-derivation.md +4 -4
- package/docs/capture-demos.js +39 -2
- package/docs/ci-runner-canary.md +123 -0
- package/docs/claude-md-propagation.md +2 -2
- package/docs/cloud-agent-dispatch.md +204 -0
- package/docs/command-center.md +7 -7
- package/docs/completion-reports.md +43 -20
- package/docs/constants.md +10 -3
- package/docs/constellation-bridge.md +134 -6
- package/docs/constellation-style-telemetry.md +4 -4
- package/docs/contracts/capability-protocol.v1.json +165 -0
- package/docs/cooldown-merge-semantics.md +12 -12
- package/docs/copilot-cli-schema.md +7 -7
- package/docs/cross-repo-plans.md +10 -10
- package/docs/dead-code-audit-retractions.md +5 -5
- package/docs/default-branch-ci.md +173 -0
- package/docs/deprecated.json +31 -31
- package/docs/design-inbox-entries-schema.md +3 -3
- package/docs/design-language.md +1051 -0
- package/docs/design-state-storage.md +11 -11
- package/docs/diagnostics-crash-reports.md +9 -9
- package/docs/diagnostics-memory.md +5 -5
- package/docs/documentation-audit-2026-07-09.md +7 -7
- package/docs/engine-restart.md +90 -5
- package/docs/harness-mode.md +1 -1
- package/docs/internal-install.md +338 -39
- package/docs/kb-dedup-duplicate-pair-investigation.md +5 -5
- package/docs/kb-pr3223-cascade-archiving.md +1 -1
- package/docs/kb-pr696-merge-conflict-docs.md +6 -6
- package/docs/kb-sweep.md +35 -35
- package/docs/keep-processes.md +1 -1
- package/docs/live-checkout-mode.md +30 -30
- package/docs/managed-spawn.md +18 -14
- package/docs/named-agents.md +7 -7
- package/docs/plan-lifecycle.md +69 -2
- package/docs/pr-author-identity.md +114 -0
- package/docs/pr-auto-fix-dispatch.md +19 -4
- package/docs/pr-comment-followup.md +6 -6
- package/docs/pr-review-fix-loop.md +59 -10
- package/docs/process-termination.md +40 -0
- package/docs/proposals/repo-pool-for-live-checkout.md +13 -13
- package/docs/qa-runbook-lifecycle.md +367 -17
- package/docs/qa-runbooks.md +3 -3
- package/docs/rfc-completion-json.md +18 -18
- package/docs/runtime-adapters.md +26 -21
- package/docs/security.md +6 -6
- package/docs/self-improvement.md +4 -4
- package/docs/shared-lifecycle-module-map.md +473 -472
- package/docs/skills.md +52 -3
- package/docs/slim-ux/concepts.md +121 -116
- package/docs/specs/agent-configurability.md +18 -18
- package/docs/specs/agent-rename.md +18 -18
- package/docs/team-memory.md +38 -21
- package/docs/timeouts-and-liveness.md +118 -10
- package/docs/tutorials/01-install-and-connect.md +1 -1
- package/docs/watches.md +40 -39
- package/docs/workspace-manifests.md +4 -4
- package/docs/worktree-lifecycle.md +293 -14
- package/engine/README.md +46 -0
- package/engine/{ado-comment.js → ado/comment.js} +8 -8
- package/engine/{ado-git-auth.js → ado/git-auth.js} +4 -4
- package/engine/{ado.js → ado/index.js} +417 -63
- package/engine/{ado-status.js → ado/status.js} +6 -8
- package/engine/{ado-token.js → ado/token.js} +1 -1
- package/engine/{acp-transport.js → agents/acp-transport.js} +62 -22
- package/engine/{agent-worker-pool.js → agents/agent-worker-pool.js} +17 -8
- package/engine/{cc-worker-pool.js → agents/cc-worker-pool.js} +16 -6
- package/engine/{claude-md-context.js → agents/claude-md-context.js} +5 -5
- package/engine/{harness-context.js → agents/harness-context.js} +5 -5
- package/engine/{harness.js → agents/harness.js} +3 -3
- package/engine/{llm.js → agents/llm.js} +18 -14
- package/engine/{model-discovery.js → agents/model-discovery.js} +2 -2
- package/engine/{playbook.js → agents/playbook.js} +155 -22
- package/engine/{pooled-agent-process.js → agents/pooled-agent-process.js} +14 -12
- package/engine/{preflight.js → agents/preflight.js} +29 -10
- package/engine/{spawn-agent.js → agents/spawn-agent.js} +25 -14
- package/engine/{spawn-phase-watchdog.js → agents/spawn-phase-watchdog.js} +16 -7
- package/engine/{steering.js → agents/steering.js} +5 -5
- package/engine/{tools-inventory.js → agents/tools-inventory.js} +2 -2
- package/engine/{agent-api-validation.js → api/agent-api-validation.js} +2 -2
- package/engine/{api-validation.js → api/api-validation.js} +1 -1
- package/engine/api/bridge.js +787 -0
- package/engine/{cc-api-validation.js → api/cc-api-validation.js} +1 -1
- package/engine/api/companion.js +560 -0
- package/engine/{content-api-validation.js → api/content-api-validation.js} +2 -2
- package/engine/{pr-issue-validation.js → api/pr-issue-validation.js} +33 -6
- package/engine/{settings-validation.js → api/settings-validation.js} +32 -4
- package/engine/api-contracts/agent-content.js +4 -4
- package/engine/api-contracts/capability-manifest.js +236 -0
- package/engine/api-contracts/capability-protocol.js +333 -0
- package/engine/api-contracts/cc-ops.js +1 -1
- package/engine/api-contracts/config-runtime.js +5 -0
- package/engine/api-contracts/core.js +28 -1
- package/engine/api-contracts/index.js +100 -0
- package/engine/api-contracts/orchestration.js +18 -5
- package/engine/api-contracts/pull-requests.js +37 -6
- package/engine/api-contracts/qa-process.js +29 -6
- package/engine/api-contracts/work-plan-prd.js +21 -1
- package/engine/cloud/contract.js +212 -0
- package/engine/cloud/index.js +159 -0
- package/engine/{execution-model.js → core/execution-model.js} +1 -1
- package/engine/{features.js → core/features.js} +4 -4
- package/engine/{operator-identity.js → core/operator-identity.js} +1 -1
- package/engine/{queries.js → core/queries.js} +201 -36
- package/engine/{safe-expr.js → core/safe-expr.js} +1 -1
- package/engine/{shared.js → core/shared.js} +1637 -175
- package/engine/{stdio-timestamps.js → core/stdio-timestamps.js} +1 -1
- package/engine/{untrusted-fence.js → core/untrusted-fence.js} +3 -3
- package/engine/db/index.js +11 -2
- package/engine/db/migrations/002-dispatches.js +3 -3
- package/engine/db/migrations/003-work-items.js +1 -1
- package/engine/db/migrations/004-pull-requests.js +1 -1
- package/engine/db/migrations/006-metrics.js +1 -1
- package/engine/db/migrations/007-watches.js +2 -2
- package/engine/db/migrations/008-small-state.js +1 -1
- package/engine/db/migrations/009-qa.js +1 -1
- package/engine/db/migrations/010-pr-links.js +1 -1
- package/engine/db/migrations/011-remaining-state.js +1 -1
- package/engine/db/migrations/012-steering-deliveries.js +2 -2
- package/engine/db/migrations/013-backfill-broken-note-links.js +1 -1
- package/engine/db/migrations/014-pr-fix-target-prefs.js +2 -2
- package/engine/db/migrations/015-plans-prds.js +0 -0
- package/engine/db/migrations/018-sql-only-cutover.js +2 -2
- package/engine/db/migrations/021-archived-work-items.js +1 -1
- package/engine/db/migrations/022-global-cc-session.js +1 -1
- package/engine/db/migrations/023-engine-state.js +1 -1
- package/engine/db/migrations/025-malformed-work-item-phantoms.js +1 -1
- package/engine/db/migrations/027-review-learning-lifecycle.js +1 -1
- package/engine/db/migrations/029-repair-reused-versions.js +20 -0
- package/engine/db/migrations/031-pr-author-identity.js +137 -0
- package/engine/{consolidation.js → memory/consolidation.js} +6 -6
- package/engine/{kb-sweep-runner.js → memory/kb-sweep-runner.js} +2 -2
- package/engine/{kb-sweep.js → memory/kb-sweep.js} +9 -7
- package/engine/{memory-retrieval.js → memory/memory-retrieval.js} +46 -4
- package/engine/{memory-store.js → memory/memory-store.js} +3 -3
- package/engine/{promotion.js → memory/promotion.js} +3 -3
- package/engine/{review-learning-backfill.js → memory/review-learning-backfill.js} +6 -6
- package/engine/{review-learning.js → memory/review-learning.js} +10 -5
- package/engine/{diagnostics-memory.js → observability/diagnostics-memory.js} +1 -1
- package/engine/{logs-store.js → observability/logs-store.js} +5 -5
- package/engine/{metrics-store.js → observability/metrics-store.js} +4 -4
- package/engine/{check-status.js → operations/check-status.js} +3 -3
- package/engine/{cli.js → operations/cli.js} +271 -113
- package/engine/{distribution.js → operations/distribution.js} +5 -6
- package/engine/{cleanup.js → orchestration/cleanup.js} +72 -45
- package/engine/{cooldown.js → orchestration/cooldown.js} +5 -5
- package/engine/{dispatch-events.js → orchestration/dispatch-events.js} +2 -2
- package/engine/{dispatch.js → orchestration/dispatch.js} +129 -36
- package/engine/orchestration/failed-scheduled-cleanup.js +274 -0
- package/engine/{lifecycle.js → orchestration/lifecycle.js} +198 -90
- package/engine/{meeting.js → orchestration/meeting.js} +6 -16
- package/engine/{pipeline.js → orchestration/pipeline.js} +12 -12
- package/engine/{pre-dispatch-eval.js → orchestration/pre-dispatch-eval.js} +10 -9
- package/engine/{routing.js → orchestration/routing.js} +3 -3
- package/engine/{schedule-bootstrap.js → orchestration/schedule-bootstrap.js} +4 -4
- package/engine/{scheduler.js → orchestration/scheduler.js} +38 -8
- package/engine/{timeout.js → orchestration/timeout.js} +158 -109
- package/engine/{db-events.js → persistence/db-events.js} +2 -2
- package/engine/{dispatch-store.js → persistence/dispatch-store.js} +7 -7
- package/engine/{inbox-store.js → persistence/inbox-store.js} +2 -2
- package/engine/{note-link-backfill.js → persistence/note-link-backfill.js} +4 -4
- package/engine/{pr-fix-target-store.js → persistence/pr-fix-target-store.js} +8 -8
- package/engine/{pull-requests-store.js → persistence/pull-requests-store.js} +21 -7
- package/engine/{small-state-store.js → persistence/small-state-store.js} +31 -31
- package/engine/persistence/state-operations.js +350 -0
- package/engine/{steering-store.js → persistence/steering-store.js} +6 -6
- package/engine/{issues.js → planning/issues.js} +2 -2
- package/engine/{plan-prd-validation.js → planning/plan-prd-validation.js} +8 -2
- package/engine/planning/prd-result-sidecar.js +190 -0
- package/engine/{prd-store.js → planning/prd-store.js} +17 -17
- package/engine/{project-discovery.js → planning/project-discovery.js} +5 -5
- package/engine/{projects.js → planning/projects.js} +10 -10
- package/engine/{resolve-area.js → planning/resolve-area.js} +1 -1
- package/engine/{work-item-validation.js → planning/work-item-validation.js} +39 -3
- package/engine/{work-items-store.js → planning/work-items-store.js} +29 -21
- package/engine/{keep-process-sweep.js → processes/keep-process-sweep.js} +57 -17
- package/engine/{managed-spawn-launcher.js → processes/managed-spawn-launcher.js} +3 -3
- package/engine/{managed-spawn.js → processes/managed-spawn.js} +97 -46
- package/engine/{process-utils.js → processes/process-utils.js} +599 -55
- package/engine/{abandoned-pr-reconciliation.js → providers/abandoned-pr-reconciliation.js} +17 -7
- package/engine/{comment-classifier.js → providers/comment-classifier.js} +85 -17
- package/engine/{comment-format.js → providers/comment-format.js} +5 -5
- package/engine/{gh-comment.js → providers/gh-comment.js} +15 -15
- package/engine/{gh-token.js → providers/gh-token.js} +4 -4
- package/engine/{github.js → providers/github.js} +131 -54
- package/engine/{pr-action.js → providers/pr-action.js} +13 -12
- package/engine/{pr-clone-keep.js → providers/pr-clone-keep.js} +7 -7
- package/engine/{pr-devbox.js → providers/pr-devbox.js} +6 -6
- package/engine/{pr-fix-target.js → providers/pr-fix-target.js} +13 -13
- package/engine/{pr-remote-patch.js → providers/pr-remote-patch.js} +4 -4
- package/engine/{pr-resolve.js → providers/pr-resolve.js} +7 -7
- package/engine/{pr-temp-clone.js → providers/pr-temp-clone.js} +5 -5
- package/engine/{pr-track.js → providers/pr-track.js} +11 -13
- package/engine/{shared-branch-pr-reconcile.js → providers/shared-branch-pr-reconcile.js} +4 -4
- package/engine/qa/auto-prd-qa.js +313 -0
- package/engine/{qa-from-prd.js → qa/from-prd.js} +42 -12
- package/engine/qa/prd-session.js +240 -0
- package/engine/{qa-process-validation.js → qa/process-validation.js} +14 -9
- package/engine/{qa-runbooks.js → qa/runbooks.js} +1 -1
- package/engine/{qa-runs.js → qa/runs.js} +286 -15
- package/engine/{qa-sessions.js → qa/sessions.js} +595 -49
- package/engine/qa/visual-journey.js +654 -0
- package/engine/{qa-runners.js → qa-runners/index.js} +7 -7
- package/engine/qa-runners/maestro.js +3 -3
- package/engine/qa-runners/playwright.js +2 -2
- package/engine/{restart-health.js → recovery/restart-health.js} +48 -4
- package/engine/recovery/stop-stack.js +607 -0
- package/engine/{supervisor.js → recovery/supervisor.js} +105 -175
- package/engine/{watchdog.js → recovery/watchdog.js} +136 -13
- package/engine/runtimes/claude.js +14 -12
- package/engine/runtimes/codex.js +8 -6
- package/engine/runtimes/copilot.js +17 -16
- package/engine/{watch-actions.js → watches/actions.js} +13 -13
- package/engine/{watches.js → watches/index.js} +43 -32
- package/engine/{watches-store.js → watches/store.js} +4 -4
- package/engine/{create-pr-worktree.js → worktrees/create-pr.js} +1 -1
- package/engine/{worktree-gc.js → worktrees/gc.js} +70 -22
- package/engine/worktrees/inventory.js +671 -0
- package/engine/{live-checkout.js → worktrees/live-checkout.js} +4 -4
- package/engine/{worktree-pool.js → worktrees/pool.js} +2 -2
- package/engine/{worktree-preflight.js → worktrees/preflight.js} +1 -0
- package/engine/worktrees/quarantine-refs.js +173 -0
- package/engine.js +1137 -208
- package/minions.js +147 -77
- package/package.json +10 -6
- package/playbooks/_pr-description-audit.md +110 -78
- package/playbooks/build-fix-complex.md +2 -0
- package/playbooks/fix.md +16 -12
- package/playbooks/implement-shared.md +2 -0
- package/playbooks/implement.md +19 -20
- package/playbooks/plan-to-prd.md +18 -3
- package/playbooks/qa-session-draft.md +136 -1
- package/playbooks/qa-session-execute.md +80 -2
- package/playbooks/qa-session-setup.md +17 -1
- package/playbooks/qa-validate.md +1 -1
- package/playbooks/setup.md +2 -0
- package/playbooks/shared-rules.md +25 -32
- package/playbooks/templates/followup-dispatch.md +4 -3
- package/playbooks/verify.md +1 -1
- package/prompts/cc-system.md +19 -27
- package/watch-plugins/README.md +92 -0
- package/watch-plugins/ado-author-prs.js +336 -0
- package/watch-plugins/gh-author-prs.js +375 -0
- package/watch-plugins/http.js +474 -0
- package/watch-plugins/teams-channel.js +869 -0
- package/docs/dev-composite-workflow.md +0 -101
- package/docs/pr-screenshots/pr-886/after-single-header.png +0 -0
- package/docs/pr-screenshots/pr-886/before-duplicate-header.png +0 -0
- package/docs/pr-screenshots/pr-895/01-cancellation-reason-detail.png +0 -0
- package/docs/pr-screenshots/pr-899/worker-pool-worktrees-AFTER.png +0 -0
- package/docs/pr-screenshots/pr-899/worker-pool-worktrees-BEFORE.png +0 -0
- package/docs/pr-screenshots/pr-901/projects-tab-default.png +0 -0
- package/docs/pr-screenshots/pr-901/projects-tab-fmf-selected.png +0 -0
- package/docs/pr-screenshots/pr-916/model-picker-AFTER-crop.png +0 -0
- package/docs/pr-screenshots/pr-916/model-picker-AFTER.png +0 -0
- package/docs/pr-screenshots/pr-916/model-picker-BEFORE-crop.png +0 -0
- package/docs/pr-screenshots/pr-916/model-picker-BEFORE.png +0 -0
- package/docs/pr-screenshots/pr-916/model-picker-dropdown-AFTER.png +0 -0
- package/docs/pr-screenshots/pr-979/auto-fix-pane-AFTER.png +0 -0
- package/docs/pr-screenshots/pr-979/auto-fix-pane-BEFORE.png +0 -0
- package/docs/pr-screenshots/pr-985/pr-column-em-dash-AFTER.png +0 -0
- package/docs/pr-screenshots/pr-985/pr-column-em-dash-BEFORE.png +0 -0
- package/docs/visual-evidence-ci.md +0 -103
- package/engine/bridge.js +0 -379
- package/engine/quarantine-refs.js +0 -103
- package/engine/state-operations.js +0 -178
- /package/engine/{steering-constraints.js → agents/steering-constraints.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// engine/pr-fix-target-store.js — SQL-backed remembered execution-target
|
|
1
|
+
// engine/persistence/pr-fix-target-store.js — SQL-backed remembered execution-target
|
|
2
2
|
// choices, keyed per repo scope.
|
|
3
3
|
//
|
|
4
4
|
// Plan: projectless-pr-actions, Phase 3, item P-ppa10009 — "Remember
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
// (github:owner/repo / ado:org/proj/repo) in the pr_fix_target_prefs table
|
|
7
7
|
// (migration 014). When a remembered choice exists, a repeat fix on that repo
|
|
8
8
|
// skips the execution-target prompt and routes straight to the executor
|
|
9
|
-
// (engine/pr-fix-target.js#planPrFix consults getRemembered). Absence of a row
|
|
9
|
+
// (engine/providers/pr-fix-target.js#planPrFix consults getRemembered). Absence of a row
|
|
10
10
|
// still prompts — the safe "never clone silently" default.
|
|
11
11
|
//
|
|
12
|
-
// Mirrors the shape of engine/steering-store.js:
|
|
12
|
+
// Mirrors the shape of engine/persistence/steering-store.js:
|
|
13
13
|
// - routes every read/write through getDb() (no JSON sidecar)
|
|
14
14
|
// - emits emitStateEvent('pr-fix-target-prefs', {repoScope, target}) on every
|
|
15
15
|
// write/clear so the dashboard's MAX(events.id) cache check fires.
|
|
@@ -29,7 +29,7 @@ function _isValidTarget(target) {
|
|
|
29
29
|
// Validate against the canonical execution-target list. Lazy require avoids a
|
|
30
30
|
// load-time cycle (pr-fix-target.js requires this store at module top).
|
|
31
31
|
try {
|
|
32
|
-
const { isValidExecutionTarget } = require('
|
|
32
|
+
const { isValidExecutionTarget } = require('../providers/pr-fix-target');
|
|
33
33
|
return isValidExecutionTarget(target);
|
|
34
34
|
} catch {
|
|
35
35
|
// If pr-fix-target can't load (shouldn't happen), fall back to a minimal
|
|
@@ -63,7 +63,7 @@ function remember(repoScope, target) {
|
|
|
63
63
|
throw new Error(`pr-fix-target-store.remember: invalid execution target ${JSON.stringify(target)}`);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
const { getDb } = require('
|
|
66
|
+
const { getDb } = require('../db');
|
|
67
67
|
const db = getDb();
|
|
68
68
|
const now = Date.now();
|
|
69
69
|
db.prepare(`
|
|
@@ -87,7 +87,7 @@ function getRecord(repoScope) {
|
|
|
87
87
|
const scope = _normScope(repoScope);
|
|
88
88
|
if (!scope) return null;
|
|
89
89
|
let db;
|
|
90
|
-
try { const { getDb } = require('
|
|
90
|
+
try { const { getDb } = require('../db'); db = getDb(); }
|
|
91
91
|
catch { return null; }
|
|
92
92
|
const row = db.prepare('SELECT * FROM pr_fix_target_prefs WHERE repo_scope = ?').get(scope);
|
|
93
93
|
return _rowToRecord(row);
|
|
@@ -97,7 +97,7 @@ function getRecord(repoScope) {
|
|
|
97
97
|
function clear(repoScope) {
|
|
98
98
|
const scope = _normScope(repoScope);
|
|
99
99
|
if (!scope) return false;
|
|
100
|
-
const { getDb } = require('
|
|
100
|
+
const { getDb } = require('../db');
|
|
101
101
|
const db = getDb();
|
|
102
102
|
const info = db.prepare('DELETE FROM pr_fix_target_prefs WHERE repo_scope = ?').run(scope);
|
|
103
103
|
const removed = (info && info.changes) > 0;
|
|
@@ -108,7 +108,7 @@ function clear(repoScope) {
|
|
|
108
108
|
/** All remembered choices, newest-updated first. */
|
|
109
109
|
function list() {
|
|
110
110
|
let db;
|
|
111
|
-
try { const { getDb } = require('
|
|
111
|
+
try { const { getDb } = require('../db'); db = getDb(); }
|
|
112
112
|
catch { return []; }
|
|
113
113
|
const rows = db.prepare('SELECT * FROM pr_fix_target_prefs ORDER BY updated_at DESC, repo_scope ASC').all();
|
|
114
114
|
return rows.map(_rowToRecord);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// engine/pull-requests-store.js — SQL-backed scoped pull-request storage.
|
|
1
|
+
// engine/persistence/pull-requests-store.js — SQL-backed scoped pull-request storage.
|
|
2
2
|
//
|
|
3
3
|
// readPullRequestsForScope(scope) -> [pr, pr, ...]
|
|
4
4
|
// applyPullRequestsMutation(scope, fn) -> diff-then-apply,
|
|
@@ -19,8 +19,20 @@ function _parseRow(row) {
|
|
|
19
19
|
catch { return null; }
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
// Typed projection for the `author` column: display name → login → id. Kept
|
|
23
|
+
// local (no shared.js require) so this low-level store stays dependency-light;
|
|
24
|
+
// the canonical structured identity always lives in the `data` JSON.
|
|
25
|
+
function _authorLabel(author) {
|
|
26
|
+
if (!author) return null;
|
|
27
|
+
if (typeof author === 'string') return author.trim().slice(0, 200) || null;
|
|
28
|
+
if (typeof author !== 'object') return null;
|
|
29
|
+
const label = author.displayName || author.login || author.id || '';
|
|
30
|
+
const s = String(label).trim();
|
|
31
|
+
return s ? s.slice(0, 200) : null;
|
|
32
|
+
}
|
|
33
|
+
|
|
22
34
|
function readPullRequestsForScope(scope) {
|
|
23
|
-
const { getDb } = require('
|
|
35
|
+
const { getDb } = require('../db');
|
|
24
36
|
const db = getDb();
|
|
25
37
|
|
|
26
38
|
const rows = db.prepare(`
|
|
@@ -38,7 +50,7 @@ function readPullRequestsForScope(scope) {
|
|
|
38
50
|
}
|
|
39
51
|
|
|
40
52
|
function readAllPullRequests() {
|
|
41
|
-
const { getDb } = require('
|
|
53
|
+
const { getDb } = require('../db');
|
|
42
54
|
const db = getDb();
|
|
43
55
|
|
|
44
56
|
const rows = db.prepare('SELECT data, scope FROM pull_requests ORDER BY rowid').all();
|
|
@@ -81,12 +93,13 @@ function _applyPullRequestsDiff(db, diff) {
|
|
|
81
93
|
if (diff.toUpsert.length === 0 && diff.toDelete.length === 0) return false;
|
|
82
94
|
const now = Date.now();
|
|
83
95
|
const upsertStmt = db.prepare(`
|
|
84
|
-
INSERT INTO pull_requests (id, scope, status, review_status, agent, branch, pr_number, created_at, last_polled_at, data, updated_at)
|
|
85
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
96
|
+
INSERT INTO pull_requests (id, scope, status, review_status, agent, author, branch, pr_number, created_at, last_polled_at, data, updated_at)
|
|
97
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
86
98
|
ON CONFLICT(scope, id) DO UPDATE SET
|
|
87
99
|
status = excluded.status,
|
|
88
100
|
review_status = excluded.review_status,
|
|
89
101
|
agent = excluded.agent,
|
|
102
|
+
author = excluded.author,
|
|
90
103
|
branch = excluded.branch,
|
|
91
104
|
pr_number = excluded.pr_number,
|
|
92
105
|
created_at = excluded.created_at,
|
|
@@ -103,6 +116,7 @@ function _applyPullRequestsDiff(db, diff) {
|
|
|
103
116
|
String(pr.status || 'active'),
|
|
104
117
|
pr.reviewStatus || null,
|
|
105
118
|
pr.agent || null,
|
|
119
|
+
_authorLabel(pr.author),
|
|
106
120
|
pr.branch || null,
|
|
107
121
|
Number.isFinite(pr.prNumber) ? pr.prNumber : null,
|
|
108
122
|
_toMs(pr.created),
|
|
@@ -118,7 +132,7 @@ function _applyPullRequestsDiff(db, diff) {
|
|
|
118
132
|
}
|
|
119
133
|
|
|
120
134
|
function applyPullRequestsMutation(scope, mutator) {
|
|
121
|
-
const { getDb, withTransaction } = require('
|
|
135
|
+
const { getDb, withTransaction } = require('../db');
|
|
122
136
|
const db = getDb();
|
|
123
137
|
|
|
124
138
|
return withTransaction(db, () => {
|
|
@@ -145,7 +159,7 @@ function applyPullRequestsMutation(scope, mutator) {
|
|
|
145
159
|
// applyPullRequestsMutation's callers (see shared.js mutatePullRequests).
|
|
146
160
|
function dropScope(scope) {
|
|
147
161
|
try {
|
|
148
|
-
const { getDb } = require('
|
|
162
|
+
const { getDb } = require('../db');
|
|
149
163
|
const result = getDb().prepare('DELETE FROM pull_requests WHERE scope = ?').run(scope);
|
|
150
164
|
if (result && result.changes > 0) {
|
|
151
165
|
try { require('./db-events').emitStateEvent('pull_requests'); } catch { /* optional */ }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// engine/persistence/small-state-store.js — Low-traffic SQL state stores.
|
|
2
2
|
|
|
3
3
|
function _toMs(v) {
|
|
4
4
|
if (v == null) return null;
|
|
@@ -21,12 +21,12 @@ function _readEngineStateFromSql(db) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
function readEngineState() {
|
|
24
|
-
const { getDb } = require('
|
|
24
|
+
const { getDb } = require('../db');
|
|
25
25
|
return _readEngineStateFromSql(getDb());
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
function applyEngineStateMutation(mutator) {
|
|
29
|
-
const { getDb, withTransaction } = require('
|
|
29
|
+
const { getDb, withTransaction } = require('../db');
|
|
30
30
|
let db;
|
|
31
31
|
try { db = getDb(); }
|
|
32
32
|
catch (e) { throw new Error(`small-state-store: SQLite unavailable (${e.message})`); }
|
|
@@ -63,12 +63,12 @@ function _readScheduleRunsFromSql(db) {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
function readScheduleRuns() {
|
|
66
|
-
const { getDb } = require('
|
|
66
|
+
const { getDb } = require('../db');
|
|
67
67
|
return _readScheduleRunsFromSql(getDb());
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
function applyScheduleRunsMutation(mutator) {
|
|
71
|
-
const { getDb, withTransaction } = require('
|
|
71
|
+
const { getDb, withTransaction } = require('../db');
|
|
72
72
|
let db;
|
|
73
73
|
try { db = getDb(); }
|
|
74
74
|
catch (e) { throw new Error(`small-state-store: SQLite unavailable (${e.message})`); }
|
|
@@ -119,12 +119,12 @@ function _readPipelineRunsFromSql(db) {
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
function readPipelineRuns() {
|
|
122
|
-
const { getDb } = require('
|
|
122
|
+
const { getDb } = require('../db');
|
|
123
123
|
return _readPipelineRunsFromSql(getDb());
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
function applyPipelineRunsMutation(mutator) {
|
|
127
|
-
const { getDb, withTransaction } = require('
|
|
127
|
+
const { getDb, withTransaction } = require('../db');
|
|
128
128
|
let db;
|
|
129
129
|
try { db = getDb(); }
|
|
130
130
|
catch (e) { throw new Error(`small-state-store: SQLite unavailable (${e.message})`); }
|
|
@@ -190,12 +190,12 @@ function _readManagedProcessesFromSql(db) {
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
function readManagedProcesses() {
|
|
193
|
-
const { getDb } = require('
|
|
193
|
+
const { getDb } = require('../db');
|
|
194
194
|
return _readManagedProcessesFromSql(getDb());
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
function applyManagedProcessesMutation(mutator) {
|
|
198
|
-
const { getDb, withTransaction } = require('
|
|
198
|
+
const { getDb, withTransaction } = require('../db');
|
|
199
199
|
let db;
|
|
200
200
|
try { db = getDb(); }
|
|
201
201
|
catch (e) { throw new Error(`small-state-store: SQLite unavailable (${e.message})`); }
|
|
@@ -258,12 +258,12 @@ function _readWorktreePoolFromSql(db) {
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
function readWorktreePool() {
|
|
261
|
-
const { getDb } = require('
|
|
261
|
+
const { getDb } = require('../db');
|
|
262
262
|
return _readWorktreePoolFromSql(getDb());
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
function applyWorktreePoolMutation(mutator) {
|
|
266
|
-
const { getDb, withTransaction } = require('
|
|
266
|
+
const { getDb, withTransaction } = require('../db');
|
|
267
267
|
let db;
|
|
268
268
|
try { db = getDb(); }
|
|
269
269
|
catch (e) { throw new Error(`small-state-store: SQLite unavailable (${e.message})`); }
|
|
@@ -312,7 +312,7 @@ function applyWorktreePoolMutation(mutator) {
|
|
|
312
312
|
// Shape: [ {id, runbookId, targetName, project, workItemId, status, startedAt,
|
|
313
313
|
// completedAt, createdAt, artifacts, summary, ...}, ... ]
|
|
314
314
|
// SQL: row per id, extracted query columns + JSON blob `data`.
|
|
315
|
-
// Pattern: mirrors watches
|
|
315
|
+
// Pattern: mirrors watches/store (top-level array, id-keyed diff).
|
|
316
316
|
|
|
317
317
|
function _readQaRunsFromSqlOnly(db) {
|
|
318
318
|
const rows = db.prepare('SELECT data FROM qa_runs ORDER BY created_at, rowid').all();
|
|
@@ -324,12 +324,12 @@ function _readQaRunsFromSqlOnly(db) {
|
|
|
324
324
|
}
|
|
325
325
|
|
|
326
326
|
function readQaRuns() {
|
|
327
|
-
const { getDb } = require('
|
|
327
|
+
const { getDb } = require('../db');
|
|
328
328
|
return _readQaRunsFromSqlOnly(getDb());
|
|
329
329
|
}
|
|
330
330
|
|
|
331
331
|
function applyQaRunsMutation(mutator) {
|
|
332
|
-
const { getDb, withTransaction } = require('
|
|
332
|
+
const { getDb, withTransaction } = require('../db');
|
|
333
333
|
let db;
|
|
334
334
|
try { db = getDb(); }
|
|
335
335
|
catch (e) { throw new Error(`small-state-store: SQLite unavailable (${e.message})`); }
|
|
@@ -420,12 +420,12 @@ function _readQaSessionsFromSqlOnly(db) {
|
|
|
420
420
|
}
|
|
421
421
|
|
|
422
422
|
function readQaSessions() {
|
|
423
|
-
const { getDb } = require('
|
|
423
|
+
const { getDb } = require('../db');
|
|
424
424
|
return _readQaSessionsFromSqlOnly(getDb());
|
|
425
425
|
}
|
|
426
426
|
|
|
427
427
|
function applyQaSessionsMutation(mutator) {
|
|
428
|
-
const { getDb, withTransaction } = require('
|
|
428
|
+
const { getDb, withTransaction } = require('../db');
|
|
429
429
|
let db;
|
|
430
430
|
try { db = getDb(); }
|
|
431
431
|
catch (e) { throw new Error(`small-state-store: SQLite unavailable (${e.message})`); }
|
|
@@ -501,12 +501,12 @@ function _readPrLinksFromSql(db) {
|
|
|
501
501
|
}
|
|
502
502
|
|
|
503
503
|
function readPrLinks() {
|
|
504
|
-
const { getDb } = require('
|
|
504
|
+
const { getDb } = require('../db');
|
|
505
505
|
return _readPrLinksFromSql(getDb());
|
|
506
506
|
}
|
|
507
507
|
|
|
508
508
|
function applyPrLinksMutation(mutator) {
|
|
509
|
-
const { getDb, withTransaction } = require('
|
|
509
|
+
const { getDb, withTransaction } = require('../db');
|
|
510
510
|
let db;
|
|
511
511
|
try { db = getDb(); }
|
|
512
512
|
catch (e) { throw new Error(`small-state-store: SQLite unavailable (${e.message})`); }
|
|
@@ -557,12 +557,12 @@ function _readCooldownsFromSql(db) {
|
|
|
557
557
|
}
|
|
558
558
|
|
|
559
559
|
function readCooldowns() {
|
|
560
|
-
const { getDb } = require('
|
|
560
|
+
const { getDb } = require('../db');
|
|
561
561
|
return _readCooldownsFromSql(getDb());
|
|
562
562
|
}
|
|
563
563
|
|
|
564
564
|
function applyCooldownsMutation(mutator) {
|
|
565
|
-
const { getDb, withTransaction } = require('
|
|
565
|
+
const { getDb, withTransaction } = require('../db');
|
|
566
566
|
let db;
|
|
567
567
|
try { db = getDb(); }
|
|
568
568
|
catch (e) { throw new Error(`small-state-store: SQLite unavailable (${e.message})`); }
|
|
@@ -614,12 +614,12 @@ function _readPendingRebasesFromSql(db) {
|
|
|
614
614
|
}
|
|
615
615
|
|
|
616
616
|
function readPendingRebases() {
|
|
617
|
-
const { getDb } = require('
|
|
617
|
+
const { getDb } = require('../db');
|
|
618
618
|
return _readPendingRebasesFromSql(getDb());
|
|
619
619
|
}
|
|
620
620
|
|
|
621
621
|
function applyPendingRebasesMutation(mutator) {
|
|
622
|
-
const { getDb, withTransaction } = require('
|
|
622
|
+
const { getDb, withTransaction } = require('../db');
|
|
623
623
|
let db;
|
|
624
624
|
try { db = getDb(); }
|
|
625
625
|
catch (e) { throw new Error(`small-state-store: SQLite unavailable (${e.message})`); }
|
|
@@ -664,12 +664,12 @@ function _readCcSessionsFromSql(db) {
|
|
|
664
664
|
}
|
|
665
665
|
|
|
666
666
|
function readCcSessions() {
|
|
667
|
-
const { getDb } = require('
|
|
667
|
+
const { getDb } = require('../db');
|
|
668
668
|
return _readCcSessionsFromSql(getDb());
|
|
669
669
|
}
|
|
670
670
|
|
|
671
671
|
function applyCcSessionsMutation(mutator) {
|
|
672
|
-
const { getDb, withTransaction } = require('
|
|
672
|
+
const { getDb, withTransaction } = require('../db');
|
|
673
673
|
let db;
|
|
674
674
|
try { db = getDb(); }
|
|
675
675
|
catch (e) { throw new Error(`small-state-store: SQLite unavailable (${e.message})`); }
|
|
@@ -707,7 +707,7 @@ function applyCcSessionsMutation(mutator) {
|
|
|
707
707
|
}
|
|
708
708
|
|
|
709
709
|
function readCcGlobalSession() {
|
|
710
|
-
const { getDb } = require('
|
|
710
|
+
const { getDb } = require('../db');
|
|
711
711
|
const row = getDb().prepare('SELECT data FROM cc_sessions WHERE id = ?').get(CC_GLOBAL_SESSION_ID);
|
|
712
712
|
if (!row) return null;
|
|
713
713
|
try {
|
|
@@ -719,7 +719,7 @@ function readCcGlobalSession() {
|
|
|
719
719
|
}
|
|
720
720
|
|
|
721
721
|
function applyCcGlobalSessionMutation(mutator) {
|
|
722
|
-
const { getDb, withTransaction } = require('
|
|
722
|
+
const { getDb, withTransaction } = require('../db');
|
|
723
723
|
let db;
|
|
724
724
|
try { db = getDb(); }
|
|
725
725
|
catch (e) { throw new Error(`small-state-store: SQLite unavailable (${e.message})`); }
|
|
@@ -769,7 +769,7 @@ function _normalizeCcQueueEntry(entry) {
|
|
|
769
769
|
|
|
770
770
|
function readCcQueue(tabId) {
|
|
771
771
|
if (!tabId) return [];
|
|
772
|
-
const { getDb } = require('
|
|
772
|
+
const { getDb } = require('../db');
|
|
773
773
|
const rows = getDb()
|
|
774
774
|
.prepare('SELECT message, intent_metadata FROM cc_queued_messages WHERE tab_id = ? ORDER BY position')
|
|
775
775
|
.all(String(tabId));
|
|
@@ -789,7 +789,7 @@ function readCcQueue(tabId) {
|
|
|
789
789
|
|
|
790
790
|
function replaceCcQueue(tabId, messages) {
|
|
791
791
|
if (!tabId) return { wrote: false, count: 0 };
|
|
792
|
-
const { getDb, withTransaction } = require('
|
|
792
|
+
const { getDb, withTransaction } = require('../db');
|
|
793
793
|
let db;
|
|
794
794
|
try { db = getDb(); }
|
|
795
795
|
catch (e) { throw new Error(`small-state-store: SQLite unavailable (${e.message})`); }
|
|
@@ -820,7 +820,7 @@ function replaceCcQueue(tabId, messages) {
|
|
|
820
820
|
|
|
821
821
|
function clearCcQueue(tabId) {
|
|
822
822
|
if (!tabId) return { wrote: false };
|
|
823
|
-
const { getDb, withTransaction } = require('
|
|
823
|
+
const { getDb, withTransaction } = require('../db');
|
|
824
824
|
let db;
|
|
825
825
|
try { db = getDb(); }
|
|
826
826
|
catch (e) { throw new Error(`small-state-store: SQLite unavailable (${e.message})`); }
|
|
@@ -845,12 +845,12 @@ function _readDocSessionsFromSql(db) {
|
|
|
845
845
|
}
|
|
846
846
|
|
|
847
847
|
function readDocSessions() {
|
|
848
|
-
const { getDb } = require('
|
|
848
|
+
const { getDb } = require('../db');
|
|
849
849
|
return _readDocSessionsFromSql(getDb());
|
|
850
850
|
}
|
|
851
851
|
|
|
852
852
|
function applyDocSessionsMutation(mutator) {
|
|
853
|
-
const { getDb, withTransaction } = require('
|
|
853
|
+
const { getDb, withTransaction } = require('../db');
|
|
854
854
|
let db;
|
|
855
855
|
try { db = getDb(); }
|
|
856
856
|
catch (e) { throw new Error(`small-state-store: SQLite unavailable (${e.message})`); }
|