replicas-engine 0.1.1574 → 0.1.1576

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.
@@ -8,12 +8,12 @@ import {
8
8
  listCodexModelsForDetails,
9
9
  restartCodexAspHost,
10
10
  restartCodexAspHostIfRunning
11
- } from "./chunk-R5GWQ7J6.js";
12
- import "./chunk-4BDP4GER.js";
13
- import "./chunk-7Z3VJW2P.js";
14
- import "./chunk-WEKYGAHD.js";
11
+ } from "./chunk-HDGHCLJF.js";
12
+ import "./chunk-PFRDJT5X.js";
13
+ import "./chunk-ZM3SKYPD.js";
14
+ import "./chunk-JIPJGIH4.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
- import "./chunk-4PXBQ6VN.js";
16
+ import "./chunk-LKCKKETW.js";
17
17
  import "./chunk-VEQXQN22.js";
18
18
  export {
19
19
  CODEX_ULTRAFAST_SERVICE_TIER,
@@ -6,7 +6,7 @@ import {
6
6
  getOriginDefaultBranch,
7
7
  monolithRequest,
8
8
  runGitCommand
9
- } from "./chunk-4BDP4GER.js";
9
+ } from "./chunk-PFRDJT5X.js";
10
10
  import {
11
11
  extractCommandProtectionCommandText,
12
12
  findCommandProtectionGitLookups,
@@ -15,7 +15,7 @@ import {
15
15
  findScoutRepoWriteSignals,
16
16
  parseCommandProtectionRequest,
17
17
  withE2BRetry
18
- } from "./chunk-4PXBQ6VN.js";
18
+ } from "./chunk-LKCKKETW.js";
19
19
 
20
20
  // src/services/command-protection-service.ts
21
21
  import { readFile, stat } from "fs/promises";
@@ -12,15 +12,15 @@ import {
12
12
  resolveDiffBase,
13
13
  runGitCommand,
14
14
  setAgentCredentialSnapshot
15
- } from "./chunk-4BDP4GER.js";
15
+ } from "./chunk-PFRDJT5X.js";
16
16
  import {
17
17
  AppServerProcess,
18
18
  buildCodexAgentEnv
19
- } from "./chunk-7Z3VJW2P.js";
19
+ } from "./chunk-ZM3SKYPD.js";
20
20
  import {
21
21
  SUBPROCESS_MAX_BUFFER,
22
22
  execFileAsync
23
- } from "./chunk-WEKYGAHD.js";
23
+ } from "./chunk-JIPJGIH4.js";
24
24
  import {
25
25
  isRecord
26
26
  } from "./chunk-UZSNFLDQ.js";
@@ -33,7 +33,9 @@ import {
33
33
  GIT_CREDENTIAL_HELPER_FILENAME,
34
34
  IMAGE_MEDIA_TYPES,
35
35
  InFlightMap,
36
+ KEEP_IMAGE_UNDER_BYTES,
36
37
  MOTHERSHIP_INSTRUCTIONS_TAG,
38
+ SHRUNK_IMAGE_QUALITY,
37
39
  SUBAGENT_MCP_SERVER_NAME,
38
40
  SUBAGENT_MCP_TOOL_NAMES,
39
41
  buildCodeHostPrUrl,
@@ -56,9 +58,10 @@ import {
56
58
  parseGitRemote,
57
59
  readOllamaAuthEnv,
58
60
  resolveOpenAICompatibleModelsUrl,
61
+ shrunkImageSize,
59
62
  splitMothershipInstructions,
60
63
  withTimeout
61
- } from "./chunk-4PXBQ6VN.js";
64
+ } from "./chunk-LKCKKETW.js";
62
65
 
63
66
  // src/managers/codex-token-manager.ts
64
67
  import { promises as fs } from "fs";
@@ -454,7 +457,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
454
457
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
455
458
  await this.applyCredentialsResponse(data);
456
459
  setAgentCredentialSnapshot("codex", data);
457
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-5K5OKJT7.js");
460
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-NRE42UDV.js");
458
461
  await restartCodexAspHostIfRunning2();
459
462
  });
460
463
  await this.start(true);
@@ -476,7 +479,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
476
479
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
477
480
  await this.applyCredentialsResponse(data);
478
481
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
479
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-5K5OKJT7.js");
482
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-NRE42UDV.js");
480
483
  await restartCodexAspHostIfRunning2();
481
484
  }
482
485
  setAgentCredentialSnapshot("codex", data);
@@ -1407,6 +1410,8 @@ import { randomUUID as randomUUID2 } from "crypto";
1407
1410
  import { mkdir as mkdir3, unlink as unlink2, writeFile as writeFile2 } from "fs/promises";
1408
1411
  import { homedir } from "os";
1409
1412
  import { join as join5 } from "path";
1413
+ import { createRequire } from "module";
1414
+ import { MessageChannel, Worker } from "worker_threads";
1410
1415
  function isImageMediaType(value) {
1411
1416
  return IMAGE_MEDIA_TYPES.includes(value);
1412
1417
  }
@@ -1430,7 +1435,8 @@ function inferMediaType(url, contentType) {
1430
1435
  async function fetchImageAsBase64(url) {
1431
1436
  const hostname = new URL(url).hostname;
1432
1437
  const provider = hostname === "uploads.linear.app" ? "linear" : hostname === "files.slack.com" ? "slack" : null;
1433
- const response = provider ? await monolithRequest(`/v1/engine/${provider}/download`, { body: { url } }) : await fetch(url, { redirect: "follow" });
1438
+ const signal = AbortSignal.timeout(3e4);
1439
+ const response = provider ? await monolithRequest(`/v1/engine/${provider}/download`, { body: { url }, signal }) : await fetch(url, { redirect: "follow", signal });
1434
1440
  if (!response.ok) {
1435
1441
  throw new Error(`Failed to fetch image from ${url}: ${response.status} ${response.statusText}`);
1436
1442
  }
@@ -1443,15 +1449,39 @@ async function fetchImageAsBase64(url) {
1443
1449
  );
1444
1450
  }
1445
1451
  }
1446
- const mediaType = inferMediaType(url, contentType);
1447
- const arrayBuffer = await response.arrayBuffer();
1448
- const buffer = Buffer.from(arrayBuffer);
1449
- const data = buffer.toString("base64");
1450
- return {
1451
- type: "base64",
1452
- media_type: mediaType,
1453
- data
1454
- };
1452
+ return toModelImage(Buffer.from(await response.arrayBuffer()), inferMediaType(url, contentType));
1453
+ }
1454
+ var MAX_HEIC_PIXELS = 5e7;
1455
+ var HEIC_WORKER = `const { workerData: { decoder, buffer, port } } = require('node:worker_threads');
1456
+ require(decoder)({ buffer }).then(({ width, height, data }) => port.postMessage({ width, height, data }, [data.buffer]));`;
1457
+ function decodeHeic(buffer) {
1458
+ const { port1, port2 } = new MessageChannel();
1459
+ return new Promise((resolve, reject) => {
1460
+ const worker = new Worker(HEIC_WORKER, { eval: true, workerData: { decoder: createRequire(import.meta.url).resolve("heic-decode"), buffer, port: port2 }, transferList: [port2] });
1461
+ port1.once("message", resolve);
1462
+ worker.once("error", reject);
1463
+ worker.once("exit", (code) => reject(new Error(`HEIC decoder exited (${code})`)));
1464
+ }).finally(() => port1.close());
1465
+ }
1466
+ async function toModelImage(content, fallbackType) {
1467
+ const passthrough = { type: "base64", media_type: fallbackType, data: content.toString("base64") };
1468
+ const sharp = await import("sharp").then((module) => module.default).catch(() => null);
1469
+ if (!sharp) return passthrough;
1470
+ const metadata = await sharp(content).metadata().catch(() => null);
1471
+ if (!metadata) throw new Error("not an image the model can read");
1472
+ const mediaType = IMAGE_MEDIA_TYPES.find((type) => type === `image/${metadata.format}`);
1473
+ const size = metadata.width && metadata.height ? shrunkImageSize(metadata.width, metadata.height) : null;
1474
+ if (mediaType && !size && (metadata.orientation ?? 1) === 1 && (content.byteLength < KEEP_IMAGE_UNDER_BYTES || mediaType === "image/gif")) {
1475
+ return { ...passthrough, media_type: mediaType };
1476
+ }
1477
+ const hevc = metadata.format === "heif" && metadata.compression === "hevc";
1478
+ if (hevc && metadata.width * metadata.height > MAX_HEIC_PIXELS) throw new Error(`HEIC image is over ${MAX_HEIC_PIXELS / 1e6}MP`);
1479
+ const heic = hevc ? await decodeHeic(content) : null;
1480
+ const image = heic ? sharp(heic.data, { raw: { width: heic.width, height: heic.height, channels: 4 } }) : sharp(content).autoOrient();
1481
+ const { width, height } = heic ?? metadata.autoOrient;
1482
+ const target = shrunkImageSize(width, height);
1483
+ const data = await (target ? image.resize(target.width, target.height) : image).webp({ quality: SHRUNK_IMAGE_QUALITY * 100 }).toBuffer();
1484
+ return { type: "base64", media_type: "image/webp", data: data.toString("base64") };
1455
1485
  }
1456
1486
  async function normalizeImages(images) {
1457
1487
  const normalized = [];
@@ -1559,7 +1589,7 @@ var CodexQuotaStatusTracker = class {
1559
1589
  import { existsSync as existsSync2 } from "fs";
1560
1590
  import { dirname as dirname2, join as join6 } from "path";
1561
1591
  import { fileURLToPath } from "url";
1562
- import { createRequire } from "module";
1592
+ import { createRequire as createRequire2 } from "module";
1563
1593
  var SUBAGENT_MCP_TOOL_TIMEOUT_MS = 24 * 60 * 60 * 1e3 + 6e4;
1564
1594
  function subagentMcpProcessConfig(parentChatId) {
1565
1595
  const directory = dirname2(fileURLToPath(import.meta.url));
@@ -1569,7 +1599,7 @@ function subagentMcpProcessConfig(parentChatId) {
1569
1599
  return {
1570
1600
  command: process.execPath,
1571
1601
  args: [
1572
- ...entry.endsWith(".ts") ? ["--import", createRequire(import.meta.url).resolve("tsx/esm")] : [],
1602
+ ...entry.endsWith(".ts") ? ["--import", createRequire2(import.meta.url).resolve("tsx/esm")] : [],
1573
1603
  entry,
1574
1604
  "--parent",
1575
1605
  parentChatId
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  HOOK_EXEC_MAX_BUFFER_BYTES
6
- } from "./chunk-4PXBQ6VN.js";
6
+ } from "./chunk-LKCKKETW.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -9231,6 +9231,21 @@ async function withTimeout(promise, ms, message2) {
9231
9231
  }
9232
9232
  return result;
9233
9233
  }
9234
+ function createConcurrencyLimit(limit) {
9235
+ const waiting = [];
9236
+ let active = 0;
9237
+ return async (task) => {
9238
+ if (active >= limit) await new Promise((resolve) => waiting.push(resolve));
9239
+ else active++;
9240
+ try {
9241
+ return await task();
9242
+ } finally {
9243
+ const next = waiting.shift();
9244
+ if (next) next();
9245
+ else active--;
9246
+ }
9247
+ };
9248
+ }
9234
9249
 
9235
9250
  // ../shared/src/result.ts
9236
9251
  function createSuccessResult(data) {
@@ -20172,7 +20187,7 @@ var VOICE_WAVEFORM = {
20172
20187
  };
20173
20188
 
20174
20189
  // ../shared/src/e2b.ts
20175
- var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-14-v29";
20190
+ var E2B_TEMPLATE_NAME = "replicas-sandbox-2026-11-15-v2";
20176
20191
 
20177
20192
  // ../shared/src/e2b-retry.ts
20178
20193
  var DEFAULT_BACKOFFS_MS = [2e3, 5e3];
@@ -20435,6 +20450,16 @@ var MAC_KEY_LABELS = {
20435
20450
  };
20436
20451
  var OTHER_KEY_LABELS = { ...MAC_KEY_LABELS, Enter: "Enter", Tab: "Tab", Backspace: "Backspace", Shift: "Shift", Alt: "Alt", Mod: "Ctrl" };
20437
20452
 
20453
+ // ../shared/src/image-attachments.ts
20454
+ var MAX_LONG_EDGE = 2576;
20455
+ var MAX_PIXELS = 375e4;
20456
+ var SHRUNK_IMAGE_QUALITY = 0.85;
20457
+ var KEEP_IMAGE_UNDER_BYTES = 5e5;
20458
+ function shrunkImageSize(width, height) {
20459
+ const scale = Math.min(MAX_LONG_EDGE / Math.max(width, height), Math.sqrt(MAX_PIXELS / (width * height)));
20460
+ return scale < 1 ? { width: Math.round(width * scale), height: Math.round(height * scale) } : null;
20461
+ }
20462
+
20438
20463
  // ../shared/src/replicas-config.ts
20439
20464
  import { parse as parseYaml2 } from "yaml";
20440
20465
 
@@ -22462,6 +22487,7 @@ export {
22462
22487
  TIMEOUT,
22463
22488
  raceWithTimeout,
22464
22489
  withTimeout,
22490
+ createConcurrencyLimit,
22465
22491
  byteRangeResponse,
22466
22492
  createSuccessResult,
22467
22493
  createErrorResult,
@@ -22729,6 +22755,9 @@ export {
22729
22755
  isCompactCommand,
22730
22756
  getGoalCommand,
22731
22757
  getGoalCommandObjectiveValidationError,
22758
+ SHRUNK_IMAGE_QUALITY,
22759
+ KEEP_IMAGE_UNDER_BYTES,
22760
+ shrunkImageSize,
22732
22761
  DEFAULT_START_HOOK_TIMEOUT_MS,
22733
22762
  DEFAULT_HOOK_OUTPUT_PREVIEW_CHARS,
22734
22763
  HOOK_EXEC_MAX_BUFFER_BYTES,
@@ -3,7 +3,7 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  AspClient
6
- } from "./chunk-7Z3VJW2P.js";
6
+ } from "./chunk-ZM3SKYPD.js";
7
7
  import {
8
8
  ASTER_BASE_URL,
9
9
  ASTER_PROVIDER,
@@ -15,7 +15,7 @@ import {
15
15
  isRecord,
16
16
  readOllamaAuthEnv,
17
17
  readOpenAICompatibleAuthEnv
18
- } from "./chunk-4PXBQ6VN.js";
18
+ } from "./chunk-LKCKKETW.js";
19
19
 
20
20
  // src/managers/codex-asp/notification-dispatch.ts
21
21
  var TURN_STARTED_METHOD = "turn/started";
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  SUBPROCESS_MAX_BUFFER,
6
6
  execFileAsync
7
- } from "./chunk-WEKYGAHD.js";
7
+ } from "./chunk-JIPJGIH4.js";
8
8
  import {
9
9
  isRecord as isRecord2
10
10
  } from "./chunk-UZSNFLDQ.js";
@@ -21,7 +21,7 @@ import {
21
21
  provisionedDeviceSchema,
22
22
  readReplicasRuntimeEnv,
23
23
  serializePosixEnvFile
24
- } from "./chunk-4PXBQ6VN.js";
24
+ } from "./chunk-LKCKKETW.js";
25
25
 
26
26
  // src/runtime-env-loader.ts
27
27
  import { readFileSync } from "fs";
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-4PXBQ6VN.js";
8
+ } from "./chunk-LKCKKETW.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -3,10 +3,10 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  execFileAsync
6
- } from "./chunk-WEKYGAHD.js";
6
+ } from "./chunk-JIPJGIH4.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-4PXBQ6VN.js";
9
+ } from "./chunk-LKCKKETW.js";
10
10
 
11
11
  // src/utils/codex-agent-env.ts
12
12
  function buildCodexAgentEnv(source = process.env) {
@@ -240,7 +240,7 @@ function getCodexModelProvider(method) {
240
240
  if (method === "foundry") return "azure";
241
241
  return method === "ollama" || method === "openai-compatible" ? "replicas_openai_compatible" : "openai";
242
242
  }
243
- var ENGINE_PACKAGE_VERSION = "0.1.1574";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1576";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  evaluateCommandProtection
6
- } from "./chunk-5LFHEDVA.js";
7
- import "./chunk-4BDP4GER.js";
8
- import "./chunk-WEKYGAHD.js";
6
+ } from "./chunk-ADTENDRG.js";
7
+ import "./chunk-PFRDJT5X.js";
8
+ import "./chunk-JIPJGIH4.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-4PXBQ6VN.js";
12
+ import "./chunk-LKCKKETW.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/command-protection-hook.ts
@@ -14,12 +14,12 @@ import {
14
14
  recoverCompletedTurn,
15
15
  spawnMuseMsp,
16
16
  startMuseSession
17
- } from "./chunk-TVPCCBH4.js";
17
+ } from "./chunk-M5QMZ4TH.js";
18
18
  import {
19
19
  AppServerProcess,
20
20
  buildCodexAgentEnv
21
- } from "./chunk-7Z3VJW2P.js";
22
- import "./chunk-WEKYGAHD.js";
21
+ } from "./chunk-ZM3SKYPD.js";
22
+ import "./chunk-JIPJGIH4.js";
23
23
  import {
24
24
  AGENT,
25
25
  OPENCODE_GO_PROVIDER,
@@ -29,7 +29,7 @@ import {
29
29
  headlessAgentUsagePath,
30
30
  isRecord,
31
31
  withTimeout
32
- } from "./chunk-4PXBQ6VN.js";
32
+ } from "./chunk-LKCKKETW.js";
33
33
  import "./chunk-VEQXQN22.js";
34
34
 
35
35
  // src/headless-agent.ts
package/dist/src/index.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  evaluateCommandProtection,
28
28
  extractToolCommand,
29
29
  reportCommandProtectionBlock
30
- } from "./chunk-5LFHEDVA.js";
30
+ } from "./chunk-ADTENDRG.js";
31
31
  import {
32
32
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
33
33
  AGENT_MESSAGE_DELTA_METHOD,
@@ -65,10 +65,10 @@ import {
65
65
  spawnMuseMsp,
66
66
  startMuseSession,
67
67
  uuidV7
68
- } from "./chunk-TVPCCBH4.js";
68
+ } from "./chunk-M5QMZ4TH.js";
69
69
  import {
70
70
  publishedPullRequestUrls
71
- } from "./chunk-CPCCQF4Z.js";
71
+ } from "./chunk-RPJB24BI.js";
72
72
  import {
73
73
  ACCOUNT_RATE_LIMITS_READ_METHOD,
74
74
  AsyncLock,
@@ -146,7 +146,7 @@ import {
146
146
  transcriptSecrets,
147
147
  upsertCredentialFileLines,
148
148
  writeSecureCredentialFile
149
- } from "./chunk-R5GWQ7J6.js";
149
+ } from "./chunk-HDGHCLJF.js";
150
150
  import {
151
151
  ENGINE_ENV,
152
152
  UNQUOTED_PATHS_CONFIG,
@@ -157,15 +157,15 @@ import {
157
157
  resolveDiffBase,
158
158
  setAgentCredentialSnapshot,
159
159
  setLinearSessionId
160
- } from "./chunk-4BDP4GER.js";
160
+ } from "./chunk-PFRDJT5X.js";
161
161
  import {
162
162
  getCodexModelProvider
163
- } from "./chunk-7Z3VJW2P.js";
163
+ } from "./chunk-ZM3SKYPD.js";
164
164
  import {
165
165
  SUBPROCESS_MAX_BUFFER,
166
166
  execAsync,
167
167
  execFileAsync
168
- } from "./chunk-WEKYGAHD.js";
168
+ } from "./chunk-JIPJGIH4.js";
169
169
  import {
170
170
  isRecord as isRecord2
171
171
  } from "./chunk-UZSNFLDQ.js";
@@ -304,6 +304,7 @@ import {
304
304
  createAcceptedUserMessageEvent,
305
305
  createChatHistoryCursor,
306
306
  createChatRequestSchema,
307
+ createConcurrencyLimit,
307
308
  createErrorResult,
308
309
  createProviderSlashCommand,
309
310
  createSuccessResult,
@@ -447,7 +448,7 @@ import {
447
448
  workspaceTokenRequestSchema,
448
449
  workspaceTokenResponseSchema,
449
450
  wrapInTag
450
- } from "./chunk-4PXBQ6VN.js";
451
+ } from "./chunk-LKCKKETW.js";
451
452
  import {
452
453
  cloneMcpConfig,
453
454
  ensureCompatibilityImports,
@@ -60805,30 +60806,14 @@ var CanvasService = class {
60805
60806
  var canvasService = new CanvasService();
60806
60807
 
60807
60808
  // src/services/upload-canvas-items.ts
60808
- var MAX_CONCURRENT_CANVAS_UPLOADS = 2;
60809
60809
  var CANVAS_REQUEST_TIMEOUT_MS = 2e4;
60810
60810
  var MIN_CANVAS_UPLOAD_BYTES_PER_SECOND = 256 * 1024;
60811
60811
  var uploadedCanvasItems = /* @__PURE__ */ new Map();
60812
- var pendingCanvasUploads = [];
60813
- var activeCanvasUploads = 0;
60812
+ var withCanvasUploadSlot = createConcurrencyLimit(2);
60814
60813
  var canvasFlushQueue = Promise.resolve();
60815
60814
  function isReconcileCanvasItemsResponse(value) {
60816
60815
  return typeof value === "object" && value !== null && "deleted" in value && typeof value.deleted === "number" && (!("skipped" in value) || typeof value.skipped === "string");
60817
60816
  }
60818
- async function withCanvasUploadSlot(operation) {
60819
- if (activeCanvasUploads >= MAX_CONCURRENT_CANVAS_UPLOADS) {
60820
- await new Promise((resolve7) => pendingCanvasUploads.push(resolve7));
60821
- } else {
60822
- activeCanvasUploads++;
60823
- }
60824
- try {
60825
- return await operation();
60826
- } finally {
60827
- const next = pendingCanvasUploads.shift();
60828
- if (next) next();
60829
- else activeCanvasUploads--;
60830
- }
60831
- }
60832
60817
  function flushAllCanvasItems() {
60833
60818
  const flush = canvasFlushQueue.then(flushCanvasItems);
60834
60819
  canvasFlushQueue = flush.then(() => void 0, () => void 0);
@@ -61988,6 +61973,21 @@ var ChatService = class {
61988
61973
  } else if (fork && chat.persisted.pullRequestNotesPath && this.getChat(fork.source.chatId)) {
61989
61974
  request = { ...request, message: await this.followForkSource(chat, fork, request.message) };
61990
61975
  }
61976
+ if (request.images?.some((image) => image.source.type === "url")) {
61977
+ const results = await Promise.all(request.images.map((image) => normalizeImages([image]).then(([normalized]) => normalized, (error) => error instanceof Error ? error.message : String(error))));
61978
+ const failed = results.filter((result) => typeof result === "string");
61979
+ const note = wrapInTag(`${failed.length} attached image${failed.length === 1 ? "" : "s"} couldn't be loaded: ${failed.join("; ")}`, REPLICAS_INSTRUCTIONS_TAG);
61980
+ const at = request.message.search(/\n\n<replicas_attachments>\n/);
61981
+ request = {
61982
+ ...request,
61983
+ images: results.filter((result) => typeof result !== "string"),
61984
+ ...failed.length ? { message: at === -1 ? `${request.message}
61985
+
61986
+ ${note}` : `${request.message.slice(0, at)}
61987
+
61988
+ ${note}${request.message.slice(at)}` } : {}
61989
+ };
61990
+ }
61991
61991
  if (chat.persisted.pullRequestNotesPath) {
61992
61992
  const decisions = await readPullRequestDecisions(chat.persisted.pullRequestNotesPath);
61993
61993
  if (decisions) request = { ...request, message: `${request.message}
@@ -3,13 +3,13 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  publishedPullRequestUrls
6
- } from "./chunk-CPCCQF4Z.js";
6
+ } from "./chunk-RPJB24BI.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-4PXBQ6VN.js";
12
+ } from "./chunk-LKCKKETW.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/services/post-tool-pr-notifier.ts
@@ -11,7 +11,7 @@ import {
11
11
  spawnSubagentRequestSchema,
12
12
  subagentResponseSchema,
13
13
  waitSubagentRequestSchema
14
- } from "./chunk-4PXBQ6VN.js";
14
+ } from "./chunk-LKCKKETW.js";
15
15
  import "./chunk-VEQXQN22.js";
16
16
 
17
17
  // src/subagent-mcp.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.1574",
3
+ "version": "0.1.1576",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -52,10 +52,12 @@
52
52
  "@opencode-ai/sdk": "1.19.4",
53
53
  "bash-language-server": "^5.6.0",
54
54
  "dockerfile-language-server-nodejs": "^0.14.1",
55
+ "heic-decode": "2.1.0",
55
56
  "hono": "^4.10.3",
56
57
  "opencode-ai": "1.19.4",
57
58
  "pi-mcp-adapter": "2.32.1",
58
59
  "pyright": "^1.1.413",
60
+ "sharp": "^0.35.5",
59
61
  "typescript": "^5.9.3",
60
62
  "typescript-language-server": "^4.4.1",
61
63
  "undici": "7.30.1",