@openclaw/acpx 2026.7.2-beta.2 → 2026.7.2-beta.3

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,10 +1,11 @@
1
- import { t as createAcpxRuntimeService } from "./register.runtime-CysfMsSr.js";
1
+ import { t as createAcpxRuntimeService } from "./register.runtime-BrVpU-xc.js";
2
2
  import "./config-schema-lrk5nlcV.js";
3
3
  import { tryDispatchAcpReplyHook } from "openclaw/plugin-sdk/acp-runtime-backend";
4
4
  import { finiteSecondsToTimerSafeMilliseconds } from "openclaw/plugin-sdk/number-runtime";
5
5
  import process$1 from "node:process";
6
6
  import { decodeNodePtyResumeParams, resolveNodeHostExecutable, runNodePtyCommand } from "openclaw/plugin-sdk/node-host";
7
7
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
8
+ import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
8
9
  import { createReadStream, readFileSync, statSync } from "node:fs";
9
10
  import fs$1 from "node:fs/promises";
10
11
  import path from "node:path";
@@ -534,7 +535,7 @@ function isoTimestamp(message, entry) {
534
535
  function jsonText(value, maxLength = 2e4) {
535
536
  try {
536
537
  const text = JSON.stringify(value);
537
- return text.length > maxLength ? `${text.slice(0, maxLength)}…` : text;
538
+ return text.length > maxLength ? `${truncateUtf16Safe(text, maxLength)}…` : text;
538
539
  } catch {
539
540
  return;
540
541
  }
@@ -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-DJchyiuU.js"));
203
+ const loadServiceModule = createLazyRuntimeModule(() => import("./service-D6LQXIcJ.js"));
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");
@@ -1,2 +1,2 @@
1
- import { t as createAcpxRuntimeService } from "./register.runtime-CysfMsSr.js";
1
+ import { t as createAcpxRuntimeService } from "./register.runtime-BrVpU-xc.js";
2
2
  export { createAcpxRuntimeService };
@@ -3,12 +3,12 @@ import { AcpRuntimeError } from "./runtime-api.js";
3
3
  import { c as splitCommandParts, f as OPENCLAW_CODEX_CONFIG_ARG, n as isOpenClawLeaseAwareAcpxProcessCommand, t as cleanupOpenClawOwnedAcpxProcessTree, u as CODEX_ACP_PACKAGE } from "./process-reaper-CoGRyMJ_.js";
4
4
  import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
5
5
  import { normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
6
+ import { sliceUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
6
7
  import fs from "node:fs/promises";
7
8
  import path, { resolve } from "node:path";
8
9
  import { AsyncLocalStorage } from "node:async_hooks";
9
10
  import { ACPX_BACKEND_ID, AcpxRuntime as AcpxRuntime$1, createAcpRuntime, createAgentRegistry, createFileSessionStore, decodeAcpxRuntimeHandleState, encodeAcpxRuntimeHandleState, isRequestedModelUnsupportedError } from "acpx/runtime";
10
11
  import { redactSensitiveText } from "openclaw/plugin-sdk/security-runtime";
11
- import { sliceUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
12
12
  //#region extensions/acpx/src/runtime.ts
13
13
  /**
14
14
  * OpenClaw ACPX runtime adapter. It wraps the upstream acpx runtime with
@@ -166,12 +166,6 @@ const OPENCLAW_BRIDGE_SUBCOMMAND = "acp";
166
166
  const CODEX_ACP_AGENT_ID = "codex";
167
167
  const CODEX_ACP_OPENCLAW_PREFIX = "openai/";
168
168
  const CLAUDE_ACP_OPENCLAW_PREFIX = "anthropic/";
169
- const CODEX_ACP_REASONING_EFFORTS = /* @__PURE__ */ new Set([
170
- "low",
171
- "medium",
172
- "high",
173
- "xhigh"
174
- ]);
175
169
  const CODEX_ACP_THINKING_ALIASES = /* @__PURE__ */ new Map([
176
170
  ["off", void 0],
177
171
  ["minimal", "low"],
@@ -286,24 +280,51 @@ function normalizeCodexAcpReasoningEffort(rawThinking) {
286
280
  if (!CODEX_ACP_THINKING_ALIASES.has(normalized)) failUnsupportedCodexAcpThinking(rawThinking ?? "");
287
281
  return CODEX_ACP_THINKING_ALIASES.get(normalized);
288
282
  }
289
- function normalizeCodexAcpModelOverride(rawModel, rawThinking) {
283
+ function isCodexAcpReasoningEffortAlias(value) {
284
+ const normalized = value?.trim().toLowerCase();
285
+ return Boolean(normalized && CODEX_ACP_THINKING_ALIASES.has(normalized));
286
+ }
287
+ function classifyCodexAcpModelRequest(rawModel, rawThinking) {
290
288
  const raw = rawModel?.trim();
291
289
  const thinkingReasoningEffort = normalizeCodexAcpReasoningEffort(rawThinking);
292
- if (!raw) return thinkingReasoningEffort ? { reasoningEffort: thinkingReasoningEffort } : void 0;
290
+ const thinkingOnlyOverride = thinkingReasoningEffort ? { reasoningEffort: thinkingReasoningEffort } : void 0;
291
+ if (!raw) return {
292
+ kind: "override",
293
+ override: thinkingOnlyOverride ?? {}
294
+ };
293
295
  let value = raw;
294
- if (value.toLowerCase().startsWith(CODEX_ACP_OPENCLAW_PREFIX)) value = value.slice(7);
295
- const parts = value.split("/");
296
- if (parts.length > 2) failUnsupportedCodexAcpModel(raw, `Codex ACP model "${raw}" is not supported. Use openai/<model> or <model>/<reasoning-effort>.`);
297
- const model = (parts[0] ?? "").trim();
298
- const modelReasoningEffort = normalizeCodexAcpReasoningEffort(parts[1]);
299
- if (!model) failUnsupportedCodexAcpModel(raw, `Codex ACP model "${raw}" is not supported. Use openai/<model> or <model>/<reasoning-effort>.`);
296
+ let hadOpenAiQualifier = false;
297
+ if (value.toLowerCase().startsWith(CODEX_ACP_OPENCLAW_PREFIX)) {
298
+ value = value.slice(7);
299
+ hadOpenAiQualifier = true;
300
+ }
301
+ let model = value.trim();
302
+ let modelReasoningEffort;
303
+ const slashIndex = value.lastIndexOf("/");
304
+ if (slashIndex >= 0 && isCodexAcpReasoningEffortAlias(value.slice(slashIndex + 1))) {
305
+ modelReasoningEffort = normalizeCodexAcpReasoningEffort(value.slice(slashIndex + 1));
306
+ model = value.slice(0, slashIndex).trim();
307
+ }
308
+ if (hadOpenAiQualifier && (!model || model.includes("/"))) failUnsupportedCodexAcpModel(raw, `Codex ACP model "${raw}" is not supported. Use openai/<model> or <model>/<reasoning-effort>.`);
309
+ if (!model || model.includes("/")) return thinkingOnlyOverride ? {
310
+ kind: "unsupported",
311
+ thinkingOverride: thinkingOnlyOverride
312
+ } : { kind: "unsupported" };
300
313
  const reasoningEffort = thinkingReasoningEffort ?? modelReasoningEffort;
301
- if (reasoningEffort && !CODEX_ACP_REASONING_EFFORTS.has(reasoningEffort)) failUnsupportedCodexAcpThinking(reasoningEffort);
302
314
  return {
303
- model,
304
- ...reasoningEffort ? { reasoningEffort } : {}
315
+ kind: "override",
316
+ override: {
317
+ model,
318
+ ...reasoningEffort ? { reasoningEffort } : {}
319
+ }
305
320
  };
306
321
  }
322
+ function withCodexSessionModel(input, override) {
323
+ const next = { ...input };
324
+ if (override?.model) next.model = override.model;
325
+ else delete next.model;
326
+ return next;
327
+ }
307
328
  function normalizeClaudeAcpModelOverride(rawModel) {
308
329
  const raw = rawModel?.trim();
309
330
  if (!raw) return;
@@ -317,8 +338,9 @@ function withAcpxSessionOptions(input) {
317
338
  ...existingOptions,
318
339
  model
319
340
  } : existingOptions;
341
+ const { modelExplicit: _modelExplicit, ...rest } = input;
320
342
  return {
321
- ...input,
343
+ ...rest,
322
344
  ...sessionOptions ? { sessionOptions } : {}
323
345
  };
324
346
  }
@@ -617,9 +639,18 @@ var AcpxRuntime = class {
617
639
  command,
618
640
  sessionKey: input.sessionKey
619
641
  });
642
+ const isCodexAcp = normalizeAgentName(input.agent) === CODEX_ACP_AGENT_ID && isCodexAcpCommand(command);
620
643
  const claudeModelOverride = isClaudeAcpCommand(command) ? normalizeClaudeAcpModelOverride(input.model) : void 0;
621
- const codexModelOverride = normalizeAgentName(input.agent) === CODEX_ACP_AGENT_ID && isCodexAcpCommand(command) ? normalizeCodexAcpModelOverride(input.model, input.thinking) : void 0;
622
- const ensureInput = claudeModelOverride ? {
644
+ const codexClassification = isCodexAcp ? classifyCodexAcpModelRequest(input.model, input.thinking) : void 0;
645
+ if (codexClassification?.kind === "unsupported" && input.modelExplicit) failUnsupportedCodexAcpModel(input.model ?? "");
646
+ const classifiedCodexOverride = codexClassification?.kind === "override" ? codexClassification.override : codexClassification?.thinkingOverride;
647
+ const codexModelOverride = classifiedCodexOverride && Object.keys(classifiedCodexOverride).length > 0 ? classifiedCodexOverride : void 0;
648
+ const requestedModel = input.model?.trim();
649
+ const appliedModel = isCodexAcp && requestedModel ? codexModelOverride?.model ? {
650
+ kind: "applied",
651
+ model: requestedModel
652
+ } : { kind: "dropped" } : void 0;
653
+ const ensureInput = isCodexAcp ? withCodexSessionModel(input, codexModelOverride) : claudeModelOverride ? {
623
654
  ...input,
624
655
  model: claudeModelOverride
625
656
  } : input;
@@ -631,7 +662,7 @@ var AcpxRuntime = class {
631
662
  command: stableLaunchCommand,
632
663
  resumeSessionId: input.resumeSessionId
633
664
  });
634
- if (!codexModelOverride) return await this.runWithLaunchLease({
665
+ const handle = !codexModelOverride ? await this.runWithLaunchLease({
635
666
  sessionKey: ensureInput.sessionKey,
636
667
  command: stableLaunchCommand,
637
668
  enabled: shouldStartWithLease,
@@ -640,21 +671,20 @@ var AcpxRuntime = class {
640
671
  fallbackCode: "ACP_SESSION_INIT_FAILED",
641
672
  run: () => ensureDelegateSessionWithModelFallback(delegate, ensureInput)
642
673
  })
643
- });
644
- const normalizedInput = {
645
- ...ensureInput,
646
- ...codexModelOverride.model ? { model: codexModelOverride.model } : {}
647
- };
648
- return await this.runWithLaunchLease({
674
+ }) : await this.runWithLaunchLease({
649
675
  sessionKey: input.sessionKey,
650
676
  command: stableLaunchCommand,
651
677
  enabled: shouldStartWithLease,
652
678
  run: () => this.codexAcpModelOverrideScope.run(codexModelOverride, () => this.withCodexWrapperDiagnostics({
653
679
  command: stableLaunchCommand,
654
680
  fallbackCode: "ACP_SESSION_INIT_FAILED",
655
- run: () => delegate.ensureSession(withAcpxSessionOptions(normalizedInput))
681
+ run: () => delegate.ensureSession(withAcpxSessionOptions(ensureInput))
656
682
  }))
657
683
  });
684
+ return appliedModel ? {
685
+ ...handle,
686
+ appliedModel
687
+ } : handle;
658
688
  }
659
689
  async *runTurn(input) {
660
690
  const command = await this.resolveCommandForHandle(input.handle);
@@ -771,22 +801,32 @@ var AcpxRuntime = class {
771
801
  const isCodexAcp = isCodexAcpCommand(command);
772
802
  if (WIRE_TIMEOUT_CONFIG_KEYS.has(key) && (isCodexAcp || isClaudeAcpCommand(command))) return;
773
803
  if (isCodexAcp) {
774
- if (key === "model" || key === "thinking" || key === "thought_level" || key === "reasoning_effort") {
775
- const override = key === "model" ? normalizeCodexAcpModelOverride(input.value) : normalizeCodexAcpModelOverride(void 0, input.value);
776
- if (!override && key !== "model") return;
777
- if (override) {
778
- if (override.model) await delegate.setConfigOption({
779
- ...input,
780
- key: "model",
781
- value: override.model
782
- });
783
- if (override.reasoningEffort) await delegate.setConfigOption({
784
- ...input,
785
- key: "reasoning_effort",
786
- value: override.reasoningEffort
787
- });
788
- return;
789
- }
804
+ if (key === "model") {
805
+ const classification = classifyCodexAcpModelRequest(input.value);
806
+ if (classification.kind === "unsupported") failUnsupportedCodexAcpModel(input.value);
807
+ const { override } = classification;
808
+ if (override.model) await delegate.setConfigOption({
809
+ ...input,
810
+ key: "model",
811
+ value: override.model
812
+ });
813
+ if (override.reasoningEffort) await delegate.setConfigOption({
814
+ ...input,
815
+ key: "reasoning_effort",
816
+ value: override.reasoningEffort
817
+ });
818
+ return;
819
+ }
820
+ if (key === "thinking" || key === "thought_level" || key === "reasoning_effort") {
821
+ const classification = classifyCodexAcpModelRequest(void 0, input.value);
822
+ const reasoningEffort = classification.kind === "override" ? classification.override.reasoningEffort : void 0;
823
+ if (!reasoningEffort) return;
824
+ await delegate.setConfigOption({
825
+ ...input,
826
+ key: "reasoning_effort",
827
+ value: reasoningEffort
828
+ });
829
+ return;
790
830
  }
791
831
  }
792
832
  if (isClaudeAcpCommand(command) && key === "model") {
@@ -827,10 +867,10 @@ var AcpxRuntime = class {
827
867
  const testing = {
828
868
  appendCodexAcpConfigOverrides,
829
869
  assertSupportedRuntimeSessionMode,
870
+ classifyCodexAcpModelRequest,
830
871
  isClaudeAcpCommand,
831
872
  isCodexAcpCommand,
832
- normalizeClaudeAcpModelOverride,
833
- normalizeCodexAcpModelOverride
873
+ normalizeClaudeAcpModelOverride
834
874
  };
835
875
  //#endregion
836
876
  export { ACPX_BACKEND_ID, AcpxRuntime, testing as __testing, testing, createAcpRuntime, createAgentRegistry, createFileSessionStore, decodeAcpxRuntimeHandleState, encodeAcpxRuntimeHandleState };
@@ -1,4 +1,4 @@
1
- import { n as createLazyAcpRuntimeProxy } from "./register.runtime-CysfMsSr.js";
1
+ import { n as createLazyAcpRuntimeProxy } from "./register.runtime-BrVpU-xc.js";
2
2
  import "./config-schema-lrk5nlcV.js";
3
3
  import { a as createAcpxProcessLeaseStore, d as ACPX_GATEWAY_INSTANCE_KEY, f as ACPX_GATEWAY_INSTANCE_NAMESPACE, h as normalizeAcpxGatewayInstanceRecord, l as openAcpxProcessLeaseStateStore, n as OPENCLAW_ACPX_LEASE_ID_ENV, r as OPENCLAW_GATEWAY_INSTANCE_ID_ARG, t as OPENCLAW_ACPX_LEASE_ID_ARG } from "./process-lease-DiKkFj6F.js";
4
4
  import { registerAcpRuntimeBackend, unregisterAcpRuntimeBackend } from "./runtime-api.js";
@@ -1027,7 +1027,7 @@ async function prepareAcpxCodexAuthConfig(params) {
1027
1027
  const ENABLE_STARTUP_PROBE_ENV = "OPENCLAW_ACPX_RUNTIME_STARTUP_PROBE";
1028
1028
  const SKIP_RUNTIME_PROBE_ENV = "OPENCLAW_SKIP_ACPX_RUNTIME_PROBE";
1029
1029
  const ACPX_BACKEND_ID = "acpx";
1030
- const loadRuntimeModule = createLazyRuntimeModule(() => import("./runtime-BEOGc4Ik.js"));
1030
+ const loadRuntimeModule = createLazyRuntimeModule(() => import("./runtime-CMARmJuS.js"));
1031
1031
  /** Convert ACPX timeout seconds into timer-safe milliseconds. */
1032
1032
  function resolveAcpxTimerTimeoutMs(timeoutSeconds) {
1033
1033
  if (timeoutSeconds === void 0) return;
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@openclaw/acpx",
3
- "version": "2026.7.2-beta.2",
3
+ "version": "2026.7.2-beta.3",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/acpx",
9
- "version": "2026.7.2-beta.2",
9
+ "version": "2026.7.2-beta.3",
10
10
  "dependencies": {
11
11
  "@agentclientprotocol/claude-agent-acp": "0.55.0",
12
12
  "@agentclientprotocol/codex-acp": "1.1.2",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/acpx",
3
- "version": "2026.7.2-beta.2",
3
+ "version": "2026.7.2-beta.3",
4
4
  "description": "OpenClaw ACP runtime backend with plugin-owned session and transport management.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,10 +27,10 @@
27
27
  "minHostVersion": ">=2026.4.25"
28
28
  },
29
29
  "compat": {
30
- "pluginApi": ">=2026.7.2-beta.2"
30
+ "pluginApi": ">=2026.7.2-beta.3"
31
31
  },
32
32
  "build": {
33
- "openclawVersion": "2026.7.2-beta.2",
33
+ "openclawVersion": "2026.7.2-beta.3",
34
34
  "staticAssets": [
35
35
  {
36
36
  "source": "./src/runtime-internals/mcp-proxy.mjs",
@@ -59,7 +59,7 @@
59
59
  "skills/**"
60
60
  ],
61
61
  "peerDependencies": {
62
- "openclaw": ">=2026.7.2-beta.2"
62
+ "openclaw": ">=2026.7.2-beta.3"
63
63
  },
64
64
  "peerDependenciesMeta": {
65
65
  "openclaw": {