@enclave-vm/client 2.19.0 → 2.19.2
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 +168 -130
- package/client.d.ts +52 -6
- package/client.d.ts.map +1 -1
- package/esm/index.mjs +395 -177
- package/index.js +384 -174
- package/package.json +3 -3
- package/types.d.ts +23 -5
- package/types.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enclave-vm/client",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.2",
|
|
4
4
|
"description": "Browser and Node.js client SDK for the EnclaveJS streaming runtime",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://github.com/agentfront/enclave",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@enclave-vm/stream": "2.19.
|
|
37
|
-
"@enclave-vm/types": "2.19.
|
|
36
|
+
"@enclave-vm/stream": "2.19.2",
|
|
37
|
+
"@enclave-vm/types": "2.19.2"
|
|
38
38
|
}
|
|
39
39
|
}
|
package/types.d.ts
CHANGED
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
import type { SessionId, StreamEvent, SessionLimits, ErrorPayload, ToolProgressPhase } from '@enclave-vm/types';
|
|
9
9
|
/**
|
|
10
10
|
* Client configuration
|
|
11
|
+
*
|
|
12
|
+
* These are all the options there are. The constructor refuses any other key: the client has
|
|
13
|
+
* no `encryption` and no `auth` option. Requests and events travel as plain JSON, so use an
|
|
14
|
+
* `https:` base URL, and send credentials with `headers`.
|
|
11
15
|
*/
|
|
12
16
|
export interface EnclaveClientConfig {
|
|
13
17
|
/**
|
|
@@ -15,11 +19,15 @@ export interface EnclaveClientConfig {
|
|
|
15
19
|
*/
|
|
16
20
|
baseUrl: string;
|
|
17
21
|
/**
|
|
18
|
-
* Default headers to include in all requests
|
|
22
|
+
* Default headers to include in all requests (for example `Authorization`)
|
|
19
23
|
*/
|
|
20
24
|
headers?: Record<string, string>;
|
|
21
25
|
/**
|
|
22
|
-
*
|
|
26
|
+
* How long the client waits for the server, in milliseconds: for the answer to a request,
|
|
27
|
+
* and for the next event on an open stream. On a stream the wait is never shorter than two
|
|
28
|
+
* heartbeat intervals of the session (15 seconds each unless `limits.heartbeatIntervalMs`
|
|
29
|
+
* asks for another). When it runs out the connection counts as lost: the client reconnects
|
|
30
|
+
* if `autoReconnect` allows it, otherwise the session fails with `TIMEOUT`.
|
|
23
31
|
* @default 60000
|
|
24
32
|
*/
|
|
25
33
|
timeout?: number;
|
|
@@ -38,6 +46,12 @@ export interface EnclaveClientConfig {
|
|
|
38
46
|
* @default 1000
|
|
39
47
|
*/
|
|
40
48
|
reconnectDelay?: number;
|
|
49
|
+
/**
|
|
50
|
+
* Largest event the client accepts, in characters of its JSON line. A longer event ends the
|
|
51
|
+
* session with `PARSE_ERROR`.
|
|
52
|
+
* @default 8388608 (8 MiB)
|
|
53
|
+
*/
|
|
54
|
+
maxEventLength?: number;
|
|
41
55
|
/**
|
|
42
56
|
* Custom fetch implementation (for Node.js or testing)
|
|
43
57
|
*/
|
|
@@ -56,7 +70,7 @@ export interface ExecuteOptions {
|
|
|
56
70
|
*/
|
|
57
71
|
limits?: Partial<SessionLimits>;
|
|
58
72
|
/**
|
|
59
|
-
* Abort signal for cancellation
|
|
73
|
+
* Abort signal for cancellation. Aborting it does what `SessionHandle.cancel()` does.
|
|
60
74
|
*/
|
|
61
75
|
signal?: AbortSignal;
|
|
62
76
|
}
|
|
@@ -97,7 +111,9 @@ export interface SessionEventHandlers {
|
|
|
97
111
|
*/
|
|
98
112
|
onHeartbeat?: () => void;
|
|
99
113
|
/**
|
|
100
|
-
* Called on non-fatal error
|
|
114
|
+
* Called on non-fatal error: an `error` event of the session, or, with the code
|
|
115
|
+
* `CANCEL_FAILED`, a cancellation that the server did not confirm (the script may still
|
|
116
|
+
* be running)
|
|
101
117
|
*/
|
|
102
118
|
onError?: (code: string, message: string) => void;
|
|
103
119
|
/**
|
|
@@ -174,7 +190,9 @@ export interface SessionHandle {
|
|
|
174
190
|
*/
|
|
175
191
|
wait(): Promise<SessionResult>;
|
|
176
192
|
/**
|
|
177
|
-
* Cancel the session
|
|
193
|
+
* Cancel the session: it ends as `CANCELLED` here, and the server is asked to end it.
|
|
194
|
+
* Does not reject; a stop that the server did not confirm is reported to `onError`
|
|
195
|
+
* with the code `CANCEL_FAILED`.
|
|
178
196
|
*/
|
|
179
197
|
cancel(reason?: string): Promise<void>;
|
|
180
198
|
/**
|
package/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEhH
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEhH;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OA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