replicas-engine 0.1.1305 → 0.1.1306

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,9 +8,9 @@ import {
8
8
  listRunningCodexModels,
9
9
  restartCodexAspHost,
10
10
  restartCodexAspHostIfRunning
11
- } from "./chunk-SYZXJP4X.js";
11
+ } from "./chunk-YJ7NCHM6.js";
12
12
  import "./chunk-TKAWFIXX.js";
13
- import "./chunk-AS77RMSN.js";
13
+ import "./chunk-OSPDTEXF.js";
14
14
  import "./chunk-IHC4JY3Q.js";
15
15
  import "./chunk-UZSNFLDQ.js";
16
16
  import "./chunk-QBNBBWCE.js";
@@ -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-AS77RMSN.js";
6
+ } from "./chunk-OSPDTEXF.js";
7
7
  import {
8
8
  ASTER_BASE_URL,
9
9
  ASTER_PROVIDER,
@@ -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.1305";
243
+ var ENGINE_PACKAGE_VERSION = "0.1.1306";
244
244
  var INITIALIZE_METHOD = "initialize";
245
245
  var INITIALIZED_NOTIFICATION = "initialized";
246
246
  var ACCOUNT_LOGIN_START_METHOD = "account/login/start";
@@ -14,7 +14,7 @@ import {
14
14
  import {
15
15
  AppServerProcess,
16
16
  buildCodexAgentEnv
17
- } from "./chunk-AS77RMSN.js";
17
+ } from "./chunk-OSPDTEXF.js";
18
18
  import {
19
19
  SUBPROCESS_MAX_BUFFER,
20
20
  execFileAsync
@@ -306,7 +306,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
306
306
  await this.applyCredentialUpdate(++this.credentialGeneration, async () => {
307
307
  await this.applyCredentialsResponse(data);
308
308
  setAgentCredentialSnapshot("codex", data);
309
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-QEZNRY2W.js");
309
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-AQZFJO5T.js");
310
310
  await restartCodexAspHostIfRunning2();
311
311
  });
312
312
  await this.start(true);
@@ -328,7 +328,7 @@ var CodexTokenManager = class extends BaseRefreshManager {
328
328
  const accountChanged = ENGINE_ENV.REPLICAS_AGENT_CREDENTIALS.codex?.credentialId !== data.credentialId;
329
329
  await this.applyCredentialsResponse(data);
330
330
  if (restartOnChange && (accountChanged || CODEX_AUTH_ENV_KEYS.some((key, index) => process.env[key] !== previousEnv[index]))) {
331
- const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-QEZNRY2W.js");
331
+ const { restartCodexAspHostIfRunning: restartCodexAspHostIfRunning2 } = await import("./asp-host-AQZFJO5T.js");
332
332
  await restartCodexAspHostIfRunning2();
333
333
  }
334
334
  setAgentCredentialSnapshot("codex", data);
@@ -14,11 +14,11 @@ import {
14
14
  recoverCompletedTurn,
15
15
  spawnMuseMsp,
16
16
  startMuseSession
17
- } from "./chunk-NG63G5VA.js";
17
+ } from "./chunk-4AY3GCWL.js";
18
18
  import {
19
19
  AppServerProcess,
20
20
  buildCodexAgentEnv
21
- } from "./chunk-AS77RMSN.js";
21
+ } from "./chunk-OSPDTEXF.js";
22
22
  import "./chunk-IHC4JY3Q.js";
23
23
  import {
24
24
  AGENT,
package/dist/src/index.js CHANGED
@@ -65,7 +65,7 @@ import {
65
65
  spawnMuseMsp,
66
66
  startMuseSession,
67
67
  uuidV7
68
- } from "./chunk-NG63G5VA.js";
68
+ } from "./chunk-4AY3GCWL.js";
69
69
  import {
70
70
  publishedPullRequestUrls
71
71
  } from "./chunk-DDUTPOJ3.js";
@@ -143,7 +143,7 @@ import {
143
143
  timestampFromSeconds,
144
144
  upsertCredentialFileLines,
145
145
  writeSecureCredentialFile
146
- } from "./chunk-SYZXJP4X.js";
146
+ } from "./chunk-YJ7NCHM6.js";
147
147
  import {
148
148
  ENGINE_ENV,
149
149
  monolithRequest,
@@ -156,7 +156,7 @@ import {
156
156
  } from "./chunk-TKAWFIXX.js";
157
157
  import {
158
158
  getCodexModelProvider
159
- } from "./chunk-AS77RMSN.js";
159
+ } from "./chunk-OSPDTEXF.js";
160
160
  import {
161
161
  SUBPROCESS_MAX_BUFFER,
162
162
  execAsync,
@@ -10639,11 +10639,9 @@ function getComparableUserMessage(event) {
10639
10639
  }
10640
10640
  function areDuplicateUserMessages(a, b) {
10641
10641
  if (areSameUserMessageEvents(a, b)) return true;
10642
- const aId = getUserMessageId(a);
10643
- const bId = getUserMessageId(b);
10642
+ const { userMessageId: aId, userMessage: aMessage } = workspaceChatEventSignals(a);
10643
+ const { userMessageId: bId, userMessage: bMessage } = workspaceChatEventSignals(b);
10644
10644
  if (aId !== null && bId !== null && aId !== bId) return false;
10645
- const aMessage = getComparableUserMessage(a);
10646
- const bMessage = getComparableUserMessage(b);
10647
10645
  if (!aMessage || aMessage !== bMessage) return false;
10648
10646
  const aAccepted = isAcceptedUserMessage(a);
10649
10647
  const bAccepted = isAcceptedUserMessage(b);
@@ -10652,7 +10650,7 @@ function areDuplicateUserMessages(a, b) {
10652
10650
  { content: bMessage, timestamp: b.timestamp }
10653
10651
  ) : false;
10654
10652
  }
10655
- var eventJsonCache = /* @__PURE__ */ new WeakMap();
10653
+ var eventSignalsCache = /* @__PURE__ */ new WeakMap();
10656
10654
  function claudeToolResultId(event) {
10657
10655
  if (event.type !== "claude-user") return null;
10658
10656
  const { message } = event.payload;
@@ -10661,17 +10659,18 @@ function claudeToolResultId(event) {
10661
10659
  return isRecord(result) && typeof result.tool_use_id === "string" ? `tool_result:${result.tool_use_id}` : null;
10662
10660
  }
10663
10661
  function workspaceChatEventSignals(event) {
10664
- let json = eventJsonCache.get(event);
10665
- if (json === void 0) {
10666
- json = JSON.stringify(event);
10667
- eventJsonCache.set(event, json);
10662
+ let signals = eventSignalsCache.get(event);
10663
+ if (signals === void 0) {
10664
+ signals = {
10665
+ streamId: getEventStreamId(event) ?? claudeToolResultId(event),
10666
+ json: JSON.stringify(event),
10667
+ userMessage: getComparableUserMessage(event),
10668
+ userMessageId: event.type === QUEUED_MESSAGE_REMOVED_EVENT_TYPE ? null : getUserMessageId(event),
10669
+ timestampMs: getEventTimestampMs(event)
10670
+ };
10671
+ eventSignalsCache.set(event, signals);
10668
10672
  }
10669
- return {
10670
- streamId: getEventStreamId(event) ?? claudeToolResultId(event),
10671
- json,
10672
- userMessage: getComparableUserMessage(event),
10673
- userMessageId: event.type === QUEUED_MESSAGE_REMOVED_EVENT_TYPE ? null : getUserMessageId(event)
10674
- };
10673
+ return signals;
10675
10674
  }
10676
10675
  var emptyIndex = () => ({
10677
10676
  byStreamId: /* @__PURE__ */ new Map(),
@@ -10799,12 +10798,13 @@ function mergeWorkspaceChatHistoryEvents(primary, supplemental, removedMessageId
10799
10798
  );
10800
10799
  }
10801
10800
  function insertChronologically(existing, additions) {
10802
- const sorted = [...additions].sort((a, b) => getEventTimestampMs(a) - getEventTimestampMs(b));
10801
+ const timestampMs2 = (event) => workspaceChatEventSignals(event).timestampMs;
10802
+ const sorted = [...additions].sort((a, b) => timestampMs2(a) - timestampMs2(b));
10803
10803
  const result = [];
10804
10804
  let next = 0;
10805
10805
  for (const event of existing) {
10806
- const ms = getEventTimestampMs(event);
10807
- while (next < sorted.length && getEventTimestampMs(sorted[next]) < ms) result.push(sorted[next++]);
10806
+ const ms = timestampMs2(event);
10807
+ while (next < sorted.length && timestampMs2(sorted[next]) < ms) result.push(sorted[next++]);
10808
10808
  result.push(event);
10809
10809
  }
10810
10810
  result.push(...sorted.slice(next));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.1305",
3
+ "version": "0.1.1306",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",