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,6 +1,7 @@
|
|
|
1
1
|
// Licensed under the Hungry Ghost Hive License. See LICENSE.
|
|
2
2
|
import initSqlJs from 'sql.js';
|
|
3
3
|
import { beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
+
import { SqliteProvider } from '../provider.js';
|
|
4
5
|
import { createAgent } from './agents.js';
|
|
5
6
|
import { countQaFailuresByStory, createLog, getLogById, getLogsByAgent, getLogsByEventType, getLogsByStory, getLogsSince, getRecentLogs, pruneOldLogs, } from './logs.js';
|
|
6
7
|
import { createStory } from './stories.js';
|
|
@@ -12,20 +13,21 @@ describe('logs queries', () => {
|
|
|
12
13
|
let agentId;
|
|
13
14
|
let storyId;
|
|
14
15
|
beforeEach(async () => {
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
const rawDb = await createTestDatabase();
|
|
17
|
+
db = new SqliteProvider(rawDb);
|
|
18
|
+
const team = await createTeam(db, {
|
|
17
19
|
repoUrl: 'https://github.com/test/repo.git',
|
|
18
20
|
repoPath: '/path/to/repo',
|
|
19
21
|
name: 'Test Team',
|
|
20
22
|
});
|
|
21
23
|
teamId = team.id;
|
|
22
|
-
const agent = createAgent(db, {
|
|
24
|
+
const agent = await createAgent(db, {
|
|
23
25
|
type: 'senior',
|
|
24
26
|
teamId,
|
|
25
27
|
model: 'claude-sonnet-4-5',
|
|
26
28
|
});
|
|
27
29
|
agentId = agent.id;
|
|
28
|
-
const story = createStory(db, {
|
|
30
|
+
const story = await createStory(db, {
|
|
29
31
|
teamId,
|
|
30
32
|
title: 'Test Story',
|
|
31
33
|
description: 'Test description',
|
|
@@ -33,9 +35,9 @@ describe('logs queries', () => {
|
|
|
33
35
|
storyId = story.id;
|
|
34
36
|
});
|
|
35
37
|
describe('createLog', () => {
|
|
36
|
-
it('should create a log entry with all fields', () => {
|
|
38
|
+
it('should create a log entry with all fields', async () => {
|
|
37
39
|
const metadata = { key: 'value', count: 42 };
|
|
38
|
-
const log = createLog(db, {
|
|
40
|
+
const log = await createLog(db, {
|
|
39
41
|
agentId,
|
|
40
42
|
storyId,
|
|
41
43
|
eventType: 'STORY_STARTED',
|
|
@@ -52,8 +54,8 @@ describe('logs queries', () => {
|
|
|
52
54
|
expect(log.metadata).toBe(JSON.stringify(metadata));
|
|
53
55
|
expect(log.timestamp).toBeDefined();
|
|
54
56
|
});
|
|
55
|
-
it('should create a log entry with minimal fields', () => {
|
|
56
|
-
const log = createLog(db, {
|
|
57
|
+
it('should create a log entry with minimal fields', async () => {
|
|
58
|
+
const log = await createLog(db, {
|
|
57
59
|
agentId,
|
|
58
60
|
eventType: 'AGENT_SPAWNED',
|
|
59
61
|
});
|
|
@@ -65,8 +67,8 @@ describe('logs queries', () => {
|
|
|
65
67
|
expect(log.message).toBeNull();
|
|
66
68
|
expect(log.metadata).toBeNull();
|
|
67
69
|
});
|
|
68
|
-
it('should create a log entry without story', () => {
|
|
69
|
-
const log = createLog(db, {
|
|
70
|
+
it('should create a log entry without story', async () => {
|
|
71
|
+
const log = await createLog(db, {
|
|
70
72
|
agentId,
|
|
71
73
|
eventType: 'AGENT_TERMINATED',
|
|
72
74
|
message: 'Agent terminated',
|
|
@@ -76,50 +78,50 @@ describe('logs queries', () => {
|
|
|
76
78
|
expect(log.event_type).toBe('AGENT_TERMINATED');
|
|
77
79
|
expect(log.message).toBe('Agent terminated');
|
|
78
80
|
});
|
|
79
|
-
it('should handle null metadata', () => {
|
|
80
|
-
const log = createLog(db, {
|
|
81
|
+
it('should handle null metadata', async () => {
|
|
82
|
+
const log = await createLog(db, {
|
|
81
83
|
agentId,
|
|
82
84
|
eventType: 'STORY_STARTED',
|
|
83
85
|
metadata: null,
|
|
84
86
|
});
|
|
85
87
|
expect(log.metadata).toBeNull();
|
|
86
88
|
});
|
|
87
|
-
it('should serialize complex metadata', () => {
|
|
89
|
+
it('should serialize complex metadata', async () => {
|
|
88
90
|
const metadata = {
|
|
89
91
|
nested: { value: 'test' },
|
|
90
92
|
array: [1, 2, 3],
|
|
91
93
|
bool: true,
|
|
92
94
|
};
|
|
93
|
-
const log = createLog(db, {
|
|
95
|
+
const log = await createLog(db, {
|
|
94
96
|
agentId,
|
|
95
97
|
eventType: 'BUILD_STARTED',
|
|
96
98
|
metadata,
|
|
97
99
|
});
|
|
98
100
|
expect(log.metadata).toBe(JSON.stringify(metadata));
|
|
99
101
|
});
|
|
100
|
-
it('should resolve tmux session names to canonical agent IDs', () => {
|
|
101
|
-
const qaAgent = createAgent(db, {
|
|
102
|
+
it('should resolve tmux session names to canonical agent IDs', async () => {
|
|
103
|
+
const qaAgent = await createAgent(db, {
|
|
102
104
|
type: 'qa',
|
|
103
105
|
teamId,
|
|
104
106
|
tmuxSession: 'hive-qa-testteam',
|
|
105
107
|
});
|
|
106
|
-
const log = createLog(db, {
|
|
108
|
+
const log = await createLog(db, {
|
|
107
109
|
agentId: 'hive-qa-testteam',
|
|
108
110
|
eventType: 'PR_REVIEW_STARTED',
|
|
109
111
|
});
|
|
110
112
|
expect(log.agent_id).toBe(qaAgent.id);
|
|
111
113
|
});
|
|
112
|
-
it('should create a synthetic agent row for unknown system actors', () => {
|
|
113
|
-
const log = createLog(db, {
|
|
114
|
+
it('should create a synthetic agent row for unknown system actors', async () => {
|
|
115
|
+
const log = await createLog(db, {
|
|
114
116
|
agentId: 'scheduler',
|
|
115
117
|
eventType: 'TEAM_SCALED_UP',
|
|
116
118
|
});
|
|
117
119
|
expect(log.agent_id).toBe('scheduler');
|
|
118
|
-
const result = db.exec("SELECT id, type, status FROM agents WHERE id = 'scheduler'");
|
|
120
|
+
const result = db.db.exec("SELECT id, type, status FROM agents WHERE id = 'scheduler'");
|
|
119
121
|
expect(result[0]?.values[0]).toEqual(['scheduler', 'tech_lead', 'terminated']);
|
|
120
122
|
});
|
|
121
|
-
it('should drop invalid story references to avoid FK failures', () => {
|
|
122
|
-
const log = createLog(db, {
|
|
123
|
+
it('should drop invalid story references to avoid FK failures', async () => {
|
|
124
|
+
const log = await createLog(db, {
|
|
123
125
|
agentId,
|
|
124
126
|
storyId: 'STORY-DOES-NOT-EXIST',
|
|
125
127
|
eventType: 'STORY_PROGRESS_UPDATE',
|
|
@@ -128,9 +130,9 @@ describe('logs queries', () => {
|
|
|
128
130
|
});
|
|
129
131
|
it('should support legacy agents schemas without last_seen', async () => {
|
|
130
132
|
const SQL = await initSqlJs();
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
const legacyRawDb = new SQL.Database();
|
|
134
|
+
legacyRawDb.run('PRAGMA foreign_keys = ON');
|
|
135
|
+
legacyRawDb.run(`
|
|
134
136
|
CREATE TABLE agents (
|
|
135
137
|
id TEXT PRIMARY KEY,
|
|
136
138
|
type TEXT,
|
|
@@ -139,8 +141,8 @@ describe('logs queries', () => {
|
|
|
139
141
|
updated_at TIMESTAMP
|
|
140
142
|
);
|
|
141
143
|
`);
|
|
142
|
-
|
|
143
|
-
|
|
144
|
+
legacyRawDb.run(`CREATE TABLE stories (id TEXT PRIMARY KEY);`);
|
|
145
|
+
legacyRawDb.run(`
|
|
144
146
|
CREATE TABLE agent_logs (
|
|
145
147
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
146
148
|
agent_id TEXT NOT NULL REFERENCES agents(id),
|
|
@@ -152,53 +154,54 @@ describe('logs queries', () => {
|
|
|
152
154
|
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
153
155
|
);
|
|
154
156
|
`);
|
|
155
|
-
const
|
|
157
|
+
const legacyDb = new SqliteProvider(legacyRawDb);
|
|
158
|
+
const log = await createLog(legacyDb, {
|
|
156
159
|
agentId: 'scheduler',
|
|
157
160
|
eventType: 'TEAM_SCALED_UP',
|
|
158
161
|
});
|
|
159
162
|
expect(log.agent_id).toBe('scheduler');
|
|
160
|
-
const row =
|
|
163
|
+
const row = legacyRawDb.exec("SELECT id, status FROM agents WHERE id = 'scheduler'");
|
|
161
164
|
expect(row[0]?.values[0]).toEqual(['scheduler', 'terminated']);
|
|
162
165
|
});
|
|
163
166
|
});
|
|
164
167
|
describe('getLogById', () => {
|
|
165
|
-
it('should retrieve a log by ID', () => {
|
|
166
|
-
const created = createLog(db, {
|
|
168
|
+
it('should retrieve a log by ID', async () => {
|
|
169
|
+
const created = await createLog(db, {
|
|
167
170
|
agentId,
|
|
168
171
|
eventType: 'STORY_STARTED',
|
|
169
172
|
message: 'Test log',
|
|
170
173
|
});
|
|
171
|
-
const retrieved = getLogById(db, created.id);
|
|
174
|
+
const retrieved = await getLogById(db, created.id);
|
|
172
175
|
expect(retrieved).toBeDefined();
|
|
173
176
|
expect(retrieved?.id).toBe(created.id);
|
|
174
177
|
expect(retrieved?.agent_id).toBe(agentId);
|
|
175
178
|
expect(retrieved?.event_type).toBe('STORY_STARTED');
|
|
176
179
|
expect(retrieved?.message).toBe('Test log');
|
|
177
180
|
});
|
|
178
|
-
it('should return undefined for non-existent log', () => {
|
|
179
|
-
const log = getLogById(db, 99999);
|
|
181
|
+
it('should return undefined for non-existent log', async () => {
|
|
182
|
+
const log = await getLogById(db, 99999);
|
|
180
183
|
expect(log).toBeUndefined();
|
|
181
184
|
});
|
|
182
185
|
});
|
|
183
186
|
describe('getLogsByAgent', () => {
|
|
184
|
-
it('should retrieve all logs for an agent', () => {
|
|
185
|
-
createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
186
|
-
createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
187
|
-
createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
187
|
+
it('should retrieve all logs for an agent', async () => {
|
|
188
|
+
await createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
189
|
+
await createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
190
|
+
await createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
188
191
|
// Create log for different agent
|
|
189
|
-
const agent2 = createAgent(db, { type: 'junior', teamId });
|
|
190
|
-
createLog(db, { agentId: agent2.id, eventType: 'AGENT_SPAWNED' });
|
|
191
|
-
const logs = getLogsByAgent(db, agentId);
|
|
192
|
+
const agent2 = await createAgent(db, { type: 'junior', teamId });
|
|
193
|
+
await createLog(db, { agentId: agent2.id, eventType: 'AGENT_SPAWNED' });
|
|
194
|
+
const logs = await getLogsByAgent(db, agentId);
|
|
192
195
|
expect(logs).toHaveLength(3);
|
|
193
196
|
logs.forEach(log => {
|
|
194
197
|
expect(log.agent_id).toBe(agentId);
|
|
195
198
|
});
|
|
196
199
|
});
|
|
197
|
-
it('should return logs in descending timestamp order', () => {
|
|
198
|
-
createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
199
|
-
createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
200
|
-
createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
201
|
-
const logs = getLogsByAgent(db, agentId);
|
|
200
|
+
it('should return logs in descending timestamp order', async () => {
|
|
201
|
+
await createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
202
|
+
await createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
203
|
+
await createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
204
|
+
const logs = await getLogsByAgent(db, agentId);
|
|
202
205
|
// Should be in descending order (newest first)
|
|
203
206
|
expect(logs).toHaveLength(3);
|
|
204
207
|
// Verify timestamps are in descending order
|
|
@@ -206,237 +209,237 @@ describe('logs queries', () => {
|
|
|
206
209
|
expect(logs[i].timestamp >= logs[i + 1].timestamp).toBe(true);
|
|
207
210
|
}
|
|
208
211
|
});
|
|
209
|
-
it('should respect the limit parameter', () => {
|
|
212
|
+
it('should respect the limit parameter', async () => {
|
|
210
213
|
// Create 10 logs
|
|
211
214
|
for (let i = 0; i < 10; i++) {
|
|
212
|
-
createLog(db, { agentId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
215
|
+
await createLog(db, { agentId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
213
216
|
}
|
|
214
|
-
const logs = getLogsByAgent(db, agentId, 5);
|
|
217
|
+
const logs = await getLogsByAgent(db, agentId, 5);
|
|
215
218
|
expect(logs).toHaveLength(5);
|
|
216
219
|
});
|
|
217
|
-
it('should use default limit of 100', () => {
|
|
220
|
+
it('should use default limit of 100', async () => {
|
|
218
221
|
// Create 5 logs
|
|
219
222
|
for (let i = 0; i < 5; i++) {
|
|
220
|
-
createLog(db, { agentId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
223
|
+
await createLog(db, { agentId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
221
224
|
}
|
|
222
|
-
const logs = getLogsByAgent(db, agentId);
|
|
225
|
+
const logs = await getLogsByAgent(db, agentId);
|
|
223
226
|
expect(logs).toHaveLength(5);
|
|
224
227
|
});
|
|
225
|
-
it('should return empty array for agent with no logs', () => {
|
|
226
|
-
const agent2 = createAgent(db, { type: 'junior', teamId });
|
|
227
|
-
const logs = getLogsByAgent(db, agent2.id);
|
|
228
|
+
it('should return empty array for agent with no logs', async () => {
|
|
229
|
+
const agent2 = await createAgent(db, { type: 'junior', teamId });
|
|
230
|
+
const logs = await getLogsByAgent(db, agent2.id);
|
|
228
231
|
expect(logs).toEqual([]);
|
|
229
232
|
});
|
|
230
233
|
});
|
|
231
234
|
describe('getLogsByStory', () => {
|
|
232
|
-
it('should retrieve all logs for a story', () => {
|
|
233
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_STARTED' });
|
|
234
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
235
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_COMPLETED' });
|
|
235
|
+
it('should retrieve all logs for a story', async () => {
|
|
236
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_STARTED' });
|
|
237
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
238
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_COMPLETED' });
|
|
236
239
|
// Create log for different story
|
|
237
|
-
const story2 = createStory(db, {
|
|
240
|
+
const story2 = await createStory(db, {
|
|
238
241
|
teamId,
|
|
239
242
|
title: 'Story 2',
|
|
240
243
|
description: 'Description',
|
|
241
244
|
});
|
|
242
|
-
createLog(db, { agentId, storyId: story2.id, eventType: 'STORY_STARTED' });
|
|
243
|
-
const logs = getLogsByStory(db, storyId);
|
|
245
|
+
await createLog(db, { agentId, storyId: story2.id, eventType: 'STORY_STARTED' });
|
|
246
|
+
const logs = await getLogsByStory(db, storyId);
|
|
244
247
|
expect(logs).toHaveLength(3);
|
|
245
248
|
logs.forEach(log => {
|
|
246
249
|
expect(log.story_id).toBe(storyId);
|
|
247
250
|
});
|
|
248
251
|
});
|
|
249
|
-
it('should return logs in descending timestamp order', () => {
|
|
250
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_STARTED' });
|
|
251
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
252
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_COMPLETED' });
|
|
253
|
-
const logs = getLogsByStory(db, storyId);
|
|
252
|
+
it('should return logs in descending timestamp order', async () => {
|
|
253
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_STARTED' });
|
|
254
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
255
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_COMPLETED' });
|
|
256
|
+
const logs = await getLogsByStory(db, storyId);
|
|
254
257
|
expect(logs).toHaveLength(3);
|
|
255
258
|
// Verify timestamps are in descending order
|
|
256
259
|
for (let i = 0; i < logs.length - 1; i++) {
|
|
257
260
|
expect(logs[i].timestamp >= logs[i + 1].timestamp).toBe(true);
|
|
258
261
|
}
|
|
259
262
|
});
|
|
260
|
-
it('should return empty array for story with no logs', () => {
|
|
261
|
-
const story2 = createStory(db, {
|
|
263
|
+
it('should return empty array for story with no logs', async () => {
|
|
264
|
+
const story2 = await createStory(db, {
|
|
262
265
|
teamId,
|
|
263
266
|
title: 'Story 2',
|
|
264
267
|
description: 'Description',
|
|
265
268
|
});
|
|
266
|
-
const logs = getLogsByStory(db, story2.id);
|
|
269
|
+
const logs = await getLogsByStory(db, story2.id);
|
|
267
270
|
expect(logs).toEqual([]);
|
|
268
271
|
});
|
|
269
272
|
});
|
|
270
273
|
describe('getLogsByEventType', () => {
|
|
271
|
-
it('should retrieve all logs of a specific event type', () => {
|
|
272
|
-
createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
273
|
-
createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
274
|
-
createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
275
|
-
const logs = getLogsByEventType(db, 'STORY_STARTED');
|
|
274
|
+
it('should retrieve all logs of a specific event type', async () => {
|
|
275
|
+
await createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
276
|
+
await createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
277
|
+
await createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
278
|
+
const logs = await getLogsByEventType(db, 'STORY_STARTED');
|
|
276
279
|
expect(logs).toHaveLength(2);
|
|
277
280
|
logs.forEach(log => {
|
|
278
281
|
expect(log.event_type).toBe('STORY_STARTED');
|
|
279
282
|
});
|
|
280
283
|
});
|
|
281
|
-
it('should respect the limit parameter', () => {
|
|
284
|
+
it('should respect the limit parameter', async () => {
|
|
282
285
|
for (let i = 0; i < 10; i++) {
|
|
283
|
-
createLog(db, { agentId, eventType: 'BUILD_STARTED' });
|
|
286
|
+
await createLog(db, { agentId, eventType: 'BUILD_STARTED' });
|
|
284
287
|
}
|
|
285
|
-
const logs = getLogsByEventType(db, 'BUILD_STARTED', 5);
|
|
288
|
+
const logs = await getLogsByEventType(db, 'BUILD_STARTED', 5);
|
|
286
289
|
expect(logs).toHaveLength(5);
|
|
287
290
|
});
|
|
288
|
-
it('should return empty array for event type with no logs', () => {
|
|
289
|
-
const logs = getLogsByEventType(db, 'PR_REJECTED');
|
|
291
|
+
it('should return empty array for event type with no logs', async () => {
|
|
292
|
+
const logs = await getLogsByEventType(db, 'PR_REJECTED');
|
|
290
293
|
expect(logs).toEqual([]);
|
|
291
294
|
});
|
|
292
295
|
});
|
|
293
296
|
describe('getRecentLogs', () => {
|
|
294
|
-
it('should retrieve recent logs', () => {
|
|
295
|
-
createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
296
|
-
createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
297
|
-
createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
298
|
-
const logs = getRecentLogs(db);
|
|
297
|
+
it('should retrieve recent logs', async () => {
|
|
298
|
+
await createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
299
|
+
await createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
300
|
+
await createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
301
|
+
const logs = await getRecentLogs(db);
|
|
299
302
|
expect(logs.length).toBeGreaterThan(0);
|
|
300
303
|
});
|
|
301
|
-
it('should respect the limit parameter', () => {
|
|
304
|
+
it('should respect the limit parameter', async () => {
|
|
302
305
|
for (let i = 0; i < 10; i++) {
|
|
303
|
-
createLog(db, { agentId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
306
|
+
await createLog(db, { agentId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
304
307
|
}
|
|
305
|
-
const logs = getRecentLogs(db, 5);
|
|
308
|
+
const logs = await getRecentLogs(db, 5);
|
|
306
309
|
expect(logs).toHaveLength(5);
|
|
307
310
|
});
|
|
308
|
-
it('should return logs in descending timestamp order', () => {
|
|
309
|
-
createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
310
|
-
createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
311
|
-
createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
312
|
-
const logs = getRecentLogs(db);
|
|
311
|
+
it('should return logs in descending timestamp order', async () => {
|
|
312
|
+
await createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
313
|
+
await createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
314
|
+
await createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
315
|
+
const logs = await getRecentLogs(db);
|
|
313
316
|
expect(logs[0].event_type).toBe('STORY_COMPLETED');
|
|
314
317
|
expect(logs[2].event_type).toBe('AGENT_SPAWNED');
|
|
315
318
|
});
|
|
316
|
-
it('should use default limit of 50', () => {
|
|
319
|
+
it('should use default limit of 50', async () => {
|
|
317
320
|
for (let i = 0; i < 60; i++) {
|
|
318
|
-
createLog(db, { agentId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
321
|
+
await createLog(db, { agentId, eventType: 'STORY_PROGRESS_UPDATE' });
|
|
319
322
|
}
|
|
320
|
-
const logs = getRecentLogs(db);
|
|
323
|
+
const logs = await getRecentLogs(db);
|
|
321
324
|
expect(logs).toHaveLength(50);
|
|
322
325
|
});
|
|
323
326
|
});
|
|
324
327
|
describe('getLogsSince', () => {
|
|
325
|
-
it('should retrieve logs since a specific timestamp', () => {
|
|
326
|
-
createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
328
|
+
it('should retrieve logs since a specific timestamp', async () => {
|
|
329
|
+
await createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
327
330
|
const sinceTime = new Date().toISOString();
|
|
328
331
|
// Small delay to ensure different timestamps
|
|
329
|
-
createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
330
|
-
createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
331
|
-
const logs = getLogsSince(db, sinceTime);
|
|
332
|
+
await createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
333
|
+
await createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
334
|
+
const logs = await getLogsSince(db, sinceTime);
|
|
332
335
|
// Should only get logs created after sinceTime
|
|
333
336
|
expect(logs.length).toBeGreaterThanOrEqual(0);
|
|
334
337
|
logs.forEach(log => {
|
|
335
338
|
expect(log.timestamp > sinceTime).toBe(true);
|
|
336
339
|
});
|
|
337
340
|
});
|
|
338
|
-
it('should return logs in ascending timestamp order', () => {
|
|
341
|
+
it('should return logs in ascending timestamp order', async () => {
|
|
339
342
|
const sinceTime = new Date().toISOString();
|
|
340
|
-
createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
341
|
-
createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
342
|
-
createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
343
|
-
const logs = getLogsSince(db, sinceTime);
|
|
343
|
+
await createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
344
|
+
await createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
345
|
+
await createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
346
|
+
const logs = await getLogsSince(db, sinceTime);
|
|
344
347
|
if (logs.length > 1) {
|
|
345
348
|
for (let i = 0; i < logs.length - 1; i++) {
|
|
346
349
|
expect(logs[i].timestamp <= logs[i + 1].timestamp).toBe(true);
|
|
347
350
|
}
|
|
348
351
|
}
|
|
349
352
|
});
|
|
350
|
-
it('should return empty array if no logs since timestamp', () => {
|
|
351
|
-
createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
353
|
+
it('should return empty array if no logs since timestamp', async () => {
|
|
354
|
+
await createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
352
355
|
const futureTime = new Date(Date.now() + 1000000).toISOString();
|
|
353
|
-
const logs = getLogsSince(db, futureTime);
|
|
356
|
+
const logs = await getLogsSince(db, futureTime);
|
|
354
357
|
expect(logs).toEqual([]);
|
|
355
358
|
});
|
|
356
359
|
});
|
|
357
360
|
describe('pruneOldLogs', () => {
|
|
358
|
-
it('should delete logs older than retention days', () => {
|
|
361
|
+
it('should delete logs older than retention days', async () => {
|
|
359
362
|
// Create a log with old timestamp (100 days ago)
|
|
360
363
|
const oldDate = new Date();
|
|
361
364
|
oldDate.setDate(oldDate.getDate() - 100);
|
|
362
365
|
// We need to manually insert to set a past timestamp
|
|
363
|
-
db.run(`
|
|
366
|
+
db.db.run(`
|
|
364
367
|
INSERT INTO agent_logs (agent_id, event_type, timestamp)
|
|
365
368
|
VALUES (?, ?, ?)
|
|
366
369
|
`, [agentId, 'AGENT_SPAWNED', oldDate.toISOString()]);
|
|
367
370
|
// Create a recent log
|
|
368
|
-
createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
369
|
-
const deletedCount = pruneOldLogs(db, 30);
|
|
371
|
+
await createLog(db, { agentId, eventType: 'STORY_STARTED' });
|
|
372
|
+
const deletedCount = await pruneOldLogs(db, 30);
|
|
370
373
|
expect(deletedCount).toBe(1);
|
|
371
374
|
// Verify recent log still exists
|
|
372
|
-
const logs = getLogsByAgent(db, agentId);
|
|
375
|
+
const logs = await getLogsByAgent(db, agentId);
|
|
373
376
|
expect(logs).toHaveLength(1);
|
|
374
377
|
expect(logs[0].event_type).toBe('STORY_STARTED');
|
|
375
378
|
});
|
|
376
|
-
it('should return 0 if no logs to prune', () => {
|
|
377
|
-
createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
378
|
-
const deletedCount = pruneOldLogs(db, 30);
|
|
379
|
+
it('should return 0 if no logs to prune', async () => {
|
|
380
|
+
await createLog(db, { agentId, eventType: 'AGENT_SPAWNED' });
|
|
381
|
+
const deletedCount = await pruneOldLogs(db, 30);
|
|
379
382
|
expect(deletedCount).toBe(0);
|
|
380
383
|
});
|
|
381
|
-
it('should handle different retention periods', () => {
|
|
384
|
+
it('should handle different retention periods', async () => {
|
|
382
385
|
// Create logs with different ages
|
|
383
386
|
const date50DaysAgo = new Date();
|
|
384
387
|
date50DaysAgo.setDate(date50DaysAgo.getDate() - 50);
|
|
385
388
|
const date20DaysAgo = new Date();
|
|
386
389
|
date20DaysAgo.setDate(date20DaysAgo.getDate() - 20);
|
|
387
|
-
db.run(`
|
|
390
|
+
db.db.run(`
|
|
388
391
|
INSERT INTO agent_logs (agent_id, event_type, timestamp)
|
|
389
392
|
VALUES (?, ?, ?)
|
|
390
393
|
`, [agentId, 'AGENT_SPAWNED', date50DaysAgo.toISOString()]);
|
|
391
|
-
db.run(`
|
|
394
|
+
db.db.run(`
|
|
392
395
|
INSERT INTO agent_logs (agent_id, event_type, timestamp)
|
|
393
396
|
VALUES (?, ?, ?)
|
|
394
397
|
`, [agentId, 'STORY_STARTED', date20DaysAgo.toISOString()]);
|
|
395
|
-
createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
398
|
+
await createLog(db, { agentId, eventType: 'STORY_COMPLETED' });
|
|
396
399
|
// Prune logs older than 30 days
|
|
397
|
-
const deletedCount = pruneOldLogs(db, 30);
|
|
400
|
+
const deletedCount = await pruneOldLogs(db, 30);
|
|
398
401
|
expect(deletedCount).toBe(1);
|
|
399
|
-
const remainingLogs = getLogsByAgent(db, agentId);
|
|
402
|
+
const remainingLogs = await getLogsByAgent(db, agentId);
|
|
400
403
|
expect(remainingLogs).toHaveLength(2);
|
|
401
404
|
});
|
|
402
405
|
});
|
|
403
406
|
describe('countQaFailuresByStory', () => {
|
|
404
|
-
it('should count STORY_QA_FAILED events for a specific story', () => {
|
|
405
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
406
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
407
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
408
|
-
const count = countQaFailuresByStory(db, storyId);
|
|
407
|
+
it('should count STORY_QA_FAILED events for a specific story', async () => {
|
|
408
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
409
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
410
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
411
|
+
const count = await countQaFailuresByStory(db, storyId);
|
|
409
412
|
expect(count).toBe(3);
|
|
410
413
|
});
|
|
411
|
-
it('should not count other event types for a story', () => {
|
|
412
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
413
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_QA_PASSED' });
|
|
414
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_STARTED' });
|
|
415
|
-
const count = countQaFailuresByStory(db, storyId);
|
|
414
|
+
it('should not count other event types for a story', async () => {
|
|
415
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
416
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_QA_PASSED' });
|
|
417
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_STARTED' });
|
|
418
|
+
const count = await countQaFailuresByStory(db, storyId);
|
|
416
419
|
expect(count).toBe(1);
|
|
417
420
|
});
|
|
418
|
-
it('should only count failures for the specified story', () => {
|
|
419
|
-
const story2 = createStory(db, {
|
|
421
|
+
it('should only count failures for the specified story', async () => {
|
|
422
|
+
const story2 = await createStory(db, {
|
|
420
423
|
teamId,
|
|
421
424
|
title: 'Story 2',
|
|
422
425
|
description: 'Description',
|
|
423
426
|
});
|
|
424
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
425
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
426
|
-
createLog(db, { agentId, storyId: story2.id, eventType: 'STORY_QA_FAILED' });
|
|
427
|
-
const count1 = countQaFailuresByStory(db, storyId);
|
|
428
|
-
const count2 = countQaFailuresByStory(db, story2.id);
|
|
427
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
428
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_QA_FAILED' });
|
|
429
|
+
await createLog(db, { agentId, storyId: story2.id, eventType: 'STORY_QA_FAILED' });
|
|
430
|
+
const count1 = await countQaFailuresByStory(db, storyId);
|
|
431
|
+
const count2 = await countQaFailuresByStory(db, story2.id);
|
|
429
432
|
expect(count1).toBe(2);
|
|
430
433
|
expect(count2).toBe(1);
|
|
431
434
|
});
|
|
432
|
-
it('should return 0 for story with no QA failures', () => {
|
|
433
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_STARTED' });
|
|
434
|
-
createLog(db, { agentId, storyId, eventType: 'STORY_COMPLETED' });
|
|
435
|
-
const count = countQaFailuresByStory(db, storyId);
|
|
435
|
+
it('should return 0 for story with no QA failures', async () => {
|
|
436
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_STARTED' });
|
|
437
|
+
await createLog(db, { agentId, storyId, eventType: 'STORY_COMPLETED' });
|
|
438
|
+
const count = await countQaFailuresByStory(db, storyId);
|
|
436
439
|
expect(count).toBe(0);
|
|
437
440
|
});
|
|
438
|
-
it('should return 0 for non-existent story', () => {
|
|
439
|
-
const count = countQaFailuresByStory(db, 'non-existent-story');
|
|
441
|
+
it('should return 0 for non-existent story', async () => {
|
|
442
|
+
const count = await countQaFailuresByStory(db, 'non-existent-story');
|
|
440
443
|
expect(count).toBe(0);
|
|
441
444
|
});
|
|
442
445
|
});
|