dsh-model-think-level 2.6.0 → 2.6.2

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.
@@ -12,6 +12,13 @@
12
12
  * every key reaches the same relay, and the relay's own pool decides which
13
13
  * resource sees the request.
14
14
  *
15
+ * The same fan-out produces a second wording when the pool keeps a tool call's
16
+ * `fc_` handle but not the `rs_` reasoning item minted with it: the server
17
+ * answers `Item 'fc_…' of type 'function_call' was provided without its
18
+ * required 'reasoning' item: 'rs_…'`. That is the same condition — the replayed
19
+ * history and the backend serving it disagree about the items — so it shares
20
+ * one recognition point and one degradation ladder with the resource refusal.
21
+ *
15
22
  * Two facts make this module structural rather than a fetch-layer patch:
16
23
  *
17
24
  * 1. The refusal arrives in more than one shape. A relay may answer `400` with
@@ -36,6 +43,8 @@
36
43
  * item as new instead of resolving a foreign handle. A text signature cannot
37
44
  * keep its `phase` once the id is gone: pi-ai only reads `{v:1, id, phase?}`,
38
45
  * and a signature without a string `id` is sent verbatim as the item id.
46
+ * This is also the repair for a split `fc_`/`rs_` pair: with no item handle
47
+ * on the function call, the server stops looking for its reasoning sibling.
39
48
  * 2. `drop_reasoning` — additionally stop replaying historical reasoning items
40
49
  * altogether (the `thinkingSignature` is removed; the visible thinking text
41
50
  * stays in the local history untouched). Reasoning is the other thing bound
@@ -53,7 +62,9 @@ export declare const HISTORY_INSPECT_LIMIT = 65536;
53
62
  /** How long an error body may take before inspection is abandoned. */
54
63
  export declare const HISTORY_INSPECT_TIMEOUT_MS = 2000;
55
64
  /**
56
- * Whether a provider message is the resource-mismatch refusal.
65
+ * Whether a provider message is one of the foreign-history refusals: an item
66
+ * minted under another backend resource, or a tool call whose paired reasoning
67
+ * item the relay no longer replays.
57
68
  * @param text - the error body or stream error message, decoded.
58
69
  * @returns whether the history (not the request shape) is what failed.
59
70
  */
package/lib/index.js CHANGED
@@ -3421,8 +3421,11 @@ var RESOURCE_MISMATCH = [
3421
3421
  /created under a different [a-z0-9 ._-]{0,48}?resource/i,
3422
3422
  /same resource that created the item/i
3423
3423
  ];
3424
+ var ITEM_PAIRING_MISMATCH = [
3425
+ /provided without its required [^\n]{0,40}?reasoning/i
3426
+ ];
3424
3427
  function isHistoryStateMismatch(text) {
3425
- return RESOURCE_MISMATCH.some((pattern) => pattern.test(text));
3428
+ return RESOURCE_MISMATCH.some((pattern) => pattern.test(text)) || ITEM_PAIRING_MISMATCH.some((pattern) => pattern.test(text));
3426
3429
  }
3427
3430
  var HISTORY_STAGES = ["portable_ids", "drop_reasoning"];
3428
3431
  function degradeForHistory(context, stage) {