acpx 0.19.6 → 0.21.0

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 (39) hide show
  1. package/dist/{agent-registry-kHdpsK9F.js → agent-registry-Gtwn7nMp.js} +9 -1
  2. package/dist/agent-registry-Gtwn7nMp.js.map +1 -0
  3. package/dist/agent-registry.d.ts.map +1 -1
  4. package/dist/agent-registry.js +1 -1
  5. package/dist/{cli-B7jLigTF.js → cli-I6rP9FGr.js} +4 -4
  6. package/dist/{cli-B7jLigTF.js.map → cli-I6rP9FGr.js.map} +1 -1
  7. package/dist/cli.d.ts +1 -1
  8. package/dist/cli.d.ts.map +1 -1
  9. package/dist/cli.js +9 -9
  10. package/dist/{client-zT_kgYGW.d.ts → client-BaAmQKNy.d.ts} +3 -2
  11. package/dist/{client-zT_kgYGW.d.ts.map → client-BaAmQKNy.d.ts.map} +1 -1
  12. package/dist/{flows-DCYuQ4Wp.js → flows-7PaF7X66.js} +5 -5
  13. package/dist/{flows-DCYuQ4Wp.js.map → flows-7PaF7X66.js.map} +1 -1
  14. package/dist/flows.d.ts +2 -2
  15. package/dist/flows.js +1 -1
  16. package/dist/{invocation-options-BDk2PTpd.js → invocation-options-TRskRIuI.js} +13 -6
  17. package/dist/{invocation-options-BDk2PTpd.js.map → invocation-options-TRskRIuI.js.map} +1 -1
  18. package/dist/{ipc-B9IjR-45.js → ipc-D2BC99hf.js} +3 -6
  19. package/dist/ipc-D2BC99hf.js.map +1 -0
  20. package/dist/{output-BBKrvWhJ.js → output-CkfCaQfo.js} +3 -3
  21. package/dist/{output-BBKrvWhJ.js.map → output-CkfCaQfo.js.map} +1 -1
  22. package/dist/{queue-owner-runtime-DJ399xKB.js → queue-owner-runtime-CNrWkR8J.js} +123 -23
  23. package/dist/queue-owner-runtime-CNrWkR8J.js.map +1 -0
  24. package/dist/runtime.d.ts +21 -2
  25. package/dist/runtime.d.ts.map +1 -1
  26. package/dist/runtime.js +87 -31
  27. package/dist/runtime.js.map +1 -1
  28. package/dist/{session-options-CkcvthCv.d.ts → session-options-DVr_JUL7.d.ts} +11 -1
  29. package/dist/session-options-DVr_JUL7.d.ts.map +1 -0
  30. package/dist/{session-watch-Dpy75ytE.js → session-watch-BLLknspd.js} +4 -4
  31. package/dist/{session-watch-Dpy75ytE.js.map → session-watch-BLLknspd.js.map} +1 -1
  32. package/dist/{watch-BlnJqhro.js → watch-Db2D1eYN.js} +2 -2
  33. package/dist/{watch-BlnJqhro.js.map → watch-Db2D1eYN.js.map} +1 -1
  34. package/package.json +3 -3
  35. package/skills/acpx/SKILL.md +31 -3
  36. package/dist/agent-registry-kHdpsK9F.js.map +0 -1
  37. package/dist/ipc-B9IjR-45.js.map +0 -1
  38. package/dist/queue-owner-runtime-DJ399xKB.js.map +0 -1
  39. package/dist/session-options-CkcvthCv.d.ts.map +0 -1
@@ -1,5 +1,5 @@
1
- import { $ as measurePerf, $t as UnsupportedPromptContentError, Bt as AgentStartupError, C as textPrompt, Dt as normalizeOutputError, Et as isRetryablePromptError, F as normalizeName, G as normalizeAgentSessionId, Gt as PermissionDeniedError, H as canonicalAgentCommand, Ht as ClaudeAcpSessionCreateTimeoutError, Jt as SessionConfigOptionReplayError, K as SESSION_JOURNAL_SCHEMA, Kt as PermissionPromptUnavailableError, L as readSessionRecord, Lt as AcpxOperationalError, M as isoNow$1, O as absolutePath, Ot as extractAcpError, Q as incrementPerfCounter, Qt as SessionResumeRequiredError, R as resolveSessionRecord, Rt as AgentDisconnectedError, S as promptToDisplayText, St as isProcessAlive, T as lockOwnerPid, Tt as isAcpQueryClosedBeforeResponseError, Ut as CopilotAcpUnsupportedError, Vt as AuthPolicyError, W as extractAgentSessionId, Wt as GeminiAcpStartupTimeoutError, X as formatPerfMetric, Xt as SessionModelReplayError, Yt as SessionModeReplayError, Z as getPerfMetricsSnapshot, _ as ProcessDescendants, _t as sessionEventLockPath, a as trySetModelOnRunningOwner, at as isAcpMessageObject, d as releaseQueueOwnerLease, et as resetPerfMetrics, f as terminateProcess, ft as defaultSessionEventLog, g as QueueLeaseGuardSettlementError, gt as sessionEventActivePath, h as waitMs$1, ht as sessionBaseDir, i as trySetModeOnRunningOwner, it as isAcpJsonRpcMessage, j as findSessionByDirectoryWalk, k as findGitRepositoryRoot, kt as isAcpResourceNotFoundError, m as tryAcquireQueueOwnerLease, mt as retainedEventMaxSegments, n as tryCloseSessionOnRunningOwner, nt as startPerfTimer, o as trySubmitToRunningOwner, ot as isSessionUpdateNotification, p as terminateQueueOwnerForSession, pt as existingEventSegmentIndices, q as SessionJournalReader, qt as QueueConnectionError, r as trySetConfigOptionOnRunningOwner, s as SessionQueueOwner, t as tryCancelOnRunningOwner, tt as setPerfGauge, u as refreshQueueOwnerLease, vt as sessionEventSegmentPath, w as createLockOwner, wt as formatErrorMessage, y as getUnsupportedPromptContentMessage, z as writeSessionRecord, zt as AgentSpawnError } from "./ipc-B9IjR-45.js";
2
- import { A as requireAgentStdio, C as PROCESS_HELPER_TIMEOUT_MS, D as isoNow$2, E as isChildProcessRunning, F as waitForChildExit, I as waitForSpawn, M as resolveAgentSessionCwd, N as runTimedExecFile, P as splitCommandLine, T as basenameToken, _ as buildSpawnCommandOptions, b as readWindowsEnvValue, f as resolveBuiltInAgentLaunch, g as buildAgentSpawnCommand, j as resolveAgentCommandParts, v as buildTerminalShellSpawnCommand, w as asAbsoluteCwd, x as resolveWindowsExecutablePath, y as buildTerminalSpawnCommand } from "./agent-registry-kHdpsK9F.js";
1
+ import { $ as measurePerf, $t as UnsupportedPromptContentError, Bt as AgentStartupError, C as textPrompt, Dt as normalizeOutputError, Et as isRetryablePromptError, F as normalizeName, G as normalizeAgentSessionId, Gt as PermissionDeniedError, H as canonicalAgentCommand, Ht as ClaudeAcpSessionCreateTimeoutError, Jt as SessionConfigOptionReplayError, K as SESSION_JOURNAL_SCHEMA, Kt as PermissionPromptUnavailableError, L as readSessionRecord, Lt as AcpxOperationalError, M as isoNow$1, O as absolutePath, Ot as extractAcpError, Q as incrementPerfCounter, Qt as SessionResumeRequiredError, R as resolveSessionRecord, Rt as AgentDisconnectedError, S as promptToDisplayText, St as isProcessAlive, T as lockOwnerPid, Tt as isAcpQueryClosedBeforeResponseError, Ut as CopilotAcpUnsupportedError, Vt as AuthPolicyError, W as extractAgentSessionId, Wt as GeminiAcpStartupTimeoutError, X as formatPerfMetric, Xt as SessionModelReplayError, Yt as SessionModeReplayError, Z as getPerfMetricsSnapshot, _ as ProcessDescendants, _t as sessionEventLockPath, a as trySetModelOnRunningOwner, at as isAcpMessageObject, d as releaseQueueOwnerLease, et as resetPerfMetrics, f as terminateProcess, ft as defaultSessionEventLog, g as QueueLeaseGuardSettlementError, gt as sessionEventActivePath, h as waitMs$1, ht as sessionBaseDir, i as trySetModeOnRunningOwner, it as isAcpJsonRpcMessage, j as findSessionByDirectoryWalk, k as findGitRepositoryRoot, kt as isAcpResourceNotFoundError, m as tryAcquireQueueOwnerLease, mt as retainedEventMaxSegments, n as tryCloseSessionOnRunningOwner, nt as startPerfTimer, o as trySubmitToRunningOwner, ot as isSessionUpdateNotification, p as terminateQueueOwnerForSession, pt as existingEventSegmentIndices, q as SessionJournalReader, qt as QueueConnectionError, r as trySetConfigOptionOnRunningOwner, s as SessionQueueOwner, t as tryCancelOnRunningOwner, tt as setPerfGauge, u as refreshQueueOwnerLease, vt as sessionEventSegmentPath, w as createLockOwner, wt as formatErrorMessage, y as getUnsupportedPromptContentMessage, z as writeSessionRecord, zt as AgentSpawnError } from "./ipc-D2BC99hf.js";
2
+ import { A as requireAgentStdio, C as PROCESS_HELPER_TIMEOUT_MS, D as isoNow$2, E as isChildProcessRunning, F as waitForChildExit, I as waitForSpawn, M as resolveAgentSessionCwd, N as runTimedExecFile, P as splitCommandLine, T as basenameToken, _ as buildSpawnCommandOptions, b as readWindowsEnvValue, f as resolveBuiltInAgentLaunch, g as buildAgentSpawnCommand, j as resolveAgentCommandParts, v as buildTerminalShellSpawnCommand, w as asAbsoluteCwd, x as resolveWindowsExecutablePath, y as buildTerminalSpawnCommand } from "./agent-registry-Gtwn7nMp.js";
3
3
  import fs, { readFileSync, realpathSync } from "node:fs";
4
4
  import { fileURLToPath, pathToFileURL } from "node:url";
5
5
  import path from "node:path";
@@ -1103,6 +1103,7 @@ const DECISION_FALLBACK_ORDER = {
1103
1103
  };
1104
1104
  function decisionToResponse(params, decision) {
1105
1105
  if (decision.outcome === "cancel") return cancelled();
1106
+ if (decision.outcome === "selected") return params.options.some((option) => option.optionId === decision.optionId) ? selected(decision.optionId) : cancelled();
1106
1107
  const matched = pickOption(params.options ?? [], DECISION_FALLBACK_ORDER[decision.outcome]);
1107
1108
  return matched ? selected(matched.optionId) : cancelled();
1108
1109
  }
@@ -1292,6 +1293,91 @@ function resolveClaudeCodeExecutable(platform = process.platform, env = process.
1292
1293
  return resolveWindowsExecutablePath("claude", env, cwd);
1293
1294
  }
1294
1295
  //#endregion
1296
+ //#region src/acp/inherited-env.ts
1297
+ const AUTH_GRANT_PREFIX = "ACPX_AUTH_";
1298
+ const POSIX_ESSENTIAL_NAMES = [
1299
+ "PATH",
1300
+ "HOME",
1301
+ "USER",
1302
+ "LOGNAME",
1303
+ "SHELL",
1304
+ "LANG",
1305
+ "LANGUAGE",
1306
+ "TZ",
1307
+ "TMPDIR",
1308
+ "TMP",
1309
+ "TEMP"
1310
+ ];
1311
+ const WINDOWS_ESSENTIAL_NAMES = [
1312
+ "SYSTEMROOT",
1313
+ "WINDIR",
1314
+ "SYSTEMDRIVE",
1315
+ "COMSPEC",
1316
+ "PATHEXT",
1317
+ "USERPROFILE",
1318
+ "HOMEDRIVE",
1319
+ "HOMEPATH",
1320
+ "USERNAME",
1321
+ "USERDOMAIN",
1322
+ "APPDATA",
1323
+ "LOCALAPPDATA",
1324
+ "PROGRAMDATA",
1325
+ "ALLUSERSPROFILE",
1326
+ "PROGRAMFILES",
1327
+ "PROGRAMFILES(X86)",
1328
+ "PROGRAMW6432",
1329
+ "COMMONPROGRAMFILES",
1330
+ "COMMONPROGRAMFILES(X86)",
1331
+ "COMMONPROGRAMW6432"
1332
+ ];
1333
+ const ESSENTIAL_PREFIXES = ["LC_", "XDG_"];
1334
+ /** Environment name as compared on this platform: Windows names are case-insensitive. */
1335
+ function envNameKey(name) {
1336
+ return process.platform === "win32" ? name.toUpperCase() : name;
1337
+ }
1338
+ function essentialNames() {
1339
+ return process.platform === "win32" ? [...POSIX_ESSENTIAL_NAMES, ...WINDOWS_ESSENTIAL_NAMES] : POSIX_ESSENTIAL_NAMES;
1340
+ }
1341
+ function isEnvName(name) {
1342
+ return typeof name === "string" && name.length > 0 && !name.includes("=") && !name.includes("\0");
1343
+ }
1344
+ function validateEnvNames(option, names) {
1345
+ if (!Array.isArray(names) || !names.every(isEnvName)) throw new Error(`Invalid ${option}: expected an array of non-empty names without NUL or '='`);
1346
+ return names;
1347
+ }
1348
+ /** Validate and copy an embedder's name list once, when a client or runtime is constructed. */
1349
+ function snapshotEnvNames(option, names) {
1350
+ return names === void 0 ? void 0 : [...validateEnvNames(option, names)];
1351
+ }
1352
+ function inheritedNameFilter(policy) {
1353
+ const blocked = new Set((policy?.block ?? []).map(envNameKey));
1354
+ const allowed = policy?.allow ? new Set([...essentialNames(), ...policy.allow].map(envNameKey)) : void 0;
1355
+ return (name) => {
1356
+ const key = envNameKey(name);
1357
+ if (key.startsWith(AUTH_GRANT_PREFIX)) return true;
1358
+ if (blocked.has(key)) return false;
1359
+ return !allowed || allowed.has(key) || ESSENTIAL_PREFIXES.some((p) => key.startsWith(p));
1360
+ };
1361
+ }
1362
+ /** Whether a parent environment name reaches agent children under this policy. */
1363
+ function isInheritedEnvName(policy, name) {
1364
+ return inheritedNameFilter(policy)(name);
1365
+ }
1366
+ /** Whether the policy changes inheritance at all; with neither list set it does not. */
1367
+ function hasInheritedEnvPolicy(policy) {
1368
+ return policy?.allow !== void 0 || (policy?.block?.length ?? 0) > 0;
1369
+ }
1370
+ /** Copy the parent environment, keeping only the names this policy lets children inherit. */
1371
+ function inheritParentEnvironment(policy) {
1372
+ const env = { ...process.env };
1373
+ if (!hasInheritedEnvPolicy(policy)) return env;
1374
+ validateEnvNames("agentProcessEnvAllow", policy?.allow ?? []);
1375
+ validateEnvNames("agentProcessEnvBlock", policy?.block ?? []);
1376
+ const inherits = inheritedNameFilter(policy);
1377
+ for (const name of Object.keys(env)) if (!inherits(name)) delete env[name];
1378
+ return env;
1379
+ }
1380
+ //#endregion
1295
1381
  //#region src/acp/auth-env.ts
1296
1382
  const AUTH_ENV_PREFIX = "ACPX_AUTH_";
1297
1383
  function toEnvToken(value) {
@@ -1343,9 +1429,9 @@ function promotePrefixedAuthEnvironment(env) {
1343
1429
  function validateAgentProcessEnv(agentProcessEnv) {
1344
1430
  for (const [key, value] of Object.entries(agentProcessEnv ?? {})) if (typeof value !== "string" || key.includes("=") || key.includes("\0") || value.includes("\0")) throw new Error("Invalid agentProcessEnv: environment entries cannot contain NUL or names with '='");
1345
1431
  }
1346
- function buildAgentEnvironment(authCredentials, sessionEnv, agentProcessEnv) {
1432
+ function buildAgentEnvironment(authCredentials, sessionEnv, agentProcessEnv, inheritedEnv) {
1347
1433
  validateAgentProcessEnv(agentProcessEnv);
1348
- const env = { ...process.env };
1434
+ const env = inheritParentEnvironment(inheritedEnv);
1349
1435
  const protectedAuthEnvKeys = promotePrefixedAuthEnvironment(env);
1350
1436
  if (authCredentials) for (const [methodId, credential] of Object.entries(authCredentials)) {
1351
1437
  addAuthCredentialEnvKeys(protectedAuthEnvKeys, methodId, credential);
@@ -1395,10 +1481,10 @@ function resolveConfiguredAuthCredential(methodId, authCredentials) {
1395
1481
  const configCredentials = authCredentials ?? {};
1396
1482
  return configCredentials[methodId] ?? configCredentials[toEnvToken(methodId)];
1397
1483
  }
1398
- function buildAgentSpawnOptions(cwd, authCredentials, sessionEnv, agentProcessEnv) {
1484
+ function buildAgentSpawnOptions(cwd, authCredentials, sessionEnv, agentProcessEnv, inheritedEnv) {
1399
1485
  return {
1400
1486
  cwd,
1401
- env: buildAgentEnvironment(authCredentials, sessionEnv, agentProcessEnv),
1487
+ env: buildAgentEnvironment(authCredentials, sessionEnv, agentProcessEnv, inheritedEnv),
1402
1488
  stdio: [
1403
1489
  "pipe",
1404
1490
  "pipe",
@@ -1895,14 +1981,14 @@ function toCommandLine(command, args) {
1895
1981
  const renderedArgs = (args ?? []).map((arg) => JSON.stringify(arg)).join(" ");
1896
1982
  return renderedArgs.length > 0 ? `${command} ${renderedArgs}` : command;
1897
1983
  }
1898
- function toEnvObject(env) {
1899
- if (!env || env.length === 0) return;
1900
- const merged = { ...process.env };
1901
- for (const entry of env) merged[entry.name] = entry.value;
1984
+ function toEnvObject(env, inheritedEnv) {
1985
+ if (!env?.length && !hasInheritedEnvPolicy(inheritedEnv)) return;
1986
+ const merged = inheritParentEnvironment(inheritedEnv);
1987
+ for (const entry of env ?? []) merged[entry.name] = entry.value;
1902
1988
  return merged;
1903
1989
  }
1904
- function buildTerminalSpawnOptions(command, cwd, env, platform = process.platform) {
1905
- const resolvedEnv = toEnvObject(env);
1990
+ function buildTerminalSpawnOptions(command, cwd, env, platform = process.platform, inheritedEnv) {
1991
+ const resolvedEnv = toEnvObject(env, inheritedEnv);
1906
1992
  return buildSpawnCommandOptions(command, {
1907
1993
  cwd,
1908
1994
  env: resolvedEnv,
@@ -1954,6 +2040,7 @@ function waitMs(ms) {
1954
2040
  function onStreamError() {}
1955
2041
  var TerminalManager = class {
1956
2042
  cwd;
2043
+ inheritedEnv;
1957
2044
  permissionMode;
1958
2045
  nonInteractivePermissions;
1959
2046
  onOperation;
@@ -1967,6 +2054,7 @@ var TerminalManager = class {
1967
2054
  constructor(options) {
1968
2055
  this.outputCeilingBytes = readTerminalOutputCeiling();
1969
2056
  this.cwd = options.cwd;
2057
+ this.inheritedEnv = options.inheritedEnv;
1970
2058
  this.permissionMode = options.permissionMode;
1971
2059
  this.nonInteractivePermissions = options.nonInteractivePermissions ?? "deny";
1972
2060
  this.onOperation = options.onOperation;
@@ -2003,7 +2091,10 @@ var TerminalManager = class {
2003
2091
  assertControlAuthority(authority);
2004
2092
  if (!approved) throw new PermissionDeniedError("Permission denied for terminal/create");
2005
2093
  const outputByteLimit = resolveTerminalOutputLimit(params.outputByteLimit, this.outputCeilingBytes);
2006
- const { proc, spawnCommand } = await spawnTerminalProcess(params, this.cwd, authority);
2094
+ const { proc, spawnCommand } = await spawnTerminalProcess(params, {
2095
+ cwd: this.cwd,
2096
+ inheritedEnv: this.inheritedEnv
2097
+ }, authority);
2007
2098
  let resolveExit = () => {};
2008
2099
  const exitPromise = new Promise((resolve) => {
2009
2100
  resolveExit = resolve;
@@ -2271,24 +2362,24 @@ var TerminalManager = class {
2271
2362
  return true;
2272
2363
  }
2273
2364
  };
2274
- async function spawnTerminalProcess(params, defaultCwd, authority) {
2365
+ async function spawnTerminalProcess(params, context, authority) {
2275
2366
  const directCommand = buildTerminalSpawnCommand(params.command, params.args);
2276
2367
  try {
2277
2368
  return {
2278
- proc: await spawnAndWait(directCommand, params, defaultCwd, authority),
2369
+ proc: await spawnAndWait(directCommand, params, context, authority),
2279
2370
  spawnCommand: directCommand
2280
2371
  };
2281
2372
  } catch (error) {
2282
- const fallbackCommand = params.args === void 0 && isNotFoundSpawnError(error) ? buildTerminalFallbackSpawnCommand(params.command, params.cwd ?? defaultCwd) : void 0;
2373
+ const fallbackCommand = params.args === void 0 && isNotFoundSpawnError(error) ? buildTerminalFallbackSpawnCommand(params.command, params.cwd ?? context.cwd) : void 0;
2283
2374
  if (!fallbackCommand) throw error;
2284
2375
  return {
2285
- proc: await spawnAndWait(fallbackCommand, params, defaultCwd, authority),
2376
+ proc: await spawnAndWait(fallbackCommand, params, context, authority),
2286
2377
  spawnCommand: fallbackCommand
2287
2378
  };
2288
2379
  }
2289
2380
  }
2290
- async function spawnAndWait(spawnCommand, params, defaultCwd, authority) {
2291
- const spawnOptions = buildTerminalSpawnOptions(spawnCommand.command, params.cwd ?? defaultCwd, params.env);
2381
+ async function spawnAndWait(spawnCommand, params, context, authority) {
2382
+ const spawnOptions = buildTerminalSpawnOptions(spawnCommand.command, params.cwd ?? context.cwd, params.env, process.platform, context.inheritedEnv);
2292
2383
  if (process.platform !== "win32") spawnOptions.detached = true;
2293
2384
  assertControlAuthority(authority);
2294
2385
  const proc = spawn(spawnCommand.command, spawnCommand.args, spawnOptions);
@@ -2542,6 +2633,8 @@ var AcpClient = class {
2542
2633
  ...options,
2543
2634
  cwd: asAbsoluteCwd(options.cwd),
2544
2635
  agentProcessEnv: options.agentProcessEnv ? { ...options.agentProcessEnv } : void 0,
2636
+ agentProcessEnvAllow: snapshotEnvNames("agentProcessEnvAllow", options.agentProcessEnvAllow),
2637
+ agentProcessEnvBlock: snapshotEnvNames("agentProcessEnvBlock", options.agentProcessEnvBlock),
2545
2638
  authPolicy: options.authPolicy ?? "skip",
2546
2639
  permissionPolicy: snapshotPermissionPolicy(options.permissionPolicy),
2547
2640
  elicitationModes: normalizeElicitationModes(options.elicitationModes)
@@ -2563,6 +2656,7 @@ var AcpClient = class {
2563
2656
  });
2564
2657
  this.terminalManager = new TerminalManager({
2565
2658
  cwd: this.options.cwd,
2659
+ inheritedEnv: this.inheritedEnvPolicy(),
2566
2660
  permissionMode: this.options.permissionMode,
2567
2661
  nonInteractivePermissions: this.options.nonInteractivePermissions,
2568
2662
  onOperation: (operation) => {
@@ -2724,7 +2818,7 @@ var AcpClient = class {
2724
2818
  const configuredCommand = resolveAgentCommandParts(this.options.agentCommand, this.options.agentArgv);
2725
2819
  const resolvedBuiltInLaunch = resolveBuiltInAgentLaunch(this.options.agentCommand);
2726
2820
  const spawnCommand = resolvedBuiltInLaunch?.command ?? configuredCommand.command;
2727
- const spawnOptions = buildAgentSpawnOptions(this.options.cwd, this.options.authCredentials, this.options.sessionOptions?.env, this.options.agentProcessEnv);
2821
+ const spawnOptions = buildAgentSpawnOptions(this.options.cwd, this.options.authCredentials, this.options.sessionOptions?.env, this.options.agentProcessEnv, this.inheritedEnvPolicy());
2728
2822
  const commandContext = {
2729
2823
  env: spawnOptions.env,
2730
2824
  readOutput: async (command, args, timeoutMs, diagnostic = false) => {
@@ -3526,8 +3620,14 @@ var AcpClient = class {
3526
3620
  if (agentManagedSelection) return agentManagedSelection;
3527
3621
  }
3528
3622
  }
3623
+ inheritedEnvPolicy() {
3624
+ return {
3625
+ allow: this.options.agentProcessEnvAllow,
3626
+ block: this.options.agentProcessEnvBlock
3627
+ };
3628
+ }
3529
3629
  readAgentSpecificEnvCredential(methodId) {
3530
- if (!this.isGrokBuildAcpCommand() || methodId !== "xai.api_key") return;
3630
+ if (!this.isGrokBuildAcpCommand() || methodId !== "xai.api_key" || !isInheritedEnvName(this.inheritedEnvPolicy(), "XAI_API_KEY")) return;
3531
3631
  const value = process.env.XAI_API_KEY;
3532
3632
  return typeof value === "string" && value.trim().length > 0 ? value : void 0;
3533
3633
  }
@@ -8119,6 +8219,6 @@ async function sendSession(options) {
8119
8219
  }
8120
8220
  const queueOwnerRuntimeTestInternals = { queueOwnerExitIsFatal };
8121
8221
  //#endregion
8122
- export { isRequestedModelUnsupportedError as $, applyInitialModelSelection as A, reconcileAgentSessionId as B, setSessionModeOnOwner as C, connectAndLoadSession as D, withConnectedSession as E, persistSessionOptions as F, recordSessionUpdate as G, createSessionConversation as H, sessionOptionsFromRecord as I, advertisedModelState as J, trimConversationForRuntime as K, applyConversation as L, applyRequestedModelIfAdvertised as M, setDesiredModeId as N, applyConfigOptionSelection as O, normalizeSessionOptionShape as P, RequestedModelUnsupportedError as Q, applyLifecycleSnapshotToRecord as R, setSessionMode as S, setSessionModelOnOwner as T, recordClientOperation as U, cloneSessionConversation as V, recordPromptSubmission as W, REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE as X, AcpClient as Y, REQUESTED_MODEL_UNSUPPORTED_REASONS as Z, cancelSessionPrompt as _, runQueuedTask as a, normalizeQueueOwnerTtlMs as at, setSessionConfigOption as b, LiveSessionCheckpoint as c, listSessionEvents as ct, flushPerfMetricsCapture as d, TimeoutError as dt, resolveRequestedConfigOption as et, installPerfMetricsCapture as f, assertControlAuthority as ft, listAgentSessions as g, ensureSession as h, runOnce as i, DEFAULT_QUEUE_OWNER_TTL_MS as it, applyModelSelection as j, applyConfigOptionsToRecord as k, runPromptTurn as l, isLegacyZedCodexAcpInvocation as lt, createSessionWithClient as m, withTimeout as mt, runSessionQueueOwner as n, getAcpxVersion as nt, sendSessionDirect as o, acquireSessionImport as ot, createSession as p, withInterrupt as pt, cloneSessionAcpxState as q, sendSession as r, permissionModeSatisfies as rt, DISCARD_OUTPUT_FORMATTER as s, acquireSessionScope as st, queueOwnerRuntimeTestInternals as t, resolveRequestedModelId as tt, buildQueueOwnerArgOverride as u, InterruptedError as ut, closeSession as v, setSessionModel as w, setSessionConfigOptionOnOwner as x, sessionControlTestInternals as y, createInitialSessionRecord as z };
8222
+ export { isRequestedModelUnsupportedError as $, applyInitialModelSelection as A, reconcileAgentSessionId as B, setSessionModeOnOwner as C, connectAndLoadSession as D, withConnectedSession as E, persistSessionOptions as F, recordSessionUpdate as G, createSessionConversation as H, sessionOptionsFromRecord as I, advertisedModelState as J, trimConversationForRuntime as K, applyConversation as L, applyRequestedModelIfAdvertised as M, setDesiredModeId as N, applyConfigOptionSelection as O, normalizeSessionOptionShape as P, RequestedModelUnsupportedError as Q, applyLifecycleSnapshotToRecord as R, setSessionMode as S, setSessionModelOnOwner as T, recordClientOperation as U, cloneSessionConversation as V, recordPromptSubmission as W, REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE as X, AcpClient as Y, REQUESTED_MODEL_UNSUPPORTED_REASONS as Z, cancelSessionPrompt as _, runQueuedTask as a, DEFAULT_QUEUE_OWNER_TTL_MS as at, setSessionConfigOption as b, LiveSessionCheckpoint as c, acquireSessionScope as ct, flushPerfMetricsCapture as d, InterruptedError as dt, resolveRequestedConfigOption as et, installPerfMetricsCapture as f, TimeoutError as ft, listAgentSessions as g, ensureSession as h, withTimeout as ht, runOnce as i, permissionModeSatisfies as it, applyModelSelection as j, applyConfigOptionsToRecord as k, runPromptTurn as l, listSessionEvents as lt, createSessionWithClient as m, withInterrupt as mt, runSessionQueueOwner as n, getAcpxVersion as nt, sendSessionDirect as o, normalizeQueueOwnerTtlMs as ot, createSession as p, assertControlAuthority as pt, cloneSessionAcpxState as q, sendSession as r, snapshotEnvNames as rt, DISCARD_OUTPUT_FORMATTER as s, acquireSessionImport as st, queueOwnerRuntimeTestInternals as t, resolveRequestedModelId as tt, buildQueueOwnerArgOverride as u, isLegacyZedCodexAcpInvocation as ut, closeSession as v, setSessionModel as w, setSessionConfigOptionOnOwner as x, sessionControlTestInternals as y, createInitialSessionRecord as z };
8123
8223
 
8124
- //# sourceMappingURL=queue-owner-runtime-DJ399xKB.js.map
8224
+ //# sourceMappingURL=queue-owner-runtime-CNrWkR8J.js.map