@duetso/agent 0.3.15 → 0.3.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duetso/agent",
3
- "version": "0.3.15",
3
+ "version": "0.3.16",
4
4
  "description": "An opinionated full-stack agent turn runner with native memories, interrupts, and multi-agent orchestration",
5
5
  "keywords": [
6
6
  "agent",
@@ -45,6 +45,10 @@
45
45
  * marker pi-ai emits when `maxRetryDelayMs` is exceeded so higher-level
46
46
  * logic can take over).
47
47
  *
48
+ * Beyond that mirror, this module also retries a provider failure that
49
+ * arrives with no cause attributed to it — see
50
+ * `UNATTRIBUTED_PROVIDER_FAILURE_PATTERN`.
51
+ *
48
52
  * Context-overflow errors are handled by `tryRecoverFromContextOverflow`
49
53
  * and intentionally skipped here. Client errors (4xx other than 429) are
50
54
  * not retried because retrying with the same payload will not change the
@@ -1 +1 @@
1
- {"version":3,"file":"transient-error.d.ts","sourceRoot":"","sources":["../../../src/turn-runner/transient-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAmBlE;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAIhF;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,OAAO,CAK/E;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,8BAA8B,EAAE,oBAI5C,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,oBAAqD,GAC5D,MAAM,CAKR"}
1
+ {"version":3,"file":"transient-error.d.ts","sourceRoot":"","sources":["../../../src/turn-runner/transient-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAyClE;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAMhF;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,OAAO,CAK/E;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,8BAA8B,EAAE,oBAI5C,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,MAAM,GAAE,oBAAqD,GAC5D,MAAM,CAKR"}
@@ -45,6 +45,10 @@
45
45
  * marker pi-ai emits when `maxRetryDelayMs` is exceeded so higher-level
46
46
  * logic can take over).
47
47
  *
48
+ * Beyond that mirror, this module also retries a provider failure that
49
+ * arrives with no cause attributed to it — see
50
+ * `UNATTRIBUTED_PROVIDER_FAILURE_PATTERN`.
51
+ *
48
52
  * Context-overflow errors are handled by `tryRecoverFromContextOverflow`
49
53
  * and intentionally skipped here. Client errors (4xx other than 429) are
50
54
  * not retried because retrying with the same payload will not change the
@@ -63,6 +67,27 @@ const TRANSIENT_PATTERN = /overloaded|provider.?returned.?error|rate.?limit|too
63
67
  * because the server is asking the caller to back off and try again.
64
68
  */
65
69
  const NON_RETRYABLE_PATTERN = /\b(?:400|401|402|403|404|405|406|407|408|410|411|412|413|414|415|416|417|418|421|422|423|424|425|426|428|431|451)\b|\bunauthorized\b|\bforbidden\b|\bnot found\b/i;
70
+ /**
71
+ * A provider stream that failed without attributing a cause.
72
+ *
73
+ * pi-ai's `response.failed` handler renders the failure as `${error.code ||
74
+ * "unknown"}: ${error.message}` when the provider sends no code, and
75
+ * `Unknown error (no error details in response)` when it sends no error
76
+ * object at all — OpenRouter passthrough is the common source of both. That
77
+ * is the shape a transient upstream blip takes when it lands mid-response,
78
+ * and it earns another attempt: the alternative is discarding a whole turn's
79
+ * work over a hiccup that usually clears on the next call.
80
+ *
81
+ * Anchored to the head of the message deliberately. A bare `unknown`
82
+ * anywhere would also match genuinely terminal failures like "unknown model"
83
+ * or "unknown parameter", which fail identically however many times they
84
+ * run. `NON_RETRYABLE_PATTERN` is still consulted first, so an unattributed
85
+ * wrapper around a 4xx stays terminal.
86
+ *
87
+ * Kept separate from `TRANSIENT_PATTERN` because that regex mirrors
88
+ * pi-coding-agent's; this rule is ours.
89
+ */
90
+ const UNATTRIBUTED_PROVIDER_FAILURE_PATTERN = /^unknown:|^unknown error \(no error details/i;
66
91
  /**
67
92
  * Returns true when `errorMessage` looks like a transient gateway/transport
68
93
  * failure that another attempt may resolve. Returns false for client errors
@@ -73,7 +98,7 @@ export function isTransientServerError(errorMessage) {
73
98
  return false;
74
99
  if (NON_RETRYABLE_PATTERN.test(errorMessage))
75
100
  return false;
76
- return TRANSIENT_PATTERN.test(errorMessage);
101
+ return (TRANSIENT_PATTERN.test(errorMessage) || UNATTRIBUTED_PROVIDER_FAILURE_PATTERN.test(errorMessage));
77
102
  }
78
103
  /**
79
104
  * True when the last assistant message in `messages` is a transient-error
@@ -1 +1 @@
1
- {"version":3,"file":"transient-error.js","sourceRoot":"","sources":["../../../src/turn-runner/transient-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAIH;;;;GAIG;AACH,MAAM,iBAAiB,GACrB,6fAA6f,CAAC;AAEhg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IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC;IACvE,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IACxD,MAAM,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;IAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;AACrC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duetso/agent",
3
- "version": "0.3.15",
3
+ "version": "0.3.16",
4
4
  "description": "An opinionated full-stack agent turn runner with native memories, interrupts, and multi-agent orchestration",
5
5
  "keywords": [
6
6
  "agent",