@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../src/registry/toolset/catalog.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../src/registry/toolset/catalog.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAcpD,MAAM,mBAAmB,GAAe;IACvC,EAAE,EAAE,YAAY;IAChB,IAAI,EAAE,WAAW;IACjB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,qCAAqC;CAClD,CAAA;AAED,MAAM,oBAAoB,GAAsB;IAC/C,EAAE,EAAE,YAAY;IAChB,QAAQ,EAAE,mBAAmB,CAAC,EAAE;IAChC,IAAI,EAAE,YAAY;IAClB,aAAa,EAAE;QACd,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,OAAO;KAChB;CACD,CAAA;AAED,MAAM,OAAO,WAAW;IACf,OAAO,GAAG,IAAI,GAAG,EAAsB,CAAA;IACvC,QAAQ,GAAG,IAAI,GAAG,EAA6B,CAAA;IAC/C,KAAK,GAAG,IAAI,GAAG,EAA4B,CAAA;IAEnD,cAAc,CAAC,MAAkB;QAChC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;IACpC,CAAC;IAED,eAAe,CAAC,O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,KAAK,IAAI,CAAC,CAAA;IAExD,OAAO;QACN,KAAK;QACL,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;KACrB,CAAA;AACF,CAAC"}
|
|
@@ -71,6 +71,7 @@ class ClassifiedFailureProvider {
|
|
|
71
71
|
providerId: 'classified-failure',
|
|
72
72
|
status: 429,
|
|
73
73
|
retryAfterMs: 2000,
|
|
74
|
+
detail: 'rate limit reached for this organization',
|
|
74
75
|
}));
|
|
75
76
|
}
|
|
76
77
|
}
|
|
@@ -169,11 +170,16 @@ describe('query stream recovery', () => {
|
|
|
169
170
|
events.push(event);
|
|
170
171
|
});
|
|
171
172
|
expect(run.status).toBe('failed');
|
|
173
|
+
// `detail` rides along with the classification. Without it a host
|
|
174
|
+
// rendering this metadata knows a request was rejected but not why, and
|
|
175
|
+
// has to go re-parse the message string — which is the re-parsing this
|
|
176
|
+
// structured field exists to avoid.
|
|
172
177
|
expect(run.lastProviderError).toEqual({
|
|
173
178
|
kind: 'throttle',
|
|
174
179
|
providerId: 'classified-failure',
|
|
175
180
|
status: 429,
|
|
176
181
|
retryAfterMs: 2000,
|
|
182
|
+
detail: 'rate limit reached for this organization',
|
|
177
183
|
});
|
|
178
184
|
expect(events.find((event) => event.type === 'run_failed')).toMatchObject({
|
|
179
185
|
type: 'run_failed',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream-recovery.test.js","sourceRoot":"","sources":["../../../../src/runtime/query/__tests__/stream-recovery.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAC5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAA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EAAE,OAAO;YACX,KAAK,EAAE,EAAE;YACT,YAAY,EAAE,MAAM;YACpB,KAAK,EAAE,UAAU;SACjB,CAAA;IACF,CAAC;CACD;AAED,MAAM,yBAAyB;IACrB,EAAE,GAAG,oBAAoB,CAAA;IACzB,IAAI,GAAG,6BAA6B,CAAA;IAE7C,KAAK,CAAC,CAAC,UAAU;QAChB,MAAM,MAAM,OAAO,CAAC,MAAM,CACzB,IAAI,oBAAoB,CAAC;YACxB,IAAI,EAAE,UAAU;YAChB,UAAU,EAAE,oBAAoB;YAChC,MAAM,EAAE,GAAG;YACX,YAAY,EAAE,IAAI;
|
|
1
|
+
{"version":3,"file":"stream-recovery.test.js","sourceRoot":"","sources":["../../../../src/runtime/query/__tests__/stream-recovery.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAC5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAInE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAExC,MAAM,UAAU,GAAG;IAClB,YAAY,EAAE,CAAC;IACf,gBAAgB,EAAE,CAAC;IACnB,WAAW,EAAE,CAAC;IACd,YAAY,EAAE,CAAC;IACf,gBAAgB,EAAE,CAAC;CACnB,CAAA;AAED,MAAM,2BAA2B;IACvB,EAAE,GAAG,wBAAwB,CAAA;IAC7B,IAAI,GAAG,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O,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAInE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAE7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAE5C,MAAM,WAAW,qBAAqB;IACrC,MAAM,EAAE,cAAc,CAAA;IACtB,WAAW,EAAE,WAAW,CAAA;IACxB,aAAa,EAAE,aAAa,CAAA;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,SAAS,CAAA;IACpB,YAAY,EAAE,MAAM,SAAS,CAAC,QAAQ,CAAC,CAAA;IACvC;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,MAAM,YAAY,GAAG,SAAS,CAAA;CACnD;AAED,qBAAa,eAAe;IAC3B,OAAO,CAAC,MAAM,CAAuB;gBAEzB,MAAM,EAAE,qBAAqB;IAIlC,WAAW,CAAC,QAAQ,EAAE,IAAI,GAAG,cAAc,CAAC,QAAQ,CAAC;IAmCrD,eAAe,CAAC,QAAQ,EAAE,IAAI,GAAG,cAAc,CAAC,QAAQ,CAAC;IAIzD,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,GAAG,cAAc,CAAC,QAAQ,CAAC;IAiGpE,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC;CAI9B"}
|
|
@@ -91,6 +91,12 @@ export class ResultAssembler {
|
|
|
91
91
|
providerId: err.providerId,
|
|
92
92
|
...(err.status !== undefined ? { status: err.status } : {}),
|
|
93
93
|
...(err.retryAfterMs !== undefined ? { retryAfterMs: err.retryAfterMs } : {}),
|
|
94
|
+
// The provider's own sentence, already truncated and scrubbed
|
|
95
|
+
// by the driver. Without it a host rendering this metadata
|
|
96
|
+
// knows a request was rejected but not which field, and has to
|
|
97
|
+
// go re-parse `error` to find out — which is exactly the
|
|
98
|
+
// re-parsing the line above says this exists to avoid.
|
|
99
|
+
...(err.detail !== undefined ? { detail: err.detail } : {}),
|
|
94
100
|
}
|
|
95
101
|
: undefined;
|
|
96
102
|
runMgr.markFailed(errorMessage, providerError);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"result.js","sourceRoot":"","sources":["../../../src/runtime/query/result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAG9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAEjE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAG7D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAqBrD,MAAM,OAAO,eAAe;IACnB,MAAM,CAAuB;IAErC,YAAY,MAA6B;QACxC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACrB,CAAC;IAED,KAAK,CAAC,CAAC,WAAW,CAAC,QAAc;QAChC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,GAAG,IAAI,CAAC,MAAM,CAAA;QAE3E,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;QACxC,CAAC;QAED,MAAM,SAAS,CAAC;YACf,IAAI,EAAE,eAAe;YACrB,KAAK,EAAE,MAAM,CAAC,EAAE;YAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,MAAM,IAAI,EAAE;YACpC,oEAAoE;YACpE,+DAA+D;YAC/D,gEAAgE;YAChE,qBAAqB;YACrB,GA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YAClB,KAAK,EAAE,MAAM,CAAC,EAAE;YAChB,KAAK,EAAE,YAAY;YACnB,OAAO;YACP,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3C,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACvC,CAAC,CAAA;QACF,KAAK,CAAC,CAAC,YAAY,EAAE,CAAA;QAErB,QAAQ,CAAC,aAAa,CAAC;YACtB,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,OAAO;YAC3B,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,gBAAgB;SAC1C,CAAC,CAAA;QACF,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAA;QACzE,QAAQ,CAAC,eAAe,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAA;QAE9E,GAAG,CAAC,KAAK,CAAC,cAAc,EAAE;YACzB,KAAK,EAAE,MAAM,CAAC,EAAE;YAChB,KAAK,EAAE,YAAY;SACnB,CAAC,CAAA;IACH,CAAC;IAED,KAAK,CAAC,QAAQ;QACb,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAA;QAClC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAA;IACnC,CAAC;CACD"}
|
|
@@ -3,19 +3,35 @@ export type ProviderErrorKind = 'throttle' | 'network' | 'auth' | 'context_overf
|
|
|
3
3
|
/**
|
|
4
4
|
* Serializable provider-failure metadata carried by failed runs and events.
|
|
5
5
|
*
|
|
6
|
-
* No response body,
|
|
6
|
+
* No response body, URL, or `cause` belongs here. `detail` is the one thing
|
|
7
|
+
* the provider itself said, and it arrives scrubbed — see below.
|
|
7
8
|
*/
|
|
8
9
|
export interface ProviderErrorInfo {
|
|
9
10
|
readonly kind: ProviderErrorKind;
|
|
10
11
|
readonly providerId: string;
|
|
11
12
|
readonly status?: number;
|
|
12
13
|
readonly retryAfterMs?: number;
|
|
14
|
+
/**
|
|
15
|
+
* What the provider said was wrong, truncated and scrubbed of anything
|
|
16
|
+
* credential-shaped.
|
|
17
|
+
*
|
|
18
|
+
* Carried here and not only on the error's `message` for the same reason
|
|
19
|
+
* `kind` is: a host rendering a failure should not have to parse a
|
|
20
|
+
* sentence to show one. It is the field that names the offending
|
|
21
|
+
* parameter, which is usually the whole diagnosis.
|
|
22
|
+
*/
|
|
23
|
+
readonly detail?: string;
|
|
13
24
|
}
|
|
14
25
|
export interface ProviderRequestErrorInit extends ProviderErrorInfo {
|
|
15
26
|
/**
|
|
16
|
-
* Optional extra clause for the message.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
27
|
+
* Optional extra clause for the message.
|
|
28
|
+
*
|
|
29
|
+
* This used to be required to be text the codebase authored, never a
|
|
30
|
+
* fragment of a vendor error — and the constructor did not read the field
|
|
31
|
+
* at all, so nothing carried either kind of text. Providers may now pass
|
|
32
|
+
* their own complaint through `vendorDetail`, which truncates it and
|
|
33
|
+
* replaces anything credential-shaped. Text this codebase authored is
|
|
34
|
+
* still welcome; what is not welcome is a raw body passed straight in.
|
|
19
35
|
*/
|
|
20
36
|
readonly detail?: string;
|
|
21
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/types/provider/error.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,MAAM,MAAM,iBAAiB,GAC1B,UAAU,GACV,SAAS,GACT,MAAM,GACN,kBAAkB,GAClB,aAAa,GACb,QAAQ,CAAA;AAEX
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/types/provider/error.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,MAAM,MAAM,iBAAiB,GAC1B,UAAU,GACV,SAAS,GACT,MAAM,GACN,kBAAkB,GAClB,aAAa,GACb,QAAQ,CAAA;AAEX;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAA;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;IAC9B;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IAClE;;;;;;;;;OASG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CACxB"}
|
package/package.json
CHANGED
|
@@ -80,12 +80,17 @@ describe('the violation report names the exact path', () => {
|
|
|
80
80
|
expect(findStrictSchemaViolations(schema)).toEqual([])
|
|
81
81
|
})
|
|
82
82
|
|
|
83
|
-
it('reports
|
|
83
|
+
it('reports the bounds the wire refuses, and only those', () => {
|
|
84
|
+
// Measured against the live API rather than read off a page. The first
|
|
85
|
+
// version of this list was derived from documentation and was wrong in
|
|
86
|
+
// both directions: it refused `maxLength`, which the wire accepts, and
|
|
87
|
+
// permitted `prefixItems`, which it rejects.
|
|
84
88
|
const schema = {
|
|
85
89
|
type: 'object',
|
|
86
90
|
properties: {
|
|
87
91
|
n: { type: 'integer', minimum: 0 },
|
|
88
92
|
s: { type: 'string', maxLength: 10 },
|
|
93
|
+
a: { type: 'array', items: { type: 'string' }, maxItems: 3, minItems: 1 },
|
|
89
94
|
},
|
|
90
95
|
}
|
|
91
96
|
|
|
@@ -93,7 +98,58 @@ describe('the violation report names the exact path', () => {
|
|
|
93
98
|
findStrictSchemaViolations(schema)
|
|
94
99
|
.map((v) => v.keyword)
|
|
95
100
|
.sort(),
|
|
96
|
-
).toEqual(['
|
|
101
|
+
).toEqual(['maxItems', 'minimum'])
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
it('leaves string length alone, because strict accepts it', () => {
|
|
105
|
+
// The false positive that would have refused tools which work.
|
|
106
|
+
expect(
|
|
107
|
+
findStrictSchemaViolations({ s: { type: 'string', minLength: 1, maxLength: 9 } }),
|
|
108
|
+
).toEqual([])
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
it('catches a tuple in either spelling, because strict admits neither', () => {
|
|
112
|
+
// The interaction worth pinning, and the one a `prefixItems` entry alone
|
|
113
|
+
// got wrong. This check runs at REGISTRATION, on the schema as rendered
|
|
114
|
+
// — draft-07, where a tuple is `items: [a, b]` — while the wire sees the
|
|
115
|
+
// `prefixItems` the driver converts it to. So denying only `prefixItems`
|
|
116
|
+
// was a guard that could not fire on the path that produces tuples.
|
|
117
|
+
//
|
|
118
|
+
// Measured, strict rejects both, which is why a tool that is both strict
|
|
119
|
+
// and tuple-shaped cannot be expressed at all. Converting it only
|
|
120
|
+
// changes which error comes back.
|
|
121
|
+
for (const items of [
|
|
122
|
+
{ prefixItems: [{ type: 'integer' }, { type: 'integer' }] },
|
|
123
|
+
{ items: [{ type: 'integer' }, { type: 'integer' }] },
|
|
124
|
+
]) {
|
|
125
|
+
const violations = findStrictSchemaViolations({
|
|
126
|
+
properties: { range: { type: 'array', ...items } },
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
expect(violations, JSON.stringify(items)).toHaveLength(1)
|
|
130
|
+
expect(violations[0]?.remedy).toContain('tuple cannot be expressed')
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
it('leaves an ordinary array alone, where `items` is one schema', () => {
|
|
135
|
+
// The false positive the tuple rule must not become: `items` is the
|
|
136
|
+
// normal spelling for a homogeneous array and strict accepts it. Only
|
|
137
|
+
// the array-of-schemas form is a tuple.
|
|
138
|
+
expect(findStrictSchemaViolations({ type: 'array', items: { type: 'string' } })).toEqual([])
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
it('admits minItems at 0 or 1 and refuses it above, as the wire does', () => {
|
|
142
|
+
// A blanket denial here was a false positive with a real cost: it
|
|
143
|
+
// refuses `z.array(...).nonempty()`, which renders `minItems: 1` and
|
|
144
|
+
// which the wire accepts. The constraint is on the VALUE, and the
|
|
145
|
+
// vendor's error says so — "'minItems' values other than 0 or 1 are not
|
|
146
|
+
// supported".
|
|
147
|
+
expect(findStrictSchemaViolations({ type: 'array', minItems: 0 })).toEqual([])
|
|
148
|
+
expect(findStrictSchemaViolations({ type: 'array', minItems: 1 })).toEqual([])
|
|
149
|
+
|
|
150
|
+
const violations = findStrictSchemaViolations({ type: 'array', minItems: 2 })
|
|
151
|
+
expect(violations).toHaveLength(1)
|
|
152
|
+
expect(violations[0]?.keyword).toBe('minItems')
|
|
97
153
|
})
|
|
98
154
|
|
|
99
155
|
it('admits additionalProperties only as false', () => {
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import { providerHttpError, redactSecrets, vendorDetail } from '../errors.js'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The provider's own account of what was wrong, kept — and scrubbed.
|
|
7
|
+
*
|
|
8
|
+
* `ProviderRequestErrorInit` declared `detail` from the beginning and the
|
|
9
|
+
* constructor never read it, so the field existed and carried nothing. The
|
|
10
|
+
* body was read to classify and then dropped, deliberately, because an error
|
|
11
|
+
* body can echo a request and a request can carry a key.
|
|
12
|
+
*
|
|
13
|
+
* The cost of that trade showed up in production: the wire had been saying
|
|
14
|
+
* `tools.0.custom.input_schema: … must match JSON Schema draft 2020-12` and
|
|
15
|
+
* the SDK deleted the sentence, so diagnosing it took seven eliminated
|
|
16
|
+
* hypotheses and a day of downtime. Keeping the sentence and scrubbing the
|
|
17
|
+
* credential shapes is the trade that was actually available.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
describe('the sentence that names the broken field survives', () => {
|
|
21
|
+
it('lifts the structured message out of a vendor body', () => {
|
|
22
|
+
const body = JSON.stringify({
|
|
23
|
+
type: 'error',
|
|
24
|
+
error: {
|
|
25
|
+
type: 'invalid_request_error',
|
|
26
|
+
message:
|
|
27
|
+
'tools.0.custom.input_schema: JSON schema is invalid. It must match JSON Schema draft 2020-12',
|
|
28
|
+
},
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
expect(vendorDetail(body)).toBe(
|
|
32
|
+
'tools.0.custom.input_schema: JSON schema is invalid. It must match JSON Schema draft 2020-12',
|
|
33
|
+
)
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it('reaches the error a caller actually catches', () => {
|
|
37
|
+
const err = providerHttpError({
|
|
38
|
+
providerId: 'anthropic',
|
|
39
|
+
status: 400,
|
|
40
|
+
body: JSON.stringify({ error: { message: "Schema type 'oneOf' is not supported" } }),
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
expect(err.detail).toContain('oneOf')
|
|
44
|
+
// …and the message too, so a log line that prints only the message is
|
|
45
|
+
// still enough to act on.
|
|
46
|
+
expect(err.message).toContain('oneOf')
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it('falls back to the raw text when the body is not JSON', () => {
|
|
50
|
+
expect(vendorDetail('upstream connect error, transport failure')).toBe(
|
|
51
|
+
'upstream connect error, transport failure',
|
|
52
|
+
)
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('says nothing rather than something empty', () => {
|
|
56
|
+
expect(vendorDetail(undefined)).toBeUndefined()
|
|
57
|
+
expect(vendorDetail(null)).toBeUndefined()
|
|
58
|
+
expect(vendorDetail(' ')).toBeUndefined()
|
|
59
|
+
expect(vendorDetail({})).toBeUndefined()
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it('truncates a body that is not a sentence', () => {
|
|
63
|
+
const detail = vendorDetail('x'.repeat(5_000))
|
|
64
|
+
expect(detail?.length).toBeLessThanOrEqual(401)
|
|
65
|
+
expect(detail?.endsWith('…')).toBe(true)
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
describe('a credential never rides along', () => {
|
|
70
|
+
it.each([
|
|
71
|
+
['sk-ant-api03-AbCdEfGhIjKlMnOpQrStUv', 'anthropic-style key'],
|
|
72
|
+
['npm_aBcDeFgHiJkLmNoPqRsTuVwXyZ012345', 'npm token'],
|
|
73
|
+
['ghp_aBcDeFgHiJkLmNoPqRsTuVwXyZ012345', 'github token'],
|
|
74
|
+
['AKIAIOSFODNN7EXAMPLE', 'aws access key id'],
|
|
75
|
+
])('scrubs %s (%s)', (secret) => {
|
|
76
|
+
const scrubbed = redactSecrets(`upstream rejected token ${secret} for this request`)
|
|
77
|
+
expect(scrubbed).not.toContain(secret)
|
|
78
|
+
expect(scrubbed).toContain('[redacted]')
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
it('scrubs a bearer header the vendor echoed back', () => {
|
|
82
|
+
const scrubbed = redactSecrets('bad header: Authorization: Bearer abcdef0123456789ABCDEF')
|
|
83
|
+
expect(scrubbed).not.toContain('abcdef0123456789ABCDEF')
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it('scrubs a credential-named JSON field without eating the rest', () => {
|
|
87
|
+
const scrubbed = redactSecrets('{"api_key":"sk-live-9999","model":"the-model-that-failed"}')
|
|
88
|
+
expect(scrubbed).not.toContain('sk-live-9999')
|
|
89
|
+
// The surrounding sentence is the whole point — scrubbing must not
|
|
90
|
+
// degrade into deleting the message.
|
|
91
|
+
expect(scrubbed).toContain('the-model-that-failed')
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
it('scrubs on the real path, not only in the helper', () => {
|
|
95
|
+
const err = providerHttpError({
|
|
96
|
+
providerId: 'anthropic',
|
|
97
|
+
status: 401,
|
|
98
|
+
body: JSON.stringify({
|
|
99
|
+
error: { message: 'invalid key sk-ant-api03-AbCdEfGhIjKlMnOpQrStUv supplied' },
|
|
100
|
+
}),
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
expect(err.detail).not.toContain('AbCdEfGhIjKlMnOpQrStUv')
|
|
104
|
+
expect(err.detail).toContain('[redacted]')
|
|
105
|
+
expect(err.message).not.toContain('AbCdEfGhIjKlMnOpQrStUv')
|
|
106
|
+
})
|
|
107
|
+
})
|
package/src/provider/errors.ts
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.
|
|
@@ -50,6 +58,22 @@ export class ProviderRequestError extends Error {
|
|
|
50
58
|
public readonly providerId: string
|
|
51
59
|
public readonly status?: number
|
|
52
60
|
public readonly retryAfterMs?: number
|
|
61
|
+
/**
|
|
62
|
+
* What the provider said was wrong, truncated and redacted.
|
|
63
|
+
*
|
|
64
|
+
* `ProviderRequestErrorInit` has declared this field all along and the
|
|
65
|
+
* constructor never read it, so every caller that set it was writing to
|
|
66
|
+
* nothing. That is not a cosmetic gap: a provider rejecting a request
|
|
67
|
+
* usually names the exact offending field, and losing that sentence turns
|
|
68
|
+
* a one-line diagnosis into hypothesis elimination against a live API. It
|
|
69
|
+
* did — a tool schema in the wrong JSON Schema dialect cost a day of
|
|
70
|
+
* production downtime while the wire had been saying
|
|
71
|
+
* `tools.0.custom.input_schema: … must match JSON Schema draft 2020-12`
|
|
72
|
+
* the whole time.
|
|
73
|
+
*
|
|
74
|
+
* See {@link vendorDetail} for what is kept and what is scrubbed.
|
|
75
|
+
*/
|
|
76
|
+
public readonly detail?: string
|
|
53
77
|
|
|
54
78
|
constructor(init: ProviderRequestErrorInit) {
|
|
55
79
|
super(buildProviderErrorMessage(init))
|
|
@@ -58,7 +82,80 @@ export class ProviderRequestError extends Error {
|
|
|
58
82
|
this.providerId = init.providerId
|
|
59
83
|
if (init.status !== undefined) this.status = init.status
|
|
60
84
|
if (init.retryAfterMs !== undefined) this.retryAfterMs = init.retryAfterMs
|
|
85
|
+
if (init.detail !== undefined) this.detail = init.detail
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Longest detail worth carrying. A provider's complaint is a sentence. */
|
|
90
|
+
const DETAIL_MAX = 400
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Credential shapes to scrub before a provider's words are kept.
|
|
94
|
+
*
|
|
95
|
+
* The original decision to discard the body outright was not paranoia — an
|
|
96
|
+
* error body can echo the request, and a request can carry a key. The answer
|
|
97
|
+
* is to scrub what looks like a credential rather than to throw away the
|
|
98
|
+
* sentence that names the broken field.
|
|
99
|
+
*/
|
|
100
|
+
const SECRET_PATTERNS: readonly RegExp[] = [
|
|
101
|
+
/\b(?:sk|pk|rk)[-_][A-Za-z0-9_-]{12,}/g,
|
|
102
|
+
/\bnpm_[A-Za-z0-9]{20,}/g,
|
|
103
|
+
/\bgh[pousr]_[A-Za-z0-9]{20,}/g,
|
|
104
|
+
/\bBearer\s+[A-Za-z0-9._~+/-]{12,}=*/gi,
|
|
105
|
+
/\bAKIA[0-9A-Z]{16}\b/g,
|
|
106
|
+
/("(?:api[_-]?key|authorization|token|secret|password)"\s*:\s*)"[^"]*"/gi,
|
|
107
|
+
]
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The provider's own account of what was wrong, safe to log.
|
|
111
|
+
*
|
|
112
|
+
* Prefers the structured `error.message` a JSON body carries, because that is
|
|
113
|
+
* the field vendors put the actionable sentence in and it is bounded; falls
|
|
114
|
+
* back to the raw text. Truncated, and every credential shape replaced.
|
|
115
|
+
*/
|
|
116
|
+
export function vendorDetail(body: unknown): string | undefined {
|
|
117
|
+
if (body === undefined || body === null) return undefined
|
|
118
|
+
|
|
119
|
+
let text: string
|
|
120
|
+
if (typeof body === 'string') {
|
|
121
|
+
try {
|
|
122
|
+
text = pickMessage(JSON.parse(body)) ?? body
|
|
123
|
+
} catch {
|
|
124
|
+
text = body
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
text = pickMessage(body) ?? ''
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const cleaned = redactSecrets(text.trim())
|
|
131
|
+
if (cleaned.length === 0) return undefined
|
|
132
|
+
return cleaned.length > DETAIL_MAX ? `${cleaned.slice(0, DETAIL_MAX)}…` : cleaned
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function redactSecrets(text: string): string {
|
|
136
|
+
let out = text
|
|
137
|
+
for (const pattern of SECRET_PATTERNS) {
|
|
138
|
+
out = out.replace(pattern, (_match, prefix?: string) =>
|
|
139
|
+
prefix === undefined ? '[redacted]' : `${prefix}"[redacted]"`,
|
|
140
|
+
)
|
|
141
|
+
}
|
|
142
|
+
return out
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function pickMessage(value: unknown): string | undefined {
|
|
146
|
+
if (typeof value === 'string') return value
|
|
147
|
+
if (typeof value !== 'object' || value === null) return undefined
|
|
148
|
+
const node = value as Record<string, unknown>
|
|
149
|
+
// `{ error: { message } }` is what every wire in this tree uses; the rest
|
|
150
|
+
// are the shapes seen in the drivers' own fixtures.
|
|
151
|
+
const nested = node.error
|
|
152
|
+
if (typeof nested === 'string') return nested
|
|
153
|
+
if (typeof nested === 'object' && nested !== null) {
|
|
154
|
+
const message = (nested as Record<string, unknown>).message
|
|
155
|
+
if (typeof message === 'string') return message
|
|
61
156
|
}
|
|
157
|
+
if (typeof node.message === 'string') return node.message
|
|
158
|
+
return undefined
|
|
62
159
|
}
|
|
63
160
|
|
|
64
161
|
/** Is this a classified provider failure, whichever SDK copy threw it? */
|
|
@@ -312,11 +409,13 @@ export function providerVendorError(input: {
|
|
|
312
409
|
input.retryAfter ?? vendorRetryAfter(error),
|
|
313
410
|
input.now ?? Date.now(),
|
|
314
411
|
)
|
|
412
|
+
const detail = vendorDetail(message)
|
|
315
413
|
return new ProviderRequestError({
|
|
316
414
|
kind,
|
|
317
415
|
providerId: input.providerId,
|
|
318
416
|
...(status !== undefined ? { status } : {}),
|
|
319
417
|
...(retryAfterMs !== undefined ? { retryAfterMs } : {}),
|
|
418
|
+
...(detail !== undefined ? { detail } : {}),
|
|
320
419
|
})
|
|
321
420
|
}
|
|
322
421
|
|
|
@@ -335,10 +434,12 @@ export function providerHttpError(input: {
|
|
|
335
434
|
}): ProviderRequestError {
|
|
336
435
|
const kind = classifyProviderHttpStatus(input.status, input.body)
|
|
337
436
|
const retryAfterMs = parseRetryAfterMs(input.retryAfter, input.now ?? Date.now())
|
|
437
|
+
const detail = vendorDetail(input.body)
|
|
338
438
|
return new ProviderRequestError({
|
|
339
439
|
kind,
|
|
340
440
|
providerId: input.providerId,
|
|
341
441
|
status: input.status,
|
|
342
442
|
...(retryAfterMs !== undefined ? { retryAfterMs } : {}),
|
|
443
|
+
...(detail !== undefined ? { detail } : {}),
|
|
343
444
|
})
|
|
344
445
|
}
|
|
@@ -28,12 +28,21 @@
|
|
|
28
28
|
* A deny-list rather than an allow-list, deliberately. An allow-list would have
|
|
29
29
|
* to enumerate every annotation a schema may carry — `description`, `title`,
|
|
30
30
|
* `examples`, vendor extensions — and would refuse a schema for saying
|
|
31
|
-
* something harmless.
|
|
32
|
-
*
|
|
31
|
+
* something harmless. Each entry names what to write instead.
|
|
32
|
+
*
|
|
33
|
+
* MEASURED against the live API, not read off a page. The first version of this
|
|
34
|
+
* list was derived from documentation and was wrong in both directions: it
|
|
35
|
+
* refused `minLength`/`maxLength`, which the wire accepts, and it permitted
|
|
36
|
+
* `prefixItems`, which the wire rejects. A deny-list nobody probed is a guess
|
|
37
|
+
* with a confident tone, and this one would have refused working tools while
|
|
38
|
+
* still letting a broken one through.
|
|
39
|
+
*
|
|
40
|
+
* The probe lives in the live contract test; run it against a new model before
|
|
41
|
+
* trusting this list on that model.
|
|
33
42
|
*/
|
|
34
43
|
const NO_CONDITIONALS = 'strict mode has no conditional schemas; flatten the object'
|
|
35
44
|
const NO_NUMERIC_BOUNDS = 'numeric bounds are not in the subset; enforce at execution'
|
|
36
|
-
const
|
|
45
|
+
const NO_ARRAY_BOUNDS = 'array bounds are not in the subset; enforce at execution'
|
|
37
46
|
|
|
38
47
|
// A Map rather than an object literal, because one of the keys is `then`: an
|
|
39
48
|
// ordinary object carrying a `then` property is a thenable, and awaiting it
|
|
@@ -50,17 +59,40 @@ const UNSUPPORTED: ReadonlyMap<string, string> = new Map([
|
|
|
50
59
|
['exclusiveMinimum', NO_NUMERIC_BOUNDS],
|
|
51
60
|
['exclusiveMaximum', NO_NUMERIC_BOUNDS],
|
|
52
61
|
['multipleOf', NO_NUMERIC_BOUNDS],
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
// `minLength`/`maxLength` are NOT here. The first version of this list put
|
|
63
|
+
// them here on documentation alone, and measurement says the wire accepts
|
|
64
|
+
// both — so the list was refusing tools that would have worked. A deny-list
|
|
65
|
+
// derived from prose and never probed is a guess with a confident tone.
|
|
66
|
+
// `minItems` is NOT a flat denial — see MIN_ITEMS_ALLOWED below. The wire
|
|
67
|
+
// accepts 0 and 1 and refuses everything above, naming the value in the
|
|
68
|
+
// error, so a blanket entry here would refuse `.nonempty()` on a schema the
|
|
69
|
+
// wire would have taken.
|
|
70
|
+
['maxItems', NO_ARRAY_BOUNDS],
|
|
71
|
+
['uniqueItems', NO_ARRAY_BOUNDS],
|
|
72
|
+
// The other direction of the same mistake: this was missing, and it is the
|
|
73
|
+
// one that interacts with the dialect conversion. A tuple becomes
|
|
74
|
+
// `prefixItems` for the 2020-12 wire — and strict rejects `prefixItems`
|
|
75
|
+
// outright, so a tool that is BOTH strict AND tuple-shaped cannot be
|
|
76
|
+
// expressed at all. Better to say that at registration than to convert a
|
|
77
|
+
// schema into a different rejection.
|
|
78
|
+
['prefixItems', 'strict arrays take one `items` schema; a tuple cannot be expressed'],
|
|
58
79
|
['patternProperties', 'name the properties explicitly'],
|
|
59
80
|
['propertyNames', 'name the properties explicitly'],
|
|
60
81
|
['dependentSchemas', 'flatten the object and validate at execution'],
|
|
61
82
|
['dependentRequired', 'flatten the object and validate at execution'],
|
|
62
83
|
])
|
|
63
84
|
|
|
85
|
+
/**
|
|
86
|
+
* The only `minItems` values the strict subset admits.
|
|
87
|
+
*
|
|
88
|
+
* Measured: `minItems: 0` and `minItems: 1` are accepted, `minItems: 2` comes
|
|
89
|
+
* back *"For 'array' type, 'minItems' values other than 0 or 1 are not
|
|
90
|
+
* supported"*. So the constraint is on the VALUE, not the keyword, and that is
|
|
91
|
+
* the whole difference between refusing a required-non-empty array — the
|
|
92
|
+
* ordinary spelling of `z.array(...).nonempty()` — and letting it through.
|
|
93
|
+
*/
|
|
94
|
+
const MIN_ITEMS_ALLOWED = new Set([0, 1])
|
|
95
|
+
|
|
64
96
|
export interface StrictSchemaViolation {
|
|
65
97
|
/** Dotted path to the offending keyword, e.g. `properties.insertLine.oneOf`. */
|
|
66
98
|
readonly path: string
|
|
@@ -100,6 +132,31 @@ export function findStrictSchemaViolations(schema: unknown, path = ''): StrictSc
|
|
|
100
132
|
})
|
|
101
133
|
continue
|
|
102
134
|
}
|
|
135
|
+
// A tuple in the OTHER spelling. This check runs at registration, on the
|
|
136
|
+
// schema as rendered — which is draft-07, where a tuple is `items: [a,
|
|
137
|
+
// b]` — while the wire sees the 2020-12 `prefixItems` the driver
|
|
138
|
+
// converts it to. So a `prefixItems` entry alone never fires on the
|
|
139
|
+
// path that produces tuples, and the entry added to catch this case was
|
|
140
|
+
// dead for exactly the case it was added for.
|
|
141
|
+
//
|
|
142
|
+
// Both spellings mean the same thing and strict admits neither, so this
|
|
143
|
+
// names the tuple rather than the dialect it happens to be written in.
|
|
144
|
+
if (keyword === 'items' && Array.isArray(value)) {
|
|
145
|
+
found.push({
|
|
146
|
+
path: here,
|
|
147
|
+
keyword,
|
|
148
|
+
remedy: 'strict arrays take one `items` schema; a tuple cannot be expressed',
|
|
149
|
+
})
|
|
150
|
+
continue
|
|
151
|
+
}
|
|
152
|
+
if (keyword === 'minItems' && typeof value === 'number' && !MIN_ITEMS_ALLOWED.has(value)) {
|
|
153
|
+
found.push({
|
|
154
|
+
path: here,
|
|
155
|
+
keyword,
|
|
156
|
+
remedy: 'strict accepts `minItems` of 0 or 1 only; enforce a larger bound at execution',
|
|
157
|
+
})
|
|
158
|
+
continue
|
|
159
|
+
}
|
|
103
160
|
found.push(...findStrictSchemaViolations(value, here))
|
|
104
161
|
}
|
|
105
162
|
return found
|