@namzu/sdk 5.2.0 → 6.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 +104 -0
- package/dist/provider/__tests__/strict-schema.test.js +50 -2
- package/dist/provider/__tests__/strict-schema.test.js.map +1 -1
- package/dist/provider/__tests__/vendor-detail.test.d.ts +2 -0
- package/dist/provider/__tests__/vendor-detail.test.d.ts.map +1 -0
- package/dist/provider/__tests__/vendor-detail.test.js +89 -0
- package/dist/provider/__tests__/vendor-detail.test.js.map +1 -0
- package/dist/provider/errors.d.ts +38 -5
- package/dist/provider/errors.d.ts.map +1 -1
- package/dist/provider/errors.js +107 -5
- package/dist/provider/errors.js.map +1 -1
- package/dist/provider/strict-schema.d.ts.map +1 -1
- package/dist/provider/strict-schema.js +64 -8
- package/dist/provider/strict-schema.js.map +1 -1
- package/dist/public-runtime.d.ts +3 -0
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +6 -0
- package/dist/public-runtime.js.map +1 -1
- package/dist/registry/tool/__tests__/dialect.test.d.ts +2 -0
- package/dist/registry/tool/__tests__/dialect.test.d.ts.map +1 -0
- package/dist/registry/tool/__tests__/dialect.test.js +143 -0
- package/dist/registry/tool/__tests__/dialect.test.js.map +1 -0
- package/dist/registry/tool/dialect.d.ts +50 -0
- package/dist/registry/tool/dialect.d.ts.map +1 -0
- package/dist/registry/tool/dialect.js +131 -0
- package/dist/registry/tool/dialect.js.map +1 -0
- package/dist/registry/toolset/catalog.d.ts.map +1 -1
- package/dist/registry/toolset/catalog.js +10 -5
- package/dist/registry/toolset/catalog.js.map +1 -1
- package/dist/runtime/query/__tests__/stream-recovery.test.js +6 -0
- package/dist/runtime/query/__tests__/stream-recovery.test.js.map +1 -1
- package/dist/runtime/query/result.d.ts.map +1 -1
- package/dist/runtime/query/result.js +6 -0
- package/dist/runtime/query/result.js.map +1 -1
- package/dist/types/provider/error.d.ts +20 -4
- package/dist/types/provider/error.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/provider/__tests__/strict-schema.test.ts +58 -2
- package/src/provider/__tests__/vendor-detail.test.ts +107 -0
- package/src/provider/errors.ts +106 -5
- package/src/provider/strict-schema.ts +65 -8
- package/src/public-runtime.ts +7 -0
- package/src/registry/tool/__tests__/dialect.test.ts +197 -0
- package/src/registry/tool/dialect.ts +136 -0
- package/src/registry/toolset/catalog.ts +10 -5
- package/src/runtime/query/__tests__/stream-recovery.test.ts +6 -0
- package/src/runtime/query/result.ts +6 -0
- package/src/types/provider/error.ts +20 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,109 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 6.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- f8355de: a failed request now carries the provider's own account of why, scrubbed
|
|
8
|
+
|
|
9
|
+
`ProviderRequestError` has always declared a `detail` field. The constructor
|
|
10
|
+
never read it, so it existed and carried nothing, and the response body was
|
|
11
|
+
parsed to classify the failure and then dropped.
|
|
12
|
+
|
|
13
|
+
That was deliberate and it was an over-correction. An error body can echo a
|
|
14
|
+
request and a request can carry a credential — but a provider rejecting a
|
|
15
|
+
request also names the exact offending field, and deleting that sentence turns
|
|
16
|
+
a one-line diagnosis into hypothesis elimination against a live API. It did:
|
|
17
|
+
the wire spent a day of production downtime repeating
|
|
18
|
+
`tools.0.custom.input_schema: … must match JSON Schema draft 2020-12` while the
|
|
19
|
+
SDK removed the sentence before anyone could read it.
|
|
20
|
+
|
|
21
|
+
Scrubbing what is credential-shaped and keeping the rest is the trade that was
|
|
22
|
+
actually available. `detail` now carries the provider's message, truncated to
|
|
23
|
+
400 characters, with API-key prefixes, bearer headers, cloud access-key ids and
|
|
24
|
+
credential-named JSON fields replaced by `[redacted]`. The same text reaches
|
|
25
|
+
`message`, so a log line that prints only the message is enough to act on.
|
|
26
|
+
|
|
27
|
+
It reaches the run too. `ProviderErrorInfo` — the metadata on failed runs and
|
|
28
|
+
`run_failed` events — had no `detail` field, so the sentence stopped at the
|
|
29
|
+
error object and a host rendering `run.lastProviderError` still had to parse
|
|
30
|
+
`error` to learn which parameter was rejected. That is the re-parsing the
|
|
31
|
+
structured field exists to avoid, so `detail` is on it now:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
if (run.lastProviderError?.kind === "bad_request") {
|
|
35
|
+
console.error(run.lastProviderError.detail);
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Breaking.** The previous contract — "the response body is never interpolated
|
|
40
|
+
into the error message" — was documented, and code may depend on it. Two tests
|
|
41
|
+
in this repository did. If you log `ProviderRequestError.message` somewhere the
|
|
42
|
+
provider's own words must not appear, read `error.kind`, `error.status` and
|
|
43
|
+
`error.providerId` instead and build the string yourself; those are unchanged.
|
|
44
|
+
|
|
45
|
+
What has NOT changed is the `cause` chain: the raw body is still never attached
|
|
46
|
+
as `cause`. A `cause` survives every logger that serializes an error chain,
|
|
47
|
+
which is the channel that would leak the body regardless of what the message
|
|
48
|
+
says.
|
|
49
|
+
|
|
50
|
+
The strict-subset check learned the same lesson in the same release. Its
|
|
51
|
+
deny-list was derived from prose and was wrong in both directions — it refused
|
|
52
|
+
`minLength`/`maxLength`, which the wire accepts, so it would have blocked
|
|
53
|
+
working tools; and it permitted tuples, which the wire rejects, so it vouched
|
|
54
|
+
for a broken one. It is now measured against the live API, and the measurement
|
|
55
|
+
runs as a contract test rather than living in a comment. `minItems` in
|
|
56
|
+
particular is a bound on the _value_, not a rejected keyword: 0 and 1 pass and
|
|
57
|
+
anything above does not, so a required non-empty array is expressible again.
|
|
58
|
+
|
|
59
|
+
### Minor Changes
|
|
60
|
+
|
|
61
|
+
- f8355de: tool schemas are rendered in the dialect each wire actually parses
|
|
62
|
+
|
|
63
|
+
A tool with a tuple-shaped field took down every request that offered it. The
|
|
64
|
+
kernel renders one canonical JSON Schema in draft-07, where a tuple is
|
|
65
|
+
`items: [a, b]`; one of the wires namzu speaks validates tool input as JSON
|
|
66
|
+
Schema 2020-12, where that spelling is invalid and a tuple must be
|
|
67
|
+
`prefixItems`. Every driver forwarded the rendering verbatim, so the built-in
|
|
68
|
+
`read` tool — whose `readRange` is a Zod tuple — produced a 400 that rejected
|
|
69
|
+
the **whole** request, taking every other tool in the call down with it. The
|
|
70
|
+
turn died before generating a token.
|
|
71
|
+
|
|
72
|
+
The failure had nothing to do with strict tool use, which is why the guard
|
|
73
|
+
added for the previous schema outage never saw it: it fires with strict
|
|
74
|
+
validation unset, and with strict on the dialect error arrives _first_.
|
|
75
|
+
|
|
76
|
+
Which dialect a wire parses is a property of the wire, so the conversion now
|
|
77
|
+
happens at each driver's boundary rather than in the renderer:
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
import { toSchemaDialect, findDraft07Only } from "@namzu/sdk";
|
|
81
|
+
|
|
82
|
+
toSchemaDialect(schema, "2020-12"); // items: [a, b] -> prefixItems: [a, b]
|
|
83
|
+
findDraft07Only(schema); // paths that no 2020-12 parser will accept
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`renderToolSchema` is exported now too, so a caller assembling its own tool
|
|
87
|
+
payload gets the same memoized, `$schema`-stripped, deep-frozen rendering the
|
|
88
|
+
kernel puts on the wire — byte-identical across iterations, which matters
|
|
89
|
+
because the tools block sits at position 0 of the prompt-cache prefix.
|
|
90
|
+
|
|
91
|
+
`ToolCatalog` used to convert schemas through its own inline call with the same
|
|
92
|
+
options. Same output, none of the guarantees: no `$schema` stripping, no
|
|
93
|
+
memoization, no freeze. It goes through `renderToolSchema` now.
|
|
94
|
+
|
|
95
|
+
**Breaking, for the three drivers.** Their `@namzu/sdk` peer range was
|
|
96
|
+
`>=1.3.0` and is now `>=6.0.0`. That range was already wrong — the drivers call
|
|
97
|
+
kernel functions added well after 1.3.0 — and it would now let a package
|
|
98
|
+
manager install a combination that throws on every request carrying a tool.
|
|
99
|
+
Upgrade the kernel alongside the driver.
|
|
100
|
+
|
|
101
|
+
The conversion follows the model on multi-vendor wires. Bedrock's Converse API
|
|
102
|
+
carries several vendors through one request shape, and the 2020-12 requirement
|
|
103
|
+
was measured on one of them, so schemas bound for the others are left in the
|
|
104
|
+
dialect they were rendered in. Guessing there would trade a known break for an
|
|
105
|
+
unmeasured one.
|
|
106
|
+
|
|
3
107
|
## 5.2.0
|
|
4
108
|
|
|
5
109
|
### Minor Changes
|
|
@@ -67,17 +67,65 @@ describe('the violation report names the exact path', () => {
|
|
|
67
67
|
};
|
|
68
68
|
expect(findStrictSchemaViolations(schema)).toEqual([]);
|
|
69
69
|
});
|
|
70
|
-
it('reports
|
|
70
|
+
it('reports the bounds the wire refuses, and only those', () => {
|
|
71
|
+
// Measured against the live API rather than read off a page. The first
|
|
72
|
+
// version of this list was derived from documentation and was wrong in
|
|
73
|
+
// both directions: it refused `maxLength`, which the wire accepts, and
|
|
74
|
+
// permitted `prefixItems`, which it rejects.
|
|
71
75
|
const schema = {
|
|
72
76
|
type: 'object',
|
|
73
77
|
properties: {
|
|
74
78
|
n: { type: 'integer', minimum: 0 },
|
|
75
79
|
s: { type: 'string', maxLength: 10 },
|
|
80
|
+
a: { type: 'array', items: { type: 'string' }, maxItems: 3, minItems: 1 },
|
|
76
81
|
},
|
|
77
82
|
};
|
|
78
83
|
expect(findStrictSchemaViolations(schema)
|
|
79
84
|
.map((v) => v.keyword)
|
|
80
|
-
.sort()).toEqual(['
|
|
85
|
+
.sort()).toEqual(['maxItems', 'minimum']);
|
|
86
|
+
});
|
|
87
|
+
it('leaves string length alone, because strict accepts it', () => {
|
|
88
|
+
// The false positive that would have refused tools which work.
|
|
89
|
+
expect(findStrictSchemaViolations({ s: { type: 'string', minLength: 1, maxLength: 9 } })).toEqual([]);
|
|
90
|
+
});
|
|
91
|
+
it('catches a tuple in either spelling, because strict admits neither', () => {
|
|
92
|
+
// The interaction worth pinning, and the one a `prefixItems` entry alone
|
|
93
|
+
// got wrong. This check runs at REGISTRATION, on the schema as rendered
|
|
94
|
+
// — draft-07, where a tuple is `items: [a, b]` — while the wire sees the
|
|
95
|
+
// `prefixItems` the driver converts it to. So denying only `prefixItems`
|
|
96
|
+
// was a guard that could not fire on the path that produces tuples.
|
|
97
|
+
//
|
|
98
|
+
// Measured, strict rejects both, which is why a tool that is both strict
|
|
99
|
+
// and tuple-shaped cannot be expressed at all. Converting it only
|
|
100
|
+
// changes which error comes back.
|
|
101
|
+
for (const items of [
|
|
102
|
+
{ prefixItems: [{ type: 'integer' }, { type: 'integer' }] },
|
|
103
|
+
{ items: [{ type: 'integer' }, { type: 'integer' }] },
|
|
104
|
+
]) {
|
|
105
|
+
const violations = findStrictSchemaViolations({
|
|
106
|
+
properties: { range: { type: 'array', ...items } },
|
|
107
|
+
});
|
|
108
|
+
expect(violations, JSON.stringify(items)).toHaveLength(1);
|
|
109
|
+
expect(violations[0]?.remedy).toContain('tuple cannot be expressed');
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
it('leaves an ordinary array alone, where `items` is one schema', () => {
|
|
113
|
+
// The false positive the tuple rule must not become: `items` is the
|
|
114
|
+
// normal spelling for a homogeneous array and strict accepts it. Only
|
|
115
|
+
// the array-of-schemas form is a tuple.
|
|
116
|
+
expect(findStrictSchemaViolations({ type: 'array', items: { type: 'string' } })).toEqual([]);
|
|
117
|
+
});
|
|
118
|
+
it('admits minItems at 0 or 1 and refuses it above, as the wire does', () => {
|
|
119
|
+
// A blanket denial here was a false positive with a real cost: it
|
|
120
|
+
// refuses `z.array(...).nonempty()`, which renders `minItems: 1` and
|
|
121
|
+
// which the wire accepts. The constraint is on the VALUE, and the
|
|
122
|
+
// vendor's error says so — "'minItems' values other than 0 or 1 are not
|
|
123
|
+
// supported".
|
|
124
|
+
expect(findStrictSchemaViolations({ type: 'array', minItems: 0 })).toEqual([]);
|
|
125
|
+
expect(findStrictSchemaViolations({ type: 'array', minItems: 1 })).toEqual([]);
|
|
126
|
+
const violations = findStrictSchemaViolations({ type: 'array', minItems: 2 });
|
|
127
|
+
expect(violations).toHaveLength(1);
|
|
128
|
+
expect(violations[0]?.keyword).toBe('minItems');
|
|
81
129
|
});
|
|
82
130
|
it('admits additionalProperties only as false', () => {
|
|
83
131
|
expect(findStrictSchemaViolations({ additionalProperties: false })).toEqual([]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strict-schema.test.js","sourceRoot":"","sources":["../../../src/provider/__tests__/strict-schema.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAA;AAEpF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,QAAQ,CAAC,sEAAsE,EAAE,GAAG,EAAE;IACrF,sEAAsE;IACtE,wEAAwE;IACxE,iBAAiB;IACjB,EAAE,CAAC,IAAI,CACN,eAAe,EAAE;SACf,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC;SAClC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAU,CAAC,CAClC,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;QACtB,MAAM,UAAU,GAAG,0BAA0B,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;QACpE,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAC7F,EAAE,CACF,CAAA;IACF,CAAC,CAAC,CAAA;IAEF,EA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AK,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAC9F,qCAAqC,CACrC,CAAA;IACF,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QAC1D,MAAM,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAA;IAC3E,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendor-detail.test.d.ts","sourceRoot":"","sources":["../../../src/provider/__tests__/vendor-detail.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { providerHttpError, redactSecrets, vendorDetail } from '../errors.js';
|
|
3
|
+
/**
|
|
4
|
+
* The provider's own account of what was wrong, kept — and scrubbed.
|
|
5
|
+
*
|
|
6
|
+
* `ProviderRequestErrorInit` declared `detail` from the beginning and the
|
|
7
|
+
* constructor never read it, so the field existed and carried nothing. The
|
|
8
|
+
* body was read to classify and then dropped, deliberately, because an error
|
|
9
|
+
* body can echo a request and a request can carry a key.
|
|
10
|
+
*
|
|
11
|
+
* The cost of that trade showed up in production: the wire had been saying
|
|
12
|
+
* `tools.0.custom.input_schema: … must match JSON Schema draft 2020-12` and
|
|
13
|
+
* the SDK deleted the sentence, so diagnosing it took seven eliminated
|
|
14
|
+
* hypotheses and a day of downtime. Keeping the sentence and scrubbing the
|
|
15
|
+
* credential shapes is the trade that was actually available.
|
|
16
|
+
*/
|
|
17
|
+
describe('the sentence that names the broken field survives', () => {
|
|
18
|
+
it('lifts the structured message out of a vendor body', () => {
|
|
19
|
+
const body = JSON.stringify({
|
|
20
|
+
type: 'error',
|
|
21
|
+
error: {
|
|
22
|
+
type: 'invalid_request_error',
|
|
23
|
+
message: 'tools.0.custom.input_schema: JSON schema is invalid. It must match JSON Schema draft 2020-12',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
expect(vendorDetail(body)).toBe('tools.0.custom.input_schema: JSON schema is invalid. It must match JSON Schema draft 2020-12');
|
|
27
|
+
});
|
|
28
|
+
it('reaches the error a caller actually catches', () => {
|
|
29
|
+
const err = providerHttpError({
|
|
30
|
+
providerId: 'anthropic',
|
|
31
|
+
status: 400,
|
|
32
|
+
body: JSON.stringify({ error: { message: "Schema type 'oneOf' is not supported" } }),
|
|
33
|
+
});
|
|
34
|
+
expect(err.detail).toContain('oneOf');
|
|
35
|
+
// …and the message too, so a log line that prints only the message is
|
|
36
|
+
// still enough to act on.
|
|
37
|
+
expect(err.message).toContain('oneOf');
|
|
38
|
+
});
|
|
39
|
+
it('falls back to the raw text when the body is not JSON', () => {
|
|
40
|
+
expect(vendorDetail('upstream connect error, transport failure')).toBe('upstream connect error, transport failure');
|
|
41
|
+
});
|
|
42
|
+
it('says nothing rather than something empty', () => {
|
|
43
|
+
expect(vendorDetail(undefined)).toBeUndefined();
|
|
44
|
+
expect(vendorDetail(null)).toBeUndefined();
|
|
45
|
+
expect(vendorDetail(' ')).toBeUndefined();
|
|
46
|
+
expect(vendorDetail({})).toBeUndefined();
|
|
47
|
+
});
|
|
48
|
+
it('truncates a body that is not a sentence', () => {
|
|
49
|
+
const detail = vendorDetail('x'.repeat(5_000));
|
|
50
|
+
expect(detail?.length).toBeLessThanOrEqual(401);
|
|
51
|
+
expect(detail?.endsWith('…')).toBe(true);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
describe('a credential never rides along', () => {
|
|
55
|
+
it.each([
|
|
56
|
+
['sk-ant-api03-AbCdEfGhIjKlMnOpQrStUv', 'anthropic-style key'],
|
|
57
|
+
['npm_aBcDeFgHiJkLmNoPqRsTuVwXyZ012345', 'npm token'],
|
|
58
|
+
['ghp_aBcDeFgHiJkLmNoPqRsTuVwXyZ012345', 'github token'],
|
|
59
|
+
['AKIAIOSFODNN7EXAMPLE', 'aws access key id'],
|
|
60
|
+
])('scrubs %s (%s)', (secret) => {
|
|
61
|
+
const scrubbed = redactSecrets(`upstream rejected token ${secret} for this request`);
|
|
62
|
+
expect(scrubbed).not.toContain(secret);
|
|
63
|
+
expect(scrubbed).toContain('[redacted]');
|
|
64
|
+
});
|
|
65
|
+
it('scrubs a bearer header the vendor echoed back', () => {
|
|
66
|
+
const scrubbed = redactSecrets('bad header: Authorization: Bearer abcdef0123456789ABCDEF');
|
|
67
|
+
expect(scrubbed).not.toContain('abcdef0123456789ABCDEF');
|
|
68
|
+
});
|
|
69
|
+
it('scrubs a credential-named JSON field without eating the rest', () => {
|
|
70
|
+
const scrubbed = redactSecrets('{"api_key":"sk-live-9999","model":"the-model-that-failed"}');
|
|
71
|
+
expect(scrubbed).not.toContain('sk-live-9999');
|
|
72
|
+
// The surrounding sentence is the whole point — scrubbing must not
|
|
73
|
+
// degrade into deleting the message.
|
|
74
|
+
expect(scrubbed).toContain('the-model-that-failed');
|
|
75
|
+
});
|
|
76
|
+
it('scrubs on the real path, not only in the helper', () => {
|
|
77
|
+
const err = providerHttpError({
|
|
78
|
+
providerId: 'anthropic',
|
|
79
|
+
status: 401,
|
|
80
|
+
body: JSON.stringify({
|
|
81
|
+
error: { message: 'invalid key sk-ant-api03-AbCdEfGhIjKlMnOpQrStUv supplied' },
|
|
82
|
+
}),
|
|
83
|
+
});
|
|
84
|
+
expect(err.detail).not.toContain('AbCdEfGhIjKlMnOpQrStUv');
|
|
85
|
+
expect(err.detail).toContain('[redacted]');
|
|
86
|
+
expect(err.message).not.toContain('AbCdEfGhIjKlMnOpQrStUv');
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
//# sourceMappingURL=vendor-detail.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vendor-detail.test.js","sourceRoot":"","sources":["../../../src/provider/__tests__/vendor-detail.test.ts"],"names":[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AAE,GAAG,EAAE;QACxD,MAAM,QAAQ,GAAG,aAAa,CAAC,0DAA0D,CAAC,CAAA;QAC1F,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAA;IACzD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,8DAA8D,EAAE,GAAG,EAAE;QACvE,MAAM,QAAQ,GAAG,aAAa,CAAC,4DAA4D,CAAC,CAAA;QAC5F,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,cAAc,CAAC,CAAA;QAC9C,mEAAmE;QACnE,qCAAqC;QACrC,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,uBAAuB,CAAC,CAAA;IACpD,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QAC1D,MAAM,GAAG,GAAG,iBAAiB,CAAC;YAC7B,UAAU,EAAE,WAAW;YACvB,MAAM,EAAE,GAAG;YACX,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACpB,KAAK,EAAE,EAAE,OAAO,EAAE,0DAA0D,EAAE;aAC9E,CAAC;SACF,CAAC,CAAA;QAEF,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAA;QAC1D,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAA;QAC1C,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAA;IAC5D,CAAC,CAAC,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -11,11 +11,19 @@
|
|
|
11
11
|
*
|
|
12
12
|
* So the contract here is deliberately narrow:
|
|
13
13
|
*
|
|
14
|
-
* - the message is built from the STATUS LINE
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* survives every logger that serializes an error chain,
|
|
18
|
-
* point.
|
|
14
|
+
* - the message is built from the STATUS LINE, the classified `kind`, and the
|
|
15
|
+
* provider's own complaint in `detail` — truncated and scrubbed of anything
|
|
16
|
+
* credential-shaped. The raw body is never re-thrown and never attached as
|
|
17
|
+
* `cause`; a `cause` survives every logger that serializes an error chain,
|
|
18
|
+
* which defeats the point.
|
|
19
|
+
*
|
|
20
|
+
* The body used to be dropped entirely. That was over-corrected: a provider
|
|
21
|
+
* rejecting a request names the exact offending field, and deleting that
|
|
22
|
+
* sentence turned a one-line diagnosis into hypothesis elimination against a
|
|
23
|
+
* live API — once at the cost of a day of production downtime, while the
|
|
24
|
+
* wire had been saying `tools.0.custom.input_schema: … must match JSON
|
|
25
|
+
* Schema draft 2020-12` the entire time. Scrubbing what looks like a
|
|
26
|
+
* credential keeps the safety and returns the sentence.
|
|
19
27
|
* - `retryAfterMs` is DATA. Nothing in this module sleeps, backs off or
|
|
20
28
|
* retries. A retry loop inside a driver burns the run's wall clock and hides
|
|
21
29
|
* the failure from the layer that should decide.
|
|
@@ -35,8 +43,33 @@ export declare class ProviderRequestError extends Error {
|
|
|
35
43
|
readonly providerId: string;
|
|
36
44
|
readonly status?: number;
|
|
37
45
|
readonly retryAfterMs?: number;
|
|
46
|
+
/**
|
|
47
|
+
* What the provider said was wrong, truncated and redacted.
|
|
48
|
+
*
|
|
49
|
+
* `ProviderRequestErrorInit` has declared this field all along and the
|
|
50
|
+
* constructor never read it, so every caller that set it was writing to
|
|
51
|
+
* nothing. That is not a cosmetic gap: a provider rejecting a request
|
|
52
|
+
* usually names the exact offending field, and losing that sentence turns
|
|
53
|
+
* a one-line diagnosis into hypothesis elimination against a live API. It
|
|
54
|
+
* did — a tool schema in the wrong JSON Schema dialect cost a day of
|
|
55
|
+
* production downtime while the wire had been saying
|
|
56
|
+
* `tools.0.custom.input_schema: … must match JSON Schema draft 2020-12`
|
|
57
|
+
* the whole time.
|
|
58
|
+
*
|
|
59
|
+
* See {@link vendorDetail} for what is kept and what is scrubbed.
|
|
60
|
+
*/
|
|
61
|
+
readonly detail?: string;
|
|
38
62
|
constructor(init: ProviderRequestErrorInit);
|
|
39
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* The provider's own account of what was wrong, safe to log.
|
|
66
|
+
*
|
|
67
|
+
* Prefers the structured `error.message` a JSON body carries, because that is
|
|
68
|
+
* the field vendors put the actionable sentence in and it is bounded; falls
|
|
69
|
+
* back to the raw text. Truncated, and every credential shape replaced.
|
|
70
|
+
*/
|
|
71
|
+
export declare function vendorDetail(body: unknown): string | undefined;
|
|
72
|
+
export declare function redactSecrets(text: string): string;
|
|
40
73
|
/** Is this a classified provider failure, whichever SDK copy threw it? */
|
|
41
74
|
export declare function isProviderRequestError(err: unknown): err is ProviderRequestError;
|
|
42
75
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/provider/errors.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/provider/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAC7F,YAAY,EACX,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,GACxB,MAAM,4BAA4B,CAAA;AAWnC;;;;;;;GAOG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC9C,SAAgB,IAAI,EAAE,iBAAiB,CAAA;IACvC,SAAgB,UAAU,EAAE,MAAM,CAAA;IAClC,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAA;IAC/B,SAAgB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrC;;;;;;;;;;;;;;OAcG;IACH,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAA;gBAEnB,IAAI,EAAE,wBAAwB;CAS1C;AAsBD;;;;;;GAMG;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7B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,oBAAoB,CAWvB"}
|
package/dist/provider/errors.js
CHANGED
|
@@ -11,11 +11,19 @@
|
|
|
11
11
|
*
|
|
12
12
|
* So the contract here is deliberately narrow:
|
|
13
13
|
*
|
|
14
|
-
* - the message is built from the STATUS LINE
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* survives every logger that serializes an error chain,
|
|
18
|
-
* point.
|
|
14
|
+
* - the message is built from the STATUS LINE, the classified `kind`, and the
|
|
15
|
+
* provider's own complaint in `detail` — truncated and scrubbed of anything
|
|
16
|
+
* credential-shaped. The raw body is never re-thrown and never attached as
|
|
17
|
+
* `cause`; a `cause` survives every logger that serializes an error chain,
|
|
18
|
+
* which defeats the point.
|
|
19
|
+
*
|
|
20
|
+
* The body used to be dropped entirely. That was over-corrected: a provider
|
|
21
|
+
* rejecting a request names the exact offending field, and deleting that
|
|
22
|
+
* sentence turned a one-line diagnosis into hypothesis elimination against a
|
|
23
|
+
* live API — once at the cost of a day of production downtime, while the
|
|
24
|
+
* wire had been saying `tools.0.custom.input_schema: … must match JSON
|
|
25
|
+
* Schema draft 2020-12` the entire time. Scrubbing what looks like a
|
|
26
|
+
* credential keeps the safety and returns the sentence.
|
|
19
27
|
* - `retryAfterMs` is DATA. Nothing in this module sleeps, backs off or
|
|
20
28
|
* retries. A retry loop inside a driver burns the run's wall clock and hides
|
|
21
29
|
* the failure from the layer that should decide.
|
|
@@ -41,6 +49,22 @@ export class ProviderRequestError extends Error {
|
|
|
41
49
|
providerId;
|
|
42
50
|
status;
|
|
43
51
|
retryAfterMs;
|
|
52
|
+
/**
|
|
53
|
+
* What the provider said was wrong, truncated and redacted.
|
|
54
|
+
*
|
|
55
|
+
* `ProviderRequestErrorInit` has declared this field all along and the
|
|
56
|
+
* constructor never read it, so every caller that set it was writing to
|
|
57
|
+
* nothing. That is not a cosmetic gap: a provider rejecting a request
|
|
58
|
+
* usually names the exact offending field, and losing that sentence turns
|
|
59
|
+
* a one-line diagnosis into hypothesis elimination against a live API. It
|
|
60
|
+
* did — a tool schema in the wrong JSON Schema dialect cost a day of
|
|
61
|
+
* production downtime while the wire had been saying
|
|
62
|
+
* `tools.0.custom.input_schema: … must match JSON Schema draft 2020-12`
|
|
63
|
+
* the whole time.
|
|
64
|
+
*
|
|
65
|
+
* See {@link vendorDetail} for what is kept and what is scrubbed.
|
|
66
|
+
*/
|
|
67
|
+
detail;
|
|
44
68
|
constructor(init) {
|
|
45
69
|
super(buildProviderErrorMessage(init));
|
|
46
70
|
this.name = 'ProviderRequestError';
|
|
@@ -50,7 +74,81 @@ export class ProviderRequestError extends Error {
|
|
|
50
74
|
this.status = init.status;
|
|
51
75
|
if (init.retryAfterMs !== undefined)
|
|
52
76
|
this.retryAfterMs = init.retryAfterMs;
|
|
77
|
+
if (init.detail !== undefined)
|
|
78
|
+
this.detail = init.detail;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/** Longest detail worth carrying. A provider's complaint is a sentence. */
|
|
82
|
+
const DETAIL_MAX = 400;
|
|
83
|
+
/**
|
|
84
|
+
* Credential shapes to scrub before a provider's words are kept.
|
|
85
|
+
*
|
|
86
|
+
* The original decision to discard the body outright was not paranoia — an
|
|
87
|
+
* error body can echo the request, and a request can carry a key. The answer
|
|
88
|
+
* is to scrub what looks like a credential rather than to throw away the
|
|
89
|
+
* sentence that names the broken field.
|
|
90
|
+
*/
|
|
91
|
+
const SECRET_PATTERNS = [
|
|
92
|
+
/\b(?:sk|pk|rk)[-_][A-Za-z0-9_-]{12,}/g,
|
|
93
|
+
/\bnpm_[A-Za-z0-9]{20,}/g,
|
|
94
|
+
/\bgh[pousr]_[A-Za-z0-9]{20,}/g,
|
|
95
|
+
/\bBearer\s+[A-Za-z0-9._~+/-]{12,}=*/gi,
|
|
96
|
+
/\bAKIA[0-9A-Z]{16}\b/g,
|
|
97
|
+
/("(?:api[_-]?key|authorization|token|secret|password)"\s*:\s*)"[^"]*"/gi,
|
|
98
|
+
];
|
|
99
|
+
/**
|
|
100
|
+
* The provider's own account of what was wrong, safe to log.
|
|
101
|
+
*
|
|
102
|
+
* Prefers the structured `error.message` a JSON body carries, because that is
|
|
103
|
+
* the field vendors put the actionable sentence in and it is bounded; falls
|
|
104
|
+
* back to the raw text. Truncated, and every credential shape replaced.
|
|
105
|
+
*/
|
|
106
|
+
export function vendorDetail(body) {
|
|
107
|
+
if (body === undefined || body === null)
|
|
108
|
+
return undefined;
|
|
109
|
+
let text;
|
|
110
|
+
if (typeof body === 'string') {
|
|
111
|
+
try {
|
|
112
|
+
text = pickMessage(JSON.parse(body)) ?? body;
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
text = body;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
text = pickMessage(body) ?? '';
|
|
120
|
+
}
|
|
121
|
+
const cleaned = redactSecrets(text.trim());
|
|
122
|
+
if (cleaned.length === 0)
|
|
123
|
+
return undefined;
|
|
124
|
+
return cleaned.length > DETAIL_MAX ? `${cleaned.slice(0, DETAIL_MAX)}…` : cleaned;
|
|
125
|
+
}
|
|
126
|
+
export function redactSecrets(text) {
|
|
127
|
+
let out = text;
|
|
128
|
+
for (const pattern of SECRET_PATTERNS) {
|
|
129
|
+
out = out.replace(pattern, (_match, prefix) => prefix === undefined ? '[redacted]' : `${prefix}"[redacted]"`);
|
|
53
130
|
}
|
|
131
|
+
return out;
|
|
132
|
+
}
|
|
133
|
+
function pickMessage(value) {
|
|
134
|
+
if (typeof value === 'string')
|
|
135
|
+
return value;
|
|
136
|
+
if (typeof value !== 'object' || value === null)
|
|
137
|
+
return undefined;
|
|
138
|
+
const node = value;
|
|
139
|
+
// `{ error: { message } }` is what every wire in this tree uses; the rest
|
|
140
|
+
// are the shapes seen in the drivers' own fixtures.
|
|
141
|
+
const nested = node.error;
|
|
142
|
+
if (typeof nested === 'string')
|
|
143
|
+
return nested;
|
|
144
|
+
if (typeof nested === 'object' && nested !== null) {
|
|
145
|
+
const message = nested.message;
|
|
146
|
+
if (typeof message === 'string')
|
|
147
|
+
return message;
|
|
148
|
+
}
|
|
149
|
+
if (typeof node.message === 'string')
|
|
150
|
+
return node.message;
|
|
151
|
+
return undefined;
|
|
54
152
|
}
|
|
55
153
|
/** Is this a classified provider failure, whichever SDK copy threw it? */
|
|
56
154
|
export function isProviderRequestError(err) {
|
|
@@ -285,11 +383,13 @@ export function providerVendorError(input) {
|
|
|
285
383
|
kind = vendorTypeKind(message) ?? 'network';
|
|
286
384
|
}
|
|
287
385
|
const retryAfterMs = parseRetryAfterMs(input.retryAfter ?? vendorRetryAfter(error), input.now ?? Date.now());
|
|
386
|
+
const detail = vendorDetail(message);
|
|
288
387
|
return new ProviderRequestError({
|
|
289
388
|
kind,
|
|
290
389
|
providerId: input.providerId,
|
|
291
390
|
...(status !== undefined ? { status } : {}),
|
|
292
391
|
...(retryAfterMs !== undefined ? { retryAfterMs } : {}),
|
|
392
|
+
...(detail !== undefined ? { detail } : {}),
|
|
293
393
|
});
|
|
294
394
|
}
|
|
295
395
|
/**
|
|
@@ -301,11 +401,13 @@ export function providerVendorError(input) {
|
|
|
301
401
|
export function providerHttpError(input) {
|
|
302
402
|
const kind = classifyProviderHttpStatus(input.status, input.body);
|
|
303
403
|
const retryAfterMs = parseRetryAfterMs(input.retryAfter, input.now ?? Date.now());
|
|
404
|
+
const detail = vendorDetail(input.body);
|
|
304
405
|
return new ProviderRequestError({
|
|
305
406
|
kind,
|
|
306
407
|
providerId: input.providerId,
|
|
307
408
|
status: input.status,
|
|
308
409
|
...(retryAfterMs !== undefined ? { retryAfterMs } : {}),
|
|
410
|
+
...(detail !== undefined ? { detail } : {}),
|
|
309
411
|
});
|
|
310
412
|
}
|
|
311
413
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/provider/errors.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/provider/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AASH,MAAM,oBAAoB,GAAiC;IAC1D,UAAU;IACV,SAAS;IACT,MAAM;IACN,kBAAkB;IAClB,aAAa;IACb,QAAQ;CACR,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC9B,IAAI,CAAmB;IACvB,UAAU,CAAQ;IAClB,MAAM,CAAS;IACf,YAAY,CAAS;IACrC;;;;;;;;;;;;;;OAcG;IACa,MAAM,CAAS;IAE/B,YAAY,IAA8B;QACzC,KAAK,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAA;QACtC,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAA;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QACrB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAA;QACjC,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;YAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QACxD,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS;YAAE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAA;QAC1E,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;YAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;IACzD,CAAC;CACD;AAED,2EAA2E;AAC3E,MAAM,UAAU,GAAG,GAAG,CAAA;AAEtB;;;;;;;GAOG;AACH,MAAM,eAAe,GAAsB;IAC1C,uCAAuC;IACvC,yBAAyB;IACzB,+BAA+B;IAC/B,uCAAuC;IACvC,uBAAuB;IACvB,yEAAyE;CACzE,CAAA;AAED;;;;;;GAMG;AACH,MA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AC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;IACjE,MAAM,YAAY,GAAG,iBAAiB,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,CAAA;IACjF,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACvC,OAAO,IAAI,oBAAoB,CAAC;QAC/B,IAAI;QACJ,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvD,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3C,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"strict-schema.d.ts","sourceRoot":"","sources":["../../src/provider/strict-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;
|
|
1
|
+
{"version":3,"file":"strict-schema.d.ts","sourceRoot":"","sources":["../../src/provider/strict-schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAyEH,MAAM,WAAW,qBAAqB;IACrC,gFAAgF;IAChF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,6BAA6B;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACvB;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,SAAK,GAAG,qBAAqB,EAAE,CAoD9F;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAQ1E"}
|