harnery 0.16.0 → 0.18.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/README.md +1 -1
- package/dist/commands/supervisor.d.ts.map +1 -1
- package/dist/commands/supervisor.js +223 -5
- package/dist/core/supervisor/index.d.ts +4 -1
- package/dist/core/supervisor/index.d.ts.map +1 -1
- package/dist/core/supervisor/index.js +3 -0
- package/dist/core/supervisor/plan-api.d.ts +16 -0
- package/dist/core/supervisor/plan-api.d.ts.map +1 -0
- package/dist/core/supervisor/plan-api.js +34 -0
- package/dist/core/supervisor/plan-read.d.ts +4 -0
- package/dist/core/supervisor/plan-read.d.ts.map +1 -0
- package/dist/core/supervisor/plan-read.js +315 -0
- package/dist/core/supervisor/plan-types.d.ts +123 -0
- package/dist/core/supervisor/plan-types.d.ts.map +1 -0
- package/dist/core/supervisor/plan-types.js +14 -0
- package/dist/core/supervisor/planning.d.ts +26 -0
- package/dist/core/supervisor/planning.d.ts.map +1 -0
- package/dist/core/supervisor/planning.js +579 -0
- package/dist/core/supervisor/read.d.ts +3 -1
- package/dist/core/supervisor/read.d.ts.map +1 -1
- package/dist/core/supervisor/read.js +2 -0
- package/dist/core/supervisor/runner.d.ts +3 -0
- package/dist/core/supervisor/runner.d.ts.map +1 -1
- package/dist/core/supervisor/runner.js +42 -7
- package/dist/core/supervisor/service.d.ts.map +1 -1
- package/dist/core/supervisor/service.js +10 -0
- package/dist/core/supervisor/state.d.ts +27 -2
- package/dist/core/supervisor/state.d.ts.map +1 -1
- package/dist/core/supervisor/state.js +302 -13
- package/package.json +1 -1
- package/src/commands/supervisor.ts +275 -5
- package/src/core/supervisor/index.ts +21 -0
- package/src/core/supervisor/plan-api.ts +47 -0
- package/src/core/supervisor/plan-read.ts +356 -0
- package/src/core/supervisor/plan-types.ts +157 -0
- package/src/core/supervisor/planning.ts +698 -0
- package/src/core/supervisor/read.ts +17 -0
- package/src/core/supervisor/runner.ts +46 -2
- package/src/core/supervisor/service.ts +10 -0
- package/src/core/supervisor/state.ts +389 -12
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
- **Cross-machine presence:** sessions on every machine that shares a repo see each other, labeled by machine. Zero-config over the repo's own git remote (presence refs), with an optional live-socket upgrade via an end-to-end-encrypted relay — the public `relay.harnery.com`, or self-host with `harn relay serve` / the bundled Cloudflare Worker (`relay/worker/`). The relay sees only ciphertext in opaquely-named rooms.
|
|
24
24
|
- **Coordination-aware workflows:** `harn workflow run <script>` executes bounded, schema-gated multi-subagent workflow scripts — plain JS stages fanning out to headless harness-CLI subagents that are born coordination-registered (heartbeats, events, claim guards), with deterministic code deciding the routing between stages. An optional host-owned policy gates dispatch and declared external mutations with `ALLOW`, `ASK`, and `DENY`; CLI `ASK` requests park durably for an explicit approve/deny and same-run resume, while library callers remain fail-closed by default.
|
|
25
25
|
- **Durable work above attempts:** `harn work` preserves an objective across bounded workflow attempts, dependencies, approval parks, failures, and review. Its one-shot reconciler derives state from append-only local evidence and reports the next explicit action without silently spawning, retrying, or accepting work.
|
|
26
|
-
- **Bounded goal supervision:** `harn supervisor` freezes a specialist team and safety limits
|
|
26
|
+
- **Bounded goal supervision:** `harn supervisor` freezes a mission or existing root graph, specialist team, and safety limits, then runs scheduling cycles until reviewed mission success, human attention, no progress, or budget exhaustion. Its optional planner can create the first milestone, reassess accepted milestone proof, or recover a terminal graph using only a frozen workflow-template catalog. Proposals require review by default, old generations remain immutable evidence, and all attempts still consume the goal budget. Use explicit foreground ticks or enroll goals in the optional heartbeat-backed background service.
|
|
27
27
|
- **Standalone web UI:** `harn web up` boots a local Next.js dashboard for the coord layer, councils, per-project state, and a local coding-agent status view (Claude Code / Codex / Cursor usage, backed by `harn devtools`). Ships with the git clone, not the npm package (see [Install](#install)).
|
|
28
28
|
- **Backup + sync:** `harn backup` snapshots `.harnery/` via [restic](https://restic.net/); `harn sync` keeps a curated subset live across machines via [rclone](https://rclone.org/) (Google Drive or any rclone remote).
|
|
29
29
|
|
|
@@ -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;AAqEnD,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CAgGnF"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { resolve } from "node:path";
|
|
2
|
+
import { dirname, isAbsolute, resolve } from "node:path";
|
|
3
3
|
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 { configureSupervisorService, createSupervisor, listSupervisors, readSupervisor, readSupervisorServiceConfig, readSupervisorServiceStatus, requestSupervisorServiceStop, runSupervisor, runSupervisorServiceDaemon, spawnSupervisorService, supervisorServiceLogPath, } from "../core/supervisor/index.js";
|
|
7
|
+
import { approveSupervisorPlan, configureSupervisorService, createSupervisor, listSupervisors, readSupervisor, readSupervisorPlan, readSupervisorServiceConfig, readSupervisorServiceStatus, rejectSupervisorPlan, requestSupervisorServiceStop, 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
|
|
11
11
|
.command("supervisor")
|
|
12
12
|
.description("Run a bounded specialist team over a durable-work dependency graph.");
|
|
13
13
|
supervisor
|
|
14
|
-
.command("create
|
|
15
|
-
.description("Freeze
|
|
14
|
+
.command("create [root-work-id]")
|
|
15
|
+
.description("Freeze an existing-root goal or an objective-first bounded mission.")
|
|
16
16
|
.requiredOption("--team <file>", "JSON object mapping specialist ids to profiles")
|
|
17
17
|
.option("--id <goal-id>", "Stable goal id (generated by default)")
|
|
18
18
|
.option("--title <text>", "Goal title (defaults to root work title)")
|
|
@@ -25,6 +25,8 @@ export function registerSupervisorCommand(program, emit) {
|
|
|
25
25
|
.option("--accept-passing-proof", "Allow the supervisor to explicitly accept passing proof")
|
|
26
26
|
.option("--no-resume-approved", "Stop after an approval instead of resuming its parked run")
|
|
27
27
|
.option("--retry-blocked", "Allow bounded retry of blocked work")
|
|
28
|
+
.option("--replanning <file>", "Frozen planner policy and allowed workflow-template catalog")
|
|
29
|
+
.option("--mission <file>", "Frozen objective, acceptance criteria, and milestone bound")
|
|
28
30
|
.option("--json", "Emit the complete supervisor record as JSON")
|
|
29
31
|
.action((rootWorkId, opts) => {
|
|
30
32
|
withSupervisorRoot(emit, (coordRoot) => {
|
|
@@ -53,6 +55,8 @@ export function registerSupervisorCommand(program, emit) {
|
|
|
53
55
|
resume_approved: opts.resumeApproved,
|
|
54
56
|
retry_blocked: opts.retryBlocked,
|
|
55
57
|
},
|
|
58
|
+
mission: opts.mission ? readMissionFile(opts.mission) : undefined,
|
|
59
|
+
replanning: opts.replanning ? readReplanningFile(opts.replanning) : undefined,
|
|
56
60
|
}), opts.json, emit, true);
|
|
57
61
|
});
|
|
58
62
|
});
|
|
@@ -84,10 +88,78 @@ export function registerSupervisorCommand(program, emit) {
|
|
|
84
88
|
emitSupervisor(readSupervisor(coordRoot, goalId), opts.json, emit, true);
|
|
85
89
|
});
|
|
86
90
|
});
|
|
91
|
+
registerPlanCommand(supervisor, emit);
|
|
87
92
|
registerServiceCommand(supervisor, registry, emit);
|
|
88
93
|
registerRunCommand(supervisor, "tick", registry, emit);
|
|
89
94
|
registerRunCommand(supervisor, "run", registry, emit);
|
|
90
95
|
}
|
|
96
|
+
function registerPlanCommand(supervisor, emit) {
|
|
97
|
+
const plan = supervisor
|
|
98
|
+
.command("plan")
|
|
99
|
+
.description("Inspect and resolve bounded planner proposals for a durable goal.");
|
|
100
|
+
plan
|
|
101
|
+
.command("list <goal-id>")
|
|
102
|
+
.description("List append-only replanning attempts for one goal.")
|
|
103
|
+
.option("--json", "Emit complete plan records as JSON")
|
|
104
|
+
.action((goalId, opts) => {
|
|
105
|
+
withSupervisorRoot(emit, (coordRoot) => {
|
|
106
|
+
const plans = readSupervisor(coordRoot, goalId).plans;
|
|
107
|
+
if (opts.json) {
|
|
108
|
+
emit.config({ format: "json" });
|
|
109
|
+
emit.data(plans);
|
|
110
|
+
}
|
|
111
|
+
else if (plans.length === 0) {
|
|
112
|
+
emit.text(`supervisor ${goalId} has no replanning attempts\n`);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
emit.text(`${plans.map(renderPlanRow).join("\n")}\n`);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
plan
|
|
120
|
+
.command("show <goal-id> <plan-id>")
|
|
121
|
+
.description("Show one planner request, schema-gated proposal, and audit events.")
|
|
122
|
+
.option("--json", "Emit the complete plan record as JSON")
|
|
123
|
+
.action((goalId, planId, opts) => {
|
|
124
|
+
withSupervisorRoot(emit, (coordRoot) => {
|
|
125
|
+
emitPlan(readSupervisorPlan(coordRoot, goalId, planId), opts.json, emit);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
plan
|
|
129
|
+
.command("approve <goal-id> <plan-id>")
|
|
130
|
+
.description("Materialize a reviewed proposal and advance the active immutable root.")
|
|
131
|
+
.option("--actor <name>", "Actor recorded on the plan decision")
|
|
132
|
+
.option("--reason <text>", "Reason for approval")
|
|
133
|
+
.option("--json", "Emit the plan outcome as JSON")
|
|
134
|
+
.action((goalId, planId, opts) => {
|
|
135
|
+
withSupervisorRoot(emit, (coordRoot) => {
|
|
136
|
+
emitPlanOutcome(approveSupervisorPlan({
|
|
137
|
+
coordRoot,
|
|
138
|
+
goalId,
|
|
139
|
+
planId,
|
|
140
|
+
actor: opts.actor,
|
|
141
|
+
reason: opts.reason,
|
|
142
|
+
}), opts.json, emit);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
plan
|
|
146
|
+
.command("reject <goal-id> <plan-id>")
|
|
147
|
+
.description("Reject a pending proposal without mutating durable work.")
|
|
148
|
+
.requiredOption("--reason <text>", "Reason the proposal is rejected")
|
|
149
|
+
.option("--actor <name>", "Actor recorded on the plan decision")
|
|
150
|
+
.option("--json", "Emit the plan outcome as JSON")
|
|
151
|
+
.action((goalId, planId, opts) => {
|
|
152
|
+
withSupervisorRoot(emit, (coordRoot) => {
|
|
153
|
+
emitPlanOutcome(rejectSupervisorPlan({
|
|
154
|
+
coordRoot,
|
|
155
|
+
goalId,
|
|
156
|
+
planId,
|
|
157
|
+
actor: opts.actor,
|
|
158
|
+
reason: opts.reason,
|
|
159
|
+
}), opts.json, emit);
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
}
|
|
91
163
|
function registerServiceCommand(supervisor, registry, emit) {
|
|
92
164
|
const service = supervisor
|
|
93
165
|
.command("service")
|
|
@@ -355,6 +427,82 @@ function readTeamFile(path) {
|
|
|
355
427
|
}
|
|
356
428
|
return value;
|
|
357
429
|
}
|
|
430
|
+
function readReplanningFile(path) {
|
|
431
|
+
const absolute = resolve(path);
|
|
432
|
+
let value;
|
|
433
|
+
try {
|
|
434
|
+
value = JSON.parse(readFileSync(absolute, "utf8"));
|
|
435
|
+
}
|
|
436
|
+
catch (error) {
|
|
437
|
+
throw new Error(`cannot read supervisor replanning policy at ${absolute}: ${error.message}`);
|
|
438
|
+
}
|
|
439
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
440
|
+
throw new Error("supervisor replanning policy must be a JSON object");
|
|
441
|
+
}
|
|
442
|
+
const config = value;
|
|
443
|
+
if (typeof config.planner_specialist !== "string") {
|
|
444
|
+
throw new Error("supervisor replanning planner_specialist must be a string");
|
|
445
|
+
}
|
|
446
|
+
if (!config.templates ||
|
|
447
|
+
typeof config.templates !== "object" ||
|
|
448
|
+
Array.isArray(config.templates)) {
|
|
449
|
+
throw new Error("supervisor replanning templates must be an object");
|
|
450
|
+
}
|
|
451
|
+
const base = dirname(absolute);
|
|
452
|
+
const templates = Object.fromEntries(Object.entries(config.templates).map(([id, raw]) => {
|
|
453
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
|
|
454
|
+
throw new Error(`supervisor replanning template ${id} must be an object`);
|
|
455
|
+
}
|
|
456
|
+
const template = raw;
|
|
457
|
+
if (typeof template.workflow !== "string") {
|
|
458
|
+
throw new Error(`supervisor replanning template ${id} workflow must be a string`);
|
|
459
|
+
}
|
|
460
|
+
return [
|
|
461
|
+
id,
|
|
462
|
+
{
|
|
463
|
+
workflowPath: isAbsolute(template.workflow)
|
|
464
|
+
? template.workflow
|
|
465
|
+
: resolve(base, template.workflow),
|
|
466
|
+
maxAttempts: jsonInteger(template.max_attempts, `template ${id} max_attempts`),
|
|
467
|
+
root: jsonBoolean(template.root, `template ${id} root`),
|
|
468
|
+
},
|
|
469
|
+
];
|
|
470
|
+
}));
|
|
471
|
+
return {
|
|
472
|
+
plannerSpecialist: config.planner_specialist,
|
|
473
|
+
autoApply: jsonBoolean(config.auto_apply, "replanning auto_apply"),
|
|
474
|
+
maxReplans: jsonInteger(config.max_replans, "replanning max_replans"),
|
|
475
|
+
maxWorkItemsPerPlan: jsonInteger(config.max_work_items_per_plan, "replanning max_work_items_per_plan"),
|
|
476
|
+
maxTotalWorkItems: jsonInteger(config.max_total_work_items, "replanning max_total_work_items"),
|
|
477
|
+
templates,
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
function readMissionFile(path) {
|
|
481
|
+
const absolute = resolve(path);
|
|
482
|
+
let value;
|
|
483
|
+
try {
|
|
484
|
+
value = JSON.parse(readFileSync(absolute, "utf8"));
|
|
485
|
+
}
|
|
486
|
+
catch (error) {
|
|
487
|
+
throw new Error(`cannot read supervisor mission at ${absolute}: ${error.message}`);
|
|
488
|
+
}
|
|
489
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
490
|
+
throw new Error("supervisor mission must be a JSON object");
|
|
491
|
+
}
|
|
492
|
+
const config = value;
|
|
493
|
+
if (typeof config.objective !== "string") {
|
|
494
|
+
throw new Error("supervisor mission objective must be a string");
|
|
495
|
+
}
|
|
496
|
+
if (!Array.isArray(config.acceptance) ||
|
|
497
|
+
config.acceptance.some((item) => typeof item !== "string")) {
|
|
498
|
+
throw new Error("supervisor mission acceptance must be an array of strings");
|
|
499
|
+
}
|
|
500
|
+
return {
|
|
501
|
+
objective: config.objective,
|
|
502
|
+
acceptance: config.acceptance,
|
|
503
|
+
maxMilestones: jsonInteger(config.max_milestones, "mission max_milestones"),
|
|
504
|
+
};
|
|
505
|
+
}
|
|
358
506
|
function emitSupervisor(record, json, emit, detail = false) {
|
|
359
507
|
if (json) {
|
|
360
508
|
emit.config({ format: "json" });
|
|
@@ -369,7 +517,7 @@ function emitSupervisor(record, json, emit, detail = false) {
|
|
|
369
517
|
const lines = [
|
|
370
518
|
`${record.intent.id}: ${record.intent.title}`,
|
|
371
519
|
`state: ${projection.state}`,
|
|
372
|
-
`root: ${
|
|
520
|
+
`root: ${projection.root_materialized ? projection.root_work_id : "pending initial plan"}`,
|
|
373
521
|
`reason: ${projection.reason}`,
|
|
374
522
|
`next: ${projection.next_action}`,
|
|
375
523
|
`work: ${projection.work_ids.length}`,
|
|
@@ -378,6 +526,19 @@ function emitSupervisor(record, json, emit, detail = false) {
|
|
|
378
526
|
`automation: accept=${record.intent.automation.accept_passing_proof}, ` +
|
|
379
527
|
`resume=${record.intent.automation.resume_approved}, retry=${record.intent.automation.retry_blocked}`,
|
|
380
528
|
];
|
|
529
|
+
if (record.intent.replanning) {
|
|
530
|
+
lines.push(`replanning: generation=${projection.plan_generation}, used=${projection.replans_used}/${record.intent.replanning.max_replans}, auto_apply=${record.intent.replanning.auto_apply}`);
|
|
531
|
+
if (projection.root_work_id !== record.intent.root_work_id) {
|
|
532
|
+
lines.push(`original root: ${record.intent.root_work_id}`);
|
|
533
|
+
}
|
|
534
|
+
if (projection.pending_plan_id)
|
|
535
|
+
lines.push(`pending plan: ${projection.pending_plan_id}`);
|
|
536
|
+
}
|
|
537
|
+
if (record.intent.mission) {
|
|
538
|
+
lines.push(`mission: ${record.intent.mission.objective}`);
|
|
539
|
+
lines.push(`milestones: ${projection.milestones_completed}/${record.intent.mission.max_milestones}`);
|
|
540
|
+
lines.push(`mission acceptance: ${record.intent.mission.acceptance.length}`);
|
|
541
|
+
}
|
|
381
542
|
if (projection.attention_work.length) {
|
|
382
543
|
lines.push(`attention: ${projection.attention_work.join(", ")}`);
|
|
383
544
|
}
|
|
@@ -392,6 +553,7 @@ function emitSupervisorReport(report, json, emit) {
|
|
|
392
553
|
emit.text(`supervisor ${report.goal_id}: ${report.stop_reason}\n` +
|
|
393
554
|
`reason: ${report.reason}\n` +
|
|
394
555
|
`cycles: ${report.cycles}; dispatches: ${report.dispatches}; acceptances: ${report.acceptances}\n` +
|
|
556
|
+
`replans: ${report.replans}\n` +
|
|
395
557
|
`state: ${report.projection.state}; next: ${report.projection.next_action}\n`);
|
|
396
558
|
}
|
|
397
559
|
function renderSupervisorRow(record) {
|
|
@@ -405,6 +567,62 @@ function integer(value) {
|
|
|
405
567
|
throw new Error(`expected a positive integer, got ${JSON.stringify(value)}`);
|
|
406
568
|
return Number.parseInt(value, 10);
|
|
407
569
|
}
|
|
570
|
+
function jsonInteger(value, field) {
|
|
571
|
+
if (value === undefined)
|
|
572
|
+
return undefined;
|
|
573
|
+
if (!Number.isSafeInteger(value) || value < 1) {
|
|
574
|
+
throw new Error(`${field} must be a positive integer`);
|
|
575
|
+
}
|
|
576
|
+
return value;
|
|
577
|
+
}
|
|
578
|
+
function jsonBoolean(value, field) {
|
|
579
|
+
if (value === undefined)
|
|
580
|
+
return undefined;
|
|
581
|
+
if (typeof value !== "boolean")
|
|
582
|
+
throw new Error(`${field} must be boolean`);
|
|
583
|
+
return value;
|
|
584
|
+
}
|
|
585
|
+
function emitPlan(plan, json, emit) {
|
|
586
|
+
if (json) {
|
|
587
|
+
emit.config({ format: "json" });
|
|
588
|
+
emit.data(plan);
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
const lines = [
|
|
592
|
+
`${plan.request.id}: ${plan.status}`,
|
|
593
|
+
`goal: ${plan.request.goal_id}`,
|
|
594
|
+
`sequence: ${plan.request.sequence}`,
|
|
595
|
+
`trigger: ${plan.request.trigger ?? "recovery"}`,
|
|
596
|
+
`prior root: ${plan.request.prior_root_work_id}`,
|
|
597
|
+
`planner run: ${plan.request.workflow_run_id}`,
|
|
598
|
+
];
|
|
599
|
+
if (plan.proposal) {
|
|
600
|
+
lines.push(`decision: ${plan.proposal.decision}`);
|
|
601
|
+
lines.push(`rationale: ${plan.proposal.rationale}`);
|
|
602
|
+
lines.push(`proposed work: ${plan.proposal.work.length}`);
|
|
603
|
+
if (plan.proposal.milestone) {
|
|
604
|
+
lines.push(`milestone: ${plan.proposal.milestone.sequence} ${plan.proposal.milestone.title}`);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
if (plan.root_work_id)
|
|
608
|
+
lines.push(`applied root: ${plan.root_work_id}`);
|
|
609
|
+
if (plan.approval_id)
|
|
610
|
+
lines.push(`approval: ${plan.approval_id}`);
|
|
611
|
+
emit.text(`${lines.join("\n")}\n`);
|
|
612
|
+
}
|
|
613
|
+
function emitPlanOutcome(outcome, json, emit) {
|
|
614
|
+
if (json) {
|
|
615
|
+
emit.config({ format: "json" });
|
|
616
|
+
emit.data(outcome);
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
emit.text(`supervisor plan ${outcome.plan_id}: ${outcome.status}\n` +
|
|
620
|
+
`${outcome.reason ? `reason: ${outcome.reason}\n` : ""}` +
|
|
621
|
+
`${outcome.root_work_id ? `root: ${outcome.root_work_id}\n` : ""}`);
|
|
622
|
+
}
|
|
623
|
+
function renderPlanRow(plan) {
|
|
624
|
+
return `${plan.request.id} ${plan.status.padEnd(18)} ${plan.request.prior_root_work_id}`;
|
|
625
|
+
}
|
|
408
626
|
function delay(ms) {
|
|
409
627
|
return new Promise((resolveDelay) => setTimeout(resolveDelay, ms));
|
|
410
628
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
export { approveSupervisorPlan, rejectSupervisorPlan } from "./plan-api.js";
|
|
2
|
+
export { readSupervisorPlan, readSupervisorPlans } from "./plan-read.js";
|
|
3
|
+
export { type CreateSupervisorPlanTemplateInput, type CreateSupervisorReplanningInput, SUPERVISOR_PLAN_SCHEMA_VERSION, type SupervisorPlanEvent, type SupervisorPlanEventType, type SupervisorPlanHistory, type SupervisorPlanMilestone, type SupervisorPlanOutcome, type SupervisorPlanProposal, type SupervisorPlanRecord, type SupervisorPlanRequest, type SupervisorPlanStatus, type SupervisorPlanTemplate, type SupervisorPlanWorkSpec, type SupervisorReplanningPolicy, } from "./plan-types.js";
|
|
1
4
|
export { type RunSupervisorInput, runSupervisor, type SupervisorDispatchOutcome, type SupervisorRunReport, type SupervisorStopReason, } from "./runner.js";
|
|
2
5
|
export { type ConfigureSupervisorServiceInput, configureSupervisorService, type RunSupervisorServiceDaemonInput, type RunSupervisorServiceSweepInput, readSupervisorServiceConfig, readSupervisorServiceRuntime, readSupervisorServiceStatus, requestSupervisorServiceStop, runSupervisorServiceDaemon, runSupervisorServiceSweep, SUPERVISOR_SERVICE_CONFIG_SCHEMA_VERSION, SUPERVISOR_SERVICE_RUNTIME_SCHEMA_VERSION, SUPERVISOR_SERVICE_STATUS_SCHEMA_VERSION, type SupervisorServiceConfig, type SupervisorServiceEngineConfig, type SupervisorServiceGoalRuntime, type SupervisorServiceGoalState, type SupervisorServiceProcessState, type SupervisorServiceRuntime, type SupervisorServiceStatus, type SupervisorServiceStatusRecord, type SupervisorServiceSweepOutcome, type SupervisorServiceSweepReport, spawnSupervisorService, supervisorServiceLogPath, } from "./service.js";
|
|
3
|
-
export { assertSupervisorId, type CreateSupervisorInput, collectSupervisorWork, createSupervisor, listSupervisors, newSupervisorId, readSupervisor, SUPERVISOR_INTENT_SCHEMA_VERSION, type SupervisorAutomationPolicy, type SupervisorIntent, type SupervisorLimits, type SupervisorNextAction, type SupervisorProjection, type SupervisorRecord, type SupervisorState, } from "./state.js";
|
|
6
|
+
export { assertSupervisorId, type CreateSupervisorInput, type CreateSupervisorMissionInput, collectSupervisorWork, createSupervisor, listSupervisors, newSupervisorId, readSupervisor, SUPERVISOR_INTENT_SCHEMA_VERSION, type SupervisorAutomationPolicy, type SupervisorIntent, type SupervisorLimits, type SupervisorMission, type SupervisorNextAction, type SupervisorProjection, type SupervisorRecord, type SupervisorState, } from "./state.js";
|
|
4
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/supervisor/index.ts"],"names":[],"mappings":"AAAA,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,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,cAAc,EACd,gCAAgC,EAChC,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/supervisor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EACL,KAAK,iCAAiC,EACtC,KAAK,+BAA+B,EACpC,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,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,3 +1,6 @@
|
|
|
1
|
+
export { approveSupervisorPlan, rejectSupervisorPlan } from "./plan-api.js";
|
|
2
|
+
export { readSupervisorPlan, readSupervisorPlans } from "./plan-read.js";
|
|
3
|
+
export { SUPERVISOR_PLAN_SCHEMA_VERSION, } from "./plan-types.js";
|
|
1
4
|
export { runSupervisor, } from "./runner.js";
|
|
2
5
|
export { configureSupervisorService, readSupervisorServiceConfig, readSupervisorServiceRuntime, readSupervisorServiceStatus, requestSupervisorServiceStop, runSupervisorServiceDaemon, runSupervisorServiceSweep, SUPERVISOR_SERVICE_CONFIG_SCHEMA_VERSION, SUPERVISOR_SERVICE_RUNTIME_SCHEMA_VERSION, SUPERVISOR_SERVICE_STATUS_SCHEMA_VERSION, spawnSupervisorService, supervisorServiceLogPath, } from "./service.js";
|
|
3
6
|
export { assertSupervisorId, collectSupervisorWork, createSupervisor, listSupervisors, newSupervisorId, readSupervisor, SUPERVISOR_INTENT_SCHEMA_VERSION, } from "./state.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SupervisorPlanOutcome } from "./plan-types.js";
|
|
2
|
+
export declare function approveSupervisorPlan(input: {
|
|
3
|
+
coordRoot: string;
|
|
4
|
+
goalId: string;
|
|
5
|
+
planId: string;
|
|
6
|
+
actor?: string;
|
|
7
|
+
reason?: string;
|
|
8
|
+
}): SupervisorPlanOutcome;
|
|
9
|
+
export declare function rejectSupervisorPlan(input: {
|
|
10
|
+
coordRoot: string;
|
|
11
|
+
goalId: string;
|
|
12
|
+
planId: string;
|
|
13
|
+
actor?: string;
|
|
14
|
+
reason: string;
|
|
15
|
+
}): SupervisorPlanOutcome;
|
|
16
|
+
//# sourceMappingURL=plan-api.d.ts.map
|
|
@@ -0,0 +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;AAI7D,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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { applySupervisorPlanProposal, rejectSupervisorPlanProposal } from "./planning.js";
|
|
2
|
+
import { acquireSupervisorLease, readSupervisorIgnoringLease } from "./state.js";
|
|
3
|
+
export function approveSupervisorPlan(input) {
|
|
4
|
+
const actor = input.actor?.trim() || `supervisor:${input.goalId}`;
|
|
5
|
+
const release = acquireSupervisorLease(input.coordRoot, input.goalId);
|
|
6
|
+
try {
|
|
7
|
+
return applySupervisorPlanProposal({
|
|
8
|
+
coordRoot: input.coordRoot,
|
|
9
|
+
record: readSupervisorIgnoringLease(input.coordRoot, input.goalId),
|
|
10
|
+
planId: input.planId,
|
|
11
|
+
actor,
|
|
12
|
+
reason: input.reason,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
finally {
|
|
16
|
+
release();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export function rejectSupervisorPlan(input) {
|
|
20
|
+
const actor = input.actor?.trim() || `supervisor:${input.goalId}`;
|
|
21
|
+
const release = acquireSupervisorLease(input.coordRoot, input.goalId);
|
|
22
|
+
try {
|
|
23
|
+
return rejectSupervisorPlanProposal({
|
|
24
|
+
coordRoot: input.coordRoot,
|
|
25
|
+
goalId: input.goalId,
|
|
26
|
+
planId: input.planId,
|
|
27
|
+
actor,
|
|
28
|
+
reason: input.reason,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
release();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type SupervisorPlanHistory, type SupervisorPlanRecord } from "./plan-types.js";
|
|
2
|
+
export declare function readSupervisorPlans(coordRootRaw: string, goalId: string, originalRootWorkId: string): SupervisorPlanHistory;
|
|
3
|
+
export declare function readSupervisorPlan(coordRootRaw: string, goalId: string, planId: string): SupervisorPlanRecord;
|
|
4
|
+
//# sourceMappingURL=plan-read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-read.d.ts","sourceRoot":"","sources":["../../../src/core/supervisor/plan-read.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,qBAAqB,EAE1B,KAAK,oBAAoB,EAE1B,MAAM,iBAAiB,CAAC;AAuBzB,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,CAetB"}
|