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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Licensed under the Hungry Ghost Hive License. See LICENSE.
|
|
2
2
|
|
|
3
|
-
import type { Database } from 'sql.js';
|
|
4
3
|
import initSqlJs from 'sql.js';
|
|
5
4
|
import { beforeEach, describe, expect, it } from 'vitest';
|
|
5
|
+
import { SqliteProvider } from '../provider.js';
|
|
6
6
|
import { createAgent } from './agents.js';
|
|
7
7
|
import {
|
|
8
8
|
countQaFailuresByStory,
|
|
@@ -21,28 +21,29 @@ import { createTeam } from './teams.js';
|
|
|
21
21
|
import { createTestDatabase } from './test-helpers.js';
|
|
22
22
|
|
|
23
23
|
describe('logs queries', () => {
|
|
24
|
-
let db:
|
|
24
|
+
let db: SqliteProvider;
|
|
25
25
|
let teamId: string;
|
|
26
26
|
let agentId: string;
|
|
27
27
|
let storyId: string;
|
|
28
28
|
|
|
29
29
|
beforeEach(async () => {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
const rawDb = await createTestDatabase();
|
|
31
|
+
db = new SqliteProvider(rawDb);
|
|
32
|
+
const team = await createTeam(db, {
|
|
32
33
|
repoUrl: 'https://github.com/test/repo.git',
|
|
33
34
|
repoPath: '/path/to/repo',
|
|
34
35
|
name: 'Test Team',
|
|
35
36
|
});
|
|
36
37
|
teamId = team.id;
|
|
37
38
|
|
|
38
|
-
const agent = createAgent(db, {
|
|
39
|
+
const agent = await createAgent(db, {
|
|
39
40
|
type: 'senior',
|
|
40
41
|
teamId,
|
|
41
42
|
model: 'claude-sonnet-4-5',
|
|
42
43
|
});
|
|
43
44
|
agentId = agent.id;
|
|
44
45
|
|
|
45
|
-
const story = createStory(db, {
|
|
46
|
+
const story = await createStory(db, {
|
|
46
47
|
teamId,
|
|
47
48
|
title: 'Test Story',
|
|
48
49
|
description: 'Test description',
|
|
@@ -51,9 +52,9 @@ describe('logs queries', () => {
|
|
|
51
52
|
});
|
|
52
53
|
|
|
53
54
|
describe('createLog', () => {
|
|
54
|
-
it('should create a log entry with all fields', () => {
|
|
55
|
+
it('should create a log entry with all fields', async () => {
|
|
55
56
|
const metadata = { key: 'value', count: 42 };
|
|
56
|
-
const log = createLog(db, {
|
|
57
|
+
const log = await createLog(db, {
|
|
57
58
|
agentId,
|
|
58
59
|
storyId,
|
|
59
60
|
eventType: 'STORY_STARTED',
|
|
@@ -72,8 +73,8 @@ describe('logs queries', () => {
|
|
|
72
73
|
expect(log.timestamp).toBeDefined();
|
|
73
74
|
});
|
|
74
75
|
|
|
75
|
-
it('should create a log entry with minimal fields', () => {
|
|
76
|
-
const log = createLog(db, {
|
|
76
|
+
it('should create a log entry with minimal fields', async () => {
|
|
77
|
+
const log = await createLog(db, {
|
|
77
78
|
agentId,
|
|
78
79
|
eventType: 'AGENT_SPAWNED',
|
|
79
80
|
});
|
|
@@ -87,8 +88,8 @@ describe('logs queries', () => {
|
|
|
87
88
|
expect(log.metadata).toBeNull();
|
|
88
89
|
});
|
|
89
90
|
|
|
90
|
-
it('should create a log entry without story', () => {
|
|
91
|
-
const log = createLog(db, {
|
|
91
|
+
it('should create a log entry without story', async () => {
|
|
92
|
+
const log = await createLog(db, {
|
|
92
93
|
agentId,
|
|
93
94
|
eventType: 'AGENT_TERMINATED',
|
|
94
95
|
message: 'Agent terminated',
|
|
@@ -100,8 +101,8 @@ describe('logs queries', () => {
|
|
|
100
101
|
expect(log.message).toBe('Agent terminated');
|
|
101
102
|
});
|
|
102
103
|
|
|
103
|
-
it('should handle null metadata', () => {
|
|
104
|
-
const log = createLog(db, {
|
|
104
|
+
it('should handle null metadata', async () => {
|
|
105
|
+
const log = await createLog(db, {
|
|
105
106
|
agentId,
|
|
106
107
|
eventType: 'STORY_STARTED',
|
|
107
108
|
metadata: null,
|
|
@@ -110,13 +111,13 @@ describe('logs queries', () => {
|
|
|
110
111
|
expect(log.metadata).toBeNull();
|
|
111
112
|
});
|
|
112
113
|
|
|
113
|
-
it('should serialize complex metadata', () => {
|
|
114
|
+
it('should serialize complex metadata', async () => {
|
|
114
115
|
const metadata = {
|
|
115
116
|
nested: { value: 'test' },
|
|
116
117
|
array: [1, 2, 3],
|
|
117
118
|
bool: true,
|
|
118
119
|
};
|
|
119
|
-
const log = createLog(db, {
|
|
120
|
+
const log = await createLog(db, {
|
|
120
121
|
agentId,
|
|
121
122
|
eventType: 'BUILD_STARTED',
|
|
122
123
|
metadata,
|
|
@@ -125,14 +126,14 @@ describe('logs queries', () => {
|
|
|
125
126
|
expect(log.metadata).toBe(JSON.stringify(metadata));
|
|
126
127
|
});
|
|
127
128
|
|
|
128
|
-
it('should resolve tmux session names to canonical agent IDs', () => {
|
|
129
|
-
const qaAgent = createAgent(db, {
|
|
129
|
+
it('should resolve tmux session names to canonical agent IDs', async () => {
|
|
130
|
+
const qaAgent = await createAgent(db, {
|
|
130
131
|
type: 'qa',
|
|
131
132
|
teamId,
|
|
132
133
|
tmuxSession: 'hive-qa-testteam',
|
|
133
134
|
});
|
|
134
135
|
|
|
135
|
-
const log = createLog(db, {
|
|
136
|
+
const log = await createLog(db, {
|
|
136
137
|
agentId: 'hive-qa-testteam',
|
|
137
138
|
eventType: 'PR_REVIEW_STARTED',
|
|
138
139
|
});
|
|
@@ -140,19 +141,19 @@ describe('logs queries', () => {
|
|
|
140
141
|
expect(log.agent_id).toBe(qaAgent.id);
|
|
141
142
|
});
|
|
142
143
|
|
|
143
|
-
it('should create a synthetic agent row for unknown system actors', () => {
|
|
144
|
-
const log = createLog(db, {
|
|
144
|
+
it('should create a synthetic agent row for unknown system actors', async () => {
|
|
145
|
+
const log = await createLog(db, {
|
|
145
146
|
agentId: 'scheduler',
|
|
146
147
|
eventType: 'TEAM_SCALED_UP',
|
|
147
148
|
});
|
|
148
149
|
|
|
149
150
|
expect(log.agent_id).toBe('scheduler');
|
|
150
|
-
const result = db.exec("SELECT id, type, status FROM agents WHERE id = 'scheduler'");
|
|
151
|
+
const result = db.db.exec("SELECT id, type, status FROM agents WHERE id = 'scheduler'");
|
|
151
152
|
expect(result[0]?.values[0]).toEqual(['scheduler', 'tech_lead', 'terminated']);
|
|
152
153
|
});
|
|
153
154
|
|
|
154
|
-
it('should drop invalid story references to avoid FK failures', () => {
|
|
155
|
-
const log = createLog(db, {
|
|
155
|
+
it('should drop invalid story references to avoid FK failures', async () => {
|
|
156
|
+
const log = await createLog(db, {
|
|
156
157
|
agentId,
|
|
157
158
|
storyId: 'STORY-DOES-NOT-EXIST',
|
|
158
159
|
eventType: 'STORY_PROGRESS_UPDATE',
|
|
@@ -163,9 +164,9 @@ describe('logs queries', () => {
|
|
|
163
164
|
|
|
164
165
|
it('should support legacy agents schemas without last_seen', async () => {
|
|
165
166
|
const SQL = await initSqlJs();
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
const legacyRawDb = new SQL.Database();
|
|
168
|
+
legacyRawDb.run('PRAGMA foreign_keys = ON');
|
|
169
|
+
legacyRawDb.run(`
|
|
169
170
|
CREATE TABLE agents (
|
|
170
171
|
id TEXT PRIMARY KEY,
|
|
171
172
|
type TEXT,
|
|
@@ -174,8 +175,8 @@ describe('logs queries', () => {
|
|
|
174
175
|
updated_at TIMESTAMP
|
|
175
176
|
);
|
|
176
177
|
`);
|
|
177
|
-
|
|
178
|
-
|
|
178
|
+
legacyRawDb.run(`CREATE TABLE stories (id TEXT PRIMARY KEY);`);
|
|
179
|
+
legacyRawDb.run(`
|
|
179
180
|
CREATE TABLE agent_logs (
|
|
180
181
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
181
182
|
agent_id TEXT NOT NULL REFERENCES agents(id),
|
|
@@ -188,25 +189,27 @@ describe('logs queries', () => {
|
|
|
188
189
|
);
|
|
189
190
|
`);
|
|
190
191
|
|
|
191
|
-
const
|
|
192
|
+
const legacyDb = new SqliteProvider(legacyRawDb);
|
|
193
|
+
|
|
194
|
+
const log = await createLog(legacyDb, {
|
|
192
195
|
agentId: 'scheduler',
|
|
193
196
|
eventType: 'TEAM_SCALED_UP',
|
|
194
197
|
});
|
|
195
198
|
expect(log.agent_id).toBe('scheduler');
|
|
196
|
-
const row =
|
|
199
|
+
const row = legacyRawDb.exec("SELECT id, status FROM agents WHERE id = 'scheduler'");
|
|
197
200
|
expect(row[0]?.values[0]).toEqual(['scheduler', 'terminated']);
|
|
198
201
|
});
|
|
199
202
|
});
|
|
200
203
|
|
|
201
204
|
describe('getLogById', () => {
|
|
202
|
-
it('should retrieve a log by ID', () => {
|
|
203
|
-
const created = createLog(db, {
|
|
205
|
+
it('should retrieve a log by ID', async () => {
|
|
206
|
+
const created = await createLog(db, {
|
|
204
207
|
agentId,
|
|
205
208
|
eventType: 'STORY_STARTED',
|
|
206
209
|
message: 'Test log',
|
|
207
210
|
});
|
|
208
211
|
|
|
209
|
-
const retrieved = getLogById(db, created.id);
|
|
212
|
+
const retrieved = await getLogById(db, created.id);
|
|
210
213
|
|
|
211
214
|
expect(retrieved).toBeDefined();
|
|
212
215
|
expect(retrieved?.id).toBe(created.id);
|
|
@@ -215,23 +218,23 @@ describe('logs queries', () => {
|
|
|
215
218
|
expect(retrieved?.message).toBe('Test log');
|
|
216
219
|
});
|
|
217
220
|
|
|
218
|
-
it('should return undefined for non-existent log', () => {
|
|
219
|
-
const log = getLogById(db, 99999);
|
|
221
|
+
it('should return undefined for non-existent log', async () => {
|
|
222
|
+
const log = await getLogById(db, 99999);
|
|
220
223
|
expect(log).toBeUndefined();
|
|
221
224
|
});
|
|
222
225
|
});
|
|
223
226
|
|
|
224
227
|
describe('getLogsByAgent', () => {
|
|
225
|
-
it('should retrieve all logs for an agent', () => {
|
|
226
|
-
createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
227
|
-
createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
228
|
-
createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
228
|
+
it('should retrieve all logs for an agent', async () => {
|
|
229
|
+
await createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
230
|
+
await createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
231
|
+
await createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
229
232
|
|
|
230
233
|
// Create log for different agent
|
|
231
|
-
const agent2 = createAgent(db, { type: 'junior', teamId });
|
|
232
|
-
createLog(db, { agentId: agent2.id, eventType: 'AGENT_SPAWNED' });
|
|
234
|
+
const agent2 = await createAgent(db, { type: 'junior', teamId });
|
|
235
|
+
await createLog(db, { agentId: agent2.id, eventType: 'AGENT_SPAWNED' });
|
|
233
236
|
|
|
234
|
-
const logs = getLogsByAgent(db, agentId);
|
|
237
|
+
const logs = await getLogsByAgent(db, agentId);
|
|
235
238
|
|
|
236
239
|
expect(logs).toHaveLength(3);
|
|
237
240
|
logs.forEach(log => {
|
|
@@ -239,12 +242,12 @@ describe('logs queries', () => {
|
|
|
239
242
|
});
|
|
240
243
|
});
|
|
241
244
|
|
|
242
|
-
it('should return logs in descending timestamp order', () => {
|
|
243
|
-
createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
244
|
-
createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
245
|
-
createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
245
|
+
it('should return logs in descending timestamp order', async () => {
|
|
246
|
+
await createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
247
|
+
await createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
248
|
+
await createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
246
249
|
|
|
247
|
-
const logs = getLogsByAgent(db, agentId);
|
|
250
|
+
const logs = await getLogsByAgent(db, agentId);
|
|
248
251
|
|
|
249
252
|
// Should be in descending order (newest first)
|
|
250
253
|
expect(logs).toHaveLength(3);
|
|
@@ -254,48 +257,48 @@ describe('logs queries', () => {
|
|
|
254
257
|
}
|
|
255
258
|
});
|
|
256
259
|
|
|
257
|
-
it('should respect the limit parameter', () => {
|
|
260
|
+
it('should respect the limit parameter', async () => {
|
|
258
261
|
// Create 10 logs
|
|
259
262
|
for (let i = 0; i < 10; i++) {
|
|
260
|
-
createLog(db, { agentId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
263
|
+
await createLog(db, { agentId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
261
264
|
}
|
|
262
265
|
|
|
263
|
-
const logs = getLogsByAgent(db, agentId, 5);
|
|
266
|
+
const logs = await getLogsByAgent(db, agentId, 5);
|
|
264
267
|
expect(logs).toHaveLength(5);
|
|
265
268
|
});
|
|
266
269
|
|
|
267
|
-
it('should use default limit of 100', () => {
|
|
270
|
+
it('should use default limit of 100', async () => {
|
|
268
271
|
// Create 5 logs
|
|
269
272
|
for (let i = 0; i < 5; i++) {
|
|
270
|
-
createLog(db, { agentId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
273
|
+
await createLog(db, { agentId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
271
274
|
}
|
|
272
275
|
|
|
273
|
-
const logs = getLogsByAgent(db, agentId);
|
|
276
|
+
const logs = await getLogsByAgent(db, agentId);
|
|
274
277
|
expect(logs).toHaveLength(5);
|
|
275
278
|
});
|
|
276
279
|
|
|
277
|
-
it('should return empty array for agent with no logs', () => {
|
|
278
|
-
const agent2 = createAgent(db, { type: 'junior', teamId });
|
|
279
|
-
const logs = getLogsByAgent(db, agent2.id);
|
|
280
|
+
it('should return empty array for agent with no logs', async () => {
|
|
281
|
+
const agent2 = await createAgent(db, { type: 'junior', teamId });
|
|
282
|
+
const logs = await getLogsByAgent(db, agent2.id);
|
|
280
283
|
expect(logs).toEqual([]);
|
|
281
284
|
});
|
|
282
285
|
});
|
|
283
286
|
|
|
284
287
|
describe('getLogsByStory', () => {
|
|
285
|
-
it('should retrieve all logs for a story', () => {
|
|
286
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_STARTED' });
|
|
287
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
288
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_COMPLETED' });
|
|
288
|
+
it('should retrieve all logs for a story', async () => {
|
|
289
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_STARTED' });
|
|
290
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
291
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_COMPLETED' });
|
|
289
292
|
|
|
290
293
|
// Create log for different story
|
|
291
|
-
const story2 = createStory(db, {
|
|
294
|
+
const story2 = await createStory(db, {
|
|
292
295
|
teamId,
|
|
293
296
|
title: 'Story 2',
|
|
294
297
|
description: 'Description',
|
|
295
298
|
});
|
|
296
|
-
createLog(db, { agentId, storyId: story2.id, eventType: 'STORY_STARTED' });
|
|
299
|
+
await createLog(db, { agentId, storyId: story2.id, eventType: 'STORY_STARTED' });
|
|
297
300
|
|
|
298
|
-
const logs = getLogsByStory(db, storyId);
|
|
301
|
+
const logs = await getLogsByStory(db, storyId);
|
|
299
302
|
|
|
300
303
|
expect(logs).toHaveLength(3);
|
|
301
304
|
logs.forEach(log => {
|
|
@@ -303,12 +306,12 @@ describe('logs queries', () => {
|
|
|
303
306
|
});
|
|
304
307
|
});
|
|
305
308
|
|
|
306
|
-
it('should return logs in descending timestamp order', () => {
|
|
307
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_STARTED' });
|
|
308
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
309
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_COMPLETED' });
|
|
309
|
+
it('should return logs in descending timestamp order', async () => {
|
|
310
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_STARTED' });
|
|
311
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
312
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_COMPLETED' });
|
|
310
313
|
|
|
311
|
-
const logs = getLogsByStory(db, storyId);
|
|
314
|
+
const logs = await getLogsByStory(db, storyId);
|
|
312
315
|
|
|
313
316
|
expect(logs).toHaveLength(3);
|
|
314
317
|
// Verify timestamps are in descending order
|
|
@@ -317,24 +320,24 @@ describe('logs queries', () => {
|
|
|
317
320
|
}
|
|
318
321
|
});
|
|
319
322
|
|
|
320
|
-
it('should return empty array for story with no logs', () => {
|
|
321
|
-
const story2 = createStory(db, {
|
|
323
|
+
it('should return empty array for story with no logs', async () => {
|
|
324
|
+
const story2 = await createStory(db, {
|
|
322
325
|
teamId,
|
|
323
326
|
title: 'Story 2',
|
|
324
327
|
description: 'Description',
|
|
325
328
|
});
|
|
326
|
-
const logs = getLogsByStory(db, story2.id);
|
|
329
|
+
const logs = await getLogsByStory(db, story2.id);
|
|
327
330
|
expect(logs).toEqual([]);
|
|
328
331
|
});
|
|
329
332
|
});
|
|
330
333
|
|
|
331
334
|
describe('getLogsByEventType', () => {
|
|
332
|
-
it('should retrieve all logs of a specific event type', () => {
|
|
333
|
-
createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
334
|
-
createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
335
|
-
createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
335
|
+
it('should retrieve all logs of a specific event type', async () => {
|
|
336
|
+
await createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
337
|
+
await createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
338
|
+
await createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
336
339
|
|
|
337
|
-
const logs = getLogsByEventType(db, 'STORY_STARTED');
|
|
340
|
+
const logs = await getLogsByEventType(db, 'STORY_STARTED');
|
|
338
341
|
|
|
339
342
|
expect(logs).toHaveLength(2);
|
|
340
343
|
logs.forEach(log => {
|
|
@@ -342,72 +345,72 @@ describe('logs queries', () => {
|
|
|
342
345
|
});
|
|
343
346
|
});
|
|
344
347
|
|
|
345
|
-
it('should respect the limit parameter', () => {
|
|
348
|
+
it('should respect the limit parameter', async () => {
|
|
346
349
|
for (let i = 0; i < 10; i++) {
|
|
347
|
-
createLog(db, { agentId, eventType: 'BUILD_STARTED' });
|
|
350
|
+
await createLog(db, { agentId, eventType: 'BUILD_STARTED' });
|
|
348
351
|
}
|
|
349
352
|
|
|
350
|
-
const logs = getLogsByEventType(db, 'BUILD_STARTED', 5);
|
|
353
|
+
const logs = await getLogsByEventType(db, 'BUILD_STARTED', 5);
|
|
351
354
|
expect(logs).toHaveLength(5);
|
|
352
355
|
});
|
|
353
356
|
|
|
354
|
-
it('should return empty array for event type with no logs', () => {
|
|
355
|
-
const logs = getLogsByEventType(db, 'PR_REJECTED' as EventType);
|
|
357
|
+
it('should return empty array for event type with no logs', async () => {
|
|
358
|
+
const logs = await getLogsByEventType(db, 'PR_REJECTED' as EventType);
|
|
356
359
|
expect(logs).toEqual([]);
|
|
357
360
|
});
|
|
358
361
|
});
|
|
359
362
|
|
|
360
363
|
describe('getRecentLogs', () => {
|
|
361
|
-
it('should retrieve recent logs', () => {
|
|
362
|
-
createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
363
|
-
createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
364
|
-
createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
364
|
+
it('should retrieve recent logs', async () => {
|
|
365
|
+
await createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
366
|
+
await createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
367
|
+
await createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
365
368
|
|
|
366
|
-
const logs = getRecentLogs(db);
|
|
369
|
+
const logs = await getRecentLogs(db);
|
|
367
370
|
|
|
368
371
|
expect(logs.length).toBeGreaterThan(0);
|
|
369
372
|
});
|
|
370
373
|
|
|
371
|
-
it('should respect the limit parameter', () => {
|
|
374
|
+
it('should respect the limit parameter', async () => {
|
|
372
375
|
for (let i = 0; i < 10; i++) {
|
|
373
|
-
createLog(db, { agentId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
376
|
+
await createLog(db, { agentId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
374
377
|
}
|
|
375
378
|
|
|
376
|
-
const logs = getRecentLogs(db, 5);
|
|
379
|
+
const logs = await getRecentLogs(db, 5);
|
|
377
380
|
expect(logs).toHaveLength(5);
|
|
378
381
|
});
|
|
379
382
|
|
|
380
|
-
it('should return logs in descending timestamp order', () => {
|
|
381
|
-
createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
382
|
-
createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
383
|
-
createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
383
|
+
it('should return logs in descending timestamp order', async () => {
|
|
384
|
+
await createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
385
|
+
await createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
386
|
+
await createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
384
387
|
|
|
385
|
-
const logs = getRecentLogs(db);
|
|
388
|
+
const logs = await getRecentLogs(db);
|
|
386
389
|
|
|
387
390
|
expect(logs[0].event_type).toBe('STORY_COMPLETED');
|
|
388
391
|
expect(logs[2].event_type).toBe('AGENT_SPAWNED');
|
|
389
392
|
});
|
|
390
393
|
|
|
391
|
-
it('should use default limit of 50', () => {
|
|
394
|
+
it('should use default limit of 50', async () => {
|
|
392
395
|
for (let i = 0; i < 60; i++) {
|
|
393
|
-
createLog(db, { agentId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
396
|
+
await createLog(db, { agentId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
394
397
|
}
|
|
395
398
|
|
|
396
|
-
const logs = getRecentLogs(db);
|
|
399
|
+
const logs = await getRecentLogs(db);
|
|
397
400
|
expect(logs).toHaveLength(50);
|
|
398
401
|
});
|
|
399
402
|
});
|
|
400
403
|
|
|
401
404
|
describe('getLogsSince', () => {
|
|
402
|
-
it('should retrieve logs since a specific timestamp', () => {
|
|
403
|
-
createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
405
|
+
it('should retrieve logs since a specific timestamp', async () => {
|
|
406
|
+
await createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
404
407
|
const sinceTime = new Date().toISOString();
|
|
405
408
|
|
|
406
409
|
// Small delay to ensure different timestamps
|
|
407
|
-
createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
408
|
-
createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
410
|
+
await createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
411
|
+
await createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
409
412
|
|
|
410
|
-
const logs = getLogsSince(db, sinceTime);
|
|
413
|
+
const logs = await getLogsSince(db, sinceTime);
|
|
411
414
|
|
|
412
415
|
// Should only get logs created after sinceTime
|
|
413
416
|
expect(logs.length).toBeGreaterThanOrEqual(0);
|
|
@@ -416,14 +419,14 @@ describe('logs queries', () => {
|
|
|
416
419
|
});
|
|
417
420
|
});
|
|
418
421
|
|
|
419
|
-
it('should return logs in ascending timestamp order', () => {
|
|
422
|
+
it('should return logs in ascending timestamp order', async () => {
|
|
420
423
|
const sinceTime = new Date().toISOString();
|
|
421
424
|
|
|
422
|
-
createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
423
|
-
createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
424
|
-
createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
425
|
+
await createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
426
|
+
await createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
427
|
+
await createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
425
428
|
|
|
426
|
-
const logs = getLogsSince(db, sinceTime);
|
|
429
|
+
const logs = await getLogsSince(db, sinceTime);
|
|
427
430
|
|
|
428
431
|
if (logs.length > 1) {
|
|
429
432
|
for (let i = 0; i < logs.length - 1; i++) {
|
|
@@ -432,24 +435,24 @@ describe('logs queries', () => {
|
|
|
432
435
|
}
|
|
433
436
|
});
|
|
434
437
|
|
|
435
|
-
it('should return empty array if no logs since timestamp', () => {
|
|
436
|
-
createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
438
|
+
it('should return empty array if no logs since timestamp', async () => {
|
|
439
|
+
await createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
437
440
|
|
|
438
441
|
const futureTime = new Date(Date.now() + 1000000).toISOString();
|
|
439
|
-
const logs = getLogsSince(db, futureTime);
|
|
442
|
+
const logs = await getLogsSince(db, futureTime);
|
|
440
443
|
|
|
441
444
|
expect(logs).toEqual([]);
|
|
442
445
|
});
|
|
443
446
|
});
|
|
444
447
|
|
|
445
448
|
describe('pruneOldLogs', () => {
|
|
446
|
-
it('should delete logs older than retention days', () => {
|
|
449
|
+
it('should delete logs older than retention days', async () => {
|
|
447
450
|
// Create a log with old timestamp (100 days ago)
|
|
448
451
|
const oldDate = new Date();
|
|
449
452
|
oldDate.setDate(oldDate.getDate() - 100);
|
|
450
453
|
|
|
451
454
|
// We need to manually insert to set a past timestamp
|
|
452
|
-
db.run(
|
|
455
|
+
db.db.run(
|
|
453
456
|
`
|
|
454
457
|
INSERT INTO agent_logs (agent_id, event_type, timestamp)
|
|
455
458
|
VALUES (?, ?, ?)
|
|
@@ -458,26 +461,26 @@ describe('logs queries', () => {
|
|
|
458
461
|
);
|
|
459
462
|
|
|
460
463
|
// Create a recent log
|
|
461
|
-
createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
464
|
+
await createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
462
465
|
|
|
463
|
-
const deletedCount = pruneOldLogs(db, 30);
|
|
466
|
+
const deletedCount = await pruneOldLogs(db, 30);
|
|
464
467
|
|
|
465
468
|
expect(deletedCount).toBe(1);
|
|
466
469
|
|
|
467
470
|
// Verify recent log still exists
|
|
468
|
-
const logs = getLogsByAgent(db, agentId);
|
|
471
|
+
const logs = await getLogsByAgent(db, agentId);
|
|
469
472
|
expect(logs).toHaveLength(1);
|
|
470
473
|
expect(logs[0].event_type).toBe('STORY_STARTED');
|
|
471
474
|
});
|
|
472
475
|
|
|
473
|
-
it('should return 0 if no logs to prune', () => {
|
|
474
|
-
createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
476
|
+
it('should return 0 if no logs to prune', async () => {
|
|
477
|
+
await createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
475
478
|
|
|
476
|
-
const deletedCount = pruneOldLogs(db, 30);
|
|
479
|
+
const deletedCount = await pruneOldLogs(db, 30);
|
|
477
480
|
expect(deletedCount).toBe(0);
|
|
478
481
|
});
|
|
479
482
|
|
|
480
|
-
it('should handle different retention periods', () => {
|
|
483
|
+
it('should handle different retention periods', async () => {
|
|
481
484
|
// Create logs with different ages
|
|
482
485
|
const date50DaysAgo = new Date();
|
|
483
486
|
date50DaysAgo.setDate(date50DaysAgo.getDate() - 50);
|
|
@@ -485,7 +488,7 @@ describe('logs queries', () => {
|
|
|
485
488
|
const date20DaysAgo = new Date();
|
|
486
489
|
date20DaysAgo.setDate(date20DaysAgo.getDate() - 20);
|
|
487
490
|
|
|
488
|
-
db.run(
|
|
491
|
+
db.db.run(
|
|
489
492
|
`
|
|
490
493
|
INSERT INTO agent_logs (agent_id, event_type, timestamp)
|
|
491
494
|
VALUES (?, ?, ?)
|
|
@@ -493,7 +496,7 @@ describe('logs queries', () => {
|
|
|
493
496
|
[agentId, 'AGENT_SPAWNED', date50DaysAgo.toISOString()]
|
|
494
497
|
);
|
|
495
498
|
|
|
496
|
-
db.run(
|
|
499
|
+
db.db.run(
|
|
497
500
|
`
|
|
498
501
|
INSERT INTO agent_logs (agent_id, event_type, timestamp)
|
|
499
502
|
VALUES (?, ?, ?)
|
|
@@ -501,67 +504,67 @@ describe('logs queries', () => {
|
|
|
501
504
|
[agentId, 'STORY_STARTED', date20DaysAgo.toISOString()]
|
|
502
505
|
);
|
|
503
506
|
|
|
504
|
-
createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
507
|
+
await createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
505
508
|
|
|
506
509
|
// Prune logs older than 30 days
|
|
507
|
-
const deletedCount = pruneOldLogs(db, 30);
|
|
510
|
+
const deletedCount = await pruneOldLogs(db, 30);
|
|
508
511
|
expect(deletedCount).toBe(1);
|
|
509
512
|
|
|
510
|
-
const remainingLogs = getLogsByAgent(db, agentId);
|
|
513
|
+
const remainingLogs = await getLogsByAgent(db, agentId);
|
|
511
514
|
expect(remainingLogs).toHaveLength(2);
|
|
512
515
|
});
|
|
513
516
|
});
|
|
514
517
|
|
|
515
518
|
describe('countQaFailuresByStory', () => {
|
|
516
|
-
it('should count STORY_QA_FAILED events for a specific story', () => {
|
|
517
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
518
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
519
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
519
|
+
it('should count STORY_QA_FAILED events for a specific story', async () => {
|
|
520
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
521
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
522
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
520
523
|
|
|
521
|
-
const count = countQaFailuresByStory(db, storyId);
|
|
524
|
+
const count = await countQaFailuresByStory(db, storyId);
|
|
522
525
|
|
|
523
526
|
expect(count).toBe(3);
|
|
524
527
|
});
|
|
525
528
|
|
|
526
|
-
it('should not count other event types for a story', () => {
|
|
527
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
528
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_QA_PASSED' });
|
|
529
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_STARTED' });
|
|
529
|
+
it('should not count other event types for a story', async () => {
|
|
530
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
531
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_QA_PASSED' });
|
|
532
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_STARTED' });
|
|
530
533
|
|
|
531
|
-
const count = countQaFailuresByStory(db, storyId);
|
|
534
|
+
const count = await countQaFailuresByStory(db, storyId);
|
|
532
535
|
|
|
533
536
|
expect(count).toBe(1);
|
|
534
537
|
});
|
|
535
538
|
|
|
536
|
-
it('should only count failures for the specified story', () => {
|
|
537
|
-
const story2 = createStory(db, {
|
|
539
|
+
it('should only count failures for the specified story', async () => {
|
|
540
|
+
const story2 = await createStory(db, {
|
|
538
541
|
teamId,
|
|
539
542
|
title: 'Story 2',
|
|
540
543
|
description: 'Description',
|
|
541
544
|
});
|
|
542
545
|
|
|
543
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
544
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
545
|
-
createLog(db, { agentId, storyId: story2.id, eventType: 'STORY_QA_FAILED' });
|
|
546
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
547
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
548
|
+
await createLog(db, { agentId, storyId: story2.id, eventType: 'STORY_QA_FAILED' });
|
|
546
549
|
|
|
547
|
-
const count1 = countQaFailuresByStory(db, storyId);
|
|
548
|
-
const count2 = countQaFailuresByStory(db, story2.id);
|
|
550
|
+
const count1 = await countQaFailuresByStory(db, storyId);
|
|
551
|
+
const count2 = await countQaFailuresByStory(db, story2.id);
|
|
549
552
|
|
|
550
553
|
expect(count1).toBe(2);
|
|
551
554
|
expect(count2).toBe(1);
|
|
552
555
|
});
|
|
553
556
|
|
|
554
|
-
it('should return 0 for story with no QA failures', () => {
|
|
555
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_STARTED' });
|
|
556
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_COMPLETED' });
|
|
557
|
+
it('should return 0 for story with no QA failures', async () => {
|
|
558
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_STARTED' });
|
|
559
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_COMPLETED' });
|
|
557
560
|
|
|
558
|
-
const count = countQaFailuresByStory(db, storyId);
|
|
561
|
+
const count = await countQaFailuresByStory(db, storyId);
|
|
559
562
|
|
|
560
563
|
expect(count).toBe(0);
|
|
561
564
|
});
|
|
562
565
|
|
|
563
|
-
it('should return 0 for non-existent story', () => {
|
|
564
|
-
const count = countQaFailuresByStory(db, 'non-existent-story');
|
|
566
|
+
it('should return 0 for non-existent story', async () => {
|
|
567
|
+
const count = await countQaFailuresByStory(db, 'non-existent-story');
|
|
565
568
|
|
|
566
569
|
expect(count).toBe(0);
|
|
567
570
|
});
|