acpus 0.0.2 → 0.2.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 +6 -103
- package/dist/catalog.d.ts +27 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +186 -0
- package/dist/catalog.js.map +1 -0
- package/dist/follow.d.ts +23 -0
- package/dist/follow.d.ts.map +1 -0
- package/dist/follow.js +109 -0
- package/dist/follow.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +522 -0
- package/dist/index.js.map +1 -0
- package/dist/io.d.ts +4 -0
- package/dist/io.d.ts.map +1 -0
- package/dist/io.js +28 -0
- package/dist/io.js.map +1 -0
- package/dist/observations.d.ts +26 -0
- package/dist/observations.d.ts.map +1 -0
- package/dist/observations.js +60 -0
- package/dist/observations.js.map +1 -0
- package/dist/output.d.ts +9 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +51 -0
- package/dist/output.js.map +1 -0
- package/dist/runs-show.d.ts +5 -0
- package/dist/runs-show.d.ts.map +1 -0
- package/dist/runs-show.js +72 -0
- package/dist/runs-show.js.map +1 -0
- package/dist/supervisor-client.d.ts +9 -0
- package/dist/supervisor-client.d.ts.map +1 -0
- package/dist/supervisor-client.js +8 -0
- package/dist/supervisor-client.js.map +1 -0
- package/dist/supervisor.d.ts +18 -0
- package/dist/supervisor.d.ts.map +1 -0
- package/dist/supervisor.js +24 -0
- package/dist/supervisor.js.map +1 -0
- package/package.json +30 -44
- package/dist/cli.d.mts +0 -1
- package/dist/cli.mjs +0 -4017
- package/dist/index.d.mts +0 -2194
- package/dist/index.mjs +0 -243
- package/dist/monitor-app-CPlEcyHR.mjs +0 -369
- package/dist/monitor-rendering-LGr9Ebd_.mjs +0 -78
- package/dist/run-picker-app-utJ2f5CU.mjs +0 -104
- package/dist/run-workflow-DdIAC8Zu.mjs +0 -12922
- package/schemas/workflow-spec.schema.json +0 -2649
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observation formatting for the follow loop.
|
|
3
|
+
*
|
|
4
|
+
* Two modes:
|
|
5
|
+
* - Human-readable: compact glyph format with node key, state, duration
|
|
6
|
+
* - JSON: newline-delimited JSON (JSONL) observations
|
|
7
|
+
*/
|
|
8
|
+
const STATE_GLYPHS = {
|
|
9
|
+
pending: "○",
|
|
10
|
+
running: "⠋",
|
|
11
|
+
awaiting: "⏳",
|
|
12
|
+
completed: "✓",
|
|
13
|
+
failed: "◆",
|
|
14
|
+
paused: "⏸",
|
|
15
|
+
cancelled: "✗"
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Format an observation event for output.
|
|
19
|
+
*/
|
|
20
|
+
export function formatObservation(event, runName, json = false) {
|
|
21
|
+
if (json)
|
|
22
|
+
return JSON.stringify(event);
|
|
23
|
+
switch (event.type) {
|
|
24
|
+
case "run":
|
|
25
|
+
return formatRunObservation(event.runId, event.status, runName);
|
|
26
|
+
case "node":
|
|
27
|
+
return formatNodeObservation(event.nodeKey, event.state, event.duration, event.error);
|
|
28
|
+
case "summary":
|
|
29
|
+
return formatSummaryObservation(event.runId, event.status, runName);
|
|
30
|
+
default:
|
|
31
|
+
return JSON.stringify(event);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Format a terminal summary line.
|
|
36
|
+
*/
|
|
37
|
+
export function formatTerminalSummary(runId, status, runName, json = false) {
|
|
38
|
+
if (json) {
|
|
39
|
+
return JSON.stringify({ type: "summary", runId, status });
|
|
40
|
+
}
|
|
41
|
+
return formatSummaryObservation(runId, status, runName);
|
|
42
|
+
}
|
|
43
|
+
function formatRunObservation(runId, status, runName) {
|
|
44
|
+
const name = runName ? ` ${runName}` : "";
|
|
45
|
+
const glyph = status === "running" ? "▶" : "■";
|
|
46
|
+
return `${glyph} Run ${runId}${name} ${status}`;
|
|
47
|
+
}
|
|
48
|
+
function formatNodeObservation(nodeKey, state, duration, error) {
|
|
49
|
+
const glyph = STATE_GLYPHS[state] ?? "?";
|
|
50
|
+
const dur = duration !== undefined ? ` (${(duration / 1000).toFixed(1)}s)` : "";
|
|
51
|
+
const err = error ? ` ${error}` : "";
|
|
52
|
+
const suffix = state === "running" ? "..." : "";
|
|
53
|
+
return ` ${glyph} ${nodeKey} ${state}${suffix}${dur}${err}`;
|
|
54
|
+
}
|
|
55
|
+
function formatSummaryObservation(runId, status, runName) {
|
|
56
|
+
const name = runName ? ` ${runName}` : "";
|
|
57
|
+
const glyph = STATE_GLYPHS[status] ?? "■";
|
|
58
|
+
return `${glyph} Run ${runId}${name} ${status}`;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=observations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observations.js","sourceRoot":"","sources":["../src/observations.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAcH,MAAM,YAAY,GAA8B;IAC9C,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,GAAG;IACZ,QAAQ,EAAE,GAAG;IACb,SAAS,EAAE,GAAG;IACd,MAAM,EAAE,GAAG;IACX,MAAM,EAAE,GAAG;IACX,SAAS,EAAE,GAAG;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAuB,EAAE,OAAgB,EAAE,IAAI,GAAG,KAAK;IACvF,IAAI,IAAI;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAEvC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,KAAK,KAAK;YACR,OAAO,oBAAoB,CAAC,KAAK,CAAC,KAAM,EAAE,KAAK,CAAC,MAAO,EAAE,OAAO,CAAC,CAAC;QACpE,KAAK,MAAM;YACT,OAAO,qBAAqB,CAAC,KAAK,CAAC,OAAQ,EAAE,KAAK,CAAC,KAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAAC,C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AC,CAAC,CAAC,EAAE,CAAC;IACtC,MAAM,MAAM,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAChD,OAAO,KAAK,KAAK,IAAI,OAAO,KAAK,KAAK,GAAG,MAAM,GAAG,GAAG,GAAG,GAAG,EAAE,CAAC;AAChE,CAAC;AAED,SAAS,wBAAwB,CAAC,KAAa,EAAE,MAAiB,EAAE,OAAgB;IAClF,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1C,MAAM,KAAK,GAAG,YAAY,CAAC,MAAmB,CAAC,IAAI,GAAG,CAAC;IACvD,OAAO,GAAG,KAAK,QAAQ,KAAK,GAAG,IAAI,IAAI,MAAM,EAAE,CAAC;AAClD,CAAC"}
|
package/dist/output.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CompileResult, LintResult } from "@acpus/core";
|
|
2
|
+
export interface OutputOptions {
|
|
3
|
+
json?: boolean;
|
|
4
|
+
quiet?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function printLint(result: LintResult, options: OutputOptions): void;
|
|
7
|
+
export declare function printCompile(result: CompileResult, options: OutputOptions): void;
|
|
8
|
+
export declare function printError(message: string, options: OutputOptions): void;
|
|
9
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAc,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzE,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAY1E;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAoBhF;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAMxE"}
|
package/dist/output.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export function printLint(result, options) {
|
|
2
|
+
if (options.quiet) {
|
|
3
|
+
return;
|
|
4
|
+
}
|
|
5
|
+
if (options.json) {
|
|
6
|
+
writeJsonLine({ ok: result.ok, diagnostics: result.diagnostics });
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
printDiagnostics(result.diagnostics);
|
|
10
|
+
if (result.ok) {
|
|
11
|
+
console.log("acpus lint: ok");
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function printCompile(result, options) {
|
|
15
|
+
if (options.quiet) {
|
|
16
|
+
if (options.json) {
|
|
17
|
+
writeJsonLine({ ok: result.ok, diagnostics: result.diagnostics, ir: result.ir, schedule: result.schedule });
|
|
18
|
+
}
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (options.json) {
|
|
22
|
+
writeJsonLine({
|
|
23
|
+
ok: result.ok,
|
|
24
|
+
diagnostics: result.diagnostics,
|
|
25
|
+
ir: result.ir,
|
|
26
|
+
schedule: result.schedule
|
|
27
|
+
});
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
printDiagnostics(result.diagnostics);
|
|
31
|
+
if (result.ok) {
|
|
32
|
+
console.log(JSON.stringify(result.schedule, null, 2));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export function printError(message, options) {
|
|
36
|
+
if (options.json) {
|
|
37
|
+
writeJsonLine({ ok: false, diagnostics: [{ severity: "error", code: "CLI_ERROR", message, path: "$" }] });
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
console.error(message);
|
|
41
|
+
}
|
|
42
|
+
function printDiagnostics(diagnostics) {
|
|
43
|
+
for (const diagnostic of diagnostics) {
|
|
44
|
+
const target = diagnostic.severity === "error" ? console.error : console.warn;
|
|
45
|
+
target(`${diagnostic.severity.toUpperCase()} ${diagnostic.code} ${diagnostic.path}: ${diagnostic.message}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function writeJsonLine(value) {
|
|
49
|
+
console.log(JSON.stringify(value));
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,SAAS,CAAC,MAAkB,EAAE,OAAsB;IAClE,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO;IACT,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,aAAa,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;QAClE,OAAO;IACT,CAAC;IACD,gBAAgB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACrC,IAAI,MAAM,CAAC,EAAE,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAChC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAqB,EAAE,OAAsB;IACxE,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,aAAa,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC9G,CAAC;QACD,OAAO;IACT,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,EAAE,CA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AG,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RunState, RunSupervisorClient } from "@acpus/runtime";
|
|
2
|
+
type ArtifactPathResolver = Pick<RunSupervisorClient, "getArtifactPath">;
|
|
3
|
+
export declare function formatRunShow(run: RunState, client?: ArtifactPathResolver, nowMs?: number): Promise<string>;
|
|
4
|
+
export {};
|
|
5
|
+
//# sourceMappingURL=runs-show.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runs-show.d.ts","sourceRoot":"","sources":["../src/runs-show.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA8C,QAAQ,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEhH,KAAK,oBAAoB,GAAG,IAAI,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC;AAEzE,wBAAsB,aAAa,CACjC,GAAG,EAAE,QAAQ,EACb,MAAM,CAAC,EAAE,oBAAoB,EAC7B,KAAK,SAAa,GACjB,OAAO,CAAC,MAAM,CAAC,CAwBjB"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export async function formatRunShow(run, client, nowMs = Date.now()) {
|
|
2
|
+
const lines = [];
|
|
3
|
+
lines.push(`Run: ${run.runId}`);
|
|
4
|
+
lines.push(`Workflow: ${run.workflowName}`);
|
|
5
|
+
if (run.workflowRef)
|
|
6
|
+
lines.push(`Workflow Ref: ${run.workflowRef}`);
|
|
7
|
+
if (run.workflowSourcePath)
|
|
8
|
+
lines.push(`Workflow Source: ${run.workflowSourcePath}`);
|
|
9
|
+
if (run.lineage) {
|
|
10
|
+
lines.push(`Forked From: ${run.lineage.sourceRunId} (origin=${run.lineage.forkOriginNodeKey}, inherited=${run.lineage.inheritedNodeCount})`);
|
|
11
|
+
}
|
|
12
|
+
lines.push(`Status: ${run.status}`);
|
|
13
|
+
lines.push(`Created: ${run.createdAt}`);
|
|
14
|
+
lines.push(`Updated: ${run.updatedAt}`);
|
|
15
|
+
lines.push("");
|
|
16
|
+
lines.push("Nodes:");
|
|
17
|
+
for (const node of run.nodes ?? []) {
|
|
18
|
+
lines.push(` ${node.nodeKey} [${node.kind}] ${node.state} attempt=${node.attempt}`);
|
|
19
|
+
if (node.error)
|
|
20
|
+
lines.push(` Error: ${node.error}`);
|
|
21
|
+
if (node.artifactRefs?.length)
|
|
22
|
+
lines.push(` Artifacts: ${node.artifactRefs.join(", ")}`);
|
|
23
|
+
const activity = await summarizeRunningAgentActivity(run.runId, node, client, nowMs);
|
|
24
|
+
if (activity)
|
|
25
|
+
lines.push(` Activity: ${activity}`);
|
|
26
|
+
}
|
|
27
|
+
return lines.join("\n");
|
|
28
|
+
}
|
|
29
|
+
async function summarizeRunningAgentActivity(runId, node, client, nowMs) {
|
|
30
|
+
void runId;
|
|
31
|
+
void client;
|
|
32
|
+
if (node.kind !== "run.agent" || node.state !== "running")
|
|
33
|
+
return undefined;
|
|
34
|
+
const telemetry = node.agentTelemetry;
|
|
35
|
+
const attempt = telemetry?.attempts.find((item) => item.attempt === telemetry.currentAttempt)
|
|
36
|
+
?? telemetry?.attempts[telemetry.attempts.length - 1];
|
|
37
|
+
if (!attempt)
|
|
38
|
+
return undefined;
|
|
39
|
+
const parts = [`updated=${formatAge(nowMs - Date.parse(attempt.updatedAt))} ago`, `tool_calls=${attempt.tools.totalToolCallCount}`];
|
|
40
|
+
const recent = attempt.tools.recentCalls.slice(0, 3).map(formatToolName).filter(Boolean);
|
|
41
|
+
if (recent.length > 0)
|
|
42
|
+
parts.push(`recent=${recent.join(", ")}`);
|
|
43
|
+
if (attempt.tools.droppedToolCallCount > 0)
|
|
44
|
+
parts.push(`dropped=${attempt.tools.droppedToolCallCount}`);
|
|
45
|
+
if (attempt.context)
|
|
46
|
+
parts.push(`context=${formatContextUsage(attempt.context.used, attempt.context.size)}`);
|
|
47
|
+
return parts.join("; ");
|
|
48
|
+
}
|
|
49
|
+
function formatContextUsage(used, size) {
|
|
50
|
+
return `${formatContextNumber(used)}/${formatContextNumber(size)}`;
|
|
51
|
+
}
|
|
52
|
+
function formatContextNumber(value) {
|
|
53
|
+
return value < 1000 ? String(value) : `${Math.floor(value / 1000)}k`;
|
|
54
|
+
}
|
|
55
|
+
function formatToolName(tool) {
|
|
56
|
+
const raw = tool.title ?? tool.toolName ?? tool.kind ?? tool.toolCallId;
|
|
57
|
+
return raw.replace(/\s+/g, " ").trim();
|
|
58
|
+
}
|
|
59
|
+
function formatAge(deltaMs) {
|
|
60
|
+
const safeMs = Number.isFinite(deltaMs) ? Math.max(0, deltaMs) : 0;
|
|
61
|
+
const seconds = Math.floor(safeMs / 1000);
|
|
62
|
+
if (seconds < 60)
|
|
63
|
+
return `${seconds}s`;
|
|
64
|
+
const minutes = Math.floor(seconds / 60);
|
|
65
|
+
if (minutes < 60)
|
|
66
|
+
return `${minutes}m`;
|
|
67
|
+
const hours = Math.floor(minutes / 60);
|
|
68
|
+
if (hours < 48)
|
|
69
|
+
return `${hours}h`;
|
|
70
|
+
return `${Math.floor(hours / 24)}d`;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=runs-show.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runs-show.js","sourceRoot":"","sources":["../src/runs-show.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,GAAa,EACb,MAA6B,EAC7B,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE;IAElB,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;IAChC,KAAK,CAAC,IAAI,CAAC,aAAa,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC;IAC5C,IAAI,GAAG,CAAC,WAAW;QAAE,KAAK,CAAC,IAAI,CAAC,iBAAiB,GAAG,CAAC,WAAW,EAAE,CAA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O,GAAG,OAAO,GAAG,CAAC;IACvC,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACzC,IAAI,OAAO,GAAG,EAAE;QAAE,OAAO,GAAG,OAAO,GAAG,CAAC;IACvC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,CAAC;IACvC,IAAI,KAAK,GAAG,EAAE;QAAE,OAAO,GAAG,KAAK,GAAG,CAAC;IACnC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC,GAAG,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RunSupervisorClient — re-exported from @acpus/runtime.
|
|
3
|
+
*
|
|
4
|
+
* The implementation lives in the runtime package so the CLI and the TUI
|
|
5
|
+
* can share one client without a package cycle.
|
|
6
|
+
*/
|
|
7
|
+
export { RunSupervisorClient } from "@acpus/runtime";
|
|
8
|
+
export type { RunCleanResult, RunState, NodeExecutionState, RunSummary, ReplayResult, SupervisorMetadata, SupervisorHealth } from "@acpus/runtime";
|
|
9
|
+
//# sourceMappingURL=supervisor-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor-client.d.ts","sourceRoot":"","sources":["../src/supervisor-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,YAAY,EAAE,cAAc,EAAE,QAAQ,EAAE,kBAAkB,EAAE,UAAU,EAAE,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RunSupervisorClient — re-exported from @acpus/runtime.
|
|
3
|
+
*
|
|
4
|
+
* The implementation lives in the runtime package so the CLI and the TUI
|
|
5
|
+
* can share one client without a package cycle.
|
|
6
|
+
*/
|
|
7
|
+
export { RunSupervisorClient } from "@acpus/runtime";
|
|
8
|
+
//# sourceMappingURL=supervisor-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor-client.js","sourceRoot":"","sources":["../src/supervisor-client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI helper: ensure a workspace supervisor is running and return a client.
|
|
3
|
+
*
|
|
4
|
+
* All Run-facing CLI commands call `ensureSupervisor()` to lazily start
|
|
5
|
+
* the supervisor and construct an `RunSupervisorClient`.
|
|
6
|
+
*/
|
|
7
|
+
import { RunSupervisorClient } from "@acpus/runtime";
|
|
8
|
+
export declare const EXIT_SUPERVISOR_ERROR = 40;
|
|
9
|
+
/**
|
|
10
|
+
* Ensure a Run Supervisor is running for the current workspace and
|
|
11
|
+
* return a connected client. Maps discovery errors to exit code 40.
|
|
12
|
+
*/
|
|
13
|
+
export declare function ensureSupervisor(): Promise<RunSupervisorClient>;
|
|
14
|
+
/**
|
|
15
|
+
* Check if an error is a supervisor connection error.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isSupervisorConnectionError(error: unknown): boolean;
|
|
18
|
+
//# sourceMappingURL=supervisor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor.d.ts","sourceRoot":"","sources":["../src/supervisor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA6B,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEhF,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC;;;GAGG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAGrE;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAGnE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI helper: ensure a workspace supervisor is running and return a client.
|
|
3
|
+
*
|
|
4
|
+
* All Run-facing CLI commands call `ensureSupervisor()` to lazily start
|
|
5
|
+
* the supervisor and construct an `RunSupervisorClient`.
|
|
6
|
+
*/
|
|
7
|
+
import { ensureWorkspaceSupervisor, RunSupervisorClient } from "@acpus/runtime";
|
|
8
|
+
export const EXIT_SUPERVISOR_ERROR = 40;
|
|
9
|
+
/**
|
|
10
|
+
* Ensure a Run Supervisor is running for the current workspace and
|
|
11
|
+
* return a connected client. Maps discovery errors to exit code 40.
|
|
12
|
+
*/
|
|
13
|
+
export async function ensureSupervisor() {
|
|
14
|
+
const metadata = await ensureWorkspaceSupervisor(process.cwd());
|
|
15
|
+
return new RunSupervisorClient(metadata.endpoint);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Check if an error is a supervisor connection error.
|
|
19
|
+
*/
|
|
20
|
+
export function isSupervisorConnectionError(error) {
|
|
21
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
22
|
+
return /ECONNREFUSED|fetch failed|connect|supervisor|ENOENT|spawn|timed out|failed to start/i.test(msg);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=supervisor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor.js","sourceRoot":"","sources":["../src/supervisor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAEhF,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAExC;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB;IACpC,MAAM,QAAQ,GAAG,MAAM,yBAAyB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAChE,OAAO,IAAI,mBAAmB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B,CAAC,KAAc;IACxD,MAAM,GAAG,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACnE,OAAO,sFAAsF,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1G,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,76 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "acpus",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"
|
|
5
|
-
"description": "Runtime-driven workflow orchestrator for ACP agents",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Local durable workflow runner for ACP agents",
|
|
6
5
|
"keywords": [
|
|
6
|
+
"acp",
|
|
7
7
|
"acpx",
|
|
8
|
+
"agent",
|
|
8
9
|
"workflow",
|
|
9
10
|
"orchestrator",
|
|
10
|
-
"agent",
|
|
11
11
|
"cli"
|
|
12
12
|
],
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"author": "kkkyran",
|
|
15
|
+
"homepage": "https://github.com/kelvinschen/acpus#readme",
|
|
15
16
|
"repository": {
|
|
16
17
|
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/kelvinschen/acpus.git"
|
|
18
|
+
"url": "git+https://github.com/kelvinschen/acpus.git",
|
|
19
|
+
"directory": "packages/cli"
|
|
18
20
|
},
|
|
19
|
-
"homepage": "https://github.com/kelvinschen/acpus#readme",
|
|
20
21
|
"bugs": {
|
|
21
22
|
"url": "https://github.com/kelvinschen/acpus/issues"
|
|
22
23
|
},
|
|
23
24
|
"type": "module",
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=22"
|
|
27
|
+
},
|
|
24
28
|
"bin": {
|
|
25
|
-
"acpus": "dist/
|
|
29
|
+
"acpus": "./dist/index.js"
|
|
26
30
|
},
|
|
27
|
-
"main": "dist/index.mjs",
|
|
28
|
-
"types": "dist/index.d.mts",
|
|
29
31
|
"exports": {
|
|
30
32
|
".": {
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"default": "./dist/index.js"
|
|
33
35
|
}
|
|
34
36
|
},
|
|
37
|
+
"main": "./dist/index.js",
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
35
39
|
"files": [
|
|
36
40
|
"dist",
|
|
37
|
-
"
|
|
38
|
-
"LICENSE"
|
|
39
|
-
"README.md"
|
|
41
|
+
"README.md",
|
|
42
|
+
"LICENSE"
|
|
40
43
|
],
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
},
|
|
44
|
-
"scripts": {
|
|
45
|
-
"build": "tsdown",
|
|
46
|
-
"typecheck": "tsc --noEmit",
|
|
47
|
-
"test": "vitest run",
|
|
48
|
-
"test:unit": "vitest run test/unit",
|
|
49
|
-
"test:integration": "vitest run test/integration",
|
|
50
|
-
"test:e2e:fake": "vitest run test/e2e/fake",
|
|
51
|
-
"test:e2e:real": "RUN_REAL_ACPX_E2E=1 vitest run test/e2e/real",
|
|
52
|
-
"generate:schema": "tsx src/schema/generate-json-schema.ts",
|
|
53
|
-
"validate": "npm run typecheck && npm run test && npm run generate:schema && npm run build"
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
54
46
|
},
|
|
55
47
|
"dependencies": {
|
|
56
|
-
"
|
|
57
|
-
"commander": "^14.0.3",
|
|
58
|
-
"execa": "^9.6.1",
|
|
59
|
-
"fast-glob": "^3.3.3",
|
|
60
|
-
"ink": "^7.0.5",
|
|
61
|
-
"kleur": "^4.1.5",
|
|
62
|
-
"proper-lockfile": "^4.1.2",
|
|
63
|
-
"react": "^19.2.7",
|
|
48
|
+
"commander": "^15.0.0",
|
|
64
49
|
"yaml": "^2.9.0",
|
|
65
|
-
"
|
|
50
|
+
"@acpus/runtime": "0.2.0",
|
|
51
|
+
"@acpus/core": "0.2.0",
|
|
52
|
+
"@acpus/tui": "0.2.0"
|
|
66
53
|
},
|
|
67
54
|
"devDependencies": {
|
|
68
|
-
"@types/node": "^
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"vitest": "^4.1.7"
|
|
55
|
+
"@types/node": "^22.15.30"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "tsc -p tsconfig.json && node -e \"require('node:fs').chmodSync('dist/index.js', 0o755)\"",
|
|
59
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
60
|
+
"clean": "rm -rf dist"
|
|
75
61
|
}
|
|
76
|
-
}
|
|
62
|
+
}
|
package/dist/cli.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { };
|