@axiom-lattice/core 4.2.12 → 4.2.14

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/dist/index.d.mts CHANGED
@@ -4005,6 +4005,7 @@ interface InMemoryProjectRoomTransaction {
4005
4005
  getMessageByIdempotency(tenantId: string, roomId: string, idempotencyKey: string): ProjectRoomMessage | undefined;
4006
4006
  getMessages(): ProjectRoomMessage[];
4007
4007
  setMessage(message: ProjectRoomMessage): void;
4008
+ deleteMessage(tenantId: string, id: string): boolean;
4008
4009
  nextTimestamp(previous?: Date): Date;
4009
4010
  }
4010
4011
  /**
@@ -4340,6 +4341,17 @@ declare class InMemoryProjectRoomMessageStore implements ProjectRoomMessageStore
4340
4341
  after: Date;
4341
4342
  excludeAuthorUserId?: string;
4342
4343
  }): Promise<number>;
4344
+ /**
4345
+ * Deletes one bounded batch of chat messages older than a horizon.
4346
+ *
4347
+ * @param input - Exclusive upper time bound and requested batch size (clamped to 1..1000).
4348
+ * @returns The number of deleted rows.
4349
+ * @remarks Only `source: "user" | "agent"` rows are eligible; task/system events are retained.
4350
+ */
4351
+ deleteChatOlderThan(input: {
4352
+ before: Date;
4353
+ limit: number;
4354
+ }): Promise<number>;
4343
4355
  private createInTransaction;
4344
4356
  }
4345
4357
 
package/dist/index.d.ts CHANGED
@@ -4005,6 +4005,7 @@ interface InMemoryProjectRoomTransaction {
4005
4005
  getMessageByIdempotency(tenantId: string, roomId: string, idempotencyKey: string): ProjectRoomMessage | undefined;
4006
4006
  getMessages(): ProjectRoomMessage[];
4007
4007
  setMessage(message: ProjectRoomMessage): void;
4008
+ deleteMessage(tenantId: string, id: string): boolean;
4008
4009
  nextTimestamp(previous?: Date): Date;
4009
4010
  }
4010
4011
  /**
@@ -4340,6 +4341,17 @@ declare class InMemoryProjectRoomMessageStore implements ProjectRoomMessageStore
4340
4341
  after: Date;
4341
4342
  excludeAuthorUserId?: string;
4342
4343
  }): Promise<number>;
4344
+ /**
4345
+ * Deletes one bounded batch of chat messages older than a horizon.
4346
+ *
4347
+ * @param input - Exclusive upper time bound and requested batch size (clamped to 1..1000).
4348
+ * @returns The number of deleted rows.
4349
+ * @remarks Only `source: "user" | "agent"` rows are eligible; task/system events are retained.
4350
+ */
4351
+ deleteChatOlderThan(input: {
4352
+ before: Date;
4353
+ limit: number;
4354
+ }): Promise<number>;
4343
4355
  private createInTransaction;
4344
4356
  }
4345
4357
 
package/dist/index.js CHANGED
@@ -3923,6 +3923,12 @@ var InMemoryMcpServerConfigStore = class {
3923
3923
 
3924
3924
  // src/store_lattice/InMemoryAgentWebAppStore.ts
3925
3925
  var import_crypto = require("crypto");
3926
+ function cloneAppearance(appearance) {
3927
+ return {
3928
+ ...appearance,
3929
+ ...appearance.quickPrompts ? { quickPrompts: appearance.quickPrompts.map((prompt) => ({ ...prompt })) } : {}
3930
+ };
3931
+ }
3926
3932
  function cloneWebApp(webApp) {
3927
3933
  return {
3928
3934
  ...webApp,
@@ -3933,7 +3939,7 @@ function cloneWebApp(webApp) {
3933
3939
  allowedModelKeys: webApp.scope.allowedModelKeys ? [...webApp.scope.allowedModelKeys] : void 0
3934
3940
  },
3935
3941
  features: { ...webApp.features },
3936
- appearance: { ...webApp.appearance },
3942
+ appearance: cloneAppearance(webApp.appearance),
3937
3943
  identity: webApp.identity ? { policy: webApp.identity.policy, issuers: webApp.identity.issuers.map((issuer) => ({ ...issuer })) } : void 0,
3938
3944
  createdAt: new Date(webApp.createdAt),
3939
3945
  updatedAt: new Date(webApp.updatedAt)
@@ -3979,7 +3985,7 @@ var InMemoryAgentWebAppStore = class {
3979
3985
  allowedModelKeys: input.scope.allowedModelKeys ? [...input.scope.allowedModelKeys] : void 0
3980
3986
  },
3981
3987
  features: { ...input.features },
3982
- appearance: { ...input.appearance },
3988
+ appearance: cloneAppearance(input.appearance),
3983
3989
  identity: input.identity ? { policy: input.identity.policy, issuers: input.identity.issuers.map((issuer) => ({ ...issuer })) } : void 0,
3984
3990
  createdAt: now,
3985
3991
  updatedAt: now
@@ -4011,7 +4017,7 @@ var InMemoryAgentWebAppStore = class {
4011
4017
  }
4012
4018
  } : {},
4013
4019
  ...patch.features ? { features: { ...patch.features } } : {},
4014
- ...patch.appearance ? { appearance: { ...patch.appearance } } : {},
4020
+ ...patch.appearance ? { appearance: cloneAppearance(patch.appearance) } : {},
4015
4021
  ...patch.identity !== void 0 ? { identity: { policy: patch.identity.policy, issuers: patch.identity.issuers.map((issuer) => ({ ...issuer })) } } : {},
4016
4022
  ...patch.status !== void 0 ? { status: patch.status } : {},
4017
4023
  updatedAt: new Date(Math.max(Date.now(), existing.updatedAt.getTime() + 1))
@@ -4237,6 +4243,17 @@ var InMemoryProjectRoomCoordinator = class {
4237
4243
  }
4238
4244
  this.messages.set(JSON.stringify([message.tenantId, message.id]), storedMessage);
4239
4245
  },
4246
+ deleteMessage: (tenantId2, id) => {
4247
+ assertActive();
4248
+ const key5 = JSON.stringify([tenantId2, id]);
4249
+ const message = this.messages.get(key5);
4250
+ if (message === void 0) return false;
4251
+ this.messages.delete(key5);
4252
+ if (message.idempotencyKey !== void 0) {
4253
+ this.messageIdsByIdempotency.delete(JSON.stringify([tenantId2, message.roomId, message.idempotencyKey]));
4254
+ }
4255
+ return true;
4256
+ },
4240
4257
  nextTimestamp: (previousTimestamp) => {
4241
4258
  assertActive();
4242
4259
  const current = this.clock().getTime();
@@ -4642,6 +4659,25 @@ var InMemoryProjectRoomMessageStore = class {
4642
4659
  const horizon = Date.prototype.getTime.call(input.after);
4643
4660
  return this.coordinator.runExclusive((transaction) => transaction.getMessages().filter((message) => message.tenantId === input.tenantId && message.roomId === input.roomId && message.createdAt.getTime() > horizon).filter((message) => input.excludeAuthorUserId === void 0 || !(message.author.type === "human" && message.author.userId === input.excludeAuthorUserId)).length);
4644
4661
  }
4662
+ /**
4663
+ * Deletes one bounded batch of chat messages older than a horizon.
4664
+ *
4665
+ * @param input - Exclusive upper time bound and requested batch size (clamped to 1..1000).
4666
+ * @returns The number of deleted rows.
4667
+ * @remarks Only `source: "user" | "agent"` rows are eligible; task/system events are retained.
4668
+ */
4669
+ async deleteChatOlderThan(input) {
4670
+ if (!validDate(input.before)) {
4671
+ throw new RangeError("Project room message retention horizon date is invalid");
4672
+ }
4673
+ const horizon = Date.prototype.getTime.call(input.before);
4674
+ const limit = Math.min(1e3, Math.max(1, Math.trunc(Number.isFinite(input.limit) ? input.limit : 1)));
4675
+ return this.coordinator.runExclusive((transaction) => {
4676
+ const candidates = transaction.getMessages().filter((message) => (message.source === "user" || message.source === "agent") && message.createdAt.getTime() < horizon).sort((left, right) => left.createdAt.getTime() - right.createdAt.getTime() || left.id.localeCompare(right.id)).slice(0, limit);
4677
+ for (const message of candidates) transaction.deleteMessage(message.tenantId, message.id);
4678
+ return candidates.length;
4679
+ });
4680
+ }
4645
4681
  createInTransaction(transaction, input) {
4646
4682
  if (transaction.getMessage(input.tenantId, input.id) !== void 0) {
4647
4683
  throw new ProjectRoomMessageIdConflictError(input.tenantId, input.id);