openmates 0.14.8-alpha.7 → 0.14.8-alpha.8
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/{chunk-S2QEBRF3.js → chunk-T57PL63X.js} +29 -2
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -1278,6 +1278,21 @@ function parsePendingTaskUpdateJobs(value) {
|
|
|
1278
1278
|
return [job];
|
|
1279
1279
|
});
|
|
1280
1280
|
}
|
|
1281
|
+
function parseAvailableRecoveryJobs(value) {
|
|
1282
|
+
if (!Array.isArray(value)) return [];
|
|
1283
|
+
return value.flatMap((item) => {
|
|
1284
|
+
if (!item || typeof item !== "object" || Array.isArray(item)) return [];
|
|
1285
|
+
const raw = item;
|
|
1286
|
+
if (typeof raw.job_id !== "string" || typeof raw.chat_id !== "string" || typeof raw.turn_id !== "string" || typeof raw.assistant_message_id !== "string" || typeof raw.chat_key_version !== "number") return [];
|
|
1287
|
+
return [{
|
|
1288
|
+
job_id: raw.job_id,
|
|
1289
|
+
chat_id: raw.chat_id,
|
|
1290
|
+
turn_id: raw.turn_id,
|
|
1291
|
+
assistant_message_id: raw.assistant_message_id,
|
|
1292
|
+
chat_key_version: raw.chat_key_version
|
|
1293
|
+
}];
|
|
1294
|
+
});
|
|
1295
|
+
}
|
|
1281
1296
|
var OpenMatesWsClient = class {
|
|
1282
1297
|
socket;
|
|
1283
1298
|
passiveTaskUpdateJobs = /* @__PURE__ */ new Map();
|
|
@@ -1740,6 +1755,16 @@ var OpenMatesWsClient = class {
|
|
|
1740
1755
|
maybeResolve();
|
|
1741
1756
|
return;
|
|
1742
1757
|
}
|
|
1758
|
+
if (type === "recovery_jobs_available") {
|
|
1759
|
+
const job = parseAvailableRecoveryJobs(p.jobs).find(
|
|
1760
|
+
(candidate) => candidate.chat_id === chatId && (!options?.recoveryTurnId || candidate.turn_id === options.recoveryTurnId)
|
|
1761
|
+
);
|
|
1762
|
+
if (!job) return;
|
|
1763
|
+
recoveryJobId = job.job_id;
|
|
1764
|
+
messageId = job.assistant_message_id;
|
|
1765
|
+
scheduleResolve(latestContent);
|
|
1766
|
+
return;
|
|
1767
|
+
}
|
|
1743
1768
|
if (type === "ai_message_update") {
|
|
1744
1769
|
const msgId = p.user_message_id ?? p.userMessageId;
|
|
1745
1770
|
if (msgId !== userMessageId && p.chat_id !== chatId) return;
|
|
@@ -5078,7 +5103,8 @@ var OpenMatesClient = class _OpenMatesClient {
|
|
|
5078
5103
|
if (params.precollectResponse && !params.incognito) {
|
|
5079
5104
|
precollectedResponse = ws.collectAiResponse(messageId, chatId, {
|
|
5080
5105
|
onStream: params.onStream,
|
|
5081
|
-
timeoutMs: params.responseTimeoutMs
|
|
5106
|
+
timeoutMs: params.responseTimeoutMs,
|
|
5107
|
+
recoveryTurnId: savedTurnId
|
|
5082
5108
|
});
|
|
5083
5109
|
}
|
|
5084
5110
|
const confirmed = ws.waitForMessage(
|
|
@@ -5493,7 +5519,8 @@ var OpenMatesClient = class _OpenMatesClient {
|
|
|
5493
5519
|
try {
|
|
5494
5520
|
const resp = await (precollectedResponse ?? ws.collectAiResponse(messageId, chatId, {
|
|
5495
5521
|
...streamOpts,
|
|
5496
|
-
timeoutMs: params.responseTimeoutMs
|
|
5522
|
+
timeoutMs: params.responseTimeoutMs,
|
|
5523
|
+
recoveryTurnId: savedTurnId
|
|
5497
5524
|
}));
|
|
5498
5525
|
assistantMessageId = resp.messageId;
|
|
5499
5526
|
assistant = resp.content;
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED