openmates 0.14.8-alpha.10 → 0.14.8-alpha.11

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.
@@ -1239,6 +1239,17 @@ function errorFrameBelongsToAiResponse(envelope, userMessageId, chatId, recovery
1239
1239
  }
1240
1240
  return !scoped || Boolean(errorChatId || errorMessageId || errorTurnId);
1241
1241
  }
1242
+ function scopedErrorMissesPredicate(envelope, predicate) {
1243
+ if (envelope.type !== "error" || !predicate) return false;
1244
+ const payload = envelope.payload && typeof envelope.payload === "object" ? envelope.payload : {};
1245
+ const hasScope = typeof payload.turn_id === "string" || typeof payload.chat_id === "string" || typeof payload.message_id === "string" || typeof payload.user_message_id === "string" || typeof payload.userMessageId === "string" || typeof payload.job_id === "string";
1246
+ if (!hasScope) return false;
1247
+ try {
1248
+ return !predicate(payload);
1249
+ } catch {
1250
+ return false;
1251
+ }
1252
+ }
1242
1253
  function parseTaskProposals(value) {
1243
1254
  if (!Array.isArray(value)) return [];
1244
1255
  return value.flatMap((item) => {
@@ -1418,6 +1429,7 @@ var OpenMatesWsClient = class {
1418
1429
  if (typeof parsed.type === "string") seenTypes.add(parsed.type);
1419
1430
  const protocolError = websocketProtocolError(parsed);
1420
1431
  if (protocolError) {
1432
+ if (scopedErrorMissesPredicate(parsed, predicate)) return;
1421
1433
  cleanup();
1422
1434
  reject(protocolError);
1423
1435
  return;
@@ -5109,7 +5121,10 @@ var OpenMatesClient = class _OpenMatesClient {
5109
5121
  updated_at: createdAt
5110
5122
  };
5111
5123
  }
5112
- const preflightAck = ws.waitForMessage("chat_turn_preflight_ack");
5124
+ const preflightAck = ws.waitForMessage(
5125
+ "chat_turn_preflight_ack",
5126
+ (payload) => payload.turn_id === turnId
5127
+ );
5113
5128
  let ackPayload;
5114
5129
  try {
5115
5130
  await ws.sendAsync("chat_turn_preflight", preflightPayload);
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  getExtForLang,
4
4
  serializeToYaml
5
- } from "./chunk-WEU7CSZD.js";
5
+ } from "./chunk-6URDLYLM.js";
6
6
  import "./chunk-AXNRPVLE.js";
7
7
  export {
8
8
  getExtForLang,
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ import {
29
29
  renderSupportInfo,
30
30
  serializeToYaml,
31
31
  unwrapApiKeyMasterKey
32
- } from "./chunk-WEU7CSZD.js";
32
+ } from "./chunk-6URDLYLM.js";
33
33
  import "./chunk-AXNRPVLE.js";
34
34
 
35
35
  // src/generated/appSkills.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmates",
3
- "version": "0.14.8-alpha.10",
3
+ "version": "0.14.8-alpha.11",
4
4
  "description": "OpenMates CLI and SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",