hungry-ghost-hive 0.48.0 → 0.49.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/dist/agents/base-agent.d.ts +11 -11
- package/dist/agents/base-agent.d.ts.map +1 -1
- package/dist/agents/base-agent.js +25 -25
- package/dist/agents/base-agent.js.map +1 -1
- package/dist/agents/base-agent.test.js +2 -1
- package/dist/agents/base-agent.test.js.map +1 -1
- package/dist/agents/intermediate.d.ts +2 -0
- package/dist/agents/intermediate.d.ts.map +1 -1
- package/dist/agents/intermediate.js +25 -18
- package/dist/agents/intermediate.js.map +1 -1
- package/dist/agents/junior.d.ts +2 -0
- package/dist/agents/junior.d.ts.map +1 -1
- package/dist/agents/junior.js +25 -18
- package/dist/agents/junior.js.map +1 -1
- package/dist/agents/qa.d.ts +2 -0
- package/dist/agents/qa.d.ts.map +1 -1
- package/dist/agents/qa.js +47 -38
- package/dist/agents/qa.js.map +1 -1
- package/dist/agents/senior.d.ts +2 -0
- package/dist/agents/senior.d.ts.map +1 -1
- package/dist/agents/senior.js +40 -27
- package/dist/agents/senior.js.map +1 -1
- package/dist/agents/tech-lead.d.ts +2 -0
- package/dist/agents/tech-lead.d.ts.map +1 -1
- package/dist/agents/tech-lead.js +37 -31
- package/dist/agents/tech-lead.js.map +1 -1
- package/dist/cli/commands/add-repo.js +2 -2
- package/dist/cli/commands/add-repo.js.map +1 -1
- package/dist/cli/commands/add-repo.test.js +1 -1
- package/dist/cli/commands/add-repo.test.js.map +1 -1
- package/dist/cli/commands/agents.d.ts.map +1 -1
- package/dist/cli/commands/agents.js +12 -10
- package/dist/cli/commands/agents.js.map +1 -1
- package/dist/cli/commands/agents.test.js +7 -7
- package/dist/cli/commands/agents.test.js.map +1 -1
- package/dist/cli/commands/approach.js +2 -2
- package/dist/cli/commands/approach.js.map +1 -1
- package/dist/cli/commands/approvals.js +7 -7
- package/dist/cli/commands/approvals.js.map +1 -1
- package/dist/cli/commands/approvals.test.js +8 -8
- package/dist/cli/commands/approvals.test.js.map +1 -1
- package/dist/cli/commands/assign.js +4 -4
- package/dist/cli/commands/assign.js.map +1 -1
- package/dist/cli/commands/assign.test.js +18 -16
- package/dist/cli/commands/assign.test.js.map +1 -1
- package/dist/cli/commands/cleanup.d.ts.map +1 -1
- package/dist/cli/commands/cleanup.js +8 -8
- package/dist/cli/commands/cleanup.js.map +1 -1
- package/dist/cli/commands/cleanup.test.js +5 -1
- package/dist/cli/commands/cleanup.test.js.map +1 -1
- package/dist/cli/commands/escalations.js +9 -7
- package/dist/cli/commands/escalations.js.map +1 -1
- package/dist/cli/commands/escalations.test.js +2 -2
- package/dist/cli/commands/escalations.test.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +48 -5
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/init.test.js +4 -0
- package/dist/cli/commands/init.test.js.map +1 -1
- package/dist/cli/commands/manager/agent-monitoring.d.ts +2 -2
- package/dist/cli/commands/manager/agent-monitoring.d.ts.map +1 -1
- package/dist/cli/commands/manager/agent-monitoring.js +1 -1
- package/dist/cli/commands/manager/agent-monitoring.js.map +1 -1
- package/dist/cli/commands/manager/auditor-lifecycle.js +3 -3
- package/dist/cli/commands/manager/auditor-lifecycle.js.map +1 -1
- package/dist/cli/commands/manager/auditor-lifecycle.test.js +21 -14
- package/dist/cli/commands/manager/auditor-lifecycle.test.js.map +1 -1
- package/dist/cli/commands/manager/auto-reject-comment-only-reviews.test.js +28 -23
- package/dist/cli/commands/manager/auto-reject-comment-only-reviews.test.js.map +1 -1
- package/dist/cli/commands/manager/escalation-handler.d.ts +2 -2
- package/dist/cli/commands/manager/escalation-handler.d.ts.map +1 -1
- package/dist/cli/commands/manager/escalation-handler.js +11 -10
- package/dist/cli/commands/manager/escalation-handler.js.map +1 -1
- package/dist/cli/commands/manager/escalation-handler.test.js +8 -8
- package/dist/cli/commands/manager/escalation-handler.test.js.map +1 -1
- package/dist/cli/commands/manager/feature-sign-off.js +7 -7
- package/dist/cli/commands/manager/feature-sign-off.js.map +1 -1
- package/dist/cli/commands/manager/feature-sign-off.test.js +40 -31
- package/dist/cli/commands/manager/feature-sign-off.test.js.map +1 -1
- package/dist/cli/commands/manager/feature-test-result.d.ts.map +1 -1
- package/dist/cli/commands/manager/feature-test-result.js +12 -13
- package/dist/cli/commands/manager/feature-test-result.js.map +1 -1
- package/dist/cli/commands/manager/handoff-recovery.d.ts.map +1 -1
- package/dist/cli/commands/manager/handoff-recovery.js +14 -15
- package/dist/cli/commands/manager/handoff-recovery.js.map +1 -1
- package/dist/cli/commands/manager/index.d.ts.map +1 -1
- package/dist/cli/commands/manager/index.js +26 -26
- package/dist/cli/commands/manager/index.js.map +1 -1
- package/dist/cli/commands/manager/index.test.js +3 -3
- package/dist/cli/commands/manager/index.test.js.map +1 -1
- package/dist/cli/commands/manager/merged-story-cleanup.d.ts +2 -2
- package/dist/cli/commands/manager/merged-story-cleanup.d.ts.map +1 -1
- package/dist/cli/commands/manager/merged-story-cleanup.js +6 -7
- package/dist/cli/commands/manager/merged-story-cleanup.js.map +1 -1
- package/dist/cli/commands/manager/merged-story-cleanup.test.js +27 -18
- package/dist/cli/commands/manager/merged-story-cleanup.test.js.map +1 -1
- package/dist/cli/commands/manager/pr-sync-orchestrator.d.ts.map +1 -1
- package/dist/cli/commands/manager/pr-sync-orchestrator.js +46 -38
- package/dist/cli/commands/manager/pr-sync-orchestrator.js.map +1 -1
- package/dist/cli/commands/manager/qa-review-handler.d.ts.map +1 -1
- package/dist/cli/commands/manager/qa-review-handler.js +25 -22
- package/dist/cli/commands/manager/qa-review-handler.js.map +1 -1
- package/dist/cli/commands/manager/spin-down.d.ts.map +1 -1
- package/dist/cli/commands/manager/spin-down.js +23 -19
- package/dist/cli/commands/manager/spin-down.js.map +1 -1
- package/dist/cli/commands/manager/stale-escalations.d.ts +2 -3
- package/dist/cli/commands/manager/stale-escalations.d.ts.map +1 -1
- package/dist/cli/commands/manager/stale-escalations.js.map +1 -1
- package/dist/cli/commands/manager/stuck-story-helpers.js +8 -8
- package/dist/cli/commands/manager/stuck-story-helpers.js.map +1 -1
- package/dist/cli/commands/manager/stuck-story-processor.d.ts +2 -2
- package/dist/cli/commands/manager/stuck-story-processor.d.ts.map +1 -1
- package/dist/cli/commands/manager/stuck-story-processor.js +23 -22
- package/dist/cli/commands/manager/stuck-story-processor.js.map +1 -1
- package/dist/cli/commands/manager/tech-lead-lifecycle.js +6 -6
- package/dist/cli/commands/manager/tech-lead-lifecycle.js.map +1 -1
- package/dist/cli/commands/manager/types.d.ts +2 -3
- package/dist/cli/commands/manager/types.d.ts.map +1 -1
- package/dist/cli/commands/manager/types.js.map +1 -1
- package/dist/cli/commands/msg.test.js +2 -2
- package/dist/cli/commands/msg.test.js.map +1 -1
- package/dist/cli/commands/my-stories.d.ts.map +1 -1
- package/dist/cli/commands/my-stories.js +17 -18
- package/dist/cli/commands/my-stories.js.map +1 -1
- package/dist/cli/commands/my-stories.test.js +2 -2
- package/dist/cli/commands/my-stories.test.js.map +1 -1
- package/dist/cli/commands/nuke.test.js +1 -1
- package/dist/cli/commands/nuke.test.js.map +1 -1
- package/dist/cli/commands/pr.js +32 -32
- package/dist/cli/commands/pr.js.map +1 -1
- package/dist/cli/commands/pr.test.js +10 -6
- package/dist/cli/commands/pr.test.js.map +1 -1
- package/dist/cli/commands/progress.d.ts.map +1 -1
- package/dist/cli/commands/progress.js +4 -5
- package/dist/cli/commands/progress.js.map +1 -1
- package/dist/cli/commands/progress.test.js +1 -1
- package/dist/cli/commands/progress.test.js.map +1 -1
- package/dist/cli/commands/req-headless.test.d.ts +2 -0
- package/dist/cli/commands/req-headless.test.d.ts.map +1 -0
- package/dist/cli/commands/req-headless.test.js +128 -0
- package/dist/cli/commands/req-headless.test.js.map +1 -0
- package/dist/cli/commands/req-spawn.test.js +5 -1
- package/dist/cli/commands/req-spawn.test.js.map +1 -1
- package/dist/cli/commands/req.d.ts.map +1 -1
- package/dist/cli/commands/req.js +13 -14
- package/dist/cli/commands/req.js.map +1 -1
- package/dist/cli/commands/resume.d.ts.map +1 -1
- package/dist/cli/commands/resume.js +7 -8
- package/dist/cli/commands/resume.js.map +1 -1
- package/dist/cli/commands/resume.test.js +1 -1
- package/dist/cli/commands/resume.test.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +42 -40
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/status.test.js +1 -1
- package/dist/cli/commands/status.test.js.map +1 -1
- package/dist/cli/commands/stories.js +9 -9
- package/dist/cli/commands/stories.js.map +1 -1
- package/dist/cli/commands/stories.test.js +2 -2
- package/dist/cli/commands/stories.test.js.map +1 -1
- package/dist/cli/commands/teams.js +11 -11
- package/dist/cli/commands/teams.js.map +1 -1
- package/dist/cli/commands/teams.test.js +2 -2
- package/dist/cli/commands/teams.test.js.map +1 -1
- package/dist/cli/dashboard/index.d.ts +2 -2
- package/dist/cli/dashboard/index.d.ts.map +1 -1
- package/dist/cli/dashboard/index.js +29 -20
- package/dist/cli/dashboard/index.js.map +1 -1
- package/dist/cli/dashboard/index.test.js +34 -32
- package/dist/cli/dashboard/index.test.js.map +1 -1
- package/dist/cli/dashboard/panels/activity.d.ts +3 -3
- package/dist/cli/dashboard/panels/activity.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/activity.js +1 -1
- package/dist/cli/dashboard/panels/activity.js.map +1 -1
- package/dist/cli/dashboard/panels/agents.d.ts +3 -3
- package/dist/cli/dashboard/panels/agents.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/agents.js +2 -2
- package/dist/cli/dashboard/panels/agents.js.map +1 -1
- package/dist/cli/dashboard/panels/escalations.d.ts +3 -3
- package/dist/cli/dashboard/panels/escalations.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/escalations.js +1 -1
- package/dist/cli/dashboard/panels/escalations.js.map +1 -1
- package/dist/cli/dashboard/panels/merge-queue.d.ts +3 -3
- package/dist/cli/dashboard/panels/merge-queue.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/merge-queue.js +1 -1
- package/dist/cli/dashboard/panels/merge-queue.js.map +1 -1
- package/dist/cli/dashboard/panels/pipeline.d.ts +3 -3
- package/dist/cli/dashboard/panels/pipeline.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/pipeline.js +1 -1
- package/dist/cli/dashboard/panels/pipeline.js.map +1 -1
- package/dist/config/schema.d.ts +85 -82
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +1 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/connectors/project-management/operations.d.ts +7 -7
- package/dist/connectors/project-management/operations.d.ts.map +1 -1
- package/dist/connectors/project-management/operations.js +2 -3
- package/dist/connectors/project-management/operations.js.map +1 -1
- package/dist/context-files/index.test.js +1 -0
- package/dist/context-files/index.test.js.map +1 -1
- package/dist/db/client.d.ts +6 -0
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +7 -0
- package/dist/db/client.js.map +1 -1
- package/dist/db/postgres-provider.d.ts +43 -0
- package/dist/db/postgres-provider.d.ts.map +1 -0
- package/dist/db/postgres-provider.integration.test.d.ts +2 -0
- package/dist/db/postgres-provider.integration.test.d.ts.map +1 -0
- package/dist/db/postgres-provider.integration.test.js +399 -0
- package/dist/db/postgres-provider.integration.test.js.map +1 -0
- package/dist/db/postgres-provider.js +315 -0
- package/dist/db/postgres-provider.js.map +1 -0
- package/dist/db/postgres-provider.test.d.ts +2 -0
- package/dist/db/postgres-provider.test.d.ts.map +1 -0
- package/dist/db/postgres-provider.test.js +72 -0
- package/dist/db/postgres-provider.test.js.map +1 -0
- package/dist/db/provider.d.ts +59 -0
- package/dist/db/provider.d.ts.map +1 -0
- package/dist/db/provider.js +121 -0
- package/dist/db/provider.js.map +1 -0
- package/dist/db/provider.test.d.ts +2 -0
- package/dist/db/provider.test.d.ts.map +1 -0
- package/dist/db/provider.test.js +226 -0
- package/dist/db/provider.test.js.map +1 -0
- package/dist/db/queries/agents.d.ts +13 -13
- package/dist/db/queries/agents.d.ts.map +1 -1
- package/dist/db/queries/agents.js +27 -28
- package/dist/db/queries/agents.js.map +1 -1
- package/dist/db/queries/agents.test.js +113 -111
- package/dist/db/queries/agents.test.js.map +1 -1
- package/dist/db/queries/escalations.d.ts +16 -16
- package/dist/db/queries/escalations.d.ts.map +1 -1
- package/dist/db/queries/escalations.js +34 -35
- package/dist/db/queries/escalations.js.map +1 -1
- package/dist/db/queries/escalations.test.js +133 -131
- package/dist/db/queries/escalations.test.js.map +1 -1
- package/dist/db/queries/heartbeat.d.ts +5 -5
- package/dist/db/queries/heartbeat.d.ts.map +1 -1
- package/dist/db/queries/heartbeat.js +7 -23
- package/dist/db/queries/heartbeat.js.map +1 -1
- package/dist/db/queries/heartbeat.test.js +76 -76
- package/dist/db/queries/heartbeat.test.js.map +1 -1
- package/dist/db/queries/integration-sync.d.ts +7 -7
- package/dist/db/queries/integration-sync.d.ts.map +1 -1
- package/dist/db/queries/integration-sync.js +13 -14
- package/dist/db/queries/integration-sync.js.map +1 -1
- package/dist/db/queries/logs.d.ts +10 -10
- package/dist/db/queries/logs.d.ts.map +1 -1
- package/dist/db/queries/logs.js +44 -42
- package/dist/db/queries/logs.js.map +1 -1
- package/dist/db/queries/logs.test.js +149 -146
- package/dist/db/queries/logs.test.js.map +1 -1
- package/dist/db/queries/messages.d.ts +6 -6
- package/dist/db/queries/messages.d.ts.map +1 -1
- package/dist/db/queries/messages.js +12 -11
- package/dist/db/queries/messages.js.map +1 -1
- package/dist/db/queries/messages.test.js +47 -46
- package/dist/db/queries/messages.test.js.map +1 -1
- package/dist/db/queries/pull-requests.d.ts +18 -18
- package/dist/db/queries/pull-requests.d.ts.map +1 -1
- package/dist/db/queries/pull-requests.js +50 -48
- package/dist/db/queries/pull-requests.js.map +1 -1
- package/dist/db/queries/pull-requests.test.js +195 -198
- package/dist/db/queries/pull-requests.test.js.map +1 -1
- package/dist/db/queries/requirements.d.ts +8 -8
- package/dist/db/queries/requirements.d.ts.map +1 -1
- package/dist/db/queries/requirements.js +17 -18
- package/dist/db/queries/requirements.js.map +1 -1
- package/dist/db/queries/requirements.test.js +83 -81
- package/dist/db/queries/requirements.test.js.map +1 -1
- package/dist/db/queries/stories.d.ts +29 -29
- package/dist/db/queries/stories.d.ts.map +1 -1
- package/dist/db/queries/stories.js +58 -64
- package/dist/db/queries/stories.js.map +1 -1
- package/dist/db/queries/stories.test.js +172 -170
- package/dist/db/queries/stories.test.js.map +1 -1
- package/dist/db/queries/teams.d.ts +6 -6
- package/dist/db/queries/teams.d.ts.map +1 -1
- package/dist/db/queries/teams.js +11 -12
- package/dist/db/queries/teams.js.map +1 -1
- package/dist/db/queries/teams.test.js +36 -34
- package/dist/db/queries/teams.test.js.map +1 -1
- package/dist/integrations/jira/repair.test.js +26 -24
- package/dist/integrations/jira/repair.test.js.map +1 -1
- package/dist/integrations/jira/stories.d.ts +3 -3
- package/dist/integrations/jira/stories.d.ts.map +1 -1
- package/dist/integrations/jira/stories.js +12 -12
- package/dist/integrations/jira/stories.js.map +1 -1
- package/dist/integrations/jira/stories.test.js +10 -8
- package/dist/integrations/jira/stories.test.js.map +1 -1
- package/dist/integrations/jira/sync.d.ts +7 -7
- package/dist/integrations/jira/sync.d.ts.map +1 -1
- package/dist/integrations/jira/sync.js +17 -20
- package/dist/integrations/jira/sync.js.map +1 -1
- package/dist/integrations/jira/sync.test.js +63 -62
- package/dist/integrations/jira/sync.test.js.map +1 -1
- package/dist/integrations/jira/transitions.d.ts +3 -3
- package/dist/integrations/jira/transitions.d.ts.map +1 -1
- package/dist/integrations/jira/transitions.js +3 -3
- package/dist/integrations/jira/transitions.js.map +1 -1
- package/dist/orchestrator/agent-selector.d.ts +3 -3
- package/dist/orchestrator/agent-selector.d.ts.map +1 -1
- package/dist/orchestrator/agent-selector.js +5 -6
- package/dist/orchestrator/agent-selector.js.map +1 -1
- package/dist/orchestrator/dependency-resolver.d.ts +4 -4
- package/dist/orchestrator/dependency-resolver.d.ts.map +1 -1
- package/dist/orchestrator/dependency-resolver.js +6 -6
- package/dist/orchestrator/dependency-resolver.js.map +1 -1
- package/dist/orchestrator/feature-branch.d.ts +3 -3
- package/dist/orchestrator/feature-branch.d.ts.map +1 -1
- package/dist/orchestrator/feature-branch.js +9 -10
- package/dist/orchestrator/feature-branch.js.map +1 -1
- package/dist/orchestrator/feature-branch.test.js +80 -78
- package/dist/orchestrator/feature-branch.test.js.map +1 -1
- package/dist/orchestrator/orphan-recovery.d.ts +2 -2
- package/dist/orchestrator/orphan-recovery.d.ts.map +1 -1
- package/dist/orchestrator/orphan-recovery.js +10 -10
- package/dist/orchestrator/orphan-recovery.js.map +1 -1
- package/dist/orchestrator/scheduler.d.ts +4 -4
- package/dist/orchestrator/scheduler.d.ts.map +1 -1
- package/dist/orchestrator/scheduler.js +90 -76
- package/dist/orchestrator/scheduler.js.map +1 -1
- package/dist/orchestrator/scheduler.test.js +496 -374
- package/dist/orchestrator/scheduler.test.js.map +1 -1
- package/dist/utils/auto-merge.d.ts.map +1 -1
- package/dist/utils/auto-merge.js +74 -56
- package/dist/utils/auto-merge.js.map +1 -1
- package/dist/utils/auto-merge.test.js +101 -66
- package/dist/utils/auto-merge.test.js.map +1 -1
- package/dist/utils/cli-helpers.d.ts +5 -5
- package/dist/utils/cli-helpers.d.ts.map +1 -1
- package/dist/utils/cli-helpers.js +8 -9
- package/dist/utils/cli-helpers.js.map +1 -1
- package/dist/utils/cli-helpers.test.js +28 -30
- package/dist/utils/cli-helpers.test.js.map +1 -1
- package/dist/utils/paths.d.ts +6 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +12 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/paths.test.js +1 -0
- package/dist/utils/paths.test.js.map +1 -1
- package/dist/utils/pr-sync.d.ts +10 -10
- package/dist/utils/pr-sync.d.ts.map +1 -1
- package/dist/utils/pr-sync.js +20 -21
- package/dist/utils/pr-sync.js.map +1 -1
- package/dist/utils/pr-sync.test.js +52 -50
- package/dist/utils/pr-sync.test.js.map +1 -1
- package/dist/utils/with-hive-context.d.ts.map +1 -1
- package/dist/utils/with-hive-context.js +70 -1
- package/dist/utils/with-hive-context.js.map +1 -1
- package/package.json +3 -1
- package/src/agents/base-agent.test.ts +2 -1
- package/src/agents/base-agent.ts +32 -28
- package/src/agents/intermediate.ts +27 -18
- package/src/agents/junior.ts +27 -18
- package/src/agents/qa.ts +54 -40
- package/src/agents/senior.ts +42 -27
- package/src/agents/tech-lead.ts +42 -32
- package/src/cli/commands/add-repo.test.ts +1 -1
- package/src/cli/commands/add-repo.ts +2 -2
- package/src/cli/commands/agents.test.ts +7 -7
- package/src/cli/commands/agents.ts +12 -10
- package/src/cli/commands/approach.ts +2 -2
- package/src/cli/commands/approvals.test.ts +8 -8
- package/src/cli/commands/approvals.ts +9 -7
- package/src/cli/commands/assign.test.ts +19 -18
- package/src/cli/commands/assign.ts +4 -4
- package/src/cli/commands/cleanup.test.ts +5 -1
- package/src/cli/commands/cleanup.ts +11 -9
- package/src/cli/commands/escalations.test.ts +2 -2
- package/src/cli/commands/escalations.ts +9 -7
- package/src/cli/commands/init.test.ts +5 -0
- package/src/cli/commands/init.ts +53 -5
- package/src/cli/commands/manager/agent-monitoring.ts +3 -3
- package/src/cli/commands/manager/auditor-lifecycle.test.ts +21 -14
- package/src/cli/commands/manager/auditor-lifecycle.ts +3 -3
- package/src/cli/commands/manager/auto-reject-comment-only-reviews.test.ts +28 -23
- package/src/cli/commands/manager/escalation-handler.test.ts +13 -13
- package/src/cli/commands/manager/escalation-handler.ts +19 -12
- package/src/cli/commands/manager/feature-sign-off.test.ts +40 -31
- package/src/cli/commands/manager/feature-sign-off.ts +7 -7
- package/src/cli/commands/manager/feature-test-result.ts +13 -16
- package/src/cli/commands/manager/handoff-recovery.ts +20 -20
- package/src/cli/commands/manager/index.test.ts +4 -4
- package/src/cli/commands/manager/index.ts +58 -59
- package/src/cli/commands/manager/merged-story-cleanup.test.ts +28 -19
- package/src/cli/commands/manager/merged-story-cleanup.ts +11 -14
- package/src/cli/commands/manager/pr-sync-orchestrator.ts +115 -110
- package/src/cli/commands/manager/qa-review-handler.ts +50 -63
- package/src/cli/commands/manager/spin-down.ts +27 -25
- package/src/cli/commands/manager/stale-escalations.ts +2 -3
- package/src/cli/commands/manager/stuck-story-helpers.ts +10 -10
- package/src/cli/commands/manager/stuck-story-processor.ts +56 -62
- package/src/cli/commands/manager/tech-lead-lifecycle.ts +6 -6
- package/src/cli/commands/manager/types.ts +2 -3
- package/src/cli/commands/msg.test.ts +2 -2
- package/src/cli/commands/my-stories.test.ts +4 -2
- package/src/cli/commands/my-stories.ts +22 -27
- package/src/cli/commands/nuke.test.ts +1 -1
- package/src/cli/commands/pr.test.ts +10 -6
- package/src/cli/commands/pr.ts +41 -32
- package/src/cli/commands/progress.test.ts +1 -1
- package/src/cli/commands/progress.ts +11 -6
- package/src/cli/commands/req-headless.test.ts +170 -0
- package/src/cli/commands/req-spawn.test.ts +12 -2
- package/src/cli/commands/req.ts +13 -14
- package/src/cli/commands/resume.test.ts +1 -1
- package/src/cli/commands/resume.ts +7 -8
- package/src/cli/commands/status.test.ts +1 -1
- package/src/cli/commands/status.ts +52 -40
- package/src/cli/commands/stories.test.ts +4 -2
- package/src/cli/commands/stories.ts +11 -11
- package/src/cli/commands/teams.test.ts +2 -2
- package/src/cli/commands/teams.ts +11 -11
- package/src/cli/dashboard/index.test.ts +35 -34
- package/src/cli/dashboard/index.ts +34 -23
- package/src/cli/dashboard/panels/activity.ts +10 -4
- package/src/cli/dashboard/panels/agents.ts +8 -5
- package/src/cli/dashboard/panels/escalations.ts +4 -4
- package/src/cli/dashboard/panels/merge-queue.ts +4 -4
- package/src/cli/dashboard/panels/pipeline.ts +10 -4
- package/src/config/schema.ts +1 -0
- package/src/connectors/project-management/operations.ts +9 -10
- package/src/context-files/index.test.ts +1 -0
- package/src/db/client.ts +17 -0
- package/src/db/pg-migrations/001-full-schema.sql +209 -0
- package/src/db/postgres-provider.integration.test.ts +574 -0
- package/src/db/postgres-provider.test.ts +97 -0
- package/src/db/postgres-provider.ts +364 -0
- package/src/db/provider.test.ts +283 -0
- package/src/db/provider.ts +161 -0
- package/src/db/queries/agents.test.ts +114 -113
- package/src/db/queries/agents.ts +50 -36
- package/src/db/queries/escalations.test.ts +134 -133
- package/src/db/queries/escalations.ts +72 -57
- package/src/db/queries/heartbeat.test.ts +77 -78
- package/src/db/queries/heartbeat.ts +24 -46
- package/src/db/queries/integration-sync.ts +26 -26
- package/src/db/queries/logs.test.ts +151 -148
- package/src/db/queries/logs.ts +78 -53
- package/src/db/queries/messages.test.ts +48 -50
- package/src/db/queries/messages.ts +26 -18
- package/src/db/queries/pull-requests.test.ts +194 -199
- package/src/db/queries/pull-requests.ts +117 -88
- package/src/db/queries/requirements.test.ts +84 -83
- package/src/db/queries/requirements.ts +33 -28
- package/src/db/queries/stories.test.ts +173 -172
- package/src/db/queries/stories.ts +141 -110
- package/src/db/queries/teams.test.ts +37 -36
- package/src/db/queries/teams.ts +22 -14
- package/src/integrations/jira/repair.test.ts +27 -26
- package/src/integrations/jira/stories.test.ts +15 -16
- package/src/integrations/jira/stories.ts +15 -15
- package/src/integrations/jira/sync.test.ts +68 -68
- package/src/integrations/jira/sync.ts +29 -39
- package/src/integrations/jira/transitions.ts +6 -6
- package/src/orchestrator/agent-selector.ts +9 -8
- package/src/orchestrator/dependency-resolver.ts +16 -7
- package/src/orchestrator/feature-branch.test.ts +85 -80
- package/src/orchestrator/feature-branch.ts +13 -14
- package/src/orchestrator/orphan-recovery.ts +14 -13
- package/src/orchestrator/scheduler.test.ts +536 -394
- package/src/orchestrator/scheduler.ts +129 -115
- package/src/utils/auto-merge.test.ts +102 -68
- package/src/utils/auto-merge.ts +161 -168
- package/src/utils/cli-helpers.test.ts +30 -32
- package/src/utils/cli-helpers.ts +15 -11
- package/src/utils/paths.test.ts +1 -0
- package/src/utils/paths.ts +14 -1
- package/src/utils/pr-sync.test.ts +55 -52
- package/src/utils/pr-sync.ts +27 -32
- package/src/utils/with-hive-context.ts +89 -1
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import type { StoryRow } from '../../../db/client.js';
|
|
5
|
-
import { queryAll, withTransaction } from '../../../db/client.js';
|
|
6
5
|
import { getAgentById, updateAgent } from '../../../db/queries/agents.js';
|
|
7
6
|
import { createLog } from '../../../db/queries/logs.js';
|
|
8
7
|
import { updateStoryAssignment } from '../../../db/queries/stories.js';
|
|
@@ -18,8 +17,7 @@ function verboseLog(ctx: Pick<ManagerCheckContext, 'verbose'>, message: string):
|
|
|
18
17
|
export async function spinDownMergedAgents(ctx: ManagerCheckContext): Promise<void> {
|
|
19
18
|
// Phase 1: Read merged stories and determine actions (brief lock)
|
|
20
19
|
const actions = await ctx.withDb(async db => {
|
|
21
|
-
const mergedStoriesWithAgents = queryAll<StoryRow>(
|
|
22
|
-
db.db,
|
|
20
|
+
const mergedStoriesWithAgents = await db.provider.queryAll<StoryRow>(
|
|
23
21
|
`SELECT * FROM stories WHERE status = 'merged' AND assigned_agent_id IS NOT NULL`
|
|
24
22
|
);
|
|
25
23
|
verboseLog(ctx, `spinDownMergedAgents: mergedStories=${mergedStoriesWithAgents.length}`);
|
|
@@ -42,7 +40,7 @@ export async function spinDownMergedAgents(ctx: ManagerCheckContext): Promise<vo
|
|
|
42
40
|
for (const story of mergedStoriesWithAgents) {
|
|
43
41
|
if (!story.assigned_agent_id) continue;
|
|
44
42
|
|
|
45
|
-
const agent = getAgentById(db.
|
|
43
|
+
const agent = await getAgentById(db.provider, story.assigned_agent_id);
|
|
46
44
|
if (!agent || agent.status === 'terminated') {
|
|
47
45
|
verboseLog(
|
|
48
46
|
ctx,
|
|
@@ -53,9 +51,10 @@ export async function spinDownMergedAgents(ctx: ManagerCheckContext): Promise<vo
|
|
|
53
51
|
|
|
54
52
|
// Safety: Don't kill agents that are working on other stories
|
|
55
53
|
if (agent.current_story_id && agent.current_story_id !== story.id) {
|
|
56
|
-
await withTransaction(
|
|
57
|
-
updateStoryAssignment(db.
|
|
54
|
+
await db.provider.withTransaction(async () => {
|
|
55
|
+
await updateStoryAssignment(db.provider, story.id, null);
|
|
58
56
|
});
|
|
57
|
+
db.save();
|
|
59
58
|
verboseLog(
|
|
60
59
|
ctx,
|
|
61
60
|
`spinDownMergedAgents: story=${story.id} cleared assignment; agent=${agent.id} moved_to=${agent.current_story_id}`
|
|
@@ -64,15 +63,15 @@ export async function spinDownMergedAgents(ctx: ManagerCheckContext): Promise<vo
|
|
|
64
63
|
}
|
|
65
64
|
|
|
66
65
|
// Check if agent has other non-merged stories assigned
|
|
67
|
-
const otherActiveStories = queryAll<StoryRow>(
|
|
68
|
-
db.db,
|
|
66
|
+
const otherActiveStories = await db.provider.queryAll<StoryRow>(
|
|
69
67
|
`SELECT * FROM stories WHERE assigned_agent_id = ? AND id != ? AND status NOT IN ('merged', 'draft')`,
|
|
70
68
|
[agent.id, story.id]
|
|
71
69
|
);
|
|
72
70
|
if (otherActiveStories.length > 0) {
|
|
73
|
-
await withTransaction(
|
|
74
|
-
updateStoryAssignment(db.
|
|
71
|
+
await db.provider.withTransaction(async () => {
|
|
72
|
+
await updateStoryAssignment(db.provider, story.id, null);
|
|
75
73
|
});
|
|
74
|
+
db.save();
|
|
76
75
|
verboseLog(
|
|
77
76
|
ctx,
|
|
78
77
|
`spinDownMergedAgents: story=${story.id} cleared assignment; agent=${agent.id} has_other_active=${otherActiveStories.length}`
|
|
@@ -93,19 +92,17 @@ export async function spinDownMergedAgents(ctx: ManagerCheckContext): Promise<vo
|
|
|
93
92
|
}
|
|
94
93
|
|
|
95
94
|
// Also find working agents with no current story that have no active stories assigned
|
|
96
|
-
const orphanedWorkingAgents = queryAll<{
|
|
95
|
+
const orphanedWorkingAgents = await db.provider.queryAll<{
|
|
97
96
|
id: string;
|
|
98
97
|
tmux_session: string | null;
|
|
99
98
|
type: string;
|
|
100
99
|
}>(
|
|
101
|
-
db.db,
|
|
102
100
|
`SELECT id, tmux_session, type FROM agents
|
|
103
101
|
WHERE status = 'working' AND current_story_id IS NULL AND type != 'tech_lead'`
|
|
104
102
|
);
|
|
105
103
|
|
|
106
104
|
for (const agent of orphanedWorkingAgents) {
|
|
107
|
-
const activeStories = queryAll<StoryRow>(
|
|
108
|
-
db.db,
|
|
105
|
+
const activeStories = await db.provider.queryAll<StoryRow>(
|
|
109
106
|
`SELECT * FROM stories WHERE assigned_agent_id = ? AND status NOT IN ('merged', 'draft')`,
|
|
110
107
|
[agent.id]
|
|
111
108
|
);
|
|
@@ -150,9 +147,12 @@ export async function spinDownMergedAgents(ctx: ManagerCheckContext): Promise<vo
|
|
|
150
147
|
if (spindownActions.length > 0) {
|
|
151
148
|
await ctx.withDb(async db => {
|
|
152
149
|
for (const action of spindownActions) {
|
|
153
|
-
await withTransaction(
|
|
154
|
-
updateAgent(db.
|
|
155
|
-
|
|
150
|
+
await db.provider.withTransaction(async () => {
|
|
151
|
+
await updateAgent(db.provider, action.agentId, {
|
|
152
|
+
status: 'terminated',
|
|
153
|
+
currentStoryId: null,
|
|
154
|
+
});
|
|
155
|
+
await createLog(db.provider, {
|
|
156
156
|
agentId: action.agentId,
|
|
157
157
|
storyId: action.storyId || undefined,
|
|
158
158
|
eventType: 'AGENT_TERMINATED',
|
|
@@ -161,7 +161,7 @@ export async function spinDownMergedAgents(ctx: ManagerCheckContext): Promise<vo
|
|
|
161
161
|
: `Agent spun down: status was working with no current story and no active stories`,
|
|
162
162
|
});
|
|
163
163
|
if (action.storyId) {
|
|
164
|
-
updateStoryAssignment(db.
|
|
164
|
+
await updateStoryAssignment(db.provider, action.storyId, null);
|
|
165
165
|
}
|
|
166
166
|
});
|
|
167
167
|
verboseLog(
|
|
@@ -181,8 +181,7 @@ export async function spinDownMergedAgents(ctx: ManagerCheckContext): Promise<vo
|
|
|
181
181
|
export async function spinDownIdleAgents(ctx: ManagerCheckContext): Promise<void> {
|
|
182
182
|
// Phase 1: Read agent state (brief lock)
|
|
183
183
|
const workingAgents = await ctx.withDb(async db => {
|
|
184
|
-
const activeStories = queryAll<StoryRow>(
|
|
185
|
-
db.db,
|
|
184
|
+
const activeStories = await db.provider.queryAll<StoryRow>(
|
|
186
185
|
`SELECT * FROM stories WHERE status IN ('planned', 'in_progress', 'review', 'qa', 'qa_failed', 'pr_submitted')`
|
|
187
186
|
);
|
|
188
187
|
verboseLog(ctx, `spinDownIdleAgents: activeStories=${activeStories.length}`);
|
|
@@ -192,8 +191,11 @@ export async function spinDownIdleAgents(ctx: ManagerCheckContext): Promise<void
|
|
|
192
191
|
return [];
|
|
193
192
|
}
|
|
194
193
|
|
|
195
|
-
const agents = queryAll<{
|
|
196
|
-
|
|
194
|
+
const agents = await db.provider.queryAll<{
|
|
195
|
+
id: string;
|
|
196
|
+
tmux_session: string | null;
|
|
197
|
+
type: string;
|
|
198
|
+
}>(
|
|
197
199
|
`SELECT id, tmux_session, type FROM agents WHERE status = 'working' AND type != 'tech_lead'`
|
|
198
200
|
);
|
|
199
201
|
verboseLog(ctx, `spinDownIdleAgents: workingAgents=${agents.length}`);
|
|
@@ -218,9 +220,9 @@ export async function spinDownIdleAgents(ctx: ManagerCheckContext): Promise<void
|
|
|
218
220
|
// Phase 3: DB writes (brief lock)
|
|
219
221
|
await ctx.withDb(async db => {
|
|
220
222
|
for (const agent of workingAgents) {
|
|
221
|
-
await withTransaction(
|
|
222
|
-
updateAgent(db.
|
|
223
|
-
createLog(db.
|
|
223
|
+
await db.provider.withTransaction(async () => {
|
|
224
|
+
await updateAgent(db.provider, agent.id, { status: 'terminated', currentStoryId: null });
|
|
225
|
+
await createLog(db.provider, {
|
|
224
226
|
agentId: agent.id,
|
|
225
227
|
eventType: 'AGENT_TERMINATED',
|
|
226
228
|
message: 'Agent spun down - no work remaining in pipeline',
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// Licensed under the Hungry Ghost Hive License. See LICENSE.
|
|
2
2
|
|
|
3
|
-
import type { EscalationRow } from '../../../db/client.js';
|
|
4
|
-
import type { getAllAgents } from '../../../db/queries/agents.js';
|
|
3
|
+
import type { AgentRow, EscalationRow } from '../../../db/client.js';
|
|
5
4
|
|
|
6
|
-
type AgentRecord =
|
|
5
|
+
type AgentRecord = AgentRow;
|
|
7
6
|
|
|
8
7
|
export interface FindStaleSessionEscalationsInput {
|
|
9
8
|
pendingEscalations: EscalationRow[];
|
|
@@ -106,13 +106,13 @@ export async function applyHumanInterventionStateOverride(
|
|
|
106
106
|
? null
|
|
107
107
|
: await ctx.withDb(async db => {
|
|
108
108
|
return (
|
|
109
|
-
(agentId ? getActiveEscalationsForAgent(db.
|
|
109
|
+
(agentId ? await getActiveEscalationsForAgent(db.provider, agentId) : []).find(
|
|
110
110
|
escalation =>
|
|
111
111
|
escalation.story_id === storyId &&
|
|
112
112
|
(escalation.reason.startsWith(CLASSIFIER_TIMEOUT_REASON_PREFIX) ||
|
|
113
113
|
escalation.reason.startsWith(AI_DONE_FALSE_REASON_PREFIX))
|
|
114
114
|
) ??
|
|
115
|
-
getPendingEscalations(db.
|
|
115
|
+
(await getPendingEscalations(db.provider)).find(
|
|
116
116
|
escalation =>
|
|
117
117
|
escalation.story_id === storyId &&
|
|
118
118
|
(escalation.reason.startsWith(CLASSIFIER_TIMEOUT_REASON_PREFIX) ||
|
|
@@ -158,16 +158,16 @@ export async function markClassifierTimeoutForHumanIntervention(
|
|
|
158
158
|
|
|
159
159
|
await ctx.withDb(async db => {
|
|
160
160
|
const activeTimeoutEscalation = (
|
|
161
|
-
agentId ? getActiveEscalationsForAgent(db.
|
|
161
|
+
agentId ? await getActiveEscalationsForAgent(db.provider, agentId) : []
|
|
162
162
|
).some(escalation => escalation.reason.startsWith(CLASSIFIER_TIMEOUT_REASON_PREFIX));
|
|
163
163
|
if (!activeTimeoutEscalation) {
|
|
164
|
-
const escalation = createEscalation(db.
|
|
164
|
+
const escalation = await createEscalation(db.provider, {
|
|
165
165
|
storyId,
|
|
166
166
|
fromAgentId: agentId,
|
|
167
167
|
toAgentId: null,
|
|
168
168
|
reason: escalationReason,
|
|
169
169
|
});
|
|
170
|
-
createLog(db.
|
|
170
|
+
await createLog(db.provider, {
|
|
171
171
|
agentId: 'manager',
|
|
172
172
|
storyId,
|
|
173
173
|
eventType: 'ESCALATION_CREATED',
|
|
@@ -213,17 +213,17 @@ export async function markDoneFalseForHumanIntervention(
|
|
|
213
213
|
});
|
|
214
214
|
|
|
215
215
|
await ctx.withDb(async db => {
|
|
216
|
-
const hasActiveEscalation = (
|
|
217
|
-
|
|
218
|
-
);
|
|
216
|
+
const hasActiveEscalation = (
|
|
217
|
+
agentId ? await getActiveEscalationsForAgent(db.provider, agentId) : []
|
|
218
|
+
).some(escalation => escalation.reason.startsWith(AI_DONE_FALSE_REASON_PREFIX));
|
|
219
219
|
if (!hasActiveEscalation) {
|
|
220
|
-
const escalation = createEscalation(db.
|
|
220
|
+
const escalation = await createEscalation(db.provider, {
|
|
221
221
|
storyId,
|
|
222
222
|
fromAgentId: agentId,
|
|
223
223
|
toAgentId: null,
|
|
224
224
|
reason: escalationReason,
|
|
225
225
|
});
|
|
226
|
-
createLog(db.
|
|
226
|
+
await createLog(db.provider, {
|
|
227
227
|
agentId: 'manager',
|
|
228
228
|
storyId,
|
|
229
229
|
eventType: 'ESCALATION_CREATED',
|
|
@@ -5,8 +5,8 @@ import { execa } from 'execa';
|
|
|
5
5
|
import { join } from 'path';
|
|
6
6
|
import { syncStatusForStory } from '../../../connectors/project-management/operations.js';
|
|
7
7
|
import type { StoryRow } from '../../../db/client.js';
|
|
8
|
-
import {
|
|
9
|
-
import { getAgentById
|
|
8
|
+
import type { AgentRow } from '../../../db/queries/agents.js';
|
|
9
|
+
import { getAgentById } from '../../../db/queries/agents.js';
|
|
10
10
|
import { createLog } from '../../../db/queries/logs.js';
|
|
11
11
|
import {
|
|
12
12
|
createPullRequest,
|
|
@@ -52,12 +52,13 @@ export async function nudgeStuckStories(ctx: ManagerCheckContext): Promise<void>
|
|
|
52
52
|
|
|
53
53
|
// Phase 1: Read stuck stories and agents (brief lock)
|
|
54
54
|
const candidates = await ctx.withDb(async db => {
|
|
55
|
-
const stuckStories =
|
|
56
|
-
db.
|
|
57
|
-
|
|
55
|
+
const stuckStories = (
|
|
56
|
+
await db.provider.queryAll<StoryRow>(
|
|
57
|
+
`SELECT * FROM stories
|
|
58
58
|
WHERE status = 'in_progress'
|
|
59
59
|
AND updated_at < ?`,
|
|
60
|
-
|
|
60
|
+
[staleUpdatedAt]
|
|
61
|
+
)
|
|
61
62
|
).filter(story => !['merged', 'completed'].includes(story.status));
|
|
62
63
|
verboseLogCtx(
|
|
63
64
|
ctx,
|
|
@@ -66,7 +67,7 @@ export async function nudgeStuckStories(ctx: ManagerCheckContext): Promise<void>
|
|
|
66
67
|
|
|
67
68
|
const result: Array<{
|
|
68
69
|
story: StoryRow;
|
|
69
|
-
agent:
|
|
70
|
+
agent: AgentRow;
|
|
70
71
|
sessionName: string;
|
|
71
72
|
cliTool: CLITool;
|
|
72
73
|
}> = [];
|
|
@@ -77,7 +78,7 @@ export async function nudgeStuckStories(ctx: ManagerCheckContext): Promise<void>
|
|
|
77
78
|
verboseLogCtx(ctx, `nudgeStuckStories: story=${story.id} skip=no_assigned_agent`);
|
|
78
79
|
continue;
|
|
79
80
|
}
|
|
80
|
-
const agent = getAgentById(db.
|
|
81
|
+
const agent = await getAgentById(db.provider, story.assigned_agent_id);
|
|
81
82
|
if (!agent) {
|
|
82
83
|
verboseLogCtx(ctx, `nudgeStuckStories: story=${story.id} skip=missing_agent`);
|
|
83
84
|
continue;
|
|
@@ -331,7 +332,7 @@ export async function nudgeStuckStories(ctx: ManagerCheckContext): Promise<void>
|
|
|
331
332
|
export async function autoProgressDoneStory(
|
|
332
333
|
ctx: ManagerCheckContext,
|
|
333
334
|
story: StoryRow,
|
|
334
|
-
agent:
|
|
335
|
+
agent: AgentRow,
|
|
335
336
|
sessionName: string,
|
|
336
337
|
reason: string,
|
|
337
338
|
confidence: number
|
|
@@ -348,12 +349,12 @@ export async function autoProgressDoneStory(
|
|
|
348
349
|
|
|
349
350
|
// DB operations under brief lock
|
|
350
351
|
const action = await ctx.withDb(async (db, scheduler) => {
|
|
351
|
-
const openPRs = getOpenPullRequestsByStory(db.
|
|
352
|
+
const openPRs = await getOpenPullRequestsByStory(db.provider, story.id);
|
|
352
353
|
verboseLogCtx(ctx, `autoProgressDoneStory: story=${story.id}, openPRs=${openPRs.length}`);
|
|
353
354
|
if (openPRs.length > 0) {
|
|
354
355
|
if (story.status !== 'pr_submitted') {
|
|
355
|
-
updateStory(db.
|
|
356
|
-
createLog(db.
|
|
356
|
+
await updateStory(db.provider, story.id, { status: 'pr_submitted' });
|
|
357
|
+
await createLog(db.provider, {
|
|
357
358
|
agentId: 'manager',
|
|
358
359
|
storyId: story.id,
|
|
359
360
|
eventType: 'STORY_PROGRESS_UPDATE',
|
|
@@ -367,7 +368,7 @@ export async function autoProgressDoneStory(
|
|
|
367
368
|
},
|
|
368
369
|
});
|
|
369
370
|
db.save();
|
|
370
|
-
await syncStatusForStory(ctx.root, db.
|
|
371
|
+
await syncStatusForStory(ctx.root, db.provider, story.id, 'pr_submitted');
|
|
371
372
|
verboseLogCtx(ctx, `autoProgressDoneStory: story=${story.id} status moved to pr_submitted`);
|
|
372
373
|
}
|
|
373
374
|
return 'existing_pr' as const;
|
|
@@ -378,33 +379,30 @@ export async function autoProgressDoneStory(
|
|
|
378
379
|
return 'no_branch' as const;
|
|
379
380
|
}
|
|
380
381
|
|
|
381
|
-
await withTransaction(
|
|
382
|
-
db.
|
|
383
|
-
(
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
() => db.save()
|
|
406
|
-
);
|
|
407
|
-
await syncStatusForStory(ctx.root, db.db, story.id, 'pr_submitted');
|
|
382
|
+
await db.provider.withTransaction(async () => {
|
|
383
|
+
await updateStory(db.provider, story.id, { status: 'pr_submitted', branchName: branch });
|
|
384
|
+
await createPullRequest(db.provider, {
|
|
385
|
+
storyId: story.id,
|
|
386
|
+
teamId: story.team_id || null,
|
|
387
|
+
branchName: branch,
|
|
388
|
+
submittedBy: sessionName,
|
|
389
|
+
});
|
|
390
|
+
await createLog(db.provider, {
|
|
391
|
+
agentId: 'manager',
|
|
392
|
+
storyId: story.id,
|
|
393
|
+
eventType: 'PR_SUBMITTED',
|
|
394
|
+
message: `Auto-submitted PR for ${story.id} after AI completion inference`,
|
|
395
|
+
metadata: {
|
|
396
|
+
session_name: sessionName,
|
|
397
|
+
recovery: 'done_inference_auto_submit',
|
|
398
|
+
reason,
|
|
399
|
+
confidence,
|
|
400
|
+
branch,
|
|
401
|
+
},
|
|
402
|
+
});
|
|
403
|
+
});
|
|
404
|
+
db.save();
|
|
405
|
+
await syncStatusForStory(ctx.root, db.provider, story.id, 'pr_submitted');
|
|
408
406
|
await scheduler.checkMergeQueue();
|
|
409
407
|
db.save();
|
|
410
408
|
verboseLogCtx(
|
|
@@ -440,7 +438,7 @@ export async function autoProgressDoneStory(
|
|
|
440
438
|
async function resolveStoryBranchName(
|
|
441
439
|
root: string,
|
|
442
440
|
story: StoryRow,
|
|
443
|
-
agent:
|
|
441
|
+
agent: AgentRow,
|
|
444
442
|
log?: (message: string) => void
|
|
445
443
|
): Promise<string | null> {
|
|
446
444
|
if (story.branch_name && story.branch_name.trim().length > 0) {
|
|
@@ -472,7 +470,7 @@ async function resolveStoryBranchName(
|
|
|
472
470
|
export async function nudgeQAFailedStories(ctx: ManagerCheckContext): Promise<void> {
|
|
473
471
|
// Phase 1: Read QA-failed stories and agents (brief lock)
|
|
474
472
|
const candidates = await ctx.withDb(async db => {
|
|
475
|
-
const qaFailedStories = getStoriesByStatus(db.
|
|
473
|
+
const qaFailedStories = (await getStoriesByStatus(db.provider, 'qa_failed')).filter(
|
|
476
474
|
story => !['merged', 'completed'].includes(story.status)
|
|
477
475
|
);
|
|
478
476
|
verboseLogCtx(ctx, `nudgeQAFailedStories: candidates=${qaFailedStories.length}`);
|
|
@@ -483,7 +481,7 @@ export async function nudgeQAFailedStories(ctx: ManagerCheckContext): Promise<vo
|
|
|
483
481
|
verboseLogCtx(ctx, `nudgeQAFailedStories: story=${story.id} skip=no_assigned_agent`);
|
|
484
482
|
continue;
|
|
485
483
|
}
|
|
486
|
-
const agent = getAgentById(db.
|
|
484
|
+
const agent = await getAgentById(db.provider, story.assigned_agent_id);
|
|
487
485
|
if (!agent || agent.status !== 'working') {
|
|
488
486
|
verboseLogCtx(
|
|
489
487
|
ctx,
|
|
@@ -538,8 +536,7 @@ hive pr queue`
|
|
|
538
536
|
|
|
539
537
|
export async function recoverUnassignedQAFailedStories(ctx: ManagerCheckContext): Promise<void> {
|
|
540
538
|
const result = await ctx.withDb(async (db, scheduler) => {
|
|
541
|
-
const recoverableStories = queryAll<StoryRow>(
|
|
542
|
-
db.db,
|
|
539
|
+
const recoverableStories = await db.provider.queryAll<StoryRow>(
|
|
543
540
|
`
|
|
544
541
|
SELECT * FROM stories
|
|
545
542
|
WHERE status = 'qa_failed'
|
|
@@ -550,25 +547,22 @@ export async function recoverUnassignedQAFailedStories(ctx: ManagerCheckContext)
|
|
|
550
547
|
if (recoverableStories.length === 0) return null;
|
|
551
548
|
verboseLogCtx(ctx, `recoverUnassignedQAFailedStories: recovered=${recoverableStories.length}`);
|
|
552
549
|
|
|
553
|
-
await withTransaction(
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
},
|
|
567
|
-
() => db.save()
|
|
568
|
-
);
|
|
550
|
+
await db.provider.withTransaction(async () => {
|
|
551
|
+
for (const story of recoverableStories) {
|
|
552
|
+
await updateStory(db.provider, story.id, { status: 'planned', assignedAgentId: null });
|
|
553
|
+
await createLog(db.provider, {
|
|
554
|
+
agentId: 'manager',
|
|
555
|
+
storyId: story.id,
|
|
556
|
+
eventType: 'ORPHANED_STORY_RECOVERED',
|
|
557
|
+
message: `Recovered QA-failed story ${story.id} (unassigned) back to planned`,
|
|
558
|
+
metadata: { from_status: 'qa_failed', to_status: 'planned' },
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
db.save();
|
|
569
563
|
|
|
570
564
|
for (const story of recoverableStories) {
|
|
571
|
-
await syncStatusForStory(ctx.root, db.
|
|
565
|
+
await syncStatusForStory(ctx.root, db.provider, story.id, 'planned');
|
|
572
566
|
}
|
|
573
567
|
|
|
574
568
|
// Proactively re-assign recovered work so it does not stall until manual `hive assign`.
|
|
@@ -33,7 +33,7 @@ export async function restartStaleTechLead(ctx: ManagerCheckContext): Promise<vo
|
|
|
33
33
|
|
|
34
34
|
// Phase 1: Read tech lead agents (brief lock)
|
|
35
35
|
const techLeads = await ctx.withDb(async db => {
|
|
36
|
-
const leads = getAgentsByType(db.
|
|
36
|
+
const leads = await getAgentsByType(db.provider, 'tech_lead');
|
|
37
37
|
verboseLogCtx(ctx, `restartStaleTechLead: found ${leads.length} tech lead agent(s)`);
|
|
38
38
|
return leads.map(tl => ({
|
|
39
39
|
id: tl.id,
|
|
@@ -139,10 +139,10 @@ export async function restartStaleTechLead(ctx: ManagerCheckContext): Promise<vo
|
|
|
139
139
|
|
|
140
140
|
// Look up active requirement and teams to provide context to the restarted tech lead
|
|
141
141
|
const initialPrompt = await ctx.withDb(async db => {
|
|
142
|
-
const planningReqs = getRequirementsByStatus(db.
|
|
143
|
-
const inProgressReqs = getRequirementsByStatus(db.
|
|
142
|
+
const planningReqs = await getRequirementsByStatus(db.provider, 'planning');
|
|
143
|
+
const inProgressReqs = await getRequirementsByStatus(db.provider, 'in_progress');
|
|
144
144
|
const activeReq = planningReqs[0] ?? inProgressReqs[0] ?? null;
|
|
145
|
-
const teams = getAllTeams(db.
|
|
145
|
+
const teams = await getAllTeams(db.provider);
|
|
146
146
|
|
|
147
147
|
if (activeReq) {
|
|
148
148
|
return generateTechLeadPrompt(
|
|
@@ -185,7 +185,7 @@ hive msg inbox ${techLeadInbox}
|
|
|
185
185
|
|
|
186
186
|
// DB writes under brief lock
|
|
187
187
|
await ctx.withDb(async db => {
|
|
188
|
-
createLog(db.
|
|
188
|
+
await createLog(db.provider, {
|
|
189
189
|
agentId: 'manager',
|
|
190
190
|
eventType: 'AGENT_SPAWNED',
|
|
191
191
|
status: 'info',
|
|
@@ -198,7 +198,7 @@ hive msg inbox ${techLeadInbox}
|
|
|
198
198
|
restart_reason: 'context_freshness',
|
|
199
199
|
},
|
|
200
200
|
});
|
|
201
|
-
updateAgent(db.
|
|
201
|
+
await updateAgent(db.provider, techLead.id, {
|
|
202
202
|
status: 'working',
|
|
203
203
|
createdAt: new Date().toISOString(),
|
|
204
204
|
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// Licensed under the Hungry Ghost Hive License. See LICENSE.
|
|
2
2
|
|
|
3
3
|
import type { HiveConfig } from '../../../config/schema.js';
|
|
4
|
-
import type { DatabaseClient, StoryRow } from '../../../db/client.js';
|
|
5
|
-
import type { getAllAgents } from '../../../db/queries/agents.js';
|
|
4
|
+
import type { AgentRow, DatabaseClient, StoryRow } from '../../../db/client.js';
|
|
6
5
|
import type { MessageRow } from '../../../db/queries/messages.js';
|
|
7
6
|
import type { Scheduler } from '../../../orchestrator/scheduler.js';
|
|
8
7
|
import type { TmuxSession } from '../../../tmux/manager.js';
|
|
@@ -86,7 +85,7 @@ export interface ManagerCheckContext {
|
|
|
86
85
|
};
|
|
87
86
|
// Shared state for dedup
|
|
88
87
|
escalatedSessions: Set<string | null>;
|
|
89
|
-
agentsBySessionName: Map<string,
|
|
88
|
+
agentsBySessionName: Map<string, AgentRow>;
|
|
90
89
|
messagesToMarkRead: string[];
|
|
91
90
|
}
|
|
92
91
|
|
|
@@ -10,8 +10,8 @@ vi.mock('../../db/client.js', () => ({
|
|
|
10
10
|
}));
|
|
11
11
|
|
|
12
12
|
vi.mock('../../utils/with-hive-context.js', () => ({
|
|
13
|
-
withHiveContext: vi.fn(callback => callback({ db: { db: {}, save: vi.fn() } })),
|
|
14
|
-
withReadOnlyHiveContext: vi.fn(callback => callback({ db: { db: {} } })),
|
|
13
|
+
withHiveContext: vi.fn(callback => callback({ db: { db: {}, provider: {}, save: vi.fn() } })),
|
|
14
|
+
withReadOnlyHiveContext: vi.fn(callback => callback({ db: { db: {}, provider: {} } })),
|
|
15
15
|
}));
|
|
16
16
|
|
|
17
17
|
import { msgCommand } from './msg.js';
|
|
@@ -24,8 +24,10 @@ vi.mock('../../integrations/jira/transitions.js', () => ({
|
|
|
24
24
|
}));
|
|
25
25
|
|
|
26
26
|
vi.mock('../../utils/with-hive-context.js', () => ({
|
|
27
|
-
withHiveContext: vi.fn(callback =>
|
|
28
|
-
|
|
27
|
+
withHiveContext: vi.fn(callback =>
|
|
28
|
+
callback({ db: { db: {}, provider: {}, save: vi.fn() }, root: '/tmp' })
|
|
29
|
+
),
|
|
30
|
+
withReadOnlyHiveContext: vi.fn(callback => callback({ db: { db: {}, provider: {} } })),
|
|
29
31
|
}));
|
|
30
32
|
|
|
31
33
|
import { myStoriesCommand } from './my-stories.js';
|