@dudousxd/nestjs-agent-store-drizzle 0.15.0 → 0.16.0

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
@@ -153,6 +153,25 @@ declare const agentThread: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
153
153
  }, {}, {
154
154
  length: number | undefined;
155
155
  }>;
156
+ model: drizzle_orm_sqlite_core.SQLiteColumn<{
157
+ name: "model";
158
+ tableName: "agent_thread";
159
+ dataType: "string";
160
+ columnType: "SQLiteText";
161
+ data: string;
162
+ driverParam: string;
163
+ notNull: false;
164
+ hasDefault: false;
165
+ isPrimaryKey: false;
166
+ isAutoincrement: false;
167
+ hasRuntimeDefault: false;
168
+ enumValues: [string, ...string[]];
169
+ baseColumn: never;
170
+ identity: undefined;
171
+ generated: undefined;
172
+ }, {}, {
173
+ length: number | undefined;
174
+ }>;
156
175
  createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
157
176
  name: "created_at";
158
177
  tableName: "agent_thread";
@@ -2109,6 +2128,25 @@ declare const agentSchema: {
2109
2128
  }, {}, {
2110
2129
  length: number | undefined;
2111
2130
  }>;
2131
+ model: drizzle_orm_sqlite_core.SQLiteColumn<{
2132
+ name: "model";
2133
+ tableName: "agent_thread";
2134
+ dataType: "string";
2135
+ columnType: "SQLiteText";
2136
+ data: string;
2137
+ driverParam: string;
2138
+ notNull: false;
2139
+ hasDefault: false;
2140
+ isPrimaryKey: false;
2141
+ isAutoincrement: false;
2142
+ hasRuntimeDefault: false;
2143
+ enumValues: [string, ...string[]];
2144
+ baseColumn: never;
2145
+ identity: undefined;
2146
+ generated: undefined;
2147
+ }, {}, {
2148
+ length: number | undefined;
2149
+ }>;
2112
2150
  createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
2113
2151
  name: "created_at";
2114
2152
  tableName: "agent_thread";
@@ -3951,6 +3989,8 @@ declare class DrizzleAgentStore implements AgentStore, ThreadTurnReader {
3951
3989
  * agent answers the next turn, and {@link getThread} would materialize the whole transcript to
3952
3990
  * hand it over. `null` when the thread is unknown, soft-deleted, or has no default set.
3953
3991
  */
3992
+ /** The thread's pinned model, projected like {@link defaultAgentForThread}. */
3993
+ modelForThread(threadId: string): Promise<string | null>;
3954
3994
  defaultAgentForThread(threadId: string): Promise<string | null>;
3955
3995
  /**
3956
3996
  * Persist the start of a run (turn). Replay-safe: called under a durable localStep.
package/dist/index.d.ts CHANGED
@@ -153,6 +153,25 @@ declare const agentThread: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
153
153
  }, {}, {
154
154
  length: number | undefined;
155
155
  }>;
156
+ model: drizzle_orm_sqlite_core.SQLiteColumn<{
157
+ name: "model";
158
+ tableName: "agent_thread";
159
+ dataType: "string";
160
+ columnType: "SQLiteText";
161
+ data: string;
162
+ driverParam: string;
163
+ notNull: false;
164
+ hasDefault: false;
165
+ isPrimaryKey: false;
166
+ isAutoincrement: false;
167
+ hasRuntimeDefault: false;
168
+ enumValues: [string, ...string[]];
169
+ baseColumn: never;
170
+ identity: undefined;
171
+ generated: undefined;
172
+ }, {}, {
173
+ length: number | undefined;
174
+ }>;
156
175
  createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
157
176
  name: "created_at";
158
177
  tableName: "agent_thread";
@@ -2109,6 +2128,25 @@ declare const agentSchema: {
2109
2128
  }, {}, {
2110
2129
  length: number | undefined;
2111
2130
  }>;
2131
+ model: drizzle_orm_sqlite_core.SQLiteColumn<{
2132
+ name: "model";
2133
+ tableName: "agent_thread";
2134
+ dataType: "string";
2135
+ columnType: "SQLiteText";
2136
+ data: string;
2137
+ driverParam: string;
2138
+ notNull: false;
2139
+ hasDefault: false;
2140
+ isPrimaryKey: false;
2141
+ isAutoincrement: false;
2142
+ hasRuntimeDefault: false;
2143
+ enumValues: [string, ...string[]];
2144
+ baseColumn: never;
2145
+ identity: undefined;
2146
+ generated: undefined;
2147
+ }, {}, {
2148
+ length: number | undefined;
2149
+ }>;
2112
2150
  createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
2113
2151
  name: "created_at";
2114
2152
  tableName: "agent_thread";
@@ -3951,6 +3989,8 @@ declare class DrizzleAgentStore implements AgentStore, ThreadTurnReader {
3951
3989
  * agent answers the next turn, and {@link getThread} would materialize the whole transcript to
3952
3990
  * hand it over. `null` when the thread is unknown, soft-deleted, or has no default set.
3953
3991
  */
3992
+ /** The thread's pinned model, projected like {@link defaultAgentForThread}. */
3993
+ modelForThread(threadId: string): Promise<string | null>;
3954
3994
  defaultAgentForThread(threadId: string): Promise<string | null>;
3955
3995
  /**
3956
3996
  * Persist the start of a run (turn). Replay-safe: called under a durable localStep.
package/dist/index.js CHANGED
@@ -14,6 +14,8 @@ var agentThread = sqliteTable("agent_thread", {
14
14
  activeStreamId: text("active_stream_id"),
15
15
  /** The agent a new turn on this thread defaults to when the caller names none. */
16
16
  defaultAgent: text("default_agent"),
17
+ /** The model every turn on this thread runs on unless the send names one; `null` → default. */
18
+ model: text("model"),
17
19
  createdAt: integer("created_at", {
18
20
  mode: "timestamp_ms"
19
21
  }).notNull(),
@@ -251,6 +253,7 @@ var statements = [
251
253
  transient INTEGER NOT NULL DEFAULT 0,
252
254
  active_stream_id TEXT,
253
255
  default_agent TEXT,
256
+ model TEXT,
254
257
  created_at INTEGER NOT NULL,
255
258
  updated_at INTEGER NOT NULL,
256
259
  deleted_at INTEGER
@@ -417,6 +420,11 @@ var additiveColumns = [
417
420
  column: "feedback",
418
421
  ddl: "ALTER TABLE agent_message ADD COLUMN feedback TEXT"
419
422
  },
423
+ {
424
+ table: "agent_thread",
425
+ column: "model",
426
+ ddl: "ALTER TABLE agent_thread ADD COLUMN model TEXT"
427
+ },
420
428
  {
421
429
  table: "agent_tool_call",
422
430
  column: "approver",
@@ -482,6 +490,7 @@ var DrizzleAgentStore = class {
482
490
  transient: input.transient ?? false,
483
491
  activeStreamId: null,
484
492
  defaultAgent: null,
493
+ model: null,
485
494
  createdAt: now,
486
495
  updatedAt: now,
487
496
  deletedAt: null
@@ -587,6 +596,7 @@ var DrizzleAgentStore = class {
587
596
  transient: false,
588
597
  activeStreamId: null,
589
598
  defaultAgent: source.defaultAgent,
599
+ model: source.model,
590
600
  createdAt: now,
591
601
  updatedAt: now,
592
602
  deletedAt: null
@@ -735,6 +745,9 @@ var DrizzleAgentStore = class {
735
745
  if (patch.defaultAgent !== void 0) {
736
746
  updates.defaultAgent = patch.defaultAgent;
737
747
  }
748
+ if (patch.model !== void 0) {
749
+ updates.model = patch.model;
750
+ }
738
751
  if (Object.keys(updates).length === 0) {
739
752
  return;
740
753
  }
@@ -746,6 +759,13 @@ var DrizzleAgentStore = class {
746
759
  * agent answers the next turn, and {@link getThread} would materialize the whole transcript to
747
760
  * hand it over. `null` when the thread is unknown, soft-deleted, or has no default set.
748
761
  */
762
+ /** The thread's pinned model, projected like {@link defaultAgentForThread}. */
763
+ async modelForThread(threadId) {
764
+ const [thread] = await this.db.select({
765
+ model: agentThread.model
766
+ }).from(agentThread).where(and(eq(agentThread.id, threadId), isNull(agentThread.deletedAt)));
767
+ return thread?.model ?? null;
768
+ }
749
769
  async defaultAgentForThread(threadId) {
750
770
  const [thread] = await this.db.select({
751
771
  defaultAgent: agentThread.defaultAgent
@@ -976,6 +996,9 @@ var DrizzleAgentStore = class {
976
996
  createdAt: thread.createdAt.toISOString(),
977
997
  updatedAt: thread.updatedAt.toISOString(),
978
998
  defaultAgent: thread.defaultAgent,
999
+ ...thread.model != null ? {
1000
+ model: thread.model
1001
+ } : {},
979
1002
  ...lastContent !== void 0 ? {
980
1003
  lastMessagePreview: lastContent.slice(0, 120)
981
1004
  } : {}