@parall/parall 1.50.1 → 1.52.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.
@@ -1 +1 @@
1
- {"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,uGAAuG;AACvG,KAAK,qBAAqB,CAAC,CAAC,GAAG,OAAO,IAAI,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AACnF,OAAO,EAUL,KAAK,eAAe,EAGrB,MAAM,oBAAoB,CAAC;AAqB5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AA+KxD,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAClD,IAAI,EAAE,aAAa,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,eAAe,CA8KlB;AAED,eAAO,MAAM,aAAa,EAAE,qBAAqB,CAAC,qBAAqB,CAmMtE,CAAC"}
1
+ {"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,uGAAuG;AACvG,KAAK,qBAAqB,CAAC,CAAC,GAAG,OAAO,IAAI,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AACnF,OAAO,EAUL,KAAK,eAAe,EAIrB,MAAM,oBAAoB,CAAC;AAqB5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAwMxD,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAClD,IAAI,EAAE,aAAa,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,eAAe,CAwLlB;AAED,eAAO,MAAM,aAAa,EAAE,qBAAqB,CAAC,qBAAqB,CAmMtE,CAAC"}
package/dist/gateway.js CHANGED
@@ -87,6 +87,32 @@ function buildInboundHistory(events) {
87
87
  };
88
88
  });
89
89
  }
90
+ const OC_AUTH_TEXT = /unauthorized|401|403|invalid api key|authentication/i;
91
+ const OC_CONTEXT_TEXT = /context (window|length)|prompt is too long|request too large|413/i;
92
+ const OC_API_TEXT = /overloaded|429|rate limit|5\d\d|bad gateway|service unavailable|timeout/i;
93
+ /**
94
+ * Best-effort classification of an OpenClaw dispatch failure
95
+ * (agent-turn-outcome-design.md §4.3). OpenClaw surfaces LLM errors as
96
+ * opaque thrown Errors, so this is message sniffing only: auth / context /
97
+ * api families when recognizable, runtime_crash otherwise. usage_limit is
98
+ * deliberately never produced here — OpenClaw's own 429 loop-ceiling shares
99
+ * the wording, and a wrong deferral is costlier than a plain retry.
100
+ */
101
+ function classifyOpenClawFailure(err) {
102
+ const message = err instanceof Error ? err.message : String(err);
103
+ let outcome = 'runtime_crash';
104
+ if (OC_AUTH_TEXT.test(message))
105
+ outcome = 'auth';
106
+ else if (OC_CONTEXT_TEXT.test(message))
107
+ outcome = 'context_overflow';
108
+ else if (OC_API_TEXT.test(message))
109
+ outcome = 'api_error';
110
+ return {
111
+ type: 'turn_outcome',
112
+ outcome,
113
+ ...(message ? { detail: message.slice(0, 500) } : {}),
114
+ };
115
+ }
90
116
  function createRuntimeEventStream() {
91
117
  const queue = [];
92
118
  const waiters = [];
@@ -254,7 +280,17 @@ export function createOpenClawDispatchAdapter(opts) {
254
280
  },
255
281
  },
256
282
  });
257
- run.then(() => stream.end()).catch((err) => stream.fail(err));
283
+ run
284
+ .then(() => stream.end())
285
+ .catch((err) => {
286
+ // Best-effort LLM-layer classification before the stream throws
287
+ // (agent-turn-outcome-design.md §4.3): the queue drains ahead of
288
+ // the failure, so the gateway records the class even though the
289
+ // turn still fails. OpenClaw swallows provider detail, so
290
+ // usage_limit detection is deliberately NOT attempted here.
291
+ stream.push(classifyOpenClawFailure(err));
292
+ stream.fail(err);
293
+ });
258
294
  let sessionId;
259
295
  try {
260
296
  sessionId = await Promise.race([