@dudousxd/nestjs-agent-store-drizzle 0.20.2 → 0.21.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,6 +1,6 @@
1
1
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
2
2
  import { BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core';
3
- import { MessageRole, ToolCallRequest, ToolResult, MessageAttachment, MessageUsage, AgentUiComponent, MessageFeedback, Actor, PageContext, QueuePause, ToolKind, ToolCallStatus, UsagePurpose, AgentStore, ThreadTurnReader, ChatQueueStore, CreateThreadInput, ThreadSummary, ThreadDetail, ThreadTurnQuery, ThreadTurnPage, ToolCallApprovalState, EnqueueMessageInput, QueuedMessage, QueuedMessagePatch, UpdateThreadInput, RecordRunStartInput, AppendMessageInput, StoredMessage, RecordToolCallInput, UpdateToolCallInput, ToolCallOutcome, RecordUsageInput, 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 } from '@dudousxd/nestjs-agent-core';
3
+ import { MessageRole, ToolCallRequest, ToolResult, MessageAttachment, MessageUsage, AgentUiComponent, MessageFeedback, Actor, PageContext, QueuePause, ToolKind, ToolCallStatus, UsagePurpose, AgentStore, ThreadTurnReader, ChatQueueStore, CreateThreadInput, ThreadSummary, ThreadDetail, ThreadTurnQuery, ThreadTurnPage, ToolCallApprovalState, EnqueueMessageInput, QueuedMessage, QueuedMessagePatch, UpdateThreadInput, RecordRunStartInput, AppendMessageInput, StoredMessage, RecordToolCallInput, UpdateToolCallInput, ToolCallOutcome, RecordUsageInput, 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, ConfirmTokenStore, ConfirmTokenClaim } from '@dudousxd/nestjs-agent-core';
4
4
  export { ThreadTurnPage, ThreadTurnQuery } from '@dudousxd/nestjs-agent-core';
5
5
  import { TablesRelationalConfig, SQL } from 'drizzle-orm';
6
6
  import { OnModuleInit, OnModuleDestroy, Type, DynamicModule } from '@nestjs/common';
@@ -2243,6 +2243,110 @@ declare const ragIngestionLog: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
2243
2243
  };
2244
2244
  dialect: "sqlite";
2245
2245
  }>;
2246
+ /**
2247
+ * Spent confirm tokens (`defineConfirmedTool`), one row per token, keyed by its SHA-256 — the
2248
+ * primary key is the lock that makes a confirmation single use across replicas. Only the hash, the
2249
+ * actor and the tool are kept, never an argument. `expires_at` is epoch-ms; past it the row is dead
2250
+ * weight for `DrizzleConfirmTokenStore.purgeExpired`.
2251
+ */
2252
+ declare const agentConfirmToken: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
2253
+ name: "agent_confirm_token";
2254
+ schema: undefined;
2255
+ columns: {
2256
+ hash: drizzle_orm_sqlite_core.SQLiteColumn<{
2257
+ name: "hash";
2258
+ tableName: "agent_confirm_token";
2259
+ dataType: "string";
2260
+ columnType: "SQLiteText";
2261
+ data: string;
2262
+ driverParam: string;
2263
+ notNull: true;
2264
+ hasDefault: false;
2265
+ isPrimaryKey: true;
2266
+ isAutoincrement: false;
2267
+ hasRuntimeDefault: false;
2268
+ enumValues: [string, ...string[]];
2269
+ baseColumn: never;
2270
+ identity: undefined;
2271
+ generated: undefined;
2272
+ }, {}, {
2273
+ length: number | undefined;
2274
+ }>;
2275
+ actorRef: drizzle_orm_sqlite_core.SQLiteColumn<{
2276
+ name: "actor_ref";
2277
+ tableName: "agent_confirm_token";
2278
+ dataType: "string";
2279
+ columnType: "SQLiteText";
2280
+ data: string;
2281
+ driverParam: string;
2282
+ notNull: true;
2283
+ hasDefault: false;
2284
+ isPrimaryKey: false;
2285
+ isAutoincrement: false;
2286
+ hasRuntimeDefault: false;
2287
+ enumValues: [string, ...string[]];
2288
+ baseColumn: never;
2289
+ identity: undefined;
2290
+ generated: undefined;
2291
+ }, {}, {
2292
+ length: number | undefined;
2293
+ }>;
2294
+ tool: drizzle_orm_sqlite_core.SQLiteColumn<{
2295
+ name: "tool";
2296
+ tableName: "agent_confirm_token";
2297
+ dataType: "string";
2298
+ columnType: "SQLiteText";
2299
+ data: string;
2300
+ driverParam: string;
2301
+ notNull: true;
2302
+ hasDefault: false;
2303
+ isPrimaryKey: false;
2304
+ isAutoincrement: false;
2305
+ hasRuntimeDefault: false;
2306
+ enumValues: [string, ...string[]];
2307
+ baseColumn: never;
2308
+ identity: undefined;
2309
+ generated: undefined;
2310
+ }, {}, {
2311
+ length: number | undefined;
2312
+ }>;
2313
+ expiresAt: drizzle_orm_sqlite_core.SQLiteColumn<{
2314
+ name: "expires_at";
2315
+ tableName: "agent_confirm_token";
2316
+ dataType: "number";
2317
+ columnType: "SQLiteInteger";
2318
+ data: number;
2319
+ driverParam: number;
2320
+ notNull: true;
2321
+ hasDefault: false;
2322
+ isPrimaryKey: false;
2323
+ isAutoincrement: false;
2324
+ hasRuntimeDefault: false;
2325
+ enumValues: undefined;
2326
+ baseColumn: never;
2327
+ identity: undefined;
2328
+ generated: undefined;
2329
+ }, {}, {}>;
2330
+ createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
2331
+ name: "created_at";
2332
+ tableName: "agent_confirm_token";
2333
+ dataType: "number";
2334
+ columnType: "SQLiteInteger";
2335
+ data: number;
2336
+ driverParam: number;
2337
+ notNull: true;
2338
+ hasDefault: false;
2339
+ isPrimaryKey: false;
2340
+ isAutoincrement: false;
2341
+ hasRuntimeDefault: false;
2342
+ enumValues: undefined;
2343
+ baseColumn: never;
2344
+ identity: undefined;
2345
+ generated: undefined;
2346
+ }, {}, {}>;
2347
+ };
2348
+ dialect: "sqlite";
2349
+ }>;
2246
2350
  /** The tables this store owns, as one schema object, ready for `drizzle(client, { schema })`. */
2247
2351
  declare const agentSchema: {
2248
2352
  agentThread: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
@@ -4401,6 +4505,104 @@ declare const agentSchema: {
4401
4505
  };
4402
4506
  dialect: "sqlite";
4403
4507
  }>;
4508
+ agentConfirmToken: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
4509
+ name: "agent_confirm_token";
4510
+ schema: undefined;
4511
+ columns: {
4512
+ hash: drizzle_orm_sqlite_core.SQLiteColumn<{
4513
+ name: "hash";
4514
+ tableName: "agent_confirm_token";
4515
+ dataType: "string";
4516
+ columnType: "SQLiteText";
4517
+ data: string;
4518
+ driverParam: string;
4519
+ notNull: true;
4520
+ hasDefault: false;
4521
+ isPrimaryKey: true;
4522
+ isAutoincrement: false;
4523
+ hasRuntimeDefault: false;
4524
+ enumValues: [string, ...string[]];
4525
+ baseColumn: never;
4526
+ identity: undefined;
4527
+ generated: undefined;
4528
+ }, {}, {
4529
+ length: number | undefined;
4530
+ }>;
4531
+ actorRef: drizzle_orm_sqlite_core.SQLiteColumn<{
4532
+ name: "actor_ref";
4533
+ tableName: "agent_confirm_token";
4534
+ dataType: "string";
4535
+ columnType: "SQLiteText";
4536
+ data: string;
4537
+ driverParam: string;
4538
+ notNull: true;
4539
+ hasDefault: false;
4540
+ isPrimaryKey: false;
4541
+ isAutoincrement: false;
4542
+ hasRuntimeDefault: false;
4543
+ enumValues: [string, ...string[]];
4544
+ baseColumn: never;
4545
+ identity: undefined;
4546
+ generated: undefined;
4547
+ }, {}, {
4548
+ length: number | undefined;
4549
+ }>;
4550
+ tool: drizzle_orm_sqlite_core.SQLiteColumn<{
4551
+ name: "tool";
4552
+ tableName: "agent_confirm_token";
4553
+ dataType: "string";
4554
+ columnType: "SQLiteText";
4555
+ data: string;
4556
+ driverParam: string;
4557
+ notNull: true;
4558
+ hasDefault: false;
4559
+ isPrimaryKey: false;
4560
+ isAutoincrement: false;
4561
+ hasRuntimeDefault: false;
4562
+ enumValues: [string, ...string[]];
4563
+ baseColumn: never;
4564
+ identity: undefined;
4565
+ generated: undefined;
4566
+ }, {}, {
4567
+ length: number | undefined;
4568
+ }>;
4569
+ expiresAt: drizzle_orm_sqlite_core.SQLiteColumn<{
4570
+ name: "expires_at";
4571
+ tableName: "agent_confirm_token";
4572
+ dataType: "number";
4573
+ columnType: "SQLiteInteger";
4574
+ data: number;
4575
+ driverParam: number;
4576
+ notNull: true;
4577
+ hasDefault: false;
4578
+ isPrimaryKey: false;
4579
+ isAutoincrement: false;
4580
+ hasRuntimeDefault: false;
4581
+ enumValues: undefined;
4582
+ baseColumn: never;
4583
+ identity: undefined;
4584
+ generated: undefined;
4585
+ }, {}, {}>;
4586
+ createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
4587
+ name: "created_at";
4588
+ tableName: "agent_confirm_token";
4589
+ dataType: "number";
4590
+ columnType: "SQLiteInteger";
4591
+ data: number;
4592
+ driverParam: number;
4593
+ notNull: true;
4594
+ hasDefault: false;
4595
+ isPrimaryKey: false;
4596
+ isAutoincrement: false;
4597
+ hasRuntimeDefault: false;
4598
+ enumValues: undefined;
4599
+ baseColumn: never;
4600
+ identity: undefined;
4601
+ generated: undefined;
4602
+ }, {}, {}>;
4603
+ };
4604
+ dialect: "sqlite";
4605
+ }>;
4404
4606
  };
4405
4607
  /**
4406
4608
  * The dialect-portable Drizzle SQLite database handle the store operates on. Accepts any SQLite
@@ -4745,6 +4947,25 @@ declare class DrizzlePricingStore implements AgentPricingStore {
4745
4947
  listCurrentPrices(): Promise<CurrentModelPrice[]>;
4746
4948
  }
4747
4949
 
4950
+ /**
4951
+ * A production `ConfirmTokenStore` (`defineConfirmedTool`) over the `agent_confirm_token` table —
4952
+ * what makes a confirmed write single use across replicas.
4953
+ *
4954
+ * `claim` is one `INSERT … ON CONFLICT DO NOTHING RETURNING`, so the primary key is the lock: of two
4955
+ * concurrent confirmations one inserts and the other touches no row. A statement that does not FAIL
4956
+ * on the duplicate, rather than an insert whose violation is caught, so it never aborts a
4957
+ * surrounding transaction. Only the token's SHA-256, the actor and the tool name are stored; call
4958
+ * {@link purgeExpired} from a scheduled job to drop the dead rows. The table comes from
4959
+ * `ensureAgentSchema` (or your own migration).
4960
+ */
4961
+ declare class DrizzleConfirmTokenStore implements ConfirmTokenStore {
4962
+ private readonly db;
4963
+ constructor(db: AgentDrizzleDb);
4964
+ claim(input: ConfirmTokenClaim): Promise<boolean>;
4965
+ release(hash: string): Promise<void>;
4966
+ purgeExpired(now?: number): Promise<number>;
4967
+ }
4968
+
4748
4969
  /**
4749
4970
  * The paging order: newest first, tiebroken on the primary key.
4750
4971
  *
@@ -4956,7 +5177,8 @@ interface DrizzleAgentStoreModuleOptions {
4956
5177
  * Binds {@link DrizzleAgentStore} to the {@link AGENT_STORE} token consumed by
4957
5178
  * `@dudousxd/nestjs-agent`, plus {@link DrizzleGovernanceQueries} to
4958
5179
  * {@link AGENT_GOVERNANCE_QUERIES} (the read-model the dashboard/telescope surfaces consume) and
4959
- * {@link DrizzlePricingStore} to {@link AGENT_PRICING_STORE} (the write side of that pricing table).
5180
+ * {@link DrizzlePricingStore} to {@link AGENT_PRICING_STORE} (the write side of that pricing table),
5181
+ * and {@link DrizzleConfirmTokenStore} to {@link AGENT_CONFIRM_TOKEN_STORE} (confirmed writes).
4960
5182
  * The host app supplies an already-opened Drizzle db — this module never opens a connection itself.
4961
5183
  *
4962
5184
  * The returned module is global, so {@link AGENT_STORE}, {@link AGENT_GOVERNANCE_QUERIES} and
@@ -4973,4 +5195,4 @@ declare class DrizzleAgentStoreModule {
4973
5195
  static forRoot(options: DrizzleAgentStoreModuleOptions): DynamicModule;
4974
5196
  }
4975
5197
 
4976
- export { type AgentDrizzleDb, type AgentMemoryRow, type AgentMessageRow, type AgentQueuedMessageRow, type AgentRunRow, type AgentRunStatus, type AgentThreadRow, DrizzleAgentStore, DrizzleAgentStoreModule, type DrizzleAgentStoreModuleOptions, DrizzleGovernanceQueries, DrizzleMemoryProvider, DrizzlePricingStore, DrizzleRagIngestionLog, RAG_INGESTION_LOG_PAGE_ORDER, type RagIngestionLogCursor, type RagIngestionLogIterateOptions, type RagIngestionLogQuery, type RagIngestionLogRow, type RagIngestionLogWhere, type RagIngestionStatus, agentMemory, agentMessage, agentModelPricing, agentQueuedMessage, agentRun, agentSchema, agentThread, agentTokenUsage, agentToolCall, ensureAgentSchema, ragIngestionLog };
5198
+ export { type AgentDrizzleDb, type AgentMemoryRow, type AgentMessageRow, type AgentQueuedMessageRow, type AgentRunRow, type AgentRunStatus, type AgentThreadRow, DrizzleAgentStore, DrizzleAgentStoreModule, type DrizzleAgentStoreModuleOptions, DrizzleConfirmTokenStore, DrizzleGovernanceQueries, DrizzleMemoryProvider, DrizzlePricingStore, DrizzleRagIngestionLog, RAG_INGESTION_LOG_PAGE_ORDER, type RagIngestionLogCursor, type RagIngestionLogIterateOptions, type RagIngestionLogQuery, type RagIngestionLogRow, type RagIngestionLogWhere, type RagIngestionStatus, agentConfirmToken, agentMemory, agentMessage, agentModelPricing, agentQueuedMessage, agentRun, agentSchema, agentThread, agentTokenUsage, agentToolCall, ensureAgentSchema, ragIngestionLog };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
2
2
  import { BaseSQLiteDatabase } from 'drizzle-orm/sqlite-core';
3
- import { MessageRole, ToolCallRequest, ToolResult, MessageAttachment, MessageUsage, AgentUiComponent, MessageFeedback, Actor, PageContext, QueuePause, ToolKind, ToolCallStatus, UsagePurpose, AgentStore, ThreadTurnReader, ChatQueueStore, CreateThreadInput, ThreadSummary, ThreadDetail, ThreadTurnQuery, ThreadTurnPage, ToolCallApprovalState, EnqueueMessageInput, QueuedMessage, QueuedMessagePatch, UpdateThreadInput, RecordRunStartInput, AppendMessageInput, StoredMessage, RecordToolCallInput, UpdateToolCallInput, ToolCallOutcome, RecordUsageInput, 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 } from '@dudousxd/nestjs-agent-core';
3
+ import { MessageRole, ToolCallRequest, ToolResult, MessageAttachment, MessageUsage, AgentUiComponent, MessageFeedback, Actor, PageContext, QueuePause, ToolKind, ToolCallStatus, UsagePurpose, AgentStore, ThreadTurnReader, ChatQueueStore, CreateThreadInput, ThreadSummary, ThreadDetail, ThreadTurnQuery, ThreadTurnPage, ToolCallApprovalState, EnqueueMessageInput, QueuedMessage, QueuedMessagePatch, UpdateThreadInput, RecordRunStartInput, AppendMessageInput, StoredMessage, RecordToolCallInput, UpdateToolCallInput, ToolCallOutcome, RecordUsageInput, 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, ConfirmTokenStore, ConfirmTokenClaim } from '@dudousxd/nestjs-agent-core';
4
4
  export { ThreadTurnPage, ThreadTurnQuery } from '@dudousxd/nestjs-agent-core';
5
5
  import { TablesRelationalConfig, SQL } from 'drizzle-orm';
6
6
  import { OnModuleInit, OnModuleDestroy, Type, DynamicModule } from '@nestjs/common';
@@ -2243,6 +2243,110 @@ declare const ragIngestionLog: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
2243
2243
  };
2244
2244
  dialect: "sqlite";
2245
2245
  }>;
2246
+ /**
2247
+ * Spent confirm tokens (`defineConfirmedTool`), one row per token, keyed by its SHA-256 — the
2248
+ * primary key is the lock that makes a confirmation single use across replicas. Only the hash, the
2249
+ * actor and the tool are kept, never an argument. `expires_at` is epoch-ms; past it the row is dead
2250
+ * weight for `DrizzleConfirmTokenStore.purgeExpired`.
2251
+ */
2252
+ declare const agentConfirmToken: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
2253
+ name: "agent_confirm_token";
2254
+ schema: undefined;
2255
+ columns: {
2256
+ hash: drizzle_orm_sqlite_core.SQLiteColumn<{
2257
+ name: "hash";
2258
+ tableName: "agent_confirm_token";
2259
+ dataType: "string";
2260
+ columnType: "SQLiteText";
2261
+ data: string;
2262
+ driverParam: string;
2263
+ notNull: true;
2264
+ hasDefault: false;
2265
+ isPrimaryKey: true;
2266
+ isAutoincrement: false;
2267
+ hasRuntimeDefault: false;
2268
+ enumValues: [string, ...string[]];
2269
+ baseColumn: never;
2270
+ identity: undefined;
2271
+ generated: undefined;
2272
+ }, {}, {
2273
+ length: number | undefined;
2274
+ }>;
2275
+ actorRef: drizzle_orm_sqlite_core.SQLiteColumn<{
2276
+ name: "actor_ref";
2277
+ tableName: "agent_confirm_token";
2278
+ dataType: "string";
2279
+ columnType: "SQLiteText";
2280
+ data: string;
2281
+ driverParam: string;
2282
+ notNull: true;
2283
+ hasDefault: false;
2284
+ isPrimaryKey: false;
2285
+ isAutoincrement: false;
2286
+ hasRuntimeDefault: false;
2287
+ enumValues: [string, ...string[]];
2288
+ baseColumn: never;
2289
+ identity: undefined;
2290
+ generated: undefined;
2291
+ }, {}, {
2292
+ length: number | undefined;
2293
+ }>;
2294
+ tool: drizzle_orm_sqlite_core.SQLiteColumn<{
2295
+ name: "tool";
2296
+ tableName: "agent_confirm_token";
2297
+ dataType: "string";
2298
+ columnType: "SQLiteText";
2299
+ data: string;
2300
+ driverParam: string;
2301
+ notNull: true;
2302
+ hasDefault: false;
2303
+ isPrimaryKey: false;
2304
+ isAutoincrement: false;
2305
+ hasRuntimeDefault: false;
2306
+ enumValues: [string, ...string[]];
2307
+ baseColumn: never;
2308
+ identity: undefined;
2309
+ generated: undefined;
2310
+ }, {}, {
2311
+ length: number | undefined;
2312
+ }>;
2313
+ expiresAt: drizzle_orm_sqlite_core.SQLiteColumn<{
2314
+ name: "expires_at";
2315
+ tableName: "agent_confirm_token";
2316
+ dataType: "number";
2317
+ columnType: "SQLiteInteger";
2318
+ data: number;
2319
+ driverParam: number;
2320
+ notNull: true;
2321
+ hasDefault: false;
2322
+ isPrimaryKey: false;
2323
+ isAutoincrement: false;
2324
+ hasRuntimeDefault: false;
2325
+ enumValues: undefined;
2326
+ baseColumn: never;
2327
+ identity: undefined;
2328
+ generated: undefined;
2329
+ }, {}, {}>;
2330
+ createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
2331
+ name: "created_at";
2332
+ tableName: "agent_confirm_token";
2333
+ dataType: "number";
2334
+ columnType: "SQLiteInteger";
2335
+ data: number;
2336
+ driverParam: number;
2337
+ notNull: true;
2338
+ hasDefault: false;
2339
+ isPrimaryKey: false;
2340
+ isAutoincrement: false;
2341
+ hasRuntimeDefault: false;
2342
+ enumValues: undefined;
2343
+ baseColumn: never;
2344
+ identity: undefined;
2345
+ generated: undefined;
2346
+ }, {}, {}>;
2347
+ };
2348
+ dialect: "sqlite";
2349
+ }>;
2246
2350
  /** The tables this store owns, as one schema object, ready for `drizzle(client, { schema })`. */
2247
2351
  declare const agentSchema: {
2248
2352
  agentThread: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
@@ -4401,6 +4505,104 @@ declare const agentSchema: {
4401
4505
  };
4402
4506
  dialect: "sqlite";
4403
4507
  }>;
4508
+ agentConfirmToken: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
4509
+ name: "agent_confirm_token";
4510
+ schema: undefined;
4511
+ columns: {
4512
+ hash: drizzle_orm_sqlite_core.SQLiteColumn<{
4513
+ name: "hash";
4514
+ tableName: "agent_confirm_token";
4515
+ dataType: "string";
4516
+ columnType: "SQLiteText";
4517
+ data: string;
4518
+ driverParam: string;
4519
+ notNull: true;
4520
+ hasDefault: false;
4521
+ isPrimaryKey: true;
4522
+ isAutoincrement: false;
4523
+ hasRuntimeDefault: false;
4524
+ enumValues: [string, ...string[]];
4525
+ baseColumn: never;
4526
+ identity: undefined;
4527
+ generated: undefined;
4528
+ }, {}, {
4529
+ length: number | undefined;
4530
+ }>;
4531
+ actorRef: drizzle_orm_sqlite_core.SQLiteColumn<{
4532
+ name: "actor_ref";
4533
+ tableName: "agent_confirm_token";
4534
+ dataType: "string";
4535
+ columnType: "SQLiteText";
4536
+ data: string;
4537
+ driverParam: string;
4538
+ notNull: true;
4539
+ hasDefault: false;
4540
+ isPrimaryKey: false;
4541
+ isAutoincrement: false;
4542
+ hasRuntimeDefault: false;
4543
+ enumValues: [string, ...string[]];
4544
+ baseColumn: never;
4545
+ identity: undefined;
4546
+ generated: undefined;
4547
+ }, {}, {
4548
+ length: number | undefined;
4549
+ }>;
4550
+ tool: drizzle_orm_sqlite_core.SQLiteColumn<{
4551
+ name: "tool";
4552
+ tableName: "agent_confirm_token";
4553
+ dataType: "string";
4554
+ columnType: "SQLiteText";
4555
+ data: string;
4556
+ driverParam: string;
4557
+ notNull: true;
4558
+ hasDefault: false;
4559
+ isPrimaryKey: false;
4560
+ isAutoincrement: false;
4561
+ hasRuntimeDefault: false;
4562
+ enumValues: [string, ...string[]];
4563
+ baseColumn: never;
4564
+ identity: undefined;
4565
+ generated: undefined;
4566
+ }, {}, {
4567
+ length: number | undefined;
4568
+ }>;
4569
+ expiresAt: drizzle_orm_sqlite_core.SQLiteColumn<{
4570
+ name: "expires_at";
4571
+ tableName: "agent_confirm_token";
4572
+ dataType: "number";
4573
+ columnType: "SQLiteInteger";
4574
+ data: number;
4575
+ driverParam: number;
4576
+ notNull: true;
4577
+ hasDefault: false;
4578
+ isPrimaryKey: false;
4579
+ isAutoincrement: false;
4580
+ hasRuntimeDefault: false;
4581
+ enumValues: undefined;
4582
+ baseColumn: never;
4583
+ identity: undefined;
4584
+ generated: undefined;
4585
+ }, {}, {}>;
4586
+ createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
4587
+ name: "created_at";
4588
+ tableName: "agent_confirm_token";
4589
+ dataType: "number";
4590
+ columnType: "SQLiteInteger";
4591
+ data: number;
4592
+ driverParam: number;
4593
+ notNull: true;
4594
+ hasDefault: false;
4595
+ isPrimaryKey: false;
4596
+ isAutoincrement: false;
4597
+ hasRuntimeDefault: false;
4598
+ enumValues: undefined;
4599
+ baseColumn: never;
4600
+ identity: undefined;
4601
+ generated: undefined;
4602
+ }, {}, {}>;
4603
+ };
4604
+ dialect: "sqlite";
4605
+ }>;
4404
4606
  };
4405
4607
  /**
4406
4608
  * The dialect-portable Drizzle SQLite database handle the store operates on. Accepts any SQLite
@@ -4745,6 +4947,25 @@ declare class DrizzlePricingStore implements AgentPricingStore {
4745
4947
  listCurrentPrices(): Promise<CurrentModelPrice[]>;
4746
4948
  }
4747
4949
 
4950
+ /**
4951
+ * A production `ConfirmTokenStore` (`defineConfirmedTool`) over the `agent_confirm_token` table —
4952
+ * what makes a confirmed write single use across replicas.
4953
+ *
4954
+ * `claim` is one `INSERT … ON CONFLICT DO NOTHING RETURNING`, so the primary key is the lock: of two
4955
+ * concurrent confirmations one inserts and the other touches no row. A statement that does not FAIL
4956
+ * on the duplicate, rather than an insert whose violation is caught, so it never aborts a
4957
+ * surrounding transaction. Only the token's SHA-256, the actor and the tool name are stored; call
4958
+ * {@link purgeExpired} from a scheduled job to drop the dead rows. The table comes from
4959
+ * `ensureAgentSchema` (or your own migration).
4960
+ */
4961
+ declare class DrizzleConfirmTokenStore implements ConfirmTokenStore {
4962
+ private readonly db;
4963
+ constructor(db: AgentDrizzleDb);
4964
+ claim(input: ConfirmTokenClaim): Promise<boolean>;
4965
+ release(hash: string): Promise<void>;
4966
+ purgeExpired(now?: number): Promise<number>;
4967
+ }
4968
+
4748
4969
  /**
4749
4970
  * The paging order: newest first, tiebroken on the primary key.
4750
4971
  *
@@ -4956,7 +5177,8 @@ interface DrizzleAgentStoreModuleOptions {
4956
5177
  * Binds {@link DrizzleAgentStore} to the {@link AGENT_STORE} token consumed by
4957
5178
  * `@dudousxd/nestjs-agent`, plus {@link DrizzleGovernanceQueries} to
4958
5179
  * {@link AGENT_GOVERNANCE_QUERIES} (the read-model the dashboard/telescope surfaces consume) and
4959
- * {@link DrizzlePricingStore} to {@link AGENT_PRICING_STORE} (the write side of that pricing table).
5180
+ * {@link DrizzlePricingStore} to {@link AGENT_PRICING_STORE} (the write side of that pricing table),
5181
+ * and {@link DrizzleConfirmTokenStore} to {@link AGENT_CONFIRM_TOKEN_STORE} (confirmed writes).
4960
5182
  * The host app supplies an already-opened Drizzle db — this module never opens a connection itself.
4961
5183
  *
4962
5184
  * The returned module is global, so {@link AGENT_STORE}, {@link AGENT_GOVERNANCE_QUERIES} and
@@ -4973,4 +5195,4 @@ declare class DrizzleAgentStoreModule {
4973
5195
  static forRoot(options: DrizzleAgentStoreModuleOptions): DynamicModule;
4974
5196
  }
4975
5197
 
4976
- export { type AgentDrizzleDb, type AgentMemoryRow, type AgentMessageRow, type AgentQueuedMessageRow, type AgentRunRow, type AgentRunStatus, type AgentThreadRow, DrizzleAgentStore, DrizzleAgentStoreModule, type DrizzleAgentStoreModuleOptions, DrizzleGovernanceQueries, DrizzleMemoryProvider, DrizzlePricingStore, DrizzleRagIngestionLog, RAG_INGESTION_LOG_PAGE_ORDER, type RagIngestionLogCursor, type RagIngestionLogIterateOptions, type RagIngestionLogQuery, type RagIngestionLogRow, type RagIngestionLogWhere, type RagIngestionStatus, agentMemory, agentMessage, agentModelPricing, agentQueuedMessage, agentRun, agentSchema, agentThread, agentTokenUsage, agentToolCall, ensureAgentSchema, ragIngestionLog };
5198
+ export { type AgentDrizzleDb, type AgentMemoryRow, type AgentMessageRow, type AgentQueuedMessageRow, type AgentRunRow, type AgentRunStatus, type AgentThreadRow, DrizzleAgentStore, DrizzleAgentStoreModule, type DrizzleAgentStoreModuleOptions, DrizzleConfirmTokenStore, DrizzleGovernanceQueries, DrizzleMemoryProvider, DrizzlePricingStore, DrizzleRagIngestionLog, RAG_INGESTION_LOG_PAGE_ORDER, type RagIngestionLogCursor, type RagIngestionLogIterateOptions, type RagIngestionLogQuery, type RagIngestionLogRow, type RagIngestionLogWhere, type RagIngestionStatus, agentConfirmToken, agentMemory, agentMessage, agentModelPricing, agentQueuedMessage, agentRun, agentSchema, agentThread, agentTokenUsage, agentToolCall, ensureAgentSchema, ragIngestionLog };