acpx 0.16.0 → 0.17.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 (36) hide show
  1. package/README.md +2 -0
  2. package/dist/{cli-BkYIxj_N.js → cli-CiyfEC7L.js} +5 -4
  3. package/dist/{cli-BkYIxj_N.js.map → cli-CiyfEC7L.js.map} +1 -1
  4. package/dist/cli.d.ts +1 -1
  5. package/dist/cli.js +33 -26
  6. package/dist/cli.js.map +1 -1
  7. package/dist/{client-5levcBIs.d.ts → client-C6NUFqr-.d.ts} +12 -6
  8. package/dist/client-C6NUFqr-.d.ts.map +1 -0
  9. package/dist/{flows-Bxs4udrs.js → flows-CTOdIk-m.js} +6 -5
  10. package/dist/{flows-Bxs4udrs.js.map → flows-CTOdIk-m.js.map} +1 -1
  11. package/dist/flows.d.ts +2 -2
  12. package/dist/flows.js +1 -1
  13. package/dist/{invocation-options-BY4lxkn3.js → invocation-options-DbCcOAzM.js} +4 -3
  14. package/dist/{invocation-options-BY4lxkn3.js.map → invocation-options-DbCcOAzM.js.map} +1 -1
  15. package/dist/ipc-D3akHMEq.js +3350 -0
  16. package/dist/ipc-D3akHMEq.js.map +1 -0
  17. package/dist/output-BPPjvJTI.js +980 -0
  18. package/dist/output-BPPjvJTI.js.map +1 -0
  19. package/dist/{live-checkpoint-BEfxBKCh.js → queue-owner-runtime--IbbndGz.js} +3052 -1852
  20. package/dist/queue-owner-runtime--IbbndGz.js.map +1 -0
  21. package/dist/runtime.d.ts +99 -12
  22. package/dist/runtime.d.ts.map +1 -1
  23. package/dist/runtime.js +308 -69
  24. package/dist/runtime.js.map +1 -1
  25. package/dist/{session-options-t3d-F4dn.d.ts → session-options-Dp6mzNSy.d.ts} +2 -2
  26. package/dist/{session-options-t3d-F4dn.d.ts.map → session-options-Dp6mzNSy.d.ts.map} +1 -1
  27. package/dist/session-watch--UX5dh00.js +76 -0
  28. package/dist/session-watch--UX5dh00.js.map +1 -0
  29. package/dist/watch-BbBxO-kb.js +32 -0
  30. package/dist/watch-BbBxO-kb.js.map +1 -0
  31. package/package.json +1 -1
  32. package/skills/acpx/SKILL.md +5 -2
  33. package/dist/client-5levcBIs.d.ts.map +0 -1
  34. package/dist/live-checkpoint-BEfxBKCh.js.map +0 -1
  35. package/dist/output-uo5a27KB.js +0 -4711
  36. package/dist/output-uo5a27KB.js.map +0 -1
@@ -342,5 +342,5 @@ type SessionAgentOptions = {
342
342
  env?: Record<string, string>;
343
343
  };
344
344
  //#endregion
345
- export { PermissionStats as C, PermissionPolicy as S, PromptInput as T, AcpProcessStarted as _, AcpElicitationHandler as a, NonInteractivePermissionPolicy as b, AcpElicitationResponse as c, AcpPermissionRequest as d, AcpProcessExit as f, AcpProcessSpawnFailure as g, AcpProcessLifecycle as h, AcpElicitationContext as i, AcpPermissionDecision as l, AcpProcessLaunchScope as m, SystemPromptOption as n, AcpElicitationMode as o, AcpProcessLaunch as p, AcpClientOptions as r, AcpElicitationRequest as s, SessionAgentOptions as t, AcpPermissionHandler as u, AuthPolicy as v, SessionRecord as w, PermissionMode as x, McpServer$1 as y };
346
- //# sourceMappingURL=session-options-t3d-F4dn.d.ts.map
345
+ export { PermissionPolicy as C, PromptInput as E, PermissionMode as S, SessionRecord as T, AcpProcessSpawnFailure as _, AcpElicitationHandler as a, McpServer$1 as b, AcpElicitationResponse as c, AcpPermissionHandler as d, AcpPermissionRequest as f, AcpProcessLifecycle as g, AcpProcessLaunchScope as h, AcpElicitationContext as i, AcpJsonRpcMessage as l, AcpProcessLaunch as m, SystemPromptOption as n, AcpElicitationMode as o, AcpProcessExit as p, AcpClientOptions as r, AcpElicitationRequest as s, SessionAgentOptions as t, AcpPermissionDecision as u, AcpProcessStarted as v, PermissionStats as w, NonInteractivePermissionPolicy as x, AuthPolicy as y };
346
+ //# sourceMappingURL=session-options-Dp6mzNSy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-options-t3d-F4dn.d.ts","names":[],"sources":["../src/prompt-content.ts","../src/types.ts","../src/runtime/engine/session-options.ts"],"mappings":";;KAEY,cAAc;;;KCgBd;EACV;EACA,KAAK;EACL,cAAc;;KAGJ;EACN;;EACA;;EACA;;EACA;;EACA;;KAEM,wBACV,SAAS,sBACT;EAAW,QAAQ;MAChB,QAAQ;cAEA;KACD,6BAA6B;KAC7B,wBAAwB;KAExB;;EAEV,WAAW;;EAEX,QAAQ;;KAGL;EACH,QAAQ;;KAGE;EAEN;EACA,UAAU,eAAe;IACvB;EACD;IAAsB;EACtB;IAAqB;KAEhB,yBACV,SAAS,uBACT,SAAS,0BACN,QAAQ;cAiBA;KACD,yBAAyB;cAExB;KACD,qBAAqB;cAEpB;KACD,yCAAyC;cAExC;KACD,iCAAiC;KAEjC;EACV;EACA;EACA;EACA,gBAAgB;;KAGN;EACV;EACA;EACA;EACA;EACA;EACA;EACA,WAAW;EACX;EACA;EACA;EACA;;KAQU,oBAAoB;KACpB;KAwCA;EACV;EACA;EACA;EACA;;KAGU;KAUA;KAEA;EACV,QAAQ;EACR,QAAQ;EACR;EACA;EACA;;KAGU;EACV;EACA;EACA;EACA;EACA;EACA;;KAgDU,wBACR;EAAW;KACX;EAAW;EAAyB;KACpC;EAAW;EAAuB;;KAE1B,mBAAmB;EAC7B;EACA,OAAO;EACP;EACA;EACA;;KAGU,oBAAoB,mBAC9B;EACE;EACA;;KAGQ,yBAAyB,mBACnC;EACE;EACA;;KAGQ,iBAAiB,oBAC3B;EACE;EACA,QAAQ,OAAO;EACf;;;;;;;;;KAUQ;EACV,iBAAiB,QAAQ,qBAAqB;EAC9C,aAAa,SAAS,sBAAsB;EAC5C,iBAAiB,SAAS,2BAA2B;EACrD,UAAU,MAAM,mBAAmB;;KAGzB;EACV;EACA;;EAEA,kBAAkB;EAClB;EACA,aAAa;EACb,gBAAgB;EAChB,4BAA4B;EAC5B,mBAAmB;EACnB,kBAAkB;EAClB,aAAa;EACb;EACA;EACA,4BAA4B;EAC5B,mBAAmB;EACnB,qBAAqB;EACrB;EACA;EACA;IACE;IACA;IACA;IACA;MAA0B;;IAC1B,MAAM;;EAER,gBAAgB,WAAW,qBAAqB,SAAS;EACzD,sBAAsB,WAAW,qBAAqB,SAAS;EAC/D,mBAAmB,cAAc;EACjC,qBAAqB,WAAW;EAChC,0BAA0B,OAAO;EACjC,sBAAsB;;cAGX;KACD;EACV;EACA;IACE;IACA;;;KAIQ;EACV;EACA;;KAGU;EAEN;;EAGA;IACE;IACA;;;EAIF,OAAO;;EAGP,OAAO;;KAGD;EACV;EACA;EACA;EACA;EACA;EACA;;KAGU;EAEN;;EAGA,OAAO;;KAGD;EACV;EACA;EACA;EACA,SAAS;EACT;;KAGU;EAEN;;EAGA;IACE;IACA;;;EAIF;;EAGA,SAAS;;KAGH;EACV;EACA,SAAS;;KAGC;EACV,SAAS;EACT,cAAc,eAAe;EAC7B;;KAGU;EAEN,MAAM;;EAGN,OAAO;;KAID;EACV;EACA;EACA;EACA;EACA;EACA;;KAGU;EACV;EACA;;KAGU;EACV;EACA;EACA;;KAYU;EACV;EACA;EACA;EACA,yBAAyB;EACzB;EACA;EACA,wBAAwB;EACxB;EACA,qBAAqB;EACrB,iBAAiB;EACjB;IACE;IACA;IACA;IACA;MAA2B;;IAC3B,MAAM;;;KAIE;EACV;EACA;EACA;EACA;;KAGU;EACV,eAAe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA,sBAAsB,OAAO;EAC7B;EACA;EACA;EACA,oBAAoB;EACpB;EACA,UAAU;EACV;EACA,wBAAwB;EACxB,kBAAkB;EAClB,qBAAqB,eAAe;EACpC,OAAO;EACP,eAAe;;;;KClfL;EAAgC;;KAEhC;EACV;EACA;EACA;EACA,eAAe;;;;;;;;;;EAUf,MAAM"}
1
+ {"version":3,"file":"session-options-Dp6mzNSy.d.ts","names":[],"sources":["../src/prompt-content.ts","../src/types.ts","../src/runtime/engine/session-options.ts"],"mappings":";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1B,MAAM;;EAER,gBAAgB,WAAW,qBAAqB,SAAS;EACzD,sBAAsB,WAAW,qBAAqB,SAAS;EAC/D,mBAAmB,cAAc;EACjC,qBAAqB,WAAW;EAChC,0BAA0B,OAAO;EACjC,sBAAsB;;cAGX;KACD;EACV;EACA;IACE;IACA;;;KAIQ;EACV;EACA;;KAGU;EAEN;;EAGA;IACE;IACA;;;EAIF,OAAO;;EAGP,OAAO;;KAGD;EACV;EACA;EACA;EACA;EACA;EACA;;KAGU;EAEN;;EAGA,OAAO;;KAGD;EACV;EACA;EACA;EACA,SAAS;EACT;;KAGU;EAEN;;EAGA;IACE;IACA;;;EAIF;;EAGA,SAAS;;KAGH;EACV;EACA,SAAS;;KAGC;EACV,SAAS;EACT,cAAc,eAAe;EAC7B;;KAGU;EAEN,MAAM;;EAGN,OAAO;;KAID;EACV;EACA;EACA;EACA;EACA;EACA;;KAGU;EACV;EACA;;KAGU;EACV;EACA;EACA;;KAYU;EACV;EACA;EACA;EACA,yBAAyB;EACzB;EACA;EACA,wBAAwB;EACxB;EACA,qBAAqB;EACrB,iBAAiB;EACjB;IACE;IACA;IACA;IACA;MAA2B;;IAC3B,MAAM;;;KAIE;EACV;EACA;EACA;EACA;;KAGU;EACV,eAAe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA,sBAAsB,OAAO;EAC7B;EACA;EACA;EACA,oBAAoB;EACpB;EACA,UAAU;EACV;EACA,wBAAwB;EACxB,kBAAkB;EAClB,qBAAqB,eAAe;EACpC,OAAO;EACP,eAAe;;;;KClfL;EAAgC;;KAEhC;EACV;EACA;EACA;EACA,eAAe;;;;;;;;;;EAUf,MAAM"}
@@ -0,0 +1,76 @@
1
+ import { i as JsonMessageSanitizer, t as createOutputFormatter } from "./output-BPPjvJTI.js";
2
+ import { ot as parsePromptStopReason, tt as isAcpJsonRpcMessage } from "./ipc-D3akHMEq.js";
3
+ import { t as watchSession } from "./watch-BbBxO-kb.js";
4
+ import { once } from "node:events";
5
+ //#region src/cli/session-watch.ts
6
+ function watchRenderer(policy) {
7
+ const chunks = [];
8
+ const stdout = { write: (chunk) => {
9
+ chunks.push(chunk);
10
+ } };
11
+ let sanitizer = new JsonMessageSanitizer(policy.suppressReads, true);
12
+ let formatter = createOutputFormatter(policy.format, { stdout });
13
+ return (event) => {
14
+ chunks.length = 0;
15
+ if (event.type === "turn_started") {
16
+ sanitizer = new JsonMessageSanitizer(policy.suppressReads, true);
17
+ formatter = createOutputFormatter(policy.format, { stdout });
18
+ }
19
+ if (policy.format === "json") chunks.push(JSON.stringify(event.type === "message" ? {
20
+ ...event,
21
+ message: sanitizer.sanitize(event.message)
22
+ } : event) + "\n");
23
+ else if (event.type === "message") renderWatchMessage(event, sanitizer, formatter, policy.format === "quiet");
24
+ else {
25
+ formatter.flush();
26
+ if (policy.format !== "quiet") chunks.push(watchLifecycleLine(event));
27
+ }
28
+ return chunks;
29
+ };
30
+ }
31
+ function renderWatchMessage(event, sanitizer, formatter, quiet) {
32
+ const message = sanitizer.sanitize(event.message);
33
+ if (!isAcpJsonRpcMessage(message)) throw new Error("Invalid sanitized session message");
34
+ if (quiet || parsePromptStopReason(message) === void 0) formatter.onAcpMessage(message);
35
+ }
36
+ function watchLifecycleLine(event) {
37
+ if (event.type === "turn_started") return `\n[${event.requestId}] started cursor=${event.cursor}\n`;
38
+ const detail = event.result.status === "failed" ? event.result.error.message : event.result.stopReason;
39
+ return `\n[${event.requestId}] ${event.result.status}${detail ? `: ${detail}` : ""} cursor=${event.cursor}\n`;
40
+ }
41
+ async function runSessionWatch(record, options) {
42
+ const stopped = new AbortController();
43
+ let outputError;
44
+ const stop = () => stopped.abort();
45
+ const onOutputError = (error) => {
46
+ if (error.code !== "EPIPE") outputError = error;
47
+ stop();
48
+ };
49
+ const render = watchRenderer(options.policy);
50
+ process.on("SIGINT", stop);
51
+ process.on("SIGTERM", stop);
52
+ process.on("SIGHUP", stop);
53
+ process.stdout.on("error", onOutputError);
54
+ try {
55
+ for await (const event of watchSession({
56
+ record,
57
+ cursor: options.cursor,
58
+ signal: stopped.signal
59
+ })) for (const chunk of render(event)) {
60
+ if (stopped.signal.aborted) break;
61
+ if (!process.stdout.write(chunk)) await once(process.stdout, "drain", { signal: stopped.signal });
62
+ }
63
+ } catch (error) {
64
+ if (!stopped.signal.aborted) throw error;
65
+ } finally {
66
+ process.off("SIGINT", stop);
67
+ process.off("SIGTERM", stop);
68
+ process.off("SIGHUP", stop);
69
+ process.stdout.off("error", onOutputError);
70
+ }
71
+ if (outputError) throw outputError;
72
+ }
73
+ //#endregion
74
+ export { runSessionWatch };
75
+
76
+ //# sourceMappingURL=session-watch--UX5dh00.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-watch--UX5dh00.js","names":[],"sources":["../src/cli/session-watch.ts"],"sourcesContent":["import { once } from \"node:events\";\nimport { isAcpJsonRpcMessage, parsePromptStopReason } from \"../acp/jsonrpc.js\";\nimport type { SessionWatchEvent } from \"../session/journal.js\";\nimport { watchSession } from \"../session/watch.js\";\nimport type { OutputFormatter, OutputPolicy, SessionRecord } from \"../types.js\";\nimport { JsonMessageSanitizer } from \"./output/json-formatter.js\";\nimport { createOutputFormatter } from \"./output/output.js\";\n\nfunction watchRenderer(policy: OutputPolicy): (event: SessionWatchEvent) => string[] {\n const chunks: string[] = [];\n const stdout = {\n write: (chunk: string) => {\n chunks.push(chunk);\n },\n };\n let sanitizer = new JsonMessageSanitizer(policy.suppressReads, true);\n let formatter = createOutputFormatter(policy.format, { stdout });\n return (event) => {\n chunks.length = 0;\n if (event.type === \"turn_started\") {\n sanitizer = new JsonMessageSanitizer(policy.suppressReads, true);\n formatter = createOutputFormatter(policy.format, { stdout });\n }\n if (policy.format === \"json\") {\n chunks.push(\n JSON.stringify(\n event.type === \"message\"\n ? { ...event, message: sanitizer.sanitize(event.message) }\n : event,\n ) + \"\\n\",\n );\n } else if (event.type === \"message\") {\n renderWatchMessage(event, sanitizer, formatter, policy.format === \"quiet\");\n } else {\n formatter.flush();\n if (policy.format !== \"quiet\") {\n chunks.push(watchLifecycleLine(event));\n }\n }\n return chunks;\n };\n}\n\nfunction renderWatchMessage(\n event: Extract<SessionWatchEvent, { type: \"message\" }>,\n sanitizer: JsonMessageSanitizer,\n formatter: OutputFormatter,\n quiet: boolean,\n): void {\n const message = sanitizer.sanitize(event.message);\n if (!isAcpJsonRpcMessage(message)) {\n throw new Error(\"Invalid sanitized session message\");\n }\n if (quiet || parsePromptStopReason(message) === undefined) {\n formatter.onAcpMessage(message);\n }\n}\n\nfunction watchLifecycleLine(event: Exclude<SessionWatchEvent, { type: \"message\" }>): string {\n if (event.type === \"turn_started\") {\n return `\\n[${event.requestId}] started cursor=${event.cursor}\\n`;\n }\n const detail =\n event.result.status === \"failed\" ? event.result.error.message : event.result.stopReason;\n return `\\n[${event.requestId}] ${event.result.status}${detail ? `: ${detail}` : \"\"} cursor=${event.cursor}\\n`;\n}\n\nexport async function runSessionWatch(\n record: SessionRecord,\n options: { cursor?: string; policy: OutputPolicy },\n): Promise<void> {\n const stopped = new AbortController();\n let outputError: Error | undefined;\n const stop = () => stopped.abort();\n const onOutputError = (error: Error) => {\n if ((error as NodeJS.ErrnoException).code !== \"EPIPE\") {\n outputError = error;\n }\n stop();\n };\n const render = watchRenderer(options.policy);\n process.on(\"SIGINT\", stop);\n process.on(\"SIGTERM\", stop);\n process.on(\"SIGHUP\", stop);\n process.stdout.on(\"error\", onOutputError);\n try {\n for await (const event of watchSession({\n record,\n cursor: options.cursor,\n signal: stopped.signal,\n })) {\n for (const chunk of render(event)) {\n if (stopped.signal.aborted) {\n break;\n }\n if (!process.stdout.write(chunk)) {\n await once(process.stdout, \"drain\", { signal: stopped.signal });\n }\n }\n }\n } catch (error) {\n if (!stopped.signal.aborted) {\n throw error;\n }\n } finally {\n process.off(\"SIGINT\", stop);\n process.off(\"SIGTERM\", stop);\n process.off(\"SIGHUP\", stop);\n process.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M,UAAU,IAAI,MAAM,OAAO,SAAS,SAAS,KAAK,WAAW,GAAG,UAAU,MAAM,OAAO;AAC5G;AAEA,eAAsB,gBACpB,QACA,SACe;CACf,MAAM,UAAU,IAAI,gBAAgB;CACpC,IAAI;CACJ,MAAM,aAAa,QAAQ,MAAM;CACjC,MAAM,iBAAiB,UAAiB;EACtC,IAAK,MAAgC,SAAS,SAC5C,cAAc;EAEhB,KAAK;CACP;CACA,MAAM,SAAS,cAAc,QAAQ,MAAM;CAC3C,QAAQ,GAAG,UAAU,IAAI;CACzB,QAAQ,GAAG,WAAW,IAAI;CAC1B,QAAQ,GAAG,UAAU,IAAI;CACzB,QAAQ,OAAO,GAAG,SAAS,aAAa;CACxC,IAAI;EACF,WAAW,MAAM,SAAS,aAAa;GACrC;GACA,QAAQ,QAAQ;GAChB,QAAQ,QAAQ;EAClB,CAAC,GACC,KAAK,MAAM,SAAS,OAAO,KAAK,GAAG;GACjC,IAAI,QAAQ,OAAO,SACjB;GAEF,IAAI,CAAC,QAAQ,OAAO,MAAM,KAAK,GAC7B,MAAM,KAAK,QAAQ,QAAQ,SAAS,EAAE,QAAQ,QAAQ,OAAO,CAAC;EAElE;CAEJ,SAAS,OAAO;EACd,IAAI,CAAC,QAAQ,OAAO,SAClB,MAAM;CAEV,UAAU;EACR,QAAQ,IAAI,UAAU,IAAI;EAC1B,QAAQ,IAAI,WAAW,IAAI;EAC3B,QAAQ,IAAI,UAAU,IAAI;EAC1B,QAAQ,OAAO,IAAI,SAAS,aAAa;CAC3C;CACA,IAAI,aACF,MAAM;AAEV"}
@@ -0,0 +1,32 @@
1
+ import { G as watchSession$1, Ht as SessionNotFoundError, P as readSessionRecord, W as SessionWatchError, d as readQueueOwnerRecord, ht as isProcessAlive } from "./ipc-D3akHMEq.js";
2
+ //#region src/session/watch.ts
3
+ async function continueWatching(recordId, pendingRequestId, observation) {
4
+ const owner = await readQueueOwnerRecord(recordId);
5
+ if (owner && isProcessAlive(owner.pid)) {
6
+ if (!owner.sessionWatch) throw new SessionWatchError("WATCH_OWNER_UNSUPPORTED", "This running session owner predates passive watching. Let it expire when idle or explicitly close the session before starting new work.");
7
+ observation.missingRequest = null;
8
+ return true;
9
+ }
10
+ if (pendingRequestId && pendingRequestId === observation.missingRequest) throw new SessionWatchError("WATCH_OUTCOME_UNKNOWN", `Session owner ended without a settled result for request ${pendingRequestId}; its outcome is unknown. Resume watching from the last cursor after recovery, and do not automatically replay the prompt.`);
11
+ observation.missingRequest = pendingRequestId;
12
+ if (pendingRequestId) return true;
13
+ return await isSessionOpen(recordId);
14
+ }
15
+ async function isSessionOpen(recordId) {
16
+ const record = await readSessionRecord(recordId);
17
+ if (!record || record.acpxRecordId !== recordId) throw new SessionNotFoundError(recordId);
18
+ return record.closed !== true;
19
+ }
20
+ function watchSession(options) {
21
+ return { [Symbol.asyncIterator]() {
22
+ const observation = { missingRequest: null };
23
+ return watchSession$1({
24
+ ...options,
25
+ continueWatching: (record, requestId) => continueWatching(record.acpxRecordId, requestId, observation)
26
+ })[Symbol.asyncIterator]();
27
+ } };
28
+ }
29
+ //#endregion
30
+ export { watchSession as t };
31
+
32
+ //# sourceMappingURL=watch-BbBxO-kb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watch-BbBxO-kb.js","names":["watchJournal"],"sources":["../src/session/watch.ts"],"sourcesContent":["import { SessionNotFoundError } from \"../errors.js\";\nimport { isProcessAlive } from \"../process-liveness.js\";\nimport type { SessionRecord } from \"../types.js\";\nimport {\n SessionWatchError,\n watchSession as watchJournal,\n type SessionWatchEvent,\n} from \"./journal.js\";\nimport { readSessionRecord } from \"./persistence.js\";\nimport { readQueueOwnerRecord } from \"./queue/lease-store.js\";\n\nasync function continueWatching(\n recordId: string,\n pendingRequestId: string | null,\n observation: { missingRequest: string | null },\n): Promise<boolean> {\n const owner = await readQueueOwnerRecord(recordId);\n if (owner && isProcessAlive(owner.pid)) {\n if (!owner.sessionWatch) {\n throw new SessionWatchError(\n \"WATCH_OWNER_UNSUPPORTED\",\n \"This running session owner predates passive watching. Let it expire when idle or explicitly close the session before starting new work.\",\n );\n }\n observation.missingRequest = null;\n return true;\n }\n if (pendingRequestId && pendingRequestId === observation.missingRequest) {\n throw new SessionWatchError(\n \"WATCH_OUTCOME_UNKNOWN\",\n `Session owner ended without a settled result for request ${pendingRequestId}; its outcome is unknown. Resume watching from the last cursor after recovery, and do not automatically replay the prompt.`,\n );\n }\n observation.missingRequest = pendingRequestId;\n if (pendingRequestId) {\n return true;\n }\n return await isSessionOpen(recordId);\n}\n\nasync function isSessionOpen(recordId: string): Promise<boolean> {\n const record = await readSessionRecord(recordId);\n if (!record || record.acpxRecordId !== recordId) {\n throw new SessionNotFoundError(recordId);\n }\n return record.closed !== true;\n}\n\nexport function watchSession(options: {\n record: SessionRecord | Promise<SessionRecord>;\n cursor?: string;\n signal?: AbortSignal;\n}): AsyncIterable<SessionWatchEvent> {\n return {\n [Symbol.asyncIterator]() {\n const observation: { missingRequest: string | null } = { missingRequest: null };\n return watchJournal({\n ...options,\n continueWatching: (record, requestId) =>\n continueWatching(record.acpxRecordId, requestId, observation),\n })[Symbol.asyncIterator]();\n },\n };\n}\n"],"mappings":";;AAWA,eAAe,iBACb,UACA,kBACA,aACkB;CAClB,MAAM,QAAQ,MAAM,qBAAqB,QAAQ;CACjD,IAAI,SAAS,eAAe,MAAM,GAAG,GAAG;EACtC,IAAI,CAAC,MAAM,cACT,MAAM,IAAI,kBACR,2BACA,yIACF;EAEF,YAAY,iBAAiB;EAC7B,OAAO;CACT;CACA,IAAI,oBAAoB,qBAAqB,YAAY,gBACvD,MAAM,IAAI,kBACR,yBACA,4DAA4D,iBAAiB,2HAC/E;CAEF,YAAY,iBAAiB;CAC7B,IAAI,kBACF,OAAO;CAET,OAAO,MAAM,cAAc,QAAQ;AACrC;AAEA,eAAe,cAAc,UAAoC;CAC/D,MAAM,SAAS,MAAM,kBAAkB,QAAQ;CAC/C,IAAI,CAAC,UAAU,OAAO,iBAAiB,UACrC,MAAM,IAAI,qBAAqB,QAAQ;CAEzC,OAAO,OAAO,WAAW;AAC3B;AAEA,SAAgB,aAAa,SAIQ;CACnC,OAAO,EACL,CAAC,OAAO,iBAAiB;EACvB,MAAM,cAAiD,EAAE,gBAAgB,KAAK;EAC9E,OAAOA,eAAa;GAClB,GAAG;GACH,mBAAmB,QAAQ,cACzB,iBAAiB,OAAO,cAAc,WAAW,WAAW;EAChE,CAAC,CAAC,CAAC,OAAO,cAAc,CAAC;CAC3B,EACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "acpx",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "Headless CLI client for the Agent Client Protocol (ACP) — talk to coding agents from the command line",
5
5
  "keywords": [
6
6
  "acp",
@@ -29,6 +29,7 @@ Core capabilities:
29
29
  - Prompt input via stdin or `--file`
30
30
  - Config files with global+project merge and `config show|init`
31
31
  - Session metadata/history inspection (`sessions show`, `sessions history`)
32
+ - Passive replay and live observation (`sessions watch -s <name> --cursor <cursor>`; omit the cursor for retained history)
32
33
  - Local agent process checks via `status`
33
34
  - Stable ACP client methods for filesystem and terminal requests
34
35
  - Stable ACP `authenticate` handshake via env/config credentials
@@ -62,7 +63,7 @@ acpx [global_options] cancel [-s <name>]
62
63
  acpx [global_options] set-mode <mode> [-s <name>]
63
64
  acpx [global_options] set <key> <value> [-s <name>]
64
65
  acpx [global_options] status [-s <name>]
65
- acpx [global_options] sessions [list | new [--name <name>] | ensure [--name <name>] | close [name] | show [name] | history [name] [--limit <count>] | export [name] --output <path> | import <archive> [--name <name>] [--cwd <dir>] | prune [--dry-run] [--before <date> | --older-than <days>] [--include-history]]
66
+ acpx [global_options] sessions [list | new [--name <name>] | ensure [--name <name>] | close [name] | show [name] | history [name] [--limit <count>] | watch [-s <name>] [--cursor <cursor>] | export [name] --output <path> | import <archive> [--name <name>] [--cwd <dir>] | prune [--dry-run] [--before <date> | --older-than <days>] [--include-history]]
66
67
  acpx [global_options] config [show | init]
67
68
  acpx [global_options] flow run <file> [--input-json '<json>' | --input-file <path>] [--default-agent <name>]
68
69
 
@@ -73,7 +74,7 @@ acpx [global_options] <agent> cancel [-s <name>]
73
74
  acpx [global_options] <agent> set-mode <mode> [-s <name>]
74
75
  acpx [global_options] <agent> set <key> <value> [-s <name>]
75
76
  acpx [global_options] <agent> status [-s <name>]
76
- acpx [global_options] <agent> sessions [list | new [--name <name>] | ensure [--name <name>] | close [name] | show [name] | history [name] [--limit <count>] | export [name] --output <path> | import <archive> [--name <name>] [--cwd <dir>] | prune [--dry-run] [--before <date> | --older-than <days>] [--include-history]]
77
+ acpx [global_options] <agent> sessions [list | new [--name <name>] | ensure [--name <name>] | close [name] | show [name] | history [name] [--limit <count>] | watch [-s <name>] [--cursor <cursor>] | export [name] --output <path> | import <archive> [--name <name>] [--cwd <dir>] | prune [--dry-run] [--before <date> | --older-than <days>] [--include-history]]
77
78
  ```
78
79
 
79
80
  If prompt text is omitted and stdin is piped, `acpx` reads prompt text from stdin.
@@ -211,6 +212,8 @@ Behavior:
211
212
 
212
213
  ### Sessions
213
214
 
215
+ Use `acpx --format json pi sessions watch -s reviewer` to observe another client's work. Resume with `--cursor` using the last event's opaque cursor. Watchers do not cancel turns when stopped; use `turn_result` for the settled outcome, and treat owner-loss errors as unknown outcomes rather than retry instructions. See [Watching sessions](https://github.com/openclaw/acpx/blob/main/docs/session-watch.md).
216
+
214
217
  ```bash
215
218
  acpx sessions
216
219
  acpx sessions list
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-5levcBIs.d.ts","names":[],"sources":["../src/acp/model-support.ts","../src/acp/client.ts"],"mappings":";;;KAGY;EACV;EACA;EACA,iBAAiB;IACf;IACA;;;cAaS;KAED,4CAA4C;cAE3C;KAKD,0CAA0C;cAEzC,uCAAuC;WACzC;WACA,QAAQ;EAEL,YAAA,iBAAiB,QAAQ;;iBAgBvB,iCACd,iBACC,SAAS;;;KCqJP;EACH;EACA;EACA;;KAGU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