@dudousxd/nestjs-agent-store-drizzle 0.22.0 → 0.22.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/dist/index.d.cts CHANGED
@@ -4845,7 +4845,8 @@ declare class DrizzleAgentStore implements AgentStore, ThreadTurnReader, ChatQue
4845
4845
  toolCallOutcomes(toolCallIds: readonly string[]): Promise<ToolCallOutcome[]>;
4846
4846
  failUnsettledToolCalls(runId: string, error: string): Promise<number>;
4847
4847
  /**
4848
- * Of `mediaIds`, the ones a surviving message in one of this actor's threads still carries.
4848
+ * Of `mediaIds`, the ones a surviving message — or a message waiting in the queue — in one of
4849
+ * this actor's threads still carries.
4849
4850
  *
4850
4851
  * Reads the `attachments` JSON back out and matches in memory rather than pushing the match into
4851
4852
  * SQL: the column holds an array of objects, and every dialect this adapter's sibling targets
package/dist/index.d.ts CHANGED
@@ -4845,7 +4845,8 @@ declare class DrizzleAgentStore implements AgentStore, ThreadTurnReader, ChatQue
4845
4845
  toolCallOutcomes(toolCallIds: readonly string[]): Promise<ToolCallOutcome[]>;
4846
4846
  failUnsettledToolCalls(runId: string, error: string): Promise<number>;
4847
4847
  /**
4848
- * Of `mediaIds`, the ones a surviving message in one of this actor's threads still carries.
4848
+ * Of `mediaIds`, the ones a surviving message — or a message waiting in the queue — in one of
4849
+ * this actor's threads still carries.
4849
4850
  *
4850
4851
  * Reads the `attachments` JSON back out and matches in memory rather than pushing the match into
4851
4852
  * SQL: the column holds an array of objects, and every dialect this adapter's sibling targets
package/dist/index.js CHANGED
@@ -1189,7 +1189,8 @@ var DrizzleAgentStore = class {
1189
1189
  return rows.length;
1190
1190
  }
1191
1191
  /**
1192
- * Of `mediaIds`, the ones a surviving message in one of this actor's threads still carries.
1192
+ * Of `mediaIds`, the ones a surviving message — or a message waiting in the queue — in one of
1193
+ * this actor's threads still carries.
1193
1194
  *
1194
1195
  * Reads the `attachments` JSON back out and matches in memory rather than pushing the match into
1195
1196
  * SQL: the column holds an array of objects, and every dialect this adapter's sibling targets
@@ -1208,9 +1209,15 @@ var DrizzleAgentStore = class {
1208
1209
  const rows = await this.db.select({
1209
1210
  attachments: agentMessage.attachments
1210
1211
  }).from(agentMessage).innerJoin(agentThread, eq(agentMessage.threadId, agentThread.id)).where(and(eq(agentThread.actorRef, actorRef), isNotNull(agentMessage.attachments)));
1212
+ const queued = await this.db.select({
1213
+ attachments: agentQueuedMessage.attachments
1214
+ }).from(agentQueuedMessage).innerJoin(agentThread, eq(agentQueuedMessage.threadId, agentThread.id)).where(and(eq(agentThread.actorRef, actorRef), isNotNull(agentQueuedMessage.attachments)));
1211
1215
  const wanted = new Set(mediaIds);
1212
1216
  const found = /* @__PURE__ */ new Set();
1213
- for (const row of rows) {
1217
+ for (const row of [
1218
+ ...rows,
1219
+ ...queued
1220
+ ]) {
1214
1221
  for (const attachment of row.attachments ?? []) {
1215
1222
  if (wanted.has(attachment.mediaId)) {
1216
1223
  found.add(attachment.mediaId);