@dudousxd/nestjs-agent-store-drizzle 0.35.0 → 0.36.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.cjs +12 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +70 -2
- package/dist/index.d.ts +70 -2
- package/dist/index.js +23 -14
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
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, AgentHostContext, Actor, PageContext, RunStepTiming, QueuePause, ActionProposal, GenuiValidity, GenuiErrorCategory, CostSource, ToolKind, ToolCallStatus, ToolConfirmation, UsagePurpose, AgentStore, ThreadTurnReader, ThreadSettingsReader, ChatQueueStore, ActionProposalStore, ActionProposalWorkerStore, ActionProposalDiscoveryIndexStore, ActionProposalOutcomeStore, ActionProposalStoreOptions, ActionProposalSupersessionStore, CreateThreadInput, ThreadSummary, ThreadDetail, ThreadTurnQuery, ThreadTurnPage, ForkThreadOptions, ToolCallApprovalState, EnqueueMessageInput, QueuedMessage, QueuedMessagePatch, UpdateThreadInput, ThreadSettings, RecordRunStartInput, RecordRunEndInput, AppendMessageInput, StoredMessage, RecordToolCallInput, UpdateToolCallInput, ToolCallOutcome, RecordUsageInput, RecordGenuiCallInput, UsageTotals, CreateActionProposal, CreateActionProposalResult, ActionProposalScope, ActionProposalMutationResult, ListActionProposals, ActionProposalDecisionCommand, ClaimActionProposal, ExtendActionProposalLease, SettleActionProposal, ActionProposalOutcomeLease, AgentGovernanceQueries, AgentPricingStore, GovernanceRange, ModelSpendRow, FeatureSpendRow, UsageBreakdownFilter, UsageBreakdownRow, ActorSpendRow, ThreadSpendRow, UsageTrendPoint, ToolCallActivityRow, ThreadActivityRow, RunMetrics, RunAgentBreakdownRow, RunErrorBreakdownRow, RunTrendPoint, RecentRunRow, PendingApprovalRow, ToolStatRow, GovernancePageQuery, ToolCallWhere, GovernancePage, ThreadWhere, RunWhere, ApprovalWhere, GovernanceRunDetail, GovernanceThreadDetailQuery, GovernanceThreadDetail, GenuiStats, MemoryProvider, ListMemoriesInput, MemoryRecord, ForgetMemoryInput, StoreMemoryInput, ModelPriceInput, CurrentModelPrice, StreamFrameTable, StreamFrameRow, SqlTokenStreamSink, SqlTokenStreamSinkOptions, ConfirmTokenStore, ConfirmTokenClaim, ChannelStore, PoppyStore, PoppyConversationRecord, PoppyConversationPatch, PoppyEventBody, StoredPoppyEvent, PoppyMessageReceipt, PoppyMessageClaim, PoppyConnectionStore, PoppyConnectionRecord, PoppyPendingConnect } from '@dudousxd/nestjs-agent-core';
|
|
2
|
+
import { MessageRole, ToolCallRequest, ToolResult, MessageAttachment, MessageUsage, AgentUiComponent, MessageFeedback, AgentHostContext, Actor, PageContext, RunStepTiming, QueuePause, ActionProposal, GenuiValidity, GenuiErrorCategory, CostSource, ToolKind, ToolCallStatus, ToolConfirmation, UsagePurpose, AgentStore, ThreadTurnReader, ThreadSettingsReader, ChatQueueStore, ActionProposalStore, ActionProposalWorkerStore, ActionProposalDiscoveryIndexStore, ActionProposalOutcomeStore, ActionProposalStoreOptions, ActionProposalSupersessionStore, CreateThreadInput, ThreadSummary, ThreadDetail, ThreadTurnQuery, ThreadTurnPage, ForkThreadOptions, ToolCallApprovalState, EnqueueMessageInput, QueuedMessage, QueuedMessagePatch, UpdateThreadInput, ThreadSettings, RecordRunStartInput, RecordRunEndInput, AppendMessageInput, StoredMessage, RecordToolCallInput, UpdateToolCallInput, ToolCallOutcome, RecordUsageInput, RecordGenuiCallInput, UsageTotals, CreateActionProposal, CreateActionProposalResult, ActionProposalScope, ActionProposalMutationResult, ListActionProposals, ActionProposalDecisionCommand, ClaimActionProposal, ExtendActionProposalLease, SettleActionProposal, ActionProposalOutcomeLease, AgentGovernanceQueries, AgentPricingStore, GovernanceRange, ModelSpendRow, FeatureSpendRow, TimestampRange, UsageBreakdownFilter, UsageBreakdownRow, ActorSpendRow, ThreadSpendRow, UsageTrendPoint, ToolCallActivityRow, ThreadActivityRow, RunMetrics, RunAgentBreakdownRow, RunErrorBreakdownRow, RunTrendPoint, RecentRunRow, PendingApprovalRow, ToolStatRow, GovernancePageQuery, ToolCallWhere, GovernancePage, ThreadWhere, RunWhere, ApprovalWhere, GovernanceRunDetail, GovernanceThreadDetailQuery, GovernanceThreadDetail, GenuiStats, MemoryProvider, ListMemoriesInput, MemoryRecord, ForgetMemoryInput, StoreMemoryInput, ModelPriceInput, CurrentModelPrice, StreamFrameTable, StreamFrameRow, SqlTokenStreamSink, SqlTokenStreamSinkOptions, ConfirmTokenStore, ConfirmTokenClaim, ChannelStore, PoppyStore, PoppyConversationRecord, PoppyConversationPatch, PoppyEventBody, StoredPoppyEvent, PoppyMessageReceipt, PoppyMessageClaim, PoppyConnectionStore, PoppyConnectionRecord, PoppyPendingConnect } 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';
|
|
@@ -1680,6 +1680,23 @@ declare const agentTokenUsage: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
1680
1680
|
}, {}, {
|
|
1681
1681
|
$type: Record<string, unknown>;
|
|
1682
1682
|
}>;
|
|
1683
|
+
countsTowardsQuota: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1684
|
+
name: "counts_towards_quota";
|
|
1685
|
+
tableName: "agent_token_usage";
|
|
1686
|
+
dataType: "boolean";
|
|
1687
|
+
columnType: "SQLiteBoolean";
|
|
1688
|
+
data: boolean;
|
|
1689
|
+
driverParam: number;
|
|
1690
|
+
notNull: true;
|
|
1691
|
+
hasDefault: true;
|
|
1692
|
+
isPrimaryKey: false;
|
|
1693
|
+
isAutoincrement: false;
|
|
1694
|
+
hasRuntimeDefault: false;
|
|
1695
|
+
enumValues: undefined;
|
|
1696
|
+
baseColumn: never;
|
|
1697
|
+
identity: undefined;
|
|
1698
|
+
generated: undefined;
|
|
1699
|
+
}, {}, {}>;
|
|
1683
1700
|
createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1684
1701
|
name: "created_at";
|
|
1685
1702
|
tableName: "agent_token_usage";
|
|
@@ -6820,6 +6837,23 @@ declare const agentSchema: {
|
|
|
6820
6837
|
}, {}, {
|
|
6821
6838
|
$type: Record<string, unknown>;
|
|
6822
6839
|
}>;
|
|
6840
|
+
countsTowardsQuota: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
6841
|
+
name: "counts_towards_quota";
|
|
6842
|
+
tableName: "agent_token_usage";
|
|
6843
|
+
dataType: "boolean";
|
|
6844
|
+
columnType: "SQLiteBoolean";
|
|
6845
|
+
data: boolean;
|
|
6846
|
+
driverParam: number;
|
|
6847
|
+
notNull: true;
|
|
6848
|
+
hasDefault: true;
|
|
6849
|
+
isPrimaryKey: false;
|
|
6850
|
+
isAutoincrement: false;
|
|
6851
|
+
hasRuntimeDefault: false;
|
|
6852
|
+
enumValues: undefined;
|
|
6853
|
+
baseColumn: never;
|
|
6854
|
+
identity: undefined;
|
|
6855
|
+
generated: undefined;
|
|
6856
|
+
}, {}, {}>;
|
|
6823
6857
|
createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
6824
6858
|
name: "created_at";
|
|
6825
6859
|
tableName: "agent_token_usage";
|
|
@@ -9958,7 +9992,7 @@ declare class DrizzleGovernanceQueries implements AgentGovernanceQueries {
|
|
|
9958
9992
|
private usageInRange;
|
|
9959
9993
|
spendByModel(range: GovernanceRange): Promise<ModelSpendRow[]>;
|
|
9960
9994
|
spendByFeature(range: GovernanceRange): Promise<FeatureSpendRow[]>;
|
|
9961
|
-
usageBreakdown(range: GovernanceRange, filter?: UsageBreakdownFilter): Promise<UsageBreakdownRow[]>;
|
|
9995
|
+
usageBreakdown(range: GovernanceRange | TimestampRange, filter?: UsageBreakdownFilter): Promise<UsageBreakdownRow[]>;
|
|
9962
9996
|
spendByActor(range: GovernanceRange): Promise<ActorSpendRow[]>;
|
|
9963
9997
|
/**
|
|
9964
9998
|
* Top threads by spend within the range, highest cost first, capped at `limit`. Usage rows for a
|
|
@@ -12333,6 +12367,23 @@ declare const pgAgentSchema: {
|
|
|
12333
12367
|
}, {}, {
|
|
12334
12368
|
$type: Record<string, unknown>;
|
|
12335
12369
|
}>;
|
|
12370
|
+
countsTowardsQuota: drizzle_orm_pg_core.PgColumn<{
|
|
12371
|
+
name: "counts_towards_quota";
|
|
12372
|
+
tableName: "agent_token_usage";
|
|
12373
|
+
dataType: "boolean";
|
|
12374
|
+
columnType: "PgBoolean";
|
|
12375
|
+
data: boolean;
|
|
12376
|
+
driverParam: boolean;
|
|
12377
|
+
notNull: true;
|
|
12378
|
+
hasDefault: true;
|
|
12379
|
+
isPrimaryKey: false;
|
|
12380
|
+
isAutoincrement: false;
|
|
12381
|
+
hasRuntimeDefault: false;
|
|
12382
|
+
enumValues: undefined;
|
|
12383
|
+
baseColumn: never;
|
|
12384
|
+
identity: undefined;
|
|
12385
|
+
generated: undefined;
|
|
12386
|
+
}, {}, {}>;
|
|
12336
12387
|
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
12337
12388
|
name: string;
|
|
12338
12389
|
tableName: "agent_token_usage";
|
|
@@ -16783,6 +16834,23 @@ declare const mysqlAgentSchema: {
|
|
|
16783
16834
|
}, {}, {
|
|
16784
16835
|
$type: Record<string, unknown>;
|
|
16785
16836
|
}>;
|
|
16837
|
+
countsTowardsQuota: drizzle_orm_mysql_core.MySqlColumn<{
|
|
16838
|
+
name: "counts_towards_quota";
|
|
16839
|
+
tableName: "agent_token_usage";
|
|
16840
|
+
dataType: "boolean";
|
|
16841
|
+
columnType: "MySqlBoolean";
|
|
16842
|
+
data: boolean;
|
|
16843
|
+
driverParam: number | boolean;
|
|
16844
|
+
notNull: true;
|
|
16845
|
+
hasDefault: true;
|
|
16846
|
+
isPrimaryKey: false;
|
|
16847
|
+
isAutoincrement: false;
|
|
16848
|
+
hasRuntimeDefault: false;
|
|
16849
|
+
enumValues: undefined;
|
|
16850
|
+
baseColumn: never;
|
|
16851
|
+
identity: undefined;
|
|
16852
|
+
generated: undefined;
|
|
16853
|
+
}, {}, {}>;
|
|
16786
16854
|
createdAt: drizzle_orm_mysql_core.MySqlColumn<{
|
|
16787
16855
|
name: string;
|
|
16788
16856
|
tableName: "agent_token_usage";
|
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, AgentHostContext, Actor, PageContext, RunStepTiming, QueuePause, ActionProposal, GenuiValidity, GenuiErrorCategory, CostSource, ToolKind, ToolCallStatus, ToolConfirmation, UsagePurpose, AgentStore, ThreadTurnReader, ThreadSettingsReader, ChatQueueStore, ActionProposalStore, ActionProposalWorkerStore, ActionProposalDiscoveryIndexStore, ActionProposalOutcomeStore, ActionProposalStoreOptions, ActionProposalSupersessionStore, CreateThreadInput, ThreadSummary, ThreadDetail, ThreadTurnQuery, ThreadTurnPage, ForkThreadOptions, ToolCallApprovalState, EnqueueMessageInput, QueuedMessage, QueuedMessagePatch, UpdateThreadInput, ThreadSettings, RecordRunStartInput, RecordRunEndInput, AppendMessageInput, StoredMessage, RecordToolCallInput, UpdateToolCallInput, ToolCallOutcome, RecordUsageInput, RecordGenuiCallInput, UsageTotals, CreateActionProposal, CreateActionProposalResult, ActionProposalScope, ActionProposalMutationResult, ListActionProposals, ActionProposalDecisionCommand, ClaimActionProposal, ExtendActionProposalLease, SettleActionProposal, ActionProposalOutcomeLease, AgentGovernanceQueries, AgentPricingStore, GovernanceRange, ModelSpendRow, FeatureSpendRow, UsageBreakdownFilter, UsageBreakdownRow, ActorSpendRow, ThreadSpendRow, UsageTrendPoint, ToolCallActivityRow, ThreadActivityRow, RunMetrics, RunAgentBreakdownRow, RunErrorBreakdownRow, RunTrendPoint, RecentRunRow, PendingApprovalRow, ToolStatRow, GovernancePageQuery, ToolCallWhere, GovernancePage, ThreadWhere, RunWhere, ApprovalWhere, GovernanceRunDetail, GovernanceThreadDetailQuery, GovernanceThreadDetail, GenuiStats, MemoryProvider, ListMemoriesInput, MemoryRecord, ForgetMemoryInput, StoreMemoryInput, ModelPriceInput, CurrentModelPrice, StreamFrameTable, StreamFrameRow, SqlTokenStreamSink, SqlTokenStreamSinkOptions, ConfirmTokenStore, ConfirmTokenClaim, ChannelStore, PoppyStore, PoppyConversationRecord, PoppyConversationPatch, PoppyEventBody, StoredPoppyEvent, PoppyMessageReceipt, PoppyMessageClaim, PoppyConnectionStore, PoppyConnectionRecord, PoppyPendingConnect } from '@dudousxd/nestjs-agent-core';
|
|
2
|
+
import { MessageRole, ToolCallRequest, ToolResult, MessageAttachment, MessageUsage, AgentUiComponent, MessageFeedback, AgentHostContext, Actor, PageContext, RunStepTiming, QueuePause, ActionProposal, GenuiValidity, GenuiErrorCategory, CostSource, ToolKind, ToolCallStatus, ToolConfirmation, UsagePurpose, AgentStore, ThreadTurnReader, ThreadSettingsReader, ChatQueueStore, ActionProposalStore, ActionProposalWorkerStore, ActionProposalDiscoveryIndexStore, ActionProposalOutcomeStore, ActionProposalStoreOptions, ActionProposalSupersessionStore, CreateThreadInput, ThreadSummary, ThreadDetail, ThreadTurnQuery, ThreadTurnPage, ForkThreadOptions, ToolCallApprovalState, EnqueueMessageInput, QueuedMessage, QueuedMessagePatch, UpdateThreadInput, ThreadSettings, RecordRunStartInput, RecordRunEndInput, AppendMessageInput, StoredMessage, RecordToolCallInput, UpdateToolCallInput, ToolCallOutcome, RecordUsageInput, RecordGenuiCallInput, UsageTotals, CreateActionProposal, CreateActionProposalResult, ActionProposalScope, ActionProposalMutationResult, ListActionProposals, ActionProposalDecisionCommand, ClaimActionProposal, ExtendActionProposalLease, SettleActionProposal, ActionProposalOutcomeLease, AgentGovernanceQueries, AgentPricingStore, GovernanceRange, ModelSpendRow, FeatureSpendRow, TimestampRange, UsageBreakdownFilter, UsageBreakdownRow, ActorSpendRow, ThreadSpendRow, UsageTrendPoint, ToolCallActivityRow, ThreadActivityRow, RunMetrics, RunAgentBreakdownRow, RunErrorBreakdownRow, RunTrendPoint, RecentRunRow, PendingApprovalRow, ToolStatRow, GovernancePageQuery, ToolCallWhere, GovernancePage, ThreadWhere, RunWhere, ApprovalWhere, GovernanceRunDetail, GovernanceThreadDetailQuery, GovernanceThreadDetail, GenuiStats, MemoryProvider, ListMemoriesInput, MemoryRecord, ForgetMemoryInput, StoreMemoryInput, ModelPriceInput, CurrentModelPrice, StreamFrameTable, StreamFrameRow, SqlTokenStreamSink, SqlTokenStreamSinkOptions, ConfirmTokenStore, ConfirmTokenClaim, ChannelStore, PoppyStore, PoppyConversationRecord, PoppyConversationPatch, PoppyEventBody, StoredPoppyEvent, PoppyMessageReceipt, PoppyMessageClaim, PoppyConnectionStore, PoppyConnectionRecord, PoppyPendingConnect } 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';
|
|
@@ -1680,6 +1680,23 @@ declare const agentTokenUsage: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
1680
1680
|
}, {}, {
|
|
1681
1681
|
$type: Record<string, unknown>;
|
|
1682
1682
|
}>;
|
|
1683
|
+
countsTowardsQuota: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1684
|
+
name: "counts_towards_quota";
|
|
1685
|
+
tableName: "agent_token_usage";
|
|
1686
|
+
dataType: "boolean";
|
|
1687
|
+
columnType: "SQLiteBoolean";
|
|
1688
|
+
data: boolean;
|
|
1689
|
+
driverParam: number;
|
|
1690
|
+
notNull: true;
|
|
1691
|
+
hasDefault: true;
|
|
1692
|
+
isPrimaryKey: false;
|
|
1693
|
+
isAutoincrement: false;
|
|
1694
|
+
hasRuntimeDefault: false;
|
|
1695
|
+
enumValues: undefined;
|
|
1696
|
+
baseColumn: never;
|
|
1697
|
+
identity: undefined;
|
|
1698
|
+
generated: undefined;
|
|
1699
|
+
}, {}, {}>;
|
|
1683
1700
|
createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
1684
1701
|
name: "created_at";
|
|
1685
1702
|
tableName: "agent_token_usage";
|
|
@@ -6820,6 +6837,23 @@ declare const agentSchema: {
|
|
|
6820
6837
|
}, {}, {
|
|
6821
6838
|
$type: Record<string, unknown>;
|
|
6822
6839
|
}>;
|
|
6840
|
+
countsTowardsQuota: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
6841
|
+
name: "counts_towards_quota";
|
|
6842
|
+
tableName: "agent_token_usage";
|
|
6843
|
+
dataType: "boolean";
|
|
6844
|
+
columnType: "SQLiteBoolean";
|
|
6845
|
+
data: boolean;
|
|
6846
|
+
driverParam: number;
|
|
6847
|
+
notNull: true;
|
|
6848
|
+
hasDefault: true;
|
|
6849
|
+
isPrimaryKey: false;
|
|
6850
|
+
isAutoincrement: false;
|
|
6851
|
+
hasRuntimeDefault: false;
|
|
6852
|
+
enumValues: undefined;
|
|
6853
|
+
baseColumn: never;
|
|
6854
|
+
identity: undefined;
|
|
6855
|
+
generated: undefined;
|
|
6856
|
+
}, {}, {}>;
|
|
6823
6857
|
createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
6824
6858
|
name: "created_at";
|
|
6825
6859
|
tableName: "agent_token_usage";
|
|
@@ -9958,7 +9992,7 @@ declare class DrizzleGovernanceQueries implements AgentGovernanceQueries {
|
|
|
9958
9992
|
private usageInRange;
|
|
9959
9993
|
spendByModel(range: GovernanceRange): Promise<ModelSpendRow[]>;
|
|
9960
9994
|
spendByFeature(range: GovernanceRange): Promise<FeatureSpendRow[]>;
|
|
9961
|
-
usageBreakdown(range: GovernanceRange, filter?: UsageBreakdownFilter): Promise<UsageBreakdownRow[]>;
|
|
9995
|
+
usageBreakdown(range: GovernanceRange | TimestampRange, filter?: UsageBreakdownFilter): Promise<UsageBreakdownRow[]>;
|
|
9962
9996
|
spendByActor(range: GovernanceRange): Promise<ActorSpendRow[]>;
|
|
9963
9997
|
/**
|
|
9964
9998
|
* Top threads by spend within the range, highest cost first, capped at `limit`. Usage rows for a
|
|
@@ -12333,6 +12367,23 @@ declare const pgAgentSchema: {
|
|
|
12333
12367
|
}, {}, {
|
|
12334
12368
|
$type: Record<string, unknown>;
|
|
12335
12369
|
}>;
|
|
12370
|
+
countsTowardsQuota: drizzle_orm_pg_core.PgColumn<{
|
|
12371
|
+
name: "counts_towards_quota";
|
|
12372
|
+
tableName: "agent_token_usage";
|
|
12373
|
+
dataType: "boolean";
|
|
12374
|
+
columnType: "PgBoolean";
|
|
12375
|
+
data: boolean;
|
|
12376
|
+
driverParam: boolean;
|
|
12377
|
+
notNull: true;
|
|
12378
|
+
hasDefault: true;
|
|
12379
|
+
isPrimaryKey: false;
|
|
12380
|
+
isAutoincrement: false;
|
|
12381
|
+
hasRuntimeDefault: false;
|
|
12382
|
+
enumValues: undefined;
|
|
12383
|
+
baseColumn: never;
|
|
12384
|
+
identity: undefined;
|
|
12385
|
+
generated: undefined;
|
|
12386
|
+
}, {}, {}>;
|
|
12336
12387
|
createdAt: drizzle_orm_pg_core.PgColumn<{
|
|
12337
12388
|
name: string;
|
|
12338
12389
|
tableName: "agent_token_usage";
|
|
@@ -16783,6 +16834,23 @@ declare const mysqlAgentSchema: {
|
|
|
16783
16834
|
}, {}, {
|
|
16784
16835
|
$type: Record<string, unknown>;
|
|
16785
16836
|
}>;
|
|
16837
|
+
countsTowardsQuota: drizzle_orm_mysql_core.MySqlColumn<{
|
|
16838
|
+
name: "counts_towards_quota";
|
|
16839
|
+
tableName: "agent_token_usage";
|
|
16840
|
+
dataType: "boolean";
|
|
16841
|
+
columnType: "MySqlBoolean";
|
|
16842
|
+
data: boolean;
|
|
16843
|
+
driverParam: number | boolean;
|
|
16844
|
+
notNull: true;
|
|
16845
|
+
hasDefault: true;
|
|
16846
|
+
isPrimaryKey: false;
|
|
16847
|
+
isAutoincrement: false;
|
|
16848
|
+
hasRuntimeDefault: false;
|
|
16849
|
+
enumValues: undefined;
|
|
16850
|
+
baseColumn: never;
|
|
16851
|
+
identity: undefined;
|
|
16852
|
+
generated: undefined;
|
|
16853
|
+
}, {}, {}>;
|
|
16786
16854
|
createdAt: drizzle_orm_mysql_core.MySqlColumn<{
|
|
16787
16855
|
name: string;
|
|
16788
16856
|
tableName: "agent_token_usage";
|
package/dist/index.js
CHANGED
|
@@ -209,6 +209,10 @@ var agentTokenUsage = sqliteTable("agent_token_usage", {
|
|
|
209
209
|
metadata: text("metadata", {
|
|
210
210
|
mode: "json"
|
|
211
211
|
}).$type(),
|
|
212
|
+
/** `false` keeps the row out of the agent's quota windows (`recordUsage({ countsTowardsQuota: false })`). */
|
|
213
|
+
countsTowardsQuota: integer("counts_towards_quota", {
|
|
214
|
+
mode: "boolean"
|
|
215
|
+
}).notNull().default(true),
|
|
212
216
|
createdAt: integer("created_at", {
|
|
213
217
|
mode: "timestamp_ms"
|
|
214
218
|
}).notNull()
|
|
@@ -682,6 +686,8 @@ var agentTokenUsage2 = mysqlTable("agent_token_usage", {
|
|
|
682
686
|
requests: int("requests"),
|
|
683
687
|
/** The caller's own JSON, never read by the library. */
|
|
684
688
|
metadata: json("metadata").$type(),
|
|
689
|
+
/** `false` keeps the row out of the agent's quota windows (`recordUsage({ countsTowardsQuota: false })`). */
|
|
690
|
+
countsTowardsQuota: boolean("counts_towards_quota").notNull().default(true),
|
|
685
691
|
createdAt: ts("created_at").notNull()
|
|
686
692
|
}, (table) => [
|
|
687
693
|
index2("agent_token_usage_actor_created_idx").on(table.actorRef, table.createdAt),
|
|
@@ -1167,6 +1173,8 @@ var agentTokenUsage3 = pgTable("agent_token_usage", {
|
|
|
1167
1173
|
requests: integer2("requests"),
|
|
1168
1174
|
/** The caller's own JSON, never read by the library. */
|
|
1169
1175
|
metadata: jsonb("metadata").$type(),
|
|
1176
|
+
/** `false` keeps the row out of the agent's quota windows (`recordUsage({ countsTowardsQuota: false })`). */
|
|
1177
|
+
countsTowardsQuota: boolean2("counts_towards_quota").notNull().default(true),
|
|
1170
1178
|
createdAt: ts2("created_at").notNull()
|
|
1171
1179
|
}, (table) => [
|
|
1172
1180
|
index3("agent_token_usage_actor_created_idx").on(table.actorRef, table.createdAt),
|
|
@@ -3237,6 +3245,7 @@ var DrizzleAgentStore = class {
|
|
|
3237
3245
|
characters: input.characters ?? null,
|
|
3238
3246
|
requests: input.requests ?? null,
|
|
3239
3247
|
metadata: input.metadata ?? null,
|
|
3248
|
+
countsTowardsQuota: input.countsTowardsQuota !== false,
|
|
3240
3249
|
modelId: input.modelId,
|
|
3241
3250
|
purpose: input.purpose,
|
|
3242
3251
|
inputTokens: input.usage.inputTokens,
|
|
@@ -3321,7 +3330,7 @@ var DrizzleAgentStore = class {
|
|
|
3321
3330
|
});
|
|
3322
3331
|
const from = new Date(Math.min(...bounds.map(({ start }) => start.getTime())));
|
|
3323
3332
|
const to = new Date(Math.max(...bounds.map(({ end }) => end.getTime())));
|
|
3324
|
-
const [row] = await this.db.select(columns).from(usage).where(and2(eq2(usage.actorRef, actorRef), within(from, to)));
|
|
3333
|
+
const [row] = await this.db.select(columns).from(usage).where(and2(eq2(usage.actorRef, actorRef), within(from, to), eq2(usage.countsTowardsQuota, true)));
|
|
3325
3334
|
return bounds.map((_, index4) => ({
|
|
3326
3335
|
usedTokens: Number(row?.[`tokens${index4}`] ?? 0),
|
|
3327
3336
|
costUsd: Number(row?.[`cost${index4}`] ?? 0),
|
|
@@ -3432,8 +3441,8 @@ function toQueuedMessage(row) {
|
|
|
3432
3441
|
__name(toQueuedMessage, "toQueuedMessage");
|
|
3433
3442
|
|
|
3434
3443
|
// src/drizzle-governance-queries.ts
|
|
3435
|
-
import { bucketByActor, bucketByFeature, bucketByModel, bucketByThread, bucketUsageBreakdown, bucketUsageTrend, dayBoundsUtc, rollupThreadUsage, summarizeGenuiCalls, truncateDetailContent } from "@dudousxd/nestjs-agent-core";
|
|
3436
|
-
import { and as and3, asc as asc3, count, desc as desc2, eq as eq3, gte as gte2, inArray as inArray2, isNull as isNull3, like, lte as lte3, sql as sql4, sum } from "drizzle-orm";
|
|
3444
|
+
import { bucketByActor, bucketByFeature, bucketByModel, bucketByThread, bucketUsageBreakdown, bucketUsageTrend, dayBoundsUtc, rollupThreadUsage, summarizeGenuiCalls, truncateDetailContent, usageRangeBounds } from "@dudousxd/nestjs-agent-core";
|
|
3445
|
+
import { and as and3, asc as asc3, count, desc as desc2, eq as eq3, gte as gte2, inArray as inArray2, isNull as isNull3, like, lt, lte as lte3, sql as sql4, sum } from "drizzle-orm";
|
|
3437
3446
|
var UNCLASSIFIED_ERROR_CODE = "unknown";
|
|
3438
3447
|
var DEFAULT_AGENT_BUCKET = "(default)";
|
|
3439
3448
|
var TOOL_CALL_STATUSES = [
|
|
@@ -3648,7 +3657,7 @@ var DrizzleGovernanceQueries = class {
|
|
|
3648
3657
|
* per-feature reads that group by them.
|
|
3649
3658
|
*/
|
|
3650
3659
|
async usageInRange(range, withFeature = false) {
|
|
3651
|
-
const { start, end } =
|
|
3660
|
+
const { start, end } = usageRangeBounds(range);
|
|
3652
3661
|
const usage = this.t.agentTokenUsage;
|
|
3653
3662
|
const rows = await this.db.select({
|
|
3654
3663
|
modelId: usage.modelId,
|
|
@@ -3668,7 +3677,7 @@ var DrizzleGovernanceQueries = class {
|
|
|
3668
3677
|
audioSeconds: usage.audioSeconds,
|
|
3669
3678
|
characters: usage.characters
|
|
3670
3679
|
} : {}
|
|
3671
|
-
}).from(usage).where(and3(gte2(this.t.agentTokenUsage.createdAt, start),
|
|
3680
|
+
}).from(usage).where(and3(gte2(this.t.agentTokenUsage.createdAt, start), lt(this.t.agentTokenUsage.createdAt, end)));
|
|
3672
3681
|
return rows.map(toUsageInput);
|
|
3673
3682
|
}
|
|
3674
3683
|
async spendByModel(range) {
|
|
@@ -4438,7 +4447,7 @@ var DrizzlePricingStore = class {
|
|
|
4438
4447
|
|
|
4439
4448
|
// src/drizzle-token-stream-sink.ts
|
|
4440
4449
|
import { SqlTokenStreamSink } from "@dudousxd/nestjs-agent-core";
|
|
4441
|
-
import { and as and6, asc as asc4, eq as eq6, gt as gt2, inArray as inArray4, lt, max as max3, sql as sql5 } from "drizzle-orm";
|
|
4450
|
+
import { and as and6, asc as asc4, eq as eq6, gt as gt2, inArray as inArray4, lt as lt2, max as max3, sql as sql5 } from "drizzle-orm";
|
|
4442
4451
|
var DrizzleStreamFrameTable = class {
|
|
4443
4452
|
static {
|
|
4444
4453
|
__name(this, "DrizzleStreamFrameTable");
|
|
@@ -4478,7 +4487,7 @@ var DrizzleStreamFrameTable = class {
|
|
|
4478
4487
|
async lapsedRuns(cutoff) {
|
|
4479
4488
|
const rows = await this.db.select({
|
|
4480
4489
|
runId: this.t.agentStreamFrame.runId
|
|
4481
|
-
}).from(this.t.agentStreamFrame).groupBy(this.t.agentStreamFrame.runId).having(
|
|
4490
|
+
}).from(this.t.agentStreamFrame).groupBy(this.t.agentStreamFrame.runId).having(lt2(max3(this.t.agentStreamFrame.createdAt), cutoff));
|
|
4482
4491
|
return rows.map((row) => row.runId);
|
|
4483
4492
|
}
|
|
4484
4493
|
isUniqueViolation(error) {
|
|
@@ -4495,7 +4504,7 @@ var DrizzleTokenStreamSink = class extends SqlTokenStreamSink {
|
|
|
4495
4504
|
};
|
|
4496
4505
|
|
|
4497
4506
|
// src/drizzle-confirm-token-store.ts
|
|
4498
|
-
import { eq as eq7, lt as
|
|
4507
|
+
import { eq as eq7, lt as lt3 } from "drizzle-orm";
|
|
4499
4508
|
var DrizzleConfirmTokenStore = class {
|
|
4500
4509
|
static {
|
|
4501
4510
|
__name(this, "DrizzleConfirmTokenStore");
|
|
@@ -4529,7 +4538,7 @@ var DrizzleConfirmTokenStore = class {
|
|
|
4529
4538
|
}
|
|
4530
4539
|
async purgeExpired(now = Date.now()) {
|
|
4531
4540
|
const table = this.t.agentConfirmToken;
|
|
4532
|
-
return affectedRows(this.dialect, this.db.delete(table).where(
|
|
4541
|
+
return affectedRows(this.dialect, this.db.delete(table).where(lt3(table.expiresAt, now)), table.hash);
|
|
4533
4542
|
}
|
|
4534
4543
|
};
|
|
4535
4544
|
|
|
@@ -4607,7 +4616,7 @@ var DrizzleChannelStore = class {
|
|
|
4607
4616
|
|
|
4608
4617
|
// src/drizzle-poppy-store.ts
|
|
4609
4618
|
import { newEventId } from "@dudousxd/nestjs-agent-core";
|
|
4610
|
-
import { and as and8, desc as desc3, eq as eq9, gt as gt4, isNull as isNull4, lt as
|
|
4619
|
+
import { and as and8, desc as desc3, eq as eq9, gt as gt4, isNull as isNull4, lt as lt4, lte as lte5, or as or3 } from "drizzle-orm";
|
|
4611
4620
|
var MAX_APPEND_ATTEMPTS = 50;
|
|
4612
4621
|
var sleep = /* @__PURE__ */ __name((ms) => new Promise((resolve) => setTimeout(resolve, ms)), "sleep");
|
|
4613
4622
|
var nullable = /* @__PURE__ */ __name((value) => value == null ? null : String(value), "nullable");
|
|
@@ -4792,13 +4801,13 @@ var DrizzlePoppyStore = class {
|
|
|
4792
4801
|
if (!last) return;
|
|
4793
4802
|
const [dropped] = await this.db.select({
|
|
4794
4803
|
seq: table.seq
|
|
4795
|
-
}).from(table).where(and8(eq9(table.conversationId, conversationId),
|
|
4804
|
+
}).from(table).where(and8(eq9(table.conversationId, conversationId), lt4(table.createdAt, before), lt4(table.seq, toInt(last.seq)))).orderBy(desc3(table.seq)).limit(1);
|
|
4796
4805
|
if (!dropped) return;
|
|
4797
4806
|
const upTo = toInt(dropped.seq);
|
|
4798
4807
|
const conversations = this.t.agentPoppyConversation;
|
|
4799
4808
|
await this.db.update(conversations).set({
|
|
4800
4809
|
prunedSeq: upTo
|
|
4801
|
-
}).where(and8(eq9(conversations.id, conversationId),
|
|
4810
|
+
}).where(and8(eq9(conversations.id, conversationId), lt4(conversations.prunedSeq, upTo)));
|
|
4802
4811
|
await this.db.delete(table).where(and8(eq9(table.conversationId, conversationId), lte5(table.seq, upTo)));
|
|
4803
4812
|
}
|
|
4804
4813
|
async claimMessage(owner, messageId, receipt) {
|
|
@@ -4986,7 +4995,7 @@ __name(toConnection, "toConnection");
|
|
|
4986
4995
|
// src/drizzle-rag-ingestion-log.ts
|
|
4987
4996
|
import { subscribe, unsubscribe } from "diagnostics_channel";
|
|
4988
4997
|
import { Injectable, Logger } from "@nestjs/common";
|
|
4989
|
-
import { and as and10, asc as asc6, count as count2, desc as desc4, eq as eq11, gt as gt5, lt as
|
|
4998
|
+
import { and as and10, asc as asc6, count as count2, desc as desc4, eq as eq11, gt as gt5, lt as lt5, or as or4 } from "drizzle-orm";
|
|
4990
4999
|
function _ts_decorate(decorators, target, key2, desc5) {
|
|
4991
5000
|
var c = arguments.length, r = c < 3 ? target : desc5 === null ? desc5 = Object.getOwnPropertyDescriptor(target, key2) : desc5, d;
|
|
4992
5001
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
@@ -5240,7 +5249,7 @@ var DrizzleRagIngestionLog = class _DrizzleRagIngestionLog {
|
|
|
5240
5249
|
if (cursor === void 0) {
|
|
5241
5250
|
return base;
|
|
5242
5251
|
}
|
|
5243
|
-
return and10(base, or4(
|
|
5252
|
+
return and10(base, or4(lt5(this.t.ragIngestionLog.updatedAt, cursor.updatedAt), and10(eq11(this.t.ragIngestionLog.updatedAt, cursor.updatedAt), gt5(this.t.ragIngestionLog.documentId, cursor.documentId))));
|
|
5244
5253
|
}
|
|
5245
5254
|
/**
|
|
5246
5255
|
* Upsert one outcome. Keyed by document id so the row always reflects the *current* state — a
|