@ai-matrx/desktop-protocol 0.1.0 → 0.1.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/dist/client.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { BackoffOptions } from '@ai-matrx/realtime';
2
2
  export { RECONNECT_ALARM_ATTEMPTS } from '@ai-matrx/realtime';
3
3
  import { z } from 'zod';
4
- import { W as Welcome, D as DesktopProtocolError, O as OpName, a as OpParams, b as OpResult, c as OPS, S as StreamMeta, E as EndReason, d as EVENTS, C as ClientType } from './registry-DTcTGycI.cjs';
5
- export { i as isDesktopProtocolError } from './registry-DTcTGycI.cjs';
4
+ import { W as Welcome, D as DesktopProtocolError, O as OpName, a as OpParams, b as OpResult, c as OPS, S as StreamMeta, E as EndReason, d as EVENTS, C as ClientType } from './registry-DJbrsZ4u.cjs';
5
+ export { i as isDesktopProtocolError } from './registry-DJbrsZ4u.cjs';
6
6
  import { FrameHeader } from './frame.cjs';
7
7
 
8
8
  /** The subset of the WHATWG WebSocket the client uses — browser, React Native, `ws` and Workers all fit. */
package/dist/client.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { BackoffOptions } from '@ai-matrx/realtime';
2
2
  export { RECONNECT_ALARM_ATTEMPTS } from '@ai-matrx/realtime';
3
3
  import { z } from 'zod';
4
- import { W as Welcome, D as DesktopProtocolError, O as OpName, a as OpParams, b as OpResult, c as OPS, S as StreamMeta, E as EndReason, d as EVENTS, C as ClientType } from './registry-DTcTGycI.js';
5
- export { i as isDesktopProtocolError } from './registry-DTcTGycI.js';
4
+ import { W as Welcome, D as DesktopProtocolError, O as OpName, a as OpParams, b as OpResult, c as OPS, S as StreamMeta, E as EndReason, d as EVENTS, C as ClientType } from './registry-DJbrsZ4u.js';
5
+ export { i as isDesktopProtocolError } from './registry-DJbrsZ4u.js';
6
6
  import { FrameHeader } from './frame.js';
7
7
 
8
8
  /** The subset of the WHATWG WebSocket the client uses — browser, React Native, `ws` and Workers all fit. */
package/dist/client.js CHANGED
@@ -254,7 +254,15 @@ var CoreToClientMsg = z3.discriminatedUnion("type", [ResponseMsg, ErrorMsg, Stre
254
254
  var CloseCode = {
255
255
  NORMAL: 1e3,
256
256
  GOING_AWAY: 1001,
257
- // relay deploy / app quit — reconnect immediately
257
+ // app quit; relay: the device was silent for 75 s — reconnect
258
+ /** Never sent by anyone: what a socket reports when it drops without a close frame. A relay
259
+ * deploy (every Durable Object restarts) arrives as this — reconnect immediately. */
260
+ ABNORMAL: 1006,
261
+ /** Relay → clients: the device (re)connected, so the core session they spoke to is gone —
262
+ * reconnect, hello, and reattach with since_seq. */
263
+ DEVICE_RECONNECTED: 1012,
264
+ TRY_AGAIN_LATER: 1013,
265
+ // relay: signing keys or the device registry unreachable — retry
258
266
  AUTH_INVALID: 4001,
259
267
  AUTH_FORBIDDEN: 4003,
260
268
  DEVICE_NOT_FOUND: 4004,
@@ -267,6 +275,7 @@ var CloseCode = {
267
275
  PROTOCOL_ERROR: 4400,
268
276
  UPGRADE_REQUIRED: 4426
269
277
  };
278
+ var CloseCodeValue = z3.literal([1e3, 1001, 1006, 1012, 1013, 4001, 4003, 4004, 4008, 4009, 4010, 4400, 4426]);
270
279
 
271
280
  // src/schema/frame.ts
272
281
  import { z as z4 } from "zod";
@@ -278,6 +287,22 @@ var FrameHeader = z4.strictObject({
278
287
  sid: u32,
279
288
  seq: u32
280
289
  });
290
+ var RelayHopEnvelopeHeader = z4.strictObject({
291
+ version: z4.literal(FRAME_VERSION),
292
+ flags: z4.literal(0),
293
+ channel: z4.literal(255),
294
+ cid: u32,
295
+ sid: z4.literal(0),
296
+ seq: z4.literal(0)
297
+ });
298
+ var RelayHopConnectionEnd = z4.strictObject({
299
+ version: z4.literal(FRAME_VERSION),
300
+ flags: z4.literal(1),
301
+ channel: z4.literal(255),
302
+ cid: z4.int().min(1).max(4294967295),
303
+ sid: z4.literal(0),
304
+ seq: z4.literal(0)
305
+ });
281
306
  var DEFAULT_WINDOW_BYTES = 262144;
282
307
  var DEFAULT_MAX_FRAME_PAYLOAD_BYTES = 65536;
283
308
 
@@ -587,6 +612,22 @@ var RelayCallResponse = z9.discriminatedUnion("ok", [
587
612
  z9.strictObject({ ok: z9.literal(true), result: z9.unknown() }),
588
613
  z9.strictObject({ ok: z9.literal(false), error: ProtocolErrorBody })
589
614
  ]);
615
+ var RELAY_CALL_HELLO_ID = "hello";
616
+ var RELAY_CALL_REQUEST_ID = "call";
617
+ var RelayCallHello = z9.strictObject({
618
+ type: z9.literal("hello"),
619
+ id: z9.literal(RELAY_CALL_HELLO_ID),
620
+ protocolVersion: ProtocolVersion,
621
+ clientType: z9.literal("server"),
622
+ clientVersion: z9.string().min(1).max(32)
623
+ });
624
+ var RelayCallEnvelope = z9.strictObject({
625
+ id: z9.literal(RELAY_CALL_REQUEST_ID),
626
+ type: z9.literal("request"),
627
+ cap: z9.string().min(1).max(32),
628
+ op: z9.string().min(1).max(64),
629
+ params: z9.unknown()
630
+ });
590
631
 
591
632
  // src/schema/registry.ts
592
633
  var FS_ERR = ["NOT_FOUND", "PERMISSION_DENIED_OS", "INVALID_PARAMS", "RESOURCE_BUSY", "INTERNAL"];