@llblab/pi-actors 0.32.0 → 0.34.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/AGENTS.md +23 -11
- package/BACKLOG.md +2 -30
- package/CHANGELOG.md +30 -1
- package/dist/index.js +10 -10
- package/dist/lib/async-runs.d.ts +23 -75
- package/dist/lib/async-runs.js +49 -801
- package/dist/lib/command-templates.d.ts +3 -3
- package/dist/lib/command-templates.js +3 -3
- package/dist/lib/config.d.ts +2 -2
- package/dist/lib/config.js +5 -5
- package/dist/lib/{output.d.ts → execution-output.d.ts} +3 -3
- package/dist/lib/{output.js → execution-output.js} +3 -3
- package/dist/lib/execution.js +1 -1
- package/dist/lib/{actor-inspector-tui.d.ts → inspector.d.ts} +3 -2
- package/dist/lib/{actor-inspector-tui.js → inspector.js} +3 -2
- package/dist/lib/mailbox-loop.d.ts +3 -3
- package/dist/lib/mailbox-loop.js +3 -3
- package/dist/lib/{actor-messages.d.ts → messages.d.ts} +3 -3
- package/dist/lib/{actor-messages.js → messages.js} +3 -3
- package/dist/lib/paths.d.ts +1 -1
- package/dist/lib/paths.js +3 -3
- package/dist/lib/{actor-recipe-context.d.ts → recipes-context.d.ts} +3 -2
- package/dist/lib/{actor-recipe-context.js → recipes-context.js} +2 -1
- package/dist/lib/{recipe-discovery.d.ts → recipes-discovery.d.ts} +9 -9
- package/dist/lib/{recipe-discovery.js → recipes-discovery.js} +17 -17
- package/dist/lib/registry.d.ts +1 -1
- package/dist/lib/registry.js +22 -22
- package/dist/lib/{actor-rooms.d.ts → rooms.d.ts} +4 -4
- package/dist/lib/{actor-rooms.js → rooms.js} +3 -3
- package/dist/lib/runs-artifacts.d.ts +21 -0
- package/dist/lib/runs-artifacts.js +68 -0
- package/dist/lib/runs-control.d.ts +13 -0
- package/dist/lib/runs-control.js +59 -0
- package/dist/lib/runs-identity.d.ts +5 -0
- package/dist/lib/runs-identity.js +11 -0
- package/dist/lib/runs-index.d.ts +18 -0
- package/dist/lib/runs-index.js +119 -0
- package/dist/lib/runs-mailbox.d.ts +25 -0
- package/dist/lib/runs-mailbox.js +146 -0
- package/dist/lib/runs-messages.d.ts +15 -0
- package/dist/lib/runs-messages.js +179 -0
- package/dist/lib/runs-outbox.d.ts +41 -0
- package/dist/lib/runs-outbox.js +87 -0
- package/dist/lib/runs-process.d.ts +7 -0
- package/dist/lib/runs-process.js +36 -0
- package/dist/lib/runs-retention.d.ts +8 -0
- package/dist/lib/runs-retention.js +56 -0
- package/dist/lib/runs-start.d.ts +9 -0
- package/dist/lib/runs-start.js +67 -0
- package/dist/lib/runs-status.d.ts +8 -0
- package/dist/lib/runs-status.js +60 -0
- package/dist/lib/runtime.d.ts +2 -2
- package/dist/lib/runtime.js +5 -5
- package/dist/lib/schema.d.ts +9 -0
- package/dist/lib/schema.js +40 -0
- package/dist/lib/tools-access.d.ts +19 -0
- package/dist/lib/tools-access.js +44 -0
- package/dist/lib/tools-inspect.d.ts +11 -0
- package/dist/lib/tools-inspect.js +534 -0
- package/dist/lib/tools-local.d.ts +14 -0
- package/dist/lib/tools-local.js +156 -0
- package/dist/lib/tools-mailbox.d.ts +8 -0
- package/dist/lib/tools-mailbox.js +48 -0
- package/dist/lib/tools-message.d.ts +9 -0
- package/dist/lib/tools-message.js +346 -0
- package/dist/lib/tools-register.d.ts +18 -0
- package/dist/lib/tools-register.js +40 -0
- package/dist/lib/tools-response.d.ts +21 -0
- package/dist/lib/tools-response.js +219 -0
- package/dist/lib/tools-spawn.d.ts +12 -0
- package/dist/lib/tools-spawn.js +159 -0
- package/dist/lib/tools.d.ts +13 -39
- package/dist/lib/tools.js +11 -1497
- package/dist/recipes/utility-coordinator-lock-snapshot.json +1 -1
- package/dist/scripts/actor-worker.mjs +186 -7
- package/dist/scripts/async-runner.mjs +171 -8
- package/dist/scripts/build-dist.mjs +1 -1
- package/dist/scripts/conformance.mjs +34 -18
- package/dist/scripts/coordinator.mjs +733 -11
- package/dist/scripts/locker.mjs +345 -16
- package/dist/scripts/recipe-utils.mjs +478 -14
- package/dist/scripts/validate-recipe.mjs +110 -10
- package/dist/skills/actors/SKILL.md +2 -2
- package/dist/skills/swarm/SKILL.md +2 -2
- package/docs/recipe-library.md +1 -1
- package/docs/template-recipes.md +1 -1
- package/docs/tool-registry.md +3 -3
- package/index.ts +12 -19
- package/lib/async-runs.ts +124 -1016
- package/lib/command-templates.ts +3 -3
- package/lib/config.ts +7 -7
- package/lib/{output.ts → execution-output.ts} +3 -3
- package/lib/execution.ts +5 -1
- package/lib/{actor-inspector-tui.ts → inspector.ts} +4 -3
- package/lib/mailbox-loop.ts +3 -3
- package/lib/{actor-messages.ts → messages.ts} +3 -3
- package/lib/paths.ts +3 -3
- package/lib/{actor-recipe-context.ts → recipes-context.ts} +3 -2
- package/lib/{recipe-discovery.ts → recipes-discovery.ts} +30 -30
- package/lib/{recipe-usage.ts → recipes-usage.ts} +2 -2
- package/lib/registry.ts +37 -24
- package/lib/{actor-rooms.ts → rooms.ts} +4 -4
- package/lib/runs-artifacts.ts +96 -0
- package/lib/runs-control.ts +85 -0
- package/lib/runs-identity.ts +14 -0
- package/lib/runs-index.ts +156 -0
- package/lib/runs-mailbox.ts +208 -0
- package/lib/runs-messages.ts +252 -0
- package/lib/runs-outbox.ts +144 -0
- package/lib/runs-process.ts +51 -0
- package/lib/runs-retention.ts +77 -0
- package/lib/runs-start.ts +98 -0
- package/lib/runs-status.ts +78 -0
- package/lib/runtime.ts +6 -6
- package/lib/schema.ts +55 -0
- package/lib/tools-access.ts +68 -0
- package/lib/tools-inspect.ts +735 -0
- package/lib/tools-local.ts +234 -0
- package/lib/tools-mailbox.ts +56 -0
- package/lib/tools-message.ts +483 -0
- package/lib/tools-register.ts +64 -0
- package/lib/tools-response.ts +267 -0
- package/lib/tools-spawn.ts +240 -0
- package/lib/tools.ts +26 -2051
- package/package.json +1 -1
- package/recipes/utility-coordinator-lock-snapshot.json +1 -1
- package/scripts/actor-worker.mjs +186 -7
- package/scripts/async-runner.mjs +171 -8
- package/scripts/build-dist.mjs +1 -1
- package/scripts/conformance.mjs +34 -18
- package/scripts/coordinator.mjs +733 -11
- package/scripts/locker.mjs +345 -16
- package/scripts/recipe-utils.mjs +478 -14
- package/scripts/validate-recipe.mjs +110 -10
- package/skills/actors/SKILL.md +2 -2
- package/skills/swarm/SKILL.md +2 -2
- package/dist/lib/actor-worker.d.ts +0 -16
- package/dist/lib/actor-worker.js +0 -134
- package/dist/lib/async-runner.d.ts +0 -5
- package/dist/lib/async-runner.js +0 -134
- package/dist/lib/conformance.d.ts +0 -12
- package/dist/lib/conformance.js +0 -28
- package/dist/lib/coordinator.d.ts +0 -5
- package/dist/lib/coordinator.js +0 -660
- package/dist/lib/locker.d.ts +0 -5
- package/dist/lib/locker.js +0 -310
- package/dist/lib/recipe-utils.d.ts +0 -5
- package/dist/lib/recipe-utils.js +0 -385
- package/dist/lib/validate-recipe.d.ts +0 -6
- package/dist/lib/validate-recipe.js +0 -104
- package/lib/actor-worker.ts +0 -174
- package/lib/async-runner.ts +0 -173
- package/lib/conformance.ts +0 -46
- package/lib/coordinator.ts +0 -742
- package/lib/locker.ts +0 -340
- package/lib/recipe-utils.ts +0 -486
- package/lib/validate-recipe.ts +0 -110
- /package/dist/lib/{recipe-references.d.ts → recipes-references.d.ts} +0 -0
- /package/dist/lib/{recipe-references.js → recipes-references.js} +0 -0
- /package/dist/lib/{recipe-usage.d.ts → recipes-usage.d.ts} +0 -0
- /package/dist/lib/{recipe-usage.js → recipes-usage.js} +0 -0
- /package/lib/{recipe-references.ts → recipes-references.ts} +0 -0
package/dist/lib/actor-worker.js
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Canonical mailbox-backed actor worker entrypoint logic.
|
|
3
|
-
* Zones: worker demo, mailbox loop recipe runtime
|
|
4
|
-
*/
|
|
5
|
-
import { appendFileSync, mkdirSync, writeFileSync } from "node:fs";
|
|
6
|
-
import { join } from "node:path";
|
|
7
|
-
import { appendRoomMessage, ensureRoomMember, readBranchInboxMessages } from "./actor-rooms.js";
|
|
8
|
-
import { handleMailboxLoopOnce, isMailboxLoopStopMessage } from "./mailbox-loop.js";
|
|
9
|
-
export function parseActorWorkerArgs(argv) {
|
|
10
|
-
const args = {};
|
|
11
|
-
for (let index = 0; index < argv.length; index += 1) {
|
|
12
|
-
const token = argv[index];
|
|
13
|
-
if (!token.startsWith("--"))
|
|
14
|
-
continue;
|
|
15
|
-
const key = token.slice(2).replaceAll("-", "_");
|
|
16
|
-
const next = argv[index + 1];
|
|
17
|
-
if (!next || next.startsWith("--")) {
|
|
18
|
-
args[key] = true;
|
|
19
|
-
continue;
|
|
20
|
-
}
|
|
21
|
-
args[key] = next;
|
|
22
|
-
index += 1;
|
|
23
|
-
}
|
|
24
|
-
return args;
|
|
25
|
-
}
|
|
26
|
-
function sleep(ms) {
|
|
27
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
28
|
-
}
|
|
29
|
-
function text(value) {
|
|
30
|
-
return typeof value === "string" ? value : JSON.stringify(value);
|
|
31
|
-
}
|
|
32
|
-
function enabled(value) {
|
|
33
|
-
return value !== false && value !== "false" && value !== "0";
|
|
34
|
-
}
|
|
35
|
-
function safeName(value) {
|
|
36
|
-
return String(value ?? "unknown").replaceAll(/[^A-Za-z0-9_.-]+/g, "_");
|
|
37
|
-
}
|
|
38
|
-
export async function runActorWorker(argv = process.argv.slice(2)) {
|
|
39
|
-
const args = parseActorWorkerArgs(argv);
|
|
40
|
-
const stateDir = String(args.state_dir ?? "");
|
|
41
|
-
const run = String(args.run ?? "");
|
|
42
|
-
const branch = String(args.branch ?? "worker");
|
|
43
|
-
const pollMs = Math.max(50, Number(args.poll_ms ?? 1000));
|
|
44
|
-
const staleClaimMs = Math.max(0, Number(args.stale_claim_ms ?? 0));
|
|
45
|
-
const artifactDir = String(args.artifact_dir ?? join(stateDir, "worker-artifacts"));
|
|
46
|
-
const writeArtifacts = enabled(args.write_artifacts ?? true);
|
|
47
|
-
if (!stateDir || !run) {
|
|
48
|
-
throw new Error("usage: actor-worker.mjs --state-dir <dir> --run <id> [--branch worker] [--poll-ms 1000]");
|
|
49
|
-
}
|
|
50
|
-
const branchAddress = `branch:${run}/${branch}`;
|
|
51
|
-
const roomAddress = `room:${run}`;
|
|
52
|
-
const journalPath = join(stateDir, "worker-events.jsonl");
|
|
53
|
-
const statusPath = join(stateDir, "worker-status.json");
|
|
54
|
-
if (writeArtifacts)
|
|
55
|
-
mkdirSync(artifactDir, { recursive: true });
|
|
56
|
-
function journal(event, data = {}) {
|
|
57
|
-
appendFileSync(journalPath, `${JSON.stringify({ event, ts: new Date().toISOString(), ...data })}\n`);
|
|
58
|
-
}
|
|
59
|
-
function staleClaims() {
|
|
60
|
-
if (staleClaimMs <= 0)
|
|
61
|
-
return 0;
|
|
62
|
-
const cutoff = Date.now() - staleClaimMs;
|
|
63
|
-
return readBranchInboxMessages(stateDir, run, branchAddress).filter((record) => {
|
|
64
|
-
if (record.status !== "claimed" || !record.claimed_at)
|
|
65
|
-
return false;
|
|
66
|
-
const claimedAt = Date.parse(record.claimed_at);
|
|
67
|
-
return Number.isFinite(claimedAt) && claimedAt < cutoff;
|
|
68
|
-
}).length;
|
|
69
|
-
}
|
|
70
|
-
function status(state, data = {}) {
|
|
71
|
-
writeFileSync(statusPath, `${JSON.stringify({ artifact_dir: artifactDir, branch, run, stale_claims: staleClaims(), state, ts: new Date().toISOString(), ...data }, null, 2)}\n`);
|
|
72
|
-
}
|
|
73
|
-
function writeResultArtifact(id, result) {
|
|
74
|
-
if (!writeArtifacts)
|
|
75
|
-
return undefined;
|
|
76
|
-
const path = join(artifactDir, `${safeName(id)}.txt`);
|
|
77
|
-
writeFileSync(path, `${result}\n`);
|
|
78
|
-
return path;
|
|
79
|
-
}
|
|
80
|
-
function room(type, summary, body = {}) {
|
|
81
|
-
appendRoomMessage(stateDir, "main", {
|
|
82
|
-
body,
|
|
83
|
-
from: branchAddress,
|
|
84
|
-
summary,
|
|
85
|
-
to: roomAddress,
|
|
86
|
-
type,
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
ensureRoomMember(stateDir, run, "main", branchAddress, { display: branch, role: "worker", status: "present" }, `${branch} joined as mailbox worker`);
|
|
90
|
-
room("awaiting_assignment", `${branch} awaiting assignment`, { branch });
|
|
91
|
-
journal("worker.started", { artifact_dir: artifactDir, branch, run, stale_claim_ms: staleClaimMs });
|
|
92
|
-
status("awaiting_assignment", { handled: 0, stale_claim_ms: staleClaimMs });
|
|
93
|
-
let handled = 0;
|
|
94
|
-
let stopping = false;
|
|
95
|
-
while (!stopping) {
|
|
96
|
-
const result = await handleMailboxLoopOnce({ address: branchAddress, kind: "branch", run, stateDir }, (message) => {
|
|
97
|
-
if (isMailboxLoopStopMessage(message)) {
|
|
98
|
-
stopping = true;
|
|
99
|
-
room("actor.leave", `${branch} stopping`, { branch, reason: message.type });
|
|
100
|
-
journal("worker.stopping", { id: message.id, type: message.type });
|
|
101
|
-
status("stopping", { handled, reason: message.type });
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
room("task.claim", `${branch} claimed ${message.type}`, {
|
|
105
|
-
branch,
|
|
106
|
-
id: message.id,
|
|
107
|
-
type: message.type,
|
|
108
|
-
});
|
|
109
|
-
const result = text(message.body);
|
|
110
|
-
const artifact = writeResultArtifact(message.id, result);
|
|
111
|
-
handled += 1;
|
|
112
|
-
room("task.result", `${branch} handled ${message.type}`, {
|
|
113
|
-
artifact,
|
|
114
|
-
branch,
|
|
115
|
-
id: message.id,
|
|
116
|
-
result,
|
|
117
|
-
type: message.type,
|
|
118
|
-
});
|
|
119
|
-
room("awaiting_assignment", `${branch} awaiting assignment`, { branch });
|
|
120
|
-
journal("task.handled", { artifact, id: message.id, type: message.type });
|
|
121
|
-
status("awaiting_assignment", {
|
|
122
|
-
handled,
|
|
123
|
-
last_artifact: artifact,
|
|
124
|
-
last_id: message.id,
|
|
125
|
-
last_type: message.type,
|
|
126
|
-
stale_claim_ms: staleClaimMs,
|
|
127
|
-
});
|
|
128
|
-
}, { owner: branchAddress });
|
|
129
|
-
if (!result.handled)
|
|
130
|
-
await sleep(pollMs);
|
|
131
|
-
}
|
|
132
|
-
journal("worker.done", { branch, handled, run });
|
|
133
|
-
status("done", { handled });
|
|
134
|
-
}
|
package/dist/lib/async-runner.js
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Detached async-runner entrypoint logic.
|
|
3
|
-
* Zones: async run process, command-template execution telemetry
|
|
4
|
-
*/
|
|
5
|
-
import { appendFileSync, readFileSync } from "node:fs";
|
|
6
|
-
import { join } from "node:path";
|
|
7
|
-
import { appendRecipeContextToPiArgs } from "./actor-recipe-context.js";
|
|
8
|
-
import { execCommandTemplate } from "./command-templates.js";
|
|
9
|
-
import { executeRegisteredTool } from "./execution.js";
|
|
10
|
-
import { writeJsonAtomic } from "./file-state.js";
|
|
11
|
-
function quoteCommandDetailPart(value) {
|
|
12
|
-
if (value === "")
|
|
13
|
-
return "''";
|
|
14
|
-
if (/^[A-Za-z0-9_/:=.,@%+\-]+$/.test(value))
|
|
15
|
-
return value;
|
|
16
|
-
return `'${String(value).replaceAll("'", "'\\''")}'`;
|
|
17
|
-
}
|
|
18
|
-
function formatCommandDetail(command, args) {
|
|
19
|
-
return [command, ...args].map(quoteCommandDetailPart).join(" ");
|
|
20
|
-
}
|
|
21
|
-
function summarizeCommandDetail(commandDetail) {
|
|
22
|
-
return commandDetail.length > 160
|
|
23
|
-
? `${commandDetail.slice(0, 157)}...`
|
|
24
|
-
: commandDetail;
|
|
25
|
-
}
|
|
26
|
-
export async function runAsyncRunner(stateDir = process.argv[2]) {
|
|
27
|
-
if (!stateDir)
|
|
28
|
-
throw new Error("missing state dir");
|
|
29
|
-
const runPath = join(stateDir, "run.json");
|
|
30
|
-
const progressPath = join(stateDir, "progress.json");
|
|
31
|
-
const resultPath = join(stateDir, "result.json");
|
|
32
|
-
const eventsPath = join(stateDir, "events.jsonl");
|
|
33
|
-
const outboxPath = join(stateDir, "outbox.jsonl");
|
|
34
|
-
const stdoutPath = join(stateDir, "stdout.log");
|
|
35
|
-
const stderrPath = join(stateDir, "stderr.log");
|
|
36
|
-
const meta = JSON.parse(readFileSync(runPath, "utf8"));
|
|
37
|
-
function event(name, data = {}) {
|
|
38
|
-
appendFileSync(eventsPath, `${JSON.stringify({ event: name, ts: new Date().toISOString(), ...data })}\n`);
|
|
39
|
-
}
|
|
40
|
-
function outbox(name, summary, data = {}, delivery = "log", level = "info") {
|
|
41
|
-
appendFileSync(outboxPath, `${JSON.stringify({ body: data, data, delivery, event: name, from: `run:${meta.run}`, level, summary, to: "coordinator", ts: new Date().toISOString(), type: name })}\n`);
|
|
42
|
-
}
|
|
43
|
-
function progress(phase, extra = {}) {
|
|
44
|
-
writeJsonAtomic(progressPath, {
|
|
45
|
-
phase,
|
|
46
|
-
updatedAt: new Date().toISOString(),
|
|
47
|
-
...extra,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
let activeSubagents = 0;
|
|
51
|
-
let completedSubagents = 0;
|
|
52
|
-
const subagentFailures = [];
|
|
53
|
-
function getCommandDoneDelivery(result) {
|
|
54
|
-
return result.code !== 0 || activeSubagents > 0 ? "followup" : "log";
|
|
55
|
-
}
|
|
56
|
-
function progressRunning() {
|
|
57
|
-
progress("running", {
|
|
58
|
-
activeSubagents,
|
|
59
|
-
completed: completedSubagents,
|
|
60
|
-
failures: subagentFailures,
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
async function observedExec(command, args, options) {
|
|
64
|
-
const commandDetail = formatCommandDetail(command, args);
|
|
65
|
-
const execArgs = appendRecipeContextToPiArgs(command, args, meta.recipe_context_records, options?.actorRecipeContext);
|
|
66
|
-
activeSubagents += 1;
|
|
67
|
-
event("command.start", { activeSubagents, command: commandDetail });
|
|
68
|
-
progressRunning();
|
|
69
|
-
const result = await execCommandTemplate(command, execArgs, options);
|
|
70
|
-
activeSubagents = Math.max(0, activeSubagents - 1);
|
|
71
|
-
completedSubagents += 1;
|
|
72
|
-
if (result.code !== 0) {
|
|
73
|
-
subagentFailures.push({
|
|
74
|
-
code: result.code,
|
|
75
|
-
command: commandDetail,
|
|
76
|
-
killed: result.killed,
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
event("command.done", {
|
|
80
|
-
activeSubagents,
|
|
81
|
-
code: result.code,
|
|
82
|
-
command: commandDetail,
|
|
83
|
-
killed: result.killed,
|
|
84
|
-
});
|
|
85
|
-
outbox("command.done", `Command ${summarizeCommandDetail(commandDetail)} completed with code ${result.code}`, {
|
|
86
|
-
activeSubagents,
|
|
87
|
-
...(meta.artifacts ? { artifacts: meta.artifacts } : {}),
|
|
88
|
-
run_files: [stdoutPath, stderrPath, resultPath, eventsPath, outboxPath],
|
|
89
|
-
code: result.code,
|
|
90
|
-
command: commandDetail,
|
|
91
|
-
killed: result.killed,
|
|
92
|
-
}, getCommandDoneDelivery(result), result.code === 0 ? "info" : "error");
|
|
93
|
-
progressRunning();
|
|
94
|
-
return result;
|
|
95
|
-
}
|
|
96
|
-
try {
|
|
97
|
-
event("run.runner.start", { pid: process.pid });
|
|
98
|
-
progressRunning();
|
|
99
|
-
const result = await executeRegisteredTool({
|
|
100
|
-
name: "run_actor",
|
|
101
|
-
description: "Detached command-template run actor",
|
|
102
|
-
template: meta.template,
|
|
103
|
-
args: [],
|
|
104
|
-
defaults: {},
|
|
105
|
-
}, meta.values || {}, observedExec, meta.cwd);
|
|
106
|
-
const text = result.content?.[0]?.text || "";
|
|
107
|
-
appendFileSync(stdoutPath, text);
|
|
108
|
-
writeJsonAtomic(resultPath, {
|
|
109
|
-
code: result.details.code,
|
|
110
|
-
command: result.details.command,
|
|
111
|
-
killed: result.details.killed,
|
|
112
|
-
truncated: result.details.truncated,
|
|
113
|
-
completedAt: new Date().toISOString(),
|
|
114
|
-
});
|
|
115
|
-
progress("done", {
|
|
116
|
-
completed: 1,
|
|
117
|
-
failures: result.details.nonCriticalFailures || [],
|
|
118
|
-
});
|
|
119
|
-
event("run.done", { code: result.details.code });
|
|
120
|
-
}
|
|
121
|
-
catch (error) {
|
|
122
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
123
|
-
appendFileSync(stderrPath, `${message}\n`);
|
|
124
|
-
writeJsonAtomic(resultPath, {
|
|
125
|
-
code: 1,
|
|
126
|
-
error: message,
|
|
127
|
-
killed: false,
|
|
128
|
-
completedAt: new Date().toISOString(),
|
|
129
|
-
});
|
|
130
|
-
progress("failed", { completed: 0, failures: [{ message }] });
|
|
131
|
-
event("run.failed", { error: message });
|
|
132
|
-
throw error;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal conformance runner logic.
|
|
3
|
-
* Zones: CI/release validation, protocol regression suite selection
|
|
4
|
-
*/
|
|
5
|
-
export declare const conformanceSuites: string[];
|
|
6
|
-
export interface ConformanceReport {
|
|
7
|
-
code: number;
|
|
8
|
-
output: string;
|
|
9
|
-
summary: string;
|
|
10
|
-
suites: number;
|
|
11
|
-
}
|
|
12
|
-
export declare function runConformance(cwd?: URL): ConformanceReport;
|
package/dist/lib/conformance.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal conformance runner logic.
|
|
3
|
-
* Zones: CI/release validation, protocol regression suite selection
|
|
4
|
-
*/
|
|
5
|
-
import { spawnSync } from "node:child_process";
|
|
6
|
-
export const conformanceSuites = [
|
|
7
|
-
"tests/protocol-examples.test.ts",
|
|
8
|
-
"tests/recipe-discovery.test.ts",
|
|
9
|
-
"tests/registry.test.ts",
|
|
10
|
-
"tests/runtime-registry.test.ts",
|
|
11
|
-
"tests/async-runs.test.ts",
|
|
12
|
-
"tests/actor-rooms.test.ts",
|
|
13
|
-
"tests/tools.test.ts",
|
|
14
|
-
];
|
|
15
|
-
export function runConformance(cwd = new URL("..", import.meta.url)) {
|
|
16
|
-
const result = spawnSync(process.execPath, ["--experimental-strip-types", "--test", ...conformanceSuites], { cwd, encoding: "utf8", stdio: "pipe" });
|
|
17
|
-
const output = `${result.stdout ?? ""}${result.stderr ?? ""}`;
|
|
18
|
-
const summary = output
|
|
19
|
-
.split("\n")
|
|
20
|
-
.filter((line) => /^ℹ (tests|pass|fail|cancelled|skipped|todo|duration_ms) /.test(line))
|
|
21
|
-
.join("\n");
|
|
22
|
-
return {
|
|
23
|
-
code: result.status ?? 1,
|
|
24
|
-
output,
|
|
25
|
-
summary,
|
|
26
|
-
suites: conformanceSuites.length,
|
|
27
|
-
};
|
|
28
|
-
}
|