agentic-engineering-harness 0.6.13 → 0.6.15
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/outputContracts.d.ts +44 -1
- package/dist/agents/outputContracts.js +12 -2
- package/dist/agents/outputContracts.js.map +1 -1
- package/dist/agents/reviewLifecycle.js +54 -14
- package/dist/agents/reviewLifecycle.js.map +1 -1
- package/dist/agents/waveExecutor.d.ts +2 -13
- package/dist/audit/run.d.ts +7 -0
- package/dist/audit/run.js +198 -32
- package/dist/audit/run.js.map +1 -1
- package/dist/core/run.js +103 -28
- package/dist/core/run.js.map +1 -1
- package/dist/main.js +95 -29
- package/dist/main.js.map +1 -1
- package/dist/operations/artifacts.d.ts +13 -0
- package/dist/operations/artifacts.js +45 -0
- package/dist/operations/artifacts.js.map +1 -0
- package/dist/operations/change.d.ts +11 -0
- package/dist/operations/change.js +144 -0
- package/dist/operations/change.js.map +1 -0
- package/dist/operations/completion.d.ts +4 -1
- package/dist/operations/completion.js +69 -89
- package/dist/operations/completion.js.map +1 -1
- package/dist/operations/controller.d.ts +8 -5
- package/dist/operations/controller.js +270 -131
- package/dist/operations/controller.js.map +1 -1
- package/dist/operations/leadBinding.d.ts +2 -0
- package/dist/operations/leadBinding.js +22 -0
- package/dist/operations/leadBinding.js.map +1 -0
- package/dist/operations/liveness.d.ts +1 -0
- package/dist/operations/liveness.js +2 -0
- package/dist/operations/liveness.js.map +1 -0
- package/dist/operations/livenessV2.d.ts +34 -0
- package/dist/operations/livenessV2.js +339 -0
- package/dist/operations/livenessV2.js.map +1 -0
- package/dist/operations/mcp.d.ts +1 -0
- package/dist/operations/mcp.js +84 -57
- package/dist/operations/mcp.js.map +1 -1
- package/dist/operations/monitorProcess.d.ts +8 -0
- package/dist/operations/monitorProcess.js +33 -0
- package/dist/operations/monitorProcess.js.map +1 -0
- package/dist/operations/portfolio.d.ts +35 -0
- package/dist/operations/portfolio.js +158 -0
- package/dist/operations/portfolio.js.map +1 -0
- package/dist/operations/state.d.ts +174 -17
- package/dist/operations/state.js +178 -163
- package/dist/operations/state.js.map +1 -1
- package/dist/operations/supervisor.d.ts +38 -0
- package/dist/operations/supervisor.js +248 -0
- package/dist/operations/supervisor.js.map +1 -0
- package/dist/operations/wakeBudget.d.ts +15 -0
- package/dist/operations/wakeBudget.js +142 -0
- package/dist/operations/wakeBudget.js.map +1 -0
- package/dist/paseo/launchSpec.d.ts +4 -0
- package/dist/paseo/launchSpec.js +31 -37
- package/dist/paseo/launchSpec.js.map +1 -1
- package/dist/paseo/sdk.d.ts +5 -0
- package/dist/paseo/sdk.js +35 -87
- package/dist/paseo/sdk.js.map +1 -1
- package/dist/paseo/start.d.ts +1 -1
- package/dist/paseo/start.js +38 -87
- package/dist/paseo/start.js.map +1 -1
- package/dist/workers/agentPrompt.d.ts +2 -0
- package/dist/workers/agentPrompt.js +135 -190
- package/dist/workers/agentPrompt.js.map +1 -1
- package/docs/OPERATION_SUPERVISION.md +198 -0
- package/package.json +1 -1
- package/presets/agents/orchestration.jsonc +14 -4
- package/skills/engineering-workflow/SKILL.md +149 -104
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { loadResolvedAgentTopology } from "../agents/config.js";
|
|
2
|
+
import { executionSelectionForAgent } from "../agents/routing.js";
|
|
3
|
+
import { plannerOutputSchema } from "../agents/outputContracts.js";
|
|
4
|
+
import { extractMarkedJson } from "../agents/structuredOutput.js";
|
|
5
|
+
import { createControlPlaneSnapshot } from "../core/controlPlane.js";
|
|
6
|
+
import { loadTaskContract } from "../core/config.js";
|
|
7
|
+
import { createQuickContract } from "../core/quick.js";
|
|
8
|
+
import { runTask } from "../core/run.js";
|
|
9
|
+
import { validateSddChange } from "../core/sdd.js";
|
|
10
|
+
import { sealTask } from "../core/seal.js";
|
|
11
|
+
import { triageChange } from "../core/triage.js";
|
|
12
|
+
import { prepareOpenSpecChange, compileOpenSpecChange } from "../spec/openspec.js";
|
|
13
|
+
import { executeAgentPrompt } from "../workers/agentPrompt.js";
|
|
14
|
+
import { recordEvent } from "../telemetry/events.js";
|
|
15
|
+
import { ensureOperationSupervisor, maybeRotateOperationSupervisor } from "./supervisor.js";
|
|
16
|
+
import { loadOperation, patchOperation, setOperationStage } from "./state.js";
|
|
17
|
+
export async function runChangeOperation(root, controlRoot, config, operation, payload) {
|
|
18
|
+
const taskId = payload.taskId?.trim() || operation.id;
|
|
19
|
+
const title = payload.title?.trim() || payload.request.slice(0, 120) || `Change ${taskId}`;
|
|
20
|
+
const topology = await loadResolvedAgentTopology(root, config, payload.profile ?? config.agents?.activeProfile);
|
|
21
|
+
const bootstrapContract = operationBootstrapContract(taskId, title, payload);
|
|
22
|
+
await createControlPlaneSnapshot(root, config, taskId);
|
|
23
|
+
await setOperationStage(controlRoot, operation.id, "discovery", "RUNNING");
|
|
24
|
+
await ensureOperationSupervisor(root, config, bootstrapContract, topology, { required: true, forceMaterialize: true });
|
|
25
|
+
const explorerEvidence = await runDiscovery(root, config, bootstrapContract, topology, payload);
|
|
26
|
+
await setOperationStage(controlRoot, operation.id, "discovery", "COMPLETED");
|
|
27
|
+
await maybeRotateOperationSupervisor(root, config, bootstrapContract, topology);
|
|
28
|
+
await setOperationStage(controlRoot, operation.id, "planning", "RUNNING");
|
|
29
|
+
const plannerEvidence = await runPlanning(root, config, bootstrapContract, topology, payload, explorerEvidence);
|
|
30
|
+
await setOperationStage(controlRoot, operation.id, "planning", "COMPLETED");
|
|
31
|
+
await setOperationStage(controlRoot, operation.id, "triage", "RUNNING");
|
|
32
|
+
const triage = triageChange(config, { request: payload.request, files: payload.files, domains: payload.domains, risk: payload.risk });
|
|
33
|
+
const mode = triage.quickEligible && (payload.acceptance?.length ?? 0) > 0 ? "quick" : "spec";
|
|
34
|
+
const triageReasons = mode === "quick" ? triage.reasons : [...triage.reasons, ...(payload.acceptance?.length ? [] : ["SPEC selected because no explicit observable QUICK acceptance was supplied"])];
|
|
35
|
+
const current = await loadOperation(controlRoot, operation.id);
|
|
36
|
+
await patchOperation(controlRoot, operation.id, { intent: { ...current.intent, request: payload.request, classification: "CHANGE", mode, risk: payload.risk ?? "low", priority: payload.priority ?? current.intent?.priority } });
|
|
37
|
+
await setOperationStage(controlRoot, operation.id, "triage", "COMPLETED", { message: `${mode.toUpperCase()}: ${triageReasons.join("; ")}` });
|
|
38
|
+
let contract;
|
|
39
|
+
let specChange;
|
|
40
|
+
if (mode === "quick") {
|
|
41
|
+
await setOperationStage(controlRoot, operation.id, "contract-authoring", "RUNNING");
|
|
42
|
+
const quick = await createQuickContract(root, config, taskId, {
|
|
43
|
+
title,
|
|
44
|
+
request: payload.request,
|
|
45
|
+
scope: payload.files ?? [],
|
|
46
|
+
acceptance: payload.acceptance ?? [],
|
|
47
|
+
domains: payload.domains,
|
|
48
|
+
risk: payload.risk,
|
|
49
|
+
profile: payload.profile
|
|
50
|
+
});
|
|
51
|
+
contract = quick.contract;
|
|
52
|
+
await sealTask(root, config, contract);
|
|
53
|
+
await setOperationStage(controlRoot, operation.id, "contract-authoring", "COMPLETED", { artifact: relativeContract(config, taskId) });
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
await setOperationStage(controlRoot, operation.id, "spec-authoring", "RUNNING");
|
|
57
|
+
const prepared = await prepareOpenSpecChange(root, config, taskId, title);
|
|
58
|
+
specChange = prepared.changeName;
|
|
59
|
+
const manager = topology.agents[prepared.managerAgent];
|
|
60
|
+
if (!manager || manager.disabled)
|
|
61
|
+
throw new Error(`SPEC_MANAGER_UNAVAILABLE: ${prepared.managerAgent}`);
|
|
62
|
+
const selection = executionSelectionForAgent(topology, prepared.managerAgent);
|
|
63
|
+
const specSession = await executeAgentPrompt(root, config, bootstrapContract, selection, buildSpecManagerPrompt(payload, prepared.changeName, explorerEvidence, plannerEvidence), { outputContract: selection.outputContract ?? "planner", phase: "spec-authoring", operationKind: "change" });
|
|
64
|
+
if (specSession.exitCode !== 0)
|
|
65
|
+
throw new Error(`SPEC_MANAGER_FAILED: ${specSession.stderr || specSession.stdout}`);
|
|
66
|
+
await maybeRotateOperationSupervisor(root, config, bootstrapContract, topology);
|
|
67
|
+
await setOperationStage(controlRoot, operation.id, "spec-compilation", "RUNNING");
|
|
68
|
+
await compileOpenSpecChange(root, config, taskId, title, prepared.changeName);
|
|
69
|
+
const validation = await validateSddChange(root, taskId, config);
|
|
70
|
+
if (!validation.ok)
|
|
71
|
+
throw new Error(`SDD validation failed after OpenSpec compilation: ${[...validation.missing, ...validation.issues].join("; ")}`);
|
|
72
|
+
contract = await loadTaskContract(root, taskId, config);
|
|
73
|
+
await sealTask(root, config, contract);
|
|
74
|
+
await setOperationStage(controlRoot, operation.id, "spec-authoring", "COMPLETED", { artifact: `openspec/changes/${prepared.changeName}` });
|
|
75
|
+
await setOperationStage(controlRoot, operation.id, "spec-compilation", "COMPLETED", { artifact: relativeContract(config, taskId) });
|
|
76
|
+
}
|
|
77
|
+
await setOperationStage(controlRoot, operation.id, "implementation", "RUNNING");
|
|
78
|
+
const run = await runTask(root, config, contract, { profile: payload.profile });
|
|
79
|
+
await setOperationStage(controlRoot, operation.id, "implementation", run.status === "PASS" ? "COMPLETED" : "FAILED");
|
|
80
|
+
await recordEvent(controlRoot, config, "harness.change.finish", { operationId: operation.id, taskId, mode, status: run.status, triageReasons, specChange });
|
|
81
|
+
return { taskId, mode, triageReasons, run, specChange };
|
|
82
|
+
}
|
|
83
|
+
async function runDiscovery(root, config, contract, topology, payload) {
|
|
84
|
+
const explorer = topology.agents.explorer;
|
|
85
|
+
if (!explorer || explorer.disabled)
|
|
86
|
+
return "Explorer unavailable; deterministic triage will use explicit user evidence only.";
|
|
87
|
+
const session = await executeAgentPrompt(root, config, contract, executionSelectionForAgent(topology, "explorer"), [
|
|
88
|
+
"Perform bounded repository discovery for this CHANGE operation.",
|
|
89
|
+
`Request: ${payload.request}`,
|
|
90
|
+
`Explicit files: ${(payload.files ?? []).join(", ") || "none"}`,
|
|
91
|
+
`Domains: ${(payload.domains ?? []).join(", ") || "unspecified"}`,
|
|
92
|
+
"Return only relevant files/symbols/tests/module boundaries and concrete evidence. Do not implement, author specs or start another AEH workflow."
|
|
93
|
+
].join("\n"), { phase: "discovery", operationKind: "change" });
|
|
94
|
+
if (session.exitCode !== 0)
|
|
95
|
+
throw new Error(`EXPLORER_FAILED: ${session.stderr || session.stdout}`);
|
|
96
|
+
return compact(session.stdout || session.stderr, 12_000);
|
|
97
|
+
}
|
|
98
|
+
async function runPlanning(root, config, contract, topology, payload, explorerEvidence) {
|
|
99
|
+
const planner = topology.agents.planner;
|
|
100
|
+
if (!planner || planner.disabled)
|
|
101
|
+
return "Planner unavailable; deterministic triage will use explicit user evidence only.";
|
|
102
|
+
const selection = executionSelectionForAgent(topology, "planner");
|
|
103
|
+
const session = await executeAgentPrompt(root, config, contract, selection, [
|
|
104
|
+
"Produce planning/triage evidence only for this CHANGE operation. Do not implement or author the specification.",
|
|
105
|
+
`Request: ${payload.request}`,
|
|
106
|
+
`Explorer evidence:\n${explorerEvidence}`,
|
|
107
|
+
"Identify affected areas, dependencies, likely implementer boundaries, reviewers and validation gates. Keep normative requirements unchanged."
|
|
108
|
+
].join("\n\n"), { outputContract: "planner", phase: "planning", operationKind: "change" });
|
|
109
|
+
if (session.exitCode !== 0)
|
|
110
|
+
throw new Error(`PLANNER_FAILED: ${session.stderr || session.stdout}`);
|
|
111
|
+
try {
|
|
112
|
+
const parsed = plannerOutputSchema.parse(extractMarkedJson(session.stdout, session.stderr));
|
|
113
|
+
return JSON.stringify(parsed);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return compact(session.stdout || session.stderr, 12_000);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function operationBootstrapContract(taskId, title, payload) {
|
|
120
|
+
return {
|
|
121
|
+
version: 1,
|
|
122
|
+
task: { id: taskId, title },
|
|
123
|
+
scope: { allowed: payload.files?.length ? payload.files : ["**"], forbidden: [], frozen: [] },
|
|
124
|
+
routing: { intent: "change", domains: payload.domains ?? [], risk: payload.risk ?? "low", profile: payload.profile },
|
|
125
|
+
constraints: { breakingApiChanges: false, newDependencies: false, schemaChanges: false }
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function buildSpecManagerPrompt(payload, changeName, explorerEvidence, plannerEvidence) {
|
|
129
|
+
return [
|
|
130
|
+
`Author OpenSpec change '${changeName}' for the existing durable CHANGE operation.`,
|
|
131
|
+
`User request: ${payload.request}`,
|
|
132
|
+
`Explicit acceptance: ${JSON.stringify(payload.acceptance ?? [])}`,
|
|
133
|
+
`Explorer evidence:\n${explorerEvidence}`,
|
|
134
|
+
`Planner evidence:\n${plannerEvidence}`,
|
|
135
|
+
"Use `openspec status`, `openspec instructions` and the OpenSpec authoring workflow to complete proposal.md, specs, design.md when needed and tasks.md.",
|
|
136
|
+
"Do not invoke `aeh spec`, `aeh run`, `aeh operation ...` or another Harness workflow. The deterministic controller will validate, compile, seal and execute after your authoring turn.",
|
|
137
|
+
"Do not invent a product decision. If a true requirement decision is impossible to derive, make that unresolved state explicit in your final structured output."
|
|
138
|
+
].join("\n\n");
|
|
139
|
+
}
|
|
140
|
+
function relativeContract(config, taskId) {
|
|
141
|
+
return `${config.sdd?.contractsDir ?? ".harness/contracts"}/${taskId}.yaml`;
|
|
142
|
+
}
|
|
143
|
+
function compact(value, max) { return value.length <= max ? value : `${value.slice(0, max)}\n[truncated ${value.length - max} chars]`; }
|
|
144
|
+
//# sourceMappingURL=change.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"change.js","sourceRoot":"","sources":["../../src/operations/change.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,0BAA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+B,EAAE,UAAkB,EAAE,gBAAwB,EAAE,eAAuB;IACpI,OAAO;QACL,2BAA2B,UAAU,8CAA8C;QACnF,iBAAiB,OAAO,CAAC,OAAO,EAAE;QAClC,wBAAwB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC,EAAE;QAClE,uBAAuB,gBAAgB,EAAE;QACzC,sBAAsB,eAAe,EAAE;QACvC,wJAAwJ;QACxJ,wLAAwL;QACxL,gKAAgK;KACjK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACjB,CAAC;AAED,SAAS,gBAAgB,CAAC,MAA4B,EAAE,MAAc;IACpE,OAAO,GAAG,MAAM,CAAC,GAAG,EAAE,YAAY,IAAI,oBAAoB,IAAI,MAAM,OAAO,CAAC;AAC9E,CAAC;AACD,SAAS,OAAO,CAAC,KAAa,EAAE,GAAW,IAAY,OAAO,KAAK,CAAC,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,gBAAgB,KAAK,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { dispatchManagedPaseoAgent } from "../paseo/runtime.js";
|
|
2
2
|
import { recordPaseoTrace } from "../paseo/trace.js";
|
|
3
|
-
import type
|
|
3
|
+
import { type OperationRecord } from "./state.js";
|
|
4
4
|
export type OperationCompletionStatus = "PENDING" | "SENT" | "FAILED" | "DISABLED";
|
|
5
5
|
export interface OperationCompletionTarget {
|
|
6
6
|
version: 1;
|
|
@@ -10,6 +10,7 @@ export interface OperationCompletionTarget {
|
|
|
10
10
|
status: OperationCompletionStatus;
|
|
11
11
|
registeredAt: string;
|
|
12
12
|
attemptedAt?: string;
|
|
13
|
+
attempts?: number;
|
|
13
14
|
sentAt?: string;
|
|
14
15
|
failedAt?: string;
|
|
15
16
|
error?: string;
|
|
@@ -17,6 +18,8 @@ export interface OperationCompletionTarget {
|
|
|
17
18
|
export interface OperationCompletionDeps {
|
|
18
19
|
dispatch?: typeof dispatchManagedPaseoAgent;
|
|
19
20
|
trace?: typeof recordPaseoTrace;
|
|
21
|
+
retryDelaysMs?: number[];
|
|
22
|
+
sleep?: (ms: number) => Promise<void>;
|
|
20
23
|
}
|
|
21
24
|
export declare function operationCompletionFile(root: string, operationId: string): string;
|
|
22
25
|
export declare function registerOperationCompletionTarget(root: string, operationId: string, agentId: string, source?: string, trace?: typeof recordPaseoTrace): Promise<OperationCompletionTarget>;
|
|
@@ -2,52 +2,31 @@ import fs from "node:fs/promises";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { dispatchManagedPaseoAgent } from "../paseo/runtime.js";
|
|
4
4
|
import { recordPaseoTrace } from "../paseo/trace.js";
|
|
5
|
+
import { loadOperation, patchOperationMetadata } from "./state.js";
|
|
6
|
+
const DEFAULT_RETRY_DELAYS_MS = [0, 500, 1_500];
|
|
7
|
+
const COMPLETION_WARNING_PREFIX = "completion callback:";
|
|
5
8
|
export function operationCompletionFile(root, operationId) {
|
|
6
9
|
return path.resolve(root, ".harness/operations", `${safeId(operationId)}.completion.json`);
|
|
7
10
|
}
|
|
8
11
|
export async function registerOperationCompletionTarget(root, operationId, agentId, source, trace = recordPaseoTrace) {
|
|
9
|
-
const target = {
|
|
10
|
-
version: 1,
|
|
11
|
-
operationId,
|
|
12
|
-
agentId: requiredId(agentId, "agent id"),
|
|
13
|
-
source,
|
|
14
|
-
status: "PENDING",
|
|
15
|
-
registeredAt: new Date().toISOString()
|
|
16
|
-
};
|
|
12
|
+
const target = { version: 1, operationId, agentId: requiredId(agentId, "agent id"), source, status: "PENDING", registeredAt: new Date().toISOString() };
|
|
17
13
|
await persist(root, target);
|
|
18
|
-
await trace(root, "operation.callback.registered", {
|
|
19
|
-
operationId,
|
|
20
|
-
agentId: target.agentId,
|
|
21
|
-
source: source ?? "unknown"
|
|
22
|
-
});
|
|
14
|
+
await trace(root, "operation.callback.registered", { operationId, agentId: target.agentId, source: source ?? "unknown" });
|
|
23
15
|
return target;
|
|
24
16
|
}
|
|
25
17
|
export async function disableOperationCompletionTarget(root, operationId, reason, trace = recordPaseoTrace) {
|
|
26
18
|
const target = await loadOperationCompletionTarget(root, operationId);
|
|
27
19
|
if (!target || target.status === "SENT")
|
|
28
20
|
return;
|
|
29
|
-
const disabled = {
|
|
30
|
-
...target,
|
|
31
|
-
status: "DISABLED",
|
|
32
|
-
attemptedAt: new Date().toISOString(),
|
|
33
|
-
error: reason
|
|
34
|
-
};
|
|
21
|
+
const disabled = { ...target, status: "DISABLED", attemptedAt: new Date().toISOString(), error: reason };
|
|
35
22
|
await persist(root, disabled);
|
|
36
|
-
await trace(root, "operation.callback.disabled", {
|
|
37
|
-
operationId,
|
|
38
|
-
agentId: target.agentId,
|
|
39
|
-
reason
|
|
40
|
-
});
|
|
23
|
+
await trace(root, "operation.callback.disabled", { operationId, agentId: target.agentId, reason });
|
|
41
24
|
}
|
|
42
25
|
export async function loadOperationCompletionTarget(root, operationId) {
|
|
43
26
|
try {
|
|
44
27
|
const value = JSON.parse(await fs.readFile(operationCompletionFile(root, operationId), "utf8"));
|
|
45
|
-
if (value.version !== 1 ||
|
|
46
|
-
value.operationId !== operationId ||
|
|
47
|
-
!value.agentId ||
|
|
48
|
-
!["PENDING", "SENT", "FAILED", "DISABLED"].includes(value.status)) {
|
|
28
|
+
if (value.version !== 1 || value.operationId !== operationId || !value.agentId || !["PENDING", "SENT", "FAILED", "DISABLED"].includes(value.status))
|
|
49
29
|
throw new Error("invalid completion target record");
|
|
50
|
-
}
|
|
51
30
|
return value;
|
|
52
31
|
}
|
|
53
32
|
catch (error) {
|
|
@@ -57,51 +36,39 @@ export async function loadOperationCompletionTarget(root, operationId) {
|
|
|
57
36
|
}
|
|
58
37
|
}
|
|
59
38
|
export async function notifyOperationCompletion(root, operation, deps = {}) {
|
|
60
|
-
|
|
39
|
+
let target = await loadOperationCompletionTarget(root, operation.id);
|
|
61
40
|
if (!target || target.status === "SENT" || target.status === "DISABLED")
|
|
62
41
|
return target;
|
|
63
42
|
const dispatch = deps.dispatch ?? dispatchManagedPaseoAgent;
|
|
64
43
|
const trace = deps.trace ?? recordPaseoTrace;
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
44
|
+
const retryDelaysMs = normalizeRetryDelays(deps.retryDelaysMs);
|
|
45
|
+
const sleep = deps.sleep ?? delay;
|
|
46
|
+
for (let index = 0; index < retryDelaysMs.length; index += 1) {
|
|
47
|
+
const retryDelayMs = retryDelaysMs[index];
|
|
48
|
+
if (retryDelayMs > 0)
|
|
49
|
+
await sleep(retryDelayMs);
|
|
50
|
+
const attemptedAt = new Date().toISOString();
|
|
51
|
+
const attempts = (target.attempts ?? 0) + 1;
|
|
52
|
+
await trace(root, "operation.callback.attempt", { operationId: operation.id, operationStatus: operation.status, agentId: target.agentId, attempt: attempts, invocationAttempt: index + 1, maxInvocationAttempts: retryDelaysMs.length, retryDelayMs });
|
|
53
|
+
try {
|
|
54
|
+
const result = await dispatch(root, target.agentId, completionPrompt(operation), 60);
|
|
55
|
+
if (result.exitCode !== 0)
|
|
56
|
+
throw new Error(result.stderr || result.stdout || `Paseo dispatch exited with code ${result.exitCode}`);
|
|
57
|
+
const sent = { ...target, status: "SENT", attemptedAt, attempts, sentAt: new Date().toISOString(), failedAt: undefined, error: undefined };
|
|
58
|
+
await persist(root, sent);
|
|
59
|
+
await reflectCompletionState(root, operation.id, attempts, undefined);
|
|
60
|
+
await trace(root, "operation.callback.sent", { operationId: operation.id, operationStatus: operation.status, agentId: target.agentId, transport: result.transport, attempts, resultPath: resultPath(operation) ?? "" });
|
|
61
|
+
return sent;
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const failed = { ...target, status: "FAILED", attemptedAt, attempts, failedAt: new Date().toISOString(), error: error instanceof Error ? error.message : String(error) };
|
|
65
|
+
await persist(root, failed);
|
|
66
|
+
target = failed;
|
|
67
|
+
await trace(root, "operation.callback.failed", { operationId: operation.id, operationStatus: operation.status, agentId: target.agentId, attempt: attempts, invocationAttempt: index + 1, maxInvocationAttempts: retryDelaysMs.length, willRetry: index + 1 < retryDelaysMs.length, error: failed.error ?? "unknown" });
|
|
70
68
|
}
|
|
71
|
-
const sent = {
|
|
72
|
-
...target,
|
|
73
|
-
status: "SENT",
|
|
74
|
-
attemptedAt,
|
|
75
|
-
sentAt: new Date().toISOString(),
|
|
76
|
-
error: undefined
|
|
77
|
-
};
|
|
78
|
-
await persist(root, sent);
|
|
79
|
-
await trace(root, "operation.callback.sent", {
|
|
80
|
-
operationId: operation.id,
|
|
81
|
-
operationStatus: operation.status,
|
|
82
|
-
agentId: target.agentId,
|
|
83
|
-
transport: result.transport,
|
|
84
|
-
resultPath: resultPath(operation) ?? ""
|
|
85
|
-
});
|
|
86
|
-
return sent;
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
const failed = {
|
|
90
|
-
...target,
|
|
91
|
-
status: "FAILED",
|
|
92
|
-
attemptedAt,
|
|
93
|
-
failedAt: new Date().toISOString(),
|
|
94
|
-
error: error instanceof Error ? error.message : String(error)
|
|
95
|
-
};
|
|
96
|
-
await persist(root, failed);
|
|
97
|
-
await trace(root, "operation.callback.failed", {
|
|
98
|
-
operationId: operation.id,
|
|
99
|
-
operationStatus: operation.status,
|
|
100
|
-
agentId: target.agentId,
|
|
101
|
-
error: failed.error ?? "unknown"
|
|
102
|
-
});
|
|
103
|
-
return failed;
|
|
104
69
|
}
|
|
70
|
+
await reflectCompletionState(root, operation.id, target.attempts ?? 0, target.error ?? "unknown error");
|
|
71
|
+
return target;
|
|
105
72
|
}
|
|
106
73
|
export function completionPrompt(operation) {
|
|
107
74
|
const artifact = resultPath(operation);
|
|
@@ -109,10 +76,10 @@ export function completionPrompt(operation) {
|
|
|
109
76
|
return [
|
|
110
77
|
"[AEH_OPERATION_COMPLETED]",
|
|
111
78
|
`Detached AEH operation ${operation.id} (${operation.kind}) reached terminal state ${operation.status}.`,
|
|
112
|
-
"This is an internal AEH
|
|
113
|
-
"Do not start a duplicate
|
|
114
|
-
`
|
|
115
|
-
"Continue
|
|
79
|
+
"This is an internal AEH operation continuation event, not a new user task.",
|
|
80
|
+
"Do not start a duplicate operation or restart the completed operation.",
|
|
81
|
+
`Read OperationRecord ${operation.id} and its durable result artifacts.${artifact ? ` Authoritative result artifact: ${artifact}.` : ""}`,
|
|
82
|
+
"Continue the original pending user-facing request using durable operation state as the source of truth.",
|
|
116
83
|
operation.error ? `Operation error: ${operation.error.split("\n", 1)[0]}` : `Operation result: ${result}`
|
|
117
84
|
].join("\n");
|
|
118
85
|
}
|
|
@@ -120,6 +87,29 @@ function resultPath(operation) {
|
|
|
120
87
|
const report = operation.result?.report;
|
|
121
88
|
return typeof report === "string" && report.trim() ? report.trim() : undefined;
|
|
122
89
|
}
|
|
90
|
+
async function reflectCompletionState(root, operationId, attempts, error) {
|
|
91
|
+
try {
|
|
92
|
+
const operation = await loadOperation(root, operationId);
|
|
93
|
+
const warnings = (operation.cleanupWarnings ?? []).filter((item) => !item.startsWith(COMPLETION_WARNING_PREFIX));
|
|
94
|
+
if (error)
|
|
95
|
+
warnings.push(`${COMPLETION_WARNING_PREFIX} failed to reactivate ${operation.lead?.agentId ?? "lead"} after ${attempts} attempt(s): ${error}`);
|
|
96
|
+
await patchOperationMetadata(root, operationId, {
|
|
97
|
+
cleanupWarnings: warnings.length ? warnings : undefined,
|
|
98
|
+
notification: {
|
|
99
|
+
...operation.notification,
|
|
100
|
+
lastLeadWakeRevision: operation.revision,
|
|
101
|
+
lastLeadWakeAt: new Date().toISOString(),
|
|
102
|
+
lastLeadWakeReason: "terminal",
|
|
103
|
+
terminalDelivered: !error,
|
|
104
|
+
attempts,
|
|
105
|
+
lastError: error
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
// completion sidecar remains an independent recovery record
|
|
111
|
+
}
|
|
112
|
+
}
|
|
123
113
|
async function persist(root, target) {
|
|
124
114
|
const file = operationCompletionFile(root, target.operationId);
|
|
125
115
|
await fs.mkdir(path.dirname(file), { recursive: true });
|
|
@@ -132,21 +122,11 @@ async function persist(root, target) {
|
|
|
132
122
|
await fs.rm(temp, { force: true }).catch(() => undefined);
|
|
133
123
|
}
|
|
134
124
|
}
|
|
135
|
-
function
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return
|
|
140
|
-
}
|
|
141
|
-
function
|
|
142
|
-
if (!/^[A-Za-z0-9._-]+$/.test(value))
|
|
143
|
-
throw new Error(`Invalid operation id '${value}'.`);
|
|
144
|
-
return value;
|
|
145
|
-
}
|
|
146
|
-
function isMissing(error) {
|
|
147
|
-
return Boolean(error &&
|
|
148
|
-
typeof error === "object" &&
|
|
149
|
-
"code" in error &&
|
|
150
|
-
error.code === "ENOENT");
|
|
151
|
-
}
|
|
125
|
+
function normalizeRetryDelays(value) { const candidate = value?.length ? value : DEFAULT_RETRY_DELAYS_MS; const normalized = candidate.filter((item) => Number.isFinite(item) && item >= 0); return normalized.length ? normalized : [0]; }
|
|
126
|
+
function requiredId(value, name) { const trimmed = value.trim(); if (!trimmed)
|
|
127
|
+
throw new Error(`${name} is required.`); return trimmed; }
|
|
128
|
+
function safeId(value) { if (!/^[A-Za-z0-9._-]+$/.test(value))
|
|
129
|
+
throw new Error(`Invalid operation id '${value}'.`); return value; }
|
|
130
|
+
function isMissing(error) { return Boolean(error && typeof error === "object" && "code" in error && error.code === "ENOENT"); }
|
|
131
|
+
function delay(ms) { return new Promise((resolve) => setTimeout(resolve, ms)); }
|
|
152
132
|
//# sourceMappingURL=completion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../src/operations/completion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;A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UAAU,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChQ,SAAS,UAAU,CAAC,KAAa,EAAE,IAAY,IAAY,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO;IAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,eAAe,CAAC,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,CAAC;AACjK,SAAS,MAAM,CAAC,KAAa,IAAY,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC;IAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC;AACnJ,SAAS,SAAS,CAAC,KAAc,IAAa,OAAO,OAAO,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,IAAI,KAAK,IAAK,KAA4B,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC;AACzK,SAAS,KAAK,CAAC,EAAU,IAAmB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import { recordPaseoTrace } from "../paseo/trace.js";
|
|
3
3
|
import { runProcess } from "../utils/process.js";
|
|
4
|
-
import {
|
|
4
|
+
import { startOperationWatchdog } from "./liveness.js";
|
|
5
|
+
import { type OperationKind, type OperationPayload, type OperationRecord, type OperationRecordV2 } from "./state.js";
|
|
5
6
|
export interface StartOperationOptions {
|
|
6
7
|
nodeExecutable: string;
|
|
7
8
|
entryFile: string;
|
|
@@ -13,10 +14,12 @@ export interface OperationControllerDeps {
|
|
|
13
14
|
run?: typeof runProcess;
|
|
14
15
|
trace?: typeof recordPaseoTrace;
|
|
15
16
|
notifyCompletion?: (root: string, operation: OperationRecord) => Promise<unknown>;
|
|
17
|
+
startWatchdog?: typeof startOperationWatchdog;
|
|
16
18
|
}
|
|
17
|
-
export declare function startDetachedOperation(root: string, kind: OperationKind, payload: OperationPayload, options: StartOperationOptions): Promise<
|
|
18
|
-
export declare function executeOperation(root: string, operationId: string, deps?: OperationControllerDeps): Promise<
|
|
19
|
-
export declare function waitForOperation(root: string, operationId: string, timeoutMs?: number, pollMs?: number): Promise<
|
|
20
|
-
export declare function cancelOperation(root: string, operationId: string, deps?: OperationControllerDeps): Promise<
|
|
19
|
+
export declare function startDetachedOperation(root: string, kind: OperationKind, payload: OperationPayload, options: StartOperationOptions): Promise<OperationRecordV2>;
|
|
20
|
+
export declare function executeOperation(root: string, operationId: string, deps?: OperationControllerDeps): Promise<OperationRecordV2>;
|
|
21
|
+
export declare function waitForOperation(root: string, operationId: string, timeoutMs?: number, pollMs?: number): Promise<OperationRecordV2>;
|
|
22
|
+
export declare function cancelOperation(root: string, operationId: string, deps?: OperationControllerDeps): Promise<OperationRecordV2>;
|
|
21
23
|
export declare function createOperationId(kind: OperationKind, seed: string): string;
|
|
22
24
|
export declare function extractWorkspaceId(text: string): string | undefined;
|
|
25
|
+
export declare function extractWorkspacePath(text: string): string | undefined;
|