@acpus/runtime 0.1.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.
Files changed (79) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +7 -0
  3. package/dist/artifacts.d.ts +30 -0
  4. package/dist/artifacts.d.ts.map +1 -0
  5. package/dist/artifacts.js +97 -0
  6. package/dist/artifacts.js.map +1 -0
  7. package/dist/client.d.ts +54 -0
  8. package/dist/client.d.ts.map +1 -0
  9. package/dist/client.js +159 -0
  10. package/dist/client.js.map +1 -0
  11. package/dist/evaluator.d.ts +37 -0
  12. package/dist/evaluator.d.ts.map +1 -0
  13. package/dist/evaluator.js +101 -0
  14. package/dist/evaluator.js.map +1 -0
  15. package/dist/executors/agent.d.ts +74 -0
  16. package/dist/executors/agent.d.ts.map +1 -0
  17. package/dist/executors/agent.js +401 -0
  18. package/dist/executors/agent.js.map +1 -0
  19. package/dist/executors/mock-program.d.ts +24 -0
  20. package/dist/executors/mock-program.d.ts.map +1 -0
  21. package/dist/executors/mock-program.js +79 -0
  22. package/dist/executors/mock-program.js.map +1 -0
  23. package/dist/executors/program.d.ts +21 -0
  24. package/dist/executors/program.d.ts.map +1 -0
  25. package/dist/executors/program.js +178 -0
  26. package/dist/executors/program.js.map +1 -0
  27. package/dist/executors/types.d.ts +26 -0
  28. package/dist/executors/types.d.ts.map +1 -0
  29. package/dist/executors/types.js +2 -0
  30. package/dist/executors/types.js.map +1 -0
  31. package/dist/index.d.ts +18 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +25 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/interpreter.d.ts +186 -0
  36. package/dist/interpreter.d.ts.map +1 -0
  37. package/dist/interpreter.js +1500 -0
  38. package/dist/interpreter.js.map +1 -0
  39. package/dist/keys.d.ts +36 -0
  40. package/dist/keys.d.ts.map +1 -0
  41. package/dist/keys.js +59 -0
  42. package/dist/keys.js.map +1 -0
  43. package/dist/state-machine.d.ts +27 -0
  44. package/dist/state-machine.d.ts.map +1 -0
  45. package/dist/state-machine.js +87 -0
  46. package/dist/state-machine.js.map +1 -0
  47. package/dist/store.d.ts +46 -0
  48. package/dist/store.d.ts.map +1 -0
  49. package/dist/store.js +260 -0
  50. package/dist/store.js.map +1 -0
  51. package/dist/supervisor-app.d.ts +27 -0
  52. package/dist/supervisor-app.d.ts.map +1 -0
  53. package/dist/supervisor-app.js +548 -0
  54. package/dist/supervisor-app.js.map +1 -0
  55. package/dist/supervisor-discovery.d.ts +17 -0
  56. package/dist/supervisor-discovery.d.ts.map +1 -0
  57. package/dist/supervisor-discovery.js +186 -0
  58. package/dist/supervisor-discovery.js.map +1 -0
  59. package/dist/supervisor-entry.d.ts +11 -0
  60. package/dist/supervisor-entry.d.ts.map +1 -0
  61. package/dist/supervisor-entry.js +50 -0
  62. package/dist/supervisor-entry.js.map +1 -0
  63. package/dist/supervisor-lock.d.ts +26 -0
  64. package/dist/supervisor-lock.d.ts.map +1 -0
  65. package/dist/supervisor-lock.js +49 -0
  66. package/dist/supervisor-lock.js.map +1 -0
  67. package/dist/supervisor-runner.d.ts +11 -0
  68. package/dist/supervisor-runner.d.ts.map +1 -0
  69. package/dist/supervisor-runner.js +128 -0
  70. package/dist/supervisor-runner.js.map +1 -0
  71. package/dist/types.d.ts +230 -0
  72. package/dist/types.d.ts.map +1 -0
  73. package/dist/types.js +2 -0
  74. package/dist/types.js.map +1 -0
  75. package/dist/validate-input.d.ts +27 -0
  76. package/dist/validate-input.d.ts.map +1 -0
  77. package/dist/validate-input.js +56 -0
  78. package/dist/validate-input.js.map +1 -0
  79. package/package.json +66 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 kkkyran
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # @acpus/runtime
2
+
3
+ `@acpus/runtime` contains the local durable execution engine for Acpus: the interpreter, Run Supervisor, state store, executors, artifacts, replay, and Run controls.
4
+
5
+ Most users should install the `acpus` CLI package.
6
+
7
+ See the repository README for full usage: https://github.com/kelvinschen/acpus
@@ -0,0 +1,30 @@
1
+ import type { ArtifactRef } from "./types.js";
2
+ /**
3
+ * Local filesystem artifact store under .acpus/state/runs/<run_id>/artifacts/.
4
+ * Artifact URIs follow the format: artifact://runs/<runId>/nodes/<nodeKey>/<filename>
5
+ */
6
+ export declare class ArtifactStore {
7
+ private readonly baseDir;
8
+ constructor(baseDir?: string);
9
+ /**
10
+ * Write an artifact file. Uses atomic write (temp + rename) for crash safety.
11
+ * Returns the ArtifactRef for the written file.
12
+ */
13
+ write(runId: string, nodeKey: string, filename: string, content: string | Buffer): ArtifactRef;
14
+ /**
15
+ * Create or truncate an artifact file and return its reference.
16
+ * Used for artifacts that will be appended while an execution is still live.
17
+ */
18
+ create(runId: string, nodeKey: string, filename: string): ArtifactRef;
19
+ /** Append content to an existing artifact, creating it if needed. */
20
+ append(runId: string, nodeKey: string, filename: string, content: string | Buffer): ArtifactRef;
21
+ /** Read an artifact file content. */
22
+ read(runId: string, nodeKey: string, filename: string): Buffer;
23
+ /** List all artifact refs for a node. */
24
+ list(runId: string, nodeKey: string): ArtifactRef[];
25
+ /** Parse an artifact URI into its components. */
26
+ parseArtifactRef(uri: string): ArtifactRef;
27
+ private nodeDir;
28
+ private makeRef;
29
+ }
30
+ //# sourceMappingURL=artifacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../src/artifacts.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,OAAO,CAAC,EAAE,MAAM;IAI5B;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW;IAa9F;;;OAGG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,WAAW;IAQrE,qEAAqE;IACrE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,WAAW;IAQ/F,qCAAqC;IACrC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAM9D,yCAAyC;IACzC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,EAAE;IASnD,iDAAiD;IACjD,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW;IAqB1C,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,OAAO;CAKhB"}
@@ -0,0 +1,97 @@
1
+ import { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { encodeNodeKeyForDir } from "./keys.js";
4
+ /**
5
+ * Local filesystem artifact store under .acpus/state/runs/<run_id>/artifacts/.
6
+ * Artifact URIs follow the format: artifact://runs/<runId>/nodes/<nodeKey>/<filename>
7
+ */
8
+ export class ArtifactStore {
9
+ baseDir;
10
+ constructor(baseDir) {
11
+ this.baseDir = baseDir ?? join(process.cwd(), ".acpus", "state", "runs");
12
+ }
13
+ /**
14
+ * Write an artifact file. Uses atomic write (temp + rename) for crash safety.
15
+ * Returns the ArtifactRef for the written file.
16
+ */
17
+ write(runId, nodeKey, filename, content) {
18
+ validateArtifactFilename(filename);
19
+ const dir = this.nodeDir(runId, nodeKey);
20
+ mkdirSync(dir, { recursive: true });
21
+ const filePath = join(dir, filename);
22
+ const tmpPath = filePath + ".tmp";
23
+ writeFileSync(tmpPath, content);
24
+ renameSync(tmpPath, filePath);
25
+ return this.makeRef(runId, nodeKey, filename);
26
+ }
27
+ /**
28
+ * Create or truncate an artifact file and return its reference.
29
+ * Used for artifacts that will be appended while an execution is still live.
30
+ */
31
+ create(runId, nodeKey, filename) {
32
+ validateArtifactFilename(filename);
33
+ const dir = this.nodeDir(runId, nodeKey);
34
+ mkdirSync(dir, { recursive: true });
35
+ writeFileSync(join(dir, filename), "");
36
+ return this.makeRef(runId, nodeKey, filename);
37
+ }
38
+ /** Append content to an existing artifact, creating it if needed. */
39
+ append(runId, nodeKey, filename, content) {
40
+ validateArtifactFilename(filename);
41
+ const dir = this.nodeDir(runId, nodeKey);
42
+ mkdirSync(dir, { recursive: true });
43
+ appendFileSync(join(dir, filename), content);
44
+ return this.makeRef(runId, nodeKey, filename);
45
+ }
46
+ /** Read an artifact file content. */
47
+ read(runId, nodeKey, filename) {
48
+ validateArtifactFilename(filename);
49
+ const filePath = join(this.nodeDir(runId, nodeKey), filename);
50
+ return readFileSync(filePath);
51
+ }
52
+ /** List all artifact refs for a node. */
53
+ list(runId, nodeKey) {
54
+ const dir = this.nodeDir(runId, nodeKey);
55
+ if (!existsSync(dir))
56
+ return [];
57
+ return readdirSync(dir)
58
+ .filter((f) => !f.endsWith(".tmp"))
59
+ .map((filename) => this.makeRef(runId, nodeKey, filename));
60
+ }
61
+ /** Parse an artifact URI into its components. */
62
+ parseArtifactRef(uri) {
63
+ const prefix = "artifact://runs/";
64
+ if (!uri.startsWith(prefix)) {
65
+ throw new Error(`Invalid artifact URI: ${uri}`);
66
+ }
67
+ const rest = uri.slice(prefix.length);
68
+ // Format: <runId>/nodes/<nodeKey>/<filename>
69
+ // nodeKey may contain : but not /
70
+ const parts = rest.split("/");
71
+ if (parts.length < 4 || parts[1] !== "nodes") {
72
+ throw new Error(`Invalid artifact URI format: ${uri}`);
73
+ }
74
+ const runId = parts[0];
75
+ // Everything between "nodes/" and the last segment is the nodeKey
76
+ const filename = parts[parts.length - 1];
77
+ const nodeKey = parts.slice(2, parts.length - 1).join("/");
78
+ return { uri, runId, nodeKey, filename };
79
+ }
80
+ // ─── Internal helpers ──────────────────────────────────────────
81
+ nodeDir(runId, nodeKey) {
82
+ const safeKey = encodeNodeKeyForDir(nodeKey);
83
+ return join(this.baseDir, runId, "artifacts", safeKey);
84
+ }
85
+ makeRef(runId, nodeKey, filename) {
86
+ const safeKey = encodeNodeKeyForDir(nodeKey);
87
+ const uri = `artifact://runs/${runId}/nodes/${safeKey}/${filename}`;
88
+ return { uri, runId, nodeKey, filename };
89
+ }
90
+ }
91
+ /** Validate that an artifact filename has no path traversal or separator characters. */
92
+ function validateArtifactFilename(filename) {
93
+ if (filename.includes("/") || filename.includes("\\") || filename.includes("..")) {
94
+ throw new Error(`Invalid artifact filename: ${filename}`);
95
+ }
96
+ }
97
+ //# sourceMappingURL=artifacts.js.map
@@ -0,0 +1 @@
1
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O,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAEO,OAAO,CAAC,KAAa,EAAE,OAAe,EAAE,QAAgB;QAC9D,MAAM,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAC7C,MAAM,GAAG,GAAG,mBAAmB,KAAK,UAAU,OAAO,IAAI,QAAQ,EAAE,CAAC;QACpE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IAC3C,CAAC;CACF;AAED,wFAAwF;AACxF,SAAS,wBAAwB,CAAC,QAAgB;IAChD,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACjF,MAAM,IAAI,KAAK,CAAC,8BAA8B,QAAQ,EAAE,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * RunSupervisorClient — thin HTTP client for the acpus Run Supervisor.
3
+ *
4
+ * Lives in @acpus/runtime so both the CLI and the TUI can share one client
5
+ * without a package cycle.
6
+ *
7
+ * Node keys are passed as ?key= query parameters since they contain "/"
8
+ * characters that are incompatible with URL path segments.
9
+ */
10
+ import type { AcpusIr } from "@acpus/core";
11
+ import type { RunCleanResult, RunState, NodeExecutionState, RunSummary, ReplayResult, SupervisorHealth } from "./types.js";
12
+ export declare class RunSupervisorClient {
13
+ private readonly baseUrl;
14
+ /** Client identity for lease tracking on the supervisor. */
15
+ readonly clientId: string;
16
+ /** When set, includes x-acpus-client-kind header to pin the supervisor alive. */
17
+ clientKind?: "follow" | "visualize";
18
+ constructor(baseUrl: string);
19
+ private headers;
20
+ health(): Promise<SupervisorHealth>;
21
+ startRun(spec: string, input?: Record<string, unknown>, sourcePath?: string, workflowRef?: string): Promise<RunState>;
22
+ listRuns(): Promise<RunSummary[]>;
23
+ cleanRuns(options?: {
24
+ dryRun?: boolean;
25
+ }): Promise<RunCleanResult>;
26
+ getRun(runId: string): Promise<RunState>;
27
+ getIr(runId: string): Promise<AcpusIr>;
28
+ /** Resolve an artifact:// URI to its absolute filesystem path on the supervisor host. */
29
+ getArtifactPath(runId: string, uri: string): Promise<string>;
30
+ getNodeStates(runId: string): Promise<NodeExecutionState[]>;
31
+ getNode(runId: string, nodeKey: string): Promise<NodeExecutionState>;
32
+ retryNode(runId: string, nodeKey: string): Promise<NodeExecutionState>;
33
+ /**
34
+ * Deliver a human-in-the-loop approval decision to an Approval Gate that is
35
+ * currently `awaiting`. Node-level only. On a non-2xx response the
36
+ * supervisor's error message (e.g. 409 "not awaiting") is surfaced.
37
+ */
38
+ signalApproval(runId: string, nodeKey: string, approved: boolean): Promise<NodeExecutionState>;
39
+ pauseRun(runId: string): Promise<RunState>;
40
+ resumeRun(runId: string): Promise<RunState>;
41
+ cancelRun(runId: string): Promise<RunState>;
42
+ retryRun(runId: string): Promise<RunState>;
43
+ getOutput(runId: string): Promise<{
44
+ status: string;
45
+ output: Record<string, unknown>;
46
+ }>;
47
+ replay(runId: string): Promise<ReplayResult>;
48
+ /**
49
+ * Issue a Run-level control action. No ?key= parameter — the action applies
50
+ * to the entire Run.
51
+ */
52
+ private controlRun;
53
+ }
54
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,kBAAkB,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG3H,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,Q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F,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI1C,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI3C,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI3C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAI1C,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;IAMtF,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAMlD;;;OAGG;YACW,UAAU;CAczB"}
package/dist/client.js ADDED
@@ -0,0 +1,159 @@
1
+ /**
2
+ * RunSupervisorClient — thin HTTP client for the acpus Run Supervisor.
3
+ *
4
+ * Lives in @acpus/runtime so both the CLI and the TUI can share one client
5
+ * without a package cycle.
6
+ *
7
+ * Node keys are passed as ?key= query parameters since they contain "/"
8
+ * characters that are incompatible with URL path segments.
9
+ */
10
+ import { randomUUID } from "node:crypto";
11
+ export class RunSupervisorClient {
12
+ baseUrl;
13
+ /** Client identity for lease tracking on the supervisor. */
14
+ clientId;
15
+ /** When set, includes x-acpus-client-kind header to pin the supervisor alive. */
16
+ clientKind;
17
+ constructor(baseUrl) {
18
+ this.baseUrl = baseUrl;
19
+ this.clientId = randomUUID();
20
+ }
21
+ headers() {
22
+ const h = {
23
+ "x-acpus-client-id": this.clientId
24
+ };
25
+ if (this.clientKind) {
26
+ h["x-acpus-client-kind"] = this.clientKind;
27
+ }
28
+ return h;
29
+ }
30
+ async health() {
31
+ const res = await fetch(`${this.baseUrl}/health`, { headers: this.headers() });
32
+ if (!res.ok)
33
+ throw new Error(`Health check failed: ${res.status}`);
34
+ return res.json();
35
+ }
36
+ async startRun(spec, input, sourcePath, workflowRef) {
37
+ const res = await fetch(`${this.baseUrl}/runs`, {
38
+ method: "POST",
39
+ headers: { "Content-Type": "application/json", ...this.headers() },
40
+ body: JSON.stringify({ spec, input, sourcePath, workflowRef })
41
+ });
42
+ if (!res.ok) {
43
+ const body = await res.json().catch(() => ({}));
44
+ throw new Error(`Failed to start run: ${res.status} ${JSON.stringify(body)}`);
45
+ }
46
+ return res.json();
47
+ }
48
+ async listRuns() {
49
+ const res = await fetch(`${this.baseUrl}/runs`, { headers: this.headers() });
50
+ if (!res.ok)
51
+ throw new Error(`Failed to list runs: ${res.status}`);
52
+ return res.json();
53
+ }
54
+ async cleanRuns(options = {}) {
55
+ const res = await fetch(`${this.baseUrl}/runs/clean`, {
56
+ method: "POST",
57
+ headers: { "Content-Type": "application/json", ...this.headers() },
58
+ body: JSON.stringify({ dryRun: Boolean(options.dryRun) })
59
+ });
60
+ if (!res.ok)
61
+ throw new Error(`Failed to clean runs: ${res.status}`);
62
+ return res.json();
63
+ }
64
+ async getRun(runId) {
65
+ const res = await fetch(`${this.baseUrl}/runs/${runId}`, { headers: this.headers() });
66
+ if (!res.ok)
67
+ throw new Error(`Run not found: ${runId}`);
68
+ return res.json();
69
+ }
70
+ async getIr(runId) {
71
+ const res = await fetch(`${this.baseUrl}/runs/${runId}/ir`, { headers: this.headers() });
72
+ if (!res.ok)
73
+ throw new Error(`IR not found: ${runId}`);
74
+ return res.json();
75
+ }
76
+ /** Resolve an artifact:// URI to its absolute filesystem path on the supervisor host. */
77
+ async getArtifactPath(runId, uri) {
78
+ const res = await fetch(`${this.baseUrl}/runs/${runId}/artifact-path?uri=${encodeURIComponent(uri)}`, { headers: this.headers() });
79
+ if (!res.ok)
80
+ throw new Error(`Failed to resolve artifact path: ${res.status}`);
81
+ const body = (await res.json());
82
+ return body.absPath;
83
+ }
84
+ async getNodeStates(runId) {
85
+ const res = await fetch(`${this.baseUrl}/runs/${runId}/nodes`, { headers: this.headers() });
86
+ if (!res.ok)
87
+ throw new Error(`Failed to get node states: ${res.status}`);
88
+ return res.json();
89
+ }
90
+ async getNode(runId, nodeKey) {
91
+ const res = await fetch(`${this.baseUrl}/runs/${runId}/node?key=${encodeURIComponent(nodeKey)}`, { headers: this.headers() });
92
+ if (!res.ok)
93
+ throw new Error(`Node not found: ${nodeKey}`);
94
+ return res.json();
95
+ }
96
+ async retryNode(runId, nodeKey) {
97
+ const res = await fetch(`${this.baseUrl}/runs/${runId}/retry?key=${encodeURIComponent(nodeKey)}`, { method: "POST", headers: this.headers() });
98
+ if (!res.ok) {
99
+ const body = (await res.json().catch(() => ({})));
100
+ throw new Error(body.error ?? `Failed to retry node: ${res.status}`);
101
+ }
102
+ return res.json();
103
+ }
104
+ /**
105
+ * Deliver a human-in-the-loop approval decision to an Approval Gate that is
106
+ * currently `awaiting`. Node-level only. On a non-2xx response the
107
+ * supervisor's error message (e.g. 409 "not awaiting") is surfaced.
108
+ */
109
+ async signalApproval(runId, nodeKey, approved) {
110
+ const res = await fetch(`${this.baseUrl}/runs/${runId}/signal?key=${encodeURIComponent(nodeKey)}`, {
111
+ method: "POST",
112
+ headers: { "Content-Type": "application/json", ...this.headers() },
113
+ body: JSON.stringify({ kind: "approval", approved })
114
+ });
115
+ if (!res.ok) {
116
+ const body = (await res.json().catch(() => ({})));
117
+ throw new Error(body.error ?? `Failed to signal approval: ${res.status}`);
118
+ }
119
+ return res.json();
120
+ }
121
+ // ─── Run-level controls ────────────────────────────────────────
122
+ async pauseRun(runId) {
123
+ return this.controlRun(runId, "pause");
124
+ }
125
+ async resumeRun(runId) {
126
+ return this.controlRun(runId, "resume");
127
+ }
128
+ async cancelRun(runId) {
129
+ return this.controlRun(runId, "cancel");
130
+ }
131
+ async retryRun(runId) {
132
+ return this.controlRun(runId, "retry");
133
+ }
134
+ async getOutput(runId) {
135
+ const res = await fetch(`${this.baseUrl}/runs/${runId}/output`, { headers: this.headers() });
136
+ if (!res.ok)
137
+ throw new Error(`Failed to get output: ${res.status}`);
138
+ return res.json();
139
+ }
140
+ async replay(runId) {
141
+ const res = await fetch(`${this.baseUrl}/runs/${runId}/replay`, { method: "POST", headers: this.headers() });
142
+ if (!res.ok)
143
+ throw new Error(`Failed to replay run: ${res.status}`);
144
+ return res.json();
145
+ }
146
+ /**
147
+ * Issue a Run-level control action. No ?key= parameter — the action applies
148
+ * to the entire Run.
149
+ */
150
+ async controlRun(runId, action) {
151
+ const res = await fetch(`${this.baseUrl}/runs/${runId}/${action}`, { method: "POST", headers: this.headers() });
152
+ if (!res.ok) {
153
+ const body = (await res.json().catch(() => ({})));
154
+ throw new Error(body.error ?? `Failed to ${action} run: ${res.status}`);
155
+ }
156
+ return res.json();
157
+ }
158
+ }
159
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,OAAO,mBAAmB;IACb,OAAO,CAAS;IACjC,4DAA4D;IACnD,QAAQ,CAAS;IAC1B,iFAAiF;IACjF,UAAU,CAA0B;IAEpC,YAAY,OAAe;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,UAAU,EAAE,CAAC;IAC/B,CAAC;IAEO,OAAO;QACb,MAAM,CAAC,GAA2B;YAChC,mBAAmB,EAAE,IAAI,CAAC,QAAQ;SACnC,CAAC;QACF,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACpB,CAAC,CAAC,qBAAqB,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC;QAC7C,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IAED,KAAK,CAAC,MAAM;QACV,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,SAAS,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EA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,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QACpE,OAAO,GAAG,CAAC,IAAI,EAA2B,CAAC;IAC7C,CAAC;IAED;;;OAGG;IACK,KAAK,CAAC,UAAU,CACtB,KAAa,EACb,MAA+C;QAE/C,MAAM,GAAG,GAAG,MAAM,KAAK,CACrB,GAAG,IAAI,CAAC,OAAO,SAAS,KAAK,IAAI,MAAM,EAAE,EACzC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,CAC5C,CAAC;QACF,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAuB,CAAC;YACxE,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,aAAa,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;QAC1E,CAAC;QACD,OAAO,GAAG,CAAC,IAAI,EAAuB,CAAC;IACzC,CAAC;CACF"}
@@ -0,0 +1,37 @@
1
+ import type { ExpressionContext } from "./types.js";
2
+ /**
3
+ * Wraps @marcbachmann/cel-js to evaluate ${{ expr }} templates and raw CEL
4
+ * expressions. Registers custom functions (now, len, startsWith, matches,
5
+ * coalesce) via Environment.registerFunction().
6
+ */
7
+ export declare class ExpressionEvaluator {
8
+ private readonly env;
9
+ private readonly nowTimestamp;
10
+ constructor(options?: {
11
+ nowTimestamp?: string;
12
+ });
13
+ /**
14
+ * The deterministic timestamp bound to now(). Exposed so the interpreter can
15
+ * stamp control outputs (e.g. approval `at`) without reading wall-clock time.
16
+ */
17
+ getNow(): string;
18
+ /**
19
+ * Evaluate a ${{ expr }} template by finding all expression patterns,
20
+ * evaluating each, and substituting the results.
21
+ */
22
+ evaluateTemplate(template: string, ctx: ExpressionContext): string;
23
+ /**
24
+ * Evaluate a raw CEL expression against the given context.
25
+ */
26
+ evaluateExpression(expr: string, ctx: ExpressionContext): unknown;
27
+ /**
28
+ * Evaluate a fanout `over` expression and validate the result is an array.
29
+ */
30
+ evaluateOverExpression(expr: string, ctx: ExpressionContext): unknown[];
31
+ /**
32
+ * Build the CEL variable bindings from the expression context.
33
+ * Transforms loop → loop_ctx to match the toCelParseSource rewriting.
34
+ */
35
+ private buildBindings;
36
+ }
37
+ //# sourceMappingURL=evaluator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluator.d.ts","sourceRoot":"","sources":["../src/evaluator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;;GAIG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAc;IAClC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;gBAE1B,OAAO,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE;IAgC/C;;;OAGG;IACH,MAAM,IAAI,MAAM;IAIhB;;;OAGG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,iBAAiB,GAAG,MAAM;IAOlE;;OAEG;IACH,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO;IAMjE;;OAEG;IACH,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,EAAE;IAQvE;;;OAGG;IACH,OAAO,CAAC,aAAa;CA0BtB"}
@@ -0,0 +1,101 @@
1
+ import { Environment } from "@marcbachmann/cel-js";
2
+ import { EXPRESSION_PATTERN, toCelParseSource } from "@acpus/core";
3
+ /**
4
+ * Wraps @marcbachmann/cel-js to evaluate ${{ expr }} templates and raw CEL
5
+ * expressions. Registers custom functions (now, len, startsWith, matches,
6
+ * coalesce) via Environment.registerFunction().
7
+ */
8
+ export class ExpressionEvaluator {
9
+ env;
10
+ nowTimestamp;
11
+ constructor(options) {
12
+ this.nowTimestamp = options?.nowTimestamp ?? new Date().toISOString();
13
+ this.env = new Environment({ unlistedVariablesAreDyn: true });
14
+ // Register custom functions with type signatures
15
+ this.env.registerFunction("now(): string", () => this.nowTimestamp);
16
+ // len() overloads — string and list
17
+ this.env.registerFunction("len(string): int", (str) => BigInt(str.length));
18
+ this.env.registerFunction("len(list): int", (arr) => BigInt(arr.length));
19
+ // startsWith
20
+ this.env.registerFunction("startsWith(string, string): bool", (str, prefix) => str.startsWith(prefix));
21
+ // matches
22
+ this.env.registerFunction("matches(string, string): bool", (str, pattern) => {
23
+ try {
24
+ return new RegExp(pattern).test(str);
25
+ }
26
+ catch {
27
+ return false;
28
+ }
29
+ });
30
+ // coalesce overloads — 2 and 3 args
31
+ this.env.registerFunction("coalesce(dyn, dyn): dyn", (a, b) => (a !== null && a !== undefined) ? a : b);
32
+ this.env.registerFunction("coalesce(dyn, dyn, dyn): dyn", (a, b, c) => {
33
+ if (a !== null && a !== undefined)
34
+ return a;
35
+ if (b !== null && b !== undefined)
36
+ return b;
37
+ return c;
38
+ });
39
+ }
40
+ /**
41
+ * The deterministic timestamp bound to now(). Exposed so the interpreter can
42
+ * stamp control outputs (e.g. approval `at`) without reading wall-clock time.
43
+ */
44
+ getNow() {
45
+ return this.nowTimestamp;
46
+ }
47
+ /**
48
+ * Evaluate a ${{ expr }} template by finding all expression patterns,
49
+ * evaluating each, and substituting the results.
50
+ */
51
+ evaluateTemplate(template, ctx) {
52
+ return template.replace(EXPRESSION_PATTERN, (_match, expr) => {
53
+ const result = this.evaluateExpression(expr.trim(), ctx);
54
+ return String(result);
55
+ });
56
+ }
57
+ /**
58
+ * Evaluate a raw CEL expression against the given context.
59
+ */
60
+ evaluateExpression(expr, ctx) {
61
+ const celSource = toCelParseSource(expr);
62
+ const bindings = this.buildBindings(ctx);
63
+ return this.env.evaluate(celSource, bindings);
64
+ }
65
+ /**
66
+ * Evaluate a fanout `over` expression and validate the result is an array.
67
+ */
68
+ evaluateOverExpression(expr, ctx) {
69
+ const result = this.evaluateExpression(expr, ctx);
70
+ if (!Array.isArray(result)) {
71
+ throw new Error(`fanout.over expression must evaluate to an array, got ${typeof result}: ${expr}`);
72
+ }
73
+ return result;
74
+ }
75
+ /**
76
+ * Build the CEL variable bindings from the expression context.
77
+ * Transforms loop → loop_ctx to match the toCelParseSource rewriting.
78
+ */
79
+ buildBindings(ctx) {
80
+ const bindings = {
81
+ input: ctx.input,
82
+ steps: ctx.steps,
83
+ run_id: ctx.run_id
84
+ };
85
+ if (ctx.loop !== undefined) {
86
+ // toCelParseSource rewrites loop. → loop_ctx.
87
+ bindings.loop_ctx = ctx.loop;
88
+ }
89
+ if (ctx.item !== undefined) {
90
+ bindings.item = ctx.item;
91
+ }
92
+ if (ctx.item_id !== undefined) {
93
+ bindings.item_id = ctx.item_id;
94
+ }
95
+ if (ctx.item_index !== undefined) {
96
+ bindings.item_index = ctx.item_index;
97
+ }
98
+ return bindings;
99
+ }
100
+ }
101
+ //# sourceMappingURL=evaluator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluator.js","sourceRoot":"","sources":["../src/evaluator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGnE;;;;GAIG;AACH,MAAM,OAAO,mBAAmB;IACb,GAAG,CAAc;IACjB,YAAY,CAAS;IAEtC,YAAY,OAAmC;QAC7C,IAAI,CAAC,YAAY,GAAG,OAAO,EAAE,YAAY,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACtE,IAAI,CAAC,GAAG,GAAG,IAAI,WAAW,CAAC,EAAE,uBAAuB,EAAE,IAAI,EAAE,CAAC,CAAC;QAE9D,iDAAiD;QACjD,IAAI,CAAC,GAAG,CAAC,gBAAgB,C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AAE,GAAG,CAAC,KAAK;YAChB,MAAM,EAAE,GAAG,CAAC,MAAM;SACnB,CAAC;QAEF,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC3B,8CAA8C;YAC9C,QAAQ,CAAC,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC;QAC/B,CAAC;QAED,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC3B,QAAQ,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;QAC3B,CAAC;QAED,IAAI,GAAG,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;YAC9B,QAAQ,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QACjC,CAAC;QAED,IAAI,GAAG,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YACjC,QAAQ,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;QACvC,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
@@ -0,0 +1,74 @@
1
+ import type { ExpressionContext, ExecutorResult } from "../types.js";
2
+ import type { ExecutorAdapter, ExecutionRequest } from "./types.js";
3
+ import { ExpressionEvaluator } from "../evaluator.js";
4
+ /**
5
+ * Drives an ACP agent through the `acpx` CLI. Acpus owns scheduling/state;
6
+ * acpx owns the ACP saved-session lifecycle and dead-pid recovery.
7
+ *
8
+ * - Session name is derived from the resolved node key (stable, unique per
9
+ * loop round / fanout lane / subworkflow nesting).
10
+ * - First run: `sessions ensure` then `prompt -s <session>` with the rendered
11
+ * prompt; continuation: same session with a fixed continuation prompt.
12
+ * - Cancel is cooperative: on abort we run `acpx cancel -s <session>` and wait
13
+ * for the in-flight prompt to settle (SIGKILL only as a last resort).
14
+ * - Output is the concatenation of `agent_message_chunk` text from the ACP
15
+ * NDJSON stream; the full stream is returned as `stdout` for transcript
16
+ * capture by the interpreter.
17
+ */
18
+ export declare class AgentExecutor implements ExecutorAdapter {
19
+ private readonly evaluator;
20
+ private readonly ajv;
21
+ private readonly acpxPath?;
22
+ private readonly cancelGraceMs;
23
+ constructor(options?: {
24
+ acpxPath?: string;
25
+ evaluator?: ExpressionEvaluator;
26
+ cancelGraceMs?: number;
27
+ });
28
+ execute({ node, context, signal, nodeKey, prompt: preparedPrompt, continuation, retry, onStream }: ExecutionRequest): Promise<ExecutorResult>;
29
+ /**
30
+ * On abort, request a cooperative `session/cancel` via acpx and schedule a
31
+ * SIGKILL fallback if the in-flight prompt does not settle within the grace
32
+ * period. Returns a handle exposing whether cancel fired and a cleanup fn.
33
+ */
34
+ private wireCooperativeCancel;
35
+ /**
36
+ * Build acpx arg lists for a subcommand. Global flags (--cwd, --model,
37
+ * --format) precede the command. For `command` agents the custom ACP server
38
+ * is selected via the `--agent` escape hatch; for `builtin` agents the
39
+ * adapter name is the command prefix.
40
+ */
41
+ private argsBuilder;
42
+ /** Resolve how to invoke acpx: an explicit path, or the resolved package bin via node. */
43
+ private resolveInvoker;
44
+ private sessionName;
45
+ private resolveCwd;
46
+ private resolveTimeoutSeconds;
47
+ private stringEnv;
48
+ }
49
+ /**
50
+ * Decide the prompt text for an agent turn:
51
+ * - first run → rendered task template
52
+ * - continuation → fixed continuation prompt
53
+ * - parse/schema retry→ fixed continuation prompt
54
+ * When an output schema is declared it is appended as a `# OUTPUT SCHEMA`
55
+ * section on the first run and on retries, but NOT on a plain continuation
56
+ * (the original task is still live in the acpx session there).
57
+ */
58
+ export declare function buildAgentPrompt(renderedTask: string, outputSchema: Record<string, unknown> | undefined, continuation: boolean, retry: boolean): string;
59
+ /** Render the exact Agent request prompt that will be sent to acpx. */
60
+ export declare function renderAgentRequestPrompt(node: {
61
+ metadata: Record<string, unknown>;
62
+ }, context: ExpressionContext, evaluator: ExpressionEvaluator, continuation: boolean, retry: boolean): string;
63
+ /**
64
+ * Extract a JSON value from an agent reply that may wrap JSON in prose and/or
65
+ * Markdown code fences. Three tiers, strictest first:
66
+ * 1. Strict fast path: parse the whole trimmed reply (pure-JSON response).
67
+ * 2. Independent balanced scan: try every `{...}`/`[...]` candidate from each
68
+ * opening brace/bracket so unbalanced prose/code cannot block later JSON.
69
+ * 3. Candidate-local jsonrepair fallback: for each later candidate, try strict
70
+ * parse first, then repair that same candidate before moving earlier.
71
+ * Returns `undefined` when no JSON can be recovered (→ retryable parse failure).
72
+ */
73
+ export declare function extractJson(text: string): unknown | undefined;
74
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/executors/agent.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAUtD;;;;;;;;;;;;;GAaG;AACH,qBAAa,aAAc,YAAW,eAAe;IACnD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsB;IAChD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAM;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;gBAE3B,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,mBAAmB,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE;IAO9F,OAAO,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC;IAgHnJ;;;;OAIG;IACH,OAAO,CAAC,qBAAqB;IA6B7B;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAenB,0FAA0F;IAC1F,OAAO,CAAC,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