acpx 0.11.2 → 0.12.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.
@@ -445,6 +445,7 @@ const AGENT_REGISTRY = {
445
445
  copilot: "copilot --acp --stdio",
446
446
  droid: "droid exec --output-format acp",
447
447
  "fast-agent": "uvx fast-agent-mcp acp",
448
+ "grok-build": "grok agent stdio",
448
449
  iflow: "iflow --experimental-acp",
449
450
  kilocode: "npx -y @kilocode/cli acp",
450
451
  kimi: "kimi acp",
@@ -4561,7 +4562,33 @@ var AcpClient = class {
4561
4562
  credential: configCredential,
4562
4563
  source: "config"
4563
4564
  };
4565
+ const agentSpecificEnvCredential = this.readAgentSpecificEnvCredential(method.id);
4566
+ if (agentSpecificEnvCredential) return {
4567
+ methodId: method.id,
4568
+ credential: agentSpecificEnvCredential,
4569
+ source: "env"
4570
+ };
4564
4571
  }
4572
+ for (const method of methods) {
4573
+ const agentManagedSelection = this.selectAgentManagedAuthMethod(method.id);
4574
+ if (agentManagedSelection) return agentManagedSelection;
4575
+ }
4576
+ }
4577
+ readAgentSpecificEnvCredential(methodId) {
4578
+ if (!this.isGrokBuildAcpCommand() || methodId !== "xai.api_key") return;
4579
+ const value = process.env.XAI_API_KEY;
4580
+ return typeof value === "string" && value.trim().length > 0 ? value : void 0;
4581
+ }
4582
+ selectAgentManagedAuthMethod(methodId) {
4583
+ if (!this.isGrokBuildAcpCommand() || methodId !== "cached_token") return;
4584
+ return {
4585
+ methodId,
4586
+ source: "agent"
4587
+ };
4588
+ }
4589
+ isGrokBuildAcpCommand() {
4590
+ const { command, args } = splitCommandLine(this.options.agentCommand);
4591
+ return command.replace(/\\/g, "/").split("/").pop()?.replace(/\.(cmd|exe|ps1)$/iu, "").toLowerCase() === "grok" && args[0] === "agent" && args[1] === "stdio";
4565
4592
  }
4566
4593
  async authenticateIfRequired(connection, methods) {
4567
4594
  if (methods.length === 0) return;
@@ -6126,4 +6153,4 @@ var LiveSessionCheckpoint = class {
6126
6153
  //#endregion
6127
6154
  export { getPerfMetricsSnapshot as $, REQUESTED_MODEL_UNSUPPORTED_ERROR_CODE as A, listBuiltInAgents as At, absolutePath as B, AUTH_POLICIES as Bt, mergeSessionOptions as C, promptToDisplayText as Ct, applyLifecycleSnapshotToRecord as D, withInterrupt as Dt, applyConversation as E, TimeoutError as Et, modelStateFromConfigOptions as F, isRetryablePromptError as Ft, listSessions as G, OUTPUT_FORMATS as Gt, findSession as H, NON_INTERACTIVE_PERMISSION_POLICIES as Ht, splitCommandLine as I, normalizeOutputError as It, pruneSessions as J, SESSION_RECORD_SCHEMA as Jt, listSessionsForAgent as K, PERMISSION_MODES as Kt, getAcpxVersion as L, extractAcpError as Lt, RequestedModelUnsupportedError as M, resolveAgentCommand as Mt, assertRequestedModelSupported as N, exitCodeForOutputErrorCode as Nt, reconcileAgentSessionId as O, withTimeout as Ot, isRequestedModelUnsupportedError as P, formatErrorMessage as Pt, formatPerfMetric as Q, QueueProtocolError as Qt, permissionModeSatisfies as R, isAcpResourceNotFoundError as Rt, advertisedModelState as S, parsePromptSource as St, sessionOptionsFromRecord as T, InterruptedError as Tt, findSessionByDirectoryWalk as U, OUTPUT_ERROR_CODES as Ut, findGitRepositoryRoot as V, EXIT_CODES as Vt, isoNow$2 as W, OUTPUT_ERROR_ORIGINS as Wt, writeSessionRecord as X, AgentSpawnError as Xt, resolveSessionRecord as Y, AcpxOperationalError as Yt, assertPersistedKeyPolicy as Z, QueueConnectionError as Zt, createSessionConversation as _, parseJsonRpcErrorMessage as _t, applyRequestedModelIfAdvertised as a, startPerfTimer as at, recordSessionUpdate as b, isPromptInput as bt, setCurrentModelId as c, normalizeRuntimeSessionId as ct, setDesiredModelId as d, sessionBaseDir$1 as dt, incrementPerfCounter as et, syncAdvertisedModelState as f, sessionEventActivePath as ft, cloneSessionConversation as g, isAcpJsonRpcMessage as gt, cloneSessionAcpxState as h, extractSessionUpdateNotification as ht, connectAndLoadSession as i, setPerfGauge as it, REQUESTED_MODEL_UNSUPPORTED_REASONS as j, normalizeAgentName$1 as jt, AcpClient as k, DEFAULT_AGENT_NAME as kt, setDesiredConfigOption as l, DEFAULT_EVENT_SEGMENT_MAX_BYTES as lt, applyConfigOptionsToState as m, sessionEventSegmentPath as mt, runPromptTurn as n, recordPerfDuration as nt, currentModelIdFromSetModelResponse as o, parseSessionRecord as ot, applyConfigOptionsToRecord as p, sessionEventLockPath as pt, normalizeName as q, PERMISSION_POLICY_ACTIONS as qt, withConnectedSession as r, resetPerfMetrics as rt, clearDesiredConfigOption as s, serializeSessionRecordForDisk as st, LiveSessionCheckpoint as t, measurePerf as tt, setDesiredModeId as u, defaultSessionEventLog as ut, recordClientOperation as v, parsePromptStopReason as vt, persistSessionOptions as w, textPrompt as wt, trimConversationForRuntime as x, mergePromptSourceWithText as xt, recordPromptSubmission as y, PromptInputValidationError as yt, DEFAULT_HISTORY_LIMIT as z, toAcpErrorPayload as zt };
6128
6155
 
6129
- //# sourceMappingURL=live-checkpoint-mdAaF3qJ.js.map
6156
+ //# sourceMappingURL=live-checkpoint-ClPCSdrW.js.map