@dudousxd/nestjs-agent-store-drizzle 0.22.0 → 0.23.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/README.md +1 -1
- package/dist/index.cjs +55 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +118 -1
- package/dist/index.d.ts +118 -1
- package/dist/index.js +55 -2
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -172,6 +172,25 @@ declare const agentThread: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
172
172
|
}, {}, {
|
|
173
173
|
length: number | undefined;
|
|
174
174
|
}>;
|
|
175
|
+
persona: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
176
|
+
name: "persona";
|
|
177
|
+
tableName: "agent_thread";
|
|
178
|
+
dataType: "string";
|
|
179
|
+
columnType: "SQLiteText";
|
|
180
|
+
data: string;
|
|
181
|
+
driverParam: string;
|
|
182
|
+
notNull: false;
|
|
183
|
+
hasDefault: false;
|
|
184
|
+
isPrimaryKey: false;
|
|
185
|
+
isAutoincrement: false;
|
|
186
|
+
hasRuntimeDefault: false;
|
|
187
|
+
enumValues: [string, ...string[]];
|
|
188
|
+
baseColumn: never;
|
|
189
|
+
identity: undefined;
|
|
190
|
+
generated: undefined;
|
|
191
|
+
}, {}, {
|
|
192
|
+
length: number | undefined;
|
|
193
|
+
}>;
|
|
175
194
|
queuePause: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
176
195
|
name: "queue_pause";
|
|
177
196
|
tableName: "agent_thread";
|
|
@@ -445,6 +464,25 @@ declare const agentMessage: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
445
464
|
}, {}, {
|
|
446
465
|
length: number | undefined;
|
|
447
466
|
}>;
|
|
467
|
+
persona: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
468
|
+
name: "persona";
|
|
469
|
+
tableName: "agent_message";
|
|
470
|
+
dataType: "string";
|
|
471
|
+
columnType: "SQLiteText";
|
|
472
|
+
data: string;
|
|
473
|
+
driverParam: string;
|
|
474
|
+
notNull: false;
|
|
475
|
+
hasDefault: false;
|
|
476
|
+
isPrimaryKey: false;
|
|
477
|
+
isAutoincrement: false;
|
|
478
|
+
hasRuntimeDefault: false;
|
|
479
|
+
enumValues: [string, ...string[]];
|
|
480
|
+
baseColumn: never;
|
|
481
|
+
identity: undefined;
|
|
482
|
+
generated: undefined;
|
|
483
|
+
}, {}, {
|
|
484
|
+
length: number | undefined;
|
|
485
|
+
}>;
|
|
448
486
|
runId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
449
487
|
name: "run_id";
|
|
450
488
|
tableName: "agent_message";
|
|
@@ -1007,6 +1045,25 @@ declare const agentQueuedMessage: drizzle_orm_sqlite_core.SQLiteTableWithColumns
|
|
|
1007
1045
|
}, {}, {
|
|
1008
1046
|
length: number | undefined;
|
|
1009
1047
|
}>;
|
|
1048
|
+
persona: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1049
|
+
name: "persona";
|
|
1050
|
+
tableName: "agent_queued_message";
|
|
1051
|
+
dataType: "string";
|
|
1052
|
+
columnType: "SQLiteText";
|
|
1053
|
+
data: string;
|
|
1054
|
+
driverParam: string;
|
|
1055
|
+
notNull: false;
|
|
1056
|
+
hasDefault: false;
|
|
1057
|
+
isPrimaryKey: false;
|
|
1058
|
+
isAutoincrement: false;
|
|
1059
|
+
hasRuntimeDefault: false;
|
|
1060
|
+
enumValues: [string, ...string[]];
|
|
1061
|
+
baseColumn: never;
|
|
1062
|
+
identity: undefined;
|
|
1063
|
+
generated: undefined;
|
|
1064
|
+
}, {}, {
|
|
1065
|
+
length: number | undefined;
|
|
1066
|
+
}>;
|
|
1010
1067
|
model: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1011
1068
|
name: "model";
|
|
1012
1069
|
tableName: "agent_queued_message";
|
|
@@ -2606,6 +2663,25 @@ declare const agentSchema: {
|
|
|
2606
2663
|
}, {}, {
|
|
2607
2664
|
length: number | undefined;
|
|
2608
2665
|
}>;
|
|
2666
|
+
persona: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
2667
|
+
name: "persona";
|
|
2668
|
+
tableName: "agent_thread";
|
|
2669
|
+
dataType: "string";
|
|
2670
|
+
columnType: "SQLiteText";
|
|
2671
|
+
data: string;
|
|
2672
|
+
driverParam: string;
|
|
2673
|
+
notNull: false;
|
|
2674
|
+
hasDefault: false;
|
|
2675
|
+
isPrimaryKey: false;
|
|
2676
|
+
isAutoincrement: false;
|
|
2677
|
+
hasRuntimeDefault: false;
|
|
2678
|
+
enumValues: [string, ...string[]];
|
|
2679
|
+
baseColumn: never;
|
|
2680
|
+
identity: undefined;
|
|
2681
|
+
generated: undefined;
|
|
2682
|
+
}, {}, {
|
|
2683
|
+
length: number | undefined;
|
|
2684
|
+
}>;
|
|
2609
2685
|
queuePause: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
2610
2686
|
name: "queue_pause";
|
|
2611
2687
|
tableName: "agent_thread";
|
|
@@ -2874,6 +2950,25 @@ declare const agentSchema: {
|
|
|
2874
2950
|
}, {}, {
|
|
2875
2951
|
length: number | undefined;
|
|
2876
2952
|
}>;
|
|
2953
|
+
persona: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
2954
|
+
name: "persona";
|
|
2955
|
+
tableName: "agent_message";
|
|
2956
|
+
dataType: "string";
|
|
2957
|
+
columnType: "SQLiteText";
|
|
2958
|
+
data: string;
|
|
2959
|
+
driverParam: string;
|
|
2960
|
+
notNull: false;
|
|
2961
|
+
hasDefault: false;
|
|
2962
|
+
isPrimaryKey: false;
|
|
2963
|
+
isAutoincrement: false;
|
|
2964
|
+
hasRuntimeDefault: false;
|
|
2965
|
+
enumValues: [string, ...string[]];
|
|
2966
|
+
baseColumn: never;
|
|
2967
|
+
identity: undefined;
|
|
2968
|
+
generated: undefined;
|
|
2969
|
+
}, {}, {
|
|
2970
|
+
length: number | undefined;
|
|
2971
|
+
}>;
|
|
2877
2972
|
runId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
2878
2973
|
name: "run_id";
|
|
2879
2974
|
tableName: "agent_message";
|
|
@@ -3105,6 +3200,25 @@ declare const agentSchema: {
|
|
|
3105
3200
|
}, {}, {
|
|
3106
3201
|
length: number | undefined;
|
|
3107
3202
|
}>;
|
|
3203
|
+
persona: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
3204
|
+
name: "persona";
|
|
3205
|
+
tableName: "agent_queued_message";
|
|
3206
|
+
dataType: "string";
|
|
3207
|
+
columnType: "SQLiteText";
|
|
3208
|
+
data: string;
|
|
3209
|
+
driverParam: string;
|
|
3210
|
+
notNull: false;
|
|
3211
|
+
hasDefault: false;
|
|
3212
|
+
isPrimaryKey: false;
|
|
3213
|
+
isAutoincrement: false;
|
|
3214
|
+
hasRuntimeDefault: false;
|
|
3215
|
+
enumValues: [string, ...string[]];
|
|
3216
|
+
baseColumn: never;
|
|
3217
|
+
identity: undefined;
|
|
3218
|
+
generated: undefined;
|
|
3219
|
+
}, {}, {
|
|
3220
|
+
length: number | undefined;
|
|
3221
|
+
}>;
|
|
3108
3222
|
model: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
3109
3223
|
name: "model";
|
|
3110
3224
|
tableName: "agent_queued_message";
|
|
@@ -4816,6 +4930,8 @@ declare class DrizzleAgentStore implements AgentStore, ThreadTurnReader, ChatQue
|
|
|
4816
4930
|
*/
|
|
4817
4931
|
/** The thread's pinned model, projected like {@link defaultAgentForThread}. */
|
|
4818
4932
|
modelForThread(threadId: string): Promise<string | null>;
|
|
4933
|
+
/** The thread's pinned persona, projected like {@link defaultAgentForThread}. */
|
|
4934
|
+
personaForThread(threadId: string): Promise<string | null>;
|
|
4819
4935
|
defaultAgentForThread(threadId: string): Promise<string | null>;
|
|
4820
4936
|
/**
|
|
4821
4937
|
* Persist the start of a run (turn). Replay-safe: called under a durable localStep.
|
|
@@ -4845,7 +4961,8 @@ declare class DrizzleAgentStore implements AgentStore, ThreadTurnReader, ChatQue
|
|
|
4845
4961
|
toolCallOutcomes(toolCallIds: readonly string[]): Promise<ToolCallOutcome[]>;
|
|
4846
4962
|
failUnsettledToolCalls(runId: string, error: string): Promise<number>;
|
|
4847
4963
|
/**
|
|
4848
|
-
* Of `mediaIds`, the ones a surviving message in
|
|
4964
|
+
* Of `mediaIds`, the ones a surviving message — or a message waiting in the queue — in one of
|
|
4965
|
+
* this actor's threads still carries.
|
|
4849
4966
|
*
|
|
4850
4967
|
* Reads the `attachments` JSON back out and matches in memory rather than pushing the match into
|
|
4851
4968
|
* SQL: the column holds an array of objects, and every dialect this adapter's sibling targets
|
package/dist/index.d.ts
CHANGED
|
@@ -172,6 +172,25 @@ declare const agentThread: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
172
172
|
}, {}, {
|
|
173
173
|
length: number | undefined;
|
|
174
174
|
}>;
|
|
175
|
+
persona: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
176
|
+
name: "persona";
|
|
177
|
+
tableName: "agent_thread";
|
|
178
|
+
dataType: "string";
|
|
179
|
+
columnType: "SQLiteText";
|
|
180
|
+
data: string;
|
|
181
|
+
driverParam: string;
|
|
182
|
+
notNull: false;
|
|
183
|
+
hasDefault: false;
|
|
184
|
+
isPrimaryKey: false;
|
|
185
|
+
isAutoincrement: false;
|
|
186
|
+
hasRuntimeDefault: false;
|
|
187
|
+
enumValues: [string, ...string[]];
|
|
188
|
+
baseColumn: never;
|
|
189
|
+
identity: undefined;
|
|
190
|
+
generated: undefined;
|
|
191
|
+
}, {}, {
|
|
192
|
+
length: number | undefined;
|
|
193
|
+
}>;
|
|
175
194
|
queuePause: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
176
195
|
name: "queue_pause";
|
|
177
196
|
tableName: "agent_thread";
|
|
@@ -445,6 +464,25 @@ declare const agentMessage: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
445
464
|
}, {}, {
|
|
446
465
|
length: number | undefined;
|
|
447
466
|
}>;
|
|
467
|
+
persona: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
468
|
+
name: "persona";
|
|
469
|
+
tableName: "agent_message";
|
|
470
|
+
dataType: "string";
|
|
471
|
+
columnType: "SQLiteText";
|
|
472
|
+
data: string;
|
|
473
|
+
driverParam: string;
|
|
474
|
+
notNull: false;
|
|
475
|
+
hasDefault: false;
|
|
476
|
+
isPrimaryKey: false;
|
|
477
|
+
isAutoincrement: false;
|
|
478
|
+
hasRuntimeDefault: false;
|
|
479
|
+
enumValues: [string, ...string[]];
|
|
480
|
+
baseColumn: never;
|
|
481
|
+
identity: undefined;
|
|
482
|
+
generated: undefined;
|
|
483
|
+
}, {}, {
|
|
484
|
+
length: number | undefined;
|
|
485
|
+
}>;
|
|
448
486
|
runId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
449
487
|
name: "run_id";
|
|
450
488
|
tableName: "agent_message";
|
|
@@ -1007,6 +1045,25 @@ declare const agentQueuedMessage: drizzle_orm_sqlite_core.SQLiteTableWithColumns
|
|
|
1007
1045
|
}, {}, {
|
|
1008
1046
|
length: number | undefined;
|
|
1009
1047
|
}>;
|
|
1048
|
+
persona: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1049
|
+
name: "persona";
|
|
1050
|
+
tableName: "agent_queued_message";
|
|
1051
|
+
dataType: "string";
|
|
1052
|
+
columnType: "SQLiteText";
|
|
1053
|
+
data: string;
|
|
1054
|
+
driverParam: string;
|
|
1055
|
+
notNull: false;
|
|
1056
|
+
hasDefault: false;
|
|
1057
|
+
isPrimaryKey: false;
|
|
1058
|
+
isAutoincrement: false;
|
|
1059
|
+
hasRuntimeDefault: false;
|
|
1060
|
+
enumValues: [string, ...string[]];
|
|
1061
|
+
baseColumn: never;
|
|
1062
|
+
identity: undefined;
|
|
1063
|
+
generated: undefined;
|
|
1064
|
+
}, {}, {
|
|
1065
|
+
length: number | undefined;
|
|
1066
|
+
}>;
|
|
1010
1067
|
model: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1011
1068
|
name: "model";
|
|
1012
1069
|
tableName: "agent_queued_message";
|
|
@@ -2606,6 +2663,25 @@ declare const agentSchema: {
|
|
|
2606
2663
|
}, {}, {
|
|
2607
2664
|
length: number | undefined;
|
|
2608
2665
|
}>;
|
|
2666
|
+
persona: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
2667
|
+
name: "persona";
|
|
2668
|
+
tableName: "agent_thread";
|
|
2669
|
+
dataType: "string";
|
|
2670
|
+
columnType: "SQLiteText";
|
|
2671
|
+
data: string;
|
|
2672
|
+
driverParam: string;
|
|
2673
|
+
notNull: false;
|
|
2674
|
+
hasDefault: false;
|
|
2675
|
+
isPrimaryKey: false;
|
|
2676
|
+
isAutoincrement: false;
|
|
2677
|
+
hasRuntimeDefault: false;
|
|
2678
|
+
enumValues: [string, ...string[]];
|
|
2679
|
+
baseColumn: never;
|
|
2680
|
+
identity: undefined;
|
|
2681
|
+
generated: undefined;
|
|
2682
|
+
}, {}, {
|
|
2683
|
+
length: number | undefined;
|
|
2684
|
+
}>;
|
|
2609
2685
|
queuePause: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
2610
2686
|
name: "queue_pause";
|
|
2611
2687
|
tableName: "agent_thread";
|
|
@@ -2874,6 +2950,25 @@ declare const agentSchema: {
|
|
|
2874
2950
|
}, {}, {
|
|
2875
2951
|
length: number | undefined;
|
|
2876
2952
|
}>;
|
|
2953
|
+
persona: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
2954
|
+
name: "persona";
|
|
2955
|
+
tableName: "agent_message";
|
|
2956
|
+
dataType: "string";
|
|
2957
|
+
columnType: "SQLiteText";
|
|
2958
|
+
data: string;
|
|
2959
|
+
driverParam: string;
|
|
2960
|
+
notNull: false;
|
|
2961
|
+
hasDefault: false;
|
|
2962
|
+
isPrimaryKey: false;
|
|
2963
|
+
isAutoincrement: false;
|
|
2964
|
+
hasRuntimeDefault: false;
|
|
2965
|
+
enumValues: [string, ...string[]];
|
|
2966
|
+
baseColumn: never;
|
|
2967
|
+
identity: undefined;
|
|
2968
|
+
generated: undefined;
|
|
2969
|
+
}, {}, {
|
|
2970
|
+
length: number | undefined;
|
|
2971
|
+
}>;
|
|
2877
2972
|
runId: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
2878
2973
|
name: "run_id";
|
|
2879
2974
|
tableName: "agent_message";
|
|
@@ -3105,6 +3200,25 @@ declare const agentSchema: {
|
|
|
3105
3200
|
}, {}, {
|
|
3106
3201
|
length: number | undefined;
|
|
3107
3202
|
}>;
|
|
3203
|
+
persona: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
3204
|
+
name: "persona";
|
|
3205
|
+
tableName: "agent_queued_message";
|
|
3206
|
+
dataType: "string";
|
|
3207
|
+
columnType: "SQLiteText";
|
|
3208
|
+
data: string;
|
|
3209
|
+
driverParam: string;
|
|
3210
|
+
notNull: false;
|
|
3211
|
+
hasDefault: false;
|
|
3212
|
+
isPrimaryKey: false;
|
|
3213
|
+
isAutoincrement: false;
|
|
3214
|
+
hasRuntimeDefault: false;
|
|
3215
|
+
enumValues: [string, ...string[]];
|
|
3216
|
+
baseColumn: never;
|
|
3217
|
+
identity: undefined;
|
|
3218
|
+
generated: undefined;
|
|
3219
|
+
}, {}, {
|
|
3220
|
+
length: number | undefined;
|
|
3221
|
+
}>;
|
|
3108
3222
|
model: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
3109
3223
|
name: "model";
|
|
3110
3224
|
tableName: "agent_queued_message";
|
|
@@ -4816,6 +4930,8 @@ declare class DrizzleAgentStore implements AgentStore, ThreadTurnReader, ChatQue
|
|
|
4816
4930
|
*/
|
|
4817
4931
|
/** The thread's pinned model, projected like {@link defaultAgentForThread}. */
|
|
4818
4932
|
modelForThread(threadId: string): Promise<string | null>;
|
|
4933
|
+
/** The thread's pinned persona, projected like {@link defaultAgentForThread}. */
|
|
4934
|
+
personaForThread(threadId: string): Promise<string | null>;
|
|
4819
4935
|
defaultAgentForThread(threadId: string): Promise<string | null>;
|
|
4820
4936
|
/**
|
|
4821
4937
|
* Persist the start of a run (turn). Replay-safe: called under a durable localStep.
|
|
@@ -4845,7 +4961,8 @@ declare class DrizzleAgentStore implements AgentStore, ThreadTurnReader, ChatQue
|
|
|
4845
4961
|
toolCallOutcomes(toolCallIds: readonly string[]): Promise<ToolCallOutcome[]>;
|
|
4846
4962
|
failUnsettledToolCalls(runId: string, error: string): Promise<number>;
|
|
4847
4963
|
/**
|
|
4848
|
-
* Of `mediaIds`, the ones a surviving message in
|
|
4964
|
+
* Of `mediaIds`, the ones a surviving message — or a message waiting in the queue — in one of
|
|
4965
|
+
* this actor's threads still carries.
|
|
4849
4966
|
*
|
|
4850
4967
|
* Reads the `attachments` JSON back out and matches in memory rather than pushing the match into
|
|
4851
4968
|
* SQL: the column holds an array of objects, and every dialect this adapter's sibling targets
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,8 @@ var agentThread = sqliteTable("agent_thread", {
|
|
|
16
16
|
defaultAgent: text("default_agent"),
|
|
17
17
|
/** The model every turn on this thread runs on unless the send names one; `null` → default. */
|
|
18
18
|
model: text("model"),
|
|
19
|
+
/** The persona a send on this thread runs under when it names none; `null` → the agent's default. */
|
|
20
|
+
persona: text("persona"),
|
|
19
21
|
/** Why the thread's message queue stopped draining; `null` → it drains. */
|
|
20
22
|
queuePause: text("queue_pause", {
|
|
21
23
|
mode: "json"
|
|
@@ -55,6 +57,8 @@ var agentMessage = sqliteTable("agent_message", {
|
|
|
55
57
|
mode: "json"
|
|
56
58
|
}).$type(),
|
|
57
59
|
agentName: text("agent_name"),
|
|
60
|
+
/** The persona the turn that wrote this message ran under; `null` → none. */
|
|
61
|
+
persona: text("persona"),
|
|
58
62
|
runId: text("run_id"),
|
|
59
63
|
/** The step's streamed thinking; `null` when the model produced none. */
|
|
60
64
|
reasoning: text("reasoning"),
|
|
@@ -127,6 +131,8 @@ var agentQueuedMessage = sqliteTable("agent_queued_message", {
|
|
|
127
131
|
mode: "json"
|
|
128
132
|
}).$type(),
|
|
129
133
|
agentName: text("agent_name"),
|
|
134
|
+
/** The persona the send resolved — what the message starts under. */
|
|
135
|
+
persona: text("persona"),
|
|
130
136
|
model: text("model"),
|
|
131
137
|
pageContext: text("page_context", {
|
|
132
138
|
mode: "json"
|
|
@@ -314,6 +320,7 @@ var statements = [
|
|
|
314
320
|
active_stream_id TEXT,
|
|
315
321
|
default_agent TEXT,
|
|
316
322
|
model TEXT,
|
|
323
|
+
persona TEXT,
|
|
317
324
|
queue_pause TEXT,
|
|
318
325
|
created_at INTEGER NOT NULL,
|
|
319
326
|
updated_at INTEGER NOT NULL,
|
|
@@ -332,6 +339,7 @@ var statements = [
|
|
|
332
339
|
follow_ups TEXT,
|
|
333
340
|
usage TEXT,
|
|
334
341
|
agent_name TEXT,
|
|
342
|
+
persona TEXT,
|
|
335
343
|
run_id TEXT,
|
|
336
344
|
reasoning TEXT,
|
|
337
345
|
reasoning_ms INTEGER,
|
|
@@ -348,6 +356,7 @@ var statements = [
|
|
|
348
356
|
content TEXT NOT NULL,
|
|
349
357
|
attachments TEXT,
|
|
350
358
|
agent_name TEXT,
|
|
359
|
+
persona TEXT,
|
|
351
360
|
model TEXT,
|
|
352
361
|
page_context TEXT,
|
|
353
362
|
interrupt INTEGER NOT NULL DEFAULT 0,
|
|
@@ -543,6 +552,21 @@ var additiveColumns = [
|
|
|
543
552
|
table: "agent_tool_call",
|
|
544
553
|
column: "decided_via",
|
|
545
554
|
ddl: "ALTER TABLE agent_tool_call ADD COLUMN decided_via TEXT"
|
|
555
|
+
},
|
|
556
|
+
{
|
|
557
|
+
table: "agent_thread",
|
|
558
|
+
column: "persona",
|
|
559
|
+
ddl: "ALTER TABLE agent_thread ADD COLUMN persona TEXT"
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
table: "agent_message",
|
|
563
|
+
column: "persona",
|
|
564
|
+
ddl: "ALTER TABLE agent_message ADD COLUMN persona TEXT"
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
table: "agent_queued_message",
|
|
568
|
+
column: "persona",
|
|
569
|
+
ddl: "ALTER TABLE agent_queued_message ADD COLUMN persona TEXT"
|
|
546
570
|
}
|
|
547
571
|
];
|
|
548
572
|
async function ensureAgentSchema(db) {
|
|
@@ -590,6 +614,7 @@ var DrizzleAgentStore = class {
|
|
|
590
614
|
activeStreamId: null,
|
|
591
615
|
defaultAgent: null,
|
|
592
616
|
model: null,
|
|
617
|
+
persona: input.persona ?? null,
|
|
593
618
|
queuePause: null,
|
|
594
619
|
createdAt: now,
|
|
595
620
|
updatedAt: now,
|
|
@@ -697,6 +722,7 @@ var DrizzleAgentStore = class {
|
|
|
697
722
|
activeStreamId: null,
|
|
698
723
|
defaultAgent: source.defaultAgent,
|
|
699
724
|
model: source.model,
|
|
725
|
+
persona: source.persona,
|
|
700
726
|
// A fork is a new conversation: nothing is waiting on it, and nothing is paused.
|
|
701
727
|
queuePause: null,
|
|
702
728
|
createdAt: now,
|
|
@@ -716,6 +742,7 @@ var DrizzleAgentStore = class {
|
|
|
716
742
|
followUps: message.followUps,
|
|
717
743
|
usage: message.usage,
|
|
718
744
|
agentName: message.agentName,
|
|
745
|
+
persona: message.persona,
|
|
719
746
|
// The copy is the same message, so it keeps the run that wrote it. A reader asking which
|
|
720
747
|
// turn produced this text gets the truthful answer; the run's own thread is still the
|
|
721
748
|
// original, so a run-scoped read never picks the fork's rows up.
|
|
@@ -876,6 +903,7 @@ var DrizzleAgentStore = class {
|
|
|
876
903
|
content: input.content,
|
|
877
904
|
attachments: input.attachments !== void 0 && input.attachments.length > 0 ? input.attachments : null,
|
|
878
905
|
agentName: input.agentName ?? null,
|
|
906
|
+
persona: input.persona ?? null,
|
|
879
907
|
model: input.model ?? null,
|
|
880
908
|
pageContext: input.pageContext ?? null,
|
|
881
909
|
interrupt: input.interrupt === true,
|
|
@@ -971,6 +999,9 @@ var DrizzleAgentStore = class {
|
|
|
971
999
|
if (patch.model !== void 0) {
|
|
972
1000
|
updates.model = patch.model;
|
|
973
1001
|
}
|
|
1002
|
+
if (patch.persona !== void 0) {
|
|
1003
|
+
updates.persona = patch.persona;
|
|
1004
|
+
}
|
|
974
1005
|
if (Object.keys(updates).length === 0) {
|
|
975
1006
|
return;
|
|
976
1007
|
}
|
|
@@ -989,6 +1020,13 @@ var DrizzleAgentStore = class {
|
|
|
989
1020
|
}).from(agentThread).where(and(eq(agentThread.id, threadId), isNull(agentThread.deletedAt)));
|
|
990
1021
|
return thread?.model ?? null;
|
|
991
1022
|
}
|
|
1023
|
+
/** The thread's pinned persona, projected like {@link defaultAgentForThread}. */
|
|
1024
|
+
async personaForThread(threadId) {
|
|
1025
|
+
const [thread] = await this.db.select({
|
|
1026
|
+
persona: agentThread.persona
|
|
1027
|
+
}).from(agentThread).where(and(eq(agentThread.id, threadId), isNull(agentThread.deletedAt)));
|
|
1028
|
+
return thread?.persona ?? null;
|
|
1029
|
+
}
|
|
992
1030
|
async defaultAgentForThread(threadId) {
|
|
993
1031
|
const [thread] = await this.db.select({
|
|
994
1032
|
defaultAgent: agentThread.defaultAgent
|
|
@@ -1059,6 +1097,7 @@ var DrizzleAgentStore = class {
|
|
|
1059
1097
|
followUps: input.followUps ?? null,
|
|
1060
1098
|
usage: input.usage ?? null,
|
|
1061
1099
|
agentName: input.agentName ?? null,
|
|
1100
|
+
persona: input.persona ?? null,
|
|
1062
1101
|
runId: input.runId ?? null,
|
|
1063
1102
|
reasoning: input.reasoning ?? null,
|
|
1064
1103
|
reasoningMs: input.reasoningMs ?? null,
|
|
@@ -1189,7 +1228,8 @@ var DrizzleAgentStore = class {
|
|
|
1189
1228
|
return rows.length;
|
|
1190
1229
|
}
|
|
1191
1230
|
/**
|
|
1192
|
-
* Of `mediaIds`, the ones a surviving message in
|
|
1231
|
+
* Of `mediaIds`, the ones a surviving message — or a message waiting in the queue — in one of
|
|
1232
|
+
* this actor's threads still carries.
|
|
1193
1233
|
*
|
|
1194
1234
|
* Reads the `attachments` JSON back out and matches in memory rather than pushing the match into
|
|
1195
1235
|
* SQL: the column holds an array of objects, and every dialect this adapter's sibling targets
|
|
@@ -1208,9 +1248,15 @@ var DrizzleAgentStore = class {
|
|
|
1208
1248
|
const rows = await this.db.select({
|
|
1209
1249
|
attachments: agentMessage.attachments
|
|
1210
1250
|
}).from(agentMessage).innerJoin(agentThread, eq(agentMessage.threadId, agentThread.id)).where(and(eq(agentThread.actorRef, actorRef), isNotNull(agentMessage.attachments)));
|
|
1251
|
+
const queued = await this.db.select({
|
|
1252
|
+
attachments: agentQueuedMessage.attachments
|
|
1253
|
+
}).from(agentQueuedMessage).innerJoin(agentThread, eq(agentQueuedMessage.threadId, agentThread.id)).where(and(eq(agentThread.actorRef, actorRef), isNotNull(agentQueuedMessage.attachments)));
|
|
1211
1254
|
const wanted = new Set(mediaIds);
|
|
1212
1255
|
const found = /* @__PURE__ */ new Set();
|
|
1213
|
-
for (const row of
|
|
1256
|
+
for (const row of [
|
|
1257
|
+
...rows,
|
|
1258
|
+
...queued
|
|
1259
|
+
]) {
|
|
1214
1260
|
for (const attachment of row.attachments ?? []) {
|
|
1215
1261
|
if (wanted.has(attachment.mediaId)) {
|
|
1216
1262
|
found.add(attachment.mediaId);
|
|
@@ -1262,6 +1308,7 @@ var DrizzleAgentStore = class {
|
|
|
1262
1308
|
...thread.model != null ? {
|
|
1263
1309
|
model: thread.model
|
|
1264
1310
|
} : {},
|
|
1311
|
+
persona: thread.persona ?? null,
|
|
1265
1312
|
...lastContent !== void 0 ? {
|
|
1266
1313
|
lastMessagePreview: lastContent.slice(0, 120)
|
|
1267
1314
|
} : {}
|
|
@@ -1291,6 +1338,9 @@ var DrizzleAgentStore = class {
|
|
|
1291
1338
|
...message.agentName != null ? {
|
|
1292
1339
|
agentName: message.agentName
|
|
1293
1340
|
} : {},
|
|
1341
|
+
...message.persona != null ? {
|
|
1342
|
+
persona: message.persona
|
|
1343
|
+
} : {},
|
|
1294
1344
|
...message.runId != null ? {
|
|
1295
1345
|
runId: message.runId
|
|
1296
1346
|
} : {},
|
|
@@ -1321,6 +1371,9 @@ function toQueuedMessage(row) {
|
|
|
1321
1371
|
...row.agentName !== null ? {
|
|
1322
1372
|
agentName: row.agentName
|
|
1323
1373
|
} : {},
|
|
1374
|
+
...row.persona !== null ? {
|
|
1375
|
+
persona: row.persona
|
|
1376
|
+
} : {},
|
|
1324
1377
|
...row.model !== null ? {
|
|
1325
1378
|
model: row.model
|
|
1326
1379
|
} : {},
|