@dudousxd/nestjs-agent-store-drizzle 0.19.0 → 0.20.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 +40 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
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, 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 } 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';
|
|
@@ -4537,6 +4537,8 @@ declare class DrizzleAgentStore implements AgentStore, ThreadTurnReader, ChatQue
|
|
|
4537
4537
|
truncateFrom(threadId: string, messageId: string): Promise<void>;
|
|
4538
4538
|
recordToolCall(input: RecordToolCallInput): Promise<void>;
|
|
4539
4539
|
updateToolCall(input: UpdateToolCallInput): Promise<void>;
|
|
4540
|
+
toolCallOutcomes(toolCallIds: readonly string[]): Promise<ToolCallOutcome[]>;
|
|
4541
|
+
failUnsettledToolCalls(runId: string, error: string): Promise<number>;
|
|
4540
4542
|
/**
|
|
4541
4543
|
* Of `mediaIds`, the ones a surviving message in one of this actor's threads still carries.
|
|
4542
4544
|
*
|
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, 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 } 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';
|
|
@@ -4537,6 +4537,8 @@ declare class DrizzleAgentStore implements AgentStore, ThreadTurnReader, ChatQue
|
|
|
4537
4537
|
truncateFrom(threadId: string, messageId: string): Promise<void>;
|
|
4538
4538
|
recordToolCall(input: RecordToolCallInput): Promise<void>;
|
|
4539
4539
|
updateToolCall(input: UpdateToolCallInput): Promise<void>;
|
|
4540
|
+
toolCallOutcomes(toolCallIds: readonly string[]): Promise<ToolCallOutcome[]>;
|
|
4541
|
+
failUnsettledToolCalls(runId: string, error: string): Promise<number>;
|
|
4540
4542
|
/**
|
|
4541
4543
|
* Of `mediaIds`, the ones a surviving message in one of this actor's threads still carries.
|
|
4542
4544
|
*
|
package/dist/index.js
CHANGED
|
@@ -863,6 +863,9 @@ var DrizzleAgentStore = class {
|
|
|
863
863
|
if (patch.attachments !== void 0) {
|
|
864
864
|
updates.attachments = patch.attachments === null || patch.attachments.length === 0 ? null : patch.attachments;
|
|
865
865
|
}
|
|
866
|
+
if (patch.interrupt !== void 0) {
|
|
867
|
+
updates.interrupt = patch.interrupt;
|
|
868
|
+
}
|
|
866
869
|
await this.db.update(agentQueuedMessage).set(updates).where(eq(agentQueuedMessage.id, id));
|
|
867
870
|
return this.getQueuedMessage(id);
|
|
868
871
|
}
|
|
@@ -1107,6 +1110,43 @@ var DrizzleAgentStore = class {
|
|
|
1107
1110
|
}
|
|
1108
1111
|
await this.db.update(agentToolCall).set(updates).where(eq(agentToolCall.id, input.toolCallId));
|
|
1109
1112
|
}
|
|
1113
|
+
async toolCallOutcomes(toolCallIds) {
|
|
1114
|
+
if (toolCallIds.length === 0) {
|
|
1115
|
+
return [];
|
|
1116
|
+
}
|
|
1117
|
+
const rows = await this.db.select({
|
|
1118
|
+
id: agentToolCall.id,
|
|
1119
|
+
status: agentToolCall.status,
|
|
1120
|
+
output: agentToolCall.output,
|
|
1121
|
+
error: agentToolCall.error
|
|
1122
|
+
}).from(agentToolCall).where(inArray(agentToolCall.id, [
|
|
1123
|
+
...toolCallIds
|
|
1124
|
+
]));
|
|
1125
|
+
return rows.map((row) => ({
|
|
1126
|
+
id: row.id,
|
|
1127
|
+
status: row.status,
|
|
1128
|
+
...row.output !== void 0 && row.output !== null ? {
|
|
1129
|
+
output: row.output
|
|
1130
|
+
} : {},
|
|
1131
|
+
...typeof row.error === "string" ? {
|
|
1132
|
+
error: row.error
|
|
1133
|
+
} : {}
|
|
1134
|
+
}));
|
|
1135
|
+
}
|
|
1136
|
+
async failUnsettledToolCalls(runId, error) {
|
|
1137
|
+
const pending = and(eq(agentToolCall.runId, runId), eq(agentToolCall.status, "pending_approval"));
|
|
1138
|
+
const rows = await this.db.select({
|
|
1139
|
+
id: agentToolCall.id
|
|
1140
|
+
}).from(agentToolCall).where(pending);
|
|
1141
|
+
if (rows.length === 0) {
|
|
1142
|
+
return 0;
|
|
1143
|
+
}
|
|
1144
|
+
await this.db.update(agentToolCall).set({
|
|
1145
|
+
status: "failed",
|
|
1146
|
+
error
|
|
1147
|
+
}).where(pending);
|
|
1148
|
+
return rows.length;
|
|
1149
|
+
}
|
|
1110
1150
|
/**
|
|
1111
1151
|
* Of `mediaIds`, the ones a surviving message in one of this actor's threads still carries.
|
|
1112
1152
|
*
|