@linkshell/wire 0.1.2 → 0.2.0

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.
@@ -0,0 +1,22 @@
1
+ /** The data channel both sides use. */
2
+ export declare const DIRECT_LABEL = "linkshell-bulk";
3
+ /** The most stream bytes in one message: every WebRTC stack takes this size. */
4
+ export declare const DIRECT_CHUNK: number;
5
+ /**
6
+ * STUN servers used when a host names none: they only tell each side its
7
+ * public address. (Several, because none of them is reachable everywhere.)
8
+ */
9
+ export declare const DEFAULT_ICE_SERVERS: string[];
10
+ export type DirectFrame = {
11
+ type: "data";
12
+ stream: number;
13
+ data: Uint8Array;
14
+ }
15
+ /** The sender's end of the stream is finished (`error`: why, when it broke). */
16
+ | {
17
+ type: "close";
18
+ stream: number;
19
+ error?: string;
20
+ };
21
+ export declare function encodeDirectFrame(frame: DirectFrame): Uint8Array;
22
+ export declare function decodeDirectFrame(bytes: Uint8Array): DirectFrame | undefined;
package/dist/direct.js ADDED
@@ -0,0 +1,37 @@
1
+ // The direct channel: bulk streams (the screen, port previews) go from the
2
+ // computer to the device peer to peer, over a WebRTC data channel, instead of
3
+ // through the gateway. The offer and answer travel over the end-to-end
4
+ // encrypted RPC channel, so the gateway can neither read them nor stand in for
5
+ // either side; it carries only what little sets the connection up. When no
6
+ // direct path can be made, the streams stay on the RPC channel as before.
7
+ /** The data channel both sides use. */
8
+ export const DIRECT_LABEL = "linkshell-bulk";
9
+ /** The most stream bytes in one message: every WebRTC stack takes this size. */
10
+ export const DIRECT_CHUNK = 16 * 1024;
11
+ /**
12
+ * STUN servers used when a host names none: they only tell each side its
13
+ * public address. (Several, because none of them is reachable everywhere.)
14
+ */
15
+ export const DEFAULT_ICE_SERVERS = ["stun:stun.cloudflare.com:3478", "stun:stun.chat.bilibili.com:3478", "stun:stun.l.google.com:19302"];
16
+ const DATA = 1;
17
+ const CLOSE = 2;
18
+ export function encodeDirectFrame(frame) {
19
+ const payload = frame.type === "data" ? frame.data : new TextEncoder().encode(frame.error ?? "");
20
+ const bytes = new Uint8Array(5 + payload.length);
21
+ bytes[0] = frame.type === "data" ? DATA : CLOSE;
22
+ new DataView(bytes.buffer).setUint32(1, frame.stream);
23
+ bytes.set(payload, 5);
24
+ return bytes;
25
+ }
26
+ export function decodeDirectFrame(bytes) {
27
+ if (bytes.length < 5)
28
+ return undefined;
29
+ const stream = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getUint32(1);
30
+ const payload = bytes.subarray(5);
31
+ if (bytes[0] === DATA)
32
+ return { type: "data", stream, data: payload };
33
+ if (bytes[0] === CLOSE)
34
+ return { type: "close", stream, error: payload.length ? new TextDecoder().decode(payload) : undefined };
35
+ return undefined;
36
+ }
37
+ //# sourceMappingURL=direct.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"direct.js","sourceRoot":"","sources":["../src/direct.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,8EAA8E;AAC9E,uEAAuE;AACvE,+EAA+E;AAC/E,2EAA2E;AAC3E,0EAA0E;AAE1E,uCAAuC;AACvC,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAE7C,gFAAgF;AAChF,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,GAAG,IAAI,CAAC;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,+BAA+B,EAAE,kCAAkC,EAAE,8BAA8B,CAAC,CAAC;AAOzI,MAAM,IAAI,GAAG,CAAC,CAAC;AACf,MAAM,KAAK,GAAG,CAAC,CAAC;AAEhB,MAAM,UAAU,iBAAiB,CAAC,KAAkB;IAClD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IACjG,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IAChD,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtD,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;IACtB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAiB;IACjD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IACvC,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC3F,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI;QAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IACtE,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,KAAK;QAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IAChI,OAAO,SAAS,CAAC;AACnB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -6,3 +6,4 @@ export * from "./shell.js";
6
6
  export * from "./crypto.js";
7
7
  export * from "./relay.js";
8
8
  export * from "./relay-client.js";
9
+ export * from "./direct.js";
package/dist/index.js CHANGED
@@ -6,4 +6,5 @@ export * from "./shell.js";
6
6
  export * from "./crypto.js";
7
7
  export * from "./relay.js";
8
8
  export * from "./relay-client.js";
9
+ export * from "./direct.js";
9
10
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC"}
package/dist/model.d.ts CHANGED
@@ -17,6 +17,12 @@ export declare const agentCapabilitiesSchema: z.ZodObject<{
17
17
  steer: z.ZodBoolean;
18
18
  permissions: z.ZodBoolean;
19
19
  images: z.ZodBoolean;
20
+ /**
21
+ * The agent forks sessions itself, keeping everything it knew. Every agent's
22
+ * sessions can be forked: without this (or from a single reply, where the
23
+ * agent only forks whole sessions) LinkShell makes the fork — the new session
24
+ * shows the conversation and its agent is told it as text.
25
+ */
20
26
  fork: z.ZodBoolean;
21
27
  models: z.ZodBoolean;
22
28
  modes: z.ZodBoolean;
@@ -88,6 +94,12 @@ export declare const agentInfoSchema: z.ZodObject<{
88
94
  steer: z.ZodBoolean;
89
95
  permissions: z.ZodBoolean;
90
96
  images: z.ZodBoolean;
97
+ /**
98
+ * The agent forks sessions itself, keeping everything it knew. Every agent's
99
+ * sessions can be forked: without this (or from a single reply, where the
100
+ * agent only forks whole sessions) LinkShell makes the fork — the new session
101
+ * shows the conversation and its agent is told it as text.
102
+ */
91
103
  fork: z.ZodBoolean;
92
104
  models: z.ZodBoolean;
93
105
  modes: z.ZodBoolean;
@@ -192,6 +204,80 @@ export declare const sessionActivitySchema: z.ZodObject<{
192
204
  }>;
193
205
  export type SessionActivity = z.infer<typeof sessionActivitySchema>;
194
206
  /** The oldest unanswered permission request, so lists can offer approval inline. Live only. */
207
+ /**
208
+ * Something the agent asks the user rather than asks permission for: a choice
209
+ * among options, several of them, or something to type (Claude's
210
+ * AskUserQuestion, Codex's request_user_input, an MCP server's form).
211
+ */
212
+ export declare const questionSchema: z.ZodObject<{
213
+ id: z.ZodString;
214
+ /** A short label for the question ("Auth method"). */
215
+ header: z.ZodOptional<z.ZodString>;
216
+ text: z.ZodString;
217
+ /** `choice`: one of `options`; `choices`: any number of them; `text`: typed. */
218
+ kind: z.ZodEnum<["choice", "choices", "text"]>;
219
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
220
+ value: z.ZodString;
221
+ label: z.ZodString;
222
+ description: z.ZodOptional<z.ZodString>;
223
+ }, "strip", z.ZodTypeAny, {
224
+ value: string;
225
+ label: string;
226
+ description?: string | undefined;
227
+ }, {
228
+ value: string;
229
+ label: string;
230
+ description?: string | undefined;
231
+ }>, "many">>;
232
+ /** With options: an answer of the user's own can be typed instead of, or beside, a pick. */
233
+ other: z.ZodOptional<z.ZodBoolean>;
234
+ /** What is typed shouldn't be shown (a token). */
235
+ secret: z.ZodOptional<z.ZodBoolean>;
236
+ required: z.ZodOptional<z.ZodBoolean>;
237
+ }, "strip", z.ZodTypeAny, {
238
+ id: string;
239
+ kind: "text" | "choice" | "choices";
240
+ text: string;
241
+ options?: {
242
+ value: string;
243
+ label: string;
244
+ description?: string | undefined;
245
+ }[] | undefined;
246
+ other?: boolean | undefined;
247
+ header?: string | undefined;
248
+ secret?: boolean | undefined;
249
+ required?: boolean | undefined;
250
+ }, {
251
+ id: string;
252
+ kind: "text" | "choice" | "choices";
253
+ text: string;
254
+ options?: {
255
+ value: string;
256
+ label: string;
257
+ description?: string | undefined;
258
+ }[] | undefined;
259
+ other?: boolean | undefined;
260
+ header?: string | undefined;
261
+ secret?: boolean | undefined;
262
+ required?: boolean | undefined;
263
+ }>;
264
+ export type Question = z.infer<typeof questionSchema>;
265
+ export declare const questionAnswerSchema: z.ZodObject<{
266
+ id: z.ZodString;
267
+ /** The values picked (`choice`: at most one), or what was typed for a `text` question. */
268
+ values: z.ZodArray<z.ZodString, "many">;
269
+ /** The user's own answer beside the options. */
270
+ other: z.ZodOptional<z.ZodString>;
271
+ }, "strip", z.ZodTypeAny, {
272
+ values: string[];
273
+ id: string;
274
+ other?: string | undefined;
275
+ }, {
276
+ values: string[];
277
+ id: string;
278
+ other?: string | undefined;
279
+ }>;
280
+ export type QuestionAnswer = z.infer<typeof questionAnswerSchema>;
195
281
  export declare const pendingPermissionSchema: z.ZodObject<{
196
282
  requestId: z.ZodString;
197
283
  toolCallId: z.ZodOptional<z.ZodString>;
@@ -210,6 +296,59 @@ export declare const pendingPermissionSchema: z.ZodObject<{
210
296
  name: string;
211
297
  kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
212
298
  }>, "many">;
299
+ /** Set when this is a question to answer (`sessions.answer`) rather than a permission to give. */
300
+ questions: z.ZodOptional<z.ZodArray<z.ZodObject<{
301
+ id: z.ZodString;
302
+ /** A short label for the question ("Auth method"). */
303
+ header: z.ZodOptional<z.ZodString>;
304
+ text: z.ZodString;
305
+ /** `choice`: one of `options`; `choices`: any number of them; `text`: typed. */
306
+ kind: z.ZodEnum<["choice", "choices", "text"]>;
307
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
308
+ value: z.ZodString;
309
+ label: z.ZodString;
310
+ description: z.ZodOptional<z.ZodString>;
311
+ }, "strip", z.ZodTypeAny, {
312
+ value: string;
313
+ label: string;
314
+ description?: string | undefined;
315
+ }, {
316
+ value: string;
317
+ label: string;
318
+ description?: string | undefined;
319
+ }>, "many">>;
320
+ /** With options: an answer of the user's own can be typed instead of, or beside, a pick. */
321
+ other: z.ZodOptional<z.ZodBoolean>;
322
+ /** What is typed shouldn't be shown (a token). */
323
+ secret: z.ZodOptional<z.ZodBoolean>;
324
+ required: z.ZodOptional<z.ZodBoolean>;
325
+ }, "strip", z.ZodTypeAny, {
326
+ id: string;
327
+ kind: "text" | "choice" | "choices";
328
+ text: string;
329
+ options?: {
330
+ value: string;
331
+ label: string;
332
+ description?: string | undefined;
333
+ }[] | undefined;
334
+ other?: boolean | undefined;
335
+ header?: string | undefined;
336
+ secret?: boolean | undefined;
337
+ required?: boolean | undefined;
338
+ }, {
339
+ id: string;
340
+ kind: "text" | "choice" | "choices";
341
+ text: string;
342
+ options?: {
343
+ value: string;
344
+ label: string;
345
+ description?: string | undefined;
346
+ }[] | undefined;
347
+ other?: boolean | undefined;
348
+ header?: string | undefined;
349
+ secret?: boolean | undefined;
350
+ required?: boolean | undefined;
351
+ }>, "many">>;
213
352
  }, "strip", z.ZodTypeAny, {
214
353
  options: {
215
354
  optionId: string;
@@ -220,6 +359,20 @@ export declare const pendingPermissionSchema: z.ZodObject<{
220
359
  requestId: string;
221
360
  toolCallId?: string | undefined;
222
361
  detail?: string | undefined;
362
+ questions?: {
363
+ id: string;
364
+ kind: "text" | "choice" | "choices";
365
+ text: string;
366
+ options?: {
367
+ value: string;
368
+ label: string;
369
+ description?: string | undefined;
370
+ }[] | undefined;
371
+ other?: boolean | undefined;
372
+ header?: string | undefined;
373
+ secret?: boolean | undefined;
374
+ required?: boolean | undefined;
375
+ }[] | undefined;
223
376
  }, {
224
377
  options: {
225
378
  optionId: string;
@@ -230,6 +383,20 @@ export declare const pendingPermissionSchema: z.ZodObject<{
230
383
  requestId: string;
231
384
  toolCallId?: string | undefined;
232
385
  detail?: string | undefined;
386
+ questions?: {
387
+ id: string;
388
+ kind: "text" | "choice" | "choices";
389
+ text: string;
390
+ options?: {
391
+ value: string;
392
+ label: string;
393
+ description?: string | undefined;
394
+ }[] | undefined;
395
+ other?: boolean | undefined;
396
+ header?: string | undefined;
397
+ secret?: boolean | undefined;
398
+ required?: boolean | undefined;
399
+ }[] | undefined;
233
400
  }>;
234
401
  export type PendingPermissionSummary = z.infer<typeof pendingPermissionSchema>;
235
402
  export declare const queuedMessageSchema: z.ZodObject<{
@@ -239,12 +406,12 @@ export declare const queuedMessageSchema: z.ZodObject<{
239
406
  images: z.ZodNumber;
240
407
  }, "strip", z.ZodTypeAny, {
241
408
  images: number;
242
- clientMessageId: string;
243
409
  text: string;
410
+ clientMessageId: string;
244
411
  }, {
245
412
  images: number;
246
- clientMessageId: string;
247
413
  text: string;
414
+ clientMessageId: string;
248
415
  }>;
249
416
  export type QueuedMessage = z.infer<typeof queuedMessageSchema>;
250
417
  /** A sub-agent a session started: the tool call it runs under, and how it is doing. */
@@ -323,6 +490,59 @@ export declare const sessionSummarySchema: z.ZodObject<{
323
490
  name: string;
324
491
  kind: "allow_once" | "allow_always" | "reject_once" | "reject_always";
325
492
  }>, "many">;
493
+ /** Set when this is a question to answer (`sessions.answer`) rather than a permission to give. */
494
+ questions: z.ZodOptional<z.ZodArray<z.ZodObject<{
495
+ id: z.ZodString;
496
+ /** A short label for the question ("Auth method"). */
497
+ header: z.ZodOptional<z.ZodString>;
498
+ text: z.ZodString;
499
+ /** `choice`: one of `options`; `choices`: any number of them; `text`: typed. */
500
+ kind: z.ZodEnum<["choice", "choices", "text"]>;
501
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
502
+ value: z.ZodString;
503
+ label: z.ZodString;
504
+ description: z.ZodOptional<z.ZodString>;
505
+ }, "strip", z.ZodTypeAny, {
506
+ value: string;
507
+ label: string;
508
+ description?: string | undefined;
509
+ }, {
510
+ value: string;
511
+ label: string;
512
+ description?: string | undefined;
513
+ }>, "many">>;
514
+ /** With options: an answer of the user's own can be typed instead of, or beside, a pick. */
515
+ other: z.ZodOptional<z.ZodBoolean>;
516
+ /** What is typed shouldn't be shown (a token). */
517
+ secret: z.ZodOptional<z.ZodBoolean>;
518
+ required: z.ZodOptional<z.ZodBoolean>;
519
+ }, "strip", z.ZodTypeAny, {
520
+ id: string;
521
+ kind: "text" | "choice" | "choices";
522
+ text: string;
523
+ options?: {
524
+ value: string;
525
+ label: string;
526
+ description?: string | undefined;
527
+ }[] | undefined;
528
+ other?: boolean | undefined;
529
+ header?: string | undefined;
530
+ secret?: boolean | undefined;
531
+ required?: boolean | undefined;
532
+ }, {
533
+ id: string;
534
+ kind: "text" | "choice" | "choices";
535
+ text: string;
536
+ options?: {
537
+ value: string;
538
+ label: string;
539
+ description?: string | undefined;
540
+ }[] | undefined;
541
+ other?: boolean | undefined;
542
+ header?: string | undefined;
543
+ secret?: boolean | undefined;
544
+ required?: boolean | undefined;
545
+ }>, "many">>;
326
546
  }, "strip", z.ZodTypeAny, {
327
547
  options: {
328
548
  optionId: string;
@@ -333,6 +553,20 @@ export declare const sessionSummarySchema: z.ZodObject<{
333
553
  requestId: string;
334
554
  toolCallId?: string | undefined;
335
555
  detail?: string | undefined;
556
+ questions?: {
557
+ id: string;
558
+ kind: "text" | "choice" | "choices";
559
+ text: string;
560
+ options?: {
561
+ value: string;
562
+ label: string;
563
+ description?: string | undefined;
564
+ }[] | undefined;
565
+ other?: boolean | undefined;
566
+ header?: string | undefined;
567
+ secret?: boolean | undefined;
568
+ required?: boolean | undefined;
569
+ }[] | undefined;
336
570
  }, {
337
571
  options: {
338
572
  optionId: string;
@@ -343,6 +577,20 @@ export declare const sessionSummarySchema: z.ZodObject<{
343
577
  requestId: string;
344
578
  toolCallId?: string | undefined;
345
579
  detail?: string | undefined;
580
+ questions?: {
581
+ id: string;
582
+ kind: "text" | "choice" | "choices";
583
+ text: string;
584
+ options?: {
585
+ value: string;
586
+ label: string;
587
+ description?: string | undefined;
588
+ }[] | undefined;
589
+ other?: boolean | undefined;
590
+ header?: string | undefined;
591
+ secret?: boolean | undefined;
592
+ required?: boolean | undefined;
593
+ }[] | undefined;
346
594
  }>>;
347
595
  /**
348
596
  * Live only: messages waiting for the current turn to end, when the host
@@ -355,13 +603,29 @@ export declare const sessionSummarySchema: z.ZodObject<{
355
603
  images: z.ZodNumber;
356
604
  }, "strip", z.ZodTypeAny, {
357
605
  images: number;
358
- clientMessageId: string;
359
606
  text: string;
607
+ clientMessageId: string;
360
608
  }, {
361
609
  images: number;
362
- clientMessageId: string;
363
610
  text: string;
611
+ clientMessageId: string;
364
612
  }>, "many">>;
613
+ /**
614
+ * The session works in a git worktree LinkShell made for it: its own
615
+ * checkout and branch, so it can't disturb the project's working directory.
616
+ * `cwd` is inside the worktree; `source` is the directory it was made from
617
+ * (the project the session belongs to).
618
+ */
619
+ worktree: z.ZodOptional<z.ZodObject<{
620
+ branch: z.ZodString;
621
+ source: z.ZodString;
622
+ }, "strip", z.ZodTypeAny, {
623
+ branch: string;
624
+ source: string;
625
+ }, {
626
+ branch: string;
627
+ source: string;
628
+ }>>;
365
629
  /** Live only, for sessions that started sub-agents: how many, and how many are working now (`sessions.subagents` lists them). */
366
630
  subagents: z.ZodOptional<z.ZodObject<{
367
631
  total: z.ZodNumber;
@@ -403,12 +667,30 @@ export declare const sessionSummarySchema: z.ZodObject<{
403
667
  requestId: string;
404
668
  toolCallId?: string | undefined;
405
669
  detail?: string | undefined;
670
+ questions?: {
671
+ id: string;
672
+ kind: "text" | "choice" | "choices";
673
+ text: string;
674
+ options?: {
675
+ value: string;
676
+ label: string;
677
+ description?: string | undefined;
678
+ }[] | undefined;
679
+ other?: boolean | undefined;
680
+ header?: string | undefined;
681
+ secret?: boolean | undefined;
682
+ required?: boolean | undefined;
683
+ }[] | undefined;
406
684
  } | undefined;
407
685
  queue?: {
408
686
  images: number;
409
- clientMessageId: string;
410
687
  text: string;
688
+ clientMessageId: string;
411
689
  }[] | undefined;
690
+ worktree?: {
691
+ branch: string;
692
+ source: string;
693
+ } | undefined;
412
694
  subagents?: {
413
695
  running: number;
414
696
  total: number;
@@ -443,12 +725,30 @@ export declare const sessionSummarySchema: z.ZodObject<{
443
725
  requestId: string;
444
726
  toolCallId?: string | undefined;
445
727
  detail?: string | undefined;
728
+ questions?: {
729
+ id: string;
730
+ kind: "text" | "choice" | "choices";
731
+ text: string;
732
+ options?: {
733
+ value: string;
734
+ label: string;
735
+ description?: string | undefined;
736
+ }[] | undefined;
737
+ other?: boolean | undefined;
738
+ header?: string | undefined;
739
+ secret?: boolean | undefined;
740
+ required?: boolean | undefined;
741
+ }[] | undefined;
446
742
  } | undefined;
447
743
  queue?: {
448
744
  images: number;
449
- clientMessageId: string;
450
745
  text: string;
746
+ clientMessageId: string;
451
747
  }[] | undefined;
748
+ worktree?: {
749
+ branch: string;
750
+ source: string;
751
+ } | undefined;
452
752
  subagents?: {
453
753
  running: number;
454
754
  total: number;
@@ -460,21 +760,79 @@ export declare function parseSessionId(id: string): {
460
760
  agent: string;
461
761
  nativeId: string;
462
762
  } | null;
763
+ /** What git says about a directory, to offer starting a session in a worktree of it. */
764
+ export declare const gitInfoSchema: z.ZodObject<{
765
+ /** The repository's top directory. */
766
+ root: z.ZodString;
767
+ /** The branch checked out; absent on a detached HEAD. */
768
+ branch: z.ZodOptional<z.ZodString>;
769
+ /** The commit checked out, abbreviated; absent before the first commit. */
770
+ head: z.ZodOptional<z.ZodString>;
771
+ /** Uncommitted changes in the working directory (a new worktree starts from the last commit, without them). */
772
+ dirty: z.ZodBoolean;
773
+ }, "strip", z.ZodTypeAny, {
774
+ dirty: boolean;
775
+ root: string;
776
+ branch?: string | undefined;
777
+ head?: string | undefined;
778
+ }, {
779
+ dirty: boolean;
780
+ root: string;
781
+ branch?: string | undefined;
782
+ head?: string | undefined;
783
+ }>;
784
+ export type GitInfo = z.infer<typeof gitInfoSchema>;
785
+ /** A worktree LinkShell made for sessions. */
786
+ export declare const worktreeEntrySchema: z.ZodObject<{
787
+ /** The worktree's top directory. */
788
+ path: z.ZodString;
789
+ branch: z.ZodString;
790
+ /** The repository it belongs to. */
791
+ source: z.ZodString;
792
+ createdAt: z.ZodNumber;
793
+ /** Sessions working in it. */
794
+ sessions: z.ZodArray<z.ZodString, "many">;
795
+ /** Uncommitted changes in it. */
796
+ dirty: z.ZodBoolean;
797
+ /** Commits made in it since it was created. */
798
+ ahead: z.ZodNumber;
799
+ }, "strip", z.ZodTypeAny, {
800
+ dirty: boolean;
801
+ path: string;
802
+ createdAt: number;
803
+ branch: string;
804
+ source: string;
805
+ sessions: string[];
806
+ ahead: number;
807
+ }, {
808
+ dirty: boolean;
809
+ path: string;
810
+ createdAt: number;
811
+ branch: string;
812
+ source: string;
813
+ sessions: string[];
814
+ ahead: number;
815
+ }>;
816
+ export type WorktreeEntry = z.infer<typeof worktreeEntrySchema>;
463
817
  export declare const projectSummarySchema: z.ZodObject<{
464
818
  cwd: z.ZodString;
465
819
  name: z.ZodString;
466
820
  lastActiveAt: z.ZodNumber;
467
821
  sessionCount: z.ZodNumber;
822
+ /** For a git repository: the branch checked out there now (or the abbreviated commit, on a detached HEAD). */
823
+ branch: z.ZodOptional<z.ZodString>;
468
824
  }, "strip", z.ZodTypeAny, {
469
825
  name: string;
470
826
  cwd: string;
471
827
  lastActiveAt: number;
472
828
  sessionCount: number;
829
+ branch?: string | undefined;
473
830
  }, {
474
831
  name: string;
475
832
  cwd: string;
476
833
  lastActiveAt: number;
477
834
  sessionCount: number;
835
+ branch?: string | undefined;
478
836
  }>;
479
837
  export type ProjectSummary = z.infer<typeof projectSummarySchema>;
480
838
  export declare const machineInfoSchema: z.ZodObject<{
@@ -513,6 +871,12 @@ export declare const machineInfoSchema: z.ZodObject<{
513
871
  steer: z.ZodBoolean;
514
872
  permissions: z.ZodBoolean;
515
873
  images: z.ZodBoolean;
874
+ /**
875
+ * The agent forks sessions itself, keeping everything it knew. Every agent's
876
+ * sessions can be forked: without this (or from a single reply, where the
877
+ * agent only forks whole sessions) LinkShell makes the fork — the new session
878
+ * shows the conversation and its agent is told it as text.
879
+ */
516
880
  fork: z.ZodBoolean;
517
881
  models: z.ZodBoolean;
518
882
  modes: z.ZodBoolean;
@@ -576,6 +940,17 @@ export declare const machineInfoSchema: z.ZodObject<{
576
940
  hint?: string | undefined;
577
941
  } | undefined;
578
942
  }>, "many">;
943
+ /**
944
+ * The host can send bulk streams peer to peer (`direct.offer`); `iceServers`
945
+ * are the STUN servers both sides use to find a path.
946
+ */
947
+ direct: z.ZodOptional<z.ZodObject<{
948
+ iceServers: z.ZodArray<z.ZodString, "many">;
949
+ }, "strip", z.ZodTypeAny, {
950
+ iceServers: string[];
951
+ }, {
952
+ iceServers: string[];
953
+ }>>;
579
954
  }, "strip", z.ZodTypeAny, {
580
955
  machineId: string;
581
956
  hostname: string;
@@ -604,6 +979,9 @@ export declare const machineInfoSchema: z.ZodObject<{
604
979
  } | undefined;
605
980
  }[];
606
981
  home?: string | undefined;
982
+ direct?: {
983
+ iceServers: string[];
984
+ } | undefined;
607
985
  }, {
608
986
  machineId: string;
609
987
  hostname: string;
@@ -632,6 +1010,9 @@ export declare const machineInfoSchema: z.ZodObject<{
632
1010
  } | undefined;
633
1011
  }[];
634
1012
  home?: string | undefined;
1013
+ direct?: {
1014
+ iceServers: string[];
1015
+ } | undefined;
635
1016
  }>;
636
1017
  export type MachineInfo = z.infer<typeof machineInfoSchema>;
637
1018
  /** A server listening on the host, which a device can preview through the encrypted channel. */