replicas-engine 0.1.984 → 0.1.986

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-CFU5LLPN.js";
9
- import "./chunk-VNL2VYM4.js";
10
- import "./chunk-FJ3GZPXB.js";
11
- import "./chunk-QVK2OVNX.js";
8
+ } from "./chunk-O2ZKAC2G.js";
9
+ import "./chunk-Z3D5SVUI.js";
10
+ import "./chunk-SAJ6ERGR.js";
11
+ import "./chunk-4WBOMDAN.js";
12
12
  import "./chunk-UZSNFLDQ.js";
13
- import "./chunk-LKTX2CHU.js";
13
+ import "./chunk-IIANP4GI.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-LKTX2CHU.js";
6
+ } from "./chunk-IIANP4GI.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-VNL2VYM4.js";
6
+ } from "./chunk-Z3D5SVUI.js";
7
7
  import {
8
8
  SUBPROCESS_MAX_BUFFER,
9
9
  execFileAsync
10
- } from "./chunk-QVK2OVNX.js";
10
+ } from "./chunk-4WBOMDAN.js";
11
11
  import {
12
12
  extractCommandProtectionCommandText,
13
13
  findCommandProtectionGitLookups,
14
14
  findGitCommitSignals,
15
15
  findPrMergeSignals,
16
16
  parseCommandProtectionRequest
17
- } from "./chunk-LKTX2CHU.js";
17
+ } from "./chunk-IIANP4GI.js";
18
18
 
19
19
  // src/services/command-protection-service.ts
20
20
  import { readFile, stat } from "fs/promises";
@@ -1083,7 +1083,6 @@ function getEventStreamId(event) {
1083
1083
  return null;
1084
1084
  }
1085
1085
  var CODEX_QUOTA_STATUS_EVENT_TYPE = "codex-quota-status";
1086
- var COMPACTION_STATUS_EVENT_TYPE = "compaction-status";
1087
1086
  var CHAT_INTERRUPTED_EVENT_TYPE = "replicas-interrupted";
1088
1087
  var CHAT_GOAL_EVENT_TYPE = "chat-goal";
1089
1088
  var AUTH_RETRY_STATUS_EVENT_TYPE = "auth-retry-status";
@@ -1322,6 +1321,7 @@ var CODEX_ITEM_FIELD_CHECKS = {
1322
1321
  function isCodexAspTranscriptItem(value) {
1323
1322
  if (!isRecord(value) || typeof value.id !== "string" || typeof value.timestamp !== "string") return false;
1324
1323
  if (value.sequence !== void 0 && typeof value.sequence !== "number") return false;
1324
+ if (value.completedAt !== void 0 && typeof value.completedAt !== "string") return false;
1325
1325
  if (typeof value.type !== "string" || !Object.hasOwn(CODEX_ITEM_FIELD_CHECKS, value.type)) return false;
1326
1326
  return CODEX_ITEM_FIELD_CHECKS[value.type](value);
1327
1327
  }
@@ -2046,6 +2046,7 @@ function normalizeBackgroundTaskStatus(status) {
2046
2046
 
2047
2047
  // ../shared/src/display-message/constants.ts
2048
2048
  var USER_MESSAGE_MATCH_GRACE_PERIOD_MS = 3e4;
2049
+ var COMPACTION_CONTENT = "Context compacted";
2049
2050
 
2050
2051
  // ../shared/src/shell-commands.ts
2051
2052
  var SHELL_OPAQUE = "\0";
@@ -2554,6 +2555,15 @@ function skillNamesFromCommand(command) {
2554
2555
  })));
2555
2556
  }
2556
2557
 
2558
+ // ../shared/src/user-message-matching.ts
2559
+ function parseTimestampMs(timestamp) {
2560
+ const value = typeof timestamp === "number" ? timestamp : Date.parse(timestamp);
2561
+ return Number.isFinite(value) ? value : 0;
2562
+ }
2563
+ function areUserMessagesWithinMatchWindow(a, b) {
2564
+ return a.content === b.content && Math.abs(parseTimestampMs(a.timestamp) - parseTimestampMs(b.timestamp)) <= USER_MESSAGE_MATCH_GRACE_PERIOD_MS;
2565
+ }
2566
+
2557
2567
  // ../shared/src/urls.ts
2558
2568
  var DASHBOARD_PATH = "/dashboard";
2559
2569
  var WEB_APP_PATHS = {
@@ -4911,15 +4921,6 @@ function stripAttachmentNote(text2) {
4911
4921
  };
4912
4922
  }
4913
4923
 
4914
- // ../shared/src/user-message-matching.ts
4915
- function parseTimestampMs(timestamp) {
4916
- const value = typeof timestamp === "number" ? timestamp : Date.parse(timestamp);
4917
- return Number.isFinite(value) ? value : 0;
4918
- }
4919
- function areUserMessagesWithinMatchWindow(a, b) {
4920
- return a.content === b.content && Math.abs(parseTimestampMs(a.timestamp) - parseTimestampMs(b.timestamp)) <= USER_MESSAGE_MATCH_GRACE_PERIOD_MS;
4921
- }
4922
-
4923
4924
  // ../shared/src/display-message/parsers/codex-asp-parser.ts
4924
4925
  function collectCodexTurns(events) {
4925
4926
  const turns = /* @__PURE__ */ new Map();
@@ -5092,9 +5093,10 @@ function messageForItem(item) {
5092
5093
  return {
5093
5094
  id: `reasoning-${item.id}`,
5094
5095
  type: "reasoning",
5095
- content: "Context compacted",
5096
+ content: COMPACTION_CONTENT,
5096
5097
  status: normalizeCodexAspTranscriptStatus(item.status),
5097
- timestamp: item.timestamp
5098
+ timestamp: item.timestamp,
5099
+ completedAt: item.completedAt
5098
5100
  };
5099
5101
  }
5100
5102
  return {
@@ -5919,6 +5921,15 @@ function parseMuseEvents(events) {
5919
5921
  status: terminal ? "completed" : "in_progress",
5920
5922
  timestamp: typeof item.recordedAt === "string" ? item.recordedAt : event.timestamp
5921
5923
  });
5924
+ } else if (item.kind === "compaction") {
5925
+ upsertDisplayMessage(messages, {
5926
+ id: `muse-compaction-${item.itemId}`,
5927
+ type: "reasoning",
5928
+ content: COMPACTION_CONTENT,
5929
+ status: item.status === "failed" ? "failed" : terminal ? "completed" : "in_progress",
5930
+ timestamp: typeof item.recordedAt === "string" ? item.recordedAt : event.timestamp,
5931
+ completedAt: terminal ? event.timestamp : void 0
5932
+ });
5922
5933
  } else if (item.kind === "toolCall") {
5923
5934
  let input = item.args;
5924
5935
  if (typeof item.args === "string") {
@@ -6252,6 +6263,7 @@ function parseClaudeEvents(events, parentToolUseId) {
6252
6263
  const completedStreamIds = /* @__PURE__ */ new Set();
6253
6264
  const supersededStreamIds = /* @__PURE__ */ new Set();
6254
6265
  let liveStreamId = null;
6266
+ let compaction;
6255
6267
  const assistantThinking = /* @__PURE__ */ new Map();
6256
6268
  const assistantTextCounts = /* @__PURE__ */ new Map();
6257
6269
  const acceptedUserMessageIndexes = /* @__PURE__ */ new Set();
@@ -6544,6 +6556,11 @@ function parseClaudeEvents(events, parentToolUseId) {
6544
6556
  }
6545
6557
  });
6546
6558
  }
6559
+ if (compaction && (event.type === "claude-result" || event.type === CHAT_INTERRUPTED_EVENT_TYPE)) {
6560
+ compaction.status = "failed";
6561
+ compaction.completedAt = event.timestamp;
6562
+ compaction = void 0;
6563
+ }
6547
6564
  if (event.type === "claude-result") {
6548
6565
  const payload = coerceClaudeResultPayload(event.payload);
6549
6566
  if (isClaudeResultError(payload)) {
@@ -6557,6 +6574,19 @@ function parseClaudeEvents(events, parentToolUseId) {
6557
6574
  }
6558
6575
  }
6559
6576
  if (event.type === "claude-system") {
6577
+ const { subtype, status, compact_result: compactResult } = event.payload;
6578
+ const compactionEnded = subtype === "compact_boundary" || compactResult === "failed";
6579
+ if (compactionEnded || subtype === "status" && status === "compacting") {
6580
+ if (!compaction) {
6581
+ compaction = { id: `compaction-${event.timestamp}`, type: "reasoning", content: COMPACTION_CONTENT, timestamp: event.timestamp };
6582
+ messages.push(compaction);
6583
+ }
6584
+ compaction.status = !compactionEnded ? "in_progress" : compactResult === "failed" ? "failed" : "completed";
6585
+ if (compactionEnded) {
6586
+ compaction.completedAt = event.timestamp;
6587
+ compaction = void 0;
6588
+ }
6589
+ }
6560
6590
  const payload = coerceBackgroundTaskPayload(event.payload);
6561
6591
  if (payload?.ambient) ambientTaskIds.add(payload.taskId);
6562
6592
  if (payload && !ambientTaskIds.has(payload.taskId)) {
@@ -9093,7 +9123,6 @@ export {
9093
9123
  CODEX_HISTORY_FORMAT_EVENT_TYPE,
9094
9124
  getEventStreamId,
9095
9125
  CODEX_QUOTA_STATUS_EVENT_TYPE,
9096
- COMPACTION_STATUS_EVENT_TYPE,
9097
9126
  CHAT_INTERRUPTED_EVENT_TYPE,
9098
9127
  CHAT_GOAL_EVENT_TYPE,
9099
9128
  AUTH_RETRY_STATUS_EVENT_TYPE,
@@ -9131,6 +9160,7 @@ export {
9131
9160
  paginateChatHistory,
9132
9161
  coerceBackgroundTaskPayload,
9133
9162
  fileContentDiff,
9163
+ areUserMessagesWithinMatchWindow,
9134
9164
  isGitHubUrl,
9135
9165
  parseCodeHostPrUrl,
9136
9166
  decodePathSegments,
@@ -9138,7 +9168,6 @@ export {
9138
9168
  createUuidFromHex,
9139
9169
  HISTORY_ROOT,
9140
9170
  HISTORY_INDEX_FILENAME,
9141
- areUserMessagesWithinMatchWindow,
9142
9171
  extractErrorText,
9143
9172
  isTransientErrorText,
9144
9173
  extractToolResultText,
@@ -5,15 +5,15 @@ import {
5
5
  ENGINE_ENV,
6
6
  monolithRequest,
7
7
  setAgentCredentialSnapshot
8
- } from "./chunk-VNL2VYM4.js";
8
+ } from "./chunk-Z3D5SVUI.js";
9
9
  import {
10
10
  AppServerProcess,
11
11
  buildCodexAgentEnv
12
- } from "./chunk-FJ3GZPXB.js";
12
+ } from "./chunk-SAJ6ERGR.js";
13
13
  import {
14
14
  SUBPROCESS_MAX_BUFFER,
15
15
  execFileAsync
16
- } from "./chunk-QVK2OVNX.js";
16
+ } from "./chunk-4WBOMDAN.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-LKTX2CHU.js";
30
+ } from "./chunk-IIANP4GI.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-PNOZD26A.js");
263
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-Q474L67V.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-PNOZD26A.js");
283
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-Q474L67V.js");
284
284
  await restartCodexAspHostIfRunning2();
285
285
  }
286
286
  setAgentCredentialSnapshot("codex", data);
@@ -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-QVK2OVNX.js";
6
+ } from "./chunk-4WBOMDAN.js";
7
7
  import {
8
8
  isVersionBelow
9
- } from "./chunk-LKTX2CHU.js";
9
+ } from "./chunk-IIANP4GI.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.984";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.986";
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-LKTX2CHU.js";
8
+ } from "./chunk-IIANP4GI.js";
9
9
 
10
10
  // src/services/published-pull-request-urls.ts
11
11
  function publishedPullRequestUrls(result) {
@@ -14,7 +14,7 @@ import {
14
14
  isValidAgentProvider,
15
15
  parsePosixEnvFile,
16
16
  readReplicasRuntimeEnv
17
- } from "./chunk-LKTX2CHU.js";
17
+ } from "./chunk-IIANP4GI.js";
18
18
 
19
19
  // src/runtime-env-loader.ts
20
20
  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-6ZHOSG2F.js";
7
- import "./chunk-VNL2VYM4.js";
8
- import "./chunk-QVK2OVNX.js";
6
+ } from "./chunk-B2JQRHF4.js";
7
+ import "./chunk-Z3D5SVUI.js";
8
+ import "./chunk-4WBOMDAN.js";
9
9
  import {
10
10
  isRecord
11
11
  } from "./chunk-UZSNFLDQ.js";
12
- import "./chunk-LKTX2CHU.js";
12
+ import "./chunk-IIANP4GI.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-FJ3GZPXB.js";
11
- import "./chunk-QVK2OVNX.js";
10
+ } from "./chunk-SAJ6ERGR.js";
11
+ import "./chunk-4WBOMDAN.js";
12
12
  import {
13
13
  AGENT,
14
14
  headlessAgentRequestSchema
15
- } from "./chunk-LKTX2CHU.js";
15
+ } from "./chunk-IIANP4GI.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-6ZHOSG2F.js";
35
+ } from "./chunk-B2JQRHF4.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-MWCBGGWF.js";
60
+ } from "./chunk-YQE57AE6.js";
61
61
  import {
62
62
  BaseRefreshManager,
63
63
  CodexAspAuthMethodChangedError,
@@ -72,7 +72,7 @@ import {
72
72
  refreshDelayMs,
73
73
  restartCodexAspHost,
74
74
  routineRefreshExclusions
75
- } from "./chunk-CFU5LLPN.js";
75
+ } from "./chunk-O2ZKAC2G.js";
76
76
  import {
77
77
  ENGINE_ENV,
78
78
  monolithRequest,
@@ -80,16 +80,16 @@ import {
80
80
  readRuntimeEnvFile,
81
81
  reloadEngineEnv,
82
82
  setAgentCredentialSnapshot
83
- } from "./chunk-VNL2VYM4.js";
83
+ } from "./chunk-Z3D5SVUI.js";
84
84
  import {
85
85
  AspClient,
86
86
  getCodexModelProvider
87
- } from "./chunk-FJ3GZPXB.js";
87
+ } from "./chunk-SAJ6ERGR.js";
88
88
  import {
89
89
  SUBPROCESS_MAX_BUFFER,
90
90
  execAsync,
91
91
  execFileAsync
92
- } from "./chunk-QVK2OVNX.js";
92
+ } from "./chunk-4WBOMDAN.js";
93
93
  import {
94
94
  isRecord as isRecord2
95
95
  } from "./chunk-UZSNFLDQ.js";
@@ -119,7 +119,6 @@ import {
119
119
  CODEX_HISTORY_FORMAT_EVENT_TYPE,
120
120
  CODEX_ITEM_EVENT_TYPE,
121
121
  CODEX_QUOTA_STATUS_EVENT_TYPE,
122
- COMPACTION_STATUS_EVENT_TYPE,
123
122
  CONTEXT_USAGE_EVENT_TYPE,
124
123
  CREDENTIAL_METHOD,
125
124
  CURSOR_CONNECTION_STATUS_EVENT_TYPE,
@@ -316,7 +315,7 @@ import {
316
315
  workspaceCredentialProviderSchema,
317
316
  workspaceTokenRequestSchema,
318
317
  workspaceTokenResponseSchema
319
- } from "./chunk-LKTX2CHU.js";
318
+ } from "./chunk-IIANP4GI.js";
320
319
  import {
321
320
  cloneMcpConfig,
322
321
  ensureCompatibilityImports,
@@ -11985,14 +11984,13 @@ var CodingAgentManager = class {
11985
11984
  onUsageUpdate;
11986
11985
  linearSessionId;
11987
11986
  chatId;
11988
- hostOnTurnComplete;
11987
+ onTurnComplete;
11989
11988
  onProcessingChanged;
11990
11989
  onMessageStarted;
11991
11990
  onModelSwitched;
11992
11991
  authFallback;
11993
11992
  subagentMcpChatId;
11994
11993
  subagentMcpEnabledForTurn = false;
11995
- compacting = false;
11996
11994
  constructor(options) {
11997
11995
  this.workingDirectory = options.workingDirectory ?? ENGINE_ENV.WORKSPACE_ROOT;
11998
11996
  this.initialSessionId = options.initialSessionId;
@@ -12003,7 +12001,7 @@ var CodingAgentManager = class {
12003
12001
  this.subagentMcpChatId = options.parentChatId === null && options.provider && SUBAGENT_MCP_HARNESSES.includes(options.provider) ? options.chatId : void 0;
12004
12002
  this.linearSessionId = options.linearSessionId;
12005
12003
  this.chatId = options.chatId;
12006
- this.hostOnTurnComplete = options.onTurnComplete;
12004
+ this.onTurnComplete = options.onTurnComplete;
12007
12005
  this.onProcessingChanged = options.onProcessingChanged ?? (() => {
12008
12006
  });
12009
12007
  this.onMessageStarted = options.onMessageStarted ?? (async () => {
@@ -12021,23 +12019,6 @@ var CodingAgentManager = class {
12021
12019
  if (result.outcome === "switched" && result.model) await this.onModelSwitched(result.model);
12022
12020
  return result;
12023
12021
  }
12024
- onTurnComplete = async () => {
12025
- if (this.compacting) {
12026
- this.setCompacting(false);
12027
- }
12028
- await this.hostOnTurnComplete();
12029
- };
12030
- isCompacting() {
12031
- return this.compacting;
12032
- }
12033
- // Dedup so a noisy stream of native compaction events doesn't spam the UI with redundant status flips.
12034
- setCompacting(active) {
12035
- if (this.compacting === active) return;
12036
- this.compacting = active;
12037
- this.emitSyntheticEvent(COMPACTION_STATUS_EVENT_TYPE, {
12038
- state: active ? "in_progress" : "completed"
12039
- });
12040
- }
12041
12022
  emitSyntheticEvent(type, payload) {
12042
12023
  this.onEvent({
12043
12024
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -14579,7 +14560,6 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
14579
14560
  console.error("[ClaudeManager] Failed to record published PR:", error);
14580
14561
  });
14581
14562
  }
14582
- this.trackNativeCompaction(message);
14583
14563
  if (message.type === "system" && message.subtype === "task_started" && message.ambient) {
14584
14564
  this.ambientTaskIds.add(message.task_id);
14585
14565
  }
@@ -14609,17 +14589,6 @@ var ClaudeManager = class _ClaudeManager extends CodingAgentManager {
14609
14589
  this.recordGoalChange(null);
14610
14590
  }
14611
14591
  }
14612
- // Claude Code intercepts /compact and auto-compaction inside the SDK process; we just observe the status messages to mirror state to the UI.
14613
- trackNativeCompaction(message) {
14614
- if (message.type !== "system") return;
14615
- if (message.subtype === "status" && message.status === "compacting") {
14616
- this.setCompacting(true);
14617
- return;
14618
- }
14619
- if (message.subtype === "compact_boundary") {
14620
- this.setCompacting(false);
14621
- }
14622
- }
14623
14592
  async recordEvent(event, replicasMessageId) {
14624
14593
  const timestamp = (/* @__PURE__ */ new Date()).toISOString();
14625
14594
  const restampAmbient = event.type === "system" && "task_id" in event && this.ambientTaskIds.has(event.task_id);
@@ -15300,6 +15269,7 @@ var CodexAspManager = class extends CodingAgentManager {
15300
15269
  slashCommandsCache = null;
15301
15270
  slashCommandsRequest = null;
15302
15271
  steeredTempImagePaths = [];
15272
+ compacting = false;
15303
15273
  steerLock = new AsyncLock();
15304
15274
  onCodexTurnStarted;
15305
15275
  onCodexTokenUsage;
@@ -15392,7 +15362,7 @@ var CodexAspManager = class extends CodingAgentManager {
15392
15362
  const threadId = this.currentThreadId;
15393
15363
  const expectedTurnId = this.activeTurnId;
15394
15364
  if (!threadId || !expectedTurnId || !this.messageQueue.isProcessing()) return false;
15395
- if (this.isCompacting()) return false;
15365
+ if (this.compacting) return false;
15396
15366
  if (getGoalCommand(request.message, request.goalMode) || isCompactCommand(request.message)) return false;
15397
15367
  const { input, tempImagePaths } = await buildTurnInput(request);
15398
15368
  const result = await this.requestActiveTurnWithReconciliation(
@@ -15612,6 +15582,7 @@ var CodexAspManager = class extends CodingAgentManager {
15612
15582
  this.itemUpdateCoalescer.flushPending();
15613
15583
  this.itemUpdateCoalescer.dispose();
15614
15584
  this.activeTurnId = null;
15585
+ this.compacting = false;
15615
15586
  await removeTempImageFiles(this.steeredTempImagePaths.splice(0));
15616
15587
  await this.historyFile?.flush();
15617
15588
  await this.onTurnComplete();
@@ -15861,7 +15832,7 @@ ${text.slice(-24e3)}`
15861
15832
  },
15862
15833
  [THREAD_COMPACTED_METHOD]: (notification) => {
15863
15834
  if (!matchesTurn(notification.params.threadId, notification.params.turnId)) return;
15864
- this.setCompacting(false);
15835
+ this.compacting = false;
15865
15836
  },
15866
15837
  [TURN_STARTED_METHOD]: (notification) => {
15867
15838
  if (notification.params.threadId !== threadId) return;
@@ -15881,9 +15852,7 @@ ${text.slice(-24e3)}`
15881
15852
  },
15882
15853
  [ITEM_STARTED_METHOD]: (notification) => {
15883
15854
  if (!matchesTurn(notification.params.threadId, notification.params.turnId)) return;
15884
- if (notification.params.item.type === "contextCompaction") {
15885
- this.setCompacting(true);
15886
- }
15855
+ if (notification.params.item.type === "contextCompaction") this.compacting = true;
15887
15856
  this.startItem(
15888
15857
  notification.params.turnId,
15889
15858
  itemToTranscriptItem(notification.params.item, timestampFromMilliseconds(notification.params.startedAtMs), "in_progress")
@@ -15893,9 +15862,7 @@ ${text.slice(-24e3)}`
15893
15862
  [ITEM_COMPLETED_METHOD]: (notification) => {
15894
15863
  if (!matchesTurn(notification.params.threadId, notification.params.turnId)) return;
15895
15864
  completedItems.push(notification.params.item);
15896
- if (notification.params.item.type === "contextCompaction") {
15897
- this.setCompacting(false);
15898
- }
15865
+ if (notification.params.item.type === "contextCompaction") this.compacting = false;
15899
15866
  const itemFailed = notification.params.item.type === "commandExecution" && typeof notification.params.item.exitCode === "number" && notification.params.item.exitCode !== 0;
15900
15867
  this.completeItem(
15901
15868
  notification.params.turnId,
@@ -16197,8 +16164,8 @@ ${text.slice(-24e3)}`
16197
16164
  const live = turn.items.get(item.id);
16198
16165
  turn.items.delete(item.id);
16199
16166
  turn.persistedItemIds.add(item.id);
16200
- const timestamp = live?.timestamp ?? item.timestamp;
16201
- const persisted = item.type === "subagent" && item.status === "completed" ? { ...item, timestamp, status: "in_progress" } : { ...item, timestamp };
16167
+ const completed = live ? { ...item, timestamp: live.timestamp, completedAt: item.timestamp } : item;
16168
+ const persisted = completed.type === "subagent" && completed.status === "completed" ? { ...completed, status: "in_progress" } : completed;
16202
16169
  if (persisted.type === "subagent" && persisted.status === "in_progress") {
16203
16170
  const subagent = { turnId, item: persisted, active: new Set(persisted.receiverThreadIds), failed: false };
16204
16171
  for (const threadId of subagent.active) this.codexSubagents.set(threadId, subagent);
@@ -17186,7 +17153,6 @@ ${typeof pending.subject.command === "string" ? pending.subject.command : JSON.s
17186
17153
  sessionId: this.sessionId
17187
17154
  });
17188
17155
  if (isRecord(result2) && result2.status === "accepted") {
17189
- this.setCompacting(true);
17190
17156
  await completed2;
17191
17157
  } else {
17192
17158
  this.compactionComplete = null;
@@ -61681,7 +61647,6 @@ var ChatService = class {
61681
61647
  processing: hasActiveChatTurn(chat),
61682
61648
  activityTrackingVersion: 1,
61683
61649
  awaitingInput: chat.provider.isAwaitingInput?.() ?? false,
61684
- isCompacting: chat.provider.isCompacting?.() ?? false,
61685
61650
  isAuthRetrying: chat.provider.isAuthRetrying?.() ?? false,
61686
61651
  mayBeReconnecting: chat.provider.mayBeReconnecting?.() ?? false,
61687
61652
  goal: chat.provider.getGoal?.() ?? null,
@@ -61809,7 +61774,7 @@ var ChatService = class {
61809
61774
  }
61810
61775
  }).catch(() => {
61811
61776
  });
61812
- if (event.type === "replicas-tool-input-request" || event.type === "replicas-tool-input-resolved" || event.type === "compaction-status" || event.type === AUTH_RETRY_STATUS_EVENT_TYPE || event.type === AUTH_FALLBACK_EVENT_TYPE || event.type === CURSOR_CONNECTION_STATUS_EVENT_TYPE || event.type === CHAT_GOAL_EVENT_TYPE || event.type === "claude-result" || event.type === "claude-system" && (event.payload.subtype === "init" || event.payload.subtype === "session_state_changed" || event.payload.subtype === "background_tasks_changed" || coerceBackgroundTaskPayload(event.payload) !== null)) {
61777
+ if (event.type === "replicas-tool-input-request" || event.type === "replicas-tool-input-resolved" || event.type === AUTH_RETRY_STATUS_EVENT_TYPE || event.type === AUTH_FALLBACK_EVENT_TYPE || event.type === CURSOR_CONNECTION_STATUS_EVENT_TYPE || event.type === CHAT_GOAL_EVENT_TYPE || event.type === "claude-result" || event.type === "claude-system" && (event.payload.subtype === "init" || event.payload.subtype === "session_state_changed" || event.payload.subtype === "background_tasks_changed" || coerceBackgroundTaskPayload(event.payload) !== null)) {
61813
61778
  this.publish({
61814
61779
  type: "chat.updated",
61815
61780
  payload: { chat: this.toSummary(chat) }
@@ -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-MWCBGGWF.js";
6
+ } from "./chunk-YQE57AE6.js";
7
7
  import {
8
8
  isRecord
9
9
  } from "./chunk-UZSNFLDQ.js";
10
10
  import {
11
11
  shouldRefreshPullRequests
12
- } from "./chunk-LKTX2CHU.js";
12
+ } from "./chunk-IIANP4GI.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-LKTX2CHU.js";
12
+ } from "./chunk-IIANP4GI.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.984",
3
+ "version": "0.1.986",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",