@openclaw/acpx 2026.6.11-beta.2 → 2026.7.1-beta.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,4 +1,4 @@
1
- import { t as createAcpxRuntimeService } from "./register.runtime-CmYbf9SF.js";
1
+ import { t as createAcpxRuntimeService } from "./register.runtime-Bq02UtOW.js";
2
2
  import { tryDispatchAcpReplyHook } from "openclaw/plugin-sdk/acp-runtime-backend";
3
3
  //#region extensions/acpx/index.ts
4
4
  /**
@@ -205,7 +205,7 @@ function createLazyAcpRuntimeProxy(resolveRuntime) {
205
205
  const ACPX_BACKEND_ID = "acpx";
206
206
  let serviceModulePromise = null;
207
207
  function loadServiceModule() {
208
- serviceModulePromise ??= import("./service-BqMIPoSJ.js");
208
+ serviceModulePromise ??= import("./service-CfrXZbVJ.js");
209
209
  return serviceModulePromise;
210
210
  }
211
211
  async function startRealService(state) {
@@ -1,2 +1,2 @@
1
- import { t as createAcpxRuntimeService } from "./register.runtime-CmYbf9SF.js";
1
+ import { t as createAcpxRuntimeService } from "./register.runtime-Bq02UtOW.js";
2
2
  export { createAcpxRuntimeService };
@@ -13,6 +13,8 @@ import { redactSensitiveText } from "openclaw/plugin-sdk/security-runtime";
13
13
  * OpenClaw ACPX runtime adapter. It wraps the upstream acpx runtime with
14
14
  * OpenClaw session metadata, lease tracking, model scoping, and cleanup policy.
15
15
  */
16
+ const ACPX_OPENCLAW_TOOLS_MCP_SERVER_NAME = "openclaw-tools";
17
+ const OPENCLAW_TOOLS_MCP_AGENT_SESSION_KEY_ENV = "OPENCLAW_TOOLS_MCP_AGENT_SESSION_KEY";
16
18
  function withOpenClawManagedTurnTimeout(input) {
17
19
  return {
18
20
  ...input,
@@ -374,16 +376,36 @@ function shouldUseDistinctBridgeDelegate(options) {
374
376
  const { mcpServers } = options;
375
377
  return Array.isArray(mcpServers) && mcpServers.length > 0;
376
378
  }
379
+ function withOpenClawToolsMcpSessionEnv(params) {
380
+ const sessionKey = params.sessionKey.trim();
381
+ if (!params.enabled || !sessionKey || !params.mcpServers?.length) return params.mcpServers;
382
+ let changed = false;
383
+ const nextServers = params.mcpServers.map((server) => {
384
+ if (server.name !== ACPX_OPENCLAW_TOOLS_MCP_SERVER_NAME || !("command" in server)) return server;
385
+ changed = true;
386
+ const env = [...server.env.filter((entry) => entry.name !== OPENCLAW_TOOLS_MCP_AGENT_SESSION_KEY_ENV), {
387
+ name: OPENCLAW_TOOLS_MCP_AGENT_SESSION_KEY_ENV,
388
+ value: sessionKey
389
+ }];
390
+ return {
391
+ ...server,
392
+ env
393
+ };
394
+ });
395
+ return changed ? nextServers : params.mcpServers;
396
+ }
377
397
  /** OpenClaw-managed ACP runtime implementation backed by the upstream acpx runtime. */
378
398
  var AcpxRuntime = class {
379
399
  constructor(options, testOptions) {
380
400
  this.codexAcpModelOverrideScope = new AsyncLocalStorage();
401
+ this.openclawToolsSessionDelegates = /* @__PURE__ */ new Map();
381
402
  this.launchLeaseScope = new AsyncLocalStorage();
382
403
  const { openclawProcessCleanup, ...delegateTestOptions } = testOptions ?? {};
383
404
  this.processCleanupDeps = openclawProcessCleanup;
384
405
  this.wrapperRoot = options.openclawWrapperRoot;
385
406
  this.gatewayInstanceId = options.openclawGatewayInstanceId;
386
407
  this.processLeaseStore = options.openclawProcessLeaseStore;
408
+ this.openclawToolsMcpBridgeEnabled = options.openclawToolsMcpBridgeEnabled === true;
387
409
  this.cwd = options.cwd;
388
410
  this.sessionStore = createResetAwareSessionStore(options.sessionStore, {
389
411
  gatewayInstanceId: this.gatewayInstanceId,
@@ -401,12 +423,14 @@ var AcpxRuntime = class {
401
423
  sessionStore: this.sessionStore,
402
424
  agentRegistry: this.scopedAgentRegistry
403
425
  };
404
- this.delegate = new AcpxRuntime$1(sharedOptions, delegateTestOptions);
426
+ this.delegateOptions = sharedOptions;
427
+ this.delegateTestOptions = delegateTestOptions;
428
+ this.delegate = new AcpxRuntime$1(sharedOptions, this.delegateTestOptions);
405
429
  this.bridgeSafeDelegate = shouldUseDistinctBridgeDelegate(options) ? new AcpxRuntime$1({
406
430
  ...sharedOptions,
407
431
  mcpServers: []
408
- }, delegateTestOptions) : this.delegate;
409
- this.probeDelegate = this.resolveDelegateForAgent(resolveProbeAgentName(options));
432
+ }, this.delegateTestOptions) : this.delegate;
433
+ this.probeDelegate = this.openclawToolsMcpBridgeEnabled ? this.bridgeSafeDelegate : this.resolveDelegateForAgent(resolveProbeAgentName(options));
410
434
  }
411
435
  resolveDelegateForAgent(agentName) {
412
436
  const command = resolveAgentCommandForName({
@@ -418,14 +442,51 @@ var AcpxRuntime = class {
418
442
  resolveDelegateForCommand(command) {
419
443
  return shouldUseBridgeSafeDelegateForCommand(command) ? this.bridgeSafeDelegate : this.delegate;
420
444
  }
445
+ resolveDelegateForSession(params) {
446
+ if (shouldUseBridgeSafeDelegateForCommand(params.command)) return this.bridgeSafeDelegate;
447
+ return this.resolveOpenClawToolsDelegateForSession(params.sessionKey);
448
+ }
449
+ resolveOpenClawToolsDelegateForSession(sessionKey) {
450
+ if (!this.openclawToolsMcpBridgeEnabled) return this.delegate;
451
+ const normalizedSessionKey = sessionKey.trim();
452
+ if (!normalizedSessionKey) return this.delegate;
453
+ const cached = this.openclawToolsSessionDelegates.get(normalizedSessionKey);
454
+ if (cached) return cached;
455
+ const delegate = new AcpxRuntime$1({
456
+ ...this.delegateOptions,
457
+ mcpServers: withOpenClawToolsMcpSessionEnv({
458
+ enabled: this.openclawToolsMcpBridgeEnabled,
459
+ mcpServers: this.delegateOptions.mcpServers,
460
+ sessionKey: normalizedSessionKey
461
+ })
462
+ }, this.delegateTestOptions);
463
+ this.openclawToolsSessionDelegates.set(normalizedSessionKey, delegate);
464
+ return delegate;
465
+ }
466
+ releaseOpenClawToolsDelegateForSession(sessionKey) {
467
+ if (!this.openclawToolsMcpBridgeEnabled) return;
468
+ const normalizedSessionKey = sessionKey.trim();
469
+ if (!normalizedSessionKey) return;
470
+ this.openclawToolsSessionDelegates.delete(normalizedSessionKey);
471
+ }
421
472
  async resolveDelegateForHandle(handle) {
422
473
  const record = await this.sessionStore.load(handle.acpxRecordId ?? handle.sessionKey);
423
474
  return this.resolveDelegateForLoadedRecord(handle, record);
424
475
  }
425
476
  resolveDelegateForLoadedRecord(handle, record) {
426
477
  const recordCommand = readAgentCommandFromRecord(record);
427
- if (recordCommand) return this.resolveDelegateForCommand(recordCommand);
428
- return this.resolveDelegateForAgent(readAgentFromHandle(handle));
478
+ if (recordCommand) return this.resolveDelegateForSession({
479
+ command: recordCommand,
480
+ sessionKey: handle.sessionKey
481
+ });
482
+ const command = resolveAgentCommandForName({
483
+ agentName: readAgentFromHandle(handle),
484
+ agentRegistry: this.agentRegistry
485
+ });
486
+ return this.resolveDelegateForSession({
487
+ command,
488
+ sessionKey: handle.sessionKey
489
+ });
429
490
  }
430
491
  async resolveCommandForHandle(handle) {
431
492
  const recordCommand = readAgentCommandFromRecord(await this.sessionStore.load(handle.acpxRecordId ?? handle.sessionKey));
@@ -554,7 +615,10 @@ var AcpxRuntime = class {
554
615
  agentName: input.agent,
555
616
  agentRegistry: this.agentRegistry
556
617
  });
557
- const delegate = this.resolveDelegateForCommand(command);
618
+ const delegate = this.resolveDelegateForSession({
619
+ command,
620
+ sessionKey: input.sessionKey
621
+ });
558
622
  const claudeModelOverride = isClaudeAcpCommand(command) ? normalizeClaudeAcpModelOverride(input.model) : void 0;
559
623
  const codexModelOverride = normalizeAgentName(input.agent) === CODEX_ACP_AGENT_ID && isCodexAcpCommand(command) ? normalizeCodexAcpModelOverride(input.model, input.thinking) : void 0;
560
624
  const ensureInput = claudeModelOverride ? {
@@ -746,8 +810,9 @@ var AcpxRuntime = class {
746
810
  async close(input) {
747
811
  const record = await this.sessionStore.load(input.handle.acpxRecordId ?? input.handle.sessionKey);
748
812
  let closeSucceeded;
813
+ const delegate = this.resolveDelegateForLoadedRecord(input.handle, record);
749
814
  try {
750
- await this.resolveDelegateForLoadedRecord(input.handle, record).close({
815
+ await delegate.close({
751
816
  handle: input.handle,
752
817
  reason: input.reason,
753
818
  discardPersistentState: input.discardPersistentState
@@ -756,6 +821,7 @@ var AcpxRuntime = class {
756
821
  } finally {
757
822
  await this.cleanupProcessTreeForRecord(input.handle, record);
758
823
  }
824
+ if (closeSucceeded) this.releaseOpenClawToolsDelegateForSession(input.handle.sessionKey);
759
825
  if (closeSucceeded && input.discardPersistentState) this.sessionStore.markFresh(input.handle.sessionKey);
760
826
  }
761
827
  };
@@ -1,4 +1,4 @@
1
- import { n as createLazyAcpRuntimeProxy } from "./register.runtime-CmYbf9SF.js";
1
+ import { n as createLazyAcpRuntimeProxy } from "./register.runtime-Bq02UtOW.js";
2
2
  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";
3
3
  import { registerAcpRuntimeBackend, unregisterAcpRuntimeBackend } from "./runtime-api.js";
4
4
  import { a as resolveAcpxPluginRoot, c as splitCommandParts, i as resolveAcpxPluginConfig, o as toAcpMcpServers, r as reapStaleOpenClawOwnedAcpxOrphans, s as quoteCommandPart, t as cleanupOpenClawOwnedAcpxProcessTree } from "./process-reaper-Dv_iMcOo.js";
@@ -853,7 +853,7 @@ const SKIP_RUNTIME_PROBE_ENV = "OPENCLAW_SKIP_ACPX_RUNTIME_PROBE";
853
853
  const ACPX_BACKEND_ID = "acpx";
854
854
  let runtimeModulePromise = null;
855
855
  function loadRuntimeModule() {
856
- runtimeModulePromise ??= import("./runtime-B1cHS4Li.js");
856
+ runtimeModulePromise ??= import("./runtime-CynB8RsZ.js");
857
857
  return runtimeModulePromise;
858
858
  }
859
859
  /** Convert ACPX timeout seconds into timer-safe milliseconds. */
@@ -876,6 +876,7 @@ function createLazyDefaultRuntime(params) {
876
876
  agentRegistry: module.createAgentRegistry({ overrides: params.pluginConfig.agents }),
877
877
  probeAgent: params.pluginConfig.probeAgent,
878
878
  mcpServers: toAcpMcpServers(params.pluginConfig.mcpServers),
879
+ openclawToolsMcpBridgeEnabled: params.pluginConfig.openClawToolsMcpBridge,
879
880
  permissionMode: params.pluginConfig.permissionMode,
880
881
  nonInteractivePermissions: params.pluginConfig.nonInteractivePermissions,
881
882
  timeoutMs: resolveAcpxTimerTimeoutMs(params.pluginConfig.timeoutSeconds)
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@openclaw/acpx",
3
- "version": "2026.6.11-beta.2",
3
+ "version": "2026.7.1-beta.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/acpx",
9
- "version": "2026.6.11-beta.2",
9
+ "version": "2026.7.1-beta.1",
10
10
  "dependencies": {
11
11
  "@agentclientprotocol/claude-agent-acp": "0.39.0",
12
12
  "@zed-industries/codex-acp": "0.15.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/acpx",
3
- "version": "2026.6.11-beta.2",
3
+ "version": "2026.7.1-beta.1",
4
4
  "description": "OpenClaw ACP runtime backend with plugin-owned session and transport management.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,10 +26,10 @@
26
26
  "minHostVersion": ">=2026.4.25"
27
27
  },
28
28
  "compat": {
29
- "pluginApi": ">=2026.6.11-beta.2"
29
+ "pluginApi": ">=2026.7.1-beta.1"
30
30
  },
31
31
  "build": {
32
- "openclawVersion": "2026.6.11-beta.2",
32
+ "openclawVersion": "2026.7.1-beta.1",
33
33
  "staticAssets": [
34
34
  {
35
35
  "source": "./src/runtime-internals/mcp-proxy.mjs",
@@ -58,7 +58,7 @@
58
58
  "skills/**"
59
59
  ],
60
60
  "peerDependencies": {
61
- "openclaw": ">=2026.6.11-beta.2"
61
+ "openclaw": ">=2026.7.1-beta.1"
62
62
  },
63
63
  "peerDependenciesMeta": {
64
64
  "openclaw": {