replicas-engine 0.1.1652 → 0.1.1654

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-6Q4N3UAH.js";
12
- import "./chunk-2FNTKZEO.js";
13
- import "./chunk-PXPQEPKR.js";
14
- import "./chunk-HOTW5IE7.js";
11
+ } from "./chunk-BIPDGRE5.js";
12
+ import "./chunk-GIPGM7HI.js";
13
+ import "./chunk-Y7LWYQ72.js";
14
+ import "./chunk-2O45JAJY.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
- import "./chunk-VTNIHEC4.js";
16
+ import "./chunk-MERB4XQW.js";
17
17
  import "./chunk-VEQXQN22.js";
18
18
  export {
19
19
  CODEX_ULTRAFAST_SERVICE_TIER,
@@ -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-VTNIHEC4.js";
6
+ } from "./chunk-MERB4XQW.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -12,15 +12,15 @@ import {
12
12
  resolveDiffBase,
13
13
  runGitCommand,
14
14
  setAgentCredentialSnapshot
15
- } from "./chunk-2FNTKZEO.js";
15
+ } from "./chunk-GIPGM7HI.js";
16
16
  import {
17
17
  AppServerProcess,
18
18
  buildCodexAgentEnv
19
- } from "./chunk-PXPQEPKR.js";
19
+ } from "./chunk-Y7LWYQ72.js";
20
20
  import {
21
21
  SUBPROCESS_MAX_BUFFER,
22
22
  execFileAsync
23
- } from "./chunk-HOTW5IE7.js";
23
+ } from "./chunk-2O45JAJY.js";
24
24
  import {
25
25
  isRecord
26
26
  } from "./chunk-UZSNFLDQ.js";
@@ -61,7 +61,7 @@ import {
61
61
  shrunkImageSize,
62
62
  splitManagerInstructions,
63
63
  withTimeout
64
- } from "./chunk-VTNIHEC4.js";
64
+ } from "./chunk-MERB4XQW.js";
65
65
 
66
66
  // src/managers/codex-token-manager.ts
67
67
  import { promises as fs } from "fs";
@@ -461,7 +461,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
461
461
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
462
462
  await this.applyCredentialsResponse(data);
463
463
  setAgentCredentialSnapshot("codex", data);
464
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-N5R7FSVH.js");
464
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-TU37EZCI.js");
465
465
  await restartCodexAspHostIfRunning2();
466
466
  });
467
467
  await this.start(true);
@@ -483,7 +483,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
483
483
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
484
484
  await this.applyCredentialsResponse(data);
485
485
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
486
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-N5R7FSVH.js");
486
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-TU37EZCI.js");
487
487
  await restartCodexAspHostIfRunning2();
488
488
  }
489
489
  setAgentCredentialSnapshot("codex", data);
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  SUBPROCESS_MAX_BUFFER,
6
6
  execFileAsync
7
- } from "./chunk-HOTW5IE7.js";
7
+ } from "./chunk-2O45JAJY.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-VTNIHEC4.js";
24
+ } from "./chunk-MERB4XQW.js";
25
25
 
26
26
  // src/runtime-env-loader.ts
27
27
  import { readFileSync } from "fs";
@@ -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-PXPQEPKR.js";
6
+ } from "./chunk-Y7LWYQ72.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-VTNIHEC4.js";
18
+ } from "./chunk-MERB4XQW.js";
19
19
 
20
20
  // src/managers/codex-asp/notification-dispatch.ts
21
21
  var TURN_STARTED_METHOD = "turn/started";
@@ -5,7 +5,7 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  runGitCommand
8
- } from "./chunk-2FNTKZEO.js";
8
+ } from "./chunk-GIPGM7HI.js";
9
9
  import {
10
10
  COMMAND_PROTECTION_MAX_MESSAGE_FILE_BYTES,
11
11
  COMMAND_PROTECTION_REPO_GIT_ARGS,
@@ -18,7 +18,7 @@ import {
18
18
  parseCommandProtectionRequest,
19
19
  toCommandProtectionRepoState,
20
20
  withRetry
21
- } from "./chunk-VTNIHEC4.js";
21
+ } from "./chunk-MERB4XQW.js";
22
22
 
23
23
  // src/services/command-protection-service.ts
24
24
  import { readFile, stat } from "fs/promises";
@@ -9271,46 +9271,6 @@ function getProviderDisplayName(provider2, variant = "short") {
9271
9271
  }
9272
9272
  }
9273
9273
 
9274
- // ../shared/src/async.ts
9275
- var TIMEOUT = /* @__PURE__ */ Symbol("timeout");
9276
- async function raceWithTimeout(promise, ms) {
9277
- let timer;
9278
- try {
9279
- return await Promise.race([
9280
- promise,
9281
- new Promise((resolve) => {
9282
- timer = setTimeout(() => resolve(TIMEOUT), ms);
9283
- })
9284
- ]);
9285
- } finally {
9286
- clearTimeout(timer);
9287
- promise.catch(() => {
9288
- });
9289
- }
9290
- }
9291
- async function withTimeout(promise, ms, message2) {
9292
- const result = await raceWithTimeout(promise, ms);
9293
- if (result === TIMEOUT) {
9294
- throw new Error(message2);
9295
- }
9296
- return result;
9297
- }
9298
- function createConcurrencyLimit(limit) {
9299
- const waiting = [];
9300
- let active = 0;
9301
- return async (task) => {
9302
- if (active >= limit) await new Promise((resolve) => waiting.push(resolve));
9303
- else active++;
9304
- try {
9305
- return await task();
9306
- } finally {
9307
- const next = waiting.shift();
9308
- if (next) next();
9309
- else active--;
9310
- }
9311
- };
9312
- }
9313
-
9314
9274
  // ../shared/src/result.ts
9315
9275
  function createSuccessResult(data) {
9316
9276
  return { ok: true, data };
@@ -9735,6 +9695,46 @@ var QUEUE_SECTIONS = [
9735
9695
  var MANAGER_QUEUE_GROUPS = QUEUE_SECTIONS.flatMap((section) => section.groups);
9736
9696
  var MANAGER_SHIPPING_LOOKBACK_MS = 3 * 24 * 60 * 6e4;
9737
9697
 
9698
+ // ../shared/src/async.ts
9699
+ var TIMEOUT = /* @__PURE__ */ Symbol("timeout");
9700
+ async function raceWithTimeout(promise, ms) {
9701
+ let timer;
9702
+ try {
9703
+ return await Promise.race([
9704
+ promise,
9705
+ new Promise((resolve) => {
9706
+ timer = setTimeout(() => resolve(TIMEOUT), ms);
9707
+ })
9708
+ ]);
9709
+ } finally {
9710
+ clearTimeout(timer);
9711
+ promise.catch(() => {
9712
+ });
9713
+ }
9714
+ }
9715
+ async function withTimeout(promise, ms, message2) {
9716
+ const result = await raceWithTimeout(promise, ms);
9717
+ if (result === TIMEOUT) {
9718
+ throw new Error(message2);
9719
+ }
9720
+ return result;
9721
+ }
9722
+ function createConcurrencyLimit(limit) {
9723
+ const waiting = [];
9724
+ let active = 0;
9725
+ return async (task) => {
9726
+ if (active >= limit) await new Promise((resolve) => waiting.push(resolve));
9727
+ else active++;
9728
+ try {
9729
+ return await task();
9730
+ } finally {
9731
+ const next = waiting.shift();
9732
+ if (next) next();
9733
+ else active--;
9734
+ }
9735
+ };
9736
+ }
9737
+
9738
9738
  // ../shared/src/models-dev.ts
9739
9739
  import { z as z5 } from "zod";
9740
9740
  var MODELS_DEV_API_URL = "https://models.dev/api.json";
@@ -12266,43 +12266,6 @@ async function readSseStream(body, onEvent, shouldContinue = () => true, onChunk
12266
12266
  // ../shared/src/types.ts
12267
12267
  var ENGINE_SEND_MESSAGE_FAILED_ERROR = "Failed to send message";
12268
12268
 
12269
- // ../shared/src/http-range.ts
12270
- function parseByteRange(header, size) {
12271
- const match = header?.trim().match(/^bytes=(\d*)-(\d*)$/);
12272
- if (!match || !match[1] && !match[2]) return null;
12273
- const [, first, last] = match;
12274
- if (!first) {
12275
- const suffix = Number(last);
12276
- return suffix > 0 && size > 0 ? { start: Math.max(0, size - suffix), end: size - 1 } : "unsatisfiable";
12277
- }
12278
- const start = Number(first);
12279
- const end = last ? Math.min(Number(last), size - 1) : size - 1;
12280
- if (last && Number(last) < start) return null;
12281
- return start < size ? { start, end } : "unsatisfiable";
12282
- }
12283
- async function byteRangeResponse(input) {
12284
- const range = parseByteRange(input.rangeHeader, input.size);
12285
- const headers = { ...input.headers, "Content-Type": input.contentType, "Accept-Ranges": "bytes" };
12286
- if (range === "unsatisfiable") {
12287
- return new Response(null, { status: 416, headers: { ...headers, "Content-Range": `bytes */${input.size}` } });
12288
- }
12289
- const { start, end } = range ?? { start: 0, end: input.size - 1 };
12290
- return new Response(end >= start ? await input.body(start, end + 1) : null, {
12291
- status: range ? 206 : 200,
12292
- headers: {
12293
- ...headers,
12294
- "Content-Length": String(end + 1 - start),
12295
- ...range ? { "Content-Range": `bytes ${start}-${end}/${input.size}` } : {}
12296
- }
12297
- });
12298
- }
12299
-
12300
- // ../shared/src/palette-search.ts
12301
- var DAY_MS = 24 * 60 * 60 * 1e3;
12302
- var RECENCY_HALF_LIFE_MS = 14 * DAY_MS;
12303
- var SEARCH_OPEN_DEDUPE_MS = 10 * 60 * 1e3;
12304
- var PICK_WINDOW_MS = 21 * DAY_MS;
12305
-
12306
12269
  // ../shared/src/routes/workspaces.ts
12307
12270
  import { z as z17 } from "zod";
12308
12271
 
@@ -12361,6 +12324,43 @@ var terminalSocketServerMessageSchema = z17.discriminatedUnion("type", [
12361
12324
  ]);
12362
12325
  var TERMINAL_RTC_ICE_SERVER = "stun:stun.l.google.com:19302";
12363
12326
 
12327
+ // ../shared/src/http-range.ts
12328
+ function parseByteRange(header, size) {
12329
+ const match = header?.trim().match(/^bytes=(\d*)-(\d*)$/);
12330
+ if (!match || !match[1] && !match[2]) return null;
12331
+ const [, first, last] = match;
12332
+ if (!first) {
12333
+ const suffix = Number(last);
12334
+ return suffix > 0 && size > 0 ? { start: Math.max(0, size - suffix), end: size - 1 } : "unsatisfiable";
12335
+ }
12336
+ const start = Number(first);
12337
+ const end = last ? Math.min(Number(last), size - 1) : size - 1;
12338
+ if (last && Number(last) < start) return null;
12339
+ return start < size ? { start, end } : "unsatisfiable";
12340
+ }
12341
+ async function byteRangeResponse(input) {
12342
+ const range = parseByteRange(input.rangeHeader, input.size);
12343
+ const headers = { ...input.headers, "Content-Type": input.contentType, "Accept-Ranges": "bytes" };
12344
+ if (range === "unsatisfiable") {
12345
+ return new Response(null, { status: 416, headers: { ...headers, "Content-Range": `bytes */${input.size}` } });
12346
+ }
12347
+ const { start, end } = range ?? { start: 0, end: input.size - 1 };
12348
+ return new Response(end >= start ? await input.body(start, end + 1) : null, {
12349
+ status: range ? 206 : 200,
12350
+ headers: {
12351
+ ...headers,
12352
+ "Content-Length": String(end + 1 - start),
12353
+ ...range ? { "Content-Range": `bytes ${start}-${end}/${input.size}` } : {}
12354
+ }
12355
+ });
12356
+ }
12357
+
12358
+ // ../shared/src/palette-search.ts
12359
+ var DAY_MS = 24 * 60 * 60 * 1e3;
12360
+ var RECENCY_HALF_LIFE_MS = 14 * DAY_MS;
12361
+ var SEARCH_OPEN_DEDUPE_MS = 10 * 60 * 1e3;
12362
+ var PICK_WINDOW_MS = 21 * DAY_MS;
12363
+
12364
12364
  // ../shared/src/workspace-search.ts
12365
12365
  var WORKSPACE_SEARCH_INDEX_PARAMS = {
12366
12366
  viewModes: [...WORKSPACE_SIDEBAR_VIEWS].sort().join(","),
@@ -15960,6 +15960,7 @@ When someone asks for a recurring task or accepts an offer to automate a repeate
15960
15960
  // ../shared/src/prompts.ts
15961
15961
  var REPLICAS_INSTRUCTIONS_TAG = "replicas_instructions";
15962
15962
  var MANAGER_INSTRUCTIONS_TAG = "multitask_instructions";
15963
+ var PR_FIXES_NEEDS_DECISION = "Needs your decision:";
15963
15964
  function wrapInTag(content, tag) {
15964
15965
  return `<${tag}>
15965
15966
  ${content}
@@ -21188,7 +21189,7 @@ async function withRetry(label, fn, options) {
21188
21189
  }
21189
21190
 
21190
21191
  // ../shared/src/tensorlake.ts
21191
- var TENSORLAKE_IMAGE_NAME = "replicas-sandbox-2026-11-19-v13";
21192
+ var TENSORLAKE_IMAGE_NAME = "replicas-sandbox-2026-11-19-v14";
21192
21193
  var TENSORLAKE_DISK_MB = 100 * 1024;
21193
21194
 
21194
21195
  // ../shared/src/egress.ts
@@ -23481,11 +23482,6 @@ export {
23481
23482
  isValidThinkingLevel,
23482
23483
  codexReasoningEffortForThinkingLevel,
23483
23484
  getProviderDisplayName,
23484
- TIMEOUT,
23485
- raceWithTimeout,
23486
- withTimeout,
23487
- createConcurrencyLimit,
23488
- byteRangeResponse,
23489
23485
  createSuccessResult,
23490
23486
  createErrorResult,
23491
23487
  listOpenAICompatibleModels,
@@ -23523,6 +23519,11 @@ export {
23523
23519
  SUBAGENT_SERVICE_TIERS,
23524
23520
  serviceTierRequestFields,
23525
23521
  TERMINAL_RTC_ICE_SERVER,
23522
+ TIMEOUT,
23523
+ raceWithTimeout,
23524
+ withTimeout,
23525
+ createConcurrencyLimit,
23526
+ byteRangeResponse,
23526
23527
  exhaustedUntil,
23527
23528
  detectAgentQuotaLimit,
23528
23529
  ASTER_PROVIDER,
@@ -23676,6 +23677,7 @@ export {
23676
23677
  REPLICAS_MCP_TOOLS,
23677
23678
  REPLICAS_INSTRUCTIONS_TAG,
23678
23679
  MANAGER_INSTRUCTIONS_TAG,
23680
+ PR_FIXES_NEEDS_DECISION,
23679
23681
  wrapInTag,
23680
23682
  splitManagerInstructions,
23681
23683
  MANAGER_TURN_ERROR_SUMMARY,
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-VTNIHEC4.js";
8
+ } from "./chunk-MERB4XQW.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-HOTW5IE7.js";
6
+ } from "./chunk-2O45JAJY.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-VTNIHEC4.js";
9
+ } from "./chunk-MERB4XQW.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.1652";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1654";
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-JBOM4NW7.js";
7
- import "./chunk-2FNTKZEO.js";
8
- import "./chunk-HOTW5IE7.js";
6
+ } from "./chunk-LSKZQEHS.js";
7
+ import "./chunk-GIPGM7HI.js";
8
+ import "./chunk-2O45JAJY.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-VTNIHEC4.js";
12
+ import "./chunk-MERB4XQW.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-DL3A6O5B.js";
17
+ } from "./chunk-KT44SVQS.js";
18
18
  import {
19
19
  AppServerProcess,
20
20
  buildCodexAgentEnv
21
- } from "./chunk-PXPQEPKR.js";
22
- import "./chunk-HOTW5IE7.js";
21
+ } from "./chunk-Y7LWYQ72.js";
22
+ import "./chunk-2O45JAJY.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-VTNIHEC4.js";
32
+ } from "./chunk-MERB4XQW.js";
33
33
  import "./chunk-VEQXQN22.js";
34
34
 
35
35
  // src/headless-agent.ts
package/dist/src/index.js CHANGED
@@ -91,7 +91,7 @@ import {
91
91
  evaluateCommandProtection,
92
92
  extractToolCommand,
93
93
  reportCommandProtectionBlock
94
- } from "./chunk-JBOM4NW7.js";
94
+ } from "./chunk-LSKZQEHS.js";
95
95
  import {
96
96
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
97
97
  AGENT_MESSAGE_DELTA_METHOD,
@@ -129,10 +129,10 @@ import {
129
129
  spawnMuseMsp,
130
130
  startMuseSession,
131
131
  uuidV7
132
- } from "./chunk-DL3A6O5B.js";
132
+ } from "./chunk-KT44SVQS.js";
133
133
  import {
134
134
  publishedPullRequestUrls
135
- } from "./chunk-3B6GDWJQ.js";
135
+ } from "./chunk-MHBE5KFM.js";
136
136
  import {
137
137
  ACCOUNT_RATE_LIMITS_READ_METHOD,
138
138
  AsyncLock,
@@ -212,7 +212,7 @@ import {
212
212
  transcriptSecrets,
213
213
  upsertCredentialFileLines,
214
214
  writeSecureCredentialFile
215
- } from "./chunk-6Q4N3UAH.js";
215
+ } from "./chunk-BIPDGRE5.js";
216
216
  import {
217
217
  ENGINE_ENV,
218
218
  UNQUOTED_PATHS_CONFIG,
@@ -223,16 +223,16 @@ import {
223
223
  resolveDiffBase,
224
224
  setAgentCredentialSnapshot,
225
225
  setLinearSessionId
226
- } from "./chunk-2FNTKZEO.js";
226
+ } from "./chunk-GIPGM7HI.js";
227
227
  import {
228
228
  buildCodexAgentEnv,
229
229
  getCodexModelProvider
230
- } from "./chunk-PXPQEPKR.js";
230
+ } from "./chunk-Y7LWYQ72.js";
231
231
  import {
232
232
  SUBPROCESS_MAX_BUFFER,
233
233
  execAsync,
234
234
  execFileAsync
235
- } from "./chunk-HOTW5IE7.js";
235
+ } from "./chunk-2O45JAJY.js";
236
236
  import {
237
237
  isRecord as isRecord2
238
238
  } from "./chunk-UZSNFLDQ.js";
@@ -329,6 +329,7 @@ import {
329
329
  OLLAMA_AGENTS,
330
330
  OPENCODE_GO_BASE_URL,
331
331
  OPENCODE_GO_PROVIDER,
332
+ PR_FIXES_NEEDS_DECISION,
332
333
  QUEUED_MESSAGE_REMOVED_EVENT_TYPE,
333
334
  REMOVED_MESSAGE_IDS_PAYLOAD_KEY,
334
335
  REPLACED_MESSAGE_ID_PAYLOAD_KEY,
@@ -528,7 +529,7 @@ import {
528
529
  workspaceTokenRequestSchema,
529
530
  workspaceTokenResponseSchema,
530
531
  wrapInTag
531
- } from "./chunk-VTNIHEC4.js";
532
+ } from "./chunk-MERB4XQW.js";
532
533
  import {
533
534
  __commonJS,
534
535
  __export,
@@ -61878,11 +61879,25 @@ var ChatService = class {
61878
61879
  this.heldSubagentReports.set(chat.persisted.id, { completedAt, errors });
61879
61880
  return;
61880
61881
  }
61881
- const last = this.getRuntimeChat(parentChatId)?.lastSendRequest;
61882
- if (!last) return;
61882
+ if (!this.getRuntimeChat(parentChatId)?.lastSendRequest) return;
61883
+ const detail = errors?.length ? errors.join("\n") : extractFinalResponse(await chat.provider.getHistory(), chat.persisted.provider) ?? "[No response from subagent]";
61884
+ await this.reportToChat(parentChatId, chat, completedAt, {
61885
+ summary: `${errors?.length ? MANAGER_TURN_ERROR_SUMMARY : "Finished its turn."} It is a subagent in this workspace: reach it with the ${SUBAGENT_MCP_TOOLS.messageAgent} and ${SUBAGENT_MCP_TOOLS.getAgent} tools and this chat_id.`,
61886
+ detail: truncateManagerEventResponse(detail, SUBAGENT_MCP_TOOLS.getAgent)
61887
+ }, `subagent-finished:${chat.persisted.id}:${completedAt}`);
61888
+ }
61889
+ async reportPullRequestFixesDecision(chat, sourceChatId, completedAt) {
61890
+ const detail = extractFinalResponse(await chat.provider.getHistory(), chat.persisted.provider);
61891
+ if (!detail?.includes(PR_FIXES_NEEDS_DECISION)) return;
61892
+ await this.reportToChat(sourceChatId, chat, completedAt, {
61893
+ summary: `Needs a decision before it can go on. Ask the user for it, and when they answer, carry it out: the fix is committed in its worktree, so push it from there with the command it gives, change it, or drop it.`,
61894
+ detail
61895
+ }, `pr-fixes-decision:${chat.persisted.id}:${completedAt}`);
61896
+ }
61897
+ async reportToChat(targetChatId, chat, completedAt, event, idempotencyKey) {
61898
+ const last = this.getRuntimeChat(targetChatId)?.lastSendRequest;
61883
61899
  try {
61884
- const detail = errors?.length ? errors.join("\n") : extractFinalResponse(await chat.provider.getHistory(), chat.persisted.provider) ?? "[No response from subagent]";
61885
- await this.sendMessage(parentChatId, {
61900
+ await this.sendMessage(targetChatId, {
61886
61901
  message: formatManagerEvents([{
61887
61902
  id: randomUUID9(),
61888
61903
  at: completedAt,
@@ -61890,18 +61905,17 @@ var ChatService = class {
61890
61905
  agentId: chat.persisted.id,
61891
61906
  agentName: chat.persisted.title,
61892
61907
  chatId: chat.persisted.id,
61893
- summary: `${errors?.length ? MANAGER_TURN_ERROR_SUMMARY : "Finished its turn."} It is a subagent in this workspace: reach it with the ${SUBAGENT_MCP_TOOLS.messageAgent} and ${SUBAGENT_MCP_TOOLS.getAgent} tools and this chat_id.`,
61894
- detail: truncateManagerEventResponse(detail, SUBAGENT_MCP_TOOLS.getAgent)
61908
+ ...event
61895
61909
  }]),
61896
- ...last.customInstructions ? { customInstructions: last.customInstructions } : {},
61897
- ...last.enableInteractiveTools !== void 0 ? { enableInteractiveTools: last.enableInteractiveTools } : {},
61910
+ ...last?.customInstructions ? { customInstructions: last.customInstructions } : {},
61911
+ ...last?.enableInteractiveTools !== void 0 ? { enableInteractiveTools: last.enableInteractiveTools } : {},
61898
61912
  type: MANAGER_EVENT_MESSAGE_TYPE,
61899
61913
  merge: true,
61900
61914
  inheritThinkingLevel: true,
61901
- idempotencyKey: `subagent-finished:${chat.persisted.id}:${completedAt}`
61915
+ idempotencyKey
61902
61916
  });
61903
61917
  } catch (error) {
61904
- console.error("[ChatService] Failed to report subagent to its parent:", { chatId: chat.persisted.id, error });
61918
+ console.error("[ChatService] Failed to report a chat to another chat:", { chatId: chat.persisted.id, targetChatId, error });
61905
61919
  }
61906
61920
  }
61907
61921
  async sendMessage(chatId, request) {
@@ -63391,6 +63405,7 @@ ${note}`;
63391
63405
  if (!processing && chat.persisted.fork?.trigger !== "side") void this.reportSubagentToParent(chat, completedAt, chat.lastTurnErrors);
63392
63406
  return;
63393
63407
  }
63408
+ if (!processing && chat.persisted.fork && isPullRequestFeedbackChat(chat.persisted)) void this.reportPullRequestFixesDecision(chat, chat.persisted.fork.source.chatId, completedAt);
63394
63409
  this.publish({
63395
63410
  type: "chat.turn.completed",
63396
63411
  payload: {
@@ -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-3B6GDWJQ.js";
6
+ } from "./chunk-MHBE5KFM.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-VTNIHEC4.js";
12
+ } from "./chunk-MERB4XQW.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-VTNIHEC4.js";
14
+ } from "./chunk-MERB4XQW.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.1652",
3
+ "version": "0.1.1654",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",