@rulvar/anthropic 1.236.0 → 1.237.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.
Files changed (2) hide show
  1. package/dist/index.js +21 -6
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -135,15 +135,30 @@ const ANTHROPIC_PRICING = {
135
135
  return models;
136
136
  })()
137
137
  };
138
+ /**
139
+ * The documented snapshot grammar: `<exact model>-YYYYMMDD`. Nothing
140
+ * else inherits a table row (RV3303, the posture openai adopted in the
141
+ * v1.17.0 review P1-1): the general prefix matcher let ANY suffix of a
142
+ * known name inherit the full row, so a preview or sibling variant the
143
+ * table has never seen, `claude-sonnet-5-preview` say, silently took
144
+ * the known model's caps AND its promotional pricing, which is exactly
145
+ * the fabricated row the unknown model contract above forbids. The
146
+ * 2026-08-12 comparison run named this counterexample: a suffix
147
+ * inheriting a promotion that ends on 2026-08-31. An unknown suffix
148
+ * now falls through to the conservative unpriced caps, and a dated
149
+ * snapshot resolves only through its EXACT base name, which also keeps
150
+ * the old guarantee that a snapshot of a longer name never lands on a
151
+ * shorter sibling entry.
152
+ */
153
+ const DATED_SNAPSHOT = /^(?<base>.+)-\d{8}$/u;
138
154
  function anthropicModelInfo(model) {
139
155
  const exact = ANTHROPIC_MODELS[model];
140
156
  if (exact !== void 0) return exact;
141
- let best;
142
- for (const [name, info] of Object.entries(ANTHROPIC_MODELS)) if (model.startsWith(`${name}-`) && (best === void 0 || name.length > best.name.length)) best = {
143
- name,
144
- info
145
- };
146
- if (best !== void 0) return best.info;
157
+ const snapshot = DATED_SNAPSHOT.exec(model)?.groups?.base;
158
+ if (snapshot !== void 0) {
159
+ const base = ANTHROPIC_MODELS[snapshot];
160
+ if (base !== void 0) return base;
161
+ }
147
162
  return current(4e5, 64e3, void 0, 4096);
148
163
  }
149
164
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rulvar/anthropic",
3
- "version": "1.236.0",
3
+ "version": "1.237.0",
4
4
  "description": "Rulvar first-class provider adapter over @anthropic-ai/sdk.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -23,13 +23,13 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@anthropic-ai/sdk": "^0.115.0",
26
- "@rulvar/core": "1.236.0"
26
+ "@rulvar/core": "1.237.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@types/node": "^22.20.1",
30
30
  "tsdown": "^0.22.14",
31
31
  "typescript": "~6.0.3",
32
- "@rulvar/testing": "1.236.0"
32
+ "@rulvar/testing": "1.237.0"
33
33
  },
34
34
  "repository": {
35
35
  "type": "git",