@jxsuite/ai 0.34.0 → 0.35.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/package.json +4 -3
- package/src/streaming-client.ts +15 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jxsuite/ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"description": "AI infrastructure for Jx Suite — streaming LLM client abstraction, tool registry, and reactive chat state",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,9 +28,10 @@
|
|
|
28
28
|
"upgrade": "bunx npm-check-updates -u && bun install"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@
|
|
31
|
+
"@jxsuite/protocol": "^1.1.0",
|
|
32
|
+
"@vue/reactivity": "3.5.41"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"@happy-dom/global-registrator": "^20.11.
|
|
35
|
+
"@happy-dom/global-registrator": "^20.11.2"
|
|
35
36
|
}
|
|
36
37
|
}
|
package/src/streaming-client.ts
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* @module @jxsuite/ai/streaming-client
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
import type { ProblemDetails } from "@jxsuite/protocol";
|
|
13
|
+
|
|
12
14
|
type StreamEvent =
|
|
13
15
|
| StreamDeltaEvent
|
|
14
16
|
| StreamToolCallStartEvent
|
|
@@ -44,10 +46,22 @@ interface StreamDoneEvent {
|
|
|
44
46
|
stopReason: string;
|
|
45
47
|
}
|
|
46
48
|
|
|
49
|
+
/**
|
|
50
|
+
* A failure that arrived mid-stream.
|
|
51
|
+
*
|
|
52
|
+
* **This is the one place RFC 9457 could not simply replace what was here**, and the reason is
|
|
53
|
+
* structural: a problem document is a _response body_, and by the time this frame is written the
|
|
54
|
+
* response has already begun with a 200. Nothing can change the status any more. So the adoption is
|
|
55
|
+
* that the frame CARRIES a problem rather than being replaced by one — `problem` is the machine
|
|
56
|
+
* half (a `type` a client can key on), `message` stays the human half every existing reader already
|
|
57
|
+
* shows, and `code` remains for the providers that send one.
|
|
58
|
+
*/
|
|
47
59
|
interface StreamErrorEvent {
|
|
48
60
|
type: "error";
|
|
49
61
|
message: string;
|
|
50
62
|
code?: string;
|
|
63
|
+
/** RFC 9457 problem document describing the failure, when the producer knows its type. */
|
|
64
|
+
problem?: ProblemDetails;
|
|
51
65
|
}
|
|
52
66
|
|
|
53
67
|
/**
|
|
@@ -384,10 +398,7 @@ export function createOpenAIStreamingClient({
|
|
|
384
398
|
* @param {string} _opts.apiKey
|
|
385
399
|
* @returns {StreamingClient}
|
|
386
400
|
*/
|
|
387
|
-
export function createAnthropicStreamingClient({
|
|
388
|
-
baseUrl: _,
|
|
389
|
-
apiKey: __,
|
|
390
|
-
}: {
|
|
401
|
+
export function createAnthropicStreamingClient(_opts: {
|
|
391
402
|
baseUrl: string;
|
|
392
403
|
apiKey: string;
|
|
393
404
|
}): StreamingClient {
|