@openclaw/acpx 2026.7.2-beta.7 → 2026.7.33

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.
@@ -1,52 +1,4 @@
1
1
  import { createHash, randomUUID } from "node:crypto";
2
- //#region extensions/acpx/src/command-line.ts
3
- /**
4
- * Small shell-command helpers for ACPX-launched processes. Splitting supports
5
- * simple quoted command strings from config without invoking a shell parser.
6
- */
7
- /** Quote one command argument for display or config serialization. */
8
- function quoteCommandPart(value) {
9
- return JSON.stringify(value);
10
- }
11
- /** Split a command string into argv-like parts using simple quote/backslash rules. */
12
- function splitCommandParts(value) {
13
- const parts = [];
14
- let current = "";
15
- let quote = null;
16
- let escaping = false;
17
- for (const ch of value) {
18
- if (escaping) {
19
- current += ch;
20
- escaping = false;
21
- continue;
22
- }
23
- if (ch === "\\" && quote !== "'") {
24
- escaping = true;
25
- continue;
26
- }
27
- if (quote) {
28
- if (ch === quote) quote = null;
29
- else current += ch;
30
- continue;
31
- }
32
- if (ch === "'" || ch === "\"") {
33
- quote = ch;
34
- continue;
35
- }
36
- if (/\s/.test(ch)) {
37
- if (current) {
38
- parts.push(current);
39
- current = "";
40
- }
41
- continue;
42
- }
43
- current += ch;
44
- }
45
- if (escaping) current += "\\";
46
- if (current) parts.push(current);
47
- return parts;
48
- }
49
- //#endregion
50
2
  //#region extensions/acpx/src/state.ts
51
3
  const ACPX_PROCESS_LEASE_NAMESPACE = "process-leases";
52
4
  const ACPX_PROCESS_LEASE_MAX_ENTRIES = 4096;
@@ -70,23 +22,14 @@ function normalizeAcpxGatewayInstanceRecord(value) {
70
22
  * Persistent lease store for ACPX wrapper processes. Leases let OpenClaw attach
71
23
  * gateway/session identity to spawned ACP processes and clean them up later.
72
24
  */
73
- /** CLI argument carrying the ACPX process lease id. */
25
+ /** Environment variable carrying the ACPX process lease id. */
26
+ const OPENCLAW_ACPX_LEASE_ID_ENV = "OPENCLAW_ACPX_LEASE_ID";
27
+ /** Environment variable carrying the owning gateway instance id. */
28
+ const OPENCLAW_GATEWAY_INSTANCE_ID_ENV = "OPENCLAW_GATEWAY_INSTANCE_ID";
29
+ /** CLI argument carrying the ACPX process lease id for platforms without env wrapping. */
74
30
  const OPENCLAW_ACPX_LEASE_ID_ARG = "--openclaw-acpx-lease-id";
75
31
  /** CLI argument carrying the owning gateway instance id. */
76
32
  const OPENCLAW_GATEWAY_INSTANCE_ID_ARG = "--openclaw-gateway-instance-id";
77
- /** Read OpenClaw lease identity from a generated wrapper command. */
78
- function readAcpxProcessLeaseIdentity(command) {
79
- const parts = splitCommandParts(command?.trim() ?? "");
80
- const leaseIndex = parts.lastIndexOf(OPENCLAW_ACPX_LEASE_ID_ARG);
81
- const gatewayIndex = parts.lastIndexOf(OPENCLAW_GATEWAY_INSTANCE_ID_ARG);
82
- const leaseId = leaseIndex >= 0 ? parts[leaseIndex + 1]?.trim() : "";
83
- const gatewayInstanceId = gatewayIndex >= 0 ? parts[gatewayIndex + 1]?.trim() : "";
84
- if (!leaseId || !gatewayInstanceId) return;
85
- return {
86
- leaseId,
87
- gatewayInstanceId
88
- };
89
- }
90
33
  function normalizeAcpxProcessLease(value) {
91
34
  if (typeof value !== "object" || value === null) return;
92
35
  const record = value;
@@ -184,9 +127,15 @@ function appendAcpxLeaseArgs(params) {
184
127
  quoteEnvValue(params.gatewayInstanceId)
185
128
  ].join(" ");
186
129
  }
187
- /** Add ACPX lease identity to a command through portable wrapper arguments. */
130
+ /** Add ACPX lease identity to a command through env vars and portable args. */
188
131
  function withAcpxLeaseEnvironment(params) {
189
- return appendAcpxLeaseArgs(params);
132
+ if ((params.platform ?? process.platform) === "win32") return appendAcpxLeaseArgs(params);
133
+ return [
134
+ "env",
135
+ `${OPENCLAW_ACPX_LEASE_ID_ENV}=${quoteEnvValue(params.leaseId)}`,
136
+ `${OPENCLAW_GATEWAY_INSTANCE_ID_ENV}=${quoteEnvValue(params.gatewayInstanceId)}`,
137
+ appendAcpxLeaseArgs(params)
138
+ ].join(" ");
190
139
  }
191
140
  //#endregion
192
- export { splitCommandParts as _, hashAcpxProcessCommand as a, openAcpxProcessLeaseStateStore as c, ACPX_GATEWAY_INSTANCE_KEY as d, ACPX_GATEWAY_INSTANCE_NAMESPACE as f, quoteCommandPart as g, normalizeAcpxGatewayInstanceRecord as h, createAcpxProcessLeaseStore as i, readAcpxProcessLeaseIdentity as l, ACPX_LEGACY_PROCESS_LEASE_FILE as m, OPENCLAW_GATEWAY_INSTANCE_ID_ARG as n, normalizeAcpxProcessLease as o, ACPX_LEGACY_GATEWAY_INSTANCE_FILE as p, createAcpxProcessLeaseId as r, normalizeAcpxProcessLeaseFile as s, OPENCLAW_ACPX_LEASE_ID_ARG as t, withAcpxLeaseEnvironment as u };
141
+ export { createAcpxProcessLeaseStore as a, normalizeAcpxProcessLeaseFile as c, ACPX_GATEWAY_INSTANCE_KEY as d, ACPX_GATEWAY_INSTANCE_NAMESPACE as f, normalizeAcpxGatewayInstanceRecord as h, createAcpxProcessLeaseId as i, openAcpxProcessLeaseStateStore as l, ACPX_LEGACY_PROCESS_LEASE_FILE as m, OPENCLAW_ACPX_LEASE_ID_ENV as n, hashAcpxProcessCommand as o, ACPX_LEGACY_GATEWAY_INSTANCE_FILE as p, OPENCLAW_GATEWAY_INSTANCE_ID_ARG as r, normalizeAcpxProcessLease as s, OPENCLAW_ACPX_LEASE_ID_ARG as t, withAcpxLeaseEnvironment as u };
@@ -200,7 +200,7 @@ function createLazyAcpRuntimeProxy(resolveRuntime) {
200
200
  * immediately, then imports the heavier service only when a session needs it.
201
201
  */
202
202
  const ACPX_BACKEND_ID = "acpx";
203
- const loadServiceModule = createLazyRuntimeModule(() => import("./service-CBZSAymH.js"));
203
+ const loadServiceModule = createLazyRuntimeModule(() => import("./service-CE4bgxXH.mjs").then((n) => n.t));
204
204
  async function startRealService(state) {
205
205
  if (state.realRuntime) return state.realRuntime;
206
206
  if (!state.ctx) throw new Error("ACPX runtime service is not started");