linkshell-cli 0.1.16 → 0.2.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.
@@ -17,9 +17,9 @@ export declare const envelopeSchema: z.ZodObject<{
17
17
  ack: z.ZodOptional<z.ZodNumber>;
18
18
  payload: z.ZodUnknown;
19
19
  }, "strip", z.ZodTypeAny, {
20
+ sessionId: string;
20
21
  id: string;
21
22
  type: string;
22
- sessionId: string;
23
23
  timestamp: string;
24
24
  deviceId?: string | undefined;
25
25
  traceId?: string | undefined;
@@ -27,9 +27,9 @@ export declare const envelopeSchema: z.ZodObject<{
27
27
  ack?: number | undefined;
28
28
  payload?: unknown;
29
29
  }, {
30
+ sessionId: string;
30
31
  id: string;
31
32
  type: string;
32
- sessionId: string;
33
33
  timestamp: string;
34
34
  deviceId?: string | undefined;
35
35
  traceId?: string | undefined;
@@ -84,14 +84,14 @@ export declare const sessionConnectPayloadSchema: z.ZodObject<{
84
84
  }, "strip", z.ZodTypeAny, {
85
85
  role: "host" | "client";
86
86
  clientName: string;
87
- provider?: "custom" | "claude" | "codex" | undefined;
87
+ provider?: "claude" | "codex" | "custom" | undefined;
88
88
  protocolVersion?: number | undefined;
89
89
  hostname?: string | undefined;
90
90
  platform?: string | undefined;
91
91
  }, {
92
92
  role: "host" | "client";
93
93
  clientName: string;
94
- provider?: "custom" | "claude" | "codex" | undefined;
94
+ provider?: "claude" | "codex" | "custom" | undefined;
95
95
  protocolVersion?: number | undefined;
96
96
  hostname?: string | undefined;
97
97
  platform?: string | undefined;
@@ -193,15 +193,91 @@ export declare const sessionHostDisconnectedPayloadSchema: z.ZodObject<{
193
193
  reason?: string | undefined;
194
194
  }>;
195
195
  export declare const sessionHostReconnectedPayloadSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
196
+ export declare const screenStartPayloadSchema: z.ZodObject<{
197
+ fps: z.ZodDefault<z.ZodNumber>;
198
+ quality: z.ZodDefault<z.ZodNumber>;
199
+ scale: z.ZodDefault<z.ZodNumber>;
200
+ }, "strip", z.ZodTypeAny, {
201
+ fps: number;
202
+ quality: number;
203
+ scale: number;
204
+ }, {
205
+ fps?: number | undefined;
206
+ quality?: number | undefined;
207
+ scale?: number | undefined;
208
+ }>;
209
+ export declare const screenStopPayloadSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
210
+ export declare const screenFramePayloadSchema: z.ZodObject<{
211
+ data: z.ZodString;
212
+ width: z.ZodNumber;
213
+ height: z.ZodNumber;
214
+ frameId: z.ZodNumber;
215
+ chunkIndex: z.ZodDefault<z.ZodNumber>;
216
+ chunkTotal: z.ZodDefault<z.ZodNumber>;
217
+ }, "strip", z.ZodTypeAny, {
218
+ data: string;
219
+ width: number;
220
+ height: number;
221
+ frameId: number;
222
+ chunkIndex: number;
223
+ chunkTotal: number;
224
+ }, {
225
+ data: string;
226
+ width: number;
227
+ height: number;
228
+ frameId: number;
229
+ chunkIndex?: number | undefined;
230
+ chunkTotal?: number | undefined;
231
+ }>;
232
+ export declare const screenStatusPayloadSchema: z.ZodObject<{
233
+ active: z.ZodBoolean;
234
+ mode: z.ZodDefault<z.ZodEnum<["webrtc", "fallback", "off"]>>;
235
+ error: z.ZodOptional<z.ZodString>;
236
+ }, "strip", z.ZodTypeAny, {
237
+ active: boolean;
238
+ mode: "webrtc" | "fallback" | "off";
239
+ error?: string | undefined;
240
+ }, {
241
+ active: boolean;
242
+ error?: string | undefined;
243
+ mode?: "webrtc" | "fallback" | "off" | undefined;
244
+ }>;
245
+ export declare const screenOfferPayloadSchema: z.ZodObject<{
246
+ sdp: z.ZodString;
247
+ }, "strip", z.ZodTypeAny, {
248
+ sdp: string;
249
+ }, {
250
+ sdp: string;
251
+ }>;
252
+ export declare const screenAnswerPayloadSchema: z.ZodObject<{
253
+ sdp: z.ZodString;
254
+ }, "strip", z.ZodTypeAny, {
255
+ sdp: string;
256
+ }, {
257
+ sdp: string;
258
+ }>;
259
+ export declare const screenIcePayloadSchema: z.ZodObject<{
260
+ candidate: z.ZodString;
261
+ sdpMid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
262
+ sdpMLineIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
263
+ }, "strip", z.ZodTypeAny, {
264
+ candidate: string;
265
+ sdpMid?: string | null | undefined;
266
+ sdpMLineIndex?: number | null | undefined;
267
+ }, {
268
+ candidate: string;
269
+ sdpMid?: string | null | undefined;
270
+ sdpMLineIndex?: number | null | undefined;
271
+ }>;
196
272
  export declare const errorPayloadSchema: z.ZodObject<{
197
273
  code: z.ZodString;
198
274
  message: z.ZodString;
199
275
  }, "strip", z.ZodTypeAny, {
200
- code: string;
201
276
  message: string;
202
- }, {
203
277
  code: string;
278
+ }, {
204
279
  message: string;
280
+ code: string;
205
281
  }>;
206
282
  export declare const protocolMessageSchemas: {
207
283
  readonly "session.connect": z.ZodObject<{
@@ -214,14 +290,14 @@ export declare const protocolMessageSchemas: {
214
290
  }, "strip", z.ZodTypeAny, {
215
291
  role: "host" | "client";
216
292
  clientName: string;
217
- provider?: "custom" | "claude" | "codex" | undefined;
293
+ provider?: "claude" | "codex" | "custom" | undefined;
218
294
  protocolVersion?: number | undefined;
219
295
  hostname?: string | undefined;
220
296
  platform?: string | undefined;
221
297
  }, {
222
298
  role: "host" | "client";
223
299
  clientName: string;
224
- provider?: "custom" | "claude" | "codex" | undefined;
300
+ provider?: "claude" | "codex" | "custom" | undefined;
225
301
  protocolVersion?: number | undefined;
226
302
  hostname?: string | undefined;
227
303
  platform?: string | undefined;
@@ -251,11 +327,11 @@ export declare const protocolMessageSchemas: {
251
327
  code: z.ZodString;
252
328
  message: z.ZodString;
253
329
  }, "strip", z.ZodTypeAny, {
254
- code: string;
255
330
  message: string;
256
- }, {
257
331
  code: string;
332
+ }, {
258
333
  message: string;
334
+ code: string;
259
335
  }>;
260
336
  readonly "terminal.output": z.ZodObject<{
261
337
  stream: z.ZodEnum<["stdout", "stderr"]>;
@@ -369,6 +445,82 @@ export declare const protocolMessageSchemas: {
369
445
  reason?: string | undefined;
370
446
  }>;
371
447
  readonly "session.host_reconnected": z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
448
+ readonly "screen.start": z.ZodObject<{
449
+ fps: z.ZodDefault<z.ZodNumber>;
450
+ quality: z.ZodDefault<z.ZodNumber>;
451
+ scale: z.ZodDefault<z.ZodNumber>;
452
+ }, "strip", z.ZodTypeAny, {
453
+ fps: number;
454
+ quality: number;
455
+ scale: number;
456
+ }, {
457
+ fps?: number | undefined;
458
+ quality?: number | undefined;
459
+ scale?: number | undefined;
460
+ }>;
461
+ readonly "screen.stop": z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
462
+ readonly "screen.frame": z.ZodObject<{
463
+ data: z.ZodString;
464
+ width: z.ZodNumber;
465
+ height: z.ZodNumber;
466
+ frameId: z.ZodNumber;
467
+ chunkIndex: z.ZodDefault<z.ZodNumber>;
468
+ chunkTotal: z.ZodDefault<z.ZodNumber>;
469
+ }, "strip", z.ZodTypeAny, {
470
+ data: string;
471
+ width: number;
472
+ height: number;
473
+ frameId: number;
474
+ chunkIndex: number;
475
+ chunkTotal: number;
476
+ }, {
477
+ data: string;
478
+ width: number;
479
+ height: number;
480
+ frameId: number;
481
+ chunkIndex?: number | undefined;
482
+ chunkTotal?: number | undefined;
483
+ }>;
484
+ readonly "screen.status": z.ZodObject<{
485
+ active: z.ZodBoolean;
486
+ mode: z.ZodDefault<z.ZodEnum<["webrtc", "fallback", "off"]>>;
487
+ error: z.ZodOptional<z.ZodString>;
488
+ }, "strip", z.ZodTypeAny, {
489
+ active: boolean;
490
+ mode: "webrtc" | "fallback" | "off";
491
+ error?: string | undefined;
492
+ }, {
493
+ active: boolean;
494
+ error?: string | undefined;
495
+ mode?: "webrtc" | "fallback" | "off" | undefined;
496
+ }>;
497
+ readonly "screen.offer": z.ZodObject<{
498
+ sdp: z.ZodString;
499
+ }, "strip", z.ZodTypeAny, {
500
+ sdp: string;
501
+ }, {
502
+ sdp: string;
503
+ }>;
504
+ readonly "screen.answer": z.ZodObject<{
505
+ sdp: z.ZodString;
506
+ }, "strip", z.ZodTypeAny, {
507
+ sdp: string;
508
+ }, {
509
+ sdp: string;
510
+ }>;
511
+ readonly "screen.ice": z.ZodObject<{
512
+ candidate: z.ZodString;
513
+ sdpMid: z.ZodOptional<z.ZodNullable<z.ZodString>>;
514
+ sdpMLineIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
515
+ }, "strip", z.ZodTypeAny, {
516
+ candidate: string;
517
+ sdpMid?: string | null | undefined;
518
+ sdpMLineIndex?: number | null | undefined;
519
+ }, {
520
+ candidate: string;
521
+ sdpMid?: string | null | undefined;
522
+ sdpMLineIndex?: number | null | undefined;
523
+ }>;
372
524
  };
373
525
  export type ProtocolMessageType = keyof typeof protocolMessageSchemas;
374
526
  export declare function createEnvelope<T>(input: {
@@ -97,6 +97,37 @@ export const sessionHostDisconnectedPayloadSchema = z.object({
97
97
  reason: z.string().optional(),
98
98
  });
99
99
  export const sessionHostReconnectedPayloadSchema = z.object({});
100
+ // ── Screen sharing payloads ─────────────────────────────────────────
101
+ export const screenStartPayloadSchema = z.object({
102
+ fps: z.number().int().min(1).max(30).default(5),
103
+ quality: z.number().int().min(10).max(100).default(60),
104
+ scale: z.number().min(0.1).max(1).default(0.5),
105
+ });
106
+ export const screenStopPayloadSchema = z.object({});
107
+ export const screenFramePayloadSchema = z.object({
108
+ data: z.string(), // base64 JPEG
109
+ width: z.number().int(),
110
+ height: z.number().int(),
111
+ frameId: z.number().int(),
112
+ chunkIndex: z.number().int().default(0),
113
+ chunkTotal: z.number().int().default(1),
114
+ });
115
+ export const screenStatusPayloadSchema = z.object({
116
+ active: z.boolean(),
117
+ mode: z.enum(["webrtc", "fallback", "off"]).default("off"),
118
+ error: z.string().optional(),
119
+ });
120
+ export const screenOfferPayloadSchema = z.object({
121
+ sdp: z.string(),
122
+ });
123
+ export const screenAnswerPayloadSchema = z.object({
124
+ sdp: z.string(),
125
+ });
126
+ export const screenIcePayloadSchema = z.object({
127
+ candidate: z.string(),
128
+ sdpMid: z.string().nullable().optional(),
129
+ sdpMLineIndex: z.number().nullable().optional(),
130
+ });
100
131
  export const errorPayloadSchema = z.object({
101
132
  code: z.string().min(1),
102
133
  message: z.string().min(1),
@@ -121,6 +152,13 @@ export const protocolMessageSchemas = {
121
152
  "control.release": controlReleasePayloadSchema,
122
153
  "session.host_disconnected": sessionHostDisconnectedPayloadSchema,
123
154
  "session.host_reconnected": sessionHostReconnectedPayloadSchema,
155
+ "screen.start": screenStartPayloadSchema,
156
+ "screen.stop": screenStopPayloadSchema,
157
+ "screen.frame": screenFramePayloadSchema,
158
+ "screen.status": screenStatusPayloadSchema,
159
+ "screen.offer": screenOfferPayloadSchema,
160
+ "screen.answer": screenAnswerPayloadSchema,
161
+ "screen.ice": screenIcePayloadSchema,
124
162
  };
125
163
  // ── UUID helper (works in Node, Web, and Expo) ─────────────────────
126
164
  function generateId() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../shared-protocol/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,uEAAuE;AAEvE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC,uEAAuE;AAEvE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AAG3D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC;IACvC,iBAAiB;IACjB,YAAY;IACZ,QAAQ;IACR,cAAc;IACd,MAAM;IACN,YAAY;CACb,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC;IACpC,mBAAmB;IACnB,iBAAiB;IACjB,mBAAmB;IACnB,kBAAkB;IAClB,oBAAoB;IACpB,kBAAk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
3
+ "version": "0.2.1",
4
4
  "description": "Remote terminal bridge for Claude Code / Codex — control from your phone",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -36,14 +36,17 @@
36
36
  "dev": "tsx src/index.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@linkshell/protocol": "^0.1.0",
40
- "@linkshell/gateway": "^0.1.7",
39
+ "@linkshell/protocol": "^0.2.0",
40
+ "@linkshell/gateway": "^0.2.0",
41
41
  "commander": "^13.1.0",
42
42
  "node-pty": "^1.0.0",
43
43
  "qrcode-terminal": "^0.12.0",
44
44
  "ws": "^8.18.1",
45
45
  "zod": "^3.24.3"
46
46
  },
47
+ "optionalDependencies": {
48
+ "werift": "^0.22.9"
49
+ },
47
50
  "devDependencies": {
48
51
  "@types/ws": "^8.5.14",
49
52
  "tsx": "^4.19.3"
package/src/index.ts CHANGED
@@ -15,7 +15,7 @@ program
15
15
  .description(
16
16
  "Bridge a local Claude/Codex terminal session to a remote gateway",
17
17
  )
18
- .version("0.1.9");
18
+ .version("0.2.0");
19
19
 
20
20
  // ── start ───────────────────────────────────────────────────────────
21
21
 
@@ -56,6 +56,7 @@ program
56
56
  String(config.cols ?? 120),
57
57
  )
58
58
  .option("--rows <rows>", "Initial terminal rows", String(config.rows ?? 36))
59
+ .option("--screen", "Enable screen sharing capability")
59
60
  .option("--daemon", "Run in background (detached)")
60
61
  .option("--verbose", "Enable verbose logging")
61
62
  .option("--_foreground-bridge", undefined) // internal
@@ -85,6 +86,7 @@ program
85
86
  childArgs.push("--cols", String(options.cols));
86
87
  childArgs.push("--rows", String(options.rows));
87
88
  if (options.verbose) childArgs.push("--verbose");
89
+ if (options.screen) childArgs.push("--screen");
88
90
  if (options.sessionId) childArgs.push("--session-id", options.sessionId);
89
91
  // Pass through extra args
90
92
  const extra = command.args.filter((v: string) => v !== "--");
@@ -161,6 +163,7 @@ program
161
163
  clientName: options.clientName,
162
164
  hostname: options.hostname,
163
165
  verbose: Boolean(options.verbose),
166
+ screen: Boolean(options.screen),
164
167
  providerConfig,
165
168
  });
166
169
 
@@ -11,6 +11,8 @@ import {
11
11
  import type { Envelope } from "@linkshell/protocol";
12
12
  import type { ProviderConfig } from "../providers.js";
13
13
  import { ScrollbackBuffer } from "./scrollback.js";
14
+ import { ScreenFallback } from "./screen-fallback.js";
15
+ import { ScreenShare } from "./screen-share.js";
14
16
  import { getLanIp } from "../utils/lan-ip.js";
15
17
 
16
18
  export interface BridgeSessionOptions {
@@ -23,6 +25,7 @@ export interface BridgeSessionOptions {
23
25
  clientName: string;
24
26
  hostname?: string;
25
27
  verbose?: boolean;
28
+ screen?: boolean;
26
29
  providerConfig: ProviderConfig;
27
30
  }
28
31
 
@@ -101,6 +104,8 @@ export class BridgeSession {
101
104
  private sessionId = "";
102
105
  private exited = false;
103
106
  private stopped = false;
107
+ private screenCapture: ScreenFallback | undefined;
108
+ private screenShare: ScreenShare | undefined;
104
109
 
105
110
  constructor(options: BridgeSessionOptions) {
106
111
  this.options = options;
@@ -267,6 +272,25 @@ export class BridgeSession {
267
272
  }
268
273
  case "session.heartbeat":
269
274
  break;
275
+ case "screen.start": {
276
+ const p = parseTypedPayload("screen.start", envelope.payload);
277
+ this.startScreenCapture(p.fps, p.quality, p.scale);
278
+ break;
279
+ }
280
+ case "screen.stop": {
281
+ this.stopScreenCapture();
282
+ break;
283
+ }
284
+ case "screen.answer": {
285
+ const p = parseTypedPayload("screen.answer", envelope.payload);
286
+ this.screenShare?.handleAnswer(p.sdp);
287
+ break;
288
+ }
289
+ case "screen.ice": {
290
+ const p = parseTypedPayload("screen.ice", envelope.payload);
291
+ this.screenShare?.handleIceCandidate(p.candidate, p.sdpMid, p.sdpMLineIndex);
292
+ break;
293
+ }
270
294
  default:
271
295
  break;
272
296
  }
@@ -373,6 +397,68 @@ export class BridgeSession {
373
397
  }
374
398
  }
375
399
 
400
+ private startScreenCapture(fps: number, quality: number, scale: number): void {
401
+ if (!this.options.screen) {
402
+ this.log("screen sharing not enabled (use --screen)");
403
+ this.send(
404
+ createEnvelope({
405
+ type: "screen.status",
406
+ sessionId: this.sessionId,
407
+ payload: { active: false, mode: "off" as const, error: "Screen sharing not enabled on host. Start CLI with --screen flag." },
408
+ }),
409
+ );
410
+ return;
411
+ }
412
+ this.stopScreenCapture();
413
+ this.log(`starting screen capture (fps=${fps}, quality=${quality}, scale=${scale})`);
414
+
415
+ // Try WebRTC first, fall back to screenshot stream
416
+ if (ScreenShare.isAvailable()) {
417
+ this.log("WebRTC available, starting screen share");
418
+ this.screenShare = new ScreenShare({
419
+ sessionId: this.sessionId,
420
+ fps,
421
+ quality,
422
+ scale,
423
+ onSignal: (envelope) => this.send(envelope),
424
+ onStatus: (envelope) => this.send(envelope),
425
+ });
426
+ this.screenShare.start().catch((err) => {
427
+ this.log(`WebRTC failed, falling back to screenshot stream: ${err}`);
428
+ this.screenShare = undefined;
429
+ this.startFallbackCapture(fps, quality, scale);
430
+ });
431
+ } else {
432
+ this.log("WebRTC not available (missing werift or ffmpeg), using screenshot fallback");
433
+ this.startFallbackCapture(fps, quality, scale);
434
+ }
435
+ }
436
+
437
+ private startFallbackCapture(fps: number, quality: number, scale: number): void {
438
+ this.screenCapture = new ScreenFallback({
439
+ fps,
440
+ quality,
441
+ scale,
442
+ sessionId: this.sessionId,
443
+ onFrame: (envelope) => this.send(envelope),
444
+ onStatus: (envelope) => this.send(envelope),
445
+ });
446
+ this.screenCapture.start();
447
+ }
448
+
449
+ private stopScreenCapture(): void {
450
+ if (this.screenShare) {
451
+ this.log("stopping WebRTC screen share");
452
+ this.screenShare.stop();
453
+ this.screenShare = undefined;
454
+ }
455
+ if (this.screenCapture) {
456
+ this.log("stopping screenshot capture");
457
+ this.screenCapture.stop();
458
+ this.screenCapture = undefined;
459
+ }
460
+ }
461
+
376
462
  private scheduleReconnect(): void {
377
463
  if (this.reconnecting || this.reconnectAttempts >= RECONNECT_MAX_ATTEMPTS) {
378
464
  process.stderr.write(
@@ -408,6 +494,7 @@ export class BridgeSession {
408
494
  this.stopped = true;
409
495
  this.exited = true;
410
496
  this.stopHeartbeat();
497
+ this.stopScreenCapture();
411
498
  if (this.reconnectTimer) {
412
499
  clearTimeout(this.reconnectTimer);
413
500
  this.reconnectTimer = undefined;