@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.cjs
CHANGED
|
@@ -904,6 +904,9 @@ var DrizzleAgentStore = class {
|
|
|
904
904
|
if (patch.attachments !== void 0) {
|
|
905
905
|
updates.attachments = patch.attachments === null || patch.attachments.length === 0 ? null : patch.attachments;
|
|
906
906
|
}
|
|
907
|
+
if (patch.interrupt !== void 0) {
|
|
908
|
+
updates.interrupt = patch.interrupt;
|
|
909
|
+
}
|
|
907
910
|
await this.db.update(agentQueuedMessage).set(updates).where((0, import_drizzle_orm2.eq)(agentQueuedMessage.id, id));
|
|
908
911
|
return this.getQueuedMessage(id);
|
|
909
912
|
}
|
|
@@ -1148,6 +1151,43 @@ var DrizzleAgentStore = class {
|
|
|
1148
1151
|
}
|
|
1149
1152
|
await this.db.update(agentToolCall).set(updates).where((0, import_drizzle_orm2.eq)(agentToolCall.id, input.toolCallId));
|
|
1150
1153
|
}
|
|
1154
|
+
async toolCallOutcomes(toolCallIds) {
|
|
1155
|
+
if (toolCallIds.length === 0) {
|
|
1156
|
+
return [];
|
|
1157
|
+
}
|
|
1158
|
+
const rows = await this.db.select({
|
|
1159
|
+
id: agentToolCall.id,
|
|
1160
|
+
status: agentToolCall.status,
|
|
1161
|
+
output: agentToolCall.output,
|
|
1162
|
+
error: agentToolCall.error
|
|
1163
|
+
}).from(agentToolCall).where((0, import_drizzle_orm2.inArray)(agentToolCall.id, [
|
|
1164
|
+
...toolCallIds
|
|
1165
|
+
]));
|
|
1166
|
+
return rows.map((row) => ({
|
|
1167
|
+
id: row.id,
|
|
1168
|
+
status: row.status,
|
|
1169
|
+
...row.output !== void 0 && row.output !== null ? {
|
|
1170
|
+
output: row.output
|
|
1171
|
+
} : {},
|
|
1172
|
+
...typeof row.error === "string" ? {
|
|
1173
|
+
error: row.error
|
|
1174
|
+
} : {}
|
|
1175
|
+
}));
|
|
1176
|
+
}
|
|
1177
|
+
async failUnsettledToolCalls(runId, error) {
|
|
1178
|
+
const pending = (0, import_drizzle_orm2.and)((0, import_drizzle_orm2.eq)(agentToolCall.runId, runId), (0, import_drizzle_orm2.eq)(agentToolCall.status, "pending_approval"));
|
|
1179
|
+
const rows = await this.db.select({
|
|
1180
|
+
id: agentToolCall.id
|
|
1181
|
+
}).from(agentToolCall).where(pending);
|
|
1182
|
+
if (rows.length === 0) {
|
|
1183
|
+
return 0;
|
|
1184
|
+
}
|
|
1185
|
+
await this.db.update(agentToolCall).set({
|
|
1186
|
+
status: "failed",
|
|
1187
|
+
error
|
|
1188
|
+
}).where(pending);
|
|
1189
|
+
return rows.length;
|
|
1190
|
+
}
|
|
1151
1191
|
/**
|
|
1152
1192
|
* Of `mediaIds`, the ones a surviving message in one of this actor's threads still carries.
|
|
1153
1193
|
*
|