replicas-engine 0.1.1006 → 0.1.1007

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-7OGI4N7B.js";
9
- import "./chunk-VAJAXROC.js";
10
- import "./chunk-SVJZNG2F.js";
11
- import "./chunk-E25NLO2C.js";
8
+ } from "./chunk-U6JEKZGL.js";
9
+ import "./chunk-M3FARRDB.js";
10
+ import "./chunk-MPQHAEI4.js";
11
+ import "./chunk-RCCLUBJX.js";
12
12
  import "./chunk-UZSNFLDQ.js";
13
- import "./chunk-BOUFJ6MN.js";
13
+ import "./chunk-FKI4Y34A.js";
14
14
  import "./chunk-VEQXQN22.js";
15
15
  export {
16
16
  getCodexAspHost,
@@ -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-VAJAXROC.js";
6
+ } from "./chunk-M3FARRDB.js";
7
7
  import {
8
8
  SUBPROCESS_MAX_BUFFER,
9
9
  execFileAsync
10
- } from "./chunk-E25NLO2C.js";
10
+ } from "./chunk-RCCLUBJX.js";
11
11
  import {
12
12
  extractCommandProtectionCommandText,
13
13
  findCommandProtectionGitLookups,
14
14
  findGitCommitSignals,
15
15
  findPrMergeSignals,
16
16
  parseCommandProtectionRequest
17
- } from "./chunk-BOUFJ6MN.js";
17
+ } from "./chunk-FKI4Y34A.js";
18
18
 
19
19
  // src/services/command-protection-service.ts
20
20
  import { readFile, stat } from "fs/promises";
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-BOUFJ6MN.js";
8
+ } from "./chunk-FKI4Y34A.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -6283,6 +6283,17 @@ function createSubagentMessage(messageIndex, timestamp, fields) {
6283
6283
  function collectNestedEvents(events, toolUseId) {
6284
6284
  return events.filter((e) => e.payload.parent_tool_use_id === toolUseId).map(({ timestamp, type, payload }) => ({ timestamp, type, payload }));
6285
6285
  }
6286
+ function readToolResult(event) {
6287
+ if (event.type !== "claude-user") return void 0;
6288
+ const toolResult = normalizeContentBlocks(event.payload.message?.content).find((c) => c.type === "tool_result");
6289
+ if (!toolResult?.tool_use_id) return void 0;
6290
+ return {
6291
+ toolResult,
6292
+ toolUseId: toolResult.tool_use_id,
6293
+ output: extractToolResultText(toolResult.content),
6294
+ status: toolResult.is_error ? "failed" : "completed"
6295
+ };
6296
+ }
6286
6297
  function coerceClaudeResultPayload(payload) {
6287
6298
  return {
6288
6299
  is_error: typeof payload.is_error === "boolean" ? payload.is_error : void 0,
@@ -6724,52 +6735,47 @@ function parseClaudeEvents(events, parentToolUseId) {
6724
6735
  messages.push(fileOrCommandMessage(tool.name, tool.id, "filePath" in tool ? { file_path: tool.filePath } : { command: tool.command }, timestamp));
6725
6736
  }
6726
6737
  filteredEvents.forEach((event) => {
6727
- if (event.type === "claude-user") {
6728
- const content = normalizeContentBlocks(event.payload.message?.content);
6729
- const toolResult = content.find((c) => c.type === "tool_result");
6730
- if (toolResult && toolResult.tool_use_id) {
6731
- const toolInfo = toolCallMap.get(toolResult.tool_use_id);
6732
- if (!toolInfo) return;
6733
- const resultContent = extractToolResultText(toolResult.content);
6734
- const isError = toolResult.is_error || false;
6735
- const status = isError ? "failed" : "completed";
6736
- if (toolInfo.toolName === "TaskCreate" && !isError) {
6737
- taskAccumulator.processContentBlock(toolResult);
6738
- }
6739
- const message = messages[toolInfo.messageIndex];
6740
- if (!message) return;
6741
- if (message.type === "command") {
6742
- message.output = resultContent;
6743
- message.status = status;
6744
- const exitCodeMatch = resultContent.match(/exit code:?\s*(\d+)/i);
6745
- if (exitCodeMatch) {
6746
- message.exitCode = parseInt(exitCodeMatch[1], 10);
6747
- } else {
6748
- message.exitCode = isError ? 1 : 0;
6749
- }
6750
- } else if (message.type === "patch") {
6751
- message.status = status;
6752
- } else if (message.type === "web_search") {
6753
- message.status = status;
6754
- } else if (message.type === "tool_call") {
6755
- message.output = resultContent;
6756
- message.status = status;
6757
- } else if (message.type === "skill") {
6758
- message.status = status;
6759
- } else if (message.type === "subagent") {
6760
- message.output = resultContent;
6761
- message.status = status;
6762
- if (!message.chatId && resultContent) {
6763
- const parsed = safeJsonParse(resultContent, {});
6764
- if (parsed.chatId) {
6765
- message.chatId = parsed.chatId;
6766
- }
6767
- }
6768
- } else if (message.type === "subagent_followup") {
6769
- message.output = resultContent;
6770
- message.status = status;
6738
+ const result = readToolResult(event);
6739
+ if (!result) return;
6740
+ const { toolResult, output: resultContent, status } = result;
6741
+ const toolInfo = toolCallMap.get(result.toolUseId);
6742
+ if (!toolInfo) return;
6743
+ const isError = status === "failed";
6744
+ if (toolInfo.toolName === "TaskCreate" && !isError) {
6745
+ taskAccumulator.processContentBlock(toolResult);
6746
+ }
6747
+ const message = messages[toolInfo.messageIndex];
6748
+ if (!message) return;
6749
+ if (message.type === "command") {
6750
+ message.output = resultContent;
6751
+ message.status = status;
6752
+ const exitCodeMatch = resultContent.match(/exit code:?\s*(\d+)/i);
6753
+ if (exitCodeMatch) {
6754
+ message.exitCode = parseInt(exitCodeMatch[1], 10);
6755
+ } else {
6756
+ message.exitCode = isError ? 1 : 0;
6757
+ }
6758
+ } else if (message.type === "patch") {
6759
+ message.status = status;
6760
+ } else if (message.type === "web_search") {
6761
+ message.status = status;
6762
+ } else if (message.type === "tool_call") {
6763
+ message.output = resultContent;
6764
+ message.status = status;
6765
+ } else if (message.type === "skill") {
6766
+ message.status = status;
6767
+ } else if (message.type === "subagent") {
6768
+ message.output = resultContent;
6769
+ message.status = status;
6770
+ if (!message.chatId && resultContent) {
6771
+ const parsed = safeJsonParse(resultContent, {});
6772
+ if (parsed.chatId) {
6773
+ message.chatId = parsed.chatId;
6771
6774
  }
6772
6775
  }
6776
+ } else if (message.type === "subagent_followup") {
6777
+ message.output = resultContent;
6778
+ message.status = status;
6773
6779
  }
6774
6780
  });
6775
6781
  for (const message of messages) {
@@ -14,7 +14,7 @@ import {
14
14
  isValidAgentProvider,
15
15
  parsePosixEnvFile,
16
16
  readReplicasRuntimeEnv
17
- } from "./chunk-BOUFJ6MN.js";
17
+ } from "./chunk-FKI4Y34A.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-E25NLO2C.js";
6
+ } from "./chunk-RCCLUBJX.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-BOUFJ6MN.js";
9
+ } from "./chunk-FKI4Y34A.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.1006";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1007";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -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-BOUFJ6MN.js";
6
+ } from "./chunk-FKI4Y34A.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -5,15 +5,15 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  setAgentCredentialSnapshot
8
- } from "./chunk-VAJAXROC.js";
8
+ } from "./chunk-M3FARRDB.js";
9
9
  import {
10
10
  AppServerProcess,
11
11
  buildCodexAgentEnv
12
- } from "./chunk-SVJZNG2F.js";
12
+ } from "./chunk-MPQHAEI4.js";
13
13
  import {
14
14
  SUBPROCESS_MAX_BUFFER,
15
15
  execFileAsync
16
- } from "./chunk-E25NLO2C.js";
16
+ } from "./chunk-RCCLUBJX.js";
17
17
  import {
18
18
  isRecord
19
19
  } from "./chunk-UZSNFLDQ.js";
@@ -28,7 +28,7 @@ import {
28
28
  listOpenAICompatibleModels,
29
29
  readOllamaAuthEnv,
30
30
  resolveOpenAICompatibleModelsUrl
31
- } from "./chunk-BOUFJ6MN.js";
31
+ } from "./chunk-FKI4Y34A.js";
32
32
 
33
33
  // src/managers/codex-token-manager.ts
34
34
  import { promises as fs } from "fs";
@@ -264,7 +264,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
264
264
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
265
265
  await this.applyCredentialsResponse(data);
266
266
  setAgentCredentialSnapshot("codex", data);
267
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-VVFKBVIK.js");
267
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-NKNJVTOF.js");
268
268
  await restartCodexAspHostIfRunning2();
269
269
  });
270
270
  await this.start(true);
@@ -285,7 +285,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
285
285
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
286
286
  await this.applyCredentialsResponse(data);
287
287
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
288
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-VVFKBVIK.js");
288
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-NKNJVTOF.js");
289
289
  await restartCodexAspHostIfRunning2();
290
290
  }
291
291
  setAgentCredentialSnapshot("codex", data);
@@ -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-YHLMQT2K.js";
7
- import "./chunk-VAJAXROC.js";
8
- import "./chunk-E25NLO2C.js";
6
+ } from "./chunk-4L2COBFE.js";
7
+ import "./chunk-M3FARRDB.js";
8
+ import "./chunk-RCCLUBJX.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-BOUFJ6MN.js";
12
+ import "./chunk-FKI4Y34A.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-SVJZNG2F.js";
11
- import "./chunk-E25NLO2C.js";
10
+ } from "./chunk-MPQHAEI4.js";
11
+ import "./chunk-RCCLUBJX.js";
12
12
  import {
13
13
  AGENT,
14
14
  headlessAgentRequestSchema
15
- } from "./chunk-BOUFJ6MN.js";
15
+ } from "./chunk-FKI4Y34A.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-YHLMQT2K.js";
35
+ } from "./chunk-4L2COBFE.js";
36
36
  import {
37
37
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
38
38
  AGENT_MESSAGE_DELTA_METHOD,
@@ -57,7 +57,7 @@ import {
57
57
  } from "./chunk-P73LGPQO.js";
58
58
  import {
59
59
  publishedPullRequestUrls
60
- } from "./chunk-JNCJG25E.js";
60
+ } from "./chunk-AHKE7S5O.js";
61
61
  import {
62
62
  BaseRefreshManager,
63
63
  CodexAspAuthMethodChangedError,
@@ -71,7 +71,7 @@ import {
71
71
  refreshDelayMs,
72
72
  restartCodexAspHost,
73
73
  routineRefreshRequest
74
- } from "./chunk-7OGI4N7B.js";
74
+ } from "./chunk-U6JEKZGL.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-VAJAXROC.js";
82
+ } from "./chunk-M3FARRDB.js";
83
83
  import {
84
84
  AspClient,
85
85
  getCodexModelProvider
86
- } from "./chunk-SVJZNG2F.js";
86
+ } from "./chunk-MPQHAEI4.js";
87
87
  import {
88
88
  SUBPROCESS_MAX_BUFFER,
89
89
  execAsync,
90
90
  execFileAsync
91
- } from "./chunk-E25NLO2C.js";
91
+ } from "./chunk-RCCLUBJX.js";
92
92
  import {
93
93
  isRecord as isRecord2
94
94
  } from "./chunk-UZSNFLDQ.js";
@@ -316,7 +316,7 @@ import {
316
316
  workspaceCredentialProviderSchema,
317
317
  workspaceTokenRequestSchema,
318
318
  workspaceTokenResponseSchema
319
- } from "./chunk-BOUFJ6MN.js";
319
+ } from "./chunk-FKI4Y34A.js";
320
320
  import {
321
321
  cloneMcpConfig,
322
322
  ensureCompatibilityImports,
@@ -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-JNCJG25E.js";
6
+ } from "./chunk-AHKE7S5O.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-BOUFJ6MN.js";
12
+ } from "./chunk-FKI4Y34A.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-BOUFJ6MN.js";
12
+ } from "./chunk-FKI4Y34A.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.1006",
3
+ "version": "0.1.1007",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",