@namzu/sdk 42.0.1 → 43.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 +82 -0
- package/dist/provider/conformance.d.ts.map +1 -1
- package/dist/provider/conformance.js +13 -1
- package/dist/provider/conformance.js.map +1 -1
- package/dist/runtime/query/callback-inference.d.ts.map +1 -1
- package/dist/runtime/query/callback-inference.js +10 -4
- package/dist/runtime/query/callback-inference.js.map +1 -1
- package/dist/types/provider/model.d.ts +26 -2
- package/dist/types/provider/model.d.ts.map +1 -1
- package/dist/types/run/prepare-step.d.ts +12 -1
- package/dist/types/run/prepare-step.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/provider/conformance.ts +13 -1
- package/src/runtime/query/callback-inference.ts +10 -7
- package/src/types/provider/model.ts +26 -2
- package/src/types/run/prepare-step.ts +12 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,87 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 43.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- e83dfe5: `ModelInfo.inputPrice` and `ModelInfo.outputPrice` are now optional. Six drivers wrote `0` wherever the vendor listing carries no rate; they omit the field instead.
|
|
8
|
+
|
|
9
|
+
A price of zero is not "I do not know" — it is a billing fact. It says the model is free, and it reaches every consumer as a quote: a menu prints `(free)`, a total reports the model as costing nothing, and an operator believes both. The drivers had no way to say anything else, because the type required a number.
|
|
10
|
+
|
|
11
|
+
This is the defect `9d6c482c` removed from `contextWindow`, in the field where a wrong value is money rather than a compaction pass. The distinction was already the house rule one level down: `resolveModelPricing` returns `undefined` for a rate nobody has and `{ inputCostPer1M: 0, outputCostPer1M: 0 }` for a driver that genuinely bills nothing, and its own docblock says a caller that flattens the two reproduces the defect the module exists to remove. `ModelInfo` carried the flattened version to every consumer that never reached that module.
|
|
12
|
+
|
|
13
|
+
**What breaks.** Code reading `model.inputPrice` or `model.outputPrice` as a `number` must handle `undefined`. That is the point — the value was already absent in fact, and the type was asserting otherwise. Treat `undefined` as unknown rather than as free: a caller that renders a price should say "unknown" rather than `$0.00`, and only `0` means the model is free.
|
|
14
|
+
|
|
15
|
+
**What does not change.** A driver that knows a rate of zero still writes `0`. `ollama` and `lmstudio` bill nothing by construction, and the Zen catalogue's free tier is priced from a source that names those models free. Values that were genuinely known are untouched.
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 9661d16: Stop an optional inference from ending the run that made it.
|
|
20
|
+
|
|
21
|
+
`PreparationTextRequest.timeoutMs` is deprecated and no longer bounds the request. An
|
|
22
|
+
auxiliary provider request that ends without its final usage receipt leaves the run's shared
|
|
23
|
+
token ledger unresolved, and an account with unresolved spend admits nothing further — so a
|
|
24
|
+
deadline that fired in normal use did not bound the call, it stopped the run. Against a
|
|
25
|
+
reasoning model whose auxiliary answer took 17 s, every turn after the first ended with
|
|
26
|
+
"usage for a model request could not be confirmed" before the model was ever asked, so no
|
|
27
|
+
tool call in the run could ever execute.
|
|
28
|
+
|
|
29
|
+
What a host observes: a run that used to stop after its first turn now continues. A
|
|
30
|
+
preparation or review inference is bounded by the provider's own request timeout and by the
|
|
31
|
+
run's cancellation — the same two bounds every other model request in the run has — instead
|
|
32
|
+
of by a 10 s deadline of its own; set `runConfig.timeoutMs` to bound the whole turn. Stop
|
|
33
|
+
still cancels an in-flight auxiliary call, and a cancelled call still leaves its unresolved
|
|
34
|
+
receipt visible in `/cost`. Passing `timeoutMs` changes nothing and is still validated; the
|
|
35
|
+
field will be removed in a later major.
|
|
36
|
+
|
|
37
|
+
## 42.0.2
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- 175dab2: Nothing a consumer installs changes. These are devDependencies and toolchain
|
|
42
|
+
pins: no runtime dependency, export, type or default moved, and the published
|
|
43
|
+
surface is identical.
|
|
44
|
+
|
|
45
|
+
Four advisories, all dev-time, closed by moving the package that carried them
|
|
46
|
+
rather than by patching around them:
|
|
47
|
+
|
|
48
|
+
- `knip` `^6.4.1` → `^6.37.0`, which carries `smol-toml` ≥ 1.8.0 — the version
|
|
49
|
+
that fixes `GHSA-7w5x-hrqm-74c2` (a malformed-TOML denial of service).
|
|
50
|
+
- `tsx` `^4.19.0` → `^4.23.13`, which depends on `esbuild ~0.28.0`, fixing
|
|
51
|
+
`GHSA-g7r4-m6w7-qqqr` (arbitrary file read from the development server, and
|
|
52
|
+
only on Windows) — and collapsing two `esbuild` copies in the tree into one.
|
|
53
|
+
- `js-yaml`, twice, fixed by a workspace override rather than a parent upgrade,
|
|
54
|
+
because both copies arrive deep inside the Changesets CLI's own tree:
|
|
55
|
+
`^3.15.2` for the 3.x line and `^4.3.2` for the 4.x line, closing
|
|
56
|
+
`GHSA-2883-xcg3-v3hh` (a merge-key CPU exhaustion). Neither override widens
|
|
57
|
+
beyond what the parent already declared — `3.15.2` satisfies `^3.13.1` and
|
|
58
|
+
`4.3.2` satisfies `^4.1.0` — so no package is forced outside its range.
|
|
59
|
+
|
|
60
|
+
- 8d5223b: Nothing a consumer installs or calls changes, and that is the whole of this
|
|
61
|
+
release. `vitest` moves from `^3.2.6` to `^4.1.11` in the `devDependencies` of
|
|
62
|
+
all nineteen packages that declared it, and `@vitest/coverage-v8` moves with it
|
|
63
|
+
in `@namzu/sdk`. Every occurrence is a devDependency — checked, not assumed —
|
|
64
|
+
so `dependencies`, `peerDependencies`, exports, types, defaults and the wire
|
|
65
|
+
shape are untouched, and the published tarballs differ from the previous
|
|
66
|
+
release only in `package.json#devDependencies`.
|
|
67
|
+
|
|
68
|
+
The reason is a security fix with no 3.x backport. `GHSA-82fw-gwwq-j7x9`
|
|
69
|
+
("Path Traversal / Arbitrary File Read via `@vitest/mocker` Redirect Mock")
|
|
70
|
+
covers `vitest` and `@vitest/mocker` from `2.1.0` up to `4.1.11`, so `^3.2.6`
|
|
71
|
+
can only be resolved by leaving the 3.x line. `4.1.11` is the first patched
|
|
72
|
+
release and is what the lockfile now resolves for both.
|
|
73
|
+
|
|
74
|
+
What this costs anyone who works on the repository rather than with it: the
|
|
75
|
+
upgrade was not a version bump. Vitest 4 changed test discovery, coverage
|
|
76
|
+
configuration, mock construction and reporter output, and each of those broke
|
|
77
|
+
something here that had to be migrated rather than worked around. Those fixes
|
|
78
|
+
are all under `__tests__/`, `vitest.config.ts` files and `scripts/`, none of
|
|
79
|
+
which is published, which is why this is a patch and not a major.
|
|
80
|
+
|
|
81
|
+
You do not need to do anything. If you pin `vitest` yourself to run this
|
|
82
|
+
project's own suites, note that the config files it ships are now written for
|
|
83
|
+
`>= 4.1.11` and will not run under 3.x.
|
|
84
|
+
|
|
3
85
|
## 42.0.1
|
|
4
86
|
|
|
5
87
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conformance.d.ts","sourceRoot":"","sources":["../../src/provider/conformance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,MAAM,6BAA6B,CAAA;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,sEAAsE;AACtE,eAAO,MAAM,gCAAgC,IAAI,CAAA;AAEjD,MAAM,WAAW,gCAAgC;IAChD,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAA;IACtC,QAAQ,CAAC,EAAE,EAAE,aAAa,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAA;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAA;I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AC,WAAW,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,aAAa,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;IAClF,sEAAsE;IACtE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,gCAAgC,GAAG,IAAI,CA0G/F"}
|
|
@@ -89,6 +89,13 @@ export function defineProviderDriverConformance(options) {
|
|
|
89
89
|
// window, and it reads to every consumer as a measurement of a model
|
|
90
90
|
// that can hold nothing.
|
|
91
91
|
//
|
|
92
|
+
// The same reasoning makes `inputPrice`/`outputPrice` optional, and a
|
|
93
|
+
// price is the more expensive of the two to get wrong: a zero window
|
|
94
|
+
// is a nonsensical measurement, where a zero PRICE is a plain claim
|
|
95
|
+
// that a model is free — one a menu will print, and one a `(free)`
|
|
96
|
+
// marker reads as a fact. Six drivers made that claim on every model
|
|
97
|
+
// they could not price.
|
|
98
|
+
//
|
|
92
99
|
// The obvious place to enforce that is here, reading `listModels`.
|
|
93
100
|
// It was here, and it was worse than nothing twice over. For every
|
|
94
101
|
// in-tree driver `listModels` needs a live service, so the rule
|
|
@@ -100,7 +107,12 @@ export function defineProviderDriverConformance(options) {
|
|
|
100
107
|
//
|
|
101
108
|
// The reintroduction of a literal zero is caught by a source scan in
|
|
102
109
|
// `provider/__tests__/conformance-fails-a-wrong-driver.test.ts`,
|
|
103
|
-
// which depends on reaching nothing.
|
|
110
|
+
// which depends on reaching nothing. It holds two further cases for
|
|
111
|
+
// prices, and the sharper of them is not the literal: a price
|
|
112
|
+
// DEFAULTED to zero cannot be written without a `??` or a `||`, and
|
|
113
|
+
// that is catchable without deciding whether any particular `0` was
|
|
114
|
+
// meant — which a text scan never can, since ollama's honest zero and
|
|
115
|
+
// a placeholder zero are the same characters.
|
|
104
116
|
it('declares the retry defaults its conformance run says it does', async () => {
|
|
105
117
|
// The option above forces the decision; this asserts the answer is
|
|
106
118
|
// TRUE of the driver. Without it a package could declare one thing
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conformance.js","sourceRoot":"","sources":["../../src/provider/conformance.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,sEAAsE;AACtE,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAA;AA4CjD,MAAM,UAAU,+BAA+B,CAAC,OAAyC;IACxF,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,GAAG,OAAO,CAAA;IACpE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,iBAAiB,CAAA;IAEhD,QAAQ,CAAC,GAAG,KAAK,uBAAuB,gCAAgC,EAAE,EAAE,GAAG,EAAE;QAChF,EAAE,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;YAC5C,4DAA4D;YAC5D,iEAAiE;YACjE,qDAAqD;YACrD,MAAM,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAA;YAErC,MAAM,CAAC,OAAO,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YACzC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACzC,MAAM,CAAC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YAC3C,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC5C,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,sDAAsD,EAAE,KAAK,IAAI,EAAE;YACrE,gEAAgE;YAChE,iEAAiE;YACjE,iEAAiE;YACjE,2BAA2B;YAC3B,MAAM,QAAQ,GAA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,oEAAoE;QACpE,sEAAsE;QACtE,8CAA8C;QAE9C,EAAE,CAAC,8DAA8D,EAAE,KAAK,IAAI,EAAE;YAC7E,mEAAmE;YACnE,mEAAmE;YACnE,4DAA4D;YAC5D,kDAAkD;YAClD,MAAM,QAAQ,GAAG,MAAM,YAAY,EAAE,CAAA;YAErC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,aAAa,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAC1D,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,aAAa,IAAI,IAAI,CAAC,CAC7C,CAAA;QACF,CAAC,CAAC,CAAA;QAEF,EAAE,CAAC,mDAAmD,EAAE,KAAK,IAAI,EAAE;YAClE,gEAAgE;YAChE,kEAAkE;YAClE,4DAA4D;YAC5D,+DAA+D;YAC/D,qCAAqC;YACrC,MAAM,CAAC,GAAG,MAAM,YAAY,EAAE,CAAA;YAC9B,MAAM,CAAC,GAAG,MAAM,YAAY,EAAE,CAAA;YAE9B,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC5B,CAAC,CAAC,CAAA;IACH,CAAC,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callback-inference.d.ts","sourceRoot":"","sources":["../../../src/runtime/query/callback-inference.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AACpG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAWrE,oFAAoF;AACpF,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,gBAAgB,EACrB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,aAAa,GAAG,QAAQ;;0BAQF,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"callback-inference.d.ts","sourceRoot":"","sources":["../../../src/runtime/query/callback-inference.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AACpG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAWrE,oFAAoF;AACpF,wBAAgB,uBAAuB,CACtC,GAAG,EAAE,gBAAgB,EACrB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,aAAa,GAAG,QAAQ;;0BAQF,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC;EAoEpF"}
|
|
@@ -29,12 +29,19 @@ export function createCallbackInference(ctx, model, phase) {
|
|
|
29
29
|
if (used)
|
|
30
30
|
throw new Error(`${phase === 'preparation' ? 'A' : 'An'} ${owner} may make only one inference call.`);
|
|
31
31
|
used = true;
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
// No deadline of our own on the request — see the note on
|
|
33
|
+
// `PreparationTextRequest.timeoutMs`. The two bounds that remain are
|
|
34
|
+
// the ones every other model request in the run has: the run's own
|
|
35
|
+
// cancellation, and the provider's request timeout. An expired local
|
|
36
|
+
// deadline here would abort a CONTACTED request, and a request that
|
|
37
|
+
// ends without its usage receipt leaves the shared ledger unresolved,
|
|
38
|
+
// which stops the whole run — so a stage that gave up on its own
|
|
39
|
+
// optional inference would take the operator's turn with it. That is
|
|
40
|
+
// not hypothetical: it is what a 10s deadline did to every turn
|
|
41
|
+
// against a reasoning model slower than 10s per auxiliary answer.
|
|
34
42
|
const signal = AbortSignal.any([
|
|
35
43
|
ctx.abortController.signal,
|
|
36
44
|
lifetime.signal,
|
|
37
|
-
deadline.signal,
|
|
38
45
|
...(requestedSignal ? [requestedSignal] : []),
|
|
39
46
|
]);
|
|
40
47
|
const requested = ctx.servingMember?.() ?? { index: 0, providerId: ctx.provider.id };
|
|
@@ -79,7 +86,6 @@ export function createCallbackInference(ctx, model, phase) {
|
|
|
79
86
|
return { text: text.text, usage, servedBy: route() };
|
|
80
87
|
}
|
|
81
88
|
finally {
|
|
82
|
-
clearTimeout(timer);
|
|
83
89
|
if (usage)
|
|
84
90
|
ctx.runMgr.accumulateUsage(usage, route());
|
|
85
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callback-inference.js","sourceRoot":"","sources":["../../../src/runtime/query/callback-inference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AACrE,OAAO,EAAmB,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAIrF,MAAM,aAAa,GAAG,CAAC;KACrB,MAAM,CAAC;IACP,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IACrC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IACrC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;IACzD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;CAC9D,CAAC;KACD,MAAM,EAAE,CAAA;AAEV,oFAAoF;AACpF,MAAM,UAAU,uBAAuB,CACtC,GAAqB,EACrB,KAAa,EACb,KAA+B;IAE/B,MAAM,KAAK,GAAG,KAAK,KAAK,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAA;IAChE,MAAM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,IAAI,CAAC,UAAU,GAAG,IAAI;4BACzB,aAAa,GAAG,GAAG,KAAK,6CAA6C,CAAA;oBACvE,CAAC;gBACF,CAAC;gBACD,MAAM,CAAC,cAAc,EAAE,CAAA;gBACvB,IAAI,CAAC,KAAK;oBAAE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,iCAAiC,CAAC,CAAA;gBACtE,IAAI,aAAa;oBAAE,MAAM,IAAI,KAAK,CAAC,aAAa,CAAC,CAAA;gBACjD,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAA;YACrD,CAAC;oBAAS,CAAC;gBACV,IAAI,KAAK;oBAAE,GAAG,CAAC,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA;YACtD,CAAC;QACF,CAAC;KACD,CAAA;AACF,CAAC"}
|
|
@@ -33,8 +33,32 @@ export interface ModelInfo {
|
|
|
33
33
|
contextWindow?: number;
|
|
34
34
|
/** Same, and absent for the same reason. */
|
|
35
35
|
maxOutputTokens?: number;
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
/**
|
|
37
|
+
* USD per million input tokens, when the driver knows the rate.
|
|
38
|
+
*
|
|
39
|
+
* OPTIONAL, and the optionality is the fix — the same one `contextWindow`
|
|
40
|
+
* got, applied to the field where a zero is most expensive. Six drivers
|
|
41
|
+
* wrote `0` wherever the vendor listing carries no rate, and a price of
|
|
42
|
+
* zero is not "I do not know", it is a billing fact: "this model is
|
|
43
|
+
* free". A consumer summing these under-reports a bill; one offering a
|
|
44
|
+
* `(free)` marker — the read that found this — labels every paid model
|
|
45
|
+
* on a driver that never learned its rates.
|
|
46
|
+
*
|
|
47
|
+
* The distinction is not new here, only lost in transit.
|
|
48
|
+
* `resolveModelPricing` already returns `undefined` for a rate nobody
|
|
49
|
+
* has and `{0, 0}` for a driver that genuinely bills nothing, and says
|
|
50
|
+
* in as many words that a caller flattening the two reproduces the
|
|
51
|
+
* defect the pricing module exists to remove. This field carried the
|
|
52
|
+
* flattened version to every consumer that never reached that module.
|
|
53
|
+
*
|
|
54
|
+
* Absent means unknown. `0` means free, and is only written by a driver
|
|
55
|
+
* that knows it: the local servers, and a catalogue whose source names
|
|
56
|
+
* the model as free. A caller that must show a number should render
|
|
57
|
+
* "unknown" rather than `$0.00`, which is the conclusion being fixed.
|
|
58
|
+
*/
|
|
59
|
+
inputPrice?: number;
|
|
60
|
+
/** Same, and absent for the same reason. */
|
|
61
|
+
outputPrice?: number;
|
|
38
62
|
supportsToolUse: boolean;
|
|
39
63
|
supportsStreaming: boolean;
|
|
40
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/types/provider/model.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAAA;AAE9D,MAAM,WAAW,SAAS;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAA;IAC/C,2GAA2G;IAC3G,qBAAqB,CAAC,EAAE,SAAS,OAAO,WAAW,EAAE,eAAe,EAAE,CAAA;IACtE,uGAAuG;IACvG,sBAAsB,CAAC,EAAE,OAAO,WAAW,EAAE,eAAe,CAAA;IAC5D;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,4CAA4C;IAC5C,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/types/provider/model.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,UAAU,CAAA;AAE9D,MAAM,WAAW,SAAS;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,SAAS,kBAAkB,EAAE,CAAA;IAC/C,2GAA2G;IAC3G,qBAAqB,CAAC,EAAE,SAAS,OAAO,WAAW,EAAE,eAAe,EAAE,CAAA;IACtE,uGAAuG;IACvG,sBAAsB,CAAC,EAAE,OAAO,WAAW,EAAE,eAAe,CAAA;IAC5D;;;;;;;;;;;;OAYG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,4CAA4C;IAC5C,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe,EAAE,OAAO,CAAA;IACxB,iBAAiB,EAAE,OAAO,CAAA;CAC1B"}
|
|
@@ -11,7 +11,18 @@ export interface PreparationTextRequest {
|
|
|
11
11
|
readonly prompt: string;
|
|
12
12
|
/** Default 256; maximum 1,024. A provider limit, not a hard billing ceiling. */
|
|
13
13
|
readonly maxTokens?: number;
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Accepted and validated; no longer bounds the request.
|
|
16
|
+
*
|
|
17
|
+
* @deprecated An auxiliary request that ends without its final usage
|
|
18
|
+
* receipt leaves the run's shared ledger with unresolved spend, which stops
|
|
19
|
+
* the run — so a deadline short enough to fire in normal use does not bound
|
|
20
|
+
* the call, it ends the run that made it. The call is bounded by the
|
|
21
|
+
* provider's own request timeout and by the run's cancellation instead, the
|
|
22
|
+
* same two bounds every other model request in the run has. Passing this
|
|
23
|
+
* field changes nothing; it is retained so an existing caller keeps
|
|
24
|
+
* compiling until it is removed in a later major.
|
|
25
|
+
*/
|
|
15
26
|
readonly timeoutMs?: number;
|
|
16
27
|
readonly signal?: AbortSignal;
|
|
17
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare-step.d.ts","sourceRoot":"","sources":["../../../src/types/run/prepare-step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE/C,0FAA0F;AAC1F,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,gFAAgF;IAChF,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B
|
|
1
|
+
{"version":3,"file":"prepare-step.d.ts","sourceRoot":"","sources":["../../../src/types/run/prepare-step.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE/C,0FAA0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SAAS,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAA;AAEzD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,SAAS,WAAW,EAAE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@namzu/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "43.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
|
"engines": {
|
|
@@ -63,12 +63,12 @@
|
|
|
63
63
|
"@opentelemetry/api": "^1.9.0",
|
|
64
64
|
"@types/brace-expansion": "^1.1.2",
|
|
65
65
|
"@types/node": "^22.19.17",
|
|
66
|
-
"@vitest/coverage-v8": "^
|
|
66
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
67
67
|
"fast-check": "^4.7.0",
|
|
68
68
|
"jsonschema": "^1.5.0",
|
|
69
|
-
"knip": "^6.
|
|
69
|
+
"knip": "^6.37.0",
|
|
70
70
|
"typescript": "^5.5.0",
|
|
71
|
-
"vitest": "^
|
|
71
|
+
"vitest": "^4.1.11",
|
|
72
72
|
"zod": "^3.23.0",
|
|
73
73
|
"zod-to-json-schema": "^3.23.0"
|
|
74
74
|
},
|
|
@@ -149,6 +149,13 @@ export function defineProviderDriverConformance(options: ProviderDriverConforman
|
|
|
149
149
|
// window, and it reads to every consumer as a measurement of a model
|
|
150
150
|
// that can hold nothing.
|
|
151
151
|
//
|
|
152
|
+
// The same reasoning makes `inputPrice`/`outputPrice` optional, and a
|
|
153
|
+
// price is the more expensive of the two to get wrong: a zero window
|
|
154
|
+
// is a nonsensical measurement, where a zero PRICE is a plain claim
|
|
155
|
+
// that a model is free — one a menu will print, and one a `(free)`
|
|
156
|
+
// marker reads as a fact. Six drivers made that claim on every model
|
|
157
|
+
// they could not price.
|
|
158
|
+
//
|
|
152
159
|
// The obvious place to enforce that is here, reading `listModels`.
|
|
153
160
|
// It was here, and it was worse than nothing twice over. For every
|
|
154
161
|
// in-tree driver `listModels` needs a live service, so the rule
|
|
@@ -160,7 +167,12 @@ export function defineProviderDriverConformance(options: ProviderDriverConforman
|
|
|
160
167
|
//
|
|
161
168
|
// The reintroduction of a literal zero is caught by a source scan in
|
|
162
169
|
// `provider/__tests__/conformance-fails-a-wrong-driver.test.ts`,
|
|
163
|
-
// which depends on reaching nothing.
|
|
170
|
+
// which depends on reaching nothing. It holds two further cases for
|
|
171
|
+
// prices, and the sharper of them is not the literal: a price
|
|
172
|
+
// DEFAULTED to zero cannot be written without a `??` or a `||`, and
|
|
173
|
+
// that is catchable without deciding whether any particular `0` was
|
|
174
|
+
// meant — which a text scan never can, since ollama's honest zero and
|
|
175
|
+
// a placeholder zero are the same characters.
|
|
164
176
|
|
|
165
177
|
it('declares the retry defaults its conformance run says it does', async () => {
|
|
166
178
|
// The option above forces the decision; this asserts the answer is
|
|
@@ -39,15 +39,19 @@ export function createCallbackInference(
|
|
|
39
39
|
`${phase === 'preparation' ? 'A' : 'An'} ${owner} may make only one inference call.`,
|
|
40
40
|
)
|
|
41
41
|
used = true
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
// No deadline of our own on the request — see the note on
|
|
43
|
+
// `PreparationTextRequest.timeoutMs`. The two bounds that remain are
|
|
44
|
+
// the ones every other model request in the run has: the run's own
|
|
45
|
+
// cancellation, and the provider's request timeout. An expired local
|
|
46
|
+
// deadline here would abort a CONTACTED request, and a request that
|
|
47
|
+
// ends without its usage receipt leaves the shared ledger unresolved,
|
|
48
|
+
// which stops the whole run — so a stage that gave up on its own
|
|
49
|
+
// optional inference would take the operator's turn with it. That is
|
|
50
|
+
// not hypothetical: it is what a 10s deadline did to every turn
|
|
51
|
+
// against a reasoning model slower than 10s per auxiliary answer.
|
|
47
52
|
const signal = AbortSignal.any([
|
|
48
53
|
ctx.abortController.signal,
|
|
49
54
|
lifetime.signal,
|
|
50
|
-
deadline.signal,
|
|
51
55
|
...(requestedSignal ? [requestedSignal] : []),
|
|
52
56
|
])
|
|
53
57
|
const requested = ctx.servingMember?.() ?? { index: 0, providerId: ctx.provider.id }
|
|
@@ -86,7 +90,6 @@ export function createCallbackInference(
|
|
|
86
90
|
if (invalidOutput) throw new Error(invalidOutput)
|
|
87
91
|
return { text: text.text, usage, servedBy: route() }
|
|
88
92
|
} finally {
|
|
89
|
-
clearTimeout(timer)
|
|
90
93
|
if (usage) ctx.runMgr.accumulateUsage(usage, route())
|
|
91
94
|
}
|
|
92
95
|
},
|
|
@@ -34,8 +34,32 @@ export interface ModelInfo {
|
|
|
34
34
|
contextWindow?: number
|
|
35
35
|
/** Same, and absent for the same reason. */
|
|
36
36
|
maxOutputTokens?: number
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
/**
|
|
38
|
+
* USD per million input tokens, when the driver knows the rate.
|
|
39
|
+
*
|
|
40
|
+
* OPTIONAL, and the optionality is the fix — the same one `contextWindow`
|
|
41
|
+
* got, applied to the field where a zero is most expensive. Six drivers
|
|
42
|
+
* wrote `0` wherever the vendor listing carries no rate, and a price of
|
|
43
|
+
* zero is not "I do not know", it is a billing fact: "this model is
|
|
44
|
+
* free". A consumer summing these under-reports a bill; one offering a
|
|
45
|
+
* `(free)` marker — the read that found this — labels every paid model
|
|
46
|
+
* on a driver that never learned its rates.
|
|
47
|
+
*
|
|
48
|
+
* The distinction is not new here, only lost in transit.
|
|
49
|
+
* `resolveModelPricing` already returns `undefined` for a rate nobody
|
|
50
|
+
* has and `{0, 0}` for a driver that genuinely bills nothing, and says
|
|
51
|
+
* in as many words that a caller flattening the two reproduces the
|
|
52
|
+
* defect the pricing module exists to remove. This field carried the
|
|
53
|
+
* flattened version to every consumer that never reached that module.
|
|
54
|
+
*
|
|
55
|
+
* Absent means unknown. `0` means free, and is only written by a driver
|
|
56
|
+
* that knows it: the local servers, and a catalogue whose source names
|
|
57
|
+
* the model as free. A caller that must show a number should render
|
|
58
|
+
* "unknown" rather than `$0.00`, which is the conclusion being fixed.
|
|
59
|
+
*/
|
|
60
|
+
inputPrice?: number
|
|
61
|
+
/** Same, and absent for the same reason. */
|
|
62
|
+
outputPrice?: number
|
|
39
63
|
supportsToolUse: boolean
|
|
40
64
|
supportsStreaming: boolean
|
|
41
65
|
}
|
|
@@ -12,7 +12,18 @@ export interface PreparationTextRequest {
|
|
|
12
12
|
readonly prompt: string
|
|
13
13
|
/** Default 256; maximum 1,024. A provider limit, not a hard billing ceiling. */
|
|
14
14
|
readonly maxTokens?: number
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Accepted and validated; no longer bounds the request.
|
|
17
|
+
*
|
|
18
|
+
* @deprecated An auxiliary request that ends without its final usage
|
|
19
|
+
* receipt leaves the run's shared ledger with unresolved spend, which stops
|
|
20
|
+
* the run — so a deadline short enough to fire in normal use does not bound
|
|
21
|
+
* the call, it ends the run that made it. The call is bounded by the
|
|
22
|
+
* provider's own request timeout and by the run's cancellation instead, the
|
|
23
|
+
* same two bounds every other model request in the run has. Passing this
|
|
24
|
+
* field changes nothing; it is retained so an existing caller keeps
|
|
25
|
+
* compiling until it is removed in a later major.
|
|
26
|
+
*/
|
|
16
27
|
readonly timeoutMs?: number
|
|
17
28
|
readonly signal?: AbortSignal
|
|
18
29
|
}
|