acpx 0.19.0 → 0.19.2
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/{agent-registry-Ct2yWPW7.js → agent-registry-DWlx5BQ4.js} +3 -2
- package/dist/agent-registry-DWlx5BQ4.js.map +1 -0
- package/dist/agent-registry.js +1 -1
- package/dist/{cli-Bmki9cj5.js → cli-D-s_eTUy.js} +5 -5
- package/dist/{cli-Bmki9cj5.js.map → cli-D-s_eTUy.js.map} +1 -1
- package/dist/cli.js +31 -15
- package/dist/cli.js.map +1 -1
- package/dist/{client-DzaUKazo.d.ts → client-BchvQRpz.d.ts} +8 -1
- package/dist/client-BchvQRpz.d.ts.map +1 -0
- package/dist/{flows--Ewxn_fQ.js → flows-DdxEaeZo.js} +33 -20
- package/dist/flows-DdxEaeZo.js.map +1 -0
- package/dist/flows.d.ts +2 -1
- package/dist/flows.d.ts.map +1 -1
- package/dist/flows.js +1 -1
- package/dist/{invocation-options-DRzxHZmr.js → invocation-options-HjxSBsK0.js} +5 -5
- package/dist/{invocation-options-DRzxHZmr.js.map → invocation-options-HjxSBsK0.js.map} +1 -1
- package/dist/{ipc-fMgj5vrO.js → ipc-D0ZMQ0q9.js} +1393 -86
- package/dist/ipc-D0ZMQ0q9.js.map +1 -0
- package/dist/{output-D6kDs8BN.js → output-GQnhkJMU.js} +20 -12
- package/dist/output-GQnhkJMU.js.map +1 -0
- package/dist/{queue-owner-runtime-CLwjMYNL.js → queue-owner-runtime-W0lly6ap.js} +344 -777
- package/dist/queue-owner-runtime-W0lly6ap.js.map +1 -0
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +5 -5
- package/dist/runtime.js.map +1 -1
- package/dist/{session-watch-BfdIo-n4.js → session-watch-_8yxQ6ba.js} +4 -4
- package/dist/{session-watch-BfdIo-n4.js.map → session-watch-_8yxQ6ba.js.map} +1 -1
- package/dist/watch-C0mwpJcN.js +85 -0
- package/dist/watch-C0mwpJcN.js.map +1 -0
- package/package.json +1 -1
- package/skills/acpx/SKILL.md +2 -0
- package/dist/agent-registry-Ct2yWPW7.js.map +0 -1
- package/dist/client-DzaUKazo.d.ts.map +0 -1
- package/dist/flows--Ewxn_fQ.js.map +0 -1
- package/dist/ipc-fMgj5vrO.js.map +0 -1
- package/dist/output-D6kDs8BN.js.map +0 -1
- package/dist/queue-owner-runtime-CLwjMYNL.js.map +0 -1
- package/dist/watch-DH-zXQH2.js +0 -32
- package/dist/watch-DH-zXQH2.js.map +0 -1
|
@@ -72,6 +72,7 @@ declare class AcpClient {
|
|
|
72
72
|
private agent?;
|
|
73
73
|
private readonly agentDescendants;
|
|
74
74
|
private readonly agentCleanups;
|
|
75
|
+
private readonly commandProbes;
|
|
75
76
|
private initResult?;
|
|
76
77
|
private loadedSessionId?;
|
|
77
78
|
private eventHandlers;
|
|
@@ -127,8 +128,13 @@ declare class AcpClient {
|
|
|
127
128
|
private resolveAgentLaunchPlan;
|
|
128
129
|
private logAgentLaunch;
|
|
129
130
|
private ensureLaunchSupport;
|
|
131
|
+
private prepareProcessLaunch;
|
|
132
|
+
private startedProcess;
|
|
130
133
|
private spawnAgentProcess;
|
|
134
|
+
private assertCommandProbeActive;
|
|
135
|
+
private readAgentCommandOutput;
|
|
131
136
|
private admitAndObserveSpawnedProcess;
|
|
137
|
+
private admitSpawnedProcess;
|
|
132
138
|
private createConnection;
|
|
133
139
|
private initializeAgentConnection;
|
|
134
140
|
private initializeProtocolConnection;
|
|
@@ -201,6 +207,7 @@ declare class AcpClient {
|
|
|
201
207
|
private emitPermissionEscalation;
|
|
202
208
|
private handleModePermissionError;
|
|
203
209
|
private attachAgentLifecycleObservers;
|
|
210
|
+
private attachProcessExitObserver;
|
|
204
211
|
private handleAgentDisconnect;
|
|
205
212
|
private notifyProcessSpawnFailure;
|
|
206
213
|
private notifyProcessExit;
|
|
@@ -227,4 +234,4 @@ declare class AcpClient {
|
|
|
227
234
|
}
|
|
228
235
|
//#endregion
|
|
229
236
|
export { RequestedModelUnsupportedErrorCode as a, AcpControlAuthority as c, RequestedModelUnsupportedError as i, REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE as n, RequestedModelUnsupportedReason as o, REQUESTED_MODEL_UNSUPPORTED_REASONS as r, isRequestedModelUnsupportedError as s, AcpClient as t };
|
|
230
|
-
//# sourceMappingURL=client-
|
|
237
|
+
//# sourceMappingURL=client-BchvQRpz.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-BchvQRpz.d.ts","names":[],"sources":["../src/async-control.ts","../src/acp/model-support.ts","../src/acp/client.ts"],"mappings":";;;KAcY;EACV,SAAS;EACT;;;;KCbU;EACV;EACA;EACA,iBAAiB;IACf;IACA;;;cAaS;KAED,4CAA4C;cAE3C;KAKD,0CAA0C;cAEzC,uCAAuC;WACzC;WACA,QAAQ;WACR;EAGP,YAAA,iBACA,QAAQ,iCACR;IAAY;;;iBAoBA,iCACd,iBACC,SAAS;;;KCwJP;EACH,YAAY;EACZ;EACA;EACA;;KAGU;EACV;EACA;EACA,gBAAgB;EAChB,SAAS;EACT;EACA;;KAGU;EACV;EACA,gBAAgB;EAChB,SAAS;EACT;EACA;;KAGU,sBAAsB;KA8B7B;KAsFO;EACV;EACA,QAAQ,OAAO;EACf;EACA,QAAQ;EACR;;KAGU;EACV;EACA;EACA;EACA,WAAW;;cAoBA;UACH;UACA;UACA;mBACS;mBACA;mBACA;UACT;UACA;UACA;mBAQS;mBAMA;mBACA;UACT;UACA;UACA;UACA;UACA;UACA;mBACS;mBACA;mBACA;UACT;UACA;UAEA;UACA;UACA;UACA;mBACS;mBACA;EAEL,YAAA,SAAS;MAmCjB,oBAAoB;EAIxB;EAIA,sBAAsB;EAItB,6BAA6B;EAW7B;EAIA;EAIA;EAIA;EAIA,iBACE,UAAU,KACR;EAWJ;EAIA,qBAAqB;IACnB,iBAAiB;IACjB,4BAA4B;IAC5B,mBAAmB;IACnB;IAC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AWM;UAkBA;EAgCR,0BAA0B;IAC9B;IACA;MACE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as createOutputFormatter } from "./output-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { t as createOutputFormatter } from "./output-GQnhkJMU.js";
|
|
2
|
+
import { E as textPrompt, R as resolveSessionRecord, T as promptToDisplayText, gt as writePrivateJsonFile, ht as writePrivateFile, jt as SESSION_RECORD_SCHEMA, kt as PERMISSION_MODES, ut as defaultSessionEventLog } from "./ipc-D0ZMQ0q9.js";
|
|
3
|
+
import { N as runTimedExecFile } from "./agent-registry-DWlx5BQ4.js";
|
|
4
|
+
import { G as recordPromptSubmission, K as recordSessionUpdate, U as createSessionConversation, V as cloneSessionAcpxState, W as recordClientOperation, i as runOnce, lt as withInterrupt, m as createSessionWithClient, o as sendSessionDirect, ot as InterruptedError, st as TimeoutError, ut as withTimeout } from "./queue-owner-runtime-W0lly6ap.js";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { spawn } from "node:child_process";
|
|
7
7
|
import fs from "node:fs/promises";
|
|
@@ -234,7 +234,7 @@ const flowDefinitionSchema = extensibleObject({
|
|
|
234
234
|
const flowNodeTypeSchema = z.object({ nodeType: z.enum(FLOW_NODE_TYPES) });
|
|
235
235
|
function assertValidFlowDefinitionShape(flow) {
|
|
236
236
|
const parsed = parseWithSchema("flow definition", flowDefinitionSchema, flow);
|
|
237
|
-
for (const [nodeId, node] of Object.entries(
|
|
237
|
+
for (const [nodeId, node] of Object.entries(flow.nodes)) assertValidFlowNodeDefinitionShape(node, `flow node "${nodeId}"`);
|
|
238
238
|
parsed.edges.forEach((edge, index) => {
|
|
239
239
|
assertValidFlowEdgeShape(edge, `flow definition: edges.${index}`);
|
|
240
240
|
});
|
|
@@ -289,6 +289,8 @@ function assertValidFlowEdgeShape(edge, label) {
|
|
|
289
289
|
return;
|
|
290
290
|
}
|
|
291
291
|
parseWithSchema(label, switchFlowEdgeSchema, edge);
|
|
292
|
+
const cases = edge.switch.cases;
|
|
293
|
+
for (const [key, target] of Object.entries(cases)) parseWithSchema(`${label}: switch.cases.${key}`, z.string(), target);
|
|
292
294
|
}
|
|
293
295
|
function parseWithSchema(label, schema, value) {
|
|
294
296
|
try {
|
|
@@ -705,35 +707,38 @@ function throwIfShellCancelled(signal, mode) {
|
|
|
705
707
|
//#region src/flows/graph.ts
|
|
706
708
|
function validateFlowDefinition(flow) {
|
|
707
709
|
assertValidFlowDefinitionShape(flow);
|
|
708
|
-
|
|
710
|
+
assertKnownFlowNode(flow, flow.startAt, "Flow start node is missing");
|
|
709
711
|
const outgoingEdges = /* @__PURE__ */ new Set();
|
|
710
712
|
for (const edge of flow.edges) validateFlowEdge(flow, edge, outgoingEdges);
|
|
711
713
|
}
|
|
712
714
|
function assertKnownFlowNode(flow, nodeId, description) {
|
|
713
|
-
if (!flow.nodes
|
|
715
|
+
if (!Object.hasOwn(flow.nodes, nodeId)) throw new Error(`${description}: ${nodeId}`);
|
|
716
|
+
}
|
|
717
|
+
function isDirectEdge(edge) {
|
|
718
|
+
return Object.hasOwn(edge, "to");
|
|
714
719
|
}
|
|
715
720
|
function validateFlowEdge(flow, edge, outgoingEdges) {
|
|
716
721
|
assertKnownFlowNode(flow, edge.from, "Flow edge references unknown from-node");
|
|
717
722
|
if (outgoingEdges.has(edge.from)) throw new Error(`Flow node must not declare multiple outgoing edges: ${edge.from}`);
|
|
718
723
|
outgoingEdges.add(edge.from);
|
|
719
|
-
if (
|
|
724
|
+
if (isDirectEdge(edge)) {
|
|
720
725
|
assertKnownFlowNode(flow, edge.to, "Flow edge references unknown to-node");
|
|
721
726
|
return;
|
|
722
727
|
}
|
|
723
728
|
for (const target of Object.values(edge.switch.cases)) assertKnownFlowNode(flow, target, "Flow switch references unknown to-node");
|
|
724
729
|
}
|
|
725
730
|
function canFollowEdge(edge, result) {
|
|
726
|
-
return !result || result.outcome === "ok" ||
|
|
731
|
+
return !result || result.outcome === "ok" || !isDirectEdge(edge) && edge.switch.on.startsWith("$result.");
|
|
727
732
|
}
|
|
728
733
|
function resolveNext(edges, from, output, result) {
|
|
729
734
|
const edge = edges.find((candidate) => candidate.from === from);
|
|
730
735
|
if (!edge || !canFollowEdge(edge, result)) return null;
|
|
731
|
-
if (
|
|
736
|
+
if (isDirectEdge(edge)) return edge.to;
|
|
732
737
|
const value = getBySwitchPath(output, result, edge.switch.on);
|
|
733
738
|
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") throw new Error(`Flow switch value must be scalar for ${edge.switch.on}`);
|
|
734
|
-
const
|
|
735
|
-
if (!
|
|
736
|
-
return
|
|
739
|
+
const key = String(value);
|
|
740
|
+
if (!Object.hasOwn(edge.switch.cases, key)) throw new Error(`No flow switch case for ${edge.switch.on}=${JSON.stringify(value)}`);
|
|
741
|
+
return edge.switch.cases[key];
|
|
737
742
|
}
|
|
738
743
|
function getBySwitchPath(output, result, jsonPath) {
|
|
739
744
|
if (jsonPath.startsWith("$result.")) return getByPath(result, `$.${jsonPath.slice(8)}`);
|
|
@@ -1406,6 +1411,14 @@ function isoNow() {
|
|
|
1406
1411
|
//#region src/flows/runtime.ts
|
|
1407
1412
|
const DEFAULT_FLOW_HEARTBEAT_MS = 5e3;
|
|
1408
1413
|
const DEFAULT_FLOW_STEP_TIMEOUT_MS = 9e5;
|
|
1414
|
+
function setNodeValue(values, nodeId, value) {
|
|
1415
|
+
Object.defineProperty(values, nodeId, {
|
|
1416
|
+
value,
|
|
1417
|
+
enumerable: true,
|
|
1418
|
+
configurable: true,
|
|
1419
|
+
writable: true
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1409
1422
|
var FlowRunner = class {
|
|
1410
1423
|
resolveAgent;
|
|
1411
1424
|
defaultCwd;
|
|
@@ -1544,7 +1557,7 @@ var FlowRunner = class {
|
|
|
1544
1557
|
let current = flow.startAt;
|
|
1545
1558
|
const attemptCounts = /* @__PURE__ */ new Map();
|
|
1546
1559
|
try {
|
|
1547
|
-
while (current) {
|
|
1560
|
+
while (current !== null) {
|
|
1548
1561
|
this.throwIfRunInterrupted(runDir);
|
|
1549
1562
|
const step = await this.executeFlowStep(flow, input, runDir, state, current, attemptCounts);
|
|
1550
1563
|
this.throwIfRunInterrupted(runDir, step.executionError);
|
|
@@ -1566,8 +1579,8 @@ var FlowRunner = class {
|
|
|
1566
1579
|
if (interrupted) throw error ?? interrupted;
|
|
1567
1580
|
}
|
|
1568
1581
|
async executeFlowStep(flow, input, runDir, state, nodeId, attemptCounts) {
|
|
1582
|
+
if (!Object.hasOwn(flow.nodes, nodeId)) throw new Error(`Unknown flow node: ${nodeId}`);
|
|
1569
1583
|
const node = flow.nodes[nodeId];
|
|
1570
|
-
if (!node) throw new Error(`Unknown flow node: ${nodeId}`);
|
|
1571
1584
|
const attemptId = nextAttemptId(attemptCounts, nodeId);
|
|
1572
1585
|
const startedAt = isoNow$1();
|
|
1573
1586
|
markNodeStarted(state, nodeId, attemptId, node.nodeType, startedAt, node.statusDetail);
|
|
@@ -1618,7 +1631,7 @@ var FlowRunner = class {
|
|
|
1618
1631
|
finishedAt: isoNow$1(),
|
|
1619
1632
|
...outcome === "ok" ? { output: executed.output } : { error: executionError instanceof Error ? executionError.message : String(executionError) }
|
|
1620
1633
|
});
|
|
1621
|
-
state.results
|
|
1634
|
+
setNodeValue(state.results, nodeId, nodeResult);
|
|
1622
1635
|
return {
|
|
1623
1636
|
...executed,
|
|
1624
1637
|
nodeResult,
|
|
@@ -1656,7 +1669,7 @@ var FlowRunner = class {
|
|
|
1656
1669
|
}
|
|
1657
1670
|
async maybeCompleteCheckpointStep(runDir, state, step) {
|
|
1658
1671
|
if (step.nodeResult.outcome !== "ok" || step.node.nodeType !== "checkpoint") return;
|
|
1659
|
-
state.outputs
|
|
1672
|
+
setNodeValue(state.outputs, step.nodeId, step.output);
|
|
1660
1673
|
state.waitingOn = step.nodeId;
|
|
1661
1674
|
state.updatedAt = isoNow$1();
|
|
1662
1675
|
state.status = "waiting";
|
|
@@ -1668,11 +1681,11 @@ var FlowRunner = class {
|
|
|
1668
1681
|
}
|
|
1669
1682
|
resolveNextNode(flow, step) {
|
|
1670
1683
|
if (step.nodeResult.outcome === "ok") {
|
|
1671
|
-
step.state.outputs
|
|
1684
|
+
setNodeValue(step.state.outputs, step.nodeId, step.output);
|
|
1672
1685
|
return resolveNext(flow.edges, step.nodeId, step.output, step.nodeResult);
|
|
1673
1686
|
}
|
|
1674
1687
|
const next = resolveNext(flow.edges, step.nodeId, void 0, step.nodeResult);
|
|
1675
|
-
if (next) return next;
|
|
1688
|
+
if (next !== null) return next;
|
|
1676
1689
|
throw step.executionError;
|
|
1677
1690
|
}
|
|
1678
1691
|
async completeFlowRun(runDir, state) {
|
|
@@ -2434,4 +2447,4 @@ function formatDecisionPrompt(question, choices, field) {
|
|
|
2434
2447
|
//#endregion
|
|
2435
2448
|
export { parseStrictJsonObject as a, validateFlowDefinition as c, checkpoint as d, compute as f, isDefinedFlow as h, parseJsonObject as i, acp as l, shell as m, decisionEdge as n, FlowRunner as o, defineFlow as p, extractJsonObject as r, flowRunsBaseDir as s, decision as t, action as u };
|
|
2436
2449
|
|
|
2437
|
-
//# sourceMappingURL=flows
|
|
2450
|
+
//# sourceMappingURL=flows-DdxEaeZo.js.map
|