@jxsuite/ai 0.33.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/LICENSE +21 -0
- package/package.json +4 -3
- package/src/streaming-client.ts +15 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kevin Shenk
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
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.
|
|
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 {
|