@robota-sdk/agent-transport-ws 3.0.0-beta.44 → 3.0.0-beta.46
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/README.md +3 -4
- package/dist/node/index.cjs +2 -2
- package/dist/node/index.d.cts +1 -4
- package/dist/node/index.d.ts +1 -4
- package/dist/node/index.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ pnpm add @robota-sdk/agent-transport-ws
|
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
14
|
import { createWsHandler } from '@robota-sdk/agent-transport-ws';
|
|
15
|
-
import { InteractiveSession
|
|
15
|
+
import type { InteractiveSession } from '@robota-sdk/agent-sdk';
|
|
16
16
|
import { WebSocketServer } from 'ws';
|
|
17
17
|
|
|
18
18
|
const wss = new WebSocketServer({ port: 8080 });
|
|
@@ -20,7 +20,6 @@ const wss = new WebSocketServer({ port: 8080 });
|
|
|
20
20
|
wss.on('connection', (ws) => {
|
|
21
21
|
const { onMessage, cleanup } = createWsHandler({
|
|
22
22
|
session: interactiveSession,
|
|
23
|
-
commandExecutor,
|
|
24
23
|
send: (msg) => ws.send(JSON.stringify(msg)),
|
|
25
24
|
});
|
|
26
25
|
|
|
@@ -38,7 +37,7 @@ All messages are JSON-encoded objects with a `type` field.
|
|
|
38
37
|
| type | payload | maps to |
|
|
39
38
|
| --------------- | --------------------------------- | ---------------------------- |
|
|
40
39
|
| `submit` | `{ prompt: string }` | `session.submit(prompt)` |
|
|
41
|
-
| `command` | `{ name: string, args?: string }` | `
|
|
40
|
+
| `command` | `{ name: string, args?: string }` | `session.executeCommand()` |
|
|
42
41
|
| `abort` | — | `session.abort()` |
|
|
43
42
|
| `cancel-queue` | — | `session.cancelQueue()` |
|
|
44
43
|
| `get-messages` | — | `session.getMessages()` |
|
|
@@ -66,5 +65,5 @@ All messages are JSON-encoded objects with a `type` field.
|
|
|
66
65
|
|
|
67
66
|
## Dependencies
|
|
68
67
|
|
|
69
|
-
- `@robota-sdk/agent-sdk` — `InteractiveSession
|
|
68
|
+
- `@robota-sdk/agent-sdk` — `InteractiveSession`
|
|
70
69
|
- No WebSocket library dependency (framework-agnostic)
|
package/dist/node/index.cjs
CHANGED
|
@@ -26,7 +26,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
26
26
|
|
|
27
27
|
// src/ws-handler.ts
|
|
28
28
|
function createWsHandler(options) {
|
|
29
|
-
const { session,
|
|
29
|
+
const { session, send } = options;
|
|
30
30
|
const onTextDelta = (delta) => send({ type: "text_delta", delta });
|
|
31
31
|
const onToolStart = (state) => send({ type: "tool_start", state });
|
|
32
32
|
const onToolEnd = (state) => send({ type: "tool_end", state });
|
|
@@ -62,7 +62,7 @@ function createWsHandler(options) {
|
|
|
62
62
|
send({ type: "protocol_error", message: "name is required" });
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
session.executeCommand(msg.name, msg.args ?? "").then((result) => {
|
|
66
66
|
send({
|
|
67
67
|
type: "command_result",
|
|
68
68
|
name: msg.name,
|
package/dist/node/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InteractiveSession,
|
|
1
|
+
import { InteractiveSession, IToolState, IExecutionResult } from '@robota-sdk/agent-sdk';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* WebSocket transport adapter — exposes InteractiveSession over WebSocket.
|
|
@@ -78,8 +78,6 @@ type TServerMessage = {
|
|
|
78
78
|
interface IWsHandlerOptions {
|
|
79
79
|
/** InteractiveSession to expose. */
|
|
80
80
|
session: InteractiveSession;
|
|
81
|
-
/** System command executor. */
|
|
82
|
-
commandExecutor: SystemCommandExecutor;
|
|
83
81
|
/** Send a JSON message to the client. */
|
|
84
82
|
send: (message: TServerMessage) => void;
|
|
85
83
|
}
|
|
@@ -94,7 +92,6 @@ interface IWsHandlerOptions {
|
|
|
94
92
|
* ```typescript
|
|
95
93
|
* const { onMessage, cleanup } = createWsHandler({
|
|
96
94
|
* session: interactiveSession,
|
|
97
|
-
* commandExecutor,
|
|
98
95
|
* send: (msg) => ws.send(JSON.stringify(msg)),
|
|
99
96
|
* });
|
|
100
97
|
*
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InteractiveSession,
|
|
1
|
+
import { InteractiveSession, IToolState, IExecutionResult } from '@robota-sdk/agent-sdk';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* WebSocket transport adapter — exposes InteractiveSession over WebSocket.
|
|
@@ -78,8 +78,6 @@ type TServerMessage = {
|
|
|
78
78
|
interface IWsHandlerOptions {
|
|
79
79
|
/** InteractiveSession to expose. */
|
|
80
80
|
session: InteractiveSession;
|
|
81
|
-
/** System command executor. */
|
|
82
|
-
commandExecutor: SystemCommandExecutor;
|
|
83
81
|
/** Send a JSON message to the client. */
|
|
84
82
|
send: (message: TServerMessage) => void;
|
|
85
83
|
}
|
|
@@ -94,7 +92,6 @@ interface IWsHandlerOptions {
|
|
|
94
92
|
* ```typescript
|
|
95
93
|
* const { onMessage, cleanup } = createWsHandler({
|
|
96
94
|
* session: interactiveSession,
|
|
97
|
-
* commandExecutor,
|
|
98
95
|
* send: (msg) => ws.send(JSON.stringify(msg)),
|
|
99
96
|
* });
|
|
100
97
|
*
|
package/dist/node/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/ws-handler.ts
|
|
2
2
|
function createWsHandler(options) {
|
|
3
|
-
const { session,
|
|
3
|
+
const { session, send } = options;
|
|
4
4
|
const onTextDelta = (delta) => send({ type: "text_delta", delta });
|
|
5
5
|
const onToolStart = (state) => send({ type: "tool_start", state });
|
|
6
6
|
const onToolEnd = (state) => send({ type: "tool_end", state });
|
|
@@ -36,7 +36,7 @@ function createWsHandler(options) {
|
|
|
36
36
|
send({ type: "protocol_error", message: "name is required" });
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
session.executeCommand(msg.name, msg.args ?? "").then((result) => {
|
|
40
40
|
send({
|
|
41
41
|
type: "command_result",
|
|
42
42
|
name: msg.name,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robota-sdk/agent-transport-ws",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.46",
|
|
4
4
|
"description": "WebSocket transport adapter for exposing InteractiveSession over real-time connections",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/node/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dist"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@robota-sdk/agent-sdk": "3.0.0-beta.
|
|
25
|
+
"@robota-sdk/agent-sdk": "3.0.0-beta.46"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"rimraf": "^5.0.5",
|