@1upvision/protocol 0.1.0 → 0.1.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.
@@ -48,6 +48,42 @@ export type StorageSetRequest = {
48
48
  data: Record<string, unknown>;
49
49
  };
50
50
  };
51
+ export type ServerQueryRequest = {
52
+ jsonrpc: "2.0";
53
+ id: string;
54
+ method: "server.query";
55
+ params: {
56
+ name: string;
57
+ args?: Record<string, unknown>;
58
+ };
59
+ };
60
+ export type ServerMutationRequest = {
61
+ jsonrpc: "2.0";
62
+ id: string;
63
+ method: "server.mutation";
64
+ params: {
65
+ name: string;
66
+ args?: Record<string, unknown>;
67
+ };
68
+ };
69
+ export type ServerSubscribeRequest = {
70
+ jsonrpc: "2.0";
71
+ id: string;
72
+ method: "server.subscribe";
73
+ params: {
74
+ subscriptionId: string;
75
+ name: string;
76
+ args?: Record<string, unknown>;
77
+ };
78
+ };
79
+ export type ServerUnsubscribeRequest = {
80
+ jsonrpc: "2.0";
81
+ id: string;
82
+ method: "server.unsubscribe";
83
+ params: {
84
+ subscriptionId: string;
85
+ };
86
+ };
51
87
  export type EventCallbackNotification = {
52
88
  jsonrpc: "2.0";
53
89
  method: "event.callback";
@@ -78,8 +114,25 @@ export type StorageUpdateNotification = {
78
114
  storage: Record<string, unknown>;
79
115
  };
80
116
  };
81
- export type SandboxToHostMessage = UIRenderNotification | UIReadyNotification | StorageGetRequest | StorageSetRequest;
82
- export type HostToSandboxMessage = EventCallbackNotification | LifecycleInitRequest | LifecycleDestroyNotification | StorageUpdateNotification;
117
+ export type ServerSubscriptionUpdateNotification = {
118
+ jsonrpc: "2.0";
119
+ method: "server.subscription.update";
120
+ params: {
121
+ subscriptionId: string;
122
+ data: unknown;
123
+ };
124
+ };
125
+ export type ServerSubscriptionErrorNotification = {
126
+ jsonrpc: "2.0";
127
+ method: "server.subscription.error";
128
+ params: {
129
+ subscriptionId: string;
130
+ error: string;
131
+ message: string;
132
+ };
133
+ };
134
+ export type SandboxToHostMessage = UIRenderNotification | UIReadyNotification | StorageGetRequest | StorageSetRequest | ServerQueryRequest | ServerMutationRequest | ServerSubscribeRequest | ServerUnsubscribeRequest;
135
+ export type HostToSandboxMessage = EventCallbackNotification | LifecycleInitRequest | LifecycleDestroyNotification | StorageUpdateNotification | ServerSubscriptionUpdateNotification | ServerSubscriptionErrorNotification;
83
136
  export declare const JsonRpcRequestSchema: z.ZodObject<{
84
137
  jsonrpc: z.ZodLiteral<"2.0">;
85
138
  id: z.ZodString;
@@ -230,6 +283,130 @@ export declare const StorageSetRequestSchema: z.ZodObject<{
230
283
  id: string;
231
284
  method: "storage.set";
232
285
  }>;
286
+ export declare const ServerQueryRequestSchema: z.ZodObject<{
287
+ jsonrpc: z.ZodLiteral<"2.0">;
288
+ id: z.ZodString;
289
+ method: z.ZodLiteral<"server.query">;
290
+ params: z.ZodObject<{
291
+ name: z.ZodString;
292
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
293
+ }, "strip", z.ZodTypeAny, {
294
+ name: string;
295
+ args?: Record<string, unknown> | undefined;
296
+ }, {
297
+ name: string;
298
+ args?: Record<string, unknown> | undefined;
299
+ }>;
300
+ }, "strip", z.ZodTypeAny, {
301
+ params: {
302
+ name: string;
303
+ args?: Record<string, unknown> | undefined;
304
+ };
305
+ jsonrpc: "2.0";
306
+ id: string;
307
+ method: "server.query";
308
+ }, {
309
+ params: {
310
+ name: string;
311
+ args?: Record<string, unknown> | undefined;
312
+ };
313
+ jsonrpc: "2.0";
314
+ id: string;
315
+ method: "server.query";
316
+ }>;
317
+ export declare const ServerMutationRequestSchema: z.ZodObject<{
318
+ jsonrpc: z.ZodLiteral<"2.0">;
319
+ id: z.ZodString;
320
+ method: z.ZodLiteral<"server.mutation">;
321
+ params: z.ZodObject<{
322
+ name: z.ZodString;
323
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
324
+ }, "strip", z.ZodTypeAny, {
325
+ name: string;
326
+ args?: Record<string, unknown> | undefined;
327
+ }, {
328
+ name: string;
329
+ args?: Record<string, unknown> | undefined;
330
+ }>;
331
+ }, "strip", z.ZodTypeAny, {
332
+ params: {
333
+ name: string;
334
+ args?: Record<string, unknown> | undefined;
335
+ };
336
+ jsonrpc: "2.0";
337
+ id: string;
338
+ method: "server.mutation";
339
+ }, {
340
+ params: {
341
+ name: string;
342
+ args?: Record<string, unknown> | undefined;
343
+ };
344
+ jsonrpc: "2.0";
345
+ id: string;
346
+ method: "server.mutation";
347
+ }>;
348
+ export declare const ServerSubscribeRequestSchema: z.ZodObject<{
349
+ jsonrpc: z.ZodLiteral<"2.0">;
350
+ id: z.ZodString;
351
+ method: z.ZodLiteral<"server.subscribe">;
352
+ params: z.ZodObject<{
353
+ subscriptionId: z.ZodString;
354
+ name: z.ZodString;
355
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
356
+ }, "strip", z.ZodTypeAny, {
357
+ name: string;
358
+ subscriptionId: string;
359
+ args?: Record<string, unknown> | undefined;
360
+ }, {
361
+ name: string;
362
+ subscriptionId: string;
363
+ args?: Record<string, unknown> | undefined;
364
+ }>;
365
+ }, "strip", z.ZodTypeAny, {
366
+ params: {
367
+ name: string;
368
+ subscriptionId: string;
369
+ args?: Record<string, unknown> | undefined;
370
+ };
371
+ jsonrpc: "2.0";
372
+ id: string;
373
+ method: "server.subscribe";
374
+ }, {
375
+ params: {
376
+ name: string;
377
+ subscriptionId: string;
378
+ args?: Record<string, unknown> | undefined;
379
+ };
380
+ jsonrpc: "2.0";
381
+ id: string;
382
+ method: "server.subscribe";
383
+ }>;
384
+ export declare const ServerUnsubscribeRequestSchema: z.ZodObject<{
385
+ jsonrpc: z.ZodLiteral<"2.0">;
386
+ id: z.ZodString;
387
+ method: z.ZodLiteral<"server.unsubscribe">;
388
+ params: z.ZodObject<{
389
+ subscriptionId: z.ZodString;
390
+ }, "strip", z.ZodTypeAny, {
391
+ subscriptionId: string;
392
+ }, {
393
+ subscriptionId: string;
394
+ }>;
395
+ }, "strip", z.ZodTypeAny, {
396
+ params: {
397
+ subscriptionId: string;
398
+ };
399
+ jsonrpc: "2.0";
400
+ id: string;
401
+ method: "server.unsubscribe";
402
+ }, {
403
+ params: {
404
+ subscriptionId: string;
405
+ };
406
+ jsonrpc: "2.0";
407
+ id: string;
408
+ method: "server.unsubscribe";
409
+ }>;
233
410
  export declare const EventCallbackNotificationSchema: z.ZodObject<{
234
411
  jsonrpc: z.ZodLiteral<"2.0">;
235
412
  method: z.ZodLiteral<"event.callback">;
@@ -237,23 +414,23 @@ export declare const EventCallbackNotificationSchema: z.ZodObject<{
237
414
  handlerId: z.ZodString;
238
415
  args: z.ZodArray<z.ZodUnknown, "many">;
239
416
  }, "strip", z.ZodTypeAny, {
240
- handlerId: string;
241
417
  args: unknown[];
242
- }, {
243
418
  handlerId: string;
419
+ }, {
244
420
  args: unknown[];
421
+ handlerId: string;
245
422
  }>;
246
423
  }, "strip", z.ZodTypeAny, {
247
424
  params: {
248
- handlerId: string;
249
425
  args: unknown[];
426
+ handlerId: string;
250
427
  };
251
428
  jsonrpc: "2.0";
252
429
  method: "event.callback";
253
430
  }, {
254
431
  params: {
255
- handlerId: string;
256
432
  args: unknown[];
433
+ handlerId: string;
257
434
  };
258
435
  jsonrpc: "2.0";
259
436
  method: "event.callback";
@@ -332,6 +509,67 @@ export declare const StorageUpdateNotificationSchema: z.ZodObject<{
332
509
  jsonrpc: "2.0";
333
510
  method: "storage.update";
334
511
  }>;
512
+ export declare const ServerSubscriptionUpdateNotificationSchema: z.ZodObject<{
513
+ jsonrpc: z.ZodLiteral<"2.0">;
514
+ method: z.ZodLiteral<"server.subscription.update">;
515
+ params: z.ZodObject<{
516
+ subscriptionId: z.ZodString;
517
+ data: z.ZodUnknown;
518
+ }, "strip", z.ZodTypeAny, {
519
+ subscriptionId: string;
520
+ data?: unknown;
521
+ }, {
522
+ subscriptionId: string;
523
+ data?: unknown;
524
+ }>;
525
+ }, "strip", z.ZodTypeAny, {
526
+ params: {
527
+ subscriptionId: string;
528
+ data?: unknown;
529
+ };
530
+ jsonrpc: "2.0";
531
+ method: "server.subscription.update";
532
+ }, {
533
+ params: {
534
+ subscriptionId: string;
535
+ data?: unknown;
536
+ };
537
+ jsonrpc: "2.0";
538
+ method: "server.subscription.update";
539
+ }>;
540
+ export declare const ServerSubscriptionErrorNotificationSchema: z.ZodObject<{
541
+ jsonrpc: z.ZodLiteral<"2.0">;
542
+ method: z.ZodLiteral<"server.subscription.error">;
543
+ params: z.ZodObject<{
544
+ subscriptionId: z.ZodString;
545
+ error: z.ZodString;
546
+ message: z.ZodString;
547
+ }, "strip", z.ZodTypeAny, {
548
+ message: string;
549
+ error: string;
550
+ subscriptionId: string;
551
+ }, {
552
+ message: string;
553
+ error: string;
554
+ subscriptionId: string;
555
+ }>;
556
+ }, "strip", z.ZodTypeAny, {
557
+ params: {
558
+ message: string;
559
+ error: string;
560
+ subscriptionId: string;
561
+ };
562
+ jsonrpc: "2.0";
563
+ method: "server.subscription.error";
564
+ }, {
565
+ params: {
566
+ message: string;
567
+ error: string;
568
+ subscriptionId: string;
569
+ };
570
+ jsonrpc: "2.0";
571
+ method: "server.subscription.error";
572
+ }>;
335
573
  export declare const SandboxToHostMessageSchema: z.ZodDiscriminatedUnion<"method", [z.ZodObject<{
336
574
  jsonrpc: z.ZodLiteral<"2.0">;
337
575
  method: z.ZodLiteral<"ui.render">;
@@ -413,6 +651,126 @@ export declare const SandboxToHostMessageSchema: z.ZodDiscriminatedUnion<"method
413
651
  jsonrpc: "2.0";
414
652
  id: string;
415
653
  method: "storage.set";
654
+ }>, z.ZodObject<{
655
+ jsonrpc: z.ZodLiteral<"2.0">;
656
+ id: z.ZodString;
657
+ method: z.ZodLiteral<"server.query">;
658
+ params: z.ZodObject<{
659
+ name: z.ZodString;
660
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
661
+ }, "strip", z.ZodTypeAny, {
662
+ name: string;
663
+ args?: Record<string, unknown> | undefined;
664
+ }, {
665
+ name: string;
666
+ args?: Record<string, unknown> | undefined;
667
+ }>;
668
+ }, "strip", z.ZodTypeAny, {
669
+ params: {
670
+ name: string;
671
+ args?: Record<string, unknown> | undefined;
672
+ };
673
+ jsonrpc: "2.0";
674
+ id: string;
675
+ method: "server.query";
676
+ }, {
677
+ params: {
678
+ name: string;
679
+ args?: Record<string, unknown> | undefined;
680
+ };
681
+ jsonrpc: "2.0";
682
+ id: string;
683
+ method: "server.query";
684
+ }>, z.ZodObject<{
685
+ jsonrpc: z.ZodLiteral<"2.0">;
686
+ id: z.ZodString;
687
+ method: z.ZodLiteral<"server.mutation">;
688
+ params: z.ZodObject<{
689
+ name: z.ZodString;
690
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
691
+ }, "strip", z.ZodTypeAny, {
692
+ name: string;
693
+ args?: Record<string, unknown> | undefined;
694
+ }, {
695
+ name: string;
696
+ args?: Record<string, unknown> | undefined;
697
+ }>;
698
+ }, "strip", z.ZodTypeAny, {
699
+ params: {
700
+ name: string;
701
+ args?: Record<string, unknown> | undefined;
702
+ };
703
+ jsonrpc: "2.0";
704
+ id: string;
705
+ method: "server.mutation";
706
+ }, {
707
+ params: {
708
+ name: string;
709
+ args?: Record<string, unknown> | undefined;
710
+ };
711
+ jsonrpc: "2.0";
712
+ id: string;
713
+ method: "server.mutation";
714
+ }>, z.ZodObject<{
715
+ jsonrpc: z.ZodLiteral<"2.0">;
716
+ id: z.ZodString;
717
+ method: z.ZodLiteral<"server.subscribe">;
718
+ params: z.ZodObject<{
719
+ subscriptionId: z.ZodString;
720
+ name: z.ZodString;
721
+ args: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
722
+ }, "strip", z.ZodTypeAny, {
723
+ name: string;
724
+ subscriptionId: string;
725
+ args?: Record<string, unknown> | undefined;
726
+ }, {
727
+ name: string;
728
+ subscriptionId: string;
729
+ args?: Record<string, unknown> | undefined;
730
+ }>;
731
+ }, "strip", z.ZodTypeAny, {
732
+ params: {
733
+ name: string;
734
+ subscriptionId: string;
735
+ args?: Record<string, unknown> | undefined;
736
+ };
737
+ jsonrpc: "2.0";
738
+ id: string;
739
+ method: "server.subscribe";
740
+ }, {
741
+ params: {
742
+ name: string;
743
+ subscriptionId: string;
744
+ args?: Record<string, unknown> | undefined;
745
+ };
746
+ jsonrpc: "2.0";
747
+ id: string;
748
+ method: "server.subscribe";
749
+ }>, z.ZodObject<{
750
+ jsonrpc: z.ZodLiteral<"2.0">;
751
+ id: z.ZodString;
752
+ method: z.ZodLiteral<"server.unsubscribe">;
753
+ params: z.ZodObject<{
754
+ subscriptionId: z.ZodString;
755
+ }, "strip", z.ZodTypeAny, {
756
+ subscriptionId: string;
757
+ }, {
758
+ subscriptionId: string;
759
+ }>;
760
+ }, "strip", z.ZodTypeAny, {
761
+ params: {
762
+ subscriptionId: string;
763
+ };
764
+ jsonrpc: "2.0";
765
+ id: string;
766
+ method: "server.unsubscribe";
767
+ }, {
768
+ params: {
769
+ subscriptionId: string;
770
+ };
771
+ jsonrpc: "2.0";
772
+ id: string;
773
+ method: "server.unsubscribe";
416
774
  }>]>;
417
775
  export declare const HostToSandboxMessageSchema: z.ZodDiscriminatedUnion<"method", [z.ZodObject<{
418
776
  jsonrpc: z.ZodLiteral<"2.0">;
@@ -421,23 +779,23 @@ export declare const HostToSandboxMessageSchema: z.ZodDiscriminatedUnion<"method
421
779
  handlerId: z.ZodString;
422
780
  args: z.ZodArray<z.ZodUnknown, "many">;
423
781
  }, "strip", z.ZodTypeAny, {
424
- handlerId: string;
425
782
  args: unknown[];
426
- }, {
427
783
  handlerId: string;
784
+ }, {
428
785
  args: unknown[];
786
+ handlerId: string;
429
787
  }>;
430
788
  }, "strip", z.ZodTypeAny, {
431
789
  params: {
432
- handlerId: string;
433
790
  args: unknown[];
791
+ handlerId: string;
434
792
  };
435
793
  jsonrpc: "2.0";
436
794
  method: "event.callback";
437
795
  }, {
438
796
  params: {
439
- handlerId: string;
440
797
  args: unknown[];
798
+ handlerId: string;
441
799
  };
442
800
  jsonrpc: "2.0";
443
801
  method: "event.callback";
@@ -512,6 +870,65 @@ export declare const HostToSandboxMessageSchema: z.ZodDiscriminatedUnion<"method
512
870
  };
513
871
  jsonrpc: "2.0";
514
872
  method: "storage.update";
873
+ }>, z.ZodObject<{
874
+ jsonrpc: z.ZodLiteral<"2.0">;
875
+ method: z.ZodLiteral<"server.subscription.update">;
876
+ params: z.ZodObject<{
877
+ subscriptionId: z.ZodString;
878
+ data: z.ZodUnknown;
879
+ }, "strip", z.ZodTypeAny, {
880
+ subscriptionId: string;
881
+ data?: unknown;
882
+ }, {
883
+ subscriptionId: string;
884
+ data?: unknown;
885
+ }>;
886
+ }, "strip", z.ZodTypeAny, {
887
+ params: {
888
+ subscriptionId: string;
889
+ data?: unknown;
890
+ };
891
+ jsonrpc: "2.0";
892
+ method: "server.subscription.update";
893
+ }, {
894
+ params: {
895
+ subscriptionId: string;
896
+ data?: unknown;
897
+ };
898
+ jsonrpc: "2.0";
899
+ method: "server.subscription.update";
900
+ }>, z.ZodObject<{
901
+ jsonrpc: z.ZodLiteral<"2.0">;
902
+ method: z.ZodLiteral<"server.subscription.error">;
903
+ params: z.ZodObject<{
904
+ subscriptionId: z.ZodString;
905
+ error: z.ZodString;
906
+ message: z.ZodString;
907
+ }, "strip", z.ZodTypeAny, {
908
+ message: string;
909
+ error: string;
910
+ subscriptionId: string;
911
+ }, {
912
+ message: string;
913
+ error: string;
914
+ subscriptionId: string;
915
+ }>;
916
+ }, "strip", z.ZodTypeAny, {
917
+ params: {
918
+ message: string;
919
+ error: string;
920
+ subscriptionId: string;
921
+ };
922
+ jsonrpc: "2.0";
923
+ method: "server.subscription.error";
924
+ }, {
925
+ params: {
926
+ message: string;
927
+ error: string;
928
+ subscriptionId: string;
929
+ };
930
+ jsonrpc: "2.0";
931
+ method: "server.subscription.error";
515
932
  }>]>;
516
933
  export declare function parseSandboxToHostMessage(data: unknown): SandboxToHostMessage;
517
934
  export declare function parseHostToSandboxMessage(data: unknown): HostToSandboxMessage;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/messages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CAC3D,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,eAAe,GAAG,mBAAmB,CAAC;AAMpF,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE;QAAE,IAAI,EAAE,OAAO,wBAAwB,EAAE,mBAAmB,EAAE,CAAA;KAAE,CAAC;CAC1E,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE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eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUrC,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;;;;;;EAG7C,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;EAM1C,CAAC;AAEH,eAAO,MAAM,0CAA0C;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOrD,CAAC;AAEH,eAAO,MAAM,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQpD,CAAC;AAMH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IASrC,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAOrC,CAAC;AAMH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,OAAO,GAAG,oBAAoB,CAE7E;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,OAAO,GAAG,oBAAoB,CAE7E"}
@@ -56,6 +56,42 @@ export const StorageSetRequestSchema = z.object({
56
56
  data: z.record(z.unknown()),
57
57
  }),
58
58
  });
59
+ export const ServerQueryRequestSchema = z.object({
60
+ jsonrpc: z.literal("2.0"),
61
+ id: z.string(),
62
+ method: z.literal("server.query"),
63
+ params: z.object({
64
+ name: z.string(),
65
+ args: z.record(z.unknown()).optional(),
66
+ }),
67
+ });
68
+ export const ServerMutationRequestSchema = z.object({
69
+ jsonrpc: z.literal("2.0"),
70
+ id: z.string(),
71
+ method: z.literal("server.mutation"),
72
+ params: z.object({
73
+ name: z.string(),
74
+ args: z.record(z.unknown()).optional(),
75
+ }),
76
+ });
77
+ export const ServerSubscribeRequestSchema = z.object({
78
+ jsonrpc: z.literal("2.0"),
79
+ id: z.string(),
80
+ method: z.literal("server.subscribe"),
81
+ params: z.object({
82
+ subscriptionId: z.string(),
83
+ name: z.string(),
84
+ args: z.record(z.unknown()).optional(),
85
+ }),
86
+ });
87
+ export const ServerUnsubscribeRequestSchema = z.object({
88
+ jsonrpc: z.literal("2.0"),
89
+ id: z.string(),
90
+ method: z.literal("server.unsubscribe"),
91
+ params: z.object({
92
+ subscriptionId: z.string(),
93
+ }),
94
+ });
59
95
  // ---------------------------------------------------------------------------
60
96
  // Zod schemas – Host → Sandbox
61
97
  // ---------------------------------------------------------------------------
@@ -89,6 +125,23 @@ export const StorageUpdateNotificationSchema = z.object({
89
125
  storage: z.record(z.unknown()),
90
126
  }),
91
127
  });
128
+ export const ServerSubscriptionUpdateNotificationSchema = z.object({
129
+ jsonrpc: z.literal("2.0"),
130
+ method: z.literal("server.subscription.update"),
131
+ params: z.object({
132
+ subscriptionId: z.string(),
133
+ data: z.unknown(),
134
+ }),
135
+ });
136
+ export const ServerSubscriptionErrorNotificationSchema = z.object({
137
+ jsonrpc: z.literal("2.0"),
138
+ method: z.literal("server.subscription.error"),
139
+ params: z.object({
140
+ subscriptionId: z.string(),
141
+ error: z.string(),
142
+ message: z.string(),
143
+ }),
144
+ });
92
145
  // ---------------------------------------------------------------------------
93
146
  // Discriminated union schemas
94
147
  // ---------------------------------------------------------------------------
@@ -97,12 +150,18 @@ export const SandboxToHostMessageSchema = z.discriminatedUnion("method", [
97
150
  UIReadyNotificationSchema,
98
151
  StorageGetRequestSchema,
99
152
  StorageSetRequestSchema,
153
+ ServerQueryRequestSchema,
154
+ ServerMutationRequestSchema,
155
+ ServerSubscribeRequestSchema,
156
+ ServerUnsubscribeRequestSchema,
100
157
  ]);
101
158
  export const HostToSandboxMessageSchema = z.discriminatedUnion("method", [
102
159
  EventCallbackNotificationSchema,
103
160
  LifecycleInitRequestSchema,
104
161
  LifecycleDestroyNotificationSchema,
105
162
  StorageUpdateNotificationSchema,
163
+ ServerSubscriptionUpdateNotificationSchema,
164
+ ServerSubscriptionErrorNotificationSchema,
106
165
  ]);
107
166
  // ---------------------------------------------------------------------------
108
167
  // Parsers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1upvision/protocol",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Wire protocol types and Zod schemas for the Vision extension platform",
5
5
  "type": "module",
6
6
  "exports": {