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
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
// Licensed under the Hungry Ghost Hive License. See LICENSE.
|
|
2
|
+
|
|
3
|
+
import type { Database as SqlJsDatabase } from 'sql.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Abstract database provider interface that supports both SQLite and Postgres backends.
|
|
7
|
+
* All methods are async to support inherently asynchronous backends like Postgres.
|
|
8
|
+
*/
|
|
9
|
+
export interface DatabaseProvider {
|
|
10
|
+
queryAll<T>(sql: string, params?: unknown[]): Promise<T[]>;
|
|
11
|
+
queryOne<T>(sql: string, params?: unknown[]): Promise<T | undefined>;
|
|
12
|
+
run(sql: string, params?: unknown[]): Promise<void>;
|
|
13
|
+
withTransaction<T>(fn: () => Promise<T> | T): Promise<T>;
|
|
14
|
+
close(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Extended provider for writable database connections that support persistence.
|
|
19
|
+
*/
|
|
20
|
+
export interface WritableDatabaseProvider extends DatabaseProvider {
|
|
21
|
+
save(): void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Result type for query operations (useful for Postgres which returns metadata).
|
|
26
|
+
*/
|
|
27
|
+
export interface QueryResult<T> {
|
|
28
|
+
rows: T[];
|
|
29
|
+
rowCount: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* SQLite implementation of DatabaseProvider using sql.js.
|
|
34
|
+
* Wraps an in-memory sql.js Database with the provider interface.
|
|
35
|
+
* Methods return resolved Promises wrapping synchronous sql.js operations.
|
|
36
|
+
*/
|
|
37
|
+
export class SqliteProvider implements WritableDatabaseProvider {
|
|
38
|
+
/**
|
|
39
|
+
* Direct access to the underlying sql.js Database.
|
|
40
|
+
* Exposed for backward compatibility during the migration period.
|
|
41
|
+
* New code should use the provider methods instead.
|
|
42
|
+
*/
|
|
43
|
+
public readonly db: SqlJsDatabase;
|
|
44
|
+
|
|
45
|
+
private _saveFn: (() => void) | undefined;
|
|
46
|
+
|
|
47
|
+
constructor(db: SqlJsDatabase, saveFn?: () => void) {
|
|
48
|
+
this.db = db;
|
|
49
|
+
this._saveFn = saveFn;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async queryAll<T>(sql: string, params: unknown[] = []): Promise<T[]> {
|
|
53
|
+
const stmt = this.db.prepare(sql);
|
|
54
|
+
try {
|
|
55
|
+
stmt.bind(params);
|
|
56
|
+
|
|
57
|
+
const results: T[] = [];
|
|
58
|
+
while (stmt.step()) {
|
|
59
|
+
const row = stmt.getAsObject();
|
|
60
|
+
results.push(row as T);
|
|
61
|
+
}
|
|
62
|
+
return results;
|
|
63
|
+
} finally {
|
|
64
|
+
stmt.free();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async queryOne<T>(sql: string, params: unknown[] = []): Promise<T | undefined> {
|
|
69
|
+
const results = await this.queryAll<T>(sql, params);
|
|
70
|
+
return results[0];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async run(sql: string, params: unknown[] = []): Promise<void> {
|
|
74
|
+
this.db.run(sql, params);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async withTransaction<T>(fn: () => Promise<T> | T): Promise<T> {
|
|
78
|
+
try {
|
|
79
|
+
this.db.run('BEGIN IMMEDIATE');
|
|
80
|
+
const result = await fn();
|
|
81
|
+
this.db.run('COMMIT');
|
|
82
|
+
if (this._saveFn) {
|
|
83
|
+
this._saveFn();
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
} catch (error) {
|
|
87
|
+
try {
|
|
88
|
+
this.db.run('ROLLBACK');
|
|
89
|
+
} catch (_error) {
|
|
90
|
+
// Ignore rollback errors - transaction may have already been rolled back
|
|
91
|
+
}
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
save(): void {
|
|
97
|
+
if (this._saveFn) {
|
|
98
|
+
this._saveFn();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async close(): Promise<void> {
|
|
103
|
+
this.db.close();
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Read-only SQLite provider that does not support save operations.
|
|
109
|
+
*/
|
|
110
|
+
export class ReadOnlySqliteProvider implements DatabaseProvider {
|
|
111
|
+
public readonly db: SqlJsDatabase;
|
|
112
|
+
|
|
113
|
+
constructor(db: SqlJsDatabase) {
|
|
114
|
+
this.db = db;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async queryAll<T>(sql: string, params: unknown[] = []): Promise<T[]> {
|
|
118
|
+
const stmt = this.db.prepare(sql);
|
|
119
|
+
try {
|
|
120
|
+
stmt.bind(params);
|
|
121
|
+
|
|
122
|
+
const results: T[] = [];
|
|
123
|
+
while (stmt.step()) {
|
|
124
|
+
const row = stmt.getAsObject();
|
|
125
|
+
results.push(row as T);
|
|
126
|
+
}
|
|
127
|
+
return results;
|
|
128
|
+
} finally {
|
|
129
|
+
stmt.free();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async queryOne<T>(sql: string, params: unknown[] = []): Promise<T | undefined> {
|
|
134
|
+
const results = await this.queryAll<T>(sql, params);
|
|
135
|
+
return results[0];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async run(sql: string, params: unknown[] = []): Promise<void> {
|
|
139
|
+
this.db.run(sql, params);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
async withTransaction<T>(fn: () => Promise<T> | T): Promise<T> {
|
|
143
|
+
try {
|
|
144
|
+
this.db.run('BEGIN IMMEDIATE');
|
|
145
|
+
const result = await fn();
|
|
146
|
+
this.db.run('COMMIT');
|
|
147
|
+
return result;
|
|
148
|
+
} catch (error) {
|
|
149
|
+
try {
|
|
150
|
+
this.db.run('ROLLBACK');
|
|
151
|
+
} catch (_error) {
|
|
152
|
+
// Ignore rollback errors
|
|
153
|
+
}
|
|
154
|
+
throw error;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
async close(): Promise<void> {
|
|
159
|
+
this.db.close();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Licensed under the Hungry Ghost Hive License. See LICENSE.
|
|
2
2
|
|
|
3
|
-
import type { Database } from 'sql.js';
|
|
4
3
|
import { beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
+
import { SqliteProvider } from '../provider.js';
|
|
5
5
|
import {
|
|
6
6
|
createAgent,
|
|
7
7
|
deleteAgent,
|
|
@@ -19,12 +19,13 @@ import { createTeam } from './teams.js';
|
|
|
19
19
|
import { createTestDatabase } from './test-helpers.js';
|
|
20
20
|
|
|
21
21
|
describe('agents queries', () => {
|
|
22
|
-
let db:
|
|
22
|
+
let db: SqliteProvider;
|
|
23
23
|
let teamId: string;
|
|
24
24
|
|
|
25
25
|
beforeEach(async () => {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const rawDb = await createTestDatabase();
|
|
27
|
+
db = new SqliteProvider(rawDb);
|
|
28
|
+
const team = await createTeam(db, {
|
|
28
29
|
repoUrl: 'https://github.com/test/repo.git',
|
|
29
30
|
repoPath: '/path/to/repo',
|
|
30
31
|
name: 'Test Team',
|
|
@@ -33,8 +34,8 @@ describe('agents queries', () => {
|
|
|
33
34
|
});
|
|
34
35
|
|
|
35
36
|
describe('createAgent', () => {
|
|
36
|
-
it('should create a tech_lead agent with fixed ID', () => {
|
|
37
|
-
const agent = createAgent(db, {
|
|
37
|
+
it('should create a tech_lead agent with fixed ID', async () => {
|
|
38
|
+
const agent = await createAgent(db, {
|
|
38
39
|
type: 'tech_lead',
|
|
39
40
|
teamId,
|
|
40
41
|
model: 'claude-sonnet-4-5',
|
|
@@ -47,8 +48,8 @@ describe('agents queries', () => {
|
|
|
47
48
|
expect(agent.status).toBe('idle');
|
|
48
49
|
});
|
|
49
50
|
|
|
50
|
-
it('should create a senior agent with generated ID', () => {
|
|
51
|
-
const agent = createAgent(db, {
|
|
51
|
+
it('should create a senior agent with generated ID', async () => {
|
|
52
|
+
const agent = await createAgent(db, {
|
|
52
53
|
type: 'senior',
|
|
53
54
|
teamId,
|
|
54
55
|
});
|
|
@@ -58,8 +59,8 @@ describe('agents queries', () => {
|
|
|
58
59
|
expect(agent.status).toBe('idle');
|
|
59
60
|
});
|
|
60
61
|
|
|
61
|
-
it('should handle optional fields', () => {
|
|
62
|
-
const agent = createAgent(db, {
|
|
62
|
+
it('should handle optional fields', async () => {
|
|
63
|
+
const agent = await createAgent(db, {
|
|
63
64
|
type: 'junior',
|
|
64
65
|
tmuxSession: 'tmux-session-1',
|
|
65
66
|
model: 'claude-sonnet-4-5-20250929',
|
|
@@ -71,12 +72,12 @@ describe('agents queries', () => {
|
|
|
71
72
|
expect(agent.worktree_path).toBe('/path/to/worktree');
|
|
72
73
|
});
|
|
73
74
|
|
|
74
|
-
it('should handle null/undefined teamId', () => {
|
|
75
|
-
const agent1 = createAgent(db, {
|
|
75
|
+
it('should handle null/undefined teamId', async () => {
|
|
76
|
+
const agent1 = await createAgent(db, {
|
|
76
77
|
type: 'qa',
|
|
77
78
|
});
|
|
78
79
|
|
|
79
|
-
const agent2 = createAgent(db, {
|
|
80
|
+
const agent2 = await createAgent(db, {
|
|
80
81
|
type: 'intermediate',
|
|
81
82
|
teamId: null,
|
|
82
83
|
});
|
|
@@ -85,8 +86,8 @@ describe('agents queries', () => {
|
|
|
85
86
|
expect(agent2.team_id).toBeNull();
|
|
86
87
|
});
|
|
87
88
|
|
|
88
|
-
it('should set timestamps', () => {
|
|
89
|
-
const agent = createAgent(db, {
|
|
89
|
+
it('should set timestamps', async () => {
|
|
90
|
+
const agent = await createAgent(db, {
|
|
90
91
|
type: 'senior',
|
|
91
92
|
});
|
|
92
93
|
|
|
@@ -97,57 +98,57 @@ describe('agents queries', () => {
|
|
|
97
98
|
});
|
|
98
99
|
|
|
99
100
|
describe('getAgentById', () => {
|
|
100
|
-
it('should retrieve an agent by ID', () => {
|
|
101
|
-
const created = createAgent(db, {
|
|
101
|
+
it('should retrieve an agent by ID', async () => {
|
|
102
|
+
const created = await createAgent(db, {
|
|
102
103
|
type: 'senior',
|
|
103
104
|
teamId,
|
|
104
105
|
});
|
|
105
106
|
|
|
106
|
-
const retrieved = getAgentById(db, created.id);
|
|
107
|
+
const retrieved = await getAgentById(db, created.id);
|
|
107
108
|
|
|
108
109
|
expect(retrieved).toBeDefined();
|
|
109
110
|
expect(retrieved?.id).toBe(created.id);
|
|
110
111
|
expect(retrieved?.type).toBe('senior');
|
|
111
112
|
});
|
|
112
113
|
|
|
113
|
-
it('should return undefined for non-existent agent', () => {
|
|
114
|
-
const result = getAgentById(db, 'non-existent-id');
|
|
114
|
+
it('should return undefined for non-existent agent', async () => {
|
|
115
|
+
const result = await getAgentById(db, 'non-existent-id');
|
|
115
116
|
expect(result).toBeUndefined();
|
|
116
117
|
});
|
|
117
118
|
});
|
|
118
119
|
|
|
119
120
|
describe('getAgentsByTeam', () => {
|
|
120
|
-
it('should return agents for a specific team', () => {
|
|
121
|
-
const agent1 = createAgent(db, { type: 'senior', teamId });
|
|
122
|
-
const agent2 = createAgent(db, { type: 'junior', teamId });
|
|
121
|
+
it('should return agents for a specific team', async () => {
|
|
122
|
+
const agent1 = await createAgent(db, { type: 'senior', teamId });
|
|
123
|
+
const agent2 = await createAgent(db, { type: 'junior', teamId });
|
|
123
124
|
|
|
124
|
-
const team2 = createTeam(db, {
|
|
125
|
+
const team2 = await createTeam(db, {
|
|
125
126
|
repoUrl: 'https://github.com/test/repo2.git',
|
|
126
127
|
repoPath: '/path/to/repo2',
|
|
127
128
|
name: 'Team 2',
|
|
128
129
|
});
|
|
129
|
-
createAgent(db, { type: 'senior', teamId: team2.id });
|
|
130
|
+
await createAgent(db, { type: 'senior', teamId: team2.id });
|
|
130
131
|
|
|
131
|
-
const teamAgents = getAgentsByTeam(db, teamId);
|
|
132
|
+
const teamAgents = await getAgentsByTeam(db, teamId);
|
|
132
133
|
|
|
133
134
|
expect(teamAgents).toHaveLength(2);
|
|
134
135
|
expect(teamAgents.map(a => a.id)).toContain(agent1.id);
|
|
135
136
|
expect(teamAgents.map(a => a.id)).toContain(agent2.id);
|
|
136
137
|
});
|
|
137
138
|
|
|
138
|
-
it('should return empty array when no agents for team', () => {
|
|
139
|
-
const agents = getAgentsByTeam(db, 'non-existent-team');
|
|
139
|
+
it('should return empty array when no agents for team', async () => {
|
|
140
|
+
const agents = await getAgentsByTeam(db, 'non-existent-team');
|
|
140
141
|
expect(agents).toEqual([]);
|
|
141
142
|
});
|
|
142
143
|
});
|
|
143
144
|
|
|
144
145
|
describe('getAgentsByType', () => {
|
|
145
|
-
it('should filter agents by type', () => {
|
|
146
|
-
const senior1 = createAgent(db, { type: 'senior', teamId });
|
|
147
|
-
const senior2 = createAgent(db, { type: 'senior', teamId });
|
|
148
|
-
createAgent(db, { type: 'junior', teamId });
|
|
146
|
+
it('should filter agents by type', async () => {
|
|
147
|
+
const senior1 = await createAgent(db, { type: 'senior', teamId });
|
|
148
|
+
const senior2 = await createAgent(db, { type: 'senior', teamId });
|
|
149
|
+
await createAgent(db, { type: 'junior', teamId });
|
|
149
150
|
|
|
150
|
-
const seniors = getAgentsByType(db, 'senior');
|
|
151
|
+
const seniors = await getAgentsByType(db, 'senior');
|
|
151
152
|
|
|
152
153
|
expect(seniors).toHaveLength(2);
|
|
153
154
|
expect(seniors.map(a => a.id)).toContain(senior1.id);
|
|
@@ -156,13 +157,13 @@ describe('agents queries', () => {
|
|
|
156
157
|
});
|
|
157
158
|
|
|
158
159
|
describe('getAgentsByStatus', () => {
|
|
159
|
-
it('should filter agents by status', () => {
|
|
160
|
-
const agent1 = createAgent(db, { type: 'senior', teamId });
|
|
161
|
-
const agent2 = createAgent(db, { type: 'junior', teamId });
|
|
162
|
-
updateAgent(db, agent2.id, { status: 'working' });
|
|
160
|
+
it('should filter agents by status', async () => {
|
|
161
|
+
const agent1 = await createAgent(db, { type: 'senior', teamId });
|
|
162
|
+
const agent2 = await createAgent(db, { type: 'junior', teamId });
|
|
163
|
+
await updateAgent(db, agent2.id, { status: 'working' });
|
|
163
164
|
|
|
164
|
-
const idle = getAgentsByStatus(db, 'idle');
|
|
165
|
-
const working = getAgentsByStatus(db, 'working');
|
|
165
|
+
const idle = await getAgentsByStatus(db, 'idle');
|
|
166
|
+
const working = await getAgentsByStatus(db, 'working');
|
|
166
167
|
|
|
167
168
|
expect(idle).toHaveLength(1);
|
|
168
169
|
expect(idle[0].id).toBe(agent1.id);
|
|
@@ -172,34 +173,34 @@ describe('agents queries', () => {
|
|
|
172
173
|
});
|
|
173
174
|
|
|
174
175
|
describe('getAllAgents', () => {
|
|
175
|
-
it('should return all agents ordered by type and team_id', () => {
|
|
176
|
-
createAgent(db, { type: 'senior', teamId });
|
|
177
|
-
createAgent(db, { type: 'junior', teamId });
|
|
178
|
-
createAgent(db, { type: 'intermediate', teamId });
|
|
176
|
+
it('should return all agents ordered by type and team_id', async () => {
|
|
177
|
+
await createAgent(db, { type: 'senior', teamId });
|
|
178
|
+
await createAgent(db, { type: 'junior', teamId });
|
|
179
|
+
await createAgent(db, { type: 'intermediate', teamId });
|
|
179
180
|
|
|
180
|
-
const agents = getAllAgents(db);
|
|
181
|
+
const agents = await getAllAgents(db);
|
|
181
182
|
|
|
182
183
|
expect(agents).toHaveLength(3);
|
|
183
184
|
// Should be ordered
|
|
184
185
|
expect(agents.every(a => a.id)).toBe(true);
|
|
185
186
|
});
|
|
186
187
|
|
|
187
|
-
it('should return empty array when no agents', () => {
|
|
188
|
-
const agents = getAllAgents(db);
|
|
188
|
+
it('should return empty array when no agents', async () => {
|
|
189
|
+
const agents = await getAllAgents(db);
|
|
189
190
|
expect(agents).toEqual([]);
|
|
190
191
|
});
|
|
191
192
|
});
|
|
192
193
|
|
|
193
194
|
describe('getActiveAgents', () => {
|
|
194
|
-
it('should return only active agents (not terminated)', () => {
|
|
195
|
-
const agent1 = createAgent(db, { type: 'senior', teamId });
|
|
196
|
-
const agent2 = createAgent(db, { type: 'junior', teamId });
|
|
197
|
-
const agent3 = createAgent(db, { type: 'intermediate', teamId });
|
|
195
|
+
it('should return only active agents (not terminated)', async () => {
|
|
196
|
+
const agent1 = await createAgent(db, { type: 'senior', teamId });
|
|
197
|
+
const agent2 = await createAgent(db, { type: 'junior', teamId });
|
|
198
|
+
const agent3 = await createAgent(db, { type: 'intermediate', teamId });
|
|
198
199
|
|
|
199
|
-
updateAgent(db, agent2.id, { status: 'working' });
|
|
200
|
-
updateAgent(db, agent3.id, { status: 'terminated' });
|
|
200
|
+
await updateAgent(db, agent2.id, { status: 'working' });
|
|
201
|
+
await updateAgent(db, agent3.id, { status: 'terminated' });
|
|
201
202
|
|
|
202
|
-
const active = getActiveAgents(db);
|
|
203
|
+
const active = await getActiveAgents(db);
|
|
203
204
|
|
|
204
205
|
expect(active).toHaveLength(2);
|
|
205
206
|
expect(active.map(a => a.id)).toContain(agent1.id);
|
|
@@ -209,69 +210,69 @@ describe('agents queries', () => {
|
|
|
209
210
|
});
|
|
210
211
|
|
|
211
212
|
describe('getTechLead', () => {
|
|
212
|
-
it('should return the tech lead agent', () => {
|
|
213
|
-
createAgent(db, { type: 'tech_lead', teamId });
|
|
214
|
-
createAgent(db, { type: 'senior', teamId });
|
|
213
|
+
it('should return the tech lead agent', async () => {
|
|
214
|
+
await createAgent(db, { type: 'tech_lead', teamId });
|
|
215
|
+
await createAgent(db, { type: 'senior', teamId });
|
|
215
216
|
|
|
216
|
-
const techLead = getTechLead(db);
|
|
217
|
+
const techLead = await getTechLead(db);
|
|
217
218
|
|
|
218
219
|
expect(techLead).toBeDefined();
|
|
219
220
|
expect(techLead?.type).toBe('tech_lead');
|
|
220
221
|
expect(techLead?.id).toBe('tech-lead');
|
|
221
222
|
});
|
|
222
223
|
|
|
223
|
-
it('should return undefined when no tech lead exists', () => {
|
|
224
|
-
const techLead = getTechLead(db);
|
|
224
|
+
it('should return undefined when no tech lead exists', async () => {
|
|
225
|
+
const techLead = await getTechLead(db);
|
|
225
226
|
expect(techLead).toBeUndefined();
|
|
226
227
|
});
|
|
227
228
|
});
|
|
228
229
|
|
|
229
230
|
describe('updateAgent', () => {
|
|
230
|
-
it('should update agent status', () => {
|
|
231
|
-
const agent = createAgent(db, { type: 'senior', teamId });
|
|
231
|
+
it('should update agent status', async () => {
|
|
232
|
+
const agent = await createAgent(db, { type: 'senior', teamId });
|
|
232
233
|
|
|
233
|
-
const updated = updateAgent(db, agent.id, { status: 'working' });
|
|
234
|
+
const updated = await updateAgent(db, agent.id, { status: 'working' });
|
|
234
235
|
|
|
235
236
|
expect(updated?.status).toBe('working');
|
|
236
237
|
});
|
|
237
238
|
|
|
238
|
-
it('should update tmux session', () => {
|
|
239
|
-
const agent = createAgent(db, { type: 'senior', teamId });
|
|
239
|
+
it('should update tmux session', async () => {
|
|
240
|
+
const agent = await createAgent(db, { type: 'senior', teamId });
|
|
240
241
|
|
|
241
|
-
const updated = updateAgent(db, agent.id, { tmuxSession: 'new-session' });
|
|
242
|
+
const updated = await updateAgent(db, agent.id, { tmuxSession: 'new-session' });
|
|
242
243
|
|
|
243
244
|
expect(updated?.tmux_session).toBe('new-session');
|
|
244
245
|
});
|
|
245
246
|
|
|
246
|
-
it('should update current story ID', () => {
|
|
247
|
-
const agent = createAgent(db, { type: 'senior', teamId });
|
|
247
|
+
it('should update current story ID', async () => {
|
|
248
|
+
const agent = await createAgent(db, { type: 'senior', teamId });
|
|
248
249
|
|
|
249
|
-
const updated = updateAgent(db, agent.id, { currentStoryId: 'STORY-123' });
|
|
250
|
+
const updated = await updateAgent(db, agent.id, { currentStoryId: 'STORY-123' });
|
|
250
251
|
|
|
251
252
|
expect(updated?.current_story_id).toBe('STORY-123');
|
|
252
253
|
});
|
|
253
254
|
|
|
254
|
-
it('should update memory state', () => {
|
|
255
|
-
const agent = createAgent(db, { type: 'senior', teamId });
|
|
255
|
+
it('should update memory state', async () => {
|
|
256
|
+
const agent = await createAgent(db, { type: 'senior', teamId });
|
|
256
257
|
const memoryState = JSON.stringify({ key: 'value' });
|
|
257
258
|
|
|
258
|
-
const updated = updateAgent(db, agent.id, { memoryState });
|
|
259
|
+
const updated = await updateAgent(db, agent.id, { memoryState });
|
|
259
260
|
|
|
260
261
|
expect(updated?.memory_state).toBe(memoryState);
|
|
261
262
|
});
|
|
262
263
|
|
|
263
|
-
it('should update worktree path', () => {
|
|
264
|
-
const agent = createAgent(db, { type: 'senior', teamId });
|
|
264
|
+
it('should update worktree path', async () => {
|
|
265
|
+
const agent = await createAgent(db, { type: 'senior', teamId });
|
|
265
266
|
|
|
266
|
-
const updated = updateAgent(db, agent.id, { worktreePath: '/new/path' });
|
|
267
|
+
const updated = await updateAgent(db, agent.id, { worktreePath: '/new/path' });
|
|
267
268
|
|
|
268
269
|
expect(updated?.worktree_path).toBe('/new/path');
|
|
269
270
|
});
|
|
270
271
|
|
|
271
|
-
it('should update multiple fields at once', () => {
|
|
272
|
-
const agent = createAgent(db, { type: 'senior', teamId });
|
|
272
|
+
it('should update multiple fields at once', async () => {
|
|
273
|
+
const agent = await createAgent(db, { type: 'senior', teamId });
|
|
273
274
|
|
|
274
|
-
const updated = updateAgent(db, agent.id, {
|
|
275
|
+
const updated = await updateAgent(db, agent.id, {
|
|
275
276
|
status: 'working',
|
|
276
277
|
currentStoryId: 'STORY-456',
|
|
277
278
|
tmuxSession: 'updated-session',
|
|
@@ -282,46 +283,46 @@ describe('agents queries', () => {
|
|
|
282
283
|
expect(updated?.tmux_session).toBe('updated-session');
|
|
283
284
|
});
|
|
284
285
|
|
|
285
|
-
it('should update updated_at timestamp', () => {
|
|
286
|
-
const agent = createAgent(db, { type: 'senior', teamId });
|
|
286
|
+
it('should update updated_at timestamp', async () => {
|
|
287
|
+
const agent = await createAgent(db, { type: 'senior', teamId });
|
|
287
288
|
|
|
288
|
-
const updated = updateAgent(db, agent.id, { status: 'working' });
|
|
289
|
+
const updated = await updateAgent(db, agent.id, { status: 'working' });
|
|
289
290
|
|
|
290
291
|
// Verify updated_at exists and is a valid timestamp
|
|
291
292
|
expect(updated?.updated_at).toBeDefined();
|
|
292
293
|
expect(typeof updated?.updated_at).toBe('string');
|
|
293
294
|
});
|
|
294
295
|
|
|
295
|
-
it('should return agent when no updates provided', () => {
|
|
296
|
-
const agent = createAgent(db, { type: 'senior', teamId });
|
|
296
|
+
it('should return agent when no updates provided', async () => {
|
|
297
|
+
const agent = await createAgent(db, { type: 'senior', teamId });
|
|
297
298
|
|
|
298
|
-
const updated = updateAgent(db, agent.id, {});
|
|
299
|
+
const updated = await updateAgent(db, agent.id, {});
|
|
299
300
|
|
|
300
301
|
expect(updated?.id).toBe(agent.id);
|
|
301
302
|
});
|
|
302
303
|
|
|
303
|
-
it('should return undefined for non-existent agent', () => {
|
|
304
|
-
const updated = updateAgent(db, 'non-existent-id', { status: 'working' });
|
|
304
|
+
it('should return undefined for non-existent agent', async () => {
|
|
305
|
+
const updated = await updateAgent(db, 'non-existent-id', { status: 'working' });
|
|
305
306
|
expect(updated).toBeUndefined();
|
|
306
307
|
});
|
|
307
308
|
|
|
308
|
-
it('should handle setting fields to null', () => {
|
|
309
|
-
const agent = createAgent(db, {
|
|
309
|
+
it('should handle setting fields to null', async () => {
|
|
310
|
+
const agent = await createAgent(db, {
|
|
310
311
|
type: 'senior',
|
|
311
312
|
teamId,
|
|
312
313
|
tmuxSession: 'session-1',
|
|
313
314
|
});
|
|
314
315
|
|
|
315
|
-
const updated = updateAgent(db, agent.id, { tmuxSession: null });
|
|
316
|
+
const updated = await updateAgent(db, agent.id, { tmuxSession: null });
|
|
316
317
|
|
|
317
318
|
expect(updated?.tmux_session).toBeNull();
|
|
318
319
|
});
|
|
319
320
|
|
|
320
|
-
it('should reset created_at when createdAt is provided', () => {
|
|
321
|
-
const agent = createAgent(db, { type: 'tech_lead', teamId });
|
|
321
|
+
it('should reset created_at when createdAt is provided', async () => {
|
|
322
|
+
const agent = await createAgent(db, { type: 'tech_lead', teamId });
|
|
322
323
|
const newCreatedAt = new Date(Date.now() + 60_000).toISOString();
|
|
323
324
|
|
|
324
|
-
const updated = updateAgent(db, agent.id, {
|
|
325
|
+
const updated = await updateAgent(db, agent.id, {
|
|
325
326
|
status: 'working',
|
|
326
327
|
createdAt: newCreatedAt,
|
|
327
328
|
});
|
|
@@ -332,38 +333,38 @@ describe('agents queries', () => {
|
|
|
332
333
|
});
|
|
333
334
|
|
|
334
335
|
describe('deleteAgent', () => {
|
|
335
|
-
it('should delete an agent', () => {
|
|
336
|
-
const agent = createAgent(db, { type: 'senior', teamId });
|
|
336
|
+
it('should delete an agent', async () => {
|
|
337
|
+
const agent = await createAgent(db, { type: 'senior', teamId });
|
|
337
338
|
|
|
338
|
-
deleteAgent(db, agent.id);
|
|
339
|
+
await deleteAgent(db, agent.id);
|
|
339
340
|
|
|
340
|
-
const retrieved = getAgentById(db, agent.id);
|
|
341
|
+
const retrieved = await getAgentById(db, agent.id);
|
|
341
342
|
expect(retrieved).toBeUndefined();
|
|
342
343
|
});
|
|
343
344
|
|
|
344
|
-
it('should not throw when deleting non-existent agent', () => {
|
|
345
|
-
expect(
|
|
345
|
+
it('should not throw when deleting non-existent agent', async () => {
|
|
346
|
+
await expect(deleteAgent(db, 'non-existent-id')).resolves.not.toThrow();
|
|
346
347
|
});
|
|
347
348
|
});
|
|
348
349
|
|
|
349
350
|
describe('terminateAgent', () => {
|
|
350
|
-
it('should set agent status to terminated and clear tmux session', () => {
|
|
351
|
-
const agent = createAgent(db, {
|
|
351
|
+
it('should set agent status to terminated and clear tmux session', async () => {
|
|
352
|
+
const agent = await createAgent(db, {
|
|
352
353
|
type: 'senior',
|
|
353
354
|
teamId,
|
|
354
355
|
tmuxSession: 'session-1',
|
|
355
356
|
});
|
|
356
357
|
|
|
357
|
-
terminateAgent(db, agent.id);
|
|
358
|
+
await terminateAgent(db, agent.id);
|
|
358
359
|
|
|
359
|
-
const terminated = getAgentById(db, agent.id);
|
|
360
|
+
const terminated = await getAgentById(db, agent.id);
|
|
360
361
|
expect(terminated?.status).toBe('terminated');
|
|
361
362
|
expect(terminated?.tmux_session).toBeNull();
|
|
362
363
|
});
|
|
363
364
|
});
|
|
364
365
|
|
|
365
366
|
describe('edge cases', () => {
|
|
366
|
-
it('should handle all agent types', () => {
|
|
367
|
+
it('should handle all agent types', async () => {
|
|
367
368
|
const types: Array<'tech_lead' | 'senior' | 'intermediate' | 'junior' | 'qa'> = [
|
|
368
369
|
'tech_lead',
|
|
369
370
|
'senior',
|
|
@@ -372,13 +373,13 @@ describe('agents queries', () => {
|
|
|
372
373
|
'qa',
|
|
373
374
|
];
|
|
374
375
|
|
|
375
|
-
|
|
376
|
-
const agent = createAgent(db, { type });
|
|
376
|
+
for (const type of types) {
|
|
377
|
+
const agent = await createAgent(db, { type });
|
|
377
378
|
expect(agent.type).toBe(type);
|
|
378
|
-
}
|
|
379
|
+
}
|
|
379
380
|
});
|
|
380
381
|
|
|
381
|
-
it('should handle all agent statuses', () => {
|
|
382
|
+
it('should handle all agent statuses', async () => {
|
|
382
383
|
const statuses: Array<'idle' | 'working' | 'blocked' | 'terminated'> = [
|
|
383
384
|
'idle',
|
|
384
385
|
'working',
|
|
@@ -386,19 +387,19 @@ describe('agents queries', () => {
|
|
|
386
387
|
'terminated',
|
|
387
388
|
];
|
|
388
389
|
|
|
389
|
-
const agent = createAgent(db, { type: 'senior', teamId });
|
|
390
|
+
const agent = await createAgent(db, { type: 'senior', teamId });
|
|
390
391
|
|
|
391
|
-
|
|
392
|
-
const updated = updateAgent(db, agent.id, { status });
|
|
392
|
+
for (const status of statuses) {
|
|
393
|
+
const updated = await updateAgent(db, agent.id, { status });
|
|
393
394
|
expect(updated?.status).toBe(status);
|
|
394
|
-
}
|
|
395
|
+
}
|
|
395
396
|
});
|
|
396
397
|
|
|
397
|
-
it('should handle long memory state strings', () => {
|
|
398
|
-
const agent = createAgent(db, { type: 'senior', teamId });
|
|
398
|
+
it('should handle long memory state strings', async () => {
|
|
399
|
+
const agent = await createAgent(db, { type: 'senior', teamId });
|
|
399
400
|
const longMemory = JSON.stringify({ data: 'A'.repeat(100000) });
|
|
400
401
|
|
|
401
|
-
const updated = updateAgent(db, agent.id, { memoryState: longMemory });
|
|
402
|
+
const updated = await updateAgent(db, agent.id, { memoryState: longMemory });
|
|
402
403
|
|
|
403
404
|
expect(updated?.memory_state).toBe(longMemory);
|
|
404
405
|
});
|