Skip to content

Commit 6b3cd13

Browse files
committed
feat: add target-scoped supervisor memory
1 parent 789ccf0 commit 6b3cd13

25 files changed

Lines changed: 2041 additions & 295 deletions

packages/core/src/domain/supervisor.ts

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,45 @@ export type SupervisorStopReason =
2525
| "supervisor_uncertain"
2626
| "needs_user_input";
2727

28-
export type SupervisorPlanStepStatus = "pending" | "in_progress" | "completed";
28+
export type SupervisorPlanStepStatus = "pending" | "in_progress" | "done";
2929

3030
export interface SupervisorPlanStep {
31-
step: string;
31+
id: string;
32+
title: string;
3233
status: SupervisorPlanStepStatus;
3334
}
3435

3536
export interface SupervisorTargetMemory {
36-
summary: string;
37+
targetId: string;
38+
planGenerated: boolean;
3739
plan: SupervisorPlanStep[];
40+
activeStepId?: string;
41+
progressSummary?: string;
42+
lastGuidance?: string;
43+
stalledCount: number;
3844
updatedAt: number;
3945
}
4046

4147
export interface SupervisorCycleStepUpdate {
42-
step: string;
48+
id: string;
4349
status: SupervisorPlanStepStatus;
4450
}
4551

4652
export interface SupervisorCycleTargetRecord {
4753
cycleId: string;
4854
targetId: string;
49-
summary?: string;
50-
stepUpdates: SupervisorCycleStepUpdate[];
51-
createdAt: number;
55+
startedAt: number;
56+
completedAt: number;
57+
result: "continue" | "stop" | "error";
58+
stopReason?: "objective_complete" | "supervisor_uncertain" | "needs_user_input";
59+
reason?: string;
60+
guidance?: string;
61+
progressSummary?: string;
62+
activeStepId?: string;
63+
stepUpdates?: SupervisorCycleStepUpdate[];
64+
injected?: boolean;
65+
attemptCount?: number;
66+
errorReason?: string;
5267
}
5368

5469
export type SupervisorCycleAttemptStatus = "evaluating" | "completed" | "failed" | "cancelled";
@@ -105,7 +120,7 @@ export interface Supervisor {
105120
scheduledAt?: number;
106121
stopReason?: SupervisorStopReason;
107122
currentTargetMemory?: SupervisorTargetMemory;
108-
recentTargetCycles: SupervisorCycleTargetRecord[];
123+
recentTargetCycles?: SupervisorCycleTargetRecord[];
109124
cycles: SupervisorCycle[];
110125
lastCycleAt?: number;
111126
lastEvaluatedTurnId?: string;

packages/server/src/__tests__/supervisor-integration.test.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { afterEach, beforeEach, describe, expect, it } from "vitest";
33
import type { ServerConfig } from "../config.js";
44
import { createServer, type Server } from "../server.js";
55
import type { SupervisorEvaluationContext } from "../supervisor/context-builder.js";
6-
import type { SupervisorResult } from "../supervisor/evaluator.js";
6+
import type { SupervisorEvaluationResult } from "../supervisor/evaluator.js";
77
import type { SupervisorManager } from "../supervisor/manager.js";
88
import { type CommandContext, dispatch } from "../ws/dispatch.js";
99

@@ -21,7 +21,7 @@ type MutableSupervisorManager = SupervisorManager & {
2121
supervisor: Supervisor,
2222
context: SupervisorEvaluationContext,
2323
options?: { signal?: AbortSignal }
24-
) => Promise<SupervisorResult>;
24+
) => Promise<SupervisorEvaluationResult>;
2525
};
2626
logger: unknown;
2727
};
@@ -103,12 +103,20 @@ describe("Supervisor integration", () => {
103103
terminalExcerpt: "assistant: built the persistent supervisor repos",
104104
evidenceSource: "headless_snapshot",
105105
latestUserInput: "run the tests",
106+
targetMemory: {
107+
targetId: "tgt-1",
108+
planGenerated: false,
109+
plan: [],
110+
stalledCount: 0,
111+
updatedAt: 1,
112+
},
106113
}),
107114
};
108115
supervisorManager.evaluator = {
109116
evaluate: async () => ({
110-
message: "",
111-
objectiveComplete: false,
117+
status: "continue",
118+
reason: "Keep going",
119+
guidance: "",
112120
}),
113121
};
114122
});

0 commit comments

Comments
 (0)