replicas-engine 0.1.1276 → 0.1.1277

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-CQXHQFAC.js";
12
- import "./chunk-V5H4AKYX.js";
13
- import "./chunk-LKQHRWNH.js";
14
- import "./chunk-CFAC6DWV.js";
11
+ } from "./chunk-RFV64KYY.js";
12
+ import "./chunk-CMBVI5RY.js";
13
+ import "./chunk-DOIUIFTK.js";
14
+ import "./chunk-JXPRQY2T.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
- import "./chunk-XAAAOOWB.js";
16
+ import "./chunk-YQMNXI2D.js";
17
17
  import "./chunk-VEQXQN22.js";
18
18
  export {
19
19
  CODEX_ULTRAFAST_SERVICE_TIER,
@@ -4,7 +4,7 @@ const require = __createRequire(import.meta.url);
4
4
  import {
5
5
  SUBPROCESS_MAX_BUFFER,
6
6
  execFileAsync
7
- } from "./chunk-CFAC6DWV.js";
7
+ } from "./chunk-JXPRQY2T.js";
8
8
  import {
9
9
  isRecord as isRecord2
10
10
  } from "./chunk-UZSNFLDQ.js";
@@ -22,7 +22,7 @@ import {
22
22
  provisionedDeviceSchema,
23
23
  readReplicasRuntimeEnv,
24
24
  serializePosixEnvFile
25
- } from "./chunk-XAAAOOWB.js";
25
+ } from "./chunk-YQMNXI2D.js";
26
26
 
27
27
  // src/runtime-env-loader.ts
28
28
  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-CFAC6DWV.js";
6
+ } from "./chunk-JXPRQY2T.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-XAAAOOWB.js";
9
+ } from "./chunk-YQMNXI2D.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.1276";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1277";
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-XAAAOOWB.js";
6
+ } from "./chunk-YQMNXI2D.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-XAAAOOWB.js";
8
+ } from "./chunk-YQMNXI2D.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -10,15 +10,15 @@ import {
10
10
  resolveDiffBase,
11
11
  runGitCommand,
12
12
  setAgentCredentialSnapshot
13
- } from "./chunk-V5H4AKYX.js";
13
+ } from "./chunk-CMBVI5RY.js";
14
14
  import {
15
15
  AppServerProcess,
16
16
  buildCodexAgentEnv
17
- } from "./chunk-LKQHRWNH.js";
17
+ } from "./chunk-DOIUIFTK.js";
18
18
  import {
19
19
  SUBPROCESS_MAX_BUFFER,
20
20
  execFileAsync
21
- } from "./chunk-CFAC6DWV.js";
21
+ } from "./chunk-JXPRQY2T.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-XAAAOOWB.js";
58
+ } from "./chunk-YQMNXI2D.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-CGRUKNN4.js");
294
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-WNBX4TA5.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-CGRUKNN4.js");
316
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-WNBX4TA5.js");
317
317
  await restartCodexAspHostIfRunning2();
318
318
  }
319
319
  setAgentCredentialSnapshot("codex", data);
@@ -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-LKQHRWNH.js";
6
+ } from "./chunk-DOIUIFTK.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-XAAAOOWB.js";
16
+ } from "./chunk-YQMNXI2D.js";
17
17
 
18
18
  // src/managers/codex-asp/notification-dispatch.ts
19
19
  var TURN_STARTED_METHOD = "turn/started";
@@ -1451,6 +1451,7 @@ var CHAT_INTERRUPTED_EVENT_TYPE = "replicas-interrupted";
1451
1451
  var CHAT_MESSAGE_REJECTED_EVENT_TYPE = "replicas-message-rejected";
1452
1452
  var CHAT_TURN_LOST_EVENT_TYPE = "replicas-turn-lost";
1453
1453
  var CHAT_GOAL_EVENT_TYPE = "chat-goal";
1454
+ var CLAUDE_PEER_MESSAGE_EVENT_TYPE = "claude-peer-message";
1454
1455
  var AUTH_RETRY_STATUS_EVENT_TYPE = "auth-retry-status";
1455
1456
  var CURSOR_CONNECTION_STATUS_EVENT_TYPE = "cursor-connection-status";
1456
1457
  var AUTH_FALLBACK_EVENT_TYPE = "auth-fallback";
@@ -2213,6 +2214,12 @@ async function readSseStream(body, onEvent, shouldContinue = () => true, onChunk
2213
2214
  // ../shared/src/types.ts
2214
2215
  var ENGINE_SEND_MESSAGE_FAILED_ERROR = "Failed to send message";
2215
2216
 
2217
+ // ../shared/src/palette-search.ts
2218
+ var DAY_MS = 24 * 60 * 60 * 1e3;
2219
+ var RECENCY_HALF_LIFE_MS = 14 * DAY_MS;
2220
+ var SEARCH_OPEN_DEDUPE_MS = 10 * 60 * 1e3;
2221
+ var PICK_WINDOW_MS = 21 * DAY_MS;
2222
+
2216
2223
  // ../shared/src/auth-fallback.ts
2217
2224
  function describeCredential(provider2, credential) {
2218
2225
  const { ownerName, email, ordinal: ordinal2 } = credential.account ?? {};
@@ -5749,6 +5756,9 @@ function planItemsFromMessage(message2) {
5749
5756
  return [{ text: text3, status: status === "completed" || status === "in_progress" ? status : "pending" }];
5750
5757
  });
5751
5758
  }
5759
+ function peerChatName(message2) {
5760
+ return message2.chat ?? "another chat";
5761
+ }
5752
5762
  function todoItemStatus(item) {
5753
5763
  return item.itemStatus ?? (item.completed ? "completed" : "pending");
5754
5764
  }
@@ -5781,6 +5791,7 @@ ${operation.diff}` : ""}`).join("\n\n");
5781
5791
  if (message2.type === "harness_switch") return { kind: "error", title: describeHarnessSwitch(message2), summary: "", content: "" };
5782
5792
  if (message2.type === "interruption") return { kind: "error", title: "Agent stopped", summary: "", content: "" };
5783
5793
  if (message2.type === "capacity_retry") return { kind: "task", title: "Model at capacity", summary: `Retry ${message2.attempt} of ${message2.maxAttempts}`, content: "" };
5794
+ if (message2.type === "peer_message") return { kind: "task", title: `${message2.direction === "received" ? "Message from" : "Message to"} ${peerChatName(message2)}`, summary: "", content: message2.content };
5784
5795
  if (message2.type === "multitask_event") return { kind: "task", title: "Ship update", summary: message2.events.map((event) => `${event.agentName}: ${event.summary}`).join(" \xB7 "), content: "" };
5785
5796
  return { kind: "error", title: "Agent error", summary: "", content: message2.message };
5786
5797
  }
@@ -7475,6 +7486,8 @@ function parseClaudeEvents(events, parentToolUseId) {
7475
7486
  });
7476
7487
  const toolCallMap = /* @__PURE__ */ new Map();
7477
7488
  const taskMessageMap = /* @__PURE__ */ new Map();
7489
+ const peerNames = /* @__PURE__ */ new Map();
7490
+ const peerTimestamps = /* @__PURE__ */ new Map();
7478
7491
  const workflowAgentMessageMap = /* @__PURE__ */ new Map();
7479
7492
  const ambientTaskIds = /* @__PURE__ */ new Set();
7480
7493
  const partialIndexes = /* @__PURE__ */ new Map();
@@ -7572,6 +7585,22 @@ function parseClaudeEvents(events, parentToolUseId) {
7572
7585
  partialIndexes.set(payload.streamId, existing);
7573
7586
  return;
7574
7587
  }
7588
+ if (event.type === CLAUDE_PEER_MESSAGE_EVENT_TYPE) {
7589
+ const { name, from, body } = event.payload;
7590
+ if (typeof body !== "string") return;
7591
+ if (typeof name === "string" && typeof from === "string") peerNames.set(from, name);
7592
+ const sameTime = peerTimestamps.get(event.timestamp) ?? 0;
7593
+ peerTimestamps.set(event.timestamp, sameTime + 1);
7594
+ messages.push({
7595
+ id: `peer-${event.timestamp}-${sameTime}`,
7596
+ type: "peer_message",
7597
+ direction: "received",
7598
+ ...typeof name === "string" ? { chat: name } : {},
7599
+ content: body,
7600
+ timestamp: event.timestamp
7601
+ });
7602
+ return;
7603
+ }
7575
7604
  if (event.type === "claude-user") {
7576
7605
  const content = normalizeContentBlocks(event.payload.message?.content);
7577
7606
  const toolResult = content.find((c) => c.type === "tool_result");
@@ -7712,6 +7741,20 @@ function parseClaudeEvents(events, parentToolUseId) {
7712
7741
  timestamp: event.timestamp
7713
7742
  });
7714
7743
  }
7744
+ } else if (toolName === "SendMessage") {
7745
+ const parsed = typeof toolInput === "string" ? safeJsonParse(toolInput, {}) : toolInput;
7746
+ const input = isRecord(parsed) ? parsed : {};
7747
+ const to = typeof input.to === "string" ? input.to.replace(/\s+\[[0-9a-f]+\]$/, "") : "";
7748
+ const chat = peerNames.get(to) ?? (to.startsWith("uds:") ? void 0 : to || void 0);
7749
+ messages.push({
7750
+ id: `peer-${toolUseId}`,
7751
+ type: "peer_message",
7752
+ direction: "sent",
7753
+ ...chat ? { chat } : {},
7754
+ content: typeof input.message === "string" ? input.message : "",
7755
+ status: "in_progress",
7756
+ timestamp: event.timestamp
7757
+ });
7715
7758
  } else if (toolName === "WebSearch") {
7716
7759
  const inputObj = typeof toolInput === "string" ? safeJsonParse(toolInput, {}) : toolInput;
7717
7760
  const query = inputObj.query || "";
@@ -7882,6 +7925,9 @@ function parseClaudeEvents(events, parentToolUseId) {
7882
7925
  message2.status = status;
7883
7926
  } else if (message2.type === "web_search") {
7884
7927
  message2.status = status;
7928
+ } else if (message2.type === "peer_message") {
7929
+ const result2 = safeJsonParse(resultContent, {});
7930
+ message2.status = isError || isRecord(result2) && result2.success === false ? "failed" : "completed";
7885
7931
  } else if (message2.type === "tool_call") {
7886
7932
  message2.output = resultContent;
7887
7933
  message2.outputOmitted = outputOmitted;
@@ -10087,6 +10133,7 @@ var WORKSPACE_SECTION_ORDER_CLIENT_STATE_KEY_PREFIX = "replicas-workspace-sectio
10087
10133
  var WORKSPACE_STAGES_CLIENT_STATE_KEY_PREFIX = "replicas-workspace-stages-";
10088
10134
  var WORKSPACE_MARKED_UNREAD_CLIENT_STATE_KEY_PREFIX = "replicas-workspace-marked-unread-";
10089
10135
  var PROMPT_HISTORY_CLIENT_STATE_KEY_PREFIX = "replicas-prompt-history-";
10136
+ var WORKSPACE_SEARCH_OPENS_CLIENT_STATE_KEY_PREFIX = "replicas-workspace-search-opens-";
10090
10137
  var orgUserClientStateKey = (prefix) => (organizationId, userId) => `${prefix}${organizationId}-${userId}`;
10091
10138
  var workspaceLastViewedAtClientStateKey = orgUserClientStateKey(WORKSPACE_LAST_VIEWED_AT_CLIENT_STATE_KEY_PREFIX);
10092
10139
  var workspaceAttentionDoneClientStateKey = orgUserClientStateKey(WORKSPACE_ATTENTION_DONE_CLIENT_STATE_KEY_PREFIX);
@@ -10094,6 +10141,7 @@ var workspaceStagesClientStateKey = orgUserClientStateKey(WORKSPACE_STAGES_CLIEN
10094
10141
  var workspaceSectionOrderClientStateKey = orgUserClientStateKey(WORKSPACE_SECTION_ORDER_CLIENT_STATE_KEY_PREFIX);
10095
10142
  var workspaceMarkedUnreadClientStateKey = orgUserClientStateKey(WORKSPACE_MARKED_UNREAD_CLIENT_STATE_KEY_PREFIX);
10096
10143
  var promptHistoryClientStateKey = orgUserClientStateKey(PROMPT_HISTORY_CLIENT_STATE_KEY_PREFIX);
10144
+ var workspaceSearchOpensClientStateKey = orgUserClientStateKey(WORKSPACE_SEARCH_OPENS_CLIENT_STATE_KEY_PREFIX);
10097
10145
 
10098
10146
  // ../shared/src/routes/workspace-events.ts
10099
10147
  import { z as z24 } from "zod";
@@ -10551,6 +10599,7 @@ export {
10551
10599
  CHAT_INTERRUPTED_EVENT_TYPE,
10552
10600
  CHAT_TURN_LOST_EVENT_TYPE,
10553
10601
  CHAT_GOAL_EVENT_TYPE,
10602
+ CLAUDE_PEER_MESSAGE_EVENT_TYPE,
10554
10603
  AUTH_RETRY_STATUS_EVENT_TYPE,
10555
10604
  CURSOR_CONNECTION_STATUS_EVENT_TYPE,
10556
10605
  AUTH_FALLBACK_EVENT_TYPE,
@@ -5,14 +5,14 @@ import {
5
5
  getOriginDefaultBranch,
6
6
  monolithRequest,
7
7
  runGitCommand
8
- } from "./chunk-V5H4AKYX.js";
8
+ } from "./chunk-CMBVI5RY.js";
9
9
  import {
10
10
  extractCommandProtectionCommandText,
11
11
  findCommandProtectionGitLookups,
12
12
  findGitCommitSignals,
13
13
  findPrMergeSignals,
14
14
  parseCommandProtectionRequest
15
- } from "./chunk-XAAAOOWB.js";
15
+ } from "./chunk-YQMNXI2D.js";
16
16
 
17
17
  // src/services/command-protection-service.ts
18
18
  import { readFile, stat } from "fs/promises";
@@ -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-FILX4PF6.js";
7
- import "./chunk-V5H4AKYX.js";
8
- import "./chunk-CFAC6DWV.js";
6
+ } from "./chunk-ZWLSWMXF.js";
7
+ import "./chunk-CMBVI5RY.js";
8
+ import "./chunk-JXPRQY2T.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-XAAAOOWB.js";
12
+ import "./chunk-YQMNXI2D.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-CQR2T35P.js";
16
+ } from "./chunk-SBWWSTV3.js";
17
17
  import {
18
18
  AppServerProcess,
19
19
  buildCodexAgentEnv
20
- } from "./chunk-LKQHRWNH.js";
21
- import "./chunk-CFAC6DWV.js";
20
+ } from "./chunk-DOIUIFTK.js";
21
+ import "./chunk-JXPRQY2T.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-XAAAOOWB.js";
31
+ } from "./chunk-YQMNXI2D.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-FILX4PF6.js";
30
+ } from "./chunk-ZWLSWMXF.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-CQR2T35P.js";
67
+ } from "./chunk-SBWWSTV3.js";
68
68
  import {
69
69
  publishedPullRequestUrls
70
- } from "./chunk-3HGIRXMN.js";
70
+ } from "./chunk-QGEYP7R5.js";
71
71
  import {
72
72
  ACCOUNT_RATE_LIMITS_READ_METHOD,
73
73
  AsyncLock,
@@ -140,7 +140,7 @@ import {
140
140
  timestampFromSeconds,
141
141
  upsertCredentialFileLines,
142
142
  writeSecureCredentialFile
143
- } from "./chunk-CQXHQFAC.js";
143
+ } from "./chunk-RFV64KYY.js";
144
144
  import {
145
145
  ENGINE_ENV,
146
146
  monolithRequest,
@@ -150,15 +150,15 @@ import {
150
150
  resolveDiffBase,
151
151
  setAgentCredentialSnapshot,
152
152
  setLinearSessionId
153
- } from "./chunk-V5H4AKYX.js";
153
+ } from "./chunk-CMBVI5RY.js";
154
154
  import {
155
155
  getCodexModelProvider
156
- } from "./chunk-LKQHRWNH.js";
156
+ } from "./chunk-DOIUIFTK.js";
157
157
  import {
158
158
  SUBPROCESS_MAX_BUFFER,
159
159
  execAsync,
160
160
  execFileAsync
161
- } from "./chunk-CFAC6DWV.js";
161
+ } from "./chunk-JXPRQY2T.js";
162
162
  import {
163
163
  isRecord as isRecord2
164
164
  } from "./chunk-UZSNFLDQ.js";
@@ -184,6 +184,7 @@ import {
184
184
  CLAUDE_HAIKU_4_5_BEDROCK_MODEL,
185
185
  CLAUDE_OPUS_4_8_BEDROCK_MODEL,
186
186
  CLAUDE_PARTIAL_MESSAGE_EVENT_TYPE,
187
+ CLAUDE_PEER_MESSAGE_EVENT_TYPE,
187
188
  CLAUDE_SONNET_5_BEDROCK_MODEL,
188
189
  CODEX_ASP_ITEM_ID_PAYLOAD_KEY,
189
190
  CODEX_HISTORY_FORMAT_EVENT_TYPE,
@@ -402,7 +403,7 @@ import {
402
403
  workspaceTokenRequestSchema,
403
404
  workspaceTokenResponseSchema,
404
405
  wrapInTag
405
- } from "./chunk-XAAAOOWB.js";
406
+ } from "./chunk-YQMNXI2D.js";
406
407
  import {
407
408
  cloneMcpConfig,
408
409
  ensureCompatibilityImports,
@@ -11610,6 +11611,7 @@ var CodingAgentManager = class {
11610
11611
  topLevel;
11611
11612
  chatId;
11612
11613
  originChatId;
11614
+ chatTitle;
11613
11615
  hostOnTurnComplete;
11614
11616
  onProcessingChanged;
11615
11617
  onMessageStarted;
@@ -11642,6 +11644,7 @@ var CodingAgentManager = class {
11642
11644
  this.topLevel = options.parentChatId === null;
11643
11645
  this.chatId = options.chatId;
11644
11646
  this.originChatId = options.originChatId;
11647
+ this.chatTitle = options.chatTitle;
11645
11648
  this.hostOnTurnComplete = options.onTurnComplete;
11646
11649
  this.onProcessingChanged = options.onProcessingChanged ?? (() => {
11647
11650
  });
@@ -12720,8 +12723,10 @@ var PromptStream = class {
12720
12723
  queue = [];
12721
12724
  closed = false;
12722
12725
  waiters = [];
12726
+ sentUuids = /* @__PURE__ */ new Set();
12723
12727
  push(message) {
12724
12728
  if (this.closed) return;
12729
+ if (message.uuid) this.sentUuids.add(message.uuid);
12725
12730
  const waiter = this.waiters.shift();
12726
12731
  if (waiter) {
12727
12732
  waiter({ value: message, done: false });
@@ -13048,6 +13053,32 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
13048
13053
  this.pendingTurn?.steers.delete(uuid);
13049
13054
  if (this.markSteerRead(steer.messageId)) await this.recordEvent(steer.userMessage, steer.messageId);
13050
13055
  }
13056
+ // Claude Code starts a command for another chat's SendMessage without streaming its text, and can start it a moment before writing it.
13057
+ async recordPeerMessage(uuid, query2) {
13058
+ for (const delayMs of [0, 100, 300, 600, 1e3]) {
13059
+ if (delayMs) await new Promise((resolve7) => setTimeout(resolve7, delayMs));
13060
+ if (this.activeQuery !== query2 || !this.sessionId) return;
13061
+ const entry = (await getSessionMessages(this.sessionId, { dir: this.workingDirectory })).findLast((message) => message.uuid === uuid);
13062
+ if (!entry) continue;
13063
+ const origin = "origin" in entry && isRecord(entry.origin) ? entry.origin : null;
13064
+ if (origin?.kind !== "peer" || origin.senderTaskId) return;
13065
+ const text = extractToolResultText(isRecord(entry.message) ? entry.message.content : void 0);
13066
+ const envelopes = [...text.matchAll(/<cross-session-message\b([^>]*)>\n?([\s\S]*?)\n?<\/cross-session-message>/g)].map(([, attributes, body]) => ({
13067
+ name: /\bfrom-name="([^"]*)"/.exec(attributes)?.[1],
13068
+ from: /\bfrom="([^"]*)"/.exec(attributes)?.[1],
13069
+ body
13070
+ }));
13071
+ const messages = envelopes.length > 0 ? envelopes : typeof origin.body === "string" ? [{ name: typeof origin.name === "string" ? origin.name : void 0, from: typeof origin.from === "string" ? origin.from : void 0, body: origin.body }] : [];
13072
+ for (const { name, from, body } of messages) {
13073
+ this.recordHistoryEvent(CLAUDE_PEER_MESSAGE_EVENT_TYPE, {
13074
+ ...name ? { name } : {},
13075
+ ...from ? { from } : {},
13076
+ body
13077
+ }, this.historyFile);
13078
+ }
13079
+ return;
13080
+ }
13081
+ }
13051
13082
  async abortAllPendingToolInputs() {
13052
13083
  const pending = Array.from(this.pendingToolInputs.values());
13053
13084
  this.pendingToolInputs.clear();
@@ -13717,8 +13748,11 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
13717
13748
  } : {}
13718
13749
  },
13719
13750
  model: claudeCodeModel,
13751
+ ...this.chatTitle ? { title: this.chatTitle() } : {},
13720
13752
  settings: {
13721
13753
  fastMode: signature.fastMode,
13754
+ // Every session in the sandbox is one of the user's chats; the default holds messages across permission modes, and a plan mode chat has no one to release them.
13755
+ crossSessionInbound: "accept",
13722
13756
  ...signature.autoCompactTokens ? { autoCompactWindow: signature.autoCompactTokens } : {},
13723
13757
  ...ultracode ? { enableWorkflows: true, ultracode: true } : {}
13724
13758
  },
@@ -13809,6 +13843,8 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
13809
13843
  const lifecycle2 = msg;
13810
13844
  if (isRecord(lifecycle2) && lifecycle2.type === "command_lifecycle" && lifecycle2.state === "started" && typeof lifecycle2.command_uuid === "string") {
13811
13845
  if (this.pendingTurn?.userMessageUuids.has(lifecycle2.command_uuid)) this.turnPromptRecorded = true;
13846
+ else if (!this.activePromptStream?.sentUuids.has(lifecycle2.command_uuid)) await this.recordPeerMessage(lifecycle2.command_uuid, response);
13847
+ if (this.activeQuery !== response) break;
13812
13848
  await this.recordSteerRead(lifecycle2.command_uuid);
13813
13849
  }
13814
13850
  if (this.pendingTurn && _ClaudeManager.isTurnActivity(msg)) {
@@ -61142,6 +61178,7 @@ ${note}`;
61142
61178
  fallbackContext,
61143
61179
  chatId: persisted.id,
61144
61180
  originChatId,
61181
+ chatTitle: () => persisted.title,
61145
61182
  onModelSwitched,
61146
61183
  onChatCredential,
61147
61184
  lastSenderKey: persisted.lastSenderKey,
@@ -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-3HGIRXMN.js";
6
+ } from "./chunk-QGEYP7R5.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-XAAAOOWB.js";
12
+ } from "./chunk-YQMNXI2D.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-XAAAOOWB.js";
14
+ } from "./chunk-YQMNXI2D.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.1276",
3
+ "version": "0.1.1277",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",