@sayknow-cli/bridge-client 0.3.16 → 0.4.1

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/src/index.ts CHANGED
@@ -1,521 +1 @@
1
- import type { BridgeClientCommand, BridgeCommandHelpers, BridgeCommandOptions } from "./commands";
2
- import type { BridgeFrame } from "./reference-consumer";
3
-
4
- export * from "./commands";
5
- export * from "./reference-consumer";
6
- export * from "./workflow-gate";
7
-
8
- import type { UnattendedDeclaration, WorkflowGate, WorkflowGateResolver } from "./workflow-gate";
9
- import { isWorkflowGateFrame } from "./workflow-gate";
10
- export type BridgeCapability =
11
- | "events"
12
- | "prompt"
13
- | "permission"
14
- | "elicitation"
15
- | "ui.declarative"
16
- | "ui.editor"
17
- | "ui.terminal_input"
18
- | "host_tools"
19
- | "host_uri"
20
- | "client_bridge.read_text_file"
21
- | "client_bridge.write_text_file"
22
- | "client_bridge.create_terminal"
23
- | "workflow_gate";
24
-
25
- export type BridgeCommandScope =
26
- | "prompt"
27
- | "control"
28
- | "bash"
29
- | "export"
30
- | "session"
31
- | "model"
32
- | "message:read"
33
- | "host_tools"
34
- | "host_uri"
35
- | "admin";
36
-
37
- export interface BridgeProtocolRange {
38
- min: number;
39
- max: number;
40
- }
41
-
42
- export interface BridgeHandshakeRequest {
43
- protocol_version_range: BridgeProtocolRange;
44
- capabilities: BridgeCapability[];
45
- requested_scopes: BridgeCommandScope[];
46
- last_seq?: number;
47
- unattended?: UnattendedDeclaration;
48
- }
49
-
50
- export interface BridgeHandshakeAccepted {
51
- status: "accepted";
52
- protocol_version: number;
53
- session_id: string;
54
- accepted_capabilities: BridgeCapability[];
55
- accepted_scopes: BridgeCommandScope[];
56
- unsupported: BridgeCapability[];
57
- endpoints: {
58
- events: string;
59
- commands: string;
60
- uiResponses: string;
61
- claimControl: string;
62
- hostToolResults: string;
63
- disconnectControl: string;
64
- hostUriResults: string;
65
- };
66
- frame_types: string[];
67
- accepted_unattended?: UnattendedDeclaration;
68
- }
69
-
70
- export interface BridgeHandshakeRejected {
71
- status: "rejected";
72
- reason: "incompatible_version" | "unauthorized" | "invalid_request";
73
- message: string;
74
- }
75
-
76
- export type BridgeFetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
77
- export type BridgeHandshakeResponse = BridgeHandshakeAccepted | BridgeHandshakeRejected;
78
- function parseSseData(buffer: string): { frames: BridgeFrame[]; rest: string } {
79
- const frames: BridgeFrame[] = [];
80
- let rest = buffer.replaceAll("\r\n", "\n");
81
- let boundary = rest.indexOf("\n\n");
82
- while (boundary >= 0) {
83
- const block = rest.slice(0, boundary);
84
- rest = rest.slice(boundary + 2);
85
- for (const line of block.split("\n")) {
86
- if (!line.startsWith("data: ")) continue;
87
- frames.push(JSON.parse(line.slice(6)) as BridgeFrame);
88
- }
89
- boundary = rest.indexOf("\n\n");
90
- }
91
- return { frames, rest };
92
- }
93
-
94
- export interface BridgeClientOptions {
95
- baseUrl: string;
96
- token: string;
97
- fetch?: BridgeFetch;
98
- allowInsecureLocalhost?: boolean;
99
- }
100
-
101
- function isLocalhostUrl(url: URL): boolean {
102
- return url.protocol === "http:" && ["localhost", "127.0.0.1", "[::1]"].includes(url.hostname);
103
- }
104
-
105
- export class BridgeClient implements BridgeCommandHelpers {
106
- readonly #baseUrl: URL;
107
- readonly #token: string;
108
- readonly #fetch: BridgeFetch;
109
-
110
- constructor(options: BridgeClientOptions) {
111
- this.#baseUrl = new URL(options.baseUrl);
112
- if (this.#baseUrl.protocol !== "https:" && !isLocalhostUrl(this.#baseUrl)) {
113
- throw new Error("BridgeClient refuses bearer tokens over non-HTTPS bridge URLs");
114
- }
115
- if (isLocalhostUrl(this.#baseUrl) && !options.allowInsecureLocalhost) {
116
- throw new Error(
117
- "BridgeClient refuses bearer tokens over HTTP localhost unless allowInsecureLocalhost is true",
118
- );
119
- }
120
- this.#token = options.token;
121
- this.#fetch = options.fetch ?? fetch;
122
- }
123
-
124
- async handshake(request: BridgeHandshakeRequest): Promise<BridgeHandshakeResponse> {
125
- return this.#json<BridgeHandshakeResponse>("/v1/handshake", {
126
- method: "POST",
127
- body: JSON.stringify(request),
128
- headers: { "Content-Type": "application/json" },
129
- });
130
- }
131
-
132
- async command(command: BridgeClientCommand, sessionId: string, idempotencyKey: string): Promise<unknown> {
133
- return this.#json(`/v1/sessions/${encodeURIComponent(sessionId)}/commands`, {
134
- method: "POST",
135
- body: JSON.stringify(command),
136
- headers: {
137
- "Content-Type": "application/json",
138
- "Idempotency-Key": idempotencyKey,
139
- },
140
- });
141
- }
142
-
143
- #command(
144
- type: BridgeClientCommand["type"],
145
- sessionId: string,
146
- fields: Record<string, unknown> = {},
147
- options: BridgeCommandOptions = {},
148
- prefix: string = type,
149
- ): Promise<unknown> {
150
- return this.command(
151
- { id: options.id, type, ...fields },
152
- sessionId,
153
- options.idempotencyKey ?? this.createIdempotencyKey(prefix),
154
- );
155
- }
156
-
157
- prompt(
158
- sessionId: string,
159
- message: string,
160
- options: {
161
- id?: string;
162
- images?: unknown[];
163
- streamingBehavior?: "steer" | "followUp";
164
- idempotencyKey?: string;
165
- } = {},
166
- ): Promise<unknown> {
167
- return this.command(
168
- {
169
- id: options.id,
170
- type: "prompt",
171
- message,
172
- images: options.images,
173
- streamingBehavior: options.streamingBehavior,
174
- },
175
- sessionId,
176
- options.idempotencyKey ?? this.createIdempotencyKey("prompt"),
177
- );
178
- }
179
-
180
- steer(
181
- sessionId: string,
182
- message: string,
183
- options: { id?: string; images?: unknown[]; idempotencyKey?: string } = {},
184
- ): Promise<unknown> {
185
- return this.command(
186
- { id: options.id, type: "steer", message, images: options.images },
187
- sessionId,
188
- options.idempotencyKey ?? this.createIdempotencyKey("steer"),
189
- );
190
- }
191
-
192
- followUp(
193
- sessionId: string,
194
- message: string,
195
- options: { id?: string; images?: unknown[]; idempotencyKey?: string } = {},
196
- ): Promise<unknown> {
197
- return this.command(
198
- { id: options.id, type: "follow_up", message, images: options.images },
199
- sessionId,
200
- options.idempotencyKey ?? this.createIdempotencyKey("follow-up"),
201
- );
202
- }
203
-
204
- bash(sessionId: string, command: string, options: { id?: string; idempotencyKey?: string } = {}): Promise<unknown> {
205
- return this.command(
206
- { id: options.id, type: "bash", command },
207
- sessionId,
208
- options.idempotencyKey ?? this.createIdempotencyKey("bash"),
209
- );
210
- }
211
-
212
- getState(sessionId: string, options: { id?: string; idempotencyKey?: string } = {}): Promise<unknown> {
213
- return this.command(
214
- { id: options.id, type: "get_state" },
215
- sessionId,
216
- options.idempotencyKey ?? this.createIdempotencyKey("get-state"),
217
- );
218
- }
219
-
220
- getMessages(sessionId: string, options: { id?: string; idempotencyKey?: string } = {}): Promise<unknown> {
221
- return this.command(
222
- { id: options.id, type: "get_messages" },
223
- sessionId,
224
- options.idempotencyKey ?? this.createIdempotencyKey("get-messages"),
225
- );
226
- }
227
-
228
- abort(sessionId: string, options: BridgeCommandOptions = {}): Promise<unknown> {
229
- return this.#command("abort", sessionId, {}, options);
230
- }
231
-
232
- abortAndPrompt(
233
- sessionId: string,
234
- message: string,
235
- options: { id?: string; images?: unknown[]; idempotencyKey?: string } = {},
236
- ): Promise<unknown> {
237
- return this.#command(
238
- "abort_and_prompt",
239
- sessionId,
240
- { message, images: options.images },
241
- options,
242
- "abort-and-prompt",
243
- );
244
- }
245
-
246
- newSession(sessionId: string, options: BridgeCommandOptions & { parentSession?: string } = {}): Promise<unknown> {
247
- return this.#command("new_session", sessionId, { parentSession: options.parentSession }, options, "new-session");
248
- }
249
-
250
- setTodos(sessionId: string, phases: unknown[], options: BridgeCommandOptions = {}): Promise<unknown> {
251
- return this.#command("set_todos", sessionId, { phases }, options, "set-todos");
252
- }
253
-
254
- setHostTools(sessionId: string, tools: unknown[], options: BridgeCommandOptions = {}): Promise<unknown> {
255
- return this.#command("set_host_tools", sessionId, { tools }, options, "set-host-tools");
256
- }
257
-
258
- setHostUriSchemes(sessionId: string, schemes: unknown[], options: BridgeCommandOptions = {}): Promise<unknown> {
259
- return this.#command("set_host_uri_schemes", sessionId, { schemes }, options, "set-host-uri-schemes");
260
- }
261
-
262
- getPendingWorkflowGates(sessionId: string, options: BridgeCommandOptions = {}): Promise<unknown> {
263
- return this.#command("get_pending_workflow_gates", sessionId, {}, options, "get-pending-workflow-gates");
264
- }
265
-
266
- setModel(
267
- sessionId: string,
268
- provider: string,
269
- modelId: string,
270
- options: BridgeCommandOptions = {},
271
- ): Promise<unknown> {
272
- return this.#command("set_model", sessionId, { provider, modelId }, options, "set-model");
273
- }
274
-
275
- cycleModel(sessionId: string, options: BridgeCommandOptions = {}): Promise<unknown> {
276
- return this.#command("cycle_model", sessionId, {}, options, "cycle-model");
277
- }
278
-
279
- getAvailableModels(sessionId: string, options: BridgeCommandOptions = {}): Promise<unknown> {
280
- return this.#command("get_available_models", sessionId, {}, options, "get-available-models");
281
- }
282
-
283
- setThinkingLevel(sessionId: string, level: string, options: BridgeCommandOptions = {}): Promise<unknown> {
284
- return this.#command("set_thinking_level", sessionId, { level }, options, "set-thinking-level");
285
- }
286
-
287
- cycleThinkingLevel(sessionId: string, options: BridgeCommandOptions = {}): Promise<unknown> {
288
- return this.#command("cycle_thinking_level", sessionId, {}, options, "cycle-thinking-level");
289
- }
290
-
291
- setSteeringMode(
292
- sessionId: string,
293
- mode: "all" | "one-at-a-time",
294
- options: BridgeCommandOptions = {},
295
- ): Promise<unknown> {
296
- return this.#command("set_steering_mode", sessionId, { mode }, options, "set-steering-mode");
297
- }
298
-
299
- setFollowUpMode(
300
- sessionId: string,
301
- mode: "all" | "one-at-a-time",
302
- options: BridgeCommandOptions = {},
303
- ): Promise<unknown> {
304
- return this.#command("set_follow_up_mode", sessionId, { mode }, options, "set-follow-up-mode");
305
- }
306
-
307
- setInterruptMode(
308
- sessionId: string,
309
- mode: "immediate" | "wait",
310
- options: BridgeCommandOptions = {},
311
- ): Promise<unknown> {
312
- return this.#command("set_interrupt_mode", sessionId, { mode }, options, "set-interrupt-mode");
313
- }
314
-
315
- compact(sessionId: string, options: BridgeCommandOptions & { customInstructions?: string } = {}): Promise<unknown> {
316
- return this.#command("compact", sessionId, { customInstructions: options.customInstructions }, options);
317
- }
318
-
319
- setAutoCompaction(sessionId: string, enabled: boolean, options: BridgeCommandOptions = {}): Promise<unknown> {
320
- return this.#command("set_auto_compaction", sessionId, { enabled }, options, "set-auto-compaction");
321
- }
322
-
323
- setAutoRetry(sessionId: string, enabled: boolean, options: BridgeCommandOptions = {}): Promise<unknown> {
324
- return this.#command("set_auto_retry", sessionId, { enabled }, options, "set-auto-retry");
325
- }
326
-
327
- abortRetry(sessionId: string, options: BridgeCommandOptions = {}): Promise<unknown> {
328
- return this.#command("abort_retry", sessionId, {}, options, "abort-retry");
329
- }
330
-
331
- abortBash(sessionId: string, options: BridgeCommandOptions = {}): Promise<unknown> {
332
- return this.#command("abort_bash", sessionId, {}, options, "abort-bash");
333
- }
334
-
335
- getSessionStats(sessionId: string, options: BridgeCommandOptions = {}): Promise<unknown> {
336
- return this.#command("get_session_stats", sessionId, {}, options, "get-session-stats");
337
- }
338
-
339
- exportHtml(sessionId: string, options: BridgeCommandOptions & { outputPath?: string } = {}): Promise<unknown> {
340
- return this.#command("export_html", sessionId, { outputPath: options.outputPath }, options, "export-html");
341
- }
342
-
343
- switchSession(sessionId: string, sessionPath: string, options: BridgeCommandOptions = {}): Promise<unknown> {
344
- return this.#command("switch_session", sessionId, { sessionPath }, options, "switch-session");
345
- }
346
-
347
- branch(sessionId: string, entryId: string, options: BridgeCommandOptions = {}): Promise<unknown> {
348
- return this.#command("branch", sessionId, { entryId }, options);
349
- }
350
-
351
- getBranchMessages(sessionId: string, options: BridgeCommandOptions = {}): Promise<unknown> {
352
- return this.#command("get_branch_messages", sessionId, {}, options, "get-branch-messages");
353
- }
354
-
355
- getLastAssistantText(sessionId: string, options: BridgeCommandOptions = {}): Promise<unknown> {
356
- return this.#command("get_last_assistant_text", sessionId, {}, options, "get-last-assistant-text");
357
- }
358
-
359
- setSessionName(sessionId: string, name: string, options: BridgeCommandOptions = {}): Promise<unknown> {
360
- return this.#command("set_session_name", sessionId, { name }, options, "set-session-name");
361
- }
362
-
363
- handoff(sessionId: string, options: BridgeCommandOptions & { customInstructions?: string } = {}): Promise<unknown> {
364
- return this.#command("handoff", sessionId, { customInstructions: options.customInstructions }, options);
365
- }
366
-
367
- getLoginProviders(sessionId: string, options: BridgeCommandOptions = {}): Promise<unknown> {
368
- return this.#command("get_login_providers", sessionId, {}, options, "get-login-providers");
369
- }
370
-
371
- login(sessionId: string, providerId: string, options: BridgeCommandOptions = {}): Promise<unknown> {
372
- return this.#command("login", sessionId, { providerId }, options);
373
- }
374
-
375
- createIdempotencyKey(prefix = "cmd"): string {
376
- return `${prefix}-${crypto.randomUUID()}`;
377
- }
378
-
379
- async *events(sessionId: string, lastSeq?: number): AsyncGenerator<BridgeFrame> {
380
- const response = await this.connectEvents(sessionId, lastSeq);
381
- if (!response.ok) throw new Error(`Bridge event stream failed: ${response.status}`);
382
- const reader = response.body?.getReader();
383
- if (!reader) throw new Error("Bridge event stream response had no body");
384
- const decoder = new TextDecoder();
385
- let buffered = "";
386
- try {
387
- while (true) {
388
- const chunk = await reader.read();
389
- if (chunk.done) break;
390
- buffered += decoder.decode(chunk.value, { stream: true });
391
- const parsed = parseSseData(buffered);
392
- buffered = parsed.rest;
393
- for (const frame of parsed.frames) yield frame;
394
- }
395
- buffered += decoder.decode();
396
- const parsed = parseSseData(buffered);
397
- for (const frame of parsed.frames) yield frame;
398
- } finally {
399
- await reader.cancel().catch(() => undefined);
400
- reader.releaseLock();
401
- }
402
- }
403
- claimControl(sessionId: string, ownerToken?: string): Promise<unknown> {
404
- return this.#json(`/v1/sessions/${encodeURIComponent(sessionId)}/control:claim`, {
405
- method: "POST",
406
- headers: ownerToken ? { "X-SKC-Bridge-Owner-Token": ownerToken } : undefined,
407
- });
408
- }
409
- disconnectControl(sessionId: string, ownerToken: string): Promise<unknown> {
410
- return this.#json(`/v1/sessions/${encodeURIComponent(sessionId)}/control:disconnect`, {
411
- method: "POST",
412
- headers: { "X-SKC-Bridge-Owner-Token": ownerToken },
413
- });
414
- }
415
-
416
- respondToUiRequest(
417
- sessionId: string,
418
- correlationId: string,
419
- ownerToken: string,
420
- response: unknown,
421
- idempotencyKey?: string,
422
- ): Promise<unknown> {
423
- return this.#json(
424
- `/v1/sessions/${encodeURIComponent(sessionId)}/ui-responses/${encodeURIComponent(correlationId)}`,
425
- {
426
- method: "POST",
427
- body: JSON.stringify(response),
428
- headers: {
429
- "Content-Type": "application/json",
430
- "X-SKC-Bridge-Owner-Token": ownerToken,
431
- ...(idempotencyKey ? { "Idempotency-Key": idempotencyKey } : {}),
432
- },
433
- },
434
- );
435
- }
436
-
437
- /**
438
- * Answer a `workflow_gate` by posting to the UI-response endpoint and return
439
- * the gate resolution envelope. Authorization is bearer auth plus the
440
- * `control` scope; `ownerToken` is carried for idempotency/controller
441
- * correlation, not as the gate authorization boundary.
442
- */
443
- respondGate(
444
- sessionId: string,
445
- gateId: string,
446
- ownerToken: string,
447
- answer: unknown,
448
- options: { idempotencyKey?: string; id?: string } = {},
449
- ): Promise<unknown> {
450
- return this.#json(`/v1/sessions/${encodeURIComponent(sessionId)}/ui-responses/${encodeURIComponent(gateId)}`, {
451
- method: "POST",
452
- body: JSON.stringify({ gate_id: gateId, answer, idempotency_key: options.idempotencyKey }),
453
- headers: {
454
- "Content-Type": "application/json",
455
- "X-SKC-Bridge-Owner-Token": ownerToken,
456
- ...(options.idempotencyKey ? { "Idempotency-Key": options.idempotencyKey } : {}),
457
- },
458
- });
459
- }
460
-
461
- /**
462
- * Headless policy: stream the session's frames, route every received
463
- * `workflow_gate` to the agent `resolver`, and post its answer back. Yields
464
- * each handled gate. The resolver supplies the agent's memory-backed answer.
465
- */
466
- async *consumeWorkflowGates(
467
- sessionId: string,
468
- ownerToken: string,
469
- resolver: WorkflowGateResolver,
470
- options: { lastSeq?: number } = {},
471
- ): AsyncGenerator<{ gate: WorkflowGate; answer: unknown }> {
472
- for await (const frame of this.events(sessionId, options.lastSeq)) {
473
- if (!isWorkflowGateFrame(frame)) continue;
474
- const gate = frame.payload as WorkflowGate;
475
- const answer = await resolver(gate);
476
- await this.respondGate(sessionId, gate.gate_id, ownerToken, answer);
477
- yield { gate, answer };
478
- }
479
- }
480
-
481
- respondToHostTool(sessionId: string, correlationId: string, result: unknown): Promise<unknown> {
482
- return this.#json(
483
- `/v1/sessions/${encodeURIComponent(sessionId)}/host-tool-results/${encodeURIComponent(correlationId)}`,
484
- {
485
- method: "POST",
486
- body: JSON.stringify(result),
487
- headers: { "Content-Type": "application/json" },
488
- },
489
- );
490
- }
491
-
492
- respondToHostUri(sessionId: string, correlationId: string, result: unknown): Promise<unknown> {
493
- return this.#json(
494
- `/v1/sessions/${encodeURIComponent(sessionId)}/host-uri-results/${encodeURIComponent(correlationId)}`,
495
- {
496
- method: "POST",
497
- body: JSON.stringify(result),
498
- headers: { "Content-Type": "application/json" },
499
- },
500
- );
501
- }
502
- connectEvents(sessionId: string, lastSeq?: number): Promise<Response> {
503
- const path = `/v1/sessions/${encodeURIComponent(sessionId)}/events${lastSeq === undefined ? "" : `?last_seq=${lastSeq}`}`;
504
- return this.#request(path, { method: "GET" });
505
- }
506
-
507
- #request(pathname: string, init: RequestInit): Promise<Response> {
508
- const url = new URL(pathname, this.#baseUrl);
509
- const headers = new Headers(init.headers);
510
- headers.set("Authorization", `Bearer ${this.#token}`);
511
- return this.#fetch(url, { ...init, headers });
512
- }
513
-
514
- async #json<T>(pathname: string, init: RequestInit): Promise<T> {
515
- const response = await this.#request(pathname, init);
516
- if (!response.ok) {
517
- throw new Error(`Bridge request failed: ${response.status}`);
518
- }
519
- return (await response.json()) as T;
520
- }
521
- }
1
+ export * from "./client";
@@ -1,62 +0,0 @@
1
- export declare const BRIDGE_CLIENT_COMMAND_TYPES: readonly ["prompt", "steer", "follow_up", "abort", "abort_and_prompt", "new_session", "get_state", "set_todos", "set_host_tools", "set_host_uri_schemes", "get_pending_workflow_gates", "set_capabilities", "workflow_gate_response", "set_model", "set_default_model_selection", "cycle_model", "get_available_models", "set_thinking_level", "cycle_thinking_level", "set_steering_mode", "set_follow_up_mode", "set_interrupt_mode", "compact", "set_auto_compaction", "set_auto_retry", "abort_retry", "bash", "abort_bash", "get_session_stats", "export_html", "switch_session", "branch", "get_branch_messages", "get_last_assistant_text", "set_session_name", "handoff", "get_messages", "get_login_providers", "login", "negotiate_unattended"];
2
- export type BridgeClientCommandType = (typeof BRIDGE_CLIENT_COMMAND_TYPES)[number];
3
- export type BridgeClientCommand<TType extends BridgeClientCommandType = BridgeClientCommandType> = {
4
- id?: string;
5
- type: TType;
6
- } & Record<string, unknown>;
7
- export interface BridgeCommandOptions {
8
- id?: string;
9
- idempotencyKey?: string;
10
- }
11
- export interface BridgeImageCommandOptions extends BridgeCommandOptions {
12
- images?: unknown[];
13
- }
14
- export interface BridgeCommandHelpers {
15
- prompt(sessionId: string, message: string, options?: BridgeImageCommandOptions & {
16
- streamingBehavior?: "steer" | "followUp";
17
- }): Promise<unknown>;
18
- steer(sessionId: string, message: string, options?: BridgeImageCommandOptions): Promise<unknown>;
19
- followUp(sessionId: string, message: string, options?: BridgeImageCommandOptions): Promise<unknown>;
20
- abort(sessionId: string, options?: BridgeCommandOptions): Promise<unknown>;
21
- abortAndPrompt(sessionId: string, message: string, options?: BridgeImageCommandOptions): Promise<unknown>;
22
- newSession(sessionId: string, options?: BridgeCommandOptions & {
23
- parentSession?: string;
24
- }): Promise<unknown>;
25
- getState(sessionId: string, options?: BridgeCommandOptions): Promise<unknown>;
26
- setTodos(sessionId: string, phases: unknown[], options?: BridgeCommandOptions): Promise<unknown>;
27
- setHostTools(sessionId: string, tools: unknown[], options?: BridgeCommandOptions): Promise<unknown>;
28
- setHostUriSchemes(sessionId: string, schemes: unknown[], options?: BridgeCommandOptions): Promise<unknown>;
29
- getPendingWorkflowGates(sessionId: string, options?: BridgeCommandOptions): Promise<unknown>;
30
- setModel(sessionId: string, provider: string, modelId: string, options?: BridgeCommandOptions): Promise<unknown>;
31
- cycleModel(sessionId: string, options?: BridgeCommandOptions): Promise<unknown>;
32
- getAvailableModels(sessionId: string, options?: BridgeCommandOptions): Promise<unknown>;
33
- setThinkingLevel(sessionId: string, level: string, options?: BridgeCommandOptions): Promise<unknown>;
34
- cycleThinkingLevel(sessionId: string, options?: BridgeCommandOptions): Promise<unknown>;
35
- setSteeringMode(sessionId: string, mode: "all" | "one-at-a-time", options?: BridgeCommandOptions): Promise<unknown>;
36
- setFollowUpMode(sessionId: string, mode: "all" | "one-at-a-time", options?: BridgeCommandOptions): Promise<unknown>;
37
- setInterruptMode(sessionId: string, mode: "immediate" | "wait", options?: BridgeCommandOptions): Promise<unknown>;
38
- compact(sessionId: string, options?: BridgeCommandOptions & {
39
- customInstructions?: string;
40
- }): Promise<unknown>;
41
- setAutoCompaction(sessionId: string, enabled: boolean, options?: BridgeCommandOptions): Promise<unknown>;
42
- setAutoRetry(sessionId: string, enabled: boolean, options?: BridgeCommandOptions): Promise<unknown>;
43
- abortRetry(sessionId: string, options?: BridgeCommandOptions): Promise<unknown>;
44
- bash(sessionId: string, command: string, options?: BridgeCommandOptions): Promise<unknown>;
45
- abortBash(sessionId: string, options?: BridgeCommandOptions): Promise<unknown>;
46
- getSessionStats(sessionId: string, options?: BridgeCommandOptions): Promise<unknown>;
47
- exportHtml(sessionId: string, options?: BridgeCommandOptions & {
48
- outputPath?: string;
49
- }): Promise<unknown>;
50
- switchSession(sessionId: string, sessionPath: string, options?: BridgeCommandOptions): Promise<unknown>;
51
- branch(sessionId: string, entryId: string, options?: BridgeCommandOptions): Promise<unknown>;
52
- getBranchMessages(sessionId: string, options?: BridgeCommandOptions): Promise<unknown>;
53
- getLastAssistantText(sessionId: string, options?: BridgeCommandOptions): Promise<unknown>;
54
- setSessionName(sessionId: string, name: string, options?: BridgeCommandOptions): Promise<unknown>;
55
- handoff(sessionId: string, options?: BridgeCommandOptions & {
56
- customInstructions?: string;
57
- }): Promise<unknown>;
58
- getMessages(sessionId: string, options?: BridgeCommandOptions): Promise<unknown>;
59
- getLoginProviders(sessionId: string, options?: BridgeCommandOptions): Promise<unknown>;
60
- login(sessionId: string, providerId: string, options?: BridgeCommandOptions): Promise<unknown>;
61
- respondGate(sessionId: string, gateId: string, ownerToken: string, answer: unknown, options?: BridgeCommandOptions): Promise<unknown>;
62
- }