@namzu/sdk 22.1.0 → 23.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 23.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - f58a086: Compaction's model table reported 200k for every Claude model, including the ones whose context window is 1M.
8
+
9
+ `resolveContextWindow` (and `lookupContextWindow` under it) now answers 1,000,000 for `claude-fable-5`, `claude-mythos-*`, `claude-opus-5`, `claude-sonnet-5`, `claude-opus-4-6`, `claude-opus-4-7`, `claude-opus-4-8` and `claude-sonnet-4-6`. It still answers 200,000 for the 4.5 generation (`claude-opus-4-5`, `claude-sonnet-4-5`, `claude-haiku-4-5`), for the 3.x models, and for any unlisted `claude-` id.
10
+
11
+ **What changes for you.** The compaction trigger measures fullness against this window and fires at 0.7 of it. On a 1M model that threshold moves from ~140k to ~700k, so a long run now compacts once where it used to compact several times — and stops discarding its prompt-cache prefix to do it. This is the intended correction: at 200k the trigger was firing at about 14% of the real window.
12
+
13
+ **If you were relying on the old number,** pass the window explicitly — `contextWindowTokens` on the run config takes precedence over the table and always has:
14
+
15
+ ```ts
16
+ {
17
+ contextWindowTokens: 200_000;
18
+ }
19
+ ```
20
+
21
+ Do that if your endpoint caps the window below the model's published maximum (an older gateway, a proxy, or a tenant limit). Without it, a run against such an endpoint will now build a larger context than the endpoint accepts and fail with `context_length_exceeded` rather than compacting — which is the case this bump is `major` for.
22
+
23
+ The values are read off the published model comparison. The durable fix is for a driver to ask the provider for the window per model id instead of consulting a table that drifts every release; this change does not do that.
24
+
3
25
  ## 22.1.0
4
26
 
5
27
  ### Minor Changes
@@ -13,6 +13,21 @@
13
13
  *
14
14
  * The table is a floor, not an oracle: a host that knows better passes
15
15
  * `contextWindowTokens` explicitly and this file is never consulted.
16
+ *
17
+ * "Floor" governs the model we do NOT recognise — that is what
18
+ * `DEFAULT_ASSUMED_CONTEXT_WINDOW` is for. It does not license a wrong
19
+ * number for a model the table names. Every entry below carried 200k for
20
+ * the whole Claude family, including the models whose window is 1M, and
21
+ * understating a window by 5x is not caution: the trigger fires at 0.7 x
22
+ * the divisor, so a 1M-window run compacted at ~14% full. Each of those
23
+ * runs paid a summarization pass it did not need and threw away the prompt
24
+ * cache prefix to do it.
25
+ *
26
+ * The values are read off the published model comparison rather than
27
+ * recalled. The durable fix is to ask the provider — the Models API
28
+ * reports a window per model id — which would end the drift this table
29
+ * accumulates every release. Until a driver does that, an entry here is
30
+ * only ever as fresh as the day someone checked it.
16
31
  */
17
32
  /**
18
33
  * Conservative default for a model we do not recognise.
@@ -1 +1 @@
1
- {"version":3,"file":"context-window.d.ts","sourceRoot":"","sources":["../../src/compaction/context-window.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,SAAU,CAAA;AA2CrD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAOjF;AAED,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,aAAa,GAAG,SAAS,CAAA;CACrD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CACnC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,KAAK,EAAE,MAAM,GAAG,SAAS,GACvB,qBAAqB,CASvB"}
1
+ {"version":3,"file":"context-window.d.ts","sourceRoot":"","sources":["../../src/compaction/context-window.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B,SAAU,CAAA;AAqDrD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAOjF;AAED,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,aAAa,GAAG,SAAS,CAAA;CACrD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CACnC,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,KAAK,EAAE,MAAM,GAAG,SAAS,GACvB,qBAAqB,CASvB"}
@@ -13,6 +13,21 @@
13
13
  *
14
14
  * The table is a floor, not an oracle: a host that knows better passes
15
15
  * `contextWindowTokens` explicitly and this file is never consulted.
16
+ *
17
+ * "Floor" governs the model we do NOT recognise — that is what
18
+ * `DEFAULT_ASSUMED_CONTEXT_WINDOW` is for. It does not license a wrong
19
+ * number for a model the table names. Every entry below carried 200k for
20
+ * the whole Claude family, including the models whose window is 1M, and
21
+ * understating a window by 5x is not caution: the trigger fires at 0.7 x
22
+ * the divisor, so a 1M-window run compacted at ~14% full. Each of those
23
+ * runs paid a summarization pass it did not need and threw away the prompt
24
+ * cache prefix to do it.
25
+ *
26
+ * The values are read off the published model comparison rather than
27
+ * recalled. The durable fix is to ask the provider — the Models API
28
+ * reports a window per model id — which would end the drift this table
29
+ * accumulates every release. Until a driver does that, an entry here is
30
+ * only ever as fresh as the day someone checked it.
16
31
  */
17
32
  /**
18
33
  * Conservative default for a model we do not recognise.
@@ -29,10 +44,20 @@ export const DEFAULT_ASSUMED_CONTEXT_WINDOW = 128_000;
29
44
  * over a shorter one that also prefixes it.
30
45
  */
31
46
  const WINDOWS = [
32
- ['claude-fable-5', 200_000],
33
- ['claude-opus-5', 200_000],
34
- ['claude-sonnet-5', 200_000],
47
+ ['claude-fable-5', 1_000_000],
48
+ ['claude-mythos', 1_000_000],
49
+ ['claude-opus-5', 1_000_000],
50
+ ['claude-sonnet-5', 1_000_000],
51
+ ['claude-opus-4-8', 1_000_000],
52
+ ['claude-opus-4-7', 1_000_000],
53
+ ['claude-opus-4-6', 1_000_000],
54
+ ['claude-sonnet-4-6', 1_000_000],
55
+ // The 4.5 generation is 200k, so the two 4.5 keys have to out-rank the
56
+ // bare `claude-opus-4` / `claude-sonnet-4` entries below AND stay
57
+ // distinct from their 1M siblings above. Longest-key-wins does that.
35
58
  ['claude-haiku-4-5', 200_000],
59
+ ['claude-sonnet-4-5', 200_000],
60
+ ['claude-opus-4-5', 200_000],
36
61
  ['claude-opus-4', 200_000],
37
62
  ['claude-sonnet-4', 200_000],
38
63
  ['claude-3-7-sonnet', 200_000],
@@ -1 +1 @@
1
- {"version":3,"file":"context-window.js","sourceRoot":"","sources":["../../src/compaction/context-window.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,OAAO,CAAA;AAErD;;;;;GAKG;AACH,MAAM,OAAO,GAA6D;IACzE,CAAC,gBAAgB,EAAE,OAAO,CAAC;IAC3B,CAAC,eAAe,EAAE,OAAO,CAAC;IAC1B,CAAC,iBAAiB,EAAE,OAAO,CAAC;IAC5B,CAAC,kBAAkB,EAAE,OAAO,CAAC;IAC7B,CAAC,eAAe,EAAE,OAAO,CAAC;IAC1B,CAAC,iBAAiB,EAAE,OAAO,CAAC;IAC5B,CAAC,mBAAmB,EAAE,OAAO,CAAC;IAC9B,CAAC,mBAAmB,EAAE,OAAO,CAAC;IAC9B,CAAC,kBAAkB,EAAE,OAAO,CAAC;IAC7B,CAAC,eAAe,EAAE,OAAO,CAAC;IAC1B,CAAC,SAAS,EAAE,OAAO,CAAC;IACpB,CAAC,OAAO,EAAE,OAAO,CAAC;IAClB,CAAC,SAAS,EAAE,SAAS,CAAC;IACtB,CAAC,QAAQ,EAAE,OAAO,CAAC;IACnB,CAAC,aAAa,EAAE,OAAO,CAAC;IACxB,CAAC,OAAO,EAAE,KAAK,CAAC;IAChB,CAAC,eAAe,EAAE,MAAM,CAAC;IACzB,CAAC,I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AAA;AACjB,CAAC;AAOD;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CACnC,UAA8B,EAC9B,KAAyB;IAEzB,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QAChD,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAA;IAChD,CAAC;IACD,MAAM,KAAK,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAA;IACxC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,CAAA;IAChD,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,8BAA8B,EAAE,MAAM,EAAE,SAAS,EAAE,CAAA;AACrE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@namzu/sdk",
3
- "version": "22.1.0",
3
+ "version": "23.0.0",
4
4
  "description": "Open-source AI agent SDK with a built-in runtime. Nothing between you and your agents.",
5
5
  "license": "FSL-1.1-MIT",
6
6
  "type": "module",
@@ -13,6 +13,21 @@
13
13
  *
14
14
  * The table is a floor, not an oracle: a host that knows better passes
15
15
  * `contextWindowTokens` explicitly and this file is never consulted.
16
+ *
17
+ * "Floor" governs the model we do NOT recognise — that is what
18
+ * `DEFAULT_ASSUMED_CONTEXT_WINDOW` is for. It does not license a wrong
19
+ * number for a model the table names. Every entry below carried 200k for
20
+ * the whole Claude family, including the models whose window is 1M, and
21
+ * understating a window by 5x is not caution: the trigger fires at 0.7 x
22
+ * the divisor, so a 1M-window run compacted at ~14% full. Each of those
23
+ * runs paid a summarization pass it did not need and threw away the prompt
24
+ * cache prefix to do it.
25
+ *
26
+ * The values are read off the published model comparison rather than
27
+ * recalled. The durable fix is to ask the provider — the Models API
28
+ * reports a window per model id — which would end the drift this table
29
+ * accumulates every release. Until a driver does that, an entry here is
30
+ * only ever as fresh as the day someone checked it.
16
31
  */
17
32
 
18
33
  /**
@@ -31,10 +46,20 @@ export const DEFAULT_ASSUMED_CONTEXT_WINDOW = 128_000
31
46
  * over a shorter one that also prefixes it.
32
47
  */
33
48
  const WINDOWS: ReadonlyArray<readonly [prefix: string, tokens: number]> = [
34
- ['claude-fable-5', 200_000],
35
- ['claude-opus-5', 200_000],
36
- ['claude-sonnet-5', 200_000],
49
+ ['claude-fable-5', 1_000_000],
50
+ ['claude-mythos', 1_000_000],
51
+ ['claude-opus-5', 1_000_000],
52
+ ['claude-sonnet-5', 1_000_000],
53
+ ['claude-opus-4-8', 1_000_000],
54
+ ['claude-opus-4-7', 1_000_000],
55
+ ['claude-opus-4-6', 1_000_000],
56
+ ['claude-sonnet-4-6', 1_000_000],
57
+ // The 4.5 generation is 200k, so the two 4.5 keys have to out-rank the
58
+ // bare `claude-opus-4` / `claude-sonnet-4` entries below AND stay
59
+ // distinct from their 1M siblings above. Longest-key-wins does that.
37
60
  ['claude-haiku-4-5', 200_000],
61
+ ['claude-sonnet-4-5', 200_000],
62
+ ['claude-opus-4-5', 200_000],
38
63
  ['claude-opus-4', 200_000],
39
64
  ['claude-sonnet-4', 200_000],
40
65
  ['claude-3-7-sonnet', 200_000],