@axiom-lattice/gateway 2.1.69 → 2.1.71
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +17 -0
- package/dist/index.js +25 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/controllers/workflow-tracking.ts +36 -24
package/dist/index.mjs
CHANGED
|
@@ -1851,8 +1851,7 @@ async function getInboxItems(request, reply) {
|
|
|
1851
1851
|
if (runningRuns.length === 0) {
|
|
1852
1852
|
return { success: true, message: "No running workflows", data: { records: [] } };
|
|
1853
1853
|
}
|
|
1854
|
-
const
|
|
1855
|
-
for (const r of runningRuns) {
|
|
1854
|
+
const checkPromises = runningRuns.map(async (r) => {
|
|
1856
1855
|
try {
|
|
1857
1856
|
const agent = agentInstanceManager4.getAgent({
|
|
1858
1857
|
assistant_id: r.assistantId,
|
|
@@ -1860,26 +1859,28 @@ async function getInboxItems(request, reply) {
|
|
|
1860
1859
|
tenant_id: r.tenantId
|
|
1861
1860
|
});
|
|
1862
1861
|
const runStatus = await agent.getRunStatus();
|
|
1863
|
-
if (runStatus !== "interrupted")
|
|
1862
|
+
if (runStatus !== "interrupted") return [];
|
|
1864
1863
|
const state = await agent.getCurrentState();
|
|
1865
1864
|
const interrupts = state.tasks?.flatMap((t) => t.interrupts || []) || [];
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
}
|
|
1880
|
-
|
|
1865
|
+
return interrupts.map((i) => ({
|
|
1866
|
+
runId: r.id,
|
|
1867
|
+
assistantId: r.assistantId,
|
|
1868
|
+
assistantName: nameMap[r.assistantId] || r.assistantId,
|
|
1869
|
+
threadId: r.threadId,
|
|
1870
|
+
tenantId: r.tenantId,
|
|
1871
|
+
interruptId: i.id,
|
|
1872
|
+
interruptValue: i.value,
|
|
1873
|
+
startedAt: r.startedAt,
|
|
1874
|
+
totalEdges: r.totalEdges,
|
|
1875
|
+
completedEdges: r.completedEdges
|
|
1876
|
+
}));
|
|
1877
|
+
} catch (err) {
|
|
1878
|
+
request.log.warn({ runId: r.id, error: err.message }, "Agent check skipped");
|
|
1879
|
+
return [];
|
|
1881
1880
|
}
|
|
1882
|
-
}
|
|
1881
|
+
});
|
|
1882
|
+
const results = await Promise.all(checkPromises);
|
|
1883
|
+
const inboxItems = results.flat();
|
|
1883
1884
|
inboxItems.sort(
|
|
1884
1885
|
(a, b) => new Date(b.startedAt).getTime() - new Date(a.startedAt).getTime()
|
|
1885
1886
|
);
|
|
@@ -2029,6 +2030,10 @@ async function replyInboxTask(request, reply) {
|
|
|
2029
2030
|
tenant_id: tenantId
|
|
2030
2031
|
});
|
|
2031
2032
|
try {
|
|
2033
|
+
const queueStore = agent.getQueueStore?.() || agent.queueStore;
|
|
2034
|
+
if (queueStore?.resetProcessingToPending) {
|
|
2035
|
+
await queueStore.resetProcessingToPending(run.threadId);
|
|
2036
|
+
}
|
|
2032
2037
|
await agent.addMessage({
|
|
2033
2038
|
input: { message: "Clarification answers submitted" },
|
|
2034
2039
|
command: {
|
|
@@ -2039,6 +2044,7 @@ async function replyInboxTask(request, reply) {
|
|
|
2039
2044
|
}
|
|
2040
2045
|
}
|
|
2041
2046
|
});
|
|
2047
|
+
await agent.startQueueProcessorIfNeeded();
|
|
2042
2048
|
} catch (error) {
|
|
2043
2049
|
return reply.status(400).send({
|
|
2044
2050
|
success: false,
|