@openclaw/acpx 2026.8.1-beta.2 → 2026.8.1

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/index.js CHANGED
@@ -1,14 +1,14 @@
1
- import { t as createAcpxRuntimeService } from "./register.runtime-C29AY8LI.js";
1
+ import { t as createAcpxRuntimeService } from "./register.runtime-DFRkXzZ_.js";
2
2
  import "./config-schema-DN_uAi4R.js";
3
- import { a as PI_SESSION_READ_COMMAND, i as PI_SESSIONS_LIST_COMMAND, o as PI_TERMINAL_RESUME_COMMAND, r as piSessionStoreAvailable } from "./pi-session-paths-DgYt8LUg.js";
3
+ import { a as PI_SESSIONS_CAPABILITY, c as PI_SESSION_READ_COMMAND, l as PI_TERMINAL_RESUME_COMMAND, o as PI_SESSIONS_LIST_COMMAND, r as piSessionStoreAvailable, s as PI_SESSION_ID_PATTERN } from "./pi-session-paths-EMbd4Hkz.js";
4
4
  import { tryDispatchAcpReplyHook } from "openclaw/plugin-sdk/acp-runtime-backend";
5
5
  import { finiteSecondsToTimerSafeMilliseconds } from "openclaw/plugin-sdk/number-runtime";
6
6
  import { createLazyRuntimeModule, createLazyRuntimeSurface } from "openclaw/plugin-sdk/lazy-runtime";
7
7
  import { resolveNodeHostExecutable } from "openclaw/plugin-sdk/node-host";
8
+ import { createSessionCatalogNodeHostBindings } from "openclaw/plugin-sdk/session-catalog";
8
9
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
9
10
  //#region extensions/acpx/src/pi-session-catalog-plugin.ts
10
- const PI_SESSIONS_CAPABILITY = "pi-sessions";
11
- const loadPiSessionCatalogModule = createLazyRuntimeModule(() => import("./pi-session-catalog-runtime-BiTQtT7s.js"));
11
+ const loadPiSessionCatalogModule = createLazyRuntimeModule(() => import("./pi-session-catalog-runtime-g6A6ADEf.js"));
12
12
  function fullConfigCatalogEnabled(config) {
13
13
  if (!isRecord(config) || !isRecord(config.plugins) || !isRecord(config.plugins.entries)) return true;
14
14
  const entry = config.plugins.entries.acpx;
@@ -18,54 +18,40 @@ function fullConfigCatalogEnabled(config) {
18
18
  function isPiSessionCatalogEnabled(pluginConfig) {
19
19
  return !isRecord(pluginConfig) || !isRecord(pluginConfig.piSessionCatalog) || pluginConfig.piSessionCatalog.enabled !== false;
20
20
  }
21
- function createPiSessionNodeHostCommands() {
21
+ function createPiSessionNodeHostBindings() {
22
22
  const storeAvailable = ({ config, env }) => fullConfigCatalogEnabled(config) && piSessionStoreAvailable(env);
23
- return [
24
- {
25
- command: PI_SESSIONS_LIST_COMMAND,
26
- cap: PI_SESSIONS_CAPABILITY,
27
- dangerous: false,
28
- isAvailable: storeAvailable,
29
- handle: async (paramsJSON) => await (await loadPiSessionCatalogModule()).listPiSessions(paramsJSON)
23
+ return createSessionCatalogNodeHostBindings({
24
+ capability: PI_SESSIONS_CAPABILITY,
25
+ listCommand: PI_SESSIONS_LIST_COMMAND,
26
+ readCommand: PI_SESSION_READ_COMMAND,
27
+ terminalCommand: PI_TERMINAL_RESUME_COMMAND,
28
+ sessionIdPattern: PI_SESSION_ID_PATTERN,
29
+ executable: "pi",
30
+ args: (threadId) => ["--session", threadId],
31
+ listAvailable: storeAvailable,
32
+ terminalAvailable: ({ config, env }) => storeAvailable({
33
+ config,
34
+ env
35
+ }) && Boolean(resolveNodeHostExecutable("pi", {
36
+ env,
37
+ pathEnv: env.PATH ?? env.Path ?? "",
38
+ strategy: "direct"
39
+ })),
40
+ parseParams: (paramsJSON) => {
41
+ if (!paramsJSON) return;
42
+ try {
43
+ return JSON.parse(paramsJSON);
44
+ } catch (error) {
45
+ throw new Error("Pi session parameters must be valid JSON", { cause: error });
46
+ }
30
47
  },
31
- {
32
- command: PI_SESSION_READ_COMMAND,
33
- cap: PI_SESSIONS_CAPABILITY,
34
- dangerous: false,
35
- isAvailable: storeAvailable,
36
- handle: async (paramsJSON) => await (await loadPiSessionCatalogModule()).readPiSession(paramsJSON)
37
- },
38
- {
39
- command: PI_TERMINAL_RESUME_COMMAND,
40
- cap: PI_SESSIONS_CAPABILITY,
41
- dangerous: false,
42
- duplex: true,
43
- isAvailable: ({ config, env }) => storeAvailable({
44
- config,
45
- env
46
- }) && Boolean(resolveNodeHostExecutable("pi", {
47
- env,
48
- pathEnv: env.PATH ?? env.Path ?? "",
49
- strategy: "direct"
50
- })),
51
- handle: async (paramsJSON, io) => await (await loadPiSessionCatalogModule()).resumePiSession(paramsJSON, io)
52
- }
53
- ];
54
- }
55
- function createPiSessionNodeInvokePolicies() {
56
- return [{
57
- commands: [
58
- PI_SESSIONS_LIST_COMMAND,
59
- PI_SESSION_READ_COMMAND,
60
- PI_TERMINAL_RESUME_COMMAND
61
- ],
62
- defaultPlatforms: [
63
- "macos",
64
- "linux",
65
- "windows"
66
- ],
67
- handle: (context) => context.command === "acpx.pi.terminal.resume.v1" ? { ok: true } : context.invokeNode()
68
- }];
48
+ list: async (params) => await (await loadPiSessionCatalogModule()).listPiSessions(params),
49
+ read: async (params) => await (await loadPiSessionCatalogModule()).readPiSession(params),
50
+ requireSession: async (threadId) => await (await loadPiSessionCatalogModule()).requireLocalPiSession(threadId),
51
+ terminalIoRequiredMessage: "Pi terminal command requires duplex transport",
52
+ terminalUnavailableMessage: "Pi CLI is unavailable",
53
+ invalidThreadIdMessage: "INVALID_REQUEST: threadId is invalid"
54
+ });
69
55
  }
70
56
  function registerPiSessionCatalog(api) {
71
57
  if (!isPiSessionCatalogEnabled(api.pluginConfig)) return;
@@ -80,8 +66,9 @@ function registerPiSessionCatalog(api) {
80
66
  checkUpstreamActivity: async (probes, policy) => await (await loadCatalogRuntime()).checkUpstreamActivity(probes, policy),
81
67
  openTerminal: async (request) => await (await loadCatalogRuntime()).openTerminal(request)
82
68
  });
83
- for (const command of createPiSessionNodeHostCommands()) api.registerNodeHostCommand(command);
84
- for (const policy of createPiSessionNodeInvokePolicies()) api.registerNodeInvokePolicy(policy);
69
+ const nodeHost = createPiSessionNodeHostBindings();
70
+ for (const command of nodeHost.commands) api.registerNodeHostCommand(command);
71
+ for (const policy of nodeHost.policies) api.registerNodeInvokePolicy(policy);
85
72
  }
86
73
  //#endregion
87
74
  //#region extensions/acpx/index.ts
@@ -118,7 +105,10 @@ const plugin = {
118
105
  pluginConfig: api.pluginConfig,
119
106
  openKeyedStore: (options) => api.runtime.state.openKeyedStore(options)
120
107
  }));
121
- api.on("reply_dispatch", (event, ctx) => tryDispatchAcpReplyHookWithTimeout(event, ctx, replyDispatchTimeoutMs), { timeoutMs: replyDispatchTimeoutMs });
108
+ api.on("reply_dispatch", (event, ctx) => tryDispatchAcpReplyHookWithTimeout(event, ctx, replyDispatchTimeoutMs), {
109
+ timeoutMs: replyDispatchTimeoutMs,
110
+ eligibleDispatchKinds: ["acp"]
111
+ });
122
112
  }
123
113
  };
124
114
  //#endregion