@byok-sdk/client 0.4.0 → 0.4.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 +1 -1
- package/dist/adapters/claude/process-client.d.ts +7 -1
- package/dist/adapters/codex/process-runner.d.ts +5 -0
- package/dist/adapters/index.js +258 -60
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/pi/resolve-bin.d.ts +1 -1
- package/dist/adapters/pi/rpc-client.d.ts +7 -1
- package/dist/adapters/process-tree.d.ts +45 -4
- package/dist/adapters/taskkill-pid-set.d.ts +34 -0
- package/dist/bin/byok-agent.js +283 -80
- package/dist/bin/byok-agent.js.map +1 -1
- package/dist/daemon/connection-manager.d.ts +11 -15
- package/dist/daemon/long-poll-transport.d.ts +6 -0
- package/dist/daemon/task-runner.d.ts +7 -6
- package/dist/index.js +283 -80
- package/dist/index.js.map +1 -1
- package/package.json +14 -14
|
@@ -159,25 +159,24 @@ export declare class ConnectionManager {
|
|
|
159
159
|
*/
|
|
160
160
|
private cancelPendingDrainRetry;
|
|
161
161
|
/**
|
|
162
|
-
* The capabilities the
|
|
163
|
-
* `
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
* successful handshake.
|
|
162
|
+
* The capabilities the CURRENT transport's server advertised — untyped
|
|
163
|
+
* `string[]` for forward compatibility. WS populates it from `conn.ack`;
|
|
164
|
+
* long-poll populates it from each successful events response. Empty until
|
|
165
|
+
* the active transport supplies an advertisement.
|
|
167
166
|
*
|
|
168
167
|
* Finding R2 (cross-model re-review — was P1): strictly PER-CONNECTION,
|
|
169
168
|
* not per-daemon-lifetime. Cleared to `[]` the instant the acked WS
|
|
170
169
|
* connection ends for ANY reason — an ordinary disconnect (`onWsOutcome`'s
|
|
171
170
|
* `acked` branch), `stop()`, or a transport switch to long-poll
|
|
172
|
-
* (`enterLongPoll`) — and only
|
|
171
|
+
* (`enterLongPoll`) — and only repopulated by a fresh advertisement from
|
|
172
|
+
* the transport that is still current.
|
|
173
173
|
* The previous version of this doc comment claimed long-poll mode simply
|
|
174
174
|
* "stays at whatever the last real WS `conn.ack` said" — that was the bug:
|
|
175
175
|
* a daemon that once learned e.g. `approval_resolved` from an earlier WS
|
|
176
176
|
* session kept believing it applied to whatever it's connected to NOW,
|
|
177
177
|
* even after a disconnect/degrade where nothing has actually confirmed
|
|
178
178
|
* that's still true (a reconnect could land on a DIFFERENT server behind a
|
|
179
|
-
* load balancer
|
|
180
|
-
* handshake at all). Concretely, `TaskRunner.sendApprovalResolved` gates
|
|
179
|
+
* load balancer). Concretely, `TaskRunner.sendApprovalResolved` gates
|
|
181
180
|
* `task.approval_resolved` on this list — sending it to a server that
|
|
182
181
|
* doesn't actually understand it over the long-poll path would get a
|
|
183
182
|
* batch-level 400 from `MessagesSendRequestSchema` (protocol §8.2), which
|
|
@@ -242,13 +241,10 @@ export declare class ConnectionManager {
|
|
|
242
241
|
private drainRetryDelay;
|
|
243
242
|
isTransportDegraded(): boolean;
|
|
244
243
|
/**
|
|
245
|
-
* The capabilities the
|
|
246
|
-
* `conn.ack`
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
* first handshake completes, AND (finding R2) once again empty after any
|
|
250
|
-
* disconnect/degrade — see `serverCapabilities`'s own doc comment for why
|
|
251
|
-
* this is strictly per-connection rather than "sticky" across one.
|
|
244
|
+
* The capabilities the CURRENT transport's server advertised: from
|
|
245
|
+
* `conn.ack` on WS, or the latest successful `GET /byok/events` response
|
|
246
|
+
* on long-poll. Empty before either transport has supplied its current
|
|
247
|
+
* advertisement, and cleared across disconnect/switch boundaries.
|
|
252
248
|
*/
|
|
253
249
|
getServerCapabilities(): readonly string[];
|
|
254
250
|
isConnected(): boolean;
|
|
@@ -5,6 +5,12 @@ export interface LongPollClientOptions {
|
|
|
5
5
|
auth: AuthManager;
|
|
6
6
|
getCursor: () => number | undefined;
|
|
7
7
|
onEnvelope: (envelope: Envelope) => void;
|
|
8
|
+
/**
|
|
9
|
+
* Capabilities advertised by the server that produced the current poll
|
|
10
|
+
* response. Called before any envelopes from that response are delivered.
|
|
11
|
+
* An older responder omitting the additive field is reported as `[]`.
|
|
12
|
+
*/
|
|
13
|
+
onServerCapabilities?: (capabilities: string[]) => void;
|
|
8
14
|
/** Called once the device is found to be revoked (401 surfaced through {@link AuthManager}) — the loop stops itself rather than retrying. */
|
|
9
15
|
onRevoked?: () => void;
|
|
10
16
|
/**
|
|
@@ -264,9 +264,10 @@ export interface TaskRunnerDeps {
|
|
|
264
264
|
*/
|
|
265
265
|
maxTaskOutputBytes?: number;
|
|
266
266
|
/**
|
|
267
|
-
* M4 (additive-minor, `task.approval_resolved`): the
|
|
268
|
-
* `conn.ack
|
|
269
|
-
*
|
|
267
|
+
* M4 (additive-minor, `task.approval_resolved`): the capabilities advertised
|
|
268
|
+
* by the CURRENT transport's server (`conn.ack` on WS, the latest successful
|
|
269
|
+
* events response on long-poll) — read fresh at call time (mirrors
|
|
270
|
+
* `getCursor`/`getToken`'s own
|
|
270
271
|
* "read fresh, not captured once" convention elsewhere in this codebase),
|
|
271
272
|
* since the capability is learned asynchronously, after this `TaskRunner`
|
|
272
273
|
* is already constructed (`create-daemon.ts`'s `start()` builds `deps`
|
|
@@ -935,9 +936,9 @@ export declare class TaskRunner {
|
|
|
935
936
|
/**
|
|
936
937
|
* Whether the CURRENTLY connected server advertised `result-document` —
|
|
937
938
|
* read fresh on every call, never captured, because the answer changes
|
|
938
|
-
* across a reconnect (`ConnectionManager
|
|
939
|
-
*
|
|
940
|
-
*
|
|
939
|
+
* across a reconnect or transport switch (`ConnectionManager` clears the
|
|
940
|
+
* old advertisement at the boundary, then repopulates it from a fresh WS
|
|
941
|
+
* ack or successful poll response). An absent `getServerCapabilities` seam is
|
|
941
942
|
* "no capabilities", the fail-closed reading.
|
|
942
943
|
*/
|
|
943
944
|
private hasResultDocumentCapability;
|