replicas-engine 0.1.963 → 0.1.965

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.
@@ -5,12 +5,12 @@ import {
5
5
  getCodexAspHost,
6
6
  restartCodexAspHost,
7
7
  restartCodexAspHostIfRunning
8
- } from "./chunk-LVLSEAYD.js";
9
- import "./chunk-GSQ7ILGR.js";
10
- import "./chunk-KAMPG4XF.js";
11
- import "./chunk-43I2SLDL.js";
8
+ } from "./chunk-MEVE5U5A.js";
9
+ import "./chunk-ACUYRC4H.js";
10
+ import "./chunk-AOF42AV2.js";
11
+ import "./chunk-TP5NFRFE.js";
12
12
  import "./chunk-UZSNFLDQ.js";
13
- import "./chunk-LZ3GKDSS.js";
13
+ import "./chunk-BYJ6CIME.js";
14
14
  import "./chunk-VEQXQN22.js";
15
15
  export {
16
16
  getCodexAspHost,
@@ -14,7 +14,7 @@ import {
14
14
  isValidAgentProvider,
15
15
  parsePosixEnvFile,
16
16
  readReplicasRuntimeEnv
17
- } from "./chunk-LZ3GKDSS.js";
17
+ } from "./chunk-BYJ6CIME.js";
18
18
 
19
19
  // src/runtime-env-loader.ts
20
20
  import { readFileSync } from "fs";
@@ -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-43I2SLDL.js";
6
+ } from "./chunk-TP5NFRFE.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-LZ3GKDSS.js";
9
+ } from "./chunk-BYJ6CIME.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.963";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.965";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -2434,6 +2434,25 @@ function insertDisplayMessageByTimestamp(messages, message) {
2434
2434
  }
2435
2435
 
2436
2436
  // ../shared/src/display-message/format.ts
2437
+ function planItemsFromMessage(message) {
2438
+ if (message.type === "todo_list") {
2439
+ return message.items.map((item) => ({ text: item.text, status: todoItemStatus(item) }));
2440
+ }
2441
+ if (message.type !== "tool_call" || message.tool !== "TodoWrite" && message.tool !== "write_todos") return null;
2442
+ const input = typeof message.input === "object" ? message.input : null;
2443
+ const todos = Array.isArray(input?.todos) ? input.todos : null;
2444
+ if (!todos) return null;
2445
+ return todos.flatMap((todo) => {
2446
+ if (!todo || typeof todo !== "object") return [];
2447
+ const text2 = "content" in todo && typeof todo.content === "string" ? todo.content : "text" in todo && typeof todo.text === "string" ? todo.text : null;
2448
+ const status = "status" in todo ? todo.status : null;
2449
+ if (!text2) return [];
2450
+ return [{ text: text2, status: status === "completed" || status === "in_progress" ? status : "pending" }];
2451
+ });
2452
+ }
2453
+ function todoItemStatus(item) {
2454
+ return item.itemStatus ?? (item.completed ? "completed" : "pending");
2455
+ }
2437
2456
  function getDisplayMessageActivity(message) {
2438
2457
  if (message.type === "user" || message.type === "agent" || message.type === "reasoning") return null;
2439
2458
  if (message.type === "command") return { kind: "command", title: "Command", summary: message.command, content: message.output ?? "" };
@@ -2446,7 +2465,7 @@ ${operation.diff}` : ""}`).join("\n\n");
2446
2465
  if (message.type === "tool_call") return { kind: "tool", title: `Tool \xB7 ${message.tool}`, summary: message.server, content: [stringifyDisplayValue(message.input), message.output].filter(Boolean).join("\n\n") };
2447
2466
  if (message.type === "web_search") return { kind: "search", title: "Web search", summary: message.query, content: "" };
2448
2467
  if (message.type === "todo_list") {
2449
- const items = message.items.map((item) => ({ text: item.text, status: item.itemStatus ?? (item.completed ? "completed" : "pending") }));
2468
+ const items = planItemsFromMessage(message) ?? [];
2450
2469
  return { kind: "plan", title: "Plan", summary: `${items.filter((item) => item.status === "completed").length}/${items.length}`, content: "", items };
2451
2470
  }
2452
2471
  if (message.type === "subagent") return { kind: "task", title: "Subagent", summary: message.description, content: [message.prompt, message.model ? `Model: ${message.model}` : "", message.receiverThreadIds?.length ? `Threads: ${message.receiverThreadIds.join(", ")}` : "", message.output].filter(Boolean).join("\n\n") };
@@ -2464,6 +2483,15 @@ ${operation.diff}` : ""}`).join("\n\n");
2464
2483
  if (message.type === "interruption") return { kind: "error", title: "Agent stopped", summary: "", content: "" };
2465
2484
  return { kind: "error", title: "Agent error", summary: "", content: message.message };
2466
2485
  }
2486
+ function fileContentDiff(path, content, action) {
2487
+ const lines = content.replace(/\n$/, "").split("\n");
2488
+ return [
2489
+ `--- ${action === "add" ? "/dev/null" : `a/${path}`}`,
2490
+ `+++ ${action === "add" ? `b/${path}` : "/dev/null"}`,
2491
+ action === "add" ? `@@ -0,0 +1,${lines.length} @@` : `@@ -1,${lines.length} +0,0 @@`,
2492
+ ...lines.map((line) => `${action === "add" ? "+" : "-"}${line}`)
2493
+ ].join("\n");
2494
+ }
2467
2495
  var SCRIPT_ROOT = "/";
2468
2496
  var commandName = (argv) => argv[0].split("/").pop() ?? argv[0];
2469
2497
  var fileWrites = ({ writes }) => writes.filter(({ path }) => path !== "/dev/null");
@@ -6049,21 +6077,21 @@ function fileOrCommandMessage(toolName, toolUseId, input, timestamp) {
6049
6077
  if (toolName === "Edit" && typeof input.old_string === "string" && typeof input.new_string === "string") {
6050
6078
  const oldLines = input.old_string.replace(/\n$/, "").split("\n");
6051
6079
  const newLines = input.new_string.replace(/\n$/, "").split("\n");
6080
+ let head = 0;
6081
+ while (head < oldLines.length && head < newLines.length && oldLines[head] === newLines[head]) head++;
6082
+ let tail = 0;
6083
+ while (tail < oldLines.length - head && tail < newLines.length - head && oldLines[oldLines.length - 1 - tail] === newLines[newLines.length - 1 - tail]) tail++;
6052
6084
  diff = [
6053
6085
  `--- a/${filePath}`,
6054
6086
  `+++ b/${filePath}`,
6055
6087
  `@@ -1,${oldLines.length} +1,${newLines.length} @@`,
6056
- ...oldLines.map((l) => `-${l}`),
6057
- ...newLines.map((l) => `+${l}`)
6088
+ ...oldLines.slice(0, head).map((l) => ` ${l}`),
6089
+ ...oldLines.slice(head, oldLines.length - tail).map((l) => `-${l}`),
6090
+ ...newLines.slice(head, newLines.length - tail).map((l) => `+${l}`),
6091
+ ...oldLines.slice(oldLines.length - tail).map((l) => ` ${l}`)
6058
6092
  ].join("\n");
6059
6093
  } else if (toolName === "Write" && typeof input.content === "string") {
6060
- const newLines = input.content.replace(/\n$/, "").split("\n");
6061
- diff = [
6062
- `--- /dev/null`,
6063
- `+++ b/${filePath}`,
6064
- `@@ -0,0 +1,${newLines.length} @@`,
6065
- ...newLines.map((l) => `+${l}`)
6066
- ].join("\n");
6094
+ diff = fileContentDiff(filePath, input.content, "add");
6067
6095
  }
6068
6096
  return {
6069
6097
  id: `patch-${toolUseId}`,
@@ -8382,6 +8410,7 @@ var MAX_CLIENT_STATE_REQUEST_BYTES = 5 * 1024 * 1024;
8382
8410
  var MAX_CLIENT_STATE_BYTES_PER_USER = 10 * 1024 * 1024;
8383
8411
 
8384
8412
  // ../shared/src/routes/workspaces.ts
8413
+ import { z as z13 } from "zod";
8385
8414
  var WORKSPACE_STATUSES = ["active", "sleeping", "archived", "preparing", "error"];
8386
8415
  var WORKSPACE_STATUS_FILTERS = WORKSPACE_STATUSES.map((status) => status === "error" ? "failed" : status);
8387
8416
  var WORKSPACE_SORT_CHOICES = [
@@ -8405,48 +8434,56 @@ var DEFAULT_WORKSPACE_FILTERS = {
8405
8434
  activity: "any"
8406
8435
  };
8407
8436
  var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
8437
+ var terminalRtcCandidateSchema = z13.object({ type: z13.literal("rtc-candidate"), candidate: z13.string(), mid: z13.string() });
8438
+ var terminalSocketServerMessageSchema = z13.discriminatedUnion("type", [
8439
+ z13.object({ type: z13.literal("output"), data: z13.string() }),
8440
+ z13.object({ type: z13.literal("rtc-answer"), sdp: z13.string() }),
8441
+ terminalRtcCandidateSchema,
8442
+ z13.object({ type: z13.literal("rtc-switch") })
8443
+ ]);
8444
+ var TERMINAL_RTC_ICE_SERVER = "stun:stun.l.google.com:19302";
8408
8445
 
8409
8446
  // ../shared/src/routes/workspace-events.ts
8410
- import { z as z13 } from "zod";
8411
- var workspaceChangedEventSchema = z13.discriminatedUnion("type", [
8412
- z13.object({
8413
- type: z13.literal("workspace.changed"),
8414
- workspaceId: z13.string(),
8415
- completion: z13.object({
8416
- workspaceName: z13.string(),
8417
- completedAt: z13.string(),
8418
- processing: z13.boolean().optional()
8447
+ import { z as z14 } from "zod";
8448
+ var workspaceChangedEventSchema = z14.discriminatedUnion("type", [
8449
+ z14.object({
8450
+ type: z14.literal("workspace.changed"),
8451
+ workspaceId: z14.string(),
8452
+ completion: z14.object({
8453
+ workspaceName: z14.string(),
8454
+ completedAt: z14.string(),
8455
+ processing: z14.boolean().optional()
8419
8456
  }).optional(),
8420
- ts: z13.string()
8457
+ ts: z14.string()
8421
8458
  }),
8422
- z13.object({
8423
- type: z13.literal("workspace.chat.changed"),
8424
- workspaceId: z13.string(),
8425
- chatId: z13.string(),
8426
- ts: z13.string()
8459
+ z14.object({
8460
+ type: z14.literal("workspace.chat.changed"),
8461
+ workspaceId: z14.string(),
8462
+ chatId: z14.string(),
8463
+ ts: z14.string()
8427
8464
  }),
8428
- z13.object({ type: z13.literal("presence.changed"), ts: z13.string() }),
8429
- z13.object({
8430
- type: z13.literal("mobile-testing.changed"),
8431
- workspaceId: z13.string(),
8432
- ts: z13.string()
8465
+ z14.object({ type: z14.literal("presence.changed"), ts: z14.string() }),
8466
+ z14.object({
8467
+ type: z14.literal("mobile-testing.changed"),
8468
+ workspaceId: z14.string(),
8469
+ ts: z14.string()
8433
8470
  })
8434
8471
  ]);
8435
8472
 
8436
8473
  // ../shared/src/routes/presence.ts
8437
- import { z as z14 } from "zod";
8438
- var presenceStatusSchema = z14.enum(["online", "typing"]);
8439
- var presenceLocationSchema = z14.object({
8440
- environmentId: z14.string().optional(),
8441
- workspaceId: z14.string().optional()
8474
+ import { z as z15 } from "zod";
8475
+ var presenceStatusSchema = z15.enum(["online", "typing"]);
8476
+ var presenceLocationSchema = z15.object({
8477
+ environmentId: z15.string().optional(),
8478
+ workspaceId: z15.string().optional()
8442
8479
  });
8443
- var presenceEntrySchema = z14.object({
8444
- userId: z14.string(),
8480
+ var presenceEntrySchema = z15.object({
8481
+ userId: z15.string(),
8445
8482
  status: presenceStatusSchema,
8446
8483
  location: presenceLocationSchema,
8447
- ts: z14.string()
8484
+ ts: z15.string()
8448
8485
  });
8449
- var updatePresenceRequestSchema = z14.object({
8486
+ var updatePresenceRequestSchema = z15.object({
8450
8487
  status: presenceStatusSchema,
8451
8488
  location: presenceLocationSchema.optional()
8452
8489
  });
@@ -8920,6 +8957,7 @@ export {
8920
8957
  chatHistoryPageParamsFromQuery,
8921
8958
  paginateChatHistory,
8922
8959
  coerceBackgroundTaskPayload,
8960
+ fileContentDiff,
8923
8961
  isGitHubUrl,
8924
8962
  parseCodeHostPrUrl,
8925
8963
  decodePathSegments,
@@ -9009,6 +9047,7 @@ export {
9009
9047
  findGitCommitSignals,
9010
9048
  findCommandProtectionGitLookups,
9011
9049
  shouldRefreshPullRequests,
9050
+ TERMINAL_RTC_ICE_SERVER,
9012
9051
  MAX_REPO_FILE_CONTENT_BYTES,
9013
9052
  searchRepoFileIndex,
9014
9053
  isExcludedRepoFilePath,
@@ -5,15 +5,15 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  setAgentCredentialSnapshot
8
- } from "./chunk-GSQ7ILGR.js";
8
+ } from "./chunk-ACUYRC4H.js";
9
9
  import {
10
10
  AppServerProcess,
11
11
  buildCodexAgentEnv
12
- } from "./chunk-KAMPG4XF.js";
12
+ } from "./chunk-AOF42AV2.js";
13
13
  import {
14
14
  SUBPROCESS_MAX_BUFFER,
15
15
  execFileAsync
16
- } from "./chunk-43I2SLDL.js";
16
+ } from "./chunk-TP5NFRFE.js";
17
17
  import {
18
18
  isRecord
19
19
  } from "./chunk-UZSNFLDQ.js";
@@ -27,7 +27,7 @@ import {
27
27
  listOpenAICompatibleModels,
28
28
  readOllamaAuthEnv,
29
29
  resolveOpenAICompatibleModelsUrl
30
- } from "./chunk-LZ3GKDSS.js";
30
+ } from "./chunk-BYJ6CIME.js";
31
31
 
32
32
  // src/managers/codex-token-manager.ts
33
33
  import { promises as fs } from "fs";
@@ -260,7 +260,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
260
260
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
261
261
  await this.applyCredentialsResponse(data);
262
262
  setAgentCredentialSnapshot("codex", data);
263
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-JTO7WAU2.js");
263
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-6ZAFHJHO.js");
264
264
  await restartCodexAspHostIfRunning2();
265
265
  });
266
266
  await this.start(true);
@@ -280,7 +280,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
280
280
  await this.applyCredentialUpdate(generation, async () => {
281
281
  await this.applyCredentialsResponse(data);
282
282
  if (restartOnChange && CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index])) {
283
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-JTO7WAU2.js");
283
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-6ZAFHJHO.js");
284
284
  await restartCodexAspHostIfRunning2();
285
285
  }
286
286
  setAgentCredentialSnapshot("codex", data);
@@ -3,18 +3,18 @@ import { createRequire as __createRequire } from 'node:module';
3
3
  const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  monolithRequest
6
- } from "./chunk-GSQ7ILGR.js";
6
+ } from "./chunk-ACUYRC4H.js";
7
7
  import {
8
8
  SUBPROCESS_MAX_BUFFER,
9
9
  execFileAsync
10
- } from "./chunk-43I2SLDL.js";
10
+ } from "./chunk-TP5NFRFE.js";
11
11
  import {
12
12
  extractCommandProtectionCommandText,
13
13
  findCommandProtectionGitLookups,
14
14
  findGitCommitSignals,
15
15
  findPrMergeSignals,
16
16
  parseCommandProtectionRequest
17
- } from "./chunk-LZ3GKDSS.js";
17
+ } from "./chunk-BYJ6CIME.js";
18
18
 
19
19
  // src/services/command-protection-service.ts
20
20
  import { readFile, stat } from "fs/promises";
@@ -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-LZ3GKDSS.js";
6
+ } from "./chunk-BYJ6CIME.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-LZ3GKDSS.js";
8
+ } from "./chunk-BYJ6CIME.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -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-KSVPXW5Y.js";
7
- import "./chunk-GSQ7ILGR.js";
8
- import "./chunk-43I2SLDL.js";
6
+ } from "./chunk-SLRHEFTS.js";
7
+ import "./chunk-ACUYRC4H.js";
8
+ import "./chunk-TP5NFRFE.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-LZ3GKDSS.js";
12
+ import "./chunk-BYJ6CIME.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/command-protection-hook.ts
@@ -7,12 +7,12 @@ import {
7
7
  import {
8
8
  AppServerProcess,
9
9
  buildCodexAgentEnv
10
- } from "./chunk-KAMPG4XF.js";
11
- import "./chunk-43I2SLDL.js";
10
+ } from "./chunk-AOF42AV2.js";
11
+ import "./chunk-TP5NFRFE.js";
12
12
  import {
13
13
  AGENT,
14
14
  headlessAgentRequestSchema
15
- } from "./chunk-LZ3GKDSS.js";
15
+ } from "./chunk-BYJ6CIME.js";
16
16
  import "./chunk-VEQXQN22.js";
17
17
 
18
18
  // src/headless-agent.ts