@vincemakes/kiso-core 0.39.0 → 0.39.1
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/dist/errors.d.ts +23 -0
- package/dist/errors.js +25 -0
- package/package.json +2 -2
package/dist/errors.d.ts
CHANGED
|
@@ -13,3 +13,26 @@ import type { StructuredError } from "./protocol/events.js";
|
|
|
13
13
|
* rather than retrying early. */
|
|
14
14
|
export declare function parseRetryAfter(value: string | null | undefined, now?: number): number | undefined;
|
|
15
15
|
export declare function mapApiError(status: number | undefined, message: string, retryAfterMs?: number): StructuredError;
|
|
16
|
+
/**
|
|
17
|
+
* A failure that reached us AFTER the response headers did.
|
|
18
|
+
*
|
|
19
|
+
* Once a 2xx and the headers are in, the request has been ACCEPTED: no
|
|
20
|
+
* later failure is a verdict on whether it was valid, because nothing was
|
|
21
|
+
* left to validate. What remains is the server or the transport failing
|
|
22
|
+
* mid-flight — a dead socket, a body cut by an intermediary, an in-band
|
|
23
|
+
* error frame, a stream that simply ends without the terminal event its
|
|
24
|
+
* protocol mandates. Every one of those is `network` and RETRYABLE, so
|
|
25
|
+
* the kernel's mid-stream recovery (ADR-0005: retry lives in the kernel;
|
|
26
|
+
* F4: void the draft durably, then retry) engages instead of ending the
|
|
27
|
+
* run on a verdict nobody issued.
|
|
28
|
+
*
|
|
29
|
+
* Deliberately broader than what can be proven transient: a permanent
|
|
30
|
+
* fault misclassified here costs `maxRetries` extra requests (2 by
|
|
31
|
+
* default) and then ends in the same terminal it would have anyway,
|
|
32
|
+
* while a transient one misclassified the other way costs the whole
|
|
33
|
+
* session. The asymmetry is the argument.
|
|
34
|
+
*
|
|
35
|
+
* An error the provider states BEFORE the stream keeps its status
|
|
36
|
+
* mapping — `mapApiError` is untouched and stays the authority there.
|
|
37
|
+
*/
|
|
38
|
+
export declare function streamFailure(message: string): StructuredError;
|
package/dist/errors.js
CHANGED
|
@@ -52,3 +52,28 @@ export function mapApiError(status, message, retryAfterMs) {
|
|
|
52
52
|
return withStatus({ code: "unknown", retryable: false, message });
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* A failure that reached us AFTER the response headers did.
|
|
57
|
+
*
|
|
58
|
+
* Once a 2xx and the headers are in, the request has been ACCEPTED: no
|
|
59
|
+
* later failure is a verdict on whether it was valid, because nothing was
|
|
60
|
+
* left to validate. What remains is the server or the transport failing
|
|
61
|
+
* mid-flight — a dead socket, a body cut by an intermediary, an in-band
|
|
62
|
+
* error frame, a stream that simply ends without the terminal event its
|
|
63
|
+
* protocol mandates. Every one of those is `network` and RETRYABLE, so
|
|
64
|
+
* the kernel's mid-stream recovery (ADR-0005: retry lives in the kernel;
|
|
65
|
+
* F4: void the draft durably, then retry) engages instead of ending the
|
|
66
|
+
* run on a verdict nobody issued.
|
|
67
|
+
*
|
|
68
|
+
* Deliberately broader than what can be proven transient: a permanent
|
|
69
|
+
* fault misclassified here costs `maxRetries` extra requests (2 by
|
|
70
|
+
* default) and then ends in the same terminal it would have anyway,
|
|
71
|
+
* while a transient one misclassified the other way costs the whole
|
|
72
|
+
* session. The asymmetry is the argument.
|
|
73
|
+
*
|
|
74
|
+
* An error the provider states BEFORE the stream keeps its status
|
|
75
|
+
* mapping — `mapApiError` is untouched and stays the authority there.
|
|
76
|
+
*/
|
|
77
|
+
export function streamFailure(message) {
|
|
78
|
+
return { code: "network", retryable: true, message };
|
|
79
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vincemakes/kiso-core",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.1",
|
|
4
4
|
"description": "kiso core \u2014 protocol, event log, loop, hooks, modes, permissions, compaction, delivery truth. The 2,000-line kernel at the bottom of the kiso framework.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"openai"
|
|
34
34
|
],
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@vincemakes/kiso-evals": "0.39.
|
|
36
|
+
"@vincemakes/kiso-evals": "0.39.1",
|
|
37
37
|
"@types/node": "^26.1.2",
|
|
38
38
|
"typescript": "^5.7.2",
|
|
39
39
|
"vitest": "^3.0.0"
|