replicas-engine 0.1.1193 → 0.1.1195

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
  listRunningCodexModels,
9
9
  restartCodexAspHost,
10
10
  restartCodexAspHostIfRunning
11
- } from "./chunk-NAX7OMFI.js";
12
- import "./chunk-WJAKGFYD.js";
13
- import "./chunk-5ZVVCDEG.js";
14
- import "./chunk-2G62KJLA.js";
11
+ } from "./chunk-LHL4WXUK.js";
12
+ import "./chunk-ZR5BD5SR.js";
13
+ import "./chunk-C3JNUTDF.js";
14
+ import "./chunk-FIBXPCOA.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
- import "./chunk-G6OGB6HX.js";
16
+ import "./chunk-7LBCGK6Y.js";
17
17
  import "./chunk-VEQXQN22.js";
18
18
  export {
19
19
  CODEX_ULTRAFAST_SERVICE_TIER,
@@ -2269,6 +2269,12 @@ var agentQuotaExhaustedPayloadSchema = z9.object({
2269
2269
  function defaultForkChatTitle(source, provider2) {
2270
2270
  return isDefaultChat(source) ? `Forked from ${source.title}` : `${source.title} (${getProviderDisplayName(provider2)})`;
2271
2271
  }
2272
+ var continuesChat = (chat, source) => !chat.deletedAt && chat.fork?.trigger === "auto" && chat.fork.source.chatId === source.id && source.updatedAt <= chat.fork.startedAt;
2273
+ function getChatContinuation(chats, chatId) {
2274
+ const source = chatId ? chats.find((chat) => chat.id === chatId) : void 0;
2275
+ const next = source && chats.find((chat) => continuesChat(chat, source));
2276
+ return next && (getChatContinuation(chats, next.id) ?? next);
2277
+ }
2272
2278
 
2273
2279
  // ../shared/src/credential-pool.ts
2274
2280
  import { z as z10 } from "zod";
@@ -2363,6 +2369,66 @@ var USER_MESSAGE_MATCH_GRACE_PERIOD_MS = 3e4;
2363
2369
  var COMPACTION_CONTENT = "Context compacted";
2364
2370
  var GOAL_TOOL_NAME = "goal";
2365
2371
 
2372
+ // ../shared/src/user-message-parser/chat-fork.ts
2373
+ var OPEN_MARKER = "<!-- replicas:chat-fork ";
2374
+ var OPEN_MARKER_END = " -->";
2375
+ var CLOSE_MARKER = "<!-- /replicas:chat-fork -->";
2376
+ var CHAT_FORK_EXCERPT_OMITTED_NOTICE = "[earlier turns omitted; read the transcript file for them]";
2377
+ function formatChatForkHandoffMessage(handoff) {
2378
+ const meta = {
2379
+ sourceProvider: handoff.source.provider,
2380
+ sourceTitle: handoff.source.title,
2381
+ trigger: handoff.trigger,
2382
+ reason: handoff.reason
2383
+ };
2384
+ const sourceName = getProviderDisplayName(handoff.source.provider, "long");
2385
+ const reason = describeChatForkReason(handoff.reason, handoff.source.provider);
2386
+ const why = handoff.trigger === "auto" ? `until ${reason ?? "it stopped"}, so Replicas moved the conversation to you automatically` : "until the user forked it to you";
2387
+ const side = handoff.trigger === "side";
2388
+ const body = [
2389
+ side ? "# Side chat" : handoff.subagent ? "# Delegated task context" : `# Continuing a ${sourceName} chat`,
2390
+ "",
2391
+ side ? `You are a side chat the user opened next to the main chat "${handoff.source.title}" (${sourceName}) in this same workspace, to talk about it without interrupting it. The main chat may still be working, and nothing you say reaches it or its agent. Answer from its transcript and the workspace. The recent turns below are a snapshot from when you were opened and the main chat has likely moved on, so re-read the transcript file before answering anything about what it is doing or has done. Its agent works in the same files, so don't edit files, change git state, or start or stop processes unless the user explicitly asks you to.` : handoff.subagent ? `You are a subagent of the chat "${handoff.source.title}" in this same workspace. The inherited transcript is background for your assigned task below. Follow that task and report your result to the parent; do not take over the parent's entire request. Workspace files and git state are shared and authoritative.` : `You are picking up the chat "${handoff.source.title}" in this same workspace. It was running on ${sourceName} ${why}. Everything the previous agent changed is already on disk: the workspace files and git state are authoritative.`,
2392
+ "",
2393
+ "## Transcript",
2394
+ "",
2395
+ side ? `- Main chat transcript: \`${handoff.transcriptPath}\` (Replicas refreshes it with the main chat's latest turns before each of your turns; re-read it whenever you need the main chat's current state)` : `- Sanitized transcript: \`${handoff.transcriptPath}\` (read or grep it for anything not in the excerpt below)`,
2396
+ ...handoff.rawHistoryPath ? [`- Raw event log: \`${handoff.rawHistoryPath}\``] : [],
2397
+ ...handoff.sourceTruncated ? [`- The chat was too large to sanitize in full; the sanitized file holds only its most recent part.${handoff.rawHistoryPath ? " Grep the raw event log for anything older." : ""}`] : [],
2398
+ "",
2399
+ "## Recent turns",
2400
+ "",
2401
+ ...handoff.excerptTruncated ? [CHAT_FORK_EXCERPT_OMITTED_NOTICE, ""] : [],
2402
+ handoff.excerpt.trim() || "_The source chat had no messages yet._"
2403
+ ].join("\n");
2404
+ const instruction = handoff.message?.trim() || (side ? "Say in one sentence that you are ready for questions about the main chat." : handoff.resumeRequest ? `The previous agent was interrupted before it finished this request from the user. Continue it now:
2405
+
2406
+ ${handoff.resumeRequest.trim().replace(/^/gm, "> ")}` : "Review the recent turns and the current workspace state, then continue where the previous agent left off. If nothing is pending, confirm in a sentence or two what you know and wait for the next request.");
2407
+ return `${OPEN_MARKER}${JSON.stringify(meta)}${OPEN_MARKER_END}
2408
+ ${body}
2409
+ ${CLOSE_MARKER}
2410
+
2411
+ ${instruction}`;
2412
+ }
2413
+ function formatSideChatUpdateMessage(source, turns, message2) {
2414
+ const meta = { sourceProvider: source.provider, sourceTitle: source.title, trigger: "side" };
2415
+ return `${OPEN_MARKER}${JSON.stringify(meta)}${OPEN_MARKER_END}
2416
+ # Main chat update
2417
+
2418
+ The main chat "${source.title}" has new turns since your last reply:
2419
+
2420
+ ${turns}
2421
+ ${CLOSE_MARKER}
2422
+
2423
+ ${message2}`;
2424
+ }
2425
+
2426
+ // ../shared/src/display-message/chat-thread.ts
2427
+ function describeHarnessSwitch(message2) {
2428
+ const reason = describeChatForkReason(message2.reason, message2.fromProvider) ?? `${getProviderDisplayName(message2.fromProvider)} stopped`;
2429
+ return `${reason}, continuing in ${getProviderDisplayName(message2.toProvider, "long")}`;
2430
+ }
2431
+
2366
2432
  // ../shared/src/shell-commands.ts
2367
2433
  var SHELL_OPAQUE = "\0";
2368
2434
  var MAX_DEPTH = 8;
@@ -2821,6 +2887,7 @@ ${operation.diff}` : ""}`).join("\n\n");
2821
2887
  const { headline, outcomeClause } = describeAuthFallback(message2);
2822
2888
  return { kind: "error", title: "Credential fallback", summary: headline, content: [`The workspace ${outcomeClause}.`, message2.detail].filter(Boolean).join("\n\n") };
2823
2889
  }
2890
+ if (message2.type === "harness_switch") return { kind: "error", title: describeHarnessSwitch(message2), summary: "", content: "" };
2824
2891
  if (message2.type === "interruption") return { kind: "error", title: "Agent stopped", summary: "", content: "" };
2825
2892
  if (message2.type === "multitask_event") return { kind: "task", title: "Subagent update", summary: message2.events.map((event) => `${event.agentName}: ${event.summary}`).join(" \xB7 "), content: "" };
2826
2893
  return { kind: "error", title: "Agent error", summary: "", content: message2.message };
@@ -7955,60 +8022,6 @@ function lastUserBlockText(blocks) {
7955
8022
  return body || null;
7956
8023
  }
7957
8024
 
7958
- // ../shared/src/user-message-parser/chat-fork.ts
7959
- var OPEN_MARKER = "<!-- replicas:chat-fork ";
7960
- var OPEN_MARKER_END = " -->";
7961
- var CLOSE_MARKER = "<!-- /replicas:chat-fork -->";
7962
- var CHAT_FORK_EXCERPT_OMITTED_NOTICE = "[earlier turns omitted; read the transcript file for them]";
7963
- function formatChatForkHandoffMessage(handoff) {
7964
- const meta = {
7965
- sourceProvider: handoff.source.provider,
7966
- sourceTitle: handoff.source.title,
7967
- trigger: handoff.trigger,
7968
- reason: handoff.reason
7969
- };
7970
- const sourceName = getProviderDisplayName(handoff.source.provider, "long");
7971
- const reason = describeChatForkReason(handoff.reason, handoff.source.provider);
7972
- const why = handoff.trigger === "auto" ? `until ${reason ?? "it stopped"}, so Replicas moved the conversation to you automatically` : "until the user forked it to you";
7973
- const side = handoff.trigger === "side";
7974
- const body = [
7975
- side ? "# Side chat" : handoff.subagent ? "# Delegated task context" : `# Continuing a ${sourceName} chat`,
7976
- "",
7977
- side ? `You are a side chat the user opened next to the main chat "${handoff.source.title}" (${sourceName}) in this same workspace, to talk about it without interrupting it. The main chat may still be working, and nothing you say reaches it or its agent. Answer from its transcript and the workspace. The recent turns below are a snapshot from when you were opened and the main chat has likely moved on, so re-read the transcript file before answering anything about what it is doing or has done. Its agent works in the same files, so don't edit files, change git state, or start or stop processes unless the user explicitly asks you to.` : handoff.subagent ? `You are a subagent of the chat "${handoff.source.title}" in this same workspace. The inherited transcript is background for your assigned task below. Follow that task and report your result to the parent; do not take over the parent's entire request. Workspace files and git state are shared and authoritative.` : `You are picking up the chat "${handoff.source.title}" in this same workspace. It was running on ${sourceName} ${why}. Everything the previous agent changed is already on disk: the workspace files and git state are authoritative.`,
7978
- "",
7979
- "## Transcript",
7980
- "",
7981
- side ? `- Main chat transcript: \`${handoff.transcriptPath}\` (Replicas refreshes it with the main chat's latest turns before each of your turns; re-read it whenever you need the main chat's current state)` : `- Sanitized transcript: \`${handoff.transcriptPath}\` (read or grep it for anything not in the excerpt below)`,
7982
- ...handoff.rawHistoryPath ? [`- Raw event log: \`${handoff.rawHistoryPath}\``] : [],
7983
- ...handoff.sourceTruncated ? [`- The chat was too large to sanitize in full; the sanitized file holds only its most recent part.${handoff.rawHistoryPath ? " Grep the raw event log for anything older." : ""}`] : [],
7984
- "",
7985
- "## Recent turns",
7986
- "",
7987
- ...handoff.excerptTruncated ? [CHAT_FORK_EXCERPT_OMITTED_NOTICE, ""] : [],
7988
- handoff.excerpt.trim() || "_The source chat had no messages yet._"
7989
- ].join("\n");
7990
- const instruction = handoff.message?.trim() || (side ? "Say in one sentence that you are ready for questions about the main chat." : handoff.resumeRequest ? `The previous agent was interrupted before it finished this request from the user. Continue it now:
7991
-
7992
- ${handoff.resumeRequest.trim().replace(/^/gm, "> ")}` : "Review the recent turns and the current workspace state, then continue where the previous agent left off. If nothing is pending, confirm in a sentence or two what you know and wait for the next request.");
7993
- return `${OPEN_MARKER}${JSON.stringify(meta)}${OPEN_MARKER_END}
7994
- ${body}
7995
- ${CLOSE_MARKER}
7996
-
7997
- ${instruction}`;
7998
- }
7999
- function formatSideChatUpdateMessage(source, turns, message2) {
8000
- const meta = { sourceProvider: source.provider, sourceTitle: source.title, trigger: "side" };
8001
- return `${OPEN_MARKER}${JSON.stringify(meta)}${OPEN_MARKER_END}
8002
- # Main chat update
8003
-
8004
- The main chat "${source.title}" has new turns since your last reply:
8005
-
8006
- ${turns}
8007
- ${CLOSE_MARKER}
8008
-
8009
- ${message2}`;
8010
- }
8011
-
8012
8025
  // ../shared/src/transcript-condense.ts
8013
8026
  var W = "[\\p{L}\\p{N}_]";
8014
8027
  var NOT_BEFORE = `(?<!${W})`;
@@ -9966,6 +9979,7 @@ export {
9966
9979
  decodePathSegments,
9967
9980
  buildCodeHostPrUrl,
9968
9981
  detectLanguageByPath,
9982
+ DEFAULT_CHAT_TITLES,
9969
9983
  isDefaultChat,
9970
9984
  CLAUDE_OPUS_4_8_BEDROCK_MODEL,
9971
9985
  CLAUDE_SONNET_5_BEDROCK_MODEL,
@@ -9997,6 +10011,7 @@ export {
9997
10011
  AGENT_QUOTA_EXHAUSTED_EVENT_TYPE,
9998
10012
  agentQuotaExhaustedPayloadSchema,
9999
10013
  defaultForkChatTitle,
10014
+ getChatContinuation,
10000
10015
  CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE,
10001
10016
  ACCEPTED_USER_MESSAGE_SOURCE,
10002
10017
  QUEUED_MESSAGE_REMOVED_EVENT_TYPE,
@@ -10045,6 +10060,9 @@ export {
10045
10060
  chatHistoryPageParamsFromQuery,
10046
10061
  paginateChatHistory,
10047
10062
  coerceBackgroundTaskPayload,
10063
+ CHAT_FORK_EXCERPT_OMITTED_NOTICE,
10064
+ formatChatForkHandoffMessage,
10065
+ formatSideChatUpdateMessage,
10048
10066
  fileContentDiff,
10049
10067
  skillNamesFromCommand,
10050
10068
  SUBAGENT_MCP_SERVER_NAME,
@@ -10098,9 +10116,6 @@ export {
10098
10116
  CodexHistoryEventFolder,
10099
10117
  canonicalizeChatTranscriptBlocks,
10100
10118
  lastUserBlockText,
10101
- CHAT_FORK_EXCERPT_OMITTED_NOTICE,
10102
- formatChatForkHandoffMessage,
10103
- formatSideChatUpdateMessage,
10104
10119
  percentage,
10105
10120
  autoCompactThresholdField,
10106
10121
  normalizeAutoCompactThreshold,
@@ -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-2G62KJLA.js";
6
+ } from "./chunk-FIBXPCOA.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-G6OGB6HX.js";
9
+ } from "./chunk-7LBCGK6Y.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.1193";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1195";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -5,7 +5,7 @@ import {
5
5
  extractCommandProtectionCommandText,
6
6
  isRecord,
7
7
  parseCodeHostPrUrl
8
- } from "./chunk-G6OGB6HX.js";
8
+ } from "./chunk-7LBCGK6Y.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -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-G6OGB6HX.js";
6
+ } from "./chunk-7LBCGK6Y.js";
7
7
 
8
8
  // src/utils/exec.ts
9
9
  import { exec, execFile } from "child_process";
@@ -5,14 +5,14 @@ import {
5
5
  getOriginDefaultBranch,
6
6
  monolithRequest,
7
7
  runGitCommand
8
- } from "./chunk-WJAKGFYD.js";
8
+ } from "./chunk-ZR5BD5SR.js";
9
9
  import {
10
10
  extractCommandProtectionCommandText,
11
11
  findCommandProtectionGitLookups,
12
12
  findGitCommitSignals,
13
13
  findPrMergeSignals,
14
14
  parseCommandProtectionRequest
15
- } from "./chunk-G6OGB6HX.js";
15
+ } from "./chunk-7LBCGK6Y.js";
16
16
 
17
17
  // src/services/command-protection-service.ts
18
18
  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
  AspClient
6
- } from "./chunk-5ZVVCDEG.js";
6
+ } from "./chunk-C3JNUTDF.js";
7
7
  import {
8
8
  ASTER_BASE_URL,
9
9
  ASTER_PROVIDER,
@@ -13,7 +13,7 @@ import {
13
13
  isRecord,
14
14
  readOllamaAuthEnv,
15
15
  readOpenAICompatibleAuthEnv
16
- } from "./chunk-G6OGB6HX.js";
16
+ } from "./chunk-7LBCGK6Y.js";
17
17
 
18
18
  // src/managers/codex-asp/notification-dispatch.ts
19
19
  var TURN_STARTED_METHOD = "turn/started";
@@ -10,15 +10,15 @@ import {
10
10
  resolveDiffBase,
11
11
  runGitCommand,
12
12
  setAgentCredentialSnapshot
13
- } from "./chunk-WJAKGFYD.js";
13
+ } from "./chunk-ZR5BD5SR.js";
14
14
  import {
15
15
  AppServerProcess,
16
16
  buildCodexAgentEnv
17
- } from "./chunk-5ZVVCDEG.js";
17
+ } from "./chunk-C3JNUTDF.js";
18
18
  import {
19
19
  SUBPROCESS_MAX_BUFFER,
20
20
  execFileAsync
21
- } from "./chunk-2G62KJLA.js";
21
+ } from "./chunk-FIBXPCOA.js";
22
22
  import {
23
23
  isRecord
24
24
  } from "./chunk-UZSNFLDQ.js";
@@ -55,7 +55,7 @@ import {
55
55
  resolveOpenAICompatibleModelsUrl,
56
56
  splitMothershipInstructions,
57
57
  withTimeout
58
- } from "./chunk-G6OGB6HX.js";
58
+ } from "./chunk-7LBCGK6Y.js";
59
59
 
60
60
  // src/managers/codex-token-manager.ts
61
61
  import { promises as fs } from "fs";
@@ -291,7 +291,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
291
291
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
292
292
  await this.applyCredentialsResponse(data);
293
293
  setAgentCredentialSnapshot("codex", data);
294
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-J2LJFIX7.js");
294
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-XGAKITDJ.js");
295
295
  await restartCodexAspHostIfRunning2();
296
296
  });
297
297
  await this.start(true);
@@ -313,7 +313,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
313
313
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
314
314
  await this.applyCredentialsResponse(data);
315
315
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
316
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-J2LJFIX7.js");
316
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-XGAKITDJ.js");
317
317
  await restartCodexAspHostIfRunning2();
318
318
  }
319
319
  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-2G62KJLA.js";
7
+ } from "./chunk-FIBXPCOA.js";
8
8
  import {
9
9
  isRecord as isRecord2
10
10
  } from "./chunk-UZSNFLDQ.js";
@@ -18,7 +18,7 @@ import {
18
18
  isValidAgentProvider,
19
19
  parsePosixEnvFile,
20
20
  readReplicasRuntimeEnv
21
- } from "./chunk-G6OGB6HX.js";
21
+ } from "./chunk-7LBCGK6Y.js";
22
22
 
23
23
  // src/runtime-env-loader.ts
24
24
  import { readFileSync } from "fs";
@@ -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-GMZHK5QI.js";
7
- import "./chunk-WJAKGFYD.js";
8
- import "./chunk-2G62KJLA.js";
6
+ } from "./chunk-GK57LZQO.js";
7
+ import "./chunk-ZR5BD5SR.js";
8
+ import "./chunk-FIBXPCOA.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-G6OGB6HX.js";
12
+ import "./chunk-7LBCGK6Y.js";
13
13
  import "./chunk-VEQXQN22.js";
14
14
 
15
15
  // src/command-protection-hook.ts
@@ -13,12 +13,12 @@ import {
13
13
  recoverCompletedTurn,
14
14
  spawnMuseMsp,
15
15
  startMuseSession
16
- } from "./chunk-VV6RUT4F.js";
16
+ } from "./chunk-GUUTH6CN.js";
17
17
  import {
18
18
  AppServerProcess,
19
19
  buildCodexAgentEnv
20
- } from "./chunk-5ZVVCDEG.js";
21
- import "./chunk-2G62KJLA.js";
20
+ } from "./chunk-C3JNUTDF.js";
21
+ import "./chunk-FIBXPCOA.js";
22
22
  import {
23
23
  AGENT,
24
24
  OPENCODE_GO_PROVIDER,
@@ -28,7 +28,7 @@ import {
28
28
  headlessAgentUsagePath,
29
29
  isRecord,
30
30
  withTimeout
31
- } from "./chunk-G6OGB6HX.js";
31
+ } from "./chunk-7LBCGK6Y.js";
32
32
  import "./chunk-VEQXQN22.js";
33
33
 
34
34
  // 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-GMZHK5QI.js";
30
+ } from "./chunk-GK57LZQO.js";
31
31
  import {
32
32
  ACCOUNT_RATE_LIMITS_UPDATED_METHOD,
33
33
  AGENT_MESSAGE_DELTA_METHOD,
@@ -64,10 +64,10 @@ import {
64
64
  spawnMuseMsp,
65
65
  startMuseSession,
66
66
  uuidV7
67
- } from "./chunk-VV6RUT4F.js";
67
+ } from "./chunk-GUUTH6CN.js";
68
68
  import {
69
69
  publishedPullRequestUrls
70
- } from "./chunk-ZKSO7G5X.js";
70
+ } from "./chunk-CNWTNVTV.js";
71
71
  import {
72
72
  ACCOUNT_RATE_LIMITS_READ_METHOD,
73
73
  AsyncLock,
@@ -139,7 +139,7 @@ import {
139
139
  timestampFromSeconds,
140
140
  upsertCredentialFileLines,
141
141
  writeSecureCredentialFile
142
- } from "./chunk-NAX7OMFI.js";
142
+ } from "./chunk-LHL4WXUK.js";
143
143
  import {
144
144
  ENGINE_ENV,
145
145
  monolithRequest,
@@ -148,15 +148,15 @@ import {
148
148
  reloadEngineEnv,
149
149
  resolveDiffBase,
150
150
  setAgentCredentialSnapshot
151
- } from "./chunk-WJAKGFYD.js";
151
+ } from "./chunk-ZR5BD5SR.js";
152
152
  import {
153
153
  getCodexModelProvider
154
- } from "./chunk-5ZVVCDEG.js";
154
+ } from "./chunk-C3JNUTDF.js";
155
155
  import {
156
156
  SUBPROCESS_MAX_BUFFER,
157
157
  execAsync,
158
158
  execFileAsync
159
- } from "./chunk-2G62KJLA.js";
159
+ } from "./chunk-FIBXPCOA.js";
160
160
  import {
161
161
  isRecord as isRecord2
162
162
  } from "./chunk-UZSNFLDQ.js";
@@ -193,6 +193,7 @@ import {
193
193
  CURSOR_CONNECTION_STATUS_EVENT_TYPE,
194
194
  CodexHistoryEventFolder,
195
195
  DEFAULT_ASTER_MODEL,
196
+ DEFAULT_CHAT_TITLES,
196
197
  DEFAULT_CLAUDE_MODEL,
197
198
  DEFAULT_CURSOR_MODEL,
198
199
  DEFAULT_MUSE_MODEL,
@@ -292,6 +293,7 @@ import {
292
293
  forkChatRequestSchema,
293
294
  formatChatForkHandoffMessage,
294
295
  formatSideChatUpdateMessage,
296
+ getChatContinuation,
295
297
  getChatHistoryPageSenders,
296
298
  getClaudeModelContextWindow,
297
299
  getDefaultAgentModel,
@@ -386,7 +388,7 @@ import {
386
388
  workspaceTokenRequestSchema,
387
389
  workspaceTokenResponseSchema,
388
390
  wrapInTag
389
- } from "./chunk-G6OGB6HX.js";
391
+ } from "./chunk-7LBCGK6Y.js";
390
392
  import {
391
393
  cloneMcpConfig,
392
394
  ensureCompatibilityImports,
@@ -11062,7 +11064,7 @@ function describeQuotaExhaustion(provider, reason, credential, fallback) {
11062
11064
  const agent = getProviderDisplayName(provider);
11063
11065
  const account = credential ? describeCredential(provider, credential) : "the credential this workspace is using";
11064
11066
  const limit = reason === "out_of_credits" ? `${agent} ran out of credits on ${account}.` : reason === "auth_failed" ? `${agent} could not authenticate with ${account}.` : `${agent} hit the usage limit on ${account}.`;
11065
- const next = fallback.outcome === "fork" ? `Forking this chat to ${getProviderDisplayName(fallback.target.provider, "long")}.` : QUOTA_STOP_NEXT_STEP[fallback.outcome];
11067
+ const next = fallback.outcome === "fork" ? `Continuing in ${getProviderDisplayName(fallback.target.provider, "long")}.` : QUOTA_STOP_NEXT_STEP[fallback.outcome];
11066
11068
  return `${limit} ${next}`;
11067
11069
  }
11068
11070
  var fallbackLocks = /* @__PURE__ */ new Map();
@@ -59659,6 +59661,7 @@ var ChatService = class {
59659
59661
  providerSessionId: null,
59660
59662
  parentChatId,
59661
59663
  fork: request.fork ?? null,
59664
+ ...request.displayName ? { displayName: request.displayName } : {},
59662
59665
  ...source ? {
59663
59666
  displayName: request.title?.trim() || void 0,
59664
59667
  model: source.persisted.provider === request.provider ? source.persisted.model : void 0,
@@ -59789,6 +59792,8 @@ var ChatService = class {
59789
59792
  const accepting2 = chat.acceptingSendResponses.get(idempotencyKey);
59790
59793
  if (accepting2) return accepting2;
59791
59794
  }
59795
+ const continuation = getChatContinuation(this.listChats(), chatId);
59796
+ if (continuation) return { ...await this.sendMessage(continuation.id, request), chatId: continuation.id };
59792
59797
  const previousAcceptance = chat.lastSendAcceptance;
59793
59798
  const accepting = (async () => {
59794
59799
  chat.acceptingMessages += 1;
@@ -60211,6 +60216,13 @@ var ChatService = class {
60211
60216
  target.persisted.updatedAt = restoredAt;
60212
60217
  await this.publish({ type: "chat.created", payload: { chat: this.toSummary(target) } });
60213
60218
  }
60219
+ for (let fork = chat.persisted.fork; fork?.trigger === "auto"; ) {
60220
+ const source = this.chats.get(fork.source.chatId);
60221
+ if (!source?.persisted.deletedAt || source.persisted.updatedAt > fork.startedAt) break;
60222
+ source.persisted.deletedAt = null;
60223
+ await this.publish({ type: "chat.created", payload: { chat: this.toSummary(source) } });
60224
+ fork = source.persisted.fork;
60225
+ }
60214
60226
  await this.persistAllChats();
60215
60227
  return this.toSummary(chat);
60216
60228
  }
@@ -60252,10 +60264,14 @@ var ChatService = class {
60252
60264
  if (trigger === "manual" && !isAgentAvailable(request.provider)) {
60253
60265
  throw new ChatProviderUnavailableError(request.provider);
60254
60266
  }
60267
+ const sourceName = source.persisted.displayName ?? source.persisted.title;
60255
60268
  return this.createChat({
60256
60269
  id: request.id,
60257
60270
  provider: request.provider,
60258
60271
  title: request.title?.trim() || defaultForkChatTitle(source.persisted, request.provider),
60272
+ ...trigger === "auto" ? {
60273
+ displayName: sourceName === DEFAULT_CHAT_TITLES[source.persisted.provider] ? DEFAULT_CHAT_TITLES[request.provider] : sourceName
60274
+ } : {},
60259
60275
  clientRequestId: request.clientRequestId,
60260
60276
  fork: createForkInfo(source.persisted, trigger, (/* @__PURE__ */ new Date()).toISOString(), reason)
60261
60277
  });
@@ -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-ZKSO7G5X.js";
6
+ } from "./chunk-CNWTNVTV.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-G6OGB6HX.js";
12
+ } from "./chunk-7LBCGK6Y.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-G6OGB6HX.js";
12
+ } from "./chunk-7LBCGK6Y.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.1193",
3
+ "version": "0.1.1195",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",