acpx 0.19.4 → 0.19.5

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 (34) hide show
  1. package/dist/{cli-DCtHeMEi.js → cli-CQtZNbI4.js} +4 -4
  2. package/dist/{cli-DCtHeMEi.js.map → cli-CQtZNbI4.js.map} +1 -1
  3. package/dist/cli.d.ts +1 -1
  4. package/dist/cli.js +9 -9
  5. package/dist/cli.js.map +1 -1
  6. package/dist/{client-DqCXdF0Q.d.ts → client-zT_kgYGW.d.ts} +2 -2
  7. package/dist/{client-DqCXdF0Q.d.ts.map → client-zT_kgYGW.d.ts.map} +1 -1
  8. package/dist/{flows--1zpaEh9.js → flows-Clk_mTYy.js} +4 -4
  9. package/dist/{flows--1zpaEh9.js.map → flows-Clk_mTYy.js.map} +1 -1
  10. package/dist/flows.d.ts +2 -2
  11. package/dist/flows.js +1 -1
  12. package/dist/{invocation-options-CvkenzCc.js → invocation-options-iM1Cc2A1.js} +4 -4
  13. package/dist/{invocation-options-CvkenzCc.js.map → invocation-options-iM1Cc2A1.js.map} +1 -1
  14. package/dist/{ipc-D7zT86b9.js → ipc-C96eDxkW.js} +95 -14
  15. package/dist/ipc-C96eDxkW.js.map +1 -0
  16. package/dist/{output-lylSoEBd.js → output-DnEPVCtT.js} +71 -11
  17. package/dist/output-DnEPVCtT.js.map +1 -0
  18. package/dist/{queue-owner-runtime-C0wIYowh.js → queue-owner-runtime-DoijBCvt.js} +64 -22
  19. package/dist/queue-owner-runtime-DoijBCvt.js.map +1 -0
  20. package/dist/runtime.d.ts +2 -2
  21. package/dist/runtime.d.ts.map +1 -1
  22. package/dist/runtime.js +5 -3
  23. package/dist/runtime.js.map +1 -1
  24. package/dist/{session-options-X7LhX9BF.d.ts → session-options-CkcvthCv.d.ts} +2 -1
  25. package/dist/{session-options-X7LhX9BF.d.ts.map → session-options-CkcvthCv.d.ts.map} +1 -1
  26. package/dist/{session-watch-DPOwDRf8.js → session-watch-2CKSvPIS.js} +4 -4
  27. package/dist/{session-watch-DPOwDRf8.js.map → session-watch-2CKSvPIS.js.map} +1 -1
  28. package/dist/{watch-H7rNOJtv.js → watch-pnPd9LCw.js} +2 -2
  29. package/dist/{watch-H7rNOJtv.js.map → watch-pnPd9LCw.js.map} +1 -1
  30. package/package.json +4 -5
  31. package/skills/acpx/SKILL.md +2 -0
  32. package/dist/ipc-D7zT86b9.js.map +0 -1
  33. package/dist/output-lylSoEBd.js.map +0 -1
  34. package/dist/queue-owner-runtime-C0wIYowh.js.map +0 -1
@@ -261,6 +261,7 @@ type SessionAvailableCommand = {
261
261
  has_input?: boolean;
262
262
  };
263
263
  type SessionAcpxState = {
264
+ session_origin?: "new" | "resume";
264
265
  reset_on_next_ensure?: boolean;
265
266
  current_mode_id?: string;
266
267
  desired_mode_id?: string;
@@ -344,4 +345,4 @@ type SessionAgentOptions = {
344
345
  };
345
346
  //#endregion
346
347
  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 };
347
- //# sourceMappingURL=session-options-X7LhX9BF.d.ts.map
348
+ //# sourceMappingURL=session-options-CkcvthCv.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-options-X7LhX9BF.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;;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qB,SAAS;EAC/D,mBAAmB,cAAc;EACjC,qBAAqB,WAAW;EAChC,0BAA0B,OAAO;EACjC,sBAAsB;;cAGX;KACD;EACV;EACA;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;;;;KCpfL;EAAgC;;KAEhC;EACV;EACA;EACA;EACA,eAAe;;;;;;;;;;EAUf,MAAM"}
1
+ {"version":3,"file":"session-options-CkcvthCv.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;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qB,WAAW;EAChC,0BAA0B,OAAO;EACjC,sBAAsB;;cAGX;KACD;EACV;EACA;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;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;;;;KCrfL;EAAgC;;KAEhC;EACV;EACA;EACA;EACA,eAAe;;;;;;;;;;EAUf,MAAM"}
@@ -1,6 +1,6 @@
1
- import { i as JsonMessageSanitizer, t as createOutputFormatter } from "./output-lylSoEBd.js";
2
- import { ct as parsePromptStopReason, rt as isAcpJsonRpcMessage } from "./ipc-D7zT86b9.js";
3
- import { t as watchSession } from "./watch-H7rNOJtv.js";
1
+ import { i as JsonMessageSanitizer, t as createOutputFormatter } from "./output-DnEPVCtT.js";
2
+ import { it as isAcpJsonRpcMessage, lt as parsePromptStopReason } from "./ipc-C96eDxkW.js";
3
+ import { t as watchSession } from "./watch-pnPd9LCw.js";
4
4
  import { once } from "node:events";
5
5
  //#region src/cli/session-watch.ts
6
6
  function watchRenderer(policy) {
@@ -73,4 +73,4 @@ async function runSessionWatch(record, options) {
73
73
  //#endregion
74
74
  export { runSessionWatch };
75
75
 
76
- //# sourceMappingURL=session-watch-DPOwDRf8.js.map
76
+ //# sourceMappingURL=session-watch-2CKSvPIS.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-watch-DPOwDRf8.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 if (event.type === \"turn_result\") {\n formatter.flush();\n }\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.stdout.off(\"error\", onOutputError);\n }\n if (outputError) {\n throw outputError;\n }\n}\n"],"mappings":";;;;;AAQA,SAAS,cAAc,QAA8D;CACnF,MAAM,SAAmB,CAAC;CAC1B,MAAM,SAA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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"}
1
+ {"version":3,"file":"session-watch-2CKSvPIS.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 if (event.type === \"turn_result\") {\n formatter.flush();\n }\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.stdout.off(\"error\", onOutputError);\n }\n if (outputError) {\n throw outputError;\n }\n}\n"],"mappings":";;;;;AAQA,SAAS,cAAc,QAA8D;CACnF,MAAM,SAAmB,CAAC;CAC1B,MAAM,SAAS,EACb,QAAQ,UAAkB;EACxB,OAAO,KAAK,KAAK;CACnB,EACF;CACA,IAAI,YAAY,IAAI,qBAAqB,OAAO,eAAe,IAAI;CACnE,IAAI,YAAY,sBAAsB,OAAO,QAAQ,EAAE,OAAO,CAAC;CAC/D,QAAQ,UAAU;EAChB,OAAO,SAAS;EAChB,IAAI,MAAM,SAAS,gBAAgB;GACjC,YAAY,IAAI,qBAAqB,OAAO,eAAe,IAAI;GAC/D,YAAY,sBAAsB,OAAO,QAAQ,EAAE,OAAO,CAAC;EAC7D;EACA,IAAI,OAAO,WAAW,QACpB,OAAO,KACL,KAAK,UACH,MAAM,SAAS,YACX;GAAE,GAAG;GAAO,SAAS,UAAU,SAAS,MAAM,OAAO;EAAE,IACvD,KACN,IAAI,IACN;OACK,IAAI,MAAM,SAAS,WACxB,mBAAmB,OAAO,WAAW,WAAW,OAAO,WAAW,OAAO;OACpE;GACL,IAAI,MAAM,SAAS,eACjB,UAAU,MAAM;GAElB,IAAI,OAAO,WAAW,SACpB,OAAO,KAAK,mBAAmB,KAAK,CAAC;EAEzC;EACA,OAAO;CAC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V,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"}
@@ -1,4 +1,4 @@
1
- import { E as observeProcessIncarnation, J as watchSession$1, L as readSessionRecord, l as readQueueOwnerRecord, q as SessionWatchError, qt as SessionNotFoundError } from "./ipc-D7zT86b9.js";
1
+ import { E as observeProcessIncarnation, J as SessionWatchError, L as readSessionRecord, Y as watchSession$1, Zt as SessionNotFoundError, l as readQueueOwnerRecord } from "./ipc-C96eDxkW.js";
2
2
  //#region src/session/watch.ts
3
3
  const OWNER_OBSERVATION_REUSE_MS = 1e3;
4
4
  function reuseObservation(cached) {
@@ -82,4 +82,4 @@ function watchSession(options) {
82
82
  //#endregion
83
83
  export { watchSession as t };
84
84
 
85
- //# sourceMappingURL=watch-H7rNOJtv.js.map
85
+ //# sourceMappingURL=watch-pnPd9LCw.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"watch-H7rNOJtv.js","names":["watchJournal"],"sources":["../src/session/watch.ts"],"sourcesContent":["import { SessionNotFoundError } from \"../errors.js\";\nimport { observeProcessIncarnation, type ProcessIncarnation } from \"../process-identity.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, type QueueOwnerRecord } from \"./queue/lease-store.js\";\n\nconst OWNER_OBSERVATION_REUSE_MS = 1_000;\n\ntype WatchObservation = {\n ownerKey: string | null;\n incarnation?: { state: ProcessIncarnation; checkedAt: number; decisionPending: boolean };\n missingRequest: string | null;\n};\n\nfunction reuseObservation(cached: WatchObservation[\"incarnation\"]): boolean {\n if (!cached) {\n return false;\n }\n // A query first forces a journal reread, then gets one decision pass even\n // after a slow consumer. Otherwise repeated probes can defer errors forever.\n if (cached.decisionPending) {\n cached.decisionPending = false;\n return true;\n }\n return (\n cached.state === \"gone\" || performance.now() - cached.checkedAt < OWNER_OBSERVATION_REUSE_MS\n );\n}\n\nfunction selectOwner(owner: QueueOwnerRecord | undefined, observation: WatchObservation): boolean {\n // Heartbeats and retirement receipts do not change the owner's incarnation.\n // Keep only this small key, never the potentially large descendant receipt.\n const key = owner\n ? JSON.stringify([owner.pid, owner.ownerGeneration, owner.processIdentity])\n : null;\n if (key === observation.ownerKey) {\n return false;\n }\n observation.ownerKey = key;\n observation.incarnation = undefined;\n observation.missingRequest = null;\n return true;\n}\n\nasync function runningOwner(\n recordId: string,\n observation: WatchObservation,\n): Promise<{ owner?: QueueOwnerRecord; queried: boolean }> {\n let owner = await readQueueOwnerRecord(recordId);\n selectOwner(owner, observation);\n if (!owner) {\n return { queried: false };\n }\n const cached = observation.incarnation;\n let queried = false;\n // A verified departed incarnation cannot return. Cache that fact even for\n // idle watches; other observations are bounded independently of journal polls.\n if (!reuseObservation(cached)) {\n queried = true;\n // Observation cadence must not truncate the canonical provider's query budget.\n const state = await observeProcessIncarnation(owner.pid, owner.processIdentity);\n owner = await readQueueOwnerRecord(recordId);\n if (selectOwner(owner, observation)) {\n // A replacement may have settled or recovered the journal during the\n // query. Let the reader revisit it before interpreting the old result.\n return { owner, queried };\n }\n observation.incarnation = { state, checkedAt: performance.now(), decisionPending: true };\n }\n return { owner: observation.incarnation?.state === \"gone\" ? undefined : owner, queried };\n}\n\nasync function continueWatching(\n recordId: string,\n pendingRequestId: string | null,\n observation: WatchObservation,\n): Promise<boolean> {\n const { owner, queried } = await runningOwner(recordId, observation);\n if (queried) {\n // A probe can outlast a journal update, including replacement by an older\n // owner. Revisit the journal before any unsupported/unknown/end decision.\n observation.missingRequest = owner ? null : pendingRequestId;\n return true;\n }\n if (owner) {\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: WatchObservation = { ownerKey: 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,MAAM,6BAA6B;AAQnC,SAAS,iBAAiB,QAAkD;CAC1E,IAAI,CAAC,QACH,OAAO;CAIT,IAAI,OAAO,iBAAiB;EAC1B,OAAO,kBAAkB;EACzB,OAAO;CACT;CACA,OACE,OAAO,UAAU,UAAU,YAAY,IAAI,IAAI,OAAO,YAAY;AAEtE;AAEA,SAAS,YAAY,OAAqC,aAAwC;CAGhG,MAAM,MAAM,QACR,KAAK,UAAU;EAAC,MAAM;EAAK,MAAM;EAAiB,MAAM;CAAe,CAAC,IACxE;CACJ,IAAI,QAAQ,YAAY,UACtB,OAAO;CAET,YAAY,WAAW;CACvB,YAAY,cAAc,KAAA;CAC1B,YAAY,iBAAiB;CAC7B,OAAO;AACT;AAEA,eAAe,aACb,UACA,aACyD;CACzD,IAAI,QAAQ,MAAM,qBAAqB,QAAQ;CAC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ClB,GAAG;GACH,mBAAmB,QAAQ,cACzB,iBAAiB,OAAO,cAAc,WAAW,WAAW;EAChE,CAAC,CAAC,CAAC,OAAO,cAAc,CAAC;CAC3B,EACF;AACF"}
1
+ {"version":3,"file":"watch-pnPd9LCw.js","names":["watchJournal"],"sources":["../src/session/watch.ts"],"sourcesContent":["import { SessionNotFoundError } from \"../errors.js\";\nimport { observeProcessIncarnation, type ProcessIncarnation } from \"../process-identity.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, type QueueOwnerRecord } from \"./queue/lease-store.js\";\n\nconst OWNER_OBSERVATION_REUSE_MS = 1_000;\n\ntype WatchObservation = {\n ownerKey: string | null;\n incarnation?: { state: ProcessIncarnation; checkedAt: number; decisionPending: boolean };\n missingRequest: string | null;\n};\n\nfunction reuseObservation(cached: WatchObservation[\"incarnation\"]): boolean {\n if (!cached) {\n return false;\n }\n // A query first forces a journal reread, then gets one decision pass even\n // after a slow consumer. Otherwise repeated probes can defer errors forever.\n if (cached.decisionPending) {\n cached.decisionPending = false;\n return true;\n }\n return (\n cached.state === \"gone\" || performance.now() - cached.checkedAt < OWNER_OBSERVATION_REUSE_MS\n );\n}\n\nfunction selectOwner(owner: QueueOwnerRecord | undefined, observation: WatchObservation): boolean {\n // Heartbeats and retirement receipts do not change the owner's incarnation.\n // Keep only this small key, never the potentially large descendant receipt.\n const key = owner\n ? JSON.stringify([owner.pid, owner.ownerGeneration, owner.processIdentity])\n : null;\n if (key === observation.ownerKey) {\n return false;\n }\n observation.ownerKey = key;\n observation.incarnation = undefined;\n observation.missingRequest = null;\n return true;\n}\n\nasync function runningOwner(\n recordId: string,\n observation: WatchObservation,\n): Promise<{ owner?: QueueOwnerRecord; queried: boolean }> {\n let owner = await readQueueOwnerRecord(recordId);\n selectOwner(owner, observation);\n if (!owner) {\n return { queried: false };\n }\n const cached = observation.incarnation;\n let queried = false;\n // A verified departed incarnation cannot return. Cache that fact even for\n // idle watches; other observations are bounded independently of journal polls.\n if (!reuseObservation(cached)) {\n queried = true;\n // Observation cadence must not truncate the canonical provider's query budget.\n const state = await observeProcessIncarnation(owner.pid, owner.processIdentity);\n owner = await readQueueOwnerRecord(recordId);\n if (selectOwner(owner, observation)) {\n // A replacement may have settled or recovered the journal during the\n // query. Let the reader revisit it before interpreting the old result.\n return { owner, queried };\n }\n observation.incarnation = { state, checkedAt: performance.now(), decisionPending: true };\n }\n return { owner: observation.incarnation?.state === \"gone\" ? undefined : owner, queried };\n}\n\nasync function continueWatching(\n recordId: string,\n pendingRequestId: string | null,\n observation: WatchObservation,\n): Promise<boolean> {\n const { owner, queried } = await runningOwner(recordId, observation);\n if (queried) {\n // A probe can outlast a journal update, including replacement by an older\n // owner. Revisit the journal before any unsupported/unknown/end decision.\n observation.missingRequest = owner ? null : pendingRequestId;\n return true;\n }\n if (owner) {\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: WatchObservation = { ownerKey: 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,MAAM,6BAA6B;AAQnC,SAAS,iBAAiB,QAAkD;CAC1E,IAAI,CAAC,QACH,OAAO;CAIT,IAAI,OAAO,iBAAiB;EAC1B,OAAO,kBAAkB;EACzB,OAAO;CACT;CACA,OACE,OAAO,UAAU,UAAU,YAAY,IAAI,IAAI,OAAO,YAAY;AAEtE;AAEA,SAAS,YAAY,OAAqC,aAAwC;CAGhG,MAAM,MAAM,QACR,KAAK,UAAU;EAAC,MAAM;EAAK,MAAM;EAAiB,MAAM;CAAe,CAAC,IACxE;CACJ,IAAI,QAAQ,YAAY,UACtB,OAAO;CAET,YAAY,WAAW;CACvB,YAAY,cAAc,KAAA;CAC1B,YAAY,iBAAiB;CAC7B,OAAO;AACT;AAEA,eAAe,aACb,UACA,aACyD;CACzD,IAAI,QAAQ,MAAM,qBAAqB,QAAQ;CAC/C,YAAY,OAAO,WAAW;CAC9B,IAAI,CAAC,OACH,OAAO,EAAE,SAAS,MAAM;CAE1B,MAAM,SAAS,YAAY;CAC3B,IAAI,UAAU;CAGd,IAAI,CAAC,iBAAiB,MAAM,GAAG;EAC7B,UAAU;EAEV,MAAM,QAAQ,MAAM,0BAA0B,MAAM,KAAK,MAAM,eAAe;EAC9E,QAAQ,MAAM,qBAAqB,QAAQ;EAC3C,IAAI,YAAY,OAAO,WAAW,GAGhC,OAAO;GAAE;GAAO;EAAQ;EAE1B,YAAY,cAAc;GAAE;GAAO,WAAW,YAAY,IAAI;GAAG,iBAAiB;EAAK;CACzF;CACA,OAAO;EAAE,OAAO,YAAY,aAAa,UAAU,SAAS,KAAA,IAAY;EAAO;CAAQ;AACzF;AAEA,eAAe,iBACb,UACA,kBACA,aACkB;CAClB,MAAM,EAAE,OAAO,YAAY,MAAM,aAAa,UAAU,WAAW;CACnE,IAAI,SAAS;EAGX,YAAY,iBAAiB,QAAQ,OAAO;EAC5C,OAAO;CACT;CACA,IAAI,OAAO;EACT,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,cAAgC;GAAE,UAAU;GAAM,gBAAgB;EAAK;EAC7E,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.19.4",
3
+ "version": "0.19.5",
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",
@@ -39,7 +39,7 @@
39
39
  "build": "tsdown src/cli.ts src/flows.ts src/runtime.ts src/agent-registry.ts --format esm --dts --clean --platform node --target node22 --no-fixedExtension",
40
40
  "build:quiet": "tsdown --logLevel silent src/cli.ts src/flows.ts src/runtime.ts src/agent-registry.ts --format esm --dts --clean --platform node --target node22 --no-fixedExtension",
41
41
  "build:test": "node -e \"require('node:fs').rmSync('dist-test',{recursive:true,force:true})\" && tsc -p tsconfig.test.json",
42
- "check": "pnpm run format:check && pnpm run typecheck && pnpm run lint && pnpm run build && pnpm run viewer:typecheck && pnpm run viewer:build && pnpm run test:coverage && pnpm run test:autoreview",
42
+ "check": "pnpm run format:check && pnpm run typecheck && pnpm run lint && pnpm run build && pnpm run viewer:typecheck && pnpm run viewer:build && pnpm run test:coverage",
43
43
  "check:changed": "pnpm run check",
44
44
  "check:docs": "pnpm run format:docs:check && pnpm run lint:docs && pnpm run docs:site",
45
45
  "check:mutation": "pnpm run mutate",
@@ -66,7 +66,6 @@
66
66
  "prepack": "tsdown --logLevel silent src/cli.ts src/flows.ts src/runtime.ts src/agent-registry.ts --format esm --dts --clean --platform node --target node22 --no-fixedExtension",
67
67
  "prepare": "husky",
68
68
  "test": "pnpm run build && pnpm run build:test && node --test --test-concurrency=4 dist-test/test/*.test.js",
69
- "test:autoreview": "python -I -B scripts/check-autoreview.py",
70
69
  "test:changed": "pnpm run test:coverage",
71
70
  "test:coverage": "pnpm run build && pnpm run build:test && node --test --test-concurrency=4 dist-test/test/*.test.js && c8 --all --check-coverage --lines 85 --branches 85 --functions 85 --statements 85 --include 'dist-test/src/flows/authoring.js' --include 'dist-test/src/flows/decision.js' --include 'dist-test/src/flows/definition.js' --include 'dist-test/src/flows/json.js' --include 'dist-test/src/flows/schema.js' --include 'dist-test/src/flows/store.js' --include 'dist-test/src/runtime/public/**/*.js' --include 'dist-test/src/runtime/engine/manager.js' --include 'dist-test/src/runtime/engine/status.js' --exclude 'dist-test/test/**/*.js' --exclude 'dist/**/*.js' node --test dist-test/test/flows.test.js dist-test/test/flows-store.test.js dist-test/test/runtime.test.js dist-test/test/runtime-events.test.js dist-test/test/runtime-manager.test.js dist-test/test/runtime-probe.test.js",
72
71
  "test:live": "pnpm run build:test && node --test dist-test/test/cursor-live.integration.js",
@@ -83,7 +82,7 @@
83
82
  },
84
83
  "dependencies": {
85
84
  "@agentclientprotocol/sdk": "^1.5.0",
86
- "@openclaw/fs-safe": "^0.21.1",
85
+ "@openclaw/fs-safe": "^0.22.0",
87
86
  "commander": "^15.0.0",
88
87
  "skillflag": "^0.2.1",
89
88
  "tsx": "^4.23.15",
@@ -105,7 +104,7 @@
105
104
  "husky": "^9.1.7",
106
105
  "lint-staged": "^17.5.1",
107
106
  "markdownlint-cli2": "^0.23.3",
108
- "oxfmt": "^0.71.0",
107
+ "oxfmt": "^0.72.0",
109
108
  "oxlint": "^1.85.0",
110
109
  "oxlint-tsgolint": "^7.0.2002",
111
110
  "react": "^19.3.0",
@@ -132,6 +132,8 @@ Use `prepareFreshSession({ handle })` to persist a fresh-session request across
132
132
 
133
133
  Embedded controls save accepted settings with the current conversation. Turn finalization and one-shot cleanup wait for admitted controls, preserving final output, usage, and selections in the saved session. Ordinary `close` can return before active prompt cancellation finishes; the later save preserves its close/reset markers.
134
134
 
135
+ An unprompted persistent session recorded as created through `session/new` may be replaced after an ACP internal load/resume error (`-32603`) so its first prompt or control can run with saved preferences. Explicit native resumes, older records without creation provenance, earlier prompts (including cancelled turns), agent output, legacy resume markers, or imported provenance forbid this recovery; an unsupported or missing session still fails with `SESSION_RESUME_REQUIRED`.
136
+
135
137
  For persistent sessions, compatible `ensureSession` calls may reuse an active record, including from permission callbacks during control reconnects. Changing its working directory, adapter invocation, or resume identity while turns or controls remain unfinished rejects with `ACP_SESSION_INIT_FAILED`; await that work or use a different key. After an active close, await its turn result before reopening. Idle replacement retires the old owner before initializing the successor; other records and distinct one-shot sessions remain independent.
136
138
 
137
139
  For installed entrypoints and prerequisites, read the matching [agent guide](https://github.com/openclaw/acpx/tree/main/agents). For resolver callbacks, custom command overrides, and lifecycle details, read [embedded agent discovery](https://github.com/openclaw/acpx/blob/main/docs/session-control.md#embedded-agent-discovery).