@mitralab.io/sdk-core 0.2.9-beta.0 → 0.2.9
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 +12 -0
- package/README.md +22 -11
- package/contracts/README.md +8 -0
- package/contracts/manifest.json +11 -1
- package/contracts/v0.2.9/sdk-parity.json +2902 -0
- package/contracts/v0.2.9-beta.1/sdk-parity.json +2902 -0
- package/dist/index.cjs +18 -9
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +18 -9
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented in this file.
|
|
4
4
|
|
|
5
|
+
## 0.2.9-beta.1
|
|
6
|
+
|
|
7
|
+
- Only a business agent's chat (one with an `agentId`) is created with `runtime: "T3"` and asks
|
|
8
|
+
the Copilot for the direct channel. Any other chat is created and streamed as before: 0.2.9-beta.0
|
|
9
|
+
put T3 on every new chat, which the Copilot refuses outside an agent chat
|
|
10
|
+
(`RUNTIME_REQUIRES_AGENT_APP`).
|
|
11
|
+
- A box event stream answered 200 with a type other than `text/event-stream` is a box without
|
|
12
|
+
the HTTP routes: `channelDeclined` `http_unsupported`, without reading it as a stream.
|
|
13
|
+
`AgentFetchResponse` now carries `headers`.
|
|
14
|
+
- Box refusals follow the final POST contract: 409, 400, 413, 503 and 504 reject with
|
|
15
|
+
`AgentTaskTurnError` and the box's `error_code` and `message`, the 504 included.
|
|
16
|
+
|
|
5
17
|
## 0.2.9-beta.0
|
|
6
18
|
|
|
7
19
|
- Take the chat's direct channel to its box as the Agent session transport. Sessions ask the
|
package/README.md
CHANGED
|
@@ -85,12 +85,22 @@ turn. Use `cancel()` when interruption is intended.
|
|
|
85
85
|
|
|
86
86
|
### Direct channel
|
|
87
87
|
|
|
88
|
-
The direct channel is on when the concrete SDK passes `directChannel.apiUrl
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
88
|
+
The direct channel is on when the concrete SDK passes `directChannel.apiUrl`, and it serves a
|
|
89
|
+
business agent's chat, the one with an `agentId`: only those have a box. Any other chat, or any
|
|
90
|
+
chat without `apiUrl`, stays on the event source and REST inputs, with no channel request and
|
|
91
|
+
no T3 default. A business agent's chat asks the Copilot once where it is served
|
|
92
|
+
(`POST /api/v1/tasks/{id}/channel`, through `agentTasks.channel`) and talks to the box that
|
|
93
|
+
answers. The box runs the turn; the Copilot hands out the channel, admits every turn and
|
|
94
|
+
receives the box log. A new business agent's chat is created with `runtime: "T3"` so it is born
|
|
95
|
+
on its box, unless the session names a runtime; the Copilot refuses T3 for any other chat
|
|
96
|
+
(`RUNTIME_REQUIRES_AGENT_APP`).
|
|
97
|
+
|
|
98
|
+
`session({ taskId })` reads the task before it opens anything, so the same rule holds for an
|
|
99
|
+
existing chat: with no `agentId` it never asks for `/channel`; with an `agentId` it asks and the
|
|
100
|
+
Copilot decides. A chat the Copilot will not serve on its box (not on T3, answered for example
|
|
101
|
+
with `RUNTIME_NOT_T3`) is a raw `channelDeclined` with `reason: "unavailable"` and the Copilot's
|
|
102
|
+
message, and the session goes on through the event source and REST inputs, with no `error`
|
|
103
|
+
event for the app.
|
|
94
104
|
|
|
95
105
|
- **Transport.** `websocket` uses the box socket. `http` uses the box's HTTP routes next to the
|
|
96
106
|
socket path: `POST .../api/mitra/chat/messages` to send and `GET .../api/mitra/chat/events`
|
|
@@ -107,8 +117,8 @@ with `runtime: "T3"` so it is born on its box, unless the session names a runtim
|
|
|
107
117
|
- **Fallback, always visible.** When the Copilot answers 202 or an error (a Copilot without
|
|
108
118
|
`/channel`), the body has no `wsUrl`, the host is outside the rule, a `websocket` session has
|
|
109
119
|
no WebSocket, the box cannot be reached (a handshake that times out or is refused, a proxy
|
|
110
|
-
blocking its host, a network error on the HTTP stream), or the box
|
|
111
|
-
|
|
120
|
+
blocking its host, a network error on the HTTP stream), or the box has no HTTP routes (a 404,
|
|
121
|
+
or a stream that is not `text/event-stream`, from a template older than them), the
|
|
112
122
|
session stays on the event source and REST inputs and first emits a raw `channelDeclined`
|
|
113
123
|
event with `reason` `unavailable`, `body`, `host`, `websocket`, or `http_unsupported`.
|
|
114
124
|
- **Runtimes without WebSocket.** Core uses `directChannel.WebSocket` when given, otherwise
|
|
@@ -119,9 +129,10 @@ with `runtime: "T3"` so it is born on its box, unless the session names a runtim
|
|
|
119
129
|
`stepStart` frame on the stream, or the 200 of the HTTP POST, both the box starting the turn
|
|
120
130
|
the Copilot admitted. The session then emits `accepted`, and from there the turn runs and
|
|
121
131
|
reaches the Copilot's log even if this process goes away. A refusal is reported once through
|
|
122
|
-
`error`: an `error` frame on the stream, or
|
|
123
|
-
|
|
124
|
-
|
|
132
|
+
`error`: an `error` frame on the stream, or a POST answered 409 (not admitted), 400 (bad
|
|
133
|
+
frame), 413 (too large), 503 (nobody to admit) or 504 (no admission or turn within 30 s), each
|
|
134
|
+
with `{error_code, message}`, which rejects `sendAndWait` with `AgentTaskTurnError` carrying
|
|
135
|
+
that code and message. A box silent for 35 s with the wire up fails the send; a redial pauses that clock and a successful one
|
|
125
136
|
restarts it. Over REST, `accepted` follows the Copilot's 202. A caller that does not
|
|
126
137
|
wait for the answer, such as a Serverless Function, awaits `accepted` before it returns;
|
|
127
138
|
`sendAndWait` waits for the whole turn.
|
package/contracts/README.md
CHANGED
|
@@ -24,6 +24,14 @@ publishes.
|
|
|
24
24
|
|
|
25
25
|
## Versions
|
|
26
26
|
|
|
27
|
+
- `0.2.9` is the stable release of the `0.2.9-beta.1` surface: the direct box channel on the
|
|
28
|
+
Agent session, limited to business agent chats. Same parity cases; the version exists so a
|
|
29
|
+
consumer pinning the stable package can pin a corpus with the same number.
|
|
30
|
+
|
|
31
|
+
- `0.2.9-beta.1` is the `0.2.9-beta.0` parity surface republished with the direct channel
|
|
32
|
+
limited to business agent chats and the box refusals of the final contract. Same parity
|
|
33
|
+
cases; the version exists so a consumer pinning the package can pin a corpus with the same number.
|
|
34
|
+
|
|
27
35
|
- `0.2.9-beta.0` is the `0.2.8` parity surface republished with the direct box channel on the
|
|
28
36
|
Agent session and `agentTasks.channel`, which the parity cases do not cover. Same parity cases;
|
|
29
37
|
the version exists so a consumer pinning the package can pin a corpus with the same number.
|
package/contracts/manifest.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"contract": "SDK-PARITY-001",
|
|
3
|
-
"current": "0.2.9
|
|
3
|
+
"current": "0.2.9",
|
|
4
4
|
"versions": [
|
|
5
5
|
{
|
|
6
6
|
"version": "0.1.0",
|
|
@@ -75,6 +75,16 @@
|
|
|
75
75
|
"version": "0.2.9-beta.0",
|
|
76
76
|
"path": "v0.2.9-beta.0/sdk-parity.json",
|
|
77
77
|
"sha256": "393142e56660b2fd90d51ab5e00fadd8c4454164783da23f0c1fbb264ccf92e0"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"version": "0.2.9-beta.1",
|
|
81
|
+
"path": "v0.2.9-beta.1/sdk-parity.json",
|
|
82
|
+
"sha256": "f0ec4130c399f7102ad20b6dc54ed50da957003d19d3ab811d013ce89b5cde06"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"version": "0.2.9",
|
|
86
|
+
"path": "v0.2.9/sdk-parity.json",
|
|
87
|
+
"sha256": "aa81d033dc4bf7ccd30d712568e6bccf1319a208e9072c40369a86b090bc5c13"
|
|
78
88
|
}
|
|
79
89
|
]
|
|
80
90
|
}
|