@ynhcj/xiaoyi-channel 0.0.58-next → 0.0.59-next

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.
@@ -23,12 +23,13 @@ function isRetryableProviderError(message) {
23
23
  return true;
24
24
  return false;
25
25
  }
26
- /** Compute retry delay in ms for the given 1-based attempt. */
26
+ /** Compute retry delay in ms for the given 1-based attempt, with up to 10s jitter. */
27
27
  function getRetryDelayMs(attempt) {
28
- // attempt 1→10s, 2→20s, 3→40s, 4+→60s
29
- if (attempt <= RETRY_DELAYS_MS.length)
30
- return RETRY_DELAYS_MS[attempt - 1];
31
- return RETRY_DELAYS_MS[RETRY_DELAYS_MS.length - 1]; // 60s cap
28
+ const base = attempt <= RETRY_DELAYS_MS.length
29
+ ? RETRY_DELAYS_MS[attempt - 1]
30
+ : RETRY_DELAYS_MS[RETRY_DELAYS_MS.length - 1];
31
+ const jitter = Math.floor(Math.random() * 10_000);
32
+ return base + jitter;
32
33
  }
33
34
  function sleep(ms) {
34
35
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -206,6 +207,7 @@ export const xiaoyiProvider = {
206
207
  // Wait for the stream to settle (done or error) to inspect the result.
207
208
  // stream.result() resolves to the final AssistantMessage (even on error).
208
209
  const result = await stream.result();
210
+ console.log("[provider] stream result:", result);
209
211
  // Check if this is a retryable error
210
212
  if (result.stopReason === "error" && isRetryableProviderError(result.errorMessage)) {
211
213
  const delayMs = getRetryDelayMs(attempt);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.58-next",
3
+ "version": "0.0.59-next",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",