@alan-ai-hq/agent-manager 0.1.100 → 0.1.101

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 (2) hide show
  1. package/dist/index.cjs +54 -28
  2. package/package.json +3 -3
package/dist/index.cjs CHANGED
@@ -23397,6 +23397,12 @@ function requireManagedRunReference(registration) {
23397
23397
  if (!reference) throw new Error("Alan MCP run reference is missing");
23398
23398
  return reference;
23399
23399
  }
23400
+ function managedMcpServerName(registration, namespaceScope) {
23401
+ const reference = requireManagedRunReference(registration);
23402
+ const fingerprintSource = namespaceScope?.trim() || reference;
23403
+ const fingerprint = (0, import_crypto.createHash)("sha256").update(fingerprintSource).digest("hex").slice(0, 16);
23404
+ return `alan-run-${fingerprint}`;
23405
+ }
23400
23406
  function canonicalizeManagedMcpServerName(serverName) {
23401
23407
  return MANAGED_MCP_SERVER_PATTERN.test(serverName) ? "alan" : serverName;
23402
23408
  }
@@ -23693,7 +23699,7 @@ function createCliProblem(classified, options) {
23693
23699
  return createAlanProblem({
23694
23700
  domain: "agent_cli",
23695
23701
  code: options.code ?? CLI_PROBLEM_CODE_BY_ERROR_KIND[classified.errorKind] ?? "cli.unknown",
23696
- id: (0, import_crypto.randomUUID)(),
23702
+ id: (0, import_crypto2.randomUUID)(),
23697
23703
  title: options.finality === "terminal" ? "Agent CLI run failed" : "Agent CLI problem observed",
23698
23704
  detail: classified.message,
23699
23705
  occurredAt: options.occurredAt ?? (/* @__PURE__ */ new Date()).toISOString(),
@@ -24916,7 +24922,7 @@ function buildGeneratedImageFromInlinePayload(payload, options = {}) {
24916
24922
  const mimeType = payloadMimeType?.startsWith("image/") ? payloadMimeType : inferImageMimeType(buffer);
24917
24923
  if (!mimeType) return null;
24918
24924
  const toolId = pickString(payload, options.toolIdFields ?? ["tool_id", "toolId", "call_id"]);
24919
- const imageId = pickString(payload, options.idFields ?? ["id", "image_id"]) ?? (0, import_crypto2.randomUUID)();
24925
+ const imageId = pickString(payload, options.idFields ?? ["id", "image_id"]) ?? (0, import_crypto3.randomUUID)();
24920
24926
  const dimensions = readImageDimensions(buffer, mimeType);
24921
24927
  const filename = pickString(payload, ["filename"]) || `${toolId ?? imageId}.${extensionForMimeType(mimeType)}`;
24922
24928
  return {
@@ -24928,7 +24934,7 @@ function buildGeneratedImageFromInlinePayload(payload, options = {}) {
24928
24934
  width: typeof payload.width === "number" ? payload.width : dimensions.width,
24929
24935
  height: typeof payload.height === "number" ? payload.height : dimensions.height,
24930
24936
  data: buffer.toString("base64"),
24931
- sourceHash: (0, import_crypto2.createHash)("sha256").update(buffer).digest("hex"),
24937
+ sourceHash: (0, import_crypto3.createHash)("sha256").update(buffer).digest("hex"),
24932
24938
  ...toolId ? { toolId } : {},
24933
24939
  ts: Date.now()
24934
24940
  };
@@ -25826,7 +25832,7 @@ function selectExternalMcpServers(config2) {
25826
25832
  return selected;
25827
25833
  }
25828
25834
  function headerEnvName(server, header) {
25829
- const fingerprint = (0, import_crypto3.createHash)("sha256").update(`${server}\0${header}`).digest("hex").slice(0, 12).toUpperCase();
25835
+ const fingerprint = (0, import_crypto4.createHash)("sha256").update(`${server}\0${header}`).digest("hex").slice(0, 12).toUpperCase();
25830
25836
  return `ALAN_MCP_HEADER_${fingerprint}`;
25831
25837
  }
25832
25838
  function planExternalMcpDelivery(config2, processEnv) {
@@ -27538,6 +27544,7 @@ function buildCodexEffortArgs(selectedEffortLevel, options) {
27538
27544
  }
27539
27545
  function buildCodexManagedMcpArgs(registration, options = {}) {
27540
27546
  const proxy = buildManagedMcpStdioServer(registration, options.environment ?? {});
27547
+ const serverName = managedMcpServerName(registration, options.namespaceScope);
27541
27548
  const stdioServer = [
27542
27549
  `command = ${JSON.stringify(proxy.command)}`,
27543
27550
  `args = ${JSON.stringify(proxy.args)}`,
@@ -27548,7 +27555,7 @@ function buildCodexManagedMcpArgs(registration, options = {}) {
27548
27555
  return [
27549
27556
  ...options.strict ? ["--ignore-user-config"] : [],
27550
27557
  "-c",
27551
- `mcp_servers.alan={ ${stdioServer} }`
27558
+ `mcp_servers.${serverName}={ ${stdioServer} }`
27552
27559
  ];
27553
27560
  }
27554
27561
  function buildCodexExternalMcpArgs(servers) {
@@ -27581,7 +27588,8 @@ function createCodexRuntimeBackend(command = "codex", defaultArgs = []) {
27581
27588
  const managedMcpArgs = managedRegistration ? [
27582
27589
  ...buildCodexManagedMcpArgs(managedRegistration, {
27583
27590
  strict: isWorkflowRun(context.config),
27584
- environment: context.managedMcpProxyEnvironment
27591
+ environment: context.managedMcpProxyEnvironment,
27592
+ namespaceScope: context.config.conversationId
27585
27593
  }),
27586
27594
  ...buildCodexExternalMcpArgs(externalMcp?.servers)
27587
27595
  ] : [];
@@ -30190,7 +30198,7 @@ function leaseKeyFor(context) {
30190
30198
  if (!conversationId) return null;
30191
30199
  const runReference = context.config.alanMcp?.headers?.["x-alan-run-reference"];
30192
30200
  if (!runReference) return `conv:${conversationId}`;
30193
- const fingerprint = (0, import_crypto4.createHash)("sha256").update(runReference).digest("hex").slice(0, 16);
30201
+ const fingerprint = (0, import_crypto5.createHash)("sha256").update(runReference).digest("hex").slice(0, 16);
30194
30202
  return `conv:${conversationId}|mcp:${fingerprint}`;
30195
30203
  }
30196
30204
  function isLeaseUsable(lease) {
@@ -31243,7 +31251,7 @@ function extractGeneratedImagesFromToolResult(toolId, content, cwd, toolName, op
31243
31251
  const { width, height } = readImageDimensions2(buffer, mimeType);
31244
31252
  images.push({
31245
31253
  type: "generated_image",
31246
- id: (0, import_crypto5.randomUUID)(),
31254
+ id: (0, import_crypto6.randomUUID)(),
31247
31255
  filename: (0, import_path10.basename)(path2),
31248
31256
  mimeType,
31249
31257
  size: buffer.length,
@@ -31251,7 +31259,7 @@ function extractGeneratedImagesFromToolResult(toolId, content, cwd, toolName, op
31251
31259
  height,
31252
31260
  data: buffer.toString("base64"),
31253
31261
  sourcePath: path2,
31254
- sourceHash: (0, import_crypto5.createHash)("sha256").update(buffer).digest("hex"),
31262
+ sourceHash: (0, import_crypto6.createHash)("sha256").update(buffer).digest("hex"),
31255
31263
  toolId,
31256
31264
  ts: Date.now()
31257
31265
  });
@@ -31283,7 +31291,7 @@ function extractSessionMediaFromToolResult(toolId, content, cwd, toolName, optio
31283
31291
  media.push({
31284
31292
  type: "session_media",
31285
31293
  kind,
31286
- id: (0, import_crypto5.randomUUID)(),
31294
+ id: (0, import_crypto6.randomUUID)(),
31287
31295
  filename: (0, import_path10.basename)(path2),
31288
31296
  mimeType,
31289
31297
  size: buffer.length,
@@ -31291,7 +31299,7 @@ function extractSessionMediaFromToolResult(toolId, content, cwd, toolName, optio
31291
31299
  height: dimensions?.height,
31292
31300
  data: buffer.toString("base64"),
31293
31301
  sourcePath: path2,
31294
- sourceHash: (0, import_crypto5.createHash)("sha256").update(buffer).digest("hex"),
31302
+ sourceHash: (0, import_crypto6.createHash)("sha256").update(buffer).digest("hex"),
31295
31303
  toolId,
31296
31304
  ts: Date.now()
31297
31305
  });
@@ -31343,7 +31351,7 @@ ${output2.stderr}`;
31343
31351
  }
31344
31352
  return { ok: true };
31345
31353
  }
31346
- var import_fs, import_os, import_path, import_child_process, import_fs2, import_path2, import_fs3, import_os2, import_path3, import_readline, import_crypto, import_child_process2, import_child_process3, import_fs4, import_os3, import_path4, import_url, import_crypto2, import_crypto3, import_fs5, import_os4, import_path5, import_child_process4, import_util9, import_fs6, import_os5, import_path6, import_fs7, import_os6, import_path7, import_fs8, import_os7, import_path8, import_fs9, import_os8, import_path9, import_crypto4, import_readline2, import_url2, import_crypto5, import_fs10, import_path10, ALAN_AGENT_ENTRY_ENV, ALAN_NODE_EXECUTABLE_ENV, MANAGED_MCP_SERVER_PATTERN, MAX_PARSED_ATTACHMENTS, MAX_PARSED_ATTACHMENT_CHARS, MAX_METADATA_CHARS, AGENT_INSTRUCTIONS_FILE, MAX_INSTRUCTION_CHARS, CLI_PROBLEM_CODE_BY_ERROR_KIND, ERROR_SPECS, RESUME_SESSION_UNAVAILABLE_MESSAGE, BACKGROUND_AGENT_PARENT_EXIT_MESSAGE, TERMINAL_BACKGROUND_STATUSES, NON_TERMINAL_BACKGROUND_STATUSES, ASYNC_LAUNCH_ACK_RE, SPAWN_RETRY_DELAYS_BY_CODE, delay, SPAWN_OUTCOME_TIMEOUT_MS, MAX_INLINE_GENERATED_IMAGE_BYTES, ANTIGRAVITY_TOOL_RESULT_TYPES, parseAntigravityStructuredLine, capabilityCache, execFileAsync, flagSupportCache, HIDDEN_FLAG_PROBE_VALUE, DEBUG_ASK, CLAUDE_SUBAGENT_TOOL_NAMES, TERMINAL_TASK_NOTIFICATION_STATUSES, NON_TERMINAL_TASK_NOTIFICATION_STATUSES, parseClaudeStructuredLine, CODEX_EXIT_GRACE_MS, CODEX_BACKGROUND_EXIT_GRACE_MS, CODEX_EXIT_GRACE_SIGKILL_MS, CODEX_WORKER_TRANSCRIPT_POLL_MS, TERMINAL_COLLAB_AGENT_STATUSES, FAILED_COLLAB_AGENT_STATUSES, COLLAB_COORDINATION_TOOL_NAMES, parseCodexStructuredLine, CODEX_STARTUP_TIMEOUT_MS, ALAN_MCP_STARTUP_TIMEOUT_SEC, explicitBackgroundLaunchers, parseCopilotStructuredLine, parseCursorStructuredLine, DROID_SUBAGENT_TOOL_NAMES, DROID_TASK_OUTPUT_NAMES, DROID_TASK_STOP_NAMES, pendingTaskIdByToolId, explicitBackgroundLaunchers2, parseDroidStructuredLine, ACP_PROTOCOL_VERSION, GENERIC_GROK_RPC_ERRORS, DEFAULT_SKILL_ROOTS, KIMI_RESUME_SESSION_RE, KIMI_SUBAGENT_TOOL_NAMES, explicitBackgroundLaunchers3, parseKimiStructuredLine, AUTONOMOUS_OPENCODE_CONFIG_CONTENT, TASK_TOOL_NAME, TASK_RESULT_TAG_PATTERN, TASK_ERROR_TAG_PATTERN, parseOpencodeStructuredLine, SERVER_LISTENING_PATTERN, STARTUP_TIMEOUT_MS, HEALTH_POLL_INTERVAL_MS, HEALTH_POLL_MAX_ATTEMPTS, LEASE_IDLE_TTL_MS, serveLeases, NON_INTERACTIVE_DENY_RULES, SEND_PROMPT_MAX_RETRIES, SEND_PROMPT_RETRY_BASE_DELAY_MS, SSE_DROP_RECONCILE_MAX_ATTEMPTS, SSE_DROP_RECONCILE_POLL_INTERVAL_MS, NON_INTERACTIVE_PERMISSION_KINDS, CONTENT_FILTER_FINISH_REASONS, OUTPUT_PART_TYPES, DROID_DEFAULT_MODEL, AGENT_ACTIVITY_HEARTBEAT_MS, BaseMachineAgent, IMAGE_MIME_BY_EXT, VIDEO_MIME_BY_EXT, MAX_GENERATED_IMAGE_BYTES, MAX_SESSION_VIDEO_BYTES, MCP_INSPECTION_PLANS, UNSUPPORTED_COMMAND_PATTERN, mcpConfigWriteGateTail;
31354
+ var import_fs, import_os, import_path, import_crypto, import_child_process, import_fs2, import_path2, import_fs3, import_os2, import_path3, import_readline, import_crypto2, import_child_process2, import_child_process3, import_fs4, import_os3, import_path4, import_url, import_crypto3, import_crypto4, import_fs5, import_os4, import_path5, import_child_process4, import_util9, import_fs6, import_os5, import_path6, import_fs7, import_os6, import_path7, import_fs8, import_os7, import_path8, import_fs9, import_os8, import_path9, import_crypto5, import_readline2, import_url2, import_crypto6, import_fs10, import_path10, ALAN_AGENT_ENTRY_ENV, ALAN_NODE_EXECUTABLE_ENV, MANAGED_MCP_SERVER_PATTERN, MAX_PARSED_ATTACHMENTS, MAX_PARSED_ATTACHMENT_CHARS, MAX_METADATA_CHARS, AGENT_INSTRUCTIONS_FILE, MAX_INSTRUCTION_CHARS, CLI_PROBLEM_CODE_BY_ERROR_KIND, ERROR_SPECS, RESUME_SESSION_UNAVAILABLE_MESSAGE, BACKGROUND_AGENT_PARENT_EXIT_MESSAGE, TERMINAL_BACKGROUND_STATUSES, NON_TERMINAL_BACKGROUND_STATUSES, ASYNC_LAUNCH_ACK_RE, SPAWN_RETRY_DELAYS_BY_CODE, delay, SPAWN_OUTCOME_TIMEOUT_MS, MAX_INLINE_GENERATED_IMAGE_BYTES, ANTIGRAVITY_TOOL_RESULT_TYPES, parseAntigravityStructuredLine, capabilityCache, execFileAsync, flagSupportCache, HIDDEN_FLAG_PROBE_VALUE, DEBUG_ASK, CLAUDE_SUBAGENT_TOOL_NAMES, TERMINAL_TASK_NOTIFICATION_STATUSES, NON_TERMINAL_TASK_NOTIFICATION_STATUSES, parseClaudeStructuredLine, CODEX_EXIT_GRACE_MS, CODEX_BACKGROUND_EXIT_GRACE_MS, CODEX_EXIT_GRACE_SIGKILL_MS, CODEX_WORKER_TRANSCRIPT_POLL_MS, TERMINAL_COLLAB_AGENT_STATUSES, FAILED_COLLAB_AGENT_STATUSES, COLLAB_COORDINATION_TOOL_NAMES, parseCodexStructuredLine, CODEX_STARTUP_TIMEOUT_MS, ALAN_MCP_STARTUP_TIMEOUT_SEC, explicitBackgroundLaunchers, parseCopilotStructuredLine, parseCursorStructuredLine, DROID_SUBAGENT_TOOL_NAMES, DROID_TASK_OUTPUT_NAMES, DROID_TASK_STOP_NAMES, pendingTaskIdByToolId, explicitBackgroundLaunchers2, parseDroidStructuredLine, ACP_PROTOCOL_VERSION, GENERIC_GROK_RPC_ERRORS, DEFAULT_SKILL_ROOTS, KIMI_RESUME_SESSION_RE, KIMI_SUBAGENT_TOOL_NAMES, explicitBackgroundLaunchers3, parseKimiStructuredLine, AUTONOMOUS_OPENCODE_CONFIG_CONTENT, TASK_TOOL_NAME, TASK_RESULT_TAG_PATTERN, TASK_ERROR_TAG_PATTERN, parseOpencodeStructuredLine, SERVER_LISTENING_PATTERN, STARTUP_TIMEOUT_MS, HEALTH_POLL_INTERVAL_MS, HEALTH_POLL_MAX_ATTEMPTS, LEASE_IDLE_TTL_MS, serveLeases, NON_INTERACTIVE_DENY_RULES, SEND_PROMPT_MAX_RETRIES, SEND_PROMPT_RETRY_BASE_DELAY_MS, SSE_DROP_RECONCILE_MAX_ATTEMPTS, SSE_DROP_RECONCILE_POLL_INTERVAL_MS, NON_INTERACTIVE_PERMISSION_KINDS, CONTENT_FILTER_FINISH_REASONS, OUTPUT_PART_TYPES, DROID_DEFAULT_MODEL, AGENT_ACTIVITY_HEARTBEAT_MS, BaseMachineAgent, IMAGE_MIME_BY_EXT, VIDEO_MIME_BY_EXT, MAX_GENERATED_IMAGE_BYTES, MAX_SESSION_VIDEO_BYTES, MCP_INSPECTION_PLANS, UNSUPPORTED_COMMAND_PATTERN, mcpConfigWriteGateTail;
31347
31355
  var init_dist2 = __esm({
31348
31356
  "../agent-core/dist/index.js"() {
31349
31357
  "use strict";
@@ -31354,6 +31362,7 @@ var init_dist2 = __esm({
31354
31362
  init_types2();
31355
31363
  init_runtime_discovered_models();
31356
31364
  init_runtime_runner_status();
31365
+ import_crypto = require("crypto");
31357
31366
  init_agent2();
31358
31367
  import_child_process = require("child_process");
31359
31368
  init_types2();
@@ -31365,7 +31374,7 @@ var init_dist2 = __esm({
31365
31374
  init_agent2();
31366
31375
  import_readline = require("readline");
31367
31376
  init_agent2();
31368
- import_crypto = require("crypto");
31377
+ import_crypto2 = require("crypto");
31369
31378
  init_agent2();
31370
31379
  import_child_process2 = require("child_process");
31371
31380
  import_child_process3 = require("child_process");
@@ -31373,9 +31382,9 @@ var init_dist2 = __esm({
31373
31382
  import_os3 = require("os");
31374
31383
  import_path4 = require("path");
31375
31384
  import_url = require("url");
31376
- import_crypto2 = require("crypto");
31377
- init_types2();
31378
31385
  import_crypto3 = require("crypto");
31386
+ init_types2();
31387
+ import_crypto4 = require("crypto");
31379
31388
  init_agent2();
31380
31389
  import_fs5 = require("fs");
31381
31390
  import_os4 = require("os");
@@ -31400,11 +31409,11 @@ var init_dist2 = __esm({
31400
31409
  import_fs9 = require("fs");
31401
31410
  import_os8 = require("os");
31402
31411
  import_path9 = require("path");
31403
- import_crypto4 = require("crypto");
31412
+ import_crypto5 = require("crypto");
31404
31413
  import_readline2 = require("readline");
31405
31414
  import_url2 = require("url");
31406
31415
  init_agent2();
31407
- import_crypto5 = require("crypto");
31416
+ import_crypto6 = require("crypto");
31408
31417
  import_fs10 = require("fs");
31409
31418
  import_path10 = require("path");
31410
31419
  init_agent2();
@@ -35561,7 +35570,7 @@ var require_websocket = __commonJS({
35561
35570
  var http2 = require("http");
35562
35571
  var net = require("net");
35563
35572
  var tls = require("tls");
35564
- var { randomBytes: randomBytes12, createHash: createHash18 } = require("crypto");
35573
+ var { randomBytes: randomBytes12, createHash: createHash19 } = require("crypto");
35565
35574
  var { Duplex, Readable: Readable2 } = require("stream");
35566
35575
  var { URL: URL2 } = require("url");
35567
35576
  var PerMessageDeflate = require_permessage_deflate();
@@ -36218,7 +36227,7 @@ var require_websocket = __commonJS({
36218
36227
  abortHandshake(websocket, socket, "Invalid Upgrade header");
36219
36228
  return;
36220
36229
  }
36221
- const digest = createHash18("sha1").update(key + GUID).digest("base64");
36230
+ const digest = createHash19("sha1").update(key + GUID).digest("base64");
36222
36231
  if (res.headers["sec-websocket-accept"] !== digest) {
36223
36232
  abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
36224
36233
  return;
@@ -36585,7 +36594,7 @@ var require_websocket_server = __commonJS({
36585
36594
  var EventEmitter = require("events");
36586
36595
  var http2 = require("http");
36587
36596
  var { Duplex } = require("stream");
36588
- var { createHash: createHash18 } = require("crypto");
36597
+ var { createHash: createHash19 } = require("crypto");
36589
36598
  var extension = require_extension();
36590
36599
  var PerMessageDeflate = require_permessage_deflate();
36591
36600
  var subprotocol = require_subprotocol();
@@ -36882,7 +36891,7 @@ var require_websocket_server = __commonJS({
36882
36891
  );
36883
36892
  }
36884
36893
  if (this._state > RUNNING) return abortHandshake(socket, 503);
36885
- const digest = createHash18("sha1").update(key + GUID).digest("base64");
36894
+ const digest = createHash19("sha1").update(key + GUID).digest("base64");
36886
36895
  const headers = [
36887
36896
  "HTTP/1.1 101 Switching Protocols",
36888
36897
  "Upgrade: websocket",
@@ -49032,7 +49041,7 @@ function describeError(error61) {
49032
49041
  }
49033
49042
 
49034
49043
  // src/version.ts
49035
- var AGENT_VERSION = "0.1.100";
49044
+ var AGENT_VERSION = "0.1.101";
49036
49045
 
49037
49046
  // src/daemon-worktree.ts
49038
49047
  var import_node_child_process3 = require("child_process");
@@ -59421,8 +59430,10 @@ var CoreAgent = class _CoreAgent extends BaseMachineAgent {
59421
59430
  ...this.cliEnvOverrides
59422
59431
  };
59423
59432
  augmented.ALAN_MANAGED_RUN = "1";
59424
- if (process.argv[1]) augmented[ALAN_AGENT_ENTRY_ENV] = process.argv[1];
59425
- augmented[ALAN_NODE_EXECUTABLE_ENV] = process.execPath;
59433
+ if (!augmented[ALAN_AGENT_ENTRY_ENV] && process.argv[1]) {
59434
+ augmented[ALAN_AGENT_ENTRY_ENV] = process.argv[1];
59435
+ }
59436
+ augmented[ALAN_NODE_EXECUTABLE_ENV] ??= process.execPath;
59426
59437
  if (this.runId) augmented.ALAN_RUN_ID = this.runId;
59427
59438
  else delete augmented.ALAN_RUN_ID;
59428
59439
  const backendKind = this.runtime.backendKind ?? "";
@@ -76378,7 +76389,7 @@ var StdioClientTransport = class {
76378
76389
  };
76379
76390
 
76380
76391
  // src/mcp-readiness.ts
76381
- var DEFAULT_TIMEOUT_MS = 3e3;
76392
+ var DEFAULT_TIMEOUT_MS = 1e4;
76382
76393
  var RETRY_DELAY_MS2 = 100;
76383
76394
  var McpProxyConfigurationError = class extends Error {
76384
76395
  };
@@ -76413,6 +76424,11 @@ async function defaultClientFactory(input2, proxyEnvironment = {
76413
76424
  args: proxy.args,
76414
76425
  env: {
76415
76426
  ...getDefaultEnvironment(),
76427
+ ...Object.fromEntries(
76428
+ Object.entries(proxyEnvironment).filter(
76429
+ ([key, value2]) => Boolean(value2) && key !== ALAN_NODE_EXECUTABLE_ENV && key !== ALAN_AGENT_ENTRY_ENV
76430
+ )
76431
+ ),
76416
76432
  ALAN_MANAGED_RUN: "1",
76417
76433
  [ALAN_RUN_REFERENCE_ENV]: requireManagedRunReference(input2.registration)
76418
76434
  },
@@ -76586,7 +76602,8 @@ async function prepareAlanMcpForRun(_backendKind, registration, options = {}) {
76586
76602
  void probeAlanMcpReadiness(registration, {
76587
76603
  paths: [],
76588
76604
  clientFactory: options.clientFactory,
76589
- timeoutMs: options.timeoutMs
76605
+ timeoutMs: options.timeoutMs,
76606
+ proxyEnvironment: options.proxyEnvironment
76590
76607
  }).then((result) => {
76591
76608
  if (!result.ok) options.onObservedResult?.(result);
76592
76609
  }).catch(() => void 0);
@@ -76600,7 +76617,8 @@ async function prepareAlanMcpForRun(_backendKind, registration, options = {}) {
76600
76617
  const probed = await probeAlanMcpReadiness(registration, {
76601
76618
  paths: [],
76602
76619
  clientFactory: options.clientFactory,
76603
- timeoutMs: options.timeoutMs
76620
+ timeoutMs: options.timeoutMs,
76621
+ proxyEnvironment: options.proxyEnvironment
76604
76622
  });
76605
76623
  if (!probed.ok) return probed;
76606
76624
  return { ...probed, providerLoadStatus: "indeterminate" };
@@ -77212,6 +77230,7 @@ async function handleAgentExecute(ctx, payload) {
77212
77230
  getHeartbeatSeq,
77213
77231
  endpointProfile,
77214
77232
  configPath,
77233
+ managedMcpProxyEnvironment,
77215
77234
  endpointMismatch,
77216
77235
  workspaceAccessTracker,
77217
77236
  getDisconnectedSinceMs,
@@ -77534,6 +77553,7 @@ async function handleAgentExecute(ctx, payload) {
77534
77553
  }
77535
77554
  }
77536
77555
  const mcpPromise = prepareAlanMcpForRun(registrationBackendKind, alanMcp, {
77556
+ proxyEnvironment: managedMcpProxyEnvironment,
77537
77557
  onObservedResult: (failure) => {
77538
77558
  pushLog(`mcp-readiness-observed run=${payload.runId} code=${failure.code}`);
77539
77559
  console.warn("[alan-agent] Alan MCP readiness observed failure", {
@@ -77720,6 +77740,11 @@ async function handleAgentExecute(ctx, payload) {
77720
77740
  runtimeCommand,
77721
77741
  runId: payload.runId,
77722
77742
  providerApiKey: payload.providerApiKey,
77743
+ cliEnvOverrides: Object.fromEntries(
77744
+ Object.entries(managedMcpProxyEnvironment ?? {}).filter(
77745
+ (entry) => Boolean(entry[1])
77746
+ )
77747
+ ),
77723
77748
  onProviderSpawned: (pid) => {
77724
77749
  releaseSharedConfigLock();
77725
77750
  const entry = activeAgents.get(payload.runId);
@@ -82949,7 +82974,7 @@ var SuspensionDetector = class {
82949
82974
  };
82950
82975
 
82951
82976
  // src/daemon-start.ts
82952
- async function startDaemon(args) {
82977
+ async function startDaemon(args, options = {}) {
82953
82978
  bindConfigPath(args);
82954
82979
  const stored = readConfig();
82955
82980
  const installationId = stored.installationId ?? (0, import_node_crypto19.randomUUID)();
@@ -83762,6 +83787,7 @@ async function startDaemon(args) {
83762
83787
  getHeartbeatSeq: () => heartbeatSeq,
83763
83788
  endpointProfile,
83764
83789
  configPath,
83790
+ managedMcpProxyEnvironment: options.managedMcpProxyEnvironment,
83765
83791
  endpointMismatch,
83766
83792
  workspaceAccessTracker,
83767
83793
  getDisconnectedSinceMs: () => disconnectedSinceMs,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alan-ai-hq/agent-manager",
3
- "version": "0.1.100",
3
+ "version": "0.1.101",
4
4
  "type": "module",
5
5
  "description": "Alan agent runtime — cloud sandbox and local daemon (alan-agent CLI)",
6
6
  "bin": {
@@ -26,9 +26,9 @@
26
26
  "tsup": "^8.5.1",
27
27
  "tsx": "^4.19.0",
28
28
  "typescript": "~5.9.3",
29
- "@alan-ai/agent-core": "0.1.0",
30
29
  "@alan-ai/sandbox-runtime-spec": "0.1.0",
31
- "@alan-ai/shared": "0.1.0"
30
+ "@alan-ai/shared": "0.1.0",
31
+ "@alan-ai/agent-core": "0.1.0"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "tsup",