hungry-ghost-hive 0.45.0 → 0.46.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/cli/commands/cluster.d.ts.map +1 -1
- package/dist/cli/commands/cluster.js +348 -1
- package/dist/cli/commands/cluster.js.map +1 -1
- package/dist/cli/commands/cluster.test.js +313 -9
- package/dist/cli/commands/cluster.test.js.map +1 -1
- package/dist/cli/commands/req-spawn.test.d.ts +2 -0
- package/dist/cli/commands/req-spawn.test.d.ts.map +1 -0
- package/dist/cli/commands/req-spawn.test.js +116 -0
- package/dist/cli/commands/req-spawn.test.js.map +1 -0
- package/dist/cli/commands/req.d.ts.map +1 -1
- package/dist/cli/commands/req.js +21 -13
- package/dist/cli/commands/req.js.map +1 -1
- package/dist/cluster/cluster-http-server.d.ts +32 -0
- package/dist/cluster/cluster-http-server.d.ts.map +1 -1
- package/dist/cluster/cluster-http-server.js +42 -0
- package/dist/cluster/cluster-http-server.js.map +1 -1
- package/dist/cluster/distributed-runtime-coverage.test.js +9 -0
- package/dist/cluster/distributed-runtime-coverage.test.js.map +1 -1
- package/dist/cluster/distributed-system.test.js +135 -0
- package/dist/cluster/distributed-system.test.js.map +1 -1
- package/dist/cluster/events.d.ts +23 -0
- package/dist/cluster/events.d.ts.map +1 -1
- package/dist/cluster/events.js +74 -0
- package/dist/cluster/events.js.map +1 -1
- package/dist/cluster/heartbeat-manager.d.ts +2 -0
- package/dist/cluster/heartbeat-manager.d.ts.map +1 -1
- package/dist/cluster/heartbeat-manager.js +42 -6
- package/dist/cluster/heartbeat-manager.js.map +1 -1
- package/dist/cluster/membership.test.d.ts +2 -0
- package/dist/cluster/membership.test.d.ts.map +1 -0
- package/dist/cluster/membership.test.js +416 -0
- package/dist/cluster/membership.test.js.map +1 -0
- package/dist/cluster/partition-safety.test.d.ts +2 -0
- package/dist/cluster/partition-safety.test.d.ts.map +1 -0
- package/dist/cluster/partition-safety.test.js +440 -0
- package/dist/cluster/partition-safety.test.js.map +1 -0
- package/dist/cluster/raft-state-machine.d.ts +33 -1
- package/dist/cluster/raft-state-machine.d.ts.map +1 -1
- package/dist/cluster/raft-state-machine.js +65 -3
- package/dist/cluster/raft-state-machine.js.map +1 -1
- package/dist/cluster/raft-store.d.ts +26 -1
- package/dist/cluster/raft-store.d.ts.map +1 -1
- package/dist/cluster/raft-store.js +137 -0
- package/dist/cluster/raft-store.js.map +1 -1
- package/dist/cluster/replication-lag.test.d.ts +2 -0
- package/dist/cluster/replication-lag.test.d.ts.map +1 -0
- package/dist/cluster/replication-lag.test.js +239 -0
- package/dist/cluster/replication-lag.test.js.map +1 -0
- package/dist/cluster/replication.d.ts +2 -2
- package/dist/cluster/replication.d.ts.map +1 -1
- package/dist/cluster/replication.js +1 -1
- package/dist/cluster/replication.js.map +1 -1
- package/dist/cluster/runtime.d.ts +78 -0
- package/dist/cluster/runtime.d.ts.map +1 -1
- package/dist/cluster/runtime.js +400 -13
- package/dist/cluster/runtime.js.map +1 -1
- package/dist/cluster/state-recovery.test.d.ts +2 -0
- package/dist/cluster/state-recovery.test.d.ts.map +1 -0
- package/dist/cluster/state-recovery.test.js +310 -0
- package/dist/cluster/state-recovery.test.js.map +1 -0
- package/dist/cluster/types.d.ts +30 -0
- package/dist/cluster/types.d.ts.map +1 -1
- package/dist/config/schema.d.ts +48 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +11 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/context-files/generator.js +1 -1
- package/dist/context-files/generator.js.map +1 -1
- package/dist/context-files/generator.test.js +51 -0
- package/dist/context-files/generator.test.js.map +1 -1
- package/dist/orchestrator/orphan-recovery.d.ts +1 -1
- package/dist/orchestrator/orphan-recovery.d.ts.map +1 -1
- package/dist/orchestrator/orphan-recovery.js +4 -4
- package/dist/orchestrator/orphan-recovery.js.map +1 -1
- package/dist/orchestrator/prompt-templates.d.ts +3 -1
- package/dist/orchestrator/prompt-templates.d.ts.map +1 -1
- package/dist/orchestrator/prompt-templates.js +45 -8
- package/dist/orchestrator/prompt-templates.js.map +1 -1
- package/dist/orchestrator/prompt-templates.test.js +210 -0
- package/dist/orchestrator/prompt-templates.test.js.map +1 -1
- package/dist/orchestrator/scheduler.d.ts +1 -0
- package/dist/orchestrator/scheduler.d.ts.map +1 -1
- package/dist/orchestrator/scheduler.js +15 -10
- package/dist/orchestrator/scheduler.js.map +1 -1
- package/dist/orchestrator/scheduler.test.js +97 -6
- package/dist/orchestrator/scheduler.test.js.map +1 -1
- package/package.json +1 -1
- package/src/cli/commands/cluster.test.ts +387 -9
- package/src/cli/commands/cluster.ts +486 -1
- package/src/cli/commands/req-spawn.test.ts +153 -0
- package/src/cli/commands/req.ts +31 -18
- package/src/cluster/cluster-http-server.ts +80 -0
- package/src/cluster/distributed-runtime-coverage.test.ts +9 -0
- package/src/cluster/distributed-system.test.ts +168 -0
- package/src/cluster/events.ts +90 -0
- package/src/cluster/heartbeat-manager.ts +48 -6
- package/src/cluster/membership.test.ts +498 -0
- package/src/cluster/partition-safety.test.ts +523 -0
- package/src/cluster/raft-state-machine.ts +76 -4
- package/src/cluster/raft-store.ts +167 -1
- package/src/cluster/replication-lag.test.ts +284 -0
- package/src/cluster/replication.ts +6 -0
- package/src/cluster/runtime.ts +551 -12
- package/src/cluster/state-recovery.test.ts +420 -0
- package/src/cluster/types.ts +32 -0
- package/src/config/schema.ts +11 -0
- package/src/context-files/generator.test.ts +55 -0
- package/src/context-files/generator.ts +5 -5
- package/src/orchestrator/orphan-recovery.ts +32 -13
- package/src/orchestrator/prompt-templates.test.ts +263 -0
- package/src/orchestrator/prompt-templates.ts +49 -8
- package/src/orchestrator/scheduler.test.ts +129 -6
- package/src/orchestrator/scheduler.ts +46 -20
|
@@ -48,6 +48,7 @@ import {
|
|
|
48
48
|
} from '../tmux/manager.js';
|
|
49
49
|
import { getTechLeadSessionName } from '../utils/instance.js';
|
|
50
50
|
import * as logger from '../utils/logger.js';
|
|
51
|
+
import { getHivePaths } from '../utils/paths.js';
|
|
51
52
|
import { selectAgentWithLeastWorkload } from './agent-selector.js';
|
|
52
53
|
import { getCapacityPoints, selectStoriesForCapacity } from './capacity-planner.js';
|
|
53
54
|
import { areDependenciesSatisfied, topologicalSort } from './dependency-resolver.js';
|
|
@@ -106,6 +107,10 @@ export class Scheduler {
|
|
|
106
107
|
this.pmQueue = new PMOperationQueue();
|
|
107
108
|
}
|
|
108
109
|
|
|
110
|
+
private get storiesDir(): string {
|
|
111
|
+
return getHivePaths(this.config.rootDir).storiesDir;
|
|
112
|
+
}
|
|
113
|
+
|
|
109
114
|
/**
|
|
110
115
|
* Wait for all pending Jira operations to complete.
|
|
111
116
|
* Call this before closing the database to prevent "Database closed" errors.
|
|
@@ -396,10 +401,15 @@ export class Scheduler {
|
|
|
396
401
|
await withTransaction(
|
|
397
402
|
this.db,
|
|
398
403
|
() => {
|
|
399
|
-
updateStory(
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
404
|
+
updateStory(
|
|
405
|
+
this.db,
|
|
406
|
+
story.id,
|
|
407
|
+
{
|
|
408
|
+
assignedAgentId: targetAgent.id,
|
|
409
|
+
status: 'in_progress',
|
|
410
|
+
},
|
|
411
|
+
this.storiesDir
|
|
412
|
+
);
|
|
403
413
|
|
|
404
414
|
updateAgent(this.db, targetAgent.id, {
|
|
405
415
|
status: 'working',
|
|
@@ -551,10 +561,15 @@ export class Scheduler {
|
|
|
551
561
|
|
|
552
562
|
if (subtask) {
|
|
553
563
|
// Persist subtask reference back to the story
|
|
554
|
-
updateStory(
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
564
|
+
updateStory(
|
|
565
|
+
this.db,
|
|
566
|
+
freshStory.id,
|
|
567
|
+
{
|
|
568
|
+
externalSubtaskKey: subtask.key,
|
|
569
|
+
externalSubtaskId: subtask.id,
|
|
570
|
+
},
|
|
571
|
+
this.storiesDir
|
|
572
|
+
);
|
|
558
573
|
if (this.saveFn) this.saveFn();
|
|
559
574
|
|
|
560
575
|
logger.info(`Created subtask ${subtask.key} for story ${freshStory.id}`);
|
|
@@ -711,10 +726,15 @@ export class Scheduler {
|
|
|
711
726
|
|
|
712
727
|
// If agent was working on a story, mark it for reassignment
|
|
713
728
|
if (agent.current_story_id) {
|
|
714
|
-
updateStory(
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
729
|
+
updateStory(
|
|
730
|
+
this.db,
|
|
731
|
+
agent.current_story_id,
|
|
732
|
+
{
|
|
733
|
+
status: 'planned',
|
|
734
|
+
assignedAgentId: null,
|
|
735
|
+
},
|
|
736
|
+
this.storiesDir
|
|
737
|
+
);
|
|
718
738
|
revived.push(agent.current_story_id);
|
|
719
739
|
|
|
720
740
|
// Sync status change to Jira (fire and forget)
|
|
@@ -724,7 +744,11 @@ export class Scheduler {
|
|
|
724
744
|
}
|
|
725
745
|
|
|
726
746
|
// Detect and recover orphaned stories (assigned to terminated agents)
|
|
727
|
-
const orphanedRecovered = detectAndRecoverOrphanedStories(
|
|
747
|
+
const orphanedRecovered = detectAndRecoverOrphanedStories(
|
|
748
|
+
this.db,
|
|
749
|
+
this.config.rootDir,
|
|
750
|
+
this.storiesDir
|
|
751
|
+
);
|
|
728
752
|
|
|
729
753
|
return { terminated, revived, orphanedRecovered };
|
|
730
754
|
}
|
|
@@ -1008,6 +1032,8 @@ export class Scheduler {
|
|
|
1008
1032
|
const includeProgressUpdates = this.shouldIncludeProgressUpdates();
|
|
1009
1033
|
const hiveDir = join(this.config.rootDir, '.hive');
|
|
1010
1034
|
const techLeadSession = getTechLeadSessionName(hiveDir);
|
|
1035
|
+
const chromeEnabled =
|
|
1036
|
+
this.config.hiveConfig?.agents?.chrome_enabled === true && cliTool === 'claude';
|
|
1011
1037
|
let prompt: string;
|
|
1012
1038
|
|
|
1013
1039
|
if (type === 'senior') {
|
|
@@ -1018,7 +1044,7 @@ export class Scheduler {
|
|
|
1018
1044
|
worktreePath,
|
|
1019
1045
|
stories,
|
|
1020
1046
|
targetBranch,
|
|
1021
|
-
{ includeProgressUpdates, techLeadSession },
|
|
1047
|
+
{ includeProgressUpdates, techLeadSession, chromeEnabled },
|
|
1022
1048
|
sessionName
|
|
1023
1049
|
);
|
|
1024
1050
|
} else if (type === 'intermediate') {
|
|
@@ -1028,7 +1054,7 @@ export class Scheduler {
|
|
|
1028
1054
|
worktreePath,
|
|
1029
1055
|
sessionName,
|
|
1030
1056
|
targetBranch,
|
|
1031
|
-
{ includeProgressUpdates, techLeadSession }
|
|
1057
|
+
{ includeProgressUpdates, techLeadSession, chromeEnabled }
|
|
1032
1058
|
);
|
|
1033
1059
|
} else if (type === 'junior') {
|
|
1034
1060
|
prompt = generateJuniorPrompt(
|
|
@@ -1037,7 +1063,7 @@ export class Scheduler {
|
|
|
1037
1063
|
worktreePath,
|
|
1038
1064
|
sessionName,
|
|
1039
1065
|
targetBranch,
|
|
1040
|
-
{ includeProgressUpdates, techLeadSession }
|
|
1066
|
+
{ includeProgressUpdates, techLeadSession, chromeEnabled }
|
|
1041
1067
|
);
|
|
1042
1068
|
} else if (type === 'feature_test' && featureTestContext) {
|
|
1043
1069
|
prompt = generateFeatureTestPrompt(
|
|
@@ -1048,11 +1074,12 @@ export class Scheduler {
|
|
|
1048
1074
|
featureTestContext.featureBranch,
|
|
1049
1075
|
featureTestContext.requirementId,
|
|
1050
1076
|
featureTestContext.e2eTestsPath,
|
|
1051
|
-
{ includeProgressUpdates, techLeadSession }
|
|
1077
|
+
{ includeProgressUpdates, techLeadSession, chromeEnabled }
|
|
1052
1078
|
);
|
|
1053
1079
|
} else if (type === 'auditor') {
|
|
1054
1080
|
prompt = generateAuditorPrompt(sessionName, worktreePath, team?.repo_url || '', {
|
|
1055
1081
|
techLeadSession,
|
|
1082
|
+
chromeEnabled,
|
|
1056
1083
|
});
|
|
1057
1084
|
} else {
|
|
1058
1085
|
prompt = generateQAPrompt(
|
|
@@ -1060,13 +1087,12 @@ export class Scheduler {
|
|
|
1060
1087
|
team?.repo_url || '',
|
|
1061
1088
|
worktreePath,
|
|
1062
1089
|
sessionName,
|
|
1063
|
-
targetBranch
|
|
1090
|
+
targetBranch,
|
|
1091
|
+
{ chromeEnabled }
|
|
1064
1092
|
);
|
|
1065
1093
|
}
|
|
1066
1094
|
|
|
1067
1095
|
// Build CLI command using the configured runtime
|
|
1068
|
-
const chromeEnabled =
|
|
1069
|
-
this.config.hiveConfig?.agents?.chrome_enabled === true && cliTool === 'claude';
|
|
1070
1096
|
const commandArgs = getCliRuntimeBuilder(cliTool).buildSpawnCommand(
|
|
1071
1097
|
runtimeModel,
|
|
1072
1098
|
safetyMode,
|