@evident-ai/cli 3.6.1-dev.4831868 → 3.6.1-dev.5f836c8

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/README.md CHANGED
@@ -125,6 +125,10 @@ Options:
125
125
  - `--opencode-config-overlay <path>` — Apply a runner-provided OpenCode config
126
126
  before starting OpenCode. Relative paths are resolved from the working directory;
127
127
  an existing `opencode.jsonc` is replaced before `opencode.json`.
128
+ - `--auto-configure-credentials-proxy` — Install Evident's generated `evident-*`
129
+ OpenCode provider entries for the runner's credential pool. This is off by default;
130
+ without it, the CLI only delivers `EVIDENT_PROXY_TOKEN` and leaves provider
131
+ configuration to you.
128
132
  - `--credential-sync-marker <path>` — Own the interval credential sync and write
129
133
  this marker once the shutdown flush has finished, so the runner image's lifecycle
130
134
  hooks can wait on it.
package/dist/index.js CHANGED
@@ -1332,8 +1332,29 @@ var NATIVE_PROVIDERS = {
1332
1332
  name: "Evident Kimi credential proxy",
1333
1333
  npm: "@ai-sdk/openai-compatible",
1334
1334
  sdkName: "evident-kimi"
1335
+ },
1336
+ antigravity: {
1337
+ namespace: "evident-antigravity",
1338
+ name: "Evident Antigravity credential proxy",
1339
+ npm: "@ai-sdk/openai-compatible",
1340
+ sdkName: "evident-antigravity"
1341
+ },
1342
+ xai: {
1343
+ namespace: "evident-xai",
1344
+ name: "Evident xAI credential proxy",
1345
+ npm: "@ai-sdk/openai-compatible",
1346
+ sdkName: "evident-xai"
1347
+ },
1348
+ mistral: {
1349
+ namespace: "evident-mistral",
1350
+ name: "Evident Mistral credential proxy",
1351
+ npm: "@ai-sdk/openai-compatible",
1352
+ sdkName: "evident-mistral"
1335
1353
  }
1336
1354
  };
1355
+ var CREDENTIAL_PROXY_NATIVE_NAMESPACES = [
1356
+ ...new Set(Object.values(NATIVE_PROVIDERS).map(({ namespace }) => namespace))
1357
+ ];
1337
1358
  function credentialProxyInferenceUrl(baseUrl) {
1338
1359
  const trimmed = baseUrl.trim().replace(/\/+$/, "");
1339
1360
  return /\/v1$/i.test(trimmed) ? trimmed : `${trimmed}/v1`;
@@ -1421,7 +1442,7 @@ import ora4 from "ora";
1421
1442
  import { select as select4 } from "@inquirer/prompts";
1422
1443
 
1423
1444
  // src/lib/telemetry.ts
1424
- var CLI_VERSION = (true ? "3.6.1-dev.4831868" : void 0) ?? process.env.npm_package_version ?? "unknown";
1445
+ var CLI_VERSION = (true ? "3.6.1-dev.5f836c8" : void 0) ?? process.env.npm_package_version ?? "unknown";
1425
1446
  function getCliVersion() {
1426
1447
  return CLI_VERSION;
1427
1448
  }
@@ -3188,6 +3209,52 @@ async function getModelAttachmentCapability(port, model, client) {
3188
3209
  return null;
3189
3210
  }
3190
3211
  }
3212
+ async function isPinnedProviderLoaded(port, model, client) {
3213
+ if (client?.version === "v2") return null;
3214
+ const { model: baseModel } = splitModelVariant(model);
3215
+ if (!baseModel) return null;
3216
+ const slash = baseModel.indexOf("/");
3217
+ if (slash <= 0) return null;
3218
+ const providerId = baseModel.slice(0, slash);
3219
+ try {
3220
+ const res = await requestWithClient(port, client, "/config/providers");
3221
+ if (!res.ok) {
3222
+ console.error(
3223
+ `[isPinnedProviderLoaded] GET /config/providers returned HTTP ${res.status} (port ${port})`
3224
+ );
3225
+ return null;
3226
+ }
3227
+ const body = await res.json();
3228
+ if (body === null || typeof body !== "object" || Array.isArray(body)) {
3229
+ console.error(
3230
+ `[isPinnedProviderLoaded] GET /config/providers body was not a plain object (port ${port})`
3231
+ );
3232
+ return null;
3233
+ }
3234
+ const providers = body.providers;
3235
+ if (!Array.isArray(providers)) {
3236
+ console.error(
3237
+ `[isPinnedProviderLoaded] GET /config/providers body had no providers array (port ${port})`
3238
+ );
3239
+ return null;
3240
+ }
3241
+ const providerIds = providers.filter(
3242
+ (provider) => provider !== null && typeof provider === "object" && typeof provider.id === "string"
3243
+ ).map((provider) => provider.id);
3244
+ if (providerIds.length === 0) {
3245
+ console.error(
3246
+ `[isPinnedProviderLoaded] GET /config/providers had no provider entries with string ids (port ${port})`
3247
+ );
3248
+ return null;
3249
+ }
3250
+ return providerIds.includes(providerId);
3251
+ } catch (err) {
3252
+ console.error(
3253
+ `[isPinnedProviderLoaded] GET /config/providers failed (port ${port}): ${err instanceof Error ? err.message : String(err)}`
3254
+ );
3255
+ return null;
3256
+ }
3257
+ }
3191
3258
  async function buildFileParts(attachments, capable) {
3192
3259
  const outcomes = [];
3193
3260
  const parts = [];
@@ -5600,7 +5667,11 @@ function isSessionDbProvenanceRecord(value) {
5600
5667
  var OPENCODE2_PACKAGE_SPEC = "@opencode-ai/cli@0.0.0-beta-17823";
5601
5668
 
5602
5669
  // src/lib/opencode/opencode-version-gate.ts
5603
- var QUEUE_VALIDATED_OPENCODE_VERSIONS = ["1.17.11", "1.18.3"];
5670
+ var QUEUE_VALIDATED_OPENCODE_VERSIONS = [
5671
+ "1.17.11",
5672
+ "1.18.3",
5673
+ "1.18.35"
5674
+ ];
5604
5675
  function isQueueValidatedVersion(version2) {
5605
5676
  if (!version2) return false;
5606
5677
  return QUEUE_VALIDATED_OPENCODE_VERSIONS.includes(version2);
@@ -6645,6 +6716,7 @@ function connectTunnel(options) {
6645
6716
  }, 3e4);
6646
6717
  let relaySilenceTimeout;
6647
6718
  let relaySilenceTimedOut = false;
6719
+ let relayConnectionId;
6648
6720
  const clearRelaySilenceTimeout = () => {
6649
6721
  if (relaySilenceTimeout === void 0) return;
6650
6722
  clearTimeout(relaySilenceTimeout);
@@ -6730,7 +6802,8 @@ function connectTunnel(options) {
6730
6802
  armRelaySilenceTimeout();
6731
6803
  forwarder.setBinaryFramesSupported(message.binary_frames === true);
6732
6804
  const connectedAgentId = message.agent_id ?? agentId;
6733
- onConnected?.(connectedAgentId);
6805
+ relayConnectionId = message.connection_id;
6806
+ onConnected?.(connectedAgentId, relayConnectionId);
6734
6807
  resolve5({
6735
6808
  ws,
6736
6809
  close: () => ws.close(1e3, "CLI shutdown")
@@ -6767,7 +6840,7 @@ function connectTunnel(options) {
6767
6840
  clearRelaySilenceTimeout();
6768
6841
  const reasonStr = (relaySilenceTimedOut ? "no relay heartbeat for 90s \u2014 reconnecting" : void 0) || reason.toString() || upgradeRejection || (code === 1006 ? "abnormal closure" : "No reason provided");
6769
6842
  forwarder.abortAll();
6770
- onDisconnected?.(code, reasonStr);
6843
+ onDisconnected?.(code, reasonStr, relayConnectionId);
6771
6844
  });
6772
6845
  });
6773
6846
  }
@@ -6830,7 +6903,7 @@ var RunnerConnection = class _RunnerConnection {
6830
6903
  authHeader: this.opts.getAuthHeader(),
6831
6904
  port: this.opts.port,
6832
6905
  openCodePassword: this.opts.openCodePassword,
6833
- onConnected: (agentId) => {
6906
+ onConnected: (agentId, relayConnectionId) => {
6834
6907
  const attempt = this.reconnectAttempt + 1;
6835
6908
  this.reconnectAttempt = 0;
6836
6909
  this.reconnecting = false;
@@ -6840,13 +6913,17 @@ var RunnerConnection = class _RunnerConnection {
6840
6913
  this.disconnectedAtMs = null;
6841
6914
  events.onConnected(agentId, isReconnect, {
6842
6915
  generation: this.generation,
6916
+ relayConnectionId: relayConnectionId ?? null,
6843
6917
  attempt,
6844
6918
  downtimeMs
6845
6919
  });
6846
6920
  },
6847
- onDisconnected: (code, reason) => {
6921
+ onDisconnected: (code, reason, relayConnectionId) => {
6848
6922
  this.disconnectedAtMs = this.now();
6849
- events.onDisconnected(code, reason, { generation: this.generation });
6923
+ events.onDisconnected(code, reason, {
6924
+ generation: this.generation,
6925
+ relayConnectionId: relayConnectionId ?? null
6926
+ });
6850
6927
  const relayRequestedReconnect = code === 1e3 && _RunnerConnection.RELAY_RECONNECT_CLOSE_REASONS.has(reason);
6851
6928
  if (this.opts.isRunning() && (code !== 1e3 || relayRequestedReconnect) && !this.reconnecting) {
6852
6929
  this.reconnectPromise = this.connectWithRetry(true).catch((err) => {
@@ -8691,6 +8768,47 @@ var ChannelDriver = class _ChannelDriver {
8691
8768
  agent: message.opencode_agent ?? void 0,
8692
8769
  model: message.opencode_model ?? void 0
8693
8770
  };
8771
+ const pinnedProviderLoaded = await isPinnedProviderLoaded(
8772
+ this.port,
8773
+ options.model,
8774
+ this.openCodeClient
8775
+ );
8776
+ if (pinnedProviderLoaded === false) {
8777
+ const dispatchedModel = message.opencode_model;
8778
+ const separator = dispatchedModel?.indexOf("/") ?? -1;
8779
+ const hasProviderAndModel = dispatchedModel !== null && separator > 0 && separator < dispatchedModel.length - 1;
8780
+ const providerId = hasProviderAndModel ? dispatchedModel.slice(0, separator) : null;
8781
+ const modelId = hasProviderAndModel ? dispatchedModel.slice(separator + 1) : null;
8782
+ const errorMessage3 = `Provider namespace not loaded on this runner: ${message.opencode_model}. Refused before dispatch; no turn was started.`;
8783
+ this.log({
8784
+ level: "error",
8785
+ message: `Refusing message ${message.id.slice(0, 8)} in conversation ${conv.id.slice(0, 8)}: provider namespace ${providerId ?? "(unknown)"} is not loaded; no turn was started`,
8786
+ conversation_id: conv.id,
8787
+ message_id: message.id
8788
+ });
8789
+ try {
8790
+ await this.markFailed(conv.id, message.id, sessionId, errorMessage3, void 0, {
8791
+ classification: {
8792
+ kind: "model_auth",
8793
+ providerId,
8794
+ modelId,
8795
+ reason: "missing"
8796
+ },
8797
+ errorShape: { name: null, statusCode: null }
8798
+ });
8799
+ this.signalDispatchNotStarted(conv, message, "model_provider_absent");
8800
+ } catch (markErr) {
8801
+ this.log({
8802
+ level: "warn",
8803
+ message: `markFailed PATCH for refused message ${message.id.slice(0, 8)} (conversation ${conv.id.slice(0, 8)}) failed: ${markErr instanceof Error ? markErr.message : String(markErr)}`,
8804
+ conversation_id: conv.id,
8805
+ message_id: message.id
8806
+ });
8807
+ this.signalDispatchNotStarted(conv, message, "failure_unreported");
8808
+ }
8809
+ await this.repairProviderRegistry(conv.id, message.id);
8810
+ break;
8811
+ }
8694
8812
  let opencodeMessageId;
8695
8813
  let preDispatchUserIds = null;
8696
8814
  try {
@@ -13873,12 +13991,6 @@ async function configureGitHubAccess({ env, log: log3 }) {
13873
13991
  import { execFileSync as execFileSync2 } from "node:child_process";
13874
13992
  import { copyFileSync, existsSync as existsSync2, statSync as statSync6 } from "node:fs";
13875
13993
  import { isAbsolute as isAbsolute3, join as join11, resolve as resolve4 } from "node:path";
13876
- var MANAGED_PROVIDER_NAMESPACES = [
13877
- "evident-claude",
13878
- "evident-codex",
13879
- "evident-openai",
13880
- "evident-kimi"
13881
- ];
13882
13994
  function parseConfigContent(content) {
13883
13995
  if (!content?.trim()) return {};
13884
13996
  const parsed = JSON.parse(content);
@@ -13890,27 +14002,11 @@ function parseConfigContent(content) {
13890
14002
  function mergeManagedOpenCodeConfigContent(content, managedProviders) {
13891
14003
  const config = parseConfigContent(content);
13892
14004
  const provider = typeof config.provider === "object" && config.provider !== null && !Array.isArray(config.provider) ? { ...config.provider } : {};
13893
- for (const namespace of MANAGED_PROVIDER_NAMESPACES) {
14005
+ for (const namespace of CREDENTIAL_PROXY_NATIVE_NAMESPACES) {
13894
14006
  delete provider[namespace];
13895
14007
  }
13896
14008
  return JSON.stringify({ ...config, provider: { ...provider, ...managedProviders } });
13897
14009
  }
13898
- function removeManagedOpenCodeConfigContent(content) {
13899
- if (!content?.trim()) return content;
13900
- const config = parseConfigContent(content);
13901
- if (typeof config.provider !== "object" || config.provider === null || Array.isArray(config.provider)) {
13902
- return content;
13903
- }
13904
- const provider = { ...config.provider };
13905
- let changed = false;
13906
- for (const namespace of MANAGED_PROVIDER_NAMESPACES) {
13907
- if (namespace in provider) {
13908
- delete provider[namespace];
13909
- changed = true;
13910
- }
13911
- }
13912
- return changed ? JSON.stringify({ ...config, provider }) : content;
13913
- }
13914
14010
  function isFile(filePath) {
13915
14011
  return existsSync2(filePath) && statSync6(filePath).isFile();
13916
14012
  }
@@ -14372,23 +14468,23 @@ async function responseJson(response) {
14372
14468
  function readSetup(value) {
14373
14469
  if (typeof value !== "object" || value === null || Array.isArray(value)) return null;
14374
14470
  const setup = value;
14375
- if (typeof setup.runner_id !== "string" || typeof setup.generation !== "string" || typeof setup.status !== "string" || setup.token_id !== null && typeof setup.token_id !== "string") {
14471
+ if (typeof setup.runner_id !== "string" || typeof setup.generation !== "string" || typeof setup.status !== "string" || setup.token_id !== null && typeof setup.token_id !== "string" || typeof setup.acknowledged_at !== "string" && setup.acknowledged_at !== null) {
14376
14472
  return null;
14377
14473
  }
14378
14474
  return setup;
14379
14475
  }
14380
14476
  function clearLocalSetup(options) {
14381
14477
  const env = options.env ?? process.env;
14382
- (options.store ?? defaultStore).clear(options.agentId);
14383
- delete env.EVIDENT_PROXY_TOKEN;
14384
- try {
14385
- const content = removeManagedOpenCodeConfigContent(env.OPENCODE_CONFIG_CONTENT);
14386
- if (content === void 0) delete env.OPENCODE_CONFIG_CONTENT;
14387
- else env.OPENCODE_CONFIG_CONTENT = content;
14388
- } catch (error2) {
14478
+ const store = options.store ?? defaultStore;
14479
+ const stored = store.get(options.agentId);
14480
+ store.clear(options.agentId);
14481
+ const token = env.EVIDENT_PROXY_TOKEN;
14482
+ if (token !== void 0 && token === stored?.token) {
14483
+ delete env.EVIDENT_PROXY_TOKEN;
14484
+ } else if (token !== void 0) {
14389
14485
  options.log(
14390
- "MANAGED-INFERENCE-CLEANUP-PARTIAL: stored credentials were removed, but malformed OPENCODE_CONFIG_CONTENT could not be inspected",
14391
- "warn"
14486
+ `MANAGED-INFERENCE-CLEANUP-PRESERVED-EXTERNAL-TOKEN: runner=${options.agentId}`,
14487
+ "debug"
14392
14488
  );
14393
14489
  }
14394
14490
  }
@@ -14414,6 +14510,25 @@ async function discoverManagedInferenceSetup(options) {
14414
14510
  const setup = readSetup(body?.setup);
14415
14511
  return setup ? { kind: "setup", setup } : { kind: "failed", reason: "Managed setup discovery returned an invalid response" };
14416
14512
  }
14513
+ async function enrollManagedInferenceSetup(options) {
14514
+ const response = await post(options, "enroll", {});
14515
+ if (!response) {
14516
+ return { kind: "failed", reason: safeFailure("Managed credential enrollment") };
14517
+ }
14518
+ if (response.status === 404) {
14519
+ return { kind: "none" };
14520
+ }
14521
+ const body = await responseJson(response);
14522
+ if (!response.ok) {
14523
+ const serverError = body?.error;
14524
+ return {
14525
+ kind: "failed",
14526
+ reason: typeof serverError === "string" && serverError.trim() ? redactDiagnosticText(serverError).slice(0, 500) : safeFailure("Managed credential enrollment", response.status)
14527
+ };
14528
+ }
14529
+ const setup = readSetup(body?.setup);
14530
+ return setup ? { kind: "setup", setup } : { kind: "failed", reason: "Managed credential enrollment returned an invalid response" };
14531
+ }
14417
14532
  async function post(options, operation, body) {
14418
14533
  const headers = requestHeaders(options);
14419
14534
  try {
@@ -14428,31 +14543,37 @@ async function post(options, operation, body) {
14428
14543
  }
14429
14544
  }
14430
14545
  function applyCredential(options, credential) {
14431
- const { config, unsupportedProviders } = buildCredentialProxyNativeConfig({
14432
- inferenceBaseUrl: credential.inferenceBaseUrl,
14433
- modelDescriptors: credential.modelDescriptors
14434
- });
14435
- if (unsupportedProviders.length > 0 || Object.keys(config.provider).length === 0) {
14436
- return "Managed setup contains unsupported provider descriptors";
14437
- }
14438
14546
  const env = options.env ?? process.env;
14439
14547
  let merged;
14440
- try {
14441
- merged = mergeManagedOpenCodeConfigContent(env.OPENCODE_CONFIG_CONTENT, config.provider);
14442
- } catch (error2) {
14443
- return "OPENCODE_CONFIG_CONTENT is malformed; managed providers were not installed";
14548
+ if (options.autoConfigureCredentialsProxy) {
14549
+ const { config, unsupportedProviders } = buildCredentialProxyNativeConfig({
14550
+ inferenceBaseUrl: credential.inferenceBaseUrl,
14551
+ modelDescriptors: credential.modelDescriptors
14552
+ });
14553
+ if (unsupportedProviders.length > 0 || Object.keys(config.provider).length === 0) {
14554
+ return "Managed setup contains unsupported provider descriptors";
14555
+ }
14556
+ try {
14557
+ merged = mergeManagedOpenCodeConfigContent(env.OPENCODE_CONFIG_CONTENT, config.provider);
14558
+ } catch (error2) {
14559
+ return "OPENCODE_CONFIG_CONTENT is malformed; managed providers were not installed";
14560
+ }
14444
14561
  }
14445
14562
  try {
14446
14563
  (options.store ?? defaultStore).set(options.agentId, credential);
14447
14564
  } catch (error2) {
14565
+ const detail = (error2 instanceof Error ? error2.message : String(error2)).replaceAll(
14566
+ credential.token,
14567
+ "[redacted]"
14568
+ );
14448
14569
  options.log(
14449
- `MANAGED-INFERENCE-STORE-FAILED: runner=${options.agentId} generation=${credential.generation}`,
14570
+ `MANAGED-INFERENCE-STORE-FAILED: runner=${options.agentId} generation=${credential.generation} detail=${redactDiagnosticText(detail)}`,
14450
14571
  "warn"
14451
14572
  );
14452
14573
  return "Managed credentials could not be written to the protected store";
14453
14574
  }
14454
14575
  env.EVIDENT_PROXY_TOKEN = credential.token;
14455
- env.OPENCODE_CONFIG_CONTENT = merged;
14576
+ if (merged !== void 0) env.OPENCODE_CONFIG_CONTENT = merged;
14456
14577
  return null;
14457
14578
  }
14458
14579
  async function reportManagedInferenceApplyFailure(options, failure) {
@@ -14503,7 +14624,7 @@ async function prepareManagedInferenceSetup(options, discovery, health) {
14503
14624
  }
14504
14625
  return reaffirmStored(options, stored);
14505
14626
  }
14506
- if (discovery.setup.status === "acknowledged" && stored?.generation === discovery.setup.generation && stored.tokenId === discovery.setup.token_id) {
14627
+ if (discovery.setup.acknowledged_at !== null && stored?.generation === discovery.setup.generation && stored.tokenId === discovery.setup.token_id) {
14507
14628
  return reaffirmStored(options, stored);
14508
14629
  }
14509
14630
  const response = await post(options, "bootstrap", { generation: discovery.setup.generation });
@@ -14541,7 +14662,7 @@ async function acknowledgeManagedInferenceSetup(options, preparation) {
14541
14662
  const response = await post(options, "acknowledge", {
14542
14663
  generation: preparation.generation,
14543
14664
  token_id: preparation.tokenId,
14544
- config_validated: true
14665
+ config_validated: options.autoConfigureCredentialsProxy === true
14545
14666
  });
14546
14667
  if (!response?.ok) {
14547
14668
  throw new Error(
@@ -16344,13 +16465,17 @@ async function run(options) {
16344
16465
  agentId: state.agentId,
16345
16466
  apiUrl: getApiUrlConfig(),
16346
16467
  getAuthHeader: () => state.authHeader,
16468
+ autoConfigureCredentialsProxy: options.autoConfigureCredentialsProxy,
16347
16469
  log: (message, level = "info") => logActivity(state, {
16348
16470
  type: level === "error" ? "error" : "info",
16349
16471
  level,
16350
16472
  ...level === "error" ? { error: message } : { message }
16351
16473
  })
16352
16474
  };
16353
- const managedDiscovery = await discoverManagedInferenceSetup(managedSetupOptions);
16475
+ let managedDiscovery = await discoverManagedInferenceSetup(managedSetupOptions);
16476
+ if (managedDiscovery.kind === "none") {
16477
+ managedDiscovery = await enrollManagedInferenceSetup(managedSetupOptions);
16478
+ }
16354
16479
  let managedPreparation = { kind: "none" };
16355
16480
  if (managedDiscovery.kind === "failed") {
16356
16481
  managedPreparation = managedDiscovery;
@@ -16674,7 +16799,7 @@ async function run(options) {
16674
16799
  onConnected: (agentId, isReconnect, transition) => {
16675
16800
  state.connected = true;
16676
16801
  state.agentId = agentId;
16677
- const connectionMessage = isReconnect ? `Tunnel reconnected (runner: ${agentId}, generation: ${transition.generation}, attempt: ${transition.attempt}, offline for ${transition.downtimeMs}ms)` : `Tunnel connected (runner: ${agentId}, generation: ${transition.generation})`;
16802
+ const connectionMessage = isReconnect ? `Tunnel reconnected (runner: ${agentId}, generation: ${transition.generation}, relay connection: ${transition.relayConnectionId ?? "unknown"}, attempt: ${transition.attempt}, offline for ${transition.downtimeMs}ms)` : `Tunnel connected (runner: ${agentId}, generation: ${transition.generation}, relay connection: ${transition.relayConnectionId ?? "unknown"})`;
16678
16803
  logActivity(state, {
16679
16804
  type: "info",
16680
16805
  message: connectionMessage
@@ -16707,6 +16832,7 @@ async function run(options) {
16707
16832
  connected: state.opencodeConnected
16708
16833
  }),
16709
16834
  connection_generation: transition.generation,
16835
+ ...transition.relayConnectionId !== null ? { relay_connection_id: transition.relayConnectionId } : {},
16710
16836
  ...isReconnect && transition.downtimeMs !== null ? {
16711
16837
  reconnect_attempt: transition.attempt,
16712
16838
  downtime_ms: transition.downtimeMs
@@ -16737,12 +16863,13 @@ async function run(options) {
16737
16863
  const safeReason2 = redactDiagnosticText(reason).slice(0, MAX_DISCONNECT_REASON_LENGTH);
16738
16864
  logActivity(state, {
16739
16865
  type: "info",
16740
- message: `Tunnel disconnected (generation: ${transition.generation}, code: ${code}, reason: ${safeReason2})`
16866
+ message: `Tunnel disconnected (generation: ${transition.generation}, relay connection: ${transition.relayConnectionId ?? "unknown"}, code: ${code}, reason: ${safeReason2})`
16741
16867
  });
16742
16868
  emitAgentDisconnected(state.agentId, {
16743
16869
  code,
16744
16870
  reason: safeReason2,
16745
- connection_generation: transition.generation
16871
+ connection_generation: transition.generation,
16872
+ ...transition.relayConnectionId !== null ? { relay_connection_id: transition.relayConnectionId } : {}
16746
16873
  });
16747
16874
  if (state.interactive) displayStatus(state);
16748
16875
  },
@@ -16969,6 +17096,9 @@ program.command("run").description("Connect to Evident and process messages").op
16969
17096
  ).option(
16970
17097
  "--opencode-config-overlay <path>",
16971
17098
  "Apply this runner-provided OpenCode config before starting OpenCode."
17099
+ ).option(
17100
+ "--auto-configure-credentials-proxy",
17101
+ "Install Evident's generated OpenCode providers for the runner's credential pool (off by default)."
16972
17102
  ).option(
16973
17103
  "--credential-sync-marker <path>",
16974
17104
  "Own the interval credential sync and write this marker once the shutdown flush has finished, so the runner image's lifecycle hooks can wait on it."
@@ -17012,6 +17142,7 @@ program.command("run").description("Connect to Evident and process messages").op
17012
17142
  restoreSessionDb: options.restoreSessionDb,
17013
17143
  restoreRunnerCredentials: options.restoreRunnerCredentials,
17014
17144
  opencodeConfigOverlay: options.opencodeConfigOverlay,
17145
+ autoConfigureCredentialsProxy: options.autoConfigureCredentialsProxy,
17015
17146
  credentialSyncMarker: options.credentialSyncMarker
17016
17147
  });
17017
17148
  }