replicas-engine 0.1.962 → 0.1.964

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-YQHM7SOF.js";
9
- import "./chunk-GSQ7ILGR.js";
10
- import "./chunk-3LZ6BWRP.js";
11
- import "./chunk-43I2SLDL.js";
8
+ } from "./chunk-5M2ZF4NX.js";
9
+ import "./chunk-3ZBHY2YI.js";
10
+ import "./chunk-TDVZOQMQ.js";
11
+ import "./chunk-33CDUZ6W.js";
12
12
  import "./chunk-UZSNFLDQ.js";
13
- import "./chunk-LZ3GKDSS.js";
13
+ import "./chunk-MEN62XEB.js";
14
14
  import "./chunk-VEQXQN22.js";
15
15
  export {
16
16
  getCodexAspHost,
@@ -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-MEN62XEB.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -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-3ZBHY2YI.js";
7
7
  import {
8
8
  SUBPROCESS_MAX_BUFFER,
9
9
  execFileAsync
10
- } from "./chunk-43I2SLDL.js";
10
+ } from "./chunk-33CDUZ6W.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-MEN62XEB.js";
18
18
 
19
19
  // src/services/command-protection-service.ts
20
20
  import { readFile, stat } from "fs/promises";
@@ -14,7 +14,7 @@ import {
14
14
  isValidAgentProvider,
15
15
  parsePosixEnvFile,
16
16
  readReplicasRuntimeEnv
17
- } from "./chunk-LZ3GKDSS.js";
17
+ } from "./chunk-MEN62XEB.js";
18
18
 
19
19
  // src/runtime-env-loader.ts
20
20
  import { readFileSync } from "fs";
@@ -5,15 +5,15 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  setAgentCredentialSnapshot
8
- } from "./chunk-GSQ7ILGR.js";
8
+ } from "./chunk-3ZBHY2YI.js";
9
9
  import {
10
10
  AppServerProcess,
11
11
  buildCodexAgentEnv
12
- } from "./chunk-3LZ6BWRP.js";
12
+ } from "./chunk-TDVZOQMQ.js";
13
13
  import {
14
14
  SUBPROCESS_MAX_BUFFER,
15
15
  execFileAsync
16
- } from "./chunk-43I2SLDL.js";
16
+ } from "./chunk-33CDUZ6W.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-MEN62XEB.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-UDEZCEST.js");
263
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-XRCTTTVU.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-UDEZCEST.js");
283
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-XRCTTTVU.js");
284
284
  await restartCodexAspHostIfRunning2();
285
285
  }
286
286
  setAgentCredentialSnapshot("codex", data);
@@ -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}`,
@@ -8920,6 +8948,7 @@ export {
8920
8948
  chatHistoryPageParamsFromQuery,
8921
8949
  paginateChatHistory,
8922
8950
  coerceBackgroundTaskPayload,
8951
+ fileContentDiff,
8923
8952
  isGitHubUrl,
8924
8953
  parseCodeHostPrUrl,
8925
8954
  decodePathSegments,
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-LZ3GKDSS.js";
8
+ } from "./chunk-MEN62XEB.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-43I2SLDL.js";
6
+ } from "./chunk-33CDUZ6W.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-LZ3GKDSS.js";
9
+ } from "./chunk-MEN62XEB.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.962";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.964";
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-KSVPXW5Y.js";
7
- import "./chunk-GSQ7ILGR.js";
8
- import "./chunk-43I2SLDL.js";
6
+ } from "./chunk-3NDASIOV.js";
7
+ import "./chunk-3ZBHY2YI.js";
8
+ import "./chunk-33CDUZ6W.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-LZ3GKDSS.js";
12
+ import "./chunk-MEN62XEB.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-3LZ6BWRP.js";
11
- import "./chunk-43I2SLDL.js";
10
+ } from "./chunk-TDVZOQMQ.js";
11
+ import "./chunk-33CDUZ6W.js";
12
12
  import {
13
13
  AGENT,
14
14
  headlessAgentRequestSchema
15
- } from "./chunk-LZ3GKDSS.js";
15
+ } from "./chunk-MEN62XEB.js";
16
16
  import "./chunk-VEQXQN22.js";
17
17
 
18
18
  // src/headless-agent.ts
package/dist/src/index.js CHANGED
@@ -32,7 +32,7 @@ import {
32
32
  reportCommandProtectionBlock,
33
33
  resolveDiffBase,
34
34
  runGitCommand
35
- } from "./chunk-KSVPXW5Y.js";
35
+ } from "./chunk-3NDASIOV.js";
36
36
  import {
37
37
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
38
38
  AGENT_MESSAGE_DELTA_METHOD,
@@ -56,7 +56,7 @@ import {
56
56
  } from "./chunk-UPCC4BX5.js";
57
57
  import {
58
58
  publishedPullRequestUrls
59
- } from "./chunk-DPCVYN2Z.js";
59
+ } from "./chunk-N6JCCYO3.js";
60
60
  import {
61
61
  BaseRefreshManager,
62
62
  CodexAspAuthMethodChangedError,
@@ -71,7 +71,7 @@ import {
71
71
  refreshDelayMs,
72
72
  restartCodexAspHost,
73
73
  routineRefreshExclusions
74
- } from "./chunk-YQHM7SOF.js";
74
+ } from "./chunk-5M2ZF4NX.js";
75
75
  import {
76
76
  ENGINE_ENV,
77
77
  monolithRequest,
@@ -79,16 +79,16 @@ import {
79
79
  readRuntimeEnvFile,
80
80
  reloadEngineEnv,
81
81
  setAgentCredentialSnapshot
82
- } from "./chunk-GSQ7ILGR.js";
82
+ } from "./chunk-3ZBHY2YI.js";
83
83
  import {
84
84
  AspClient,
85
85
  getCodexModelProvider
86
- } from "./chunk-3LZ6BWRP.js";
86
+ } from "./chunk-TDVZOQMQ.js";
87
87
  import {
88
88
  SUBPROCESS_MAX_BUFFER,
89
89
  execAsync,
90
90
  execFileAsync
91
- } from "./chunk-43I2SLDL.js";
91
+ } from "./chunk-33CDUZ6W.js";
92
92
  import {
93
93
  isRecord as isRecord2
94
94
  } from "./chunk-UZSNFLDQ.js";
@@ -230,6 +230,7 @@ import {
230
230
  extractLatestContextUsage,
231
231
  extractToolResultText,
232
232
  fetchOpenCodeGoCatalog,
233
+ fileContentDiff,
233
234
  forkChatRequestSchema,
234
235
  formatChatForkHandoffMessage,
235
236
  formatSideChatUpdateMessage,
@@ -317,7 +318,7 @@ import {
317
318
  workspaceCredentialProviderSchema,
318
319
  workspaceTokenRequestSchema,
319
320
  workspaceTokenResponseSchema
320
- } from "./chunk-LZ3GKDSS.js";
321
+ } from "./chunk-MEN62XEB.js";
321
322
  import {
322
323
  cloneMcpConfig,
323
324
  ensureCompatibilityImports,
@@ -14818,11 +14819,13 @@ function appendCodexAspTranscriptOutput(current, delta, maxChars = MAX_CODEX_ASP
14818
14819
  return truncateCodexAspTranscriptOutput(`${current ?? ""}${delta}`, maxChars);
14819
14820
  }
14820
14821
  function transcriptPatchOperation(change) {
14822
+ const action = change.kind.type;
14823
+ const diff = change.diff.trim().length === 0 ? void 0 : action === "update" ? change.diff : fileContentDiff(change.path, change.diff, action);
14821
14824
  return {
14822
- action: change.kind.type,
14825
+ action,
14823
14826
  path: change.path,
14824
14827
  ...change.kind.type === "update" && change.kind.move_path ? { moveTo: change.kind.move_path } : {},
14825
- ...change.diff.trim().length > 0 ? { diff: change.diff } : {}
14828
+ ...diff ? { diff } : {}
14826
14829
  };
14827
14830
  }
14828
14831
  function transcriptItemsForTurn(turn) {
@@ -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-DPCVYN2Z.js";
6
+ } from "./chunk-N6JCCYO3.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-LZ3GKDSS.js";
12
+ } from "./chunk-MEN62XEB.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/services/post-tool-pr-notifier.ts
@@ -9,7 +9,7 @@ import {
9
9
  spawnSubagentRequestSchema,
10
10
  subagentResponseSchema,
11
11
  waitSubagentRequestSchema
12
- } from "./chunk-LZ3GKDSS.js";
12
+ } from "./chunk-MEN62XEB.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/subagent-mcp.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.962",
3
+ "version": "0.1.964",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",