harnery 0.19.1 → 0.20.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/commands/supervisor.d.ts.map +1 -1
- package/dist/commands/supervisor.js +21 -1
- package/dist/core/supervisor/index.d.ts +1 -1
- package/dist/core/supervisor/index.d.ts.map +1 -1
- package/dist/core/supervisor/index.js +1 -1
- package/dist/core/supervisor/plan-api.d.ts +7 -0
- package/dist/core/supervisor/plan-api.d.ts.map +1 -1
- package/dist/core/supervisor/plan-api.js +17 -1
- package/dist/core/supervisor/plan-read.d.ts.map +1 -1
- package/dist/core/supervisor/plan-read.js +4 -0
- package/dist/core/supervisor/plan-types.d.ts +2 -2
- package/dist/core/supervisor/plan-types.d.ts.map +1 -1
- package/dist/core/supervisor/planning.d.ts +7 -0
- package/dist/core/supervisor/planning.d.ts.map +1 -1
- package/dist/core/supervisor/planning.js +38 -0
- package/dist/core/supervisor/state.d.ts +2 -1
- package/dist/core/supervisor/state.d.ts.map +1 -1
- package/dist/core/supervisor/state.js +4 -1
- package/package.json +1 -1
- package/src/commands/supervisor.ts +32 -0
- package/src/core/supervisor/index.ts +5 -1
- package/src/core/supervisor/plan-api.ts +27 -1
- package/src/core/supervisor/plan-read.ts +4 -0
- package/src/core/supervisor/plan-types.ts +2 -0
- package/src/core/supervisor/planning.ts +52 -0
- package/src/core/supervisor/state.ts +7 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../../src/commands/supervisor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../../src/commands/supervisor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAsEnD,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CAgGnF"}
|
|
@@ -4,7 +4,7 @@ import { workflowSubscriptionOnly } from "../core/config.js";
|
|
|
4
4
|
import { createBuiltinHarnessRegistry } from "../core/harnesses/index.js";
|
|
5
5
|
import { findCoordRoot } from "../core/hooks/resolve/coord-root.js";
|
|
6
6
|
import { loadPolicyFile } from "../core/policy/index.js";
|
|
7
|
-
import { approveSupervisorPlan, configureSupervisorService, createSupervisor, listSupervisors, readSupervisor, readSupervisorPlan, readSupervisorServiceConfig, readSupervisorServiceStatus, rejectSupervisorPlan, requestSupervisorServiceStop, runSupervisor, runSupervisorServiceDaemon, spawnSupervisorService, supervisorServiceLogPath, } from "../core/supervisor/index.js";
|
|
7
|
+
import { approveSupervisorPlan, configureSupervisorService, createSupervisor, listSupervisors, readSupervisor, readSupervisorPlan, readSupervisorServiceConfig, readSupervisorServiceStatus, rejectSupervisorPlan, requestSupervisorServiceStop, retrySupervisorPlan, runSupervisor, runSupervisorServiceDaemon, spawnSupervisorService, supervisorServiceLogPath, } from "../core/supervisor/index.js";
|
|
8
8
|
export function registerSupervisorCommand(program, emit) {
|
|
9
9
|
const registry = createBuiltinHarnessRegistry();
|
|
10
10
|
const supervisor = program
|
|
@@ -159,6 +159,23 @@ function registerPlanCommand(supervisor, emit) {
|
|
|
159
159
|
}), opts.json, emit);
|
|
160
160
|
});
|
|
161
161
|
});
|
|
162
|
+
plan
|
|
163
|
+
.command("retry <goal-id> <plan-id>")
|
|
164
|
+
.description("Attach bounded guidance and authorize a new attempt after plan attention.")
|
|
165
|
+
.requiredOption("--reason <text>", "Guidance for the next planner attempt")
|
|
166
|
+
.option("--actor <name>", "Actor recorded on the retry request")
|
|
167
|
+
.option("--json", "Emit the plan outcome as JSON")
|
|
168
|
+
.action((goalId, planId, opts) => {
|
|
169
|
+
withSupervisorRoot(emit, (coordRoot) => {
|
|
170
|
+
emitPlanOutcome(retrySupervisorPlan({
|
|
171
|
+
coordRoot,
|
|
172
|
+
goalId,
|
|
173
|
+
planId,
|
|
174
|
+
actor: opts.actor,
|
|
175
|
+
reason: opts.reason,
|
|
176
|
+
}), opts.json, emit);
|
|
177
|
+
});
|
|
178
|
+
});
|
|
162
179
|
}
|
|
163
180
|
function registerServiceCommand(supervisor, registry, emit) {
|
|
164
181
|
const service = supervisor
|
|
@@ -555,6 +572,9 @@ function emitSupervisor(record, json, emit, detail = false) {
|
|
|
555
572
|
}
|
|
556
573
|
if (projection.pending_plan_id)
|
|
557
574
|
lines.push(`pending plan: ${projection.pending_plan_id}`);
|
|
575
|
+
if (projection.attention_plan_id) {
|
|
576
|
+
lines.push(`attention plan: ${projection.attention_plan_id}`);
|
|
577
|
+
}
|
|
558
578
|
}
|
|
559
579
|
if (record.intent.mission) {
|
|
560
580
|
lines.push(`mission: ${record.intent.mission.objective}`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { approveSupervisorPlan, rejectSupervisorPlan } from "./plan-api.js";
|
|
1
|
+
export { approveSupervisorPlan, rejectSupervisorPlan, retrySupervisorPlan, } from "./plan-api.js";
|
|
2
2
|
export { readSupervisorPlan, readSupervisorPlanReviewReceipt, readSupervisorPlans, } from "./plan-read.js";
|
|
3
3
|
export { type CreateSupervisorPlanTemplateInput, type CreateSupervisorReplanningInput, MAX_SUPERVISOR_PLAN_REVIEWERS, MAX_SUPERVISOR_PLAN_REVISION_ROUNDS, SUPERVISOR_PLAN_SCHEMA_VERSION, type SupervisorPlanEvent, type SupervisorPlanEventType, type SupervisorPlanHistory, type SupervisorPlanMilestone, type SupervisorPlanOutcome, type SupervisorPlanProposal, type SupervisorPlanRecord, type SupervisorPlanRequest, type SupervisorPlanReviewFinding, type SupervisorPlanReviewReceipt, type SupervisorPlanReviewReviewer, type SupervisorPlanReviewRound, type SupervisorPlanReviewStatus, type SupervisorPlanReviewSummary, type SupervisorPlanReviewVerdict, type SupervisorPlanStatus, type SupervisorPlanTemplate, type SupervisorPlanWorkSpec, type SupervisorReplanningPolicy, } from "./plan-types.js";
|
|
4
4
|
export { type RunSupervisorInput, runSupervisor, type SupervisorDispatchOutcome, type SupervisorRunReport, type SupervisorStopReason, } from "./runner.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/supervisor/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/supervisor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,kBAAkB,EAClB,+BAA+B,EAC/B,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,iCAAiC,EACtC,KAAK,+BAA+B,EACpC,6BAA6B,EAC7B,mCAAmC,EACnC,8BAA8B,EAC9B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,GAChC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,kBAAkB,EACvB,aAAa,EACb,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,+BAA+B,EACpC,0BAA0B,EAC1B,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,2BAA2B,EAC3B,4BAA4B,EAC5B,2BAA2B,EAC3B,4BAA4B,EAC5B,0BAA0B,EAC1B,yBAAyB,EACzB,wCAAwC,EACxC,yCAAyC,EACzC,wCAAwC,EACxC,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EACjC,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,KAAK,qBAAqB,EAC1B,KAAK,4BAA4B,EACjC,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,cAAc,EACd,gCAAgC,EAChC,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { approveSupervisorPlan, rejectSupervisorPlan } from "./plan-api.js";
|
|
1
|
+
export { approveSupervisorPlan, rejectSupervisorPlan, retrySupervisorPlan, } from "./plan-api.js";
|
|
2
2
|
export { readSupervisorPlan, readSupervisorPlanReviewReceipt, readSupervisorPlans, } from "./plan-read.js";
|
|
3
3
|
export { MAX_SUPERVISOR_PLAN_REVIEWERS, MAX_SUPERVISOR_PLAN_REVISION_ROUNDS, SUPERVISOR_PLAN_SCHEMA_VERSION, } from "./plan-types.js";
|
|
4
4
|
export { runSupervisor, } from "./runner.js";
|
|
@@ -13,4 +13,11 @@ export declare function rejectSupervisorPlan(input: {
|
|
|
13
13
|
actor?: string;
|
|
14
14
|
reason: string;
|
|
15
15
|
}): SupervisorPlanOutcome;
|
|
16
|
+
export declare function retrySupervisorPlan(input: {
|
|
17
|
+
coordRoot: string;
|
|
18
|
+
goalId: string;
|
|
19
|
+
planId: string;
|
|
20
|
+
actor?: string;
|
|
21
|
+
reason: string;
|
|
22
|
+
}): SupervisorPlanOutcome;
|
|
16
23
|
//# sourceMappingURL=plan-api.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-api.d.ts","sourceRoot":"","sources":["../../../src/core/supervisor/plan-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"plan-api.d.ts","sourceRoot":"","sources":["../../../src/core/supervisor/plan-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAQ7D,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,qBAAqB,CAcxB;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,qBAAqB,CAcxB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,qBAAqB,CAcxB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { applySupervisorPlanProposal, rejectSupervisorPlanProposal } from "./planning.js";
|
|
1
|
+
import { applySupervisorPlanProposal, rejectSupervisorPlanProposal, retrySupervisorPlanProposal, } from "./planning.js";
|
|
2
2
|
import { acquireSupervisorLease, readSupervisorIgnoringLease } from "./state.js";
|
|
3
3
|
export function approveSupervisorPlan(input) {
|
|
4
4
|
const actor = input.actor?.trim() || `supervisor:${input.goalId}`;
|
|
@@ -32,3 +32,19 @@ export function rejectSupervisorPlan(input) {
|
|
|
32
32
|
release();
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
+
export function retrySupervisorPlan(input) {
|
|
36
|
+
const actor = input.actor?.trim() || `supervisor:${input.goalId}`;
|
|
37
|
+
const release = acquireSupervisorLease(input.coordRoot, input.goalId);
|
|
38
|
+
try {
|
|
39
|
+
return retrySupervisorPlanProposal({
|
|
40
|
+
coordRoot: input.coordRoot,
|
|
41
|
+
record: readSupervisorIgnoringLease(input.coordRoot, input.goalId),
|
|
42
|
+
planId: input.planId,
|
|
43
|
+
actor,
|
|
44
|
+
reason: input.reason,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
release();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-read.d.ts","sourceRoot":"","sources":["../../../src/core/supervisor/plan-read.ts"],"names":[],"mappings":"AAIA,OAAO,EAML,KAAK,qBAAqB,EAE1B,KAAK,oBAAoB,EAGzB,KAAK,2BAA2B,EAMjC,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"plan-read.d.ts","sourceRoot":"","sources":["../../../src/core/supervisor/plan-read.ts"],"names":[],"mappings":"AAIA,OAAO,EAML,KAAK,qBAAqB,EAE1B,KAAK,oBAAoB,EAGzB,KAAK,2BAA2B,EAMjC,MAAM,iBAAiB,CAAC;AAyBzB,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,MAAM,GACzB,qBAAqB,CAwEvB;AAED,wBAAgB,kBAAkB,CAChC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,oBAAoB,CAsBtB;AAED,wBAAgB,+BAA+B,CAC7C,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,2BAA2B,GAAG,SAAS,CAWzC"}
|
|
@@ -21,6 +21,7 @@ const EVENT_TYPES = new Set([
|
|
|
21
21
|
"plan.applied",
|
|
22
22
|
"plan.completed",
|
|
23
23
|
"plan.rejected",
|
|
24
|
+
"plan.retry_requested",
|
|
24
25
|
"plan.attention",
|
|
25
26
|
"plan.failed",
|
|
26
27
|
]);
|
|
@@ -152,6 +153,9 @@ function deriveStatus(coordRoot, events, proposal) {
|
|
|
152
153
|
if (latest?.event === "plan.rejected") {
|
|
153
154
|
return { status: "rejected", work_ids: [], reason: latest.reason };
|
|
154
155
|
}
|
|
156
|
+
if (latest?.event === "plan.retry_requested") {
|
|
157
|
+
return { status: "retry_requested", work_ids: [], reason: latest.reason };
|
|
158
|
+
}
|
|
155
159
|
if (latest?.event === "plan.attention") {
|
|
156
160
|
return { status: "attention", work_ids: [], reason: latest.reason };
|
|
157
161
|
}
|
|
@@ -73,7 +73,7 @@ export interface SupervisorPlanProposal {
|
|
|
73
73
|
milestone?: SupervisorPlanMilestone;
|
|
74
74
|
proposed_at: string;
|
|
75
75
|
}
|
|
76
|
-
export type SupervisorPlanEventType = "plan.awaiting_approval" | "plan.resumed" | "plan.reviewed" | "plan.proposed" | "plan.applied" | "plan.completed" | "plan.rejected" | "plan.attention" | "plan.failed";
|
|
76
|
+
export type SupervisorPlanEventType = "plan.awaiting_approval" | "plan.resumed" | "plan.reviewed" | "plan.proposed" | "plan.applied" | "plan.completed" | "plan.rejected" | "plan.retry_requested" | "plan.attention" | "plan.failed";
|
|
77
77
|
export type SupervisorPlanReviewStatus = "passed" | "revision_exhausted" | "attention" | "failed";
|
|
78
78
|
export type SupervisorPlanReviewVerdict = "approve" | "revise" | "attention";
|
|
79
79
|
export interface SupervisorPlanReviewFinding {
|
|
@@ -122,7 +122,7 @@ export interface SupervisorPlanEvent {
|
|
|
122
122
|
root_work_id?: string;
|
|
123
123
|
work_ids?: string[];
|
|
124
124
|
}
|
|
125
|
-
export type SupervisorPlanStatus = "interrupted" | "awaiting_approval" | "resumable" | "proposed" | "applied" | "completed" | "rejected" | "attention" | "failed";
|
|
125
|
+
export type SupervisorPlanStatus = "interrupted" | "awaiting_approval" | "resumable" | "proposed" | "applied" | "completed" | "rejected" | "retry_requested" | "attention" | "failed";
|
|
126
126
|
export interface SupervisorPlanRecord {
|
|
127
127
|
request: SupervisorPlanRequest;
|
|
128
128
|
proposal?: SupervisorPlanProposal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan-types.d.ts","sourceRoot":"","sources":["../../../src/core/supervisor/plan-types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,8BAA8B,EAAG,CAAU,CAAC;AACzD,eAAO,MAAM,6BAA6B,EAAG,CAAU,CAAC;AACxD,eAAO,MAAM,mCAAmC,EAAG,CAAU,CAAC;AAE9D,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,0BAA0B;IACzC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,uBAAuB,EAAE,MAAM,CAAC;IAChC,oBAAoB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EAAE,oBAAoB,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,aAAa,CAAC;QAClB,MAAM,EAAE;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC;QACvB,UAAU,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAC;YAAC,aAAa,EAAE,MAAM,CAAA;SAAE,CAAC;QAC1E,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC;KAC5B,CAAC,CAAC;CACJ,GAAG,MAAM,CAYT"}
|
|
@@ -23,4 +23,11 @@ export declare function rejectSupervisorPlanProposal(input: {
|
|
|
23
23
|
actor: string;
|
|
24
24
|
reason: string;
|
|
25
25
|
}): SupervisorPlanOutcome;
|
|
26
|
+
export declare function retrySupervisorPlanProposal(input: {
|
|
27
|
+
coordRoot: string;
|
|
28
|
+
record: SupervisorRecord;
|
|
29
|
+
planId: string;
|
|
30
|
+
actor: string;
|
|
31
|
+
reason: string;
|
|
32
|
+
}): SupervisorPlanOutcome;
|
|
26
33
|
//# sourceMappingURL=planning.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planning.d.ts","sourceRoot":"","sources":["../../../src/core/supervisor/planning.ts"],"names":[],"mappings":"AAcA,OAAO,EAEL,KAAK,UAAU,EAQhB,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAIL,KAAK,qBAAqB,EAU3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAUnD,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE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AAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,qBAAqB,CAAC,CA+LhC;AAuLD,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,qBAAqB,CAsHxB;AAED,wBAAgB,4BAA4B,CAAC,KAAK,EAAE;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,qBAAqB,CAYxB;AAED,wBAAgB,2BAA2B,CAAC,KAAK,EAAE;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,qBAAqB,CA4CxB"}
|
|
@@ -402,6 +402,44 @@ export function rejectSupervisorPlanProposal(input) {
|
|
|
402
402
|
});
|
|
403
403
|
return outcome(readSupervisorPlan(input.coordRoot, input.goalId, input.planId));
|
|
404
404
|
}
|
|
405
|
+
export function retrySupervisorPlanProposal(input) {
|
|
406
|
+
const policy = input.record.intent.replanning;
|
|
407
|
+
if (!policy) {
|
|
408
|
+
throw new Error(`supervisor ${input.record.intent.id} does not allow replanning`);
|
|
409
|
+
}
|
|
410
|
+
const reason = bounded(input.reason, "plan retry reason", MAX_REASON);
|
|
411
|
+
const history = readSupervisorPlans(input.coordRoot, input.record.intent.id, input.record.intent.root_work_id);
|
|
412
|
+
const latest = history.latest;
|
|
413
|
+
if (!latest || latest.request.id !== input.planId) {
|
|
414
|
+
throw new Error(`supervisor plan ${input.planId} is not the latest plan`);
|
|
415
|
+
}
|
|
416
|
+
const triggerFingerprint = supervisorGraphFingerprint({
|
|
417
|
+
rootWorkId: history.active_root_work_id,
|
|
418
|
+
generation: history.generation,
|
|
419
|
+
work: input.record.work,
|
|
420
|
+
});
|
|
421
|
+
if (latest.request.trigger_fingerprint !== triggerFingerprint ||
|
|
422
|
+
latest.request.prior_root_work_id !== history.active_root_work_id) {
|
|
423
|
+
throw new Error(`supervisor plan ${input.planId} no longer matches the active graph`);
|
|
424
|
+
}
|
|
425
|
+
if (history.completed) {
|
|
426
|
+
throw new Error(`supervisor ${input.record.intent.id} mission is already complete`);
|
|
427
|
+
}
|
|
428
|
+
if (latest.status === "retry_requested")
|
|
429
|
+
return outcome(latest);
|
|
430
|
+
if (latest.status !== "attention") {
|
|
431
|
+
throw new Error(`supervisor plan ${input.planId} cannot be retried from ${latest.status}`);
|
|
432
|
+
}
|
|
433
|
+
if (history.plans.length >= policy.max_replans) {
|
|
434
|
+
throw new Error(`supervisor ${input.record.intent.id} exhausted its ${policy.max_replans} replans`);
|
|
435
|
+
}
|
|
436
|
+
appendPlanEvent(input.coordRoot, input.record.intent.id, input.planId, {
|
|
437
|
+
event: "plan.retry_requested",
|
|
438
|
+
actor: input.actor,
|
|
439
|
+
reason,
|
|
440
|
+
});
|
|
441
|
+
return outcome(readSupervisorPlan(input.coordRoot, input.record.intent.id, input.planId));
|
|
442
|
+
}
|
|
405
443
|
function createPlanRequest(coordRoot, record, sequence, triggerFingerprint, trigger) {
|
|
406
444
|
const policy = record.intent.replanning;
|
|
407
445
|
if (!policy)
|
|
@@ -38,7 +38,7 @@ export interface SupervisorIntent {
|
|
|
38
38
|
created_at: string;
|
|
39
39
|
}
|
|
40
40
|
export type SupervisorState = "ready" | "running" | "awaiting_attention" | "blocked" | "budget_exhausted" | "succeeded";
|
|
41
|
-
export type SupervisorNextAction = "run" | "wait_for_run" | "resolve_approval" | "review" | "retry" | "replan" | "plan_initial" | "plan_milestone" | "review_plan" | "none";
|
|
41
|
+
export type SupervisorNextAction = "run" | "wait_for_run" | "resolve_approval" | "review" | "retry" | "replan" | "plan_initial" | "plan_milestone" | "review_plan" | "retry_plan" | "none";
|
|
42
42
|
export interface SupervisorProjection {
|
|
43
43
|
id: string;
|
|
44
44
|
title: string;
|
|
@@ -61,6 +61,7 @@ export interface SupervisorProjection {
|
|
|
61
61
|
milestones_completed: number;
|
|
62
62
|
milestones_remaining: number;
|
|
63
63
|
pending_plan_id?: string;
|
|
64
|
+
attention_plan_id?: string;
|
|
64
65
|
latest_plan_status?: SupervisorPlanRecord["status"];
|
|
65
66
|
governed_work_ids: string[];
|
|
66
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../src/core/supervisor/state.ts"],"names":[],"mappings":"AAeA,OAAO,EAA8B,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAG9E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEtE,OAAO,EACL,KAAK,+BAA+B,EAIpC,KAAK,oBAAoB,EACzB,KAAK,0BAA0B,EAEhC,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,gCAAgC,EAAG,CAAU,CAAC;AAW3D,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,0BAA0B;IACzC,oBAAoB,EAAE,OAAO,CAAC;IAC9B,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAA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C,KAAK,EAAE,qBAAqB,GAAG,gBAAgB,CAkD/E;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAElF;AAED,gFAAgF;AAChF,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAE/F;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAWrE;AAED,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,EAAE,CAezF;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEvD;AAED,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED,+EAA+E;AAC/E,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,IAAI,CA0CpF"}
|
|
@@ -279,7 +279,10 @@ function deriveProjection(coordRoot, intent, work, governed, plans, ignoreLease)
|
|
|
279
279
|
...base,
|
|
280
280
|
state: "awaiting_attention",
|
|
281
281
|
reason: plans.latest.reason ?? `plan ${plans.latest.request.id} requires attention`,
|
|
282
|
-
|
|
282
|
+
attention_plan_id: plans.latest.request.id,
|
|
283
|
+
next_action: intent.replanning && plans.plans.length < intent.replanning.max_replans
|
|
284
|
+
? "retry_plan"
|
|
285
|
+
: "none",
|
|
283
286
|
};
|
|
284
287
|
}
|
|
285
288
|
if (!root && intent.mission) {
|
package/package.json
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
readSupervisorServiceStatus,
|
|
21
21
|
rejectSupervisorPlan,
|
|
22
22
|
requestSupervisorServiceStop,
|
|
23
|
+
retrySupervisorPlan,
|
|
23
24
|
runSupervisor,
|
|
24
25
|
runSupervisorServiceDaemon,
|
|
25
26
|
type SupervisorPlanOutcome,
|
|
@@ -256,6 +257,34 @@ function registerPlanCommand(supervisor: Command, emit: EmitContext): void {
|
|
|
256
257
|
});
|
|
257
258
|
},
|
|
258
259
|
);
|
|
260
|
+
|
|
261
|
+
plan
|
|
262
|
+
.command("retry <goal-id> <plan-id>")
|
|
263
|
+
.description("Attach bounded guidance and authorize a new attempt after plan attention.")
|
|
264
|
+
.requiredOption("--reason <text>", "Guidance for the next planner attempt")
|
|
265
|
+
.option("--actor <name>", "Actor recorded on the retry request")
|
|
266
|
+
.option("--json", "Emit the plan outcome as JSON")
|
|
267
|
+
.action(
|
|
268
|
+
(
|
|
269
|
+
goalId: string,
|
|
270
|
+
planId: string,
|
|
271
|
+
opts: { actor?: string; reason: string; json?: boolean },
|
|
272
|
+
) => {
|
|
273
|
+
withSupervisorRoot(emit, (coordRoot) => {
|
|
274
|
+
emitPlanOutcome(
|
|
275
|
+
retrySupervisorPlan({
|
|
276
|
+
coordRoot,
|
|
277
|
+
goalId,
|
|
278
|
+
planId,
|
|
279
|
+
actor: opts.actor,
|
|
280
|
+
reason: opts.reason,
|
|
281
|
+
}),
|
|
282
|
+
opts.json,
|
|
283
|
+
emit,
|
|
284
|
+
);
|
|
285
|
+
});
|
|
286
|
+
},
|
|
287
|
+
);
|
|
259
288
|
}
|
|
260
289
|
|
|
261
290
|
function registerServiceCommand(
|
|
@@ -723,6 +752,9 @@ function emitSupervisor(
|
|
|
723
752
|
lines.push(`original root: ${record.intent.root_work_id}`);
|
|
724
753
|
}
|
|
725
754
|
if (projection.pending_plan_id) lines.push(`pending plan: ${projection.pending_plan_id}`);
|
|
755
|
+
if (projection.attention_plan_id) {
|
|
756
|
+
lines.push(`attention plan: ${projection.attention_plan_id}`);
|
|
757
|
+
}
|
|
726
758
|
}
|
|
727
759
|
if (record.intent.mission) {
|
|
728
760
|
lines.push(`mission: ${record.intent.mission.objective}`);
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { SupervisorPlanOutcome } from "./plan-types.ts";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
applySupervisorPlanProposal,
|
|
4
|
+
rejectSupervisorPlanProposal,
|
|
5
|
+
retrySupervisorPlanProposal,
|
|
6
|
+
} from "./planning.ts";
|
|
3
7
|
import { acquireSupervisorLease, readSupervisorIgnoringLease } from "./state.ts";
|
|
4
8
|
|
|
5
9
|
export function approveSupervisorPlan(input: {
|
|
@@ -45,3 +49,25 @@ export function rejectSupervisorPlan(input: {
|
|
|
45
49
|
release();
|
|
46
50
|
}
|
|
47
51
|
}
|
|
52
|
+
|
|
53
|
+
export function retrySupervisorPlan(input: {
|
|
54
|
+
coordRoot: string;
|
|
55
|
+
goalId: string;
|
|
56
|
+
planId: string;
|
|
57
|
+
actor?: string;
|
|
58
|
+
reason: string;
|
|
59
|
+
}): SupervisorPlanOutcome {
|
|
60
|
+
const actor = input.actor?.trim() || `supervisor:${input.goalId}`;
|
|
61
|
+
const release = acquireSupervisorLease(input.coordRoot, input.goalId);
|
|
62
|
+
try {
|
|
63
|
+
return retrySupervisorPlanProposal({
|
|
64
|
+
coordRoot: input.coordRoot,
|
|
65
|
+
record: readSupervisorIgnoringLease(input.coordRoot, input.goalId),
|
|
66
|
+
planId: input.planId,
|
|
67
|
+
actor,
|
|
68
|
+
reason: input.reason,
|
|
69
|
+
});
|
|
70
|
+
} finally {
|
|
71
|
+
release();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -39,6 +39,7 @@ const EVENT_TYPES = new Set<SupervisorPlanEventType>([
|
|
|
39
39
|
"plan.applied",
|
|
40
40
|
"plan.completed",
|
|
41
41
|
"plan.rejected",
|
|
42
|
+
"plan.retry_requested",
|
|
42
43
|
"plan.attention",
|
|
43
44
|
"plan.failed",
|
|
44
45
|
]);
|
|
@@ -188,6 +189,9 @@ function deriveStatus(
|
|
|
188
189
|
if (latest?.event === "plan.rejected") {
|
|
189
190
|
return { status: "rejected", work_ids: [], reason: latest.reason };
|
|
190
191
|
}
|
|
192
|
+
if (latest?.event === "plan.retry_requested") {
|
|
193
|
+
return { status: "retry_requested", work_ids: [], reason: latest.reason };
|
|
194
|
+
}
|
|
191
195
|
if (latest?.event === "plan.attention") {
|
|
192
196
|
return { status: "attention", work_ids: [], reason: latest.reason };
|
|
193
197
|
}
|
|
@@ -87,6 +87,7 @@ export type SupervisorPlanEventType =
|
|
|
87
87
|
| "plan.applied"
|
|
88
88
|
| "plan.completed"
|
|
89
89
|
| "plan.rejected"
|
|
90
|
+
| "plan.retry_requested"
|
|
90
91
|
| "plan.attention"
|
|
91
92
|
| "plan.failed";
|
|
92
93
|
|
|
@@ -154,6 +155,7 @@ export type SupervisorPlanStatus =
|
|
|
154
155
|
| "applied"
|
|
155
156
|
| "completed"
|
|
156
157
|
| "rejected"
|
|
158
|
+
| "retry_requested"
|
|
157
159
|
| "attention"
|
|
158
160
|
| "failed";
|
|
159
161
|
|
|
@@ -583,6 +583,58 @@ export function rejectSupervisorPlanProposal(input: {
|
|
|
583
583
|
return outcome(readSupervisorPlan(input.coordRoot, input.goalId, input.planId));
|
|
584
584
|
}
|
|
585
585
|
|
|
586
|
+
export function retrySupervisorPlanProposal(input: {
|
|
587
|
+
coordRoot: string;
|
|
588
|
+
record: SupervisorRecord;
|
|
589
|
+
planId: string;
|
|
590
|
+
actor: string;
|
|
591
|
+
reason: string;
|
|
592
|
+
}): SupervisorPlanOutcome {
|
|
593
|
+
const policy = input.record.intent.replanning;
|
|
594
|
+
if (!policy) {
|
|
595
|
+
throw new Error(`supervisor ${input.record.intent.id} does not allow replanning`);
|
|
596
|
+
}
|
|
597
|
+
const reason = bounded(input.reason, "plan retry reason", MAX_REASON);
|
|
598
|
+
const history = readSupervisorPlans(
|
|
599
|
+
input.coordRoot,
|
|
600
|
+
input.record.intent.id,
|
|
601
|
+
input.record.intent.root_work_id,
|
|
602
|
+
);
|
|
603
|
+
const latest = history.latest;
|
|
604
|
+
if (!latest || latest.request.id !== input.planId) {
|
|
605
|
+
throw new Error(`supervisor plan ${input.planId} is not the latest plan`);
|
|
606
|
+
}
|
|
607
|
+
const triggerFingerprint = supervisorGraphFingerprint({
|
|
608
|
+
rootWorkId: history.active_root_work_id,
|
|
609
|
+
generation: history.generation,
|
|
610
|
+
work: input.record.work,
|
|
611
|
+
});
|
|
612
|
+
if (
|
|
613
|
+
latest.request.trigger_fingerprint !== triggerFingerprint ||
|
|
614
|
+
latest.request.prior_root_work_id !== history.active_root_work_id
|
|
615
|
+
) {
|
|
616
|
+
throw new Error(`supervisor plan ${input.planId} no longer matches the active graph`);
|
|
617
|
+
}
|
|
618
|
+
if (history.completed) {
|
|
619
|
+
throw new Error(`supervisor ${input.record.intent.id} mission is already complete`);
|
|
620
|
+
}
|
|
621
|
+
if (latest.status === "retry_requested") return outcome(latest);
|
|
622
|
+
if (latest.status !== "attention") {
|
|
623
|
+
throw new Error(`supervisor plan ${input.planId} cannot be retried from ${latest.status}`);
|
|
624
|
+
}
|
|
625
|
+
if (history.plans.length >= policy.max_replans) {
|
|
626
|
+
throw new Error(
|
|
627
|
+
`supervisor ${input.record.intent.id} exhausted its ${policy.max_replans} replans`,
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
appendPlanEvent(input.coordRoot, input.record.intent.id, input.planId, {
|
|
631
|
+
event: "plan.retry_requested",
|
|
632
|
+
actor: input.actor,
|
|
633
|
+
reason,
|
|
634
|
+
});
|
|
635
|
+
return outcome(readSupervisorPlan(input.coordRoot, input.record.intent.id, input.planId));
|
|
636
|
+
}
|
|
637
|
+
|
|
586
638
|
function createPlanRequest(
|
|
587
639
|
coordRoot: string,
|
|
588
640
|
record: SupervisorRecord,
|
|
@@ -97,6 +97,7 @@ export type SupervisorNextAction =
|
|
|
97
97
|
| "plan_initial"
|
|
98
98
|
| "plan_milestone"
|
|
99
99
|
| "review_plan"
|
|
100
|
+
| "retry_plan"
|
|
100
101
|
| "none";
|
|
101
102
|
|
|
102
103
|
export interface SupervisorProjection {
|
|
@@ -121,6 +122,7 @@ export interface SupervisorProjection {
|
|
|
121
122
|
milestones_completed: number;
|
|
122
123
|
milestones_remaining: number;
|
|
123
124
|
pending_plan_id?: string;
|
|
125
|
+
attention_plan_id?: string;
|
|
124
126
|
latest_plan_status?: SupervisorPlanRecord["status"];
|
|
125
127
|
governed_work_ids: string[];
|
|
126
128
|
}
|
|
@@ -445,7 +447,11 @@ function deriveProjection(
|
|
|
445
447
|
...base,
|
|
446
448
|
state: "awaiting_attention",
|
|
447
449
|
reason: plans.latest.reason ?? `plan ${plans.latest.request.id} requires attention`,
|
|
448
|
-
|
|
450
|
+
attention_plan_id: plans.latest.request.id,
|
|
451
|
+
next_action:
|
|
452
|
+
intent.replanning && plans.plans.length < intent.replanning.max_replans
|
|
453
|
+
? "retry_plan"
|
|
454
|
+
: "none",
|
|
449
455
|
};
|
|
450
456
|
}
|
|
451
457
|
if (!root && intent.mission) {
|