@dudousxd/nestjs-agent-store-drizzle 0.25.0 → 0.27.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
@@ -1,5 +1,5 @@
1
1
  import * as _dudousxd_nestjs_agent_core from '@dudousxd/nestjs-agent-core';
2
- import { MessageRole, ToolCallRequest, ToolResult, MessageAttachment, MessageUsage, AgentUiComponent, MessageFeedback, Actor, PageContext, QueuePause, ActionProposal, ToolKind, ToolCallStatus, ToolConfirmation, UsagePurpose, AgentStore, ThreadTurnReader, ChatQueueStore, ActionProposalStore, ActionProposalWorkerStore, ActionProposalDiscoveryIndexStore, ActionProposalOutcomeStore, ActionProposalStoreOptions, ActionProposalSupersessionStore, CreateThreadInput, ThreadSummary, ThreadDetail, ThreadTurnQuery, ThreadTurnPage, ToolCallApprovalState, EnqueueMessageInput, QueuedMessage, QueuedMessagePatch, UpdateThreadInput, RecordRunStartInput, AppendMessageInput, StoredMessage, RecordToolCallInput, UpdateToolCallInput, ToolCallOutcome, RecordUsageInput, CreateActionProposal, CreateActionProposalResult, ActionProposalScope, ActionProposalMutationResult, ListActionProposals, ActionProposalDecisionCommand, ClaimActionProposal, ExtendActionProposalLease, SettleActionProposal, ActionProposalOutcomeLease, AgentGovernanceQueries, AgentPricingStore, GovernanceRange, ModelSpendRow, ActorSpendRow, ThreadSpendRow, UsageTrendPoint, ToolCallActivityRow, ThreadActivityRow, RunMetrics, RunAgentBreakdownRow, RunErrorBreakdownRow, RunTrendPoint, RecentRunRow, PendingApprovalRow, ToolStatRow, GovernancePageQuery, ToolCallWhere, GovernancePage, ThreadWhere, RunWhere, ApprovalWhere, GovernanceRunDetail, GovernanceThreadDetailQuery, GovernanceThreadDetail, MemoryProvider, ListMemoriesInput, MemoryRecord, ForgetMemoryInput, StoreMemoryInput, ModelPriceInput, CurrentModelPrice, StreamFrameTable, StreamFrameRow, SqlTokenStreamSink, SqlTokenStreamSinkOptions, ConfirmTokenStore, ConfirmTokenClaim } from '@dudousxd/nestjs-agent-core';
2
+ import { MessageRole, ToolCallRequest, ToolResult, MessageAttachment, MessageUsage, AgentUiComponent, MessageFeedback, AgentHostContext, Actor, PageContext, QueuePause, ActionProposal, ToolKind, ToolCallStatus, ToolConfirmation, UsagePurpose, AgentStore, ThreadTurnReader, ChatQueueStore, ActionProposalStore, ActionProposalWorkerStore, ActionProposalDiscoveryIndexStore, ActionProposalOutcomeStore, ActionProposalStoreOptions, ActionProposalSupersessionStore, CreateThreadInput, ThreadSummary, ThreadDetail, ThreadTurnQuery, ThreadTurnPage, ToolCallApprovalState, EnqueueMessageInput, QueuedMessage, QueuedMessagePatch, UpdateThreadInput, RecordRunStartInput, AppendMessageInput, StoredMessage, RecordToolCallInput, UpdateToolCallInput, ToolCallOutcome, RecordUsageInput, CreateActionProposal, CreateActionProposalResult, ActionProposalScope, ActionProposalMutationResult, ListActionProposals, ActionProposalDecisionCommand, ClaimActionProposal, ExtendActionProposalLease, SettleActionProposal, ActionProposalOutcomeLease, AgentGovernanceQueries, AgentPricingStore, GovernanceRange, ModelSpendRow, ActorSpendRow, ThreadSpendRow, UsageTrendPoint, ToolCallActivityRow, ThreadActivityRow, RunMetrics, RunAgentBreakdownRow, RunErrorBreakdownRow, RunTrendPoint, RecentRunRow, PendingApprovalRow, ToolStatRow, GovernancePageQuery, ToolCallWhere, GovernancePage, ThreadWhere, RunWhere, ApprovalWhere, GovernanceRunDetail, GovernanceThreadDetailQuery, GovernanceThreadDetail, MemoryProvider, ListMemoriesInput, MemoryRecord, ForgetMemoryInput, StoreMemoryInput, ModelPriceInput, CurrentModelPrice, StreamFrameTable, StreamFrameRow, SqlTokenStreamSink, SqlTokenStreamSinkOptions, ConfirmTokenStore, ConfirmTokenClaim } from '@dudousxd/nestjs-agent-core';
3
3
  export { ThreadTurnPage, ThreadTurnQuery } from '@dudousxd/nestjs-agent-core';
4
4
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
5
5
  import { BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core';
@@ -1048,6 +1048,25 @@ declare const agentQueuedMessage: drizzle_orm_sqlite_core.SQLiteTableWithColumns
1048
1048
  }, {}, {
1049
1049
  $type: UiCapabilities;
1050
1050
  }>;
1051
+ hostContext: drizzle_orm_sqlite_core.SQLiteColumn<{
1052
+ name: "host_context";
1053
+ tableName: "agent_queued_message";
1054
+ dataType: "json";
1055
+ columnType: "SQLiteTextJson";
1056
+ data: AgentHostContext;
1057
+ driverParam: string;
1058
+ notNull: false;
1059
+ hasDefault: false;
1060
+ isPrimaryKey: false;
1061
+ isAutoincrement: false;
1062
+ hasRuntimeDefault: false;
1063
+ enumValues: undefined;
1064
+ baseColumn: never;
1065
+ identity: undefined;
1066
+ generated: undefined;
1067
+ }, {}, {
1068
+ $type: AgentHostContext;
1069
+ }>;
1051
1070
  id: drizzle_orm_sqlite_core.SQLiteColumn<{
1052
1071
  name: "id";
1053
1072
  tableName: "agent_queued_message";
@@ -3861,6 +3880,25 @@ declare const agentSchema: {
3861
3880
  }, {}, {
3862
3881
  $type: UiCapabilities;
3863
3882
  }>;
3883
+ hostContext: drizzle_orm_sqlite_core.SQLiteColumn<{
3884
+ name: "host_context";
3885
+ tableName: "agent_queued_message";
3886
+ dataType: "json";
3887
+ columnType: "SQLiteTextJson";
3888
+ data: AgentHostContext;
3889
+ driverParam: string;
3890
+ notNull: false;
3891
+ hasDefault: false;
3892
+ isPrimaryKey: false;
3893
+ isAutoincrement: false;
3894
+ hasRuntimeDefault: false;
3895
+ enumValues: undefined;
3896
+ baseColumn: never;
3897
+ identity: undefined;
3898
+ generated: undefined;
3899
+ }, {}, {
3900
+ $type: AgentHostContext;
3901
+ }>;
3864
3902
  id: drizzle_orm_sqlite_core.SQLiteColumn<{
3865
3903
  name: "id";
3866
3904
  tableName: "agent_queued_message";
@@ -5770,8 +5808,8 @@ declare function agentSchemaDdl(dialect: AgentDialect): string[];
5770
5808
 
5771
5809
  /**
5772
5810
  * {@link AgentStore} backed by Drizzle ORM — a second adapter alongside the MikroORM one, proving
5773
- * the store SPI is ORM-portable. A POJO receiving a Drizzle SQLite database handle (the host app
5774
- * owns the connection). Behaviour mirrors {@link import('@dudousxd/nestjs-agent-store-mikro-orm')}
5811
+ * the store SPI is ORM-portable. A POJO receiving a Drizzle database handle — SQLite, Postgres or
5812
+ * MySQL (the host app owns the connection). Behaviour mirrors {@link import('@dudousxd/nestjs-agent-store-mikro-orm')}
5775
5813
  * exactly (fork/truncate/quota/active-stream/soft-delete semantics) so the two are interchangeable.
5776
5814
  */
5777
5815
  declare class DrizzleAgentStore implements AgentStore, ThreadTurnReader, ChatQueueStore, ActionProposalStore, ActionProposalWorkerStore, ActionProposalDiscoveryIndexStore, ActionProposalOutcomeStore {
@@ -7373,6 +7411,25 @@ declare const pgAgentSchema: {
7373
7411
  }, {}, {
7374
7412
  $type: UiCapabilities;
7375
7413
  }>;
7414
+ hostContext: drizzle_orm_pg_core.PgColumn<{
7415
+ name: "host_context";
7416
+ tableName: "agent_queued_message";
7417
+ dataType: "json";
7418
+ columnType: "PgJsonb";
7419
+ data: AgentHostContext;
7420
+ driverParam: unknown;
7421
+ notNull: false;
7422
+ hasDefault: false;
7423
+ isPrimaryKey: false;
7424
+ isAutoincrement: false;
7425
+ hasRuntimeDefault: false;
7426
+ enumValues: undefined;
7427
+ baseColumn: never;
7428
+ identity: undefined;
7429
+ generated: undefined;
7430
+ }, {}, {
7431
+ $type: AgentHostContext;
7432
+ }>;
7376
7433
  id: drizzle_orm_pg_core.PgColumn<{
7377
7434
  name: "id";
7378
7435
  tableName: "agent_queued_message";
@@ -10021,6 +10078,25 @@ declare const mysqlAgentSchema: {
10021
10078
  }, {}, {
10022
10079
  $type: UiCapabilities;
10023
10080
  }>;
10081
+ hostContext: drizzle_orm_mysql_core.MySqlColumn<{
10082
+ name: "host_context";
10083
+ tableName: "agent_queued_message";
10084
+ dataType: "json";
10085
+ columnType: "MySqlJson";
10086
+ data: AgentHostContext;
10087
+ driverParam: string;
10088
+ notNull: false;
10089
+ hasDefault: false;
10090
+ isPrimaryKey: false;
10091
+ isAutoincrement: false;
10092
+ hasRuntimeDefault: false;
10093
+ enumValues: undefined;
10094
+ baseColumn: never;
10095
+ identity: undefined;
10096
+ generated: undefined;
10097
+ }, {}, {
10098
+ $type: AgentHostContext;
10099
+ }>;
10024
10100
  id: drizzle_orm_mysql_core.MySqlColumn<{
10025
10101
  name: string;
10026
10102
  tableName: "agent_queued_message";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _dudousxd_nestjs_agent_core from '@dudousxd/nestjs-agent-core';
2
- import { MessageRole, ToolCallRequest, ToolResult, MessageAttachment, MessageUsage, AgentUiComponent, MessageFeedback, Actor, PageContext, QueuePause, ActionProposal, ToolKind, ToolCallStatus, ToolConfirmation, UsagePurpose, AgentStore, ThreadTurnReader, ChatQueueStore, ActionProposalStore, ActionProposalWorkerStore, ActionProposalDiscoveryIndexStore, ActionProposalOutcomeStore, ActionProposalStoreOptions, ActionProposalSupersessionStore, CreateThreadInput, ThreadSummary, ThreadDetail, ThreadTurnQuery, ThreadTurnPage, ToolCallApprovalState, EnqueueMessageInput, QueuedMessage, QueuedMessagePatch, UpdateThreadInput, RecordRunStartInput, AppendMessageInput, StoredMessage, RecordToolCallInput, UpdateToolCallInput, ToolCallOutcome, RecordUsageInput, CreateActionProposal, CreateActionProposalResult, ActionProposalScope, ActionProposalMutationResult, ListActionProposals, ActionProposalDecisionCommand, ClaimActionProposal, ExtendActionProposalLease, SettleActionProposal, ActionProposalOutcomeLease, AgentGovernanceQueries, AgentPricingStore, GovernanceRange, ModelSpendRow, ActorSpendRow, ThreadSpendRow, UsageTrendPoint, ToolCallActivityRow, ThreadActivityRow, RunMetrics, RunAgentBreakdownRow, RunErrorBreakdownRow, RunTrendPoint, RecentRunRow, PendingApprovalRow, ToolStatRow, GovernancePageQuery, ToolCallWhere, GovernancePage, ThreadWhere, RunWhere, ApprovalWhere, GovernanceRunDetail, GovernanceThreadDetailQuery, GovernanceThreadDetail, MemoryProvider, ListMemoriesInput, MemoryRecord, ForgetMemoryInput, StoreMemoryInput, ModelPriceInput, CurrentModelPrice, StreamFrameTable, StreamFrameRow, SqlTokenStreamSink, SqlTokenStreamSinkOptions, ConfirmTokenStore, ConfirmTokenClaim } from '@dudousxd/nestjs-agent-core';
2
+ import { MessageRole, ToolCallRequest, ToolResult, MessageAttachment, MessageUsage, AgentUiComponent, MessageFeedback, AgentHostContext, Actor, PageContext, QueuePause, ActionProposal, ToolKind, ToolCallStatus, ToolConfirmation, UsagePurpose, AgentStore, ThreadTurnReader, ChatQueueStore, ActionProposalStore, ActionProposalWorkerStore, ActionProposalDiscoveryIndexStore, ActionProposalOutcomeStore, ActionProposalStoreOptions, ActionProposalSupersessionStore, CreateThreadInput, ThreadSummary, ThreadDetail, ThreadTurnQuery, ThreadTurnPage, ToolCallApprovalState, EnqueueMessageInput, QueuedMessage, QueuedMessagePatch, UpdateThreadInput, RecordRunStartInput, AppendMessageInput, StoredMessage, RecordToolCallInput, UpdateToolCallInput, ToolCallOutcome, RecordUsageInput, CreateActionProposal, CreateActionProposalResult, ActionProposalScope, ActionProposalMutationResult, ListActionProposals, ActionProposalDecisionCommand, ClaimActionProposal, ExtendActionProposalLease, SettleActionProposal, ActionProposalOutcomeLease, AgentGovernanceQueries, AgentPricingStore, GovernanceRange, ModelSpendRow, ActorSpendRow, ThreadSpendRow, UsageTrendPoint, ToolCallActivityRow, ThreadActivityRow, RunMetrics, RunAgentBreakdownRow, RunErrorBreakdownRow, RunTrendPoint, RecentRunRow, PendingApprovalRow, ToolStatRow, GovernancePageQuery, ToolCallWhere, GovernancePage, ThreadWhere, RunWhere, ApprovalWhere, GovernanceRunDetail, GovernanceThreadDetailQuery, GovernanceThreadDetail, MemoryProvider, ListMemoriesInput, MemoryRecord, ForgetMemoryInput, StoreMemoryInput, ModelPriceInput, CurrentModelPrice, StreamFrameTable, StreamFrameRow, SqlTokenStreamSink, SqlTokenStreamSinkOptions, ConfirmTokenStore, ConfirmTokenClaim } from '@dudousxd/nestjs-agent-core';
3
3
  export { ThreadTurnPage, ThreadTurnQuery } from '@dudousxd/nestjs-agent-core';
4
4
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
5
5
  import { BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core';
@@ -1048,6 +1048,25 @@ declare const agentQueuedMessage: drizzle_orm_sqlite_core.SQLiteTableWithColumns
1048
1048
  }, {}, {
1049
1049
  $type: UiCapabilities;
1050
1050
  }>;
1051
+ hostContext: drizzle_orm_sqlite_core.SQLiteColumn<{
1052
+ name: "host_context";
1053
+ tableName: "agent_queued_message";
1054
+ dataType: "json";
1055
+ columnType: "SQLiteTextJson";
1056
+ data: AgentHostContext;
1057
+ driverParam: string;
1058
+ notNull: false;
1059
+ hasDefault: false;
1060
+ isPrimaryKey: false;
1061
+ isAutoincrement: false;
1062
+ hasRuntimeDefault: false;
1063
+ enumValues: undefined;
1064
+ baseColumn: never;
1065
+ identity: undefined;
1066
+ generated: undefined;
1067
+ }, {}, {
1068
+ $type: AgentHostContext;
1069
+ }>;
1051
1070
  id: drizzle_orm_sqlite_core.SQLiteColumn<{
1052
1071
  name: "id";
1053
1072
  tableName: "agent_queued_message";
@@ -3861,6 +3880,25 @@ declare const agentSchema: {
3861
3880
  }, {}, {
3862
3881
  $type: UiCapabilities;
3863
3882
  }>;
3883
+ hostContext: drizzle_orm_sqlite_core.SQLiteColumn<{
3884
+ name: "host_context";
3885
+ tableName: "agent_queued_message";
3886
+ dataType: "json";
3887
+ columnType: "SQLiteTextJson";
3888
+ data: AgentHostContext;
3889
+ driverParam: string;
3890
+ notNull: false;
3891
+ hasDefault: false;
3892
+ isPrimaryKey: false;
3893
+ isAutoincrement: false;
3894
+ hasRuntimeDefault: false;
3895
+ enumValues: undefined;
3896
+ baseColumn: never;
3897
+ identity: undefined;
3898
+ generated: undefined;
3899
+ }, {}, {
3900
+ $type: AgentHostContext;
3901
+ }>;
3864
3902
  id: drizzle_orm_sqlite_core.SQLiteColumn<{
3865
3903
  name: "id";
3866
3904
  tableName: "agent_queued_message";
@@ -5770,8 +5808,8 @@ declare function agentSchemaDdl(dialect: AgentDialect): string[];
5770
5808
 
5771
5809
  /**
5772
5810
  * {@link AgentStore} backed by Drizzle ORM — a second adapter alongside the MikroORM one, proving
5773
- * the store SPI is ORM-portable. A POJO receiving a Drizzle SQLite database handle (the host app
5774
- * owns the connection). Behaviour mirrors {@link import('@dudousxd/nestjs-agent-store-mikro-orm')}
5811
+ * the store SPI is ORM-portable. A POJO receiving a Drizzle database handle — SQLite, Postgres or
5812
+ * MySQL (the host app owns the connection). Behaviour mirrors {@link import('@dudousxd/nestjs-agent-store-mikro-orm')}
5775
5813
  * exactly (fork/truncate/quota/active-stream/soft-delete semantics) so the two are interchangeable.
5776
5814
  */
5777
5815
  declare class DrizzleAgentStore implements AgentStore, ThreadTurnReader, ChatQueueStore, ActionProposalStore, ActionProposalWorkerStore, ActionProposalDiscoveryIndexStore, ActionProposalOutcomeStore {
@@ -7373,6 +7411,25 @@ declare const pgAgentSchema: {
7373
7411
  }, {}, {
7374
7412
  $type: UiCapabilities;
7375
7413
  }>;
7414
+ hostContext: drizzle_orm_pg_core.PgColumn<{
7415
+ name: "host_context";
7416
+ tableName: "agent_queued_message";
7417
+ dataType: "json";
7418
+ columnType: "PgJsonb";
7419
+ data: AgentHostContext;
7420
+ driverParam: unknown;
7421
+ notNull: false;
7422
+ hasDefault: false;
7423
+ isPrimaryKey: false;
7424
+ isAutoincrement: false;
7425
+ hasRuntimeDefault: false;
7426
+ enumValues: undefined;
7427
+ baseColumn: never;
7428
+ identity: undefined;
7429
+ generated: undefined;
7430
+ }, {}, {
7431
+ $type: AgentHostContext;
7432
+ }>;
7376
7433
  id: drizzle_orm_pg_core.PgColumn<{
7377
7434
  name: "id";
7378
7435
  tableName: "agent_queued_message";
@@ -10021,6 +10078,25 @@ declare const mysqlAgentSchema: {
10021
10078
  }, {}, {
10022
10079
  $type: UiCapabilities;
10023
10080
  }>;
10081
+ hostContext: drizzle_orm_mysql_core.MySqlColumn<{
10082
+ name: "host_context";
10083
+ tableName: "agent_queued_message";
10084
+ dataType: "json";
10085
+ columnType: "MySqlJson";
10086
+ data: AgentHostContext;
10087
+ driverParam: string;
10088
+ notNull: false;
10089
+ hasDefault: false;
10090
+ isPrimaryKey: false;
10091
+ isAutoincrement: false;
10092
+ hasRuntimeDefault: false;
10093
+ enumValues: undefined;
10094
+ baseColumn: never;
10095
+ identity: undefined;
10096
+ generated: undefined;
10097
+ }, {}, {
10098
+ $type: AgentHostContext;
10099
+ }>;
10024
10100
  id: drizzle_orm_mysql_core.MySqlColumn<{
10025
10101
  name: string;
10026
10102
  tableName: "agent_queued_message";
package/dist/index.js CHANGED
@@ -133,6 +133,9 @@ var agentQueuedMessage = sqliteTable("agent_queued_message", {
133
133
  uiCapabilities: text("ui_capabilities", {
134
134
  mode: "json"
135
135
  }).$type(),
136
+ hostContext: text("host_context", {
137
+ mode: "json"
138
+ }).$type(),
136
139
  id: text("id").primaryKey(),
137
140
  threadId: text("thread_id").notNull().references(() => agentThread.id, {
138
141
  onDelete: "cascade"
@@ -444,6 +447,7 @@ var agentToolCall2 = mysqlTable("agent_tool_call", {
444
447
  ]);
445
448
  var agentQueuedMessage2 = mysqlTable("agent_queued_message", {
446
449
  uiCapabilities: json("ui_capabilities").$type(),
450
+ hostContext: json("host_context").$type(),
447
451
  id: key("id").primaryKey(),
448
452
  threadId: key("thread_id").notNull().references(() => agentThread2.id, {
449
453
  onDelete: "cascade"
@@ -711,6 +715,7 @@ var agentToolCall3 = pgTable("agent_tool_call", {
711
715
  ]);
712
716
  var agentQueuedMessage3 = pgTable("agent_queued_message", {
713
717
  uiCapabilities: jsonb("ui_capabilities").$type(),
718
+ hostContext: jsonb("host_context").$type(),
714
719
  id: text2("id").primaryKey(),
715
720
  threadId: text2("thread_id").notNull().references(() => agentThread3.id, {
716
721
  onDelete: "cascade"
@@ -1149,6 +1154,8 @@ function actionProposalTransactionMode(kind) {
1149
1154
  if (kind !== void 0 && [
1150
1155
  "NodePgDatabase",
1151
1156
  "NodePgTransaction",
1157
+ "PostgresJsDatabase",
1158
+ "PostgresJsTransaction",
1152
1159
  "MySql2Database",
1153
1160
  "MySql2Transaction",
1154
1161
  "LibSQLDatabase",
@@ -2067,6 +2074,7 @@ var DrizzleAgentStore = class {
2067
2074
  actor: input.actor,
2068
2075
  content: input.content,
2069
2076
  uiCapabilities: input.uiCapabilities ?? null,
2077
+ hostContext: input.hostContext ?? null,
2070
2078
  attachments: input.attachments !== void 0 && input.attachments.length > 0 ? input.attachments : null,
2071
2079
  agentName: input.agentName ?? null,
2072
2080
  persona: input.persona ?? null,
@@ -2534,6 +2542,9 @@ function toQueuedMessage(row) {
2534
2542
  ...row.uiCapabilities !== null ? {
2535
2543
  uiCapabilities: row.uiCapabilities
2536
2544
  } : {},
2545
+ ...row.hostContext != null ? {
2546
+ hostContext: row.hostContext
2547
+ } : {},
2537
2548
  id: row.id,
2538
2549
  threadId: row.threadId,
2539
2550
  actor: row.actor,