@alan-ai-hq/agent-manager-linux-arm64 0.1.158 → 0.1.160

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/alan-holder.cjs CHANGED
@@ -22443,6 +22443,56 @@ var init_run_log_upload = __esm({
22443
22443
  }
22444
22444
  });
22445
22445
 
22446
+ // ../shared/dist/runtime-v2/run-media.js
22447
+ function runMediaPath(runId) {
22448
+ return `/public/machines/me/runs/${encodeURIComponent(runId)}/media`;
22449
+ }
22450
+ function runMediaCompletePath(runId, mediaId) {
22451
+ return `${runMediaPath(runId)}/${encodeURIComponent(mediaId)}/complete`;
22452
+ }
22453
+ var INT4_MAX, runMediaSourceSchema, runMediaUploadRequestSchema, runMediaUploadTargetSchema, runMediaUploadResponseSchema, runMediaCompleteResponseSchema;
22454
+ var init_run_media = __esm({
22455
+ "../shared/dist/runtime-v2/run-media.js"() {
22456
+ "use strict";
22457
+ init_zod();
22458
+ INT4_MAX = 2147483647;
22459
+ runMediaSourceSchema = external_exports.enum(["generated_image", "session_media"]);
22460
+ runMediaUploadRequestSchema = external_exports.object({
22461
+ /** The `id` the transcript update carries; one upload per id and run. */
22462
+ mediaId: external_exports.string().min(1).max(200),
22463
+ source: runMediaSourceSchema,
22464
+ kind: external_exports.enum(["image", "video"]),
22465
+ mimeType: external_exports.string().min(1).max(200),
22466
+ filename: external_exports.string().min(1).max(500),
22467
+ bytes: external_exports.number().int().positive().max(INT4_MAX),
22468
+ sha256: external_exports.string().regex(/^[0-9a-f]{64}$/),
22469
+ width: external_exports.number().int().min(0).max(INT4_MAX).nullish(),
22470
+ height: external_exports.number().int().min(0).max(INT4_MAX).nullish(),
22471
+ toolId: external_exports.string().max(500).optional(),
22472
+ sourcePath: external_exports.string().max(4096).optional(),
22473
+ ts: external_exports.number().int().positive().optional()
22474
+ });
22475
+ runMediaUploadTargetSchema = external_exports.object({
22476
+ url: external_exports.url(),
22477
+ /** Every header the signed PUT expects, besides the body's `content-length`. */
22478
+ headers: external_exports.record(external_exports.string(), external_exports.string()),
22479
+ expiresAt: external_exports.iso.datetime()
22480
+ });
22481
+ runMediaUploadResponseSchema = external_exports.discriminatedUnion("status", [
22482
+ external_exports.object({
22483
+ status: external_exports.literal("upload"),
22484
+ mediaId: external_exports.string(),
22485
+ upload: runMediaUploadTargetSchema
22486
+ }),
22487
+ external_exports.object({ status: external_exports.literal("ready"), mediaId: external_exports.string() })
22488
+ ]);
22489
+ runMediaCompleteResponseSchema = external_exports.object({
22490
+ status: external_exports.literal("ready"),
22491
+ mediaId: external_exports.string()
22492
+ });
22493
+ }
22494
+ });
22495
+
22446
22496
  // ../shared/dist/runtime-v2/skills.js
22447
22497
  var MAX_MACHINE_SKILLS, installedMachineSkillSchema, MAX_SKILL_UPLOADS, machineSkillScanRepositorySchema, machineSkillScanContextSchema, machineLocalSkillsReportSchema, machineSkillUploadSchema, machineSkillsSyncRequestSchema, desiredMachineSkillSchema, machineSkillDownloadSchema, machineSkillsSyncResponseSchema;
22448
22498
  var init_skills = __esm({
@@ -22565,6 +22615,7 @@ var init_runtime_v2 = __esm({
22565
22615
  init_mcp();
22566
22616
  init_run_log();
22567
22617
  init_run_log_upload();
22618
+ init_run_media();
22568
22619
  init_skills();
22569
22620
  init_workspace();
22570
22621
  }
@@ -25098,11 +25149,15 @@ var init_background_task = __esm({
25098
25149
  function isUpdate(update, kind) {
25099
25150
  return update.sessionUpdate === kind;
25100
25151
  }
25101
- var STEER_ID_META;
25152
+ var STEER_ID_META, MEDIA_SESSION_UPDATE_KINDS;
25102
25153
  var init_types2 = __esm({
25103
25154
  "../shared/dist/agent/acp/types.js"() {
25104
25155
  "use strict";
25105
25156
  STEER_ID_META = "alan.dev/steerId";
25157
+ MEDIA_SESSION_UPDATE_KINDS = /* @__PURE__ */ new Set([
25158
+ "_alan/generated_image",
25159
+ "_alan/session_media"
25160
+ ]);
25106
25161
  }
25107
25162
  });
25108
25163
 
@@ -25210,9 +25265,14 @@ var init_session_activity = __esm({
25210
25265
  });
25211
25266
 
25212
25267
  // ../shared/dist/agent/acp/transcript-byte-decoder.js
25268
+ var MIN_ELIDED_DATA_BYTES, DATA_KEY, MEDIA_MARKERS;
25213
25269
  var init_transcript_byte_decoder = __esm({
25214
25270
  "../shared/dist/agent/acp/transcript-byte-decoder.js"() {
25215
25271
  "use strict";
25272
+ init_types2();
25273
+ MIN_ELIDED_DATA_BYTES = 16 * 1024;
25274
+ DATA_KEY = new TextEncoder().encode('"data":"');
25275
+ MEDIA_MARKERS = [...MEDIA_SESSION_UPDATE_KINDS].map((kind) => new TextEncoder().encode(JSON.stringify(kind)));
25216
25276
  }
25217
25277
  });
25218
25278
 
@@ -26113,7 +26173,7 @@ var init_chunk_ZCTKXKYY = __esm({
26113
26173
  }
26114
26174
  });
26115
26175
 
26116
- // ../agent-core/dist/chunk-FYZKVT3E.js
26176
+ // ../agent-core/dist/chunk-WD7O4DYQ.js
26117
26177
  function detectImageMimeType(buffer) {
26118
26178
  if (buffer.length >= 8 && buffer.subarray(0, 8).equals(PNG_SIGNATURE)) return "image/png";
26119
26179
  if (buffer.length >= 3 && buffer[0] === 255 && buffer[1] === 216 && buffer[2] === 255) {
@@ -26249,6 +26309,27 @@ function resultText(update) {
26249
26309
  if (typeof raw === "string") return raw;
26250
26310
  return raw === void 0 ? "" : JSON.stringify(raw);
26251
26311
  }
26312
+ function mediaUpdate(file2, body) {
26313
+ const fields = {
26314
+ id: file2.mediaId,
26315
+ filename: file2.filename,
26316
+ mimeType: file2.mimeType,
26317
+ size: file2.data.length,
26318
+ ...body,
26319
+ sourcePath: file2.sourcePath,
26320
+ sourceHash: file2.sha256,
26321
+ toolId: file2.toolId,
26322
+ ts: file2.ts,
26323
+ ...file2.width === void 0 ? {} : { width: file2.width },
26324
+ ...file2.height === void 0 ? {} : { height: file2.height }
26325
+ };
26326
+ if (file2.source === "generated_image") {
26327
+ const image = { type: "generated_image", ...fields };
26328
+ return { sessionUpdate: "_alan/generated_image", image };
26329
+ }
26330
+ const media = { type: "session_media", kind: file2.kind, ...fields };
26331
+ return { sessionUpdate: "_alan/session_media", media };
26332
+ }
26252
26333
  function updateRequiredMessage(requirement, found) {
26253
26334
  const { cli, minimumVersion, feature } = requirement;
26254
26335
  const installed = found ? `${cli} ${found}` : `The ${cli} CLI`;
@@ -26533,8 +26614,8 @@ function silentStartError(name, timeoutMs) {
26533
26614
  };
26534
26615
  }
26535
26616
  var import_crypto4, import_fs5, import_path4, PNG_SIGNATURE, IMAGE_MIME_BY_EXT, VIDEO_MIME_BY_EXT, IMAGE_EXTENSIONS, VIDEO_EXTENSIONS, MAX_IMAGE_BYTES, MAX_VIDEO_BYTES, MAX_TURN_MEDIA_DATA_CHARS, MTIME_SLACK_MS, AGENT_BROWSER_MENTION, AGENT_BROWSER_CAPTURE_COMMAND, LocalMediaReader, SessionOpenRefusal, JsonRpcError, ACP_PROTOCOL_VERSION, ACP_ERROR, STDERR_TAIL_LINES, RESULT_EXIT_GRACE_MS, PerTurnSession;
26536
- var init_chunk_FYZKVT3E = __esm({
26537
- "../agent-core/dist/chunk-FYZKVT3E.js"() {
26617
+ var init_chunk_WD7O4DYQ = __esm({
26618
+ "../agent-core/dist/chunk-WD7O4DYQ.js"() {
26538
26619
  "use strict";
26539
26620
  init_chunk_OUEMTEUX();
26540
26621
  init_chunk_ZCTKXKYY();
@@ -26576,8 +26657,12 @@ var init_chunk_FYZKVT3E = __esm({
26576
26657
  this.#cwd = cwd;
26577
26658
  this.#clock = clock;
26578
26659
  }
26579
- /** Updates to record after `update`; nothing for anything but a tool call, which is almost all. */
26660
+ /** Updates to record after `update`, with the bytes inline; nothing for most updates. */
26580
26661
  read(update) {
26662
+ return this.find(update).map((found) => this.inline(found));
26663
+ }
26664
+ /** The media files a completed tool call wrote; nothing for anything but a tool call. */
26665
+ find(update) {
26581
26666
  if (!isUpdate(update, "tool_call_update")) return [];
26582
26667
  const toolCallId = update.toolCallId;
26583
26668
  if (update.name !== void 0 || update.rawInput !== void 0) {
@@ -26623,20 +26708,42 @@ var init_chunk_FYZKVT3E = __esm({
26623
26708
  named: /* @__PURE__ */ new Set([...capturePaths(tool, content, extensions, cwd), ...this.#pathHints])
26624
26709
  });
26625
26710
  }
26626
- #payloadFields(file2, toolId, explicit) {
26627
- const dataChars = base64Length(file2.buffer.length);
26628
- const inline = explicit || this.#mediaDataChars + dataChars <= MAX_TURN_MEDIA_DATA_CHARS;
26711
+ /** The update carrying the file's bytes, unless the turn's budget is spent on media nobody asked for. */
26712
+ inline(found) {
26713
+ const { file: file2 } = found;
26714
+ const dataChars = base64Length(file2.data.length);
26715
+ const inline = found.explicit || this.#mediaDataChars + dataChars <= MAX_TURN_MEDIA_DATA_CHARS;
26629
26716
  if (inline) this.#mediaDataChars += dataChars;
26717
+ return mediaUpdate(
26718
+ file2,
26719
+ inline ? { data: file2.data.toString("base64") } : { inlineDataOmitted: true }
26720
+ );
26721
+ }
26722
+ /** Uploads the file and returns a reference to it; inline as `inline` does when the upload fails. */
26723
+ async publish(found, uploader, signal) {
26724
+ try {
26725
+ await uploader.upload(found.file, signal);
26726
+ return mediaUpdate(found.file, { uploaded: true });
26727
+ } catch {
26728
+ return this.inline(found);
26729
+ }
26730
+ }
26731
+ #found(file2, toolId, source, kind, explicit) {
26630
26732
  return {
26631
- id: (0, import_crypto4.randomUUID)(),
26632
- filename: (0, import_path4.basename)(file2.path),
26633
- mimeType: file2.mimeType,
26634
- size: file2.buffer.length,
26635
- ...inline ? { data: file2.buffer.toString("base64") } : { inlineDataOmitted: true },
26636
- sourcePath: file2.path,
26637
- sourceHash: (0, import_crypto4.createHash)("sha256").update(file2.buffer).digest("hex"),
26638
- toolId,
26639
- ts: this.#clock.now()
26733
+ explicit,
26734
+ file: {
26735
+ mediaId: (0, import_crypto4.randomUUID)(),
26736
+ source,
26737
+ kind,
26738
+ mimeType: file2.mimeType,
26739
+ filename: (0, import_path4.basename)(file2.path),
26740
+ data: file2.buffer,
26741
+ sha256: (0, import_crypto4.createHash)("sha256").update(file2.buffer).digest("hex"),
26742
+ ...kind === "image" ? imageDimensions(file2.buffer, file2.mimeType) : {},
26743
+ toolId,
26744
+ sourcePath: file2.path,
26745
+ ts: this.#clock.now()
26746
+ }
26640
26747
  };
26641
26748
  }
26642
26749
  #generatedImages(toolId, tool, content) {
@@ -26645,14 +26752,7 @@ var init_chunk_FYZKVT3E = __esm({
26645
26752
  mimeByExt: IMAGE_MIME_BY_EXT,
26646
26753
  maxBytes: MAX_IMAGE_BYTES
26647
26754
  });
26648
- return files.map((file2) => {
26649
- const image = {
26650
- type: "generated_image",
26651
- ...this.#payloadFields(file2, toolId, true),
26652
- ...imageDimensions(file2.buffer, file2.mimeType)
26653
- };
26654
- return { sessionUpdate: "_alan/generated_image", image };
26655
- });
26755
+ return files.map((file2) => this.#found(file2, toolId, "generated_image", "image", true));
26656
26756
  }
26657
26757
  #sessionMedia(toolId, tool, content) {
26658
26758
  const isVideo = isAgentBrowserMedia(tool, content, "video");
@@ -26667,13 +26767,7 @@ var init_chunk_FYZKVT3E = __esm({
26667
26767
  );
26668
26768
  return files.map((file2) => {
26669
26769
  this.#pathHints.delete(file2.path);
26670
- const media = {
26671
- type: "session_media",
26672
- kind,
26673
- ...this.#payloadFields(file2, toolId, explicit),
26674
- ...kind === "image" ? imageDimensions(file2.buffer, file2.mimeType) : {}
26675
- };
26676
- return { sessionUpdate: "_alan/session_media", media };
26770
+ return this.#found(file2, toolId, "session_media", kind, explicit);
26677
26771
  });
26678
26772
  }
26679
26773
  };
@@ -27868,16 +27962,16 @@ function externalServerConfig(server) {
27868
27962
  };
27869
27963
  }
27870
27964
  function claudeMcpConfig(mcp) {
27871
- const mcpServers = /* @__PURE__ */ Object.create(null);
27965
+ const mcpServers2 = /* @__PURE__ */ Object.create(null);
27872
27966
  for (const [name, server] of Object.entries(mcp.externalServers ?? {})) {
27873
- mcpServers[name] = externalServerConfig(server);
27967
+ mcpServers2[name] = externalServerConfig(server);
27874
27968
  }
27875
- mcpServers.alan = {
27969
+ mcpServers2.alan = {
27876
27970
  type: "http",
27877
27971
  url: mcp.alanMcpUrl,
27878
27972
  headers: managedMcpHeaders(mcp.identity)
27879
27973
  };
27880
- return { mcpServers };
27974
+ return { mcpServers: mcpServers2 };
27881
27975
  }
27882
27976
  function carriesCredential(mcp) {
27883
27977
  return mcp.identity.scope === "conversation" && mcp.identity.authorization !== void 0;
@@ -28102,11 +28196,27 @@ function parseStreamEvent(event, state) {
28102
28196
  function stringList(value) {
28103
28197
  return asArray(value).map((item) => asString(item)).filter(Boolean);
28104
28198
  }
28199
+ function mcpServers(value) {
28200
+ const servers = [];
28201
+ for (const item of asArray(value)) {
28202
+ const record2 = asRecord(item);
28203
+ const name = asString(record2?.name);
28204
+ if (!record2 || !name) continue;
28205
+ const source = asString(record2.source);
28206
+ servers.push({
28207
+ name,
28208
+ status: CLAUDE_MCP_STATUS[asString(record2.status)] ?? "unknown",
28209
+ ...source ? { source } : {}
28210
+ });
28211
+ }
28212
+ return servers;
28213
+ }
28105
28214
  function initUpdates(event, state) {
28106
28215
  const model = asString(event.model);
28107
28216
  if (model) state.model = model;
28108
28217
  const tools = stringList(event.tools);
28109
28218
  const slashCommands = stringList(event.slash_commands);
28219
+ const servers = mcpServers(event.mcp_servers);
28110
28220
  return [
28111
28221
  {
28112
28222
  sessionUpdate: "_alan/log",
@@ -28120,7 +28230,8 @@ function initUpdates(event, state) {
28120
28230
  ...tools.length > 0 ? { [TOOLS_META]: tools } : {},
28121
28231
  ...slashCommands.length > 0 ? { [SLASH_COMMANDS_META]: slashCommands } : {}
28122
28232
  }
28123
- }
28233
+ },
28234
+ ...servers.length > 0 ? [{ sessionUpdate: "_alan/mcp_servers", servers }] : []
28124
28235
  ];
28125
28236
  }
28126
28237
  function thinkingTokens(event) {
@@ -28880,12 +28991,12 @@ async function claudeTurnInput(run, context) {
28880
28991
  );
28881
28992
  return { turnId: run.runId, text: text2, ...encoded.length ? { images: encoded } : {} };
28882
28993
  }
28883
- var import_crypto7, import_fs6, import_path6, import_crypto8, import_promises15, EDIT_TOOLS, ThoughtBlocks, UNDERSTOOD_SYSTEM_SUBTYPES, RATE_LIMIT_WARN_AT, CLAUDE_GRAMMAR_NAME, SUBAGENT_TOOL_NAMES, controlResponseSchema, STOPPED_STATUSES, TaskRecords, TERMINAL_BACKGROUND_STATUSES, NON_TERMINAL_BACKGROUND_STATUSES, ASYNC_LAUNCH_ACK, BackgroundTasks, FAILED_STATUSES, STOPPED_BY_USER_TEXT, ClaudeTurn, STDERR_TAIL_LINES2, MAX_EARLY_LINES, UNSUPPORTED_STOP, OUTPUT_CLOSED_REASON, ClaudeSession, DEFAULTS, READ_ONLY_DISALLOWED_TOOLS, DEFAULT_MCP_TIMEOUT_MS;
28994
+ var import_crypto7, import_fs6, import_path6, import_crypto8, import_promises15, EDIT_TOOLS, ThoughtBlocks, UNDERSTOOD_SYSTEM_SUBTYPES, CLAUDE_MCP_STATUS, RATE_LIMIT_WARN_AT, CLAUDE_GRAMMAR_NAME, SUBAGENT_TOOL_NAMES, controlResponseSchema, STOPPED_STATUSES, TaskRecords, TERMINAL_BACKGROUND_STATUSES, NON_TERMINAL_BACKGROUND_STATUSES, ASYNC_LAUNCH_ACK, BackgroundTasks, FAILED_STATUSES, STOPPED_BY_USER_TEXT, ClaudeTurn, STDERR_TAIL_LINES2, MAX_EARLY_LINES, UNSUPPORTED_STOP, OUTPUT_CLOSED_REASON, ClaudeSession, DEFAULTS, READ_ONLY_DISALLOWED_TOOLS, DEFAULT_MCP_TIMEOUT_MS;
28884
28995
  var init_claude = __esm({
28885
28996
  "../agent-core/dist/providers/claude.js"() {
28886
28997
  "use strict";
28887
28998
  init_chunk_D4TIXPWZ();
28888
- init_chunk_FYZKVT3E();
28999
+ init_chunk_WD7O4DYQ();
28889
29000
  init_chunk_OUEMTEUX();
28890
29001
  init_chunk_ZCTKXKYY();
28891
29002
  init_chunk_6VWVDJ2A();
@@ -28949,6 +29060,13 @@ var init_claude = __esm({
28949
29060
  "status",
28950
29061
  "commands_changed"
28951
29062
  ]);
29063
+ CLAUDE_MCP_STATUS = {
29064
+ connected: "connected",
29065
+ pending: "starting",
29066
+ "needs-auth": "needs_auth",
29067
+ failed: "failed",
29068
+ disabled: "disabled"
29069
+ };
28952
29070
  RATE_LIMIT_WARN_AT = 0.8;
28953
29071
  CLAUDE_GRAMMAR_NAME = "claude_cli";
28954
29072
  SUBAGENT_TOOL_NAMES = /* @__PURE__ */ new Set(["agent", "task"]);
@@ -31092,12 +31210,12 @@ function codexTurnInput(run, context) {
31092
31210
  ...images.length ? { imagePaths: images.map((image) => image.path) } : {}
31093
31211
  };
31094
31212
  }
31095
- var import_fs7, import_path7, import_crypto9, import_crypto10, import_crypto11, import_crypto12, TokenRefresher, MCP_STARTUP_TIMEOUT_SEC, FIELD_TYPES, YES_NO, ACCEPT_DECLINE, MAX_INLINE_GENERATED_IMAGE_BYTES, PNG_SIGNATURE2, JPEG_NON_FRAME_MARKERS, IMAGE_GEN_CALL, PROMPT_LITERAL, RELOCATE_EVERY_MS, CodexImageGenerationFold, CodexRolloutImages, CodexRateLimits, USER_INPUT_METHOD, PERMISSIONS_METHOD, ELICITATION_METHOD, COMMAND_OR_FILE, LEGACY, DECISIONS, COORDINATION_TOOLS, SETTLED_AGENT, STATUS, CHANGE_OPERATIONS, SILENT_ON_START, IGNORED_ITEMS, PLAN_STATUS, WORKER_LIFECYCLE, INFO_KINDS, SILENT, CodexTurn, STDERR_TAIL_LINES3, MAX_BETWEEN_UPDATES, UNSUPPORTED_REQUEST, DECLINED_ELICITATION, IMAGE_CATCH_UP_MS, IMAGE_POLL_MS, CodexSession, CODEX_MIN_VERSION, CODEX_REQUIREMENT, CODEX_TESTED_LINE, DEFAULTS2, CLIENT_INFO, STATUS2, EXITED_WITHOUT_RESPONSE, CodexExecTurn, DEFAULTS22, CodexExecSession;
31213
+ var import_fs7, import_path7, import_crypto9, import_crypto10, import_crypto11, import_crypto12, TokenRefresher, MCP_STARTUP_TIMEOUT_SEC, FIELD_TYPES, YES_NO, ACCEPT_DECLINE, MAX_INLINE_GENERATED_IMAGE_BYTES, PNG_SIGNATURE2, JPEG_NON_FRAME_MARKERS, IMAGE_GEN_CALL, PROMPT_LITERAL, RELOCATE_EVERY_MS, CodexImageGenerationFold, CodexRolloutImages, CodexRateLimits, USER_INPUT_METHOD, PERMISSIONS_METHOD, ELICITATION_METHOD, COMMAND_OR_FILE, LEGACY, DECISIONS, COORDINATION_TOOLS, SETTLED_AGENT, STATUS, CHANGE_OPERATIONS, SILENT_ON_START, IGNORED_ITEMS, PLAN_STATUS, CODEX_MCP_STATUS, WORKER_LIFECYCLE, INFO_KINDS, SILENT, CodexTurn, STDERR_TAIL_LINES3, MAX_BETWEEN_UPDATES, UNSUPPORTED_REQUEST, DECLINED_ELICITATION, IMAGE_CATCH_UP_MS, IMAGE_POLL_MS, CodexSession, CODEX_MIN_VERSION, CODEX_REQUIREMENT, CODEX_TESTED_LINE, DEFAULTS2, CLIENT_INFO, STATUS2, EXITED_WITHOUT_RESPONSE, CodexExecTurn, DEFAULTS22, CodexExecSession;
31096
31214
  var init_codex = __esm({
31097
31215
  "../agent-core/dist/providers/codex.js"() {
31098
31216
  "use strict";
31099
31217
  init_chunk_D4TIXPWZ();
31100
- init_chunk_FYZKVT3E();
31218
+ init_chunk_WD7O4DYQ();
31101
31219
  init_chunk_OUEMTEUX();
31102
31220
  init_chunk_ZCTKXKYY();
31103
31221
  init_chunk_6VWVDJ2A();
@@ -31385,6 +31503,12 @@ var init_codex = __esm({
31385
31503
  ["inProgress", "in_progress"],
31386
31504
  ["completed", "completed"]
31387
31505
  ]);
31506
+ CODEX_MCP_STATUS = {
31507
+ starting: "starting",
31508
+ ready: "connected",
31509
+ failed: "failed",
31510
+ cancelled: "failed"
31511
+ };
31388
31512
  WORKER_LIFECYCLE = /* @__PURE__ */ new Set([
31389
31513
  "turn/started",
31390
31514
  "turn/completed",
@@ -31536,20 +31660,29 @@ var init_codex = __esm({
31536
31660
  )
31537
31661
  ];
31538
31662
  }
31663
+ #mcpStatus(params) {
31664
+ const name = asString(params.name);
31665
+ if (!name) return [];
31666
+ const reported = asString(params.status);
31667
+ const reason = asString(params.error) || asString(params.failureReason);
31668
+ const status = CODEX_MCP_STATUS[reported] ?? "unknown";
31669
+ const listed = {
31670
+ sessionUpdate: "_alan/mcp_servers",
31671
+ servers: [{ name, status, ...status === "failed" && reason ? { error: reason } : {} }]
31672
+ };
31673
+ if (reported !== "failed") return [listed];
31674
+ return [listed, ...this.#mcpFailure(name, reason)];
31675
+ }
31539
31676
  /**
31540
31677
  * Only Alan's own MCP server failing matters in the chat: its tools are gone for the session.
31541
31678
  * The user's other servers (and their logins) belong to their Codex setup, not to Alan.
31542
31679
  */
31543
- #mcpStatus(params) {
31544
- if (asString(params.status) !== "failed") return [];
31545
- const name = asString(params.name);
31680
+ #mcpFailure(name, reason) {
31546
31681
  if (canonicalizeManagedMcpServerName(name) !== MANAGED_MCP_SERVER_NAME) {
31547
- const reason2 = asString(params.error) || asString(params.failureReason);
31548
31682
  return [
31549
- logUpdate("codex/mcp", `MCP server ${name} failed to start${reason2 ? `: ${reason2}` : "."}`)
31683
+ logUpdate("codex/mcp", `MCP server ${name} failed to start${reason ? `: ${reason}` : "."}`)
31550
31684
  ];
31551
31685
  }
31552
- const reason = asString(params.error) || asString(params.failureReason);
31553
31686
  const key = `mcp_server_failed\0${reason}`;
31554
31687
  if (this.#memory.shownWarnings.has(key)) return [];
31555
31688
  this.#memory.shownWarnings.add(key);
@@ -39993,7 +40126,7 @@ var require_dist = __commonJS({
39993
40126
  var init_dist = __esm({
39994
40127
  "../agent-core/dist/index.js"() {
39995
40128
  "use strict";
39996
- init_chunk_FYZKVT3E();
40129
+ init_chunk_WD7O4DYQ();
39997
40130
  init_chunk_OUEMTEUX();
39998
40131
  init_chunk_ZCTKXKYY();
39999
40132
  init_chunk_6VWVDJ2A();
@@ -40740,7 +40873,7 @@ var import_promises24, import_path10, import_crypto14, import_promises25, CURSOR
40740
40873
  var init_acp3 = __esm({
40741
40874
  "../agent-core/dist/providers/acp.js"() {
40742
40875
  "use strict";
40743
- init_chunk_FYZKVT3E();
40876
+ init_chunk_WD7O4DYQ();
40744
40877
  init_chunk_OUEMTEUX();
40745
40878
  init_chunk_ZCTKXKYY();
40746
40879
  init_chunk_6VWVDJ2A();
@@ -41778,9 +41911,19 @@ function createPersistentDriver(provider4, options) {
41778
41911
  }
41779
41912
  };
41780
41913
  const media = new LocalMediaReader(spec.projectPath, clock);
41914
+ const uploader = inputs.media;
41915
+ let uploads = Promise.resolve();
41781
41916
  const recordWithMedia = (update) => {
41782
41917
  record2(update);
41783
- for (const found of media.read(update)) record2(found);
41918
+ const found = media.find(update);
41919
+ if (found.length === 0) return;
41920
+ if (uploader === void 0) {
41921
+ for (const item of found) record2(media.inline(item));
41922
+ return;
41923
+ }
41924
+ uploads = uploads.then(async () => {
41925
+ for (const item of found) record2(await media.publish(item, uploader, signal));
41926
+ });
41784
41927
  };
41785
41928
  const forward = (event) => {
41786
41929
  if (event.type === "session_id") {
@@ -41874,6 +42017,7 @@ function createPersistentDriver(provider4, options) {
41874
42017
  } catch (error62) {
41875
42018
  return { outcome: "failed", message: errorMessage(error62) };
41876
42019
  } finally {
42020
+ await uploads;
41877
42021
  signal.removeEventListener("abort", onAbort);
41878
42022
  if (live.turn === turn) live.turn = void 0;
41879
42023
  }
@@ -42003,7 +42147,8 @@ var init_persistent = __esm({
42003
42147
  "user_message",
42004
42148
  "user_message_chunk",
42005
42149
  "_alan/log",
42006
- "_alan/thinking_tokens"
42150
+ "_alan/thinking_tokens",
42151
+ "_alan/mcp_servers"
42007
42152
  ]);
42008
42153
  FIRST_OUTPUT_TIMEOUT_MS = 3e5;
42009
42154
  }
@@ -42707,7 +42852,7 @@ var import_crypto15, import_http4, import_crypto16, import_promises26, import_pa
42707
42852
  var init_opencode = __esm({
42708
42853
  "../agent-core/dist/providers/opencode.js"() {
42709
42854
  "use strict";
42710
- init_chunk_FYZKVT3E();
42855
+ init_chunk_WD7O4DYQ();
42711
42856
  init_chunk_OUEMTEUX();
42712
42857
  init_chunk_ZCTKXKYY();
42713
42858
  init_chunk_6VWVDJ2A();
@@ -44758,7 +44903,7 @@ var import_crypto18, import_promises27, FACTORY_API_VERSION, FACTORY_PROTOCOL_VE
44758
44903
  var init_droid = __esm({
44759
44904
  "../agent-core/dist/providers/droid.js"() {
44760
44905
  "use strict";
44761
- init_chunk_FYZKVT3E();
44906
+ init_chunk_WD7O4DYQ();
44762
44907
  init_chunk_OUEMTEUX();
44763
44908
  init_chunk_ZCTKXKYY();
44764
44909
  init_chunk_6VWVDJ2A();
@@ -45868,7 +46013,7 @@ var init_antigravity = __esm({
45868
46013
  "../agent-core/dist/providers/antigravity.js"() {
45869
46014
  "use strict";
45870
46015
  init_chunk_D4TIXPWZ();
45871
- init_chunk_FYZKVT3E();
46016
+ init_chunk_WD7O4DYQ();
45872
46017
  init_chunk_OUEMTEUX();
45873
46018
  init_chunk_ZCTKXKYY();
45874
46019
  init_chunk_6VWVDJ2A();
@@ -46572,7 +46717,7 @@ var import_promises29, import_path16, import_crypto20, COMMAND_CODE_GRAMMAR_NAME
46572
46717
  var init_command_code = __esm({
46573
46718
  "../agent-core/dist/providers/command-code.js"() {
46574
46719
  "use strict";
46575
- init_chunk_FYZKVT3E();
46720
+ init_chunk_WD7O4DYQ();
46576
46721
  init_chunk_OUEMTEUX();
46577
46722
  init_chunk_ZCTKXKYY();
46578
46723
  init_chunk_6VWVDJ2A();
@@ -47537,6 +47682,7 @@ function createHttpTransport() {
47537
47682
  init_runtime_v2();
47538
47683
  init_zod();
47539
47684
  var REQUEST_TIMEOUT_MS = 3e4;
47685
+ var MEDIA_PUT_TIMEOUT_MS = 3e5;
47540
47686
  var credentialRefusalSchema = external_exports.object({ message: external_exports.string().trim().min(1) });
47541
47687
  function credentialFailureMessage(response, fallback) {
47542
47688
  if (response.status !== 409) return fallback;
@@ -47605,6 +47751,33 @@ function createHolderApiClient({
47605
47751
  throw new RuntimeFault("io_failed", `MCP credential request failed: ${response.status}`);
47606
47752
  }
47607
47753
  return machineMcpCredentialSchema.parse(jsonBody(response));
47754
+ },
47755
+ uploadRunMedia: async (runId, media, data, signal) => {
47756
+ const reserved = await request2("POST", runMediaPath(runId), signal, media);
47757
+ if (!isOk(reserved)) {
47758
+ throw new RuntimeFault("io_failed", `Media upload request failed: ${reserved.status}`);
47759
+ }
47760
+ const reservation = runMediaUploadResponseSchema.parse(jsonBody(reserved));
47761
+ if (reservation.status === "ready") return;
47762
+ const stored = await transport.send({
47763
+ method: "PUT",
47764
+ url: new URL(reservation.upload.url),
47765
+ headers: {
47766
+ ...reservation.upload.headers,
47767
+ "content-length": String(data.byteLength)
47768
+ },
47769
+ body: data,
47770
+ redirect: "error",
47771
+ signal: AbortSignal.any([signal, AbortSignal.timeout(MEDIA_PUT_TIMEOUT_MS)])
47772
+ });
47773
+ if (!isOk(stored)) {
47774
+ throw new RuntimeFault("io_failed", `Media upload failed: ${stored.status}`);
47775
+ }
47776
+ const completed = await request2("POST", runMediaCompletePath(runId, media.mediaId), signal);
47777
+ if (!isOk(completed)) {
47778
+ throw new RuntimeFault("io_failed", `Media upload completion failed: ${completed.status}`);
47779
+ }
47780
+ runMediaCompleteResponseSchema.parse(jsonBody(completed));
47608
47781
  }
47609
47782
  };
47610
47783
  }
@@ -49685,6 +49858,13 @@ function attachmentPath(spec, attachment, index, runDir) {
49685
49858
  }
49686
49859
  return (0, import_node_path19.join)(runDir, `${index}-${safeFilename(attachment.filename)}`);
49687
49860
  }
49861
+ function runMediaUploader(source, runId) {
49862
+ const upload = source.uploadMedia?.bind(source);
49863
+ if (upload === void 0) return void 0;
49864
+ return {
49865
+ upload: ({ data, ...media }, signal) => upload(runId, { ...media, bytes: data.byteLength }, data, signal)
49866
+ };
49867
+ }
49688
49868
  async function prepareRunInputs(spec, { source, tmpDir, signal, skills = [] }) {
49689
49869
  const dir = (0, import_node_path19.join)(tmpDir, "runs", spec.runId);
49690
49870
  const cleanup = async () => {
@@ -49711,9 +49891,11 @@ async function prepareRunInputs(spec, { source, tmpDir, signal, skills = [] }) {
49711
49891
  ...attachment.height === void 0 ? {} : { height: attachment.height }
49712
49892
  });
49713
49893
  }
49894
+ const media = runMediaUploader(source, spec.runId);
49714
49895
  return {
49715
49896
  attachments,
49716
49897
  providerEnv: credential.env,
49898
+ ...media === void 0 ? {} : { media },
49717
49899
  ...credential.codex === void 0 ? {} : { codex: credential.codex },
49718
49900
  skills,
49719
49901
  [Symbol.asyncDispose]: cleanup
@@ -51322,7 +51504,8 @@ async function machineAccess(paths, log, conversationId, transport) {
51322
51504
  fetchProviderCredential: async (runId, signal) => {
51323
51505
  void managedMcp?.authorization(signal);
51324
51506
  return (await api()).fetchProviderCredential(runId, signal);
51325
- }
51507
+ },
51508
+ uploadMedia: async (runId, media, data, signal) => (await api()).uploadRunMedia(runId, media, data, signal)
51326
51509
  };
51327
51510
  const codexCredentials = {
51328
51511
  refresh: async (runId, rejectedAccessTokenSha256) => (await api()).refreshCodexCredential(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alan-ai-hq/agent-manager-linux-arm64",
3
- "version": "0.1.158",
3
+ "version": "0.1.160",
4
4
  "description": "Alan machine runtime (alan-agent) for one platform: the official Node.js binary, the runtime bundle and its launcher. Installed by @alan-ai-hq/agent-manager.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://tryalan.ai",