@omercnet/paseo-omp 5.1.1-next.332.1 → 5.1.1-next.335.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omercnet/paseo-omp",
3
- "version": "5.1.1-next.332.1",
3
+ "version": "5.1.1-next.335.1",
4
4
  "type": "module",
5
5
  "description": "Paseo integration for OMP, including its direct provider and workspace tooling.",
6
6
  "license": "MIT",
@@ -1,2 +1,2 @@
1
1
  /** Release Please keeps this bundle-safe constant aligned with package.json. */
2
- export const PASEO_OMP_PACKAGE_VERSION = "5.1.1-next.332.1"; // x-release-please-version
2
+ export const PASEO_OMP_PACKAGE_VERSION = "5.1.1-next.335.1"; // x-release-please-version
@@ -372,8 +372,8 @@ export class OmpTimelineProjector {
372
372
  private flushTimer: unknown;
373
373
  private currentTurnId: string | null = null;
374
374
  private assistantSequence = 0;
375
+ // Least recently used first, so a long turn evicts its oldest identities.
375
376
  private readonly turnNativeMessageIds = new Map<string, string>();
376
- private nativeIdentitySaturated = false;
377
377
  private assistantIdentitySequence = 0;
378
378
  private noticeSequence = 0;
379
379
  private toolSequence = 0;
@@ -901,7 +901,6 @@ export class OmpTimelineProjector {
901
901
  this.currentTurnId = null;
902
902
  this.assistantSequence = 0;
903
903
  this.turnNativeMessageIds.clear();
904
- this.nativeIdentitySaturated = false;
905
904
  this.assistantIdentitySequence = 0;
906
905
  this.toolSequence = 0;
907
906
  this.userSequence = 0;
@@ -1174,7 +1173,6 @@ export class OmpTimelineProjector {
1174
1173
  this.currentTurnId = null;
1175
1174
  this.assistantSequence = 0;
1176
1175
  this.turnNativeMessageIds.clear();
1177
- this.nativeIdentitySaturated = false;
1178
1176
  }
1179
1177
 
1180
1178
  close(): void {
@@ -1242,13 +1240,12 @@ export class OmpTimelineProjector {
1242
1240
  this.commandPublishedText = "";
1243
1241
  }
1244
1242
 
1245
- private beginStream(message: OmpAssistantMessage, turnId: string): StreamSnapshot | null {
1243
+ private beginStream(message: OmpAssistantMessage, turnId: string): StreamSnapshot {
1246
1244
  this.assistantSequence += 1;
1247
1245
  const nativeIdentity = assistantIdentity(message);
1248
1246
  const messageId = nativeIdentity
1249
1247
  ? this.messageIdForNativeIdentity(nativeIdentity)
1250
1248
  : this.nextAssistantMessageId(`turn:${turnId}:${this.assistantSequence}`);
1251
- if (!messageId) return null;
1252
1249
  this.stream = {
1253
1250
  messageId,
1254
1251
  ...(nativeIdentity ? { nativeIdentity } : {}),
@@ -1261,15 +1258,16 @@ export class OmpTimelineProjector {
1261
1258
  };
1262
1259
  return this.stream;
1263
1260
  }
1264
- private messageIdForNativeIdentity(nativeIdentity: string): string | undefined {
1261
+ private messageIdForNativeIdentity(nativeIdentity: string): string {
1265
1262
  const existing = this.turnNativeMessageIds.get(nativeIdentity);
1266
- if (existing) return existing;
1267
- if (
1268
- this.nativeIdentitySaturated ||
1269
- this.turnNativeMessageIds.size >= MAX_TURN_NATIVE_IDENTITIES
1270
- ) {
1271
- this.nativeIdentitySaturated = true;
1272
- return undefined;
1263
+ if (existing) {
1264
+ this.turnNativeMessageIds.delete(nativeIdentity);
1265
+ this.turnNativeMessageIds.set(nativeIdentity, existing);
1266
+ return existing;
1267
+ }
1268
+ if (this.turnNativeMessageIds.size >= MAX_TURN_NATIVE_IDENTITIES) {
1269
+ const oldest = this.turnNativeMessageIds.keys().next().value;
1270
+ if (oldest !== undefined) this.turnNativeMessageIds.delete(oldest);
1273
1271
  }
1274
1272
  const messageId = this.nextAssistantMessageId(nativeIdentity);
1275
1273
  this.turnNativeMessageIds.set(nativeIdentity, messageId);
@@ -1290,12 +1288,7 @@ export class OmpTimelineProjector {
1290
1288
  const nativeIdentity = assistantIdentity(message);
1291
1289
  if (this.stream && nativeIdentity && this.stream.nativeIdentity !== nativeIdentity) {
1292
1290
  if (!this.stream.nativeIdentity && !this.stream.published) {
1293
- const messageId = this.messageIdForNativeIdentity(nativeIdentity);
1294
- if (!messageId) {
1295
- this.stream = null;
1296
- return;
1297
- }
1298
- this.stream.messageId = messageId;
1291
+ this.stream.messageId = this.messageIdForNativeIdentity(nativeIdentity);
1299
1292
  this.stream.nativeIdentity = nativeIdentity;
1300
1293
  } else {
1301
1294
  this.flush();
@@ -1303,7 +1296,6 @@ export class OmpTimelineProjector {
1303
1296
  }
1304
1297
  }
1305
1298
  const stream = this.stream ?? this.beginStream(message, turnId);
1306
- if (!stream) return;
1307
1299
  if (update?.contentIndex !== undefined) {
1308
1300
  this.updateBlock(stream, message, update.contentIndex, update);
1309
1301
  return;