@proxyhuman/protocol 0.2.2 → 0.2.3

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/index.cjs CHANGED
@@ -151,7 +151,15 @@ var SessionEventSchema = import_zod.z.discriminatedUnion("type", [
151
151
  viewerCount: import_zod.z.number().int(),
152
152
  viewer: ViewerInfoSchema.optional()
153
153
  }),
154
- import_zod.z.object({ ts: import_zod.z.number(), type: import_zod.z.literal("action_recorded"), action: RecordedActionSchema }),
154
+ import_zod.z.object({
155
+ ts: import_zod.z.number(),
156
+ type: import_zod.z.literal("action_recorded"),
157
+ action: RecordedActionSchema,
158
+ /** The viewer that performed this action. Optional for backward
159
+ * compatibility with events recorded before per-action attribution
160
+ * was added. */
161
+ viewer: ViewerInfoSchema.optional()
162
+ }),
155
163
  import_zod.z.object({ ts: import_zod.z.number(), type: import_zod.z.literal("error"), message: import_zod.z.string(), detail: import_zod.z.string().optional() })
156
164
  ]);
157
165
  var NewSessionSchema = import_zod.z.object({
package/dist/index.d.cts CHANGED
@@ -587,6 +587,23 @@ declare const SessionEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
587
587
  type: "human_done";
588
588
  ts: number;
589
589
  }>]>;
590
+ /** The viewer that performed this action. Optional for backward
591
+ * compatibility with events recorded before per-action attribution
592
+ * was added. */
593
+ viewer: z.ZodOptional<z.ZodObject<{
594
+ /** Random opaque id; persisted as the `ph_device` cookie on the viewer. */
595
+ deviceId: z.ZodNullable<z.ZodString>;
596
+ userAgent: z.ZodNullable<z.ZodString>;
597
+ ip: z.ZodNullable<z.ZodString>;
598
+ }, "strip", z.ZodTypeAny, {
599
+ userAgent: string | null;
600
+ deviceId: string | null;
601
+ ip: string | null;
602
+ }, {
603
+ userAgent: string | null;
604
+ deviceId: string | null;
605
+ ip: string | null;
606
+ }>>;
590
607
  }, "strip", z.ZodTypeAny, {
591
608
  type: "action_recorded";
592
609
  ts: number;
@@ -638,6 +655,11 @@ declare const SessionEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
638
655
  type: "human_done";
639
656
  ts: number;
640
657
  };
658
+ viewer?: {
659
+ userAgent: string | null;
660
+ deviceId: string | null;
661
+ ip: string | null;
662
+ } | undefined;
641
663
  }, {
642
664
  type: "action_recorded";
643
665
  ts: number;
@@ -689,6 +711,11 @@ declare const SessionEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
689
711
  type: "human_done";
690
712
  ts: number;
691
713
  };
714
+ viewer?: {
715
+ userAgent: string | null;
716
+ deviceId: string | null;
717
+ ip: string | null;
718
+ } | undefined;
692
719
  }>, z.ZodObject<{
693
720
  ts: z.ZodNumber;
694
721
  type: z.ZodLiteral<"error">;
@@ -2892,6 +2919,23 @@ declare const SessionDetailResponseSchema: z.ZodObject<{
2892
2919
  type: "human_done";
2893
2920
  ts: number;
2894
2921
  }>]>;
2922
+ /** The viewer that performed this action. Optional for backward
2923
+ * compatibility with events recorded before per-action attribution
2924
+ * was added. */
2925
+ viewer: z.ZodOptional<z.ZodObject<{
2926
+ /** Random opaque id; persisted as the `ph_device` cookie on the viewer. */
2927
+ deviceId: z.ZodNullable<z.ZodString>;
2928
+ userAgent: z.ZodNullable<z.ZodString>;
2929
+ ip: z.ZodNullable<z.ZodString>;
2930
+ }, "strip", z.ZodTypeAny, {
2931
+ userAgent: string | null;
2932
+ deviceId: string | null;
2933
+ ip: string | null;
2934
+ }, {
2935
+ userAgent: string | null;
2936
+ deviceId: string | null;
2937
+ ip: string | null;
2938
+ }>>;
2895
2939
  }, "strip", z.ZodTypeAny, {
2896
2940
  type: "action_recorded";
2897
2941
  ts: number;
@@ -2943,6 +2987,11 @@ declare const SessionDetailResponseSchema: z.ZodObject<{
2943
2987
  type: "human_done";
2944
2988
  ts: number;
2945
2989
  };
2990
+ viewer?: {
2991
+ userAgent: string | null;
2992
+ deviceId: string | null;
2993
+ ip: string | null;
2994
+ } | undefined;
2946
2995
  }, {
2947
2996
  type: "action_recorded";
2948
2997
  ts: number;
@@ -2994,6 +3043,11 @@ declare const SessionDetailResponseSchema: z.ZodObject<{
2994
3043
  type: "human_done";
2995
3044
  ts: number;
2996
3045
  };
3046
+ viewer?: {
3047
+ userAgent: string | null;
3048
+ deviceId: string | null;
3049
+ ip: string | null;
3050
+ } | undefined;
2997
3051
  }>, z.ZodObject<{
2998
3052
  ts: z.ZodNumber;
2999
3053
  type: z.ZodLiteral<"error">;
@@ -3322,6 +3376,11 @@ declare const SessionDetailResponseSchema: z.ZodObject<{
3322
3376
  type: "human_done";
3323
3377
  ts: number;
3324
3378
  };
3379
+ viewer?: {
3380
+ userAgent: string | null;
3381
+ deviceId: string | null;
3382
+ ip: string | null;
3383
+ } | undefined;
3325
3384
  } | {
3326
3385
  message: string;
3327
3386
  type: "error";
@@ -3497,6 +3556,11 @@ declare const SessionDetailResponseSchema: z.ZodObject<{
3497
3556
  type: "human_done";
3498
3557
  ts: number;
3499
3558
  };
3559
+ viewer?: {
3560
+ userAgent: string | null;
3561
+ deviceId: string | null;
3562
+ ip: string | null;
3563
+ } | undefined;
3500
3564
  } | {
3501
3565
  message: string;
3502
3566
  type: "error";
package/dist/index.d.ts CHANGED
@@ -587,6 +587,23 @@ declare const SessionEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
587
587
  type: "human_done";
588
588
  ts: number;
589
589
  }>]>;
590
+ /** The viewer that performed this action. Optional for backward
591
+ * compatibility with events recorded before per-action attribution
592
+ * was added. */
593
+ viewer: z.ZodOptional<z.ZodObject<{
594
+ /** Random opaque id; persisted as the `ph_device` cookie on the viewer. */
595
+ deviceId: z.ZodNullable<z.ZodString>;
596
+ userAgent: z.ZodNullable<z.ZodString>;
597
+ ip: z.ZodNullable<z.ZodString>;
598
+ }, "strip", z.ZodTypeAny, {
599
+ userAgent: string | null;
600
+ deviceId: string | null;
601
+ ip: string | null;
602
+ }, {
603
+ userAgent: string | null;
604
+ deviceId: string | null;
605
+ ip: string | null;
606
+ }>>;
590
607
  }, "strip", z.ZodTypeAny, {
591
608
  type: "action_recorded";
592
609
  ts: number;
@@ -638,6 +655,11 @@ declare const SessionEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
638
655
  type: "human_done";
639
656
  ts: number;
640
657
  };
658
+ viewer?: {
659
+ userAgent: string | null;
660
+ deviceId: string | null;
661
+ ip: string | null;
662
+ } | undefined;
641
663
  }, {
642
664
  type: "action_recorded";
643
665
  ts: number;
@@ -689,6 +711,11 @@ declare const SessionEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
689
711
  type: "human_done";
690
712
  ts: number;
691
713
  };
714
+ viewer?: {
715
+ userAgent: string | null;
716
+ deviceId: string | null;
717
+ ip: string | null;
718
+ } | undefined;
692
719
  }>, z.ZodObject<{
693
720
  ts: z.ZodNumber;
694
721
  type: z.ZodLiteral<"error">;
@@ -2892,6 +2919,23 @@ declare const SessionDetailResponseSchema: z.ZodObject<{
2892
2919
  type: "human_done";
2893
2920
  ts: number;
2894
2921
  }>]>;
2922
+ /** The viewer that performed this action. Optional for backward
2923
+ * compatibility with events recorded before per-action attribution
2924
+ * was added. */
2925
+ viewer: z.ZodOptional<z.ZodObject<{
2926
+ /** Random opaque id; persisted as the `ph_device` cookie on the viewer. */
2927
+ deviceId: z.ZodNullable<z.ZodString>;
2928
+ userAgent: z.ZodNullable<z.ZodString>;
2929
+ ip: z.ZodNullable<z.ZodString>;
2930
+ }, "strip", z.ZodTypeAny, {
2931
+ userAgent: string | null;
2932
+ deviceId: string | null;
2933
+ ip: string | null;
2934
+ }, {
2935
+ userAgent: string | null;
2936
+ deviceId: string | null;
2937
+ ip: string | null;
2938
+ }>>;
2895
2939
  }, "strip", z.ZodTypeAny, {
2896
2940
  type: "action_recorded";
2897
2941
  ts: number;
@@ -2943,6 +2987,11 @@ declare const SessionDetailResponseSchema: z.ZodObject<{
2943
2987
  type: "human_done";
2944
2988
  ts: number;
2945
2989
  };
2990
+ viewer?: {
2991
+ userAgent: string | null;
2992
+ deviceId: string | null;
2993
+ ip: string | null;
2994
+ } | undefined;
2946
2995
  }, {
2947
2996
  type: "action_recorded";
2948
2997
  ts: number;
@@ -2994,6 +3043,11 @@ declare const SessionDetailResponseSchema: z.ZodObject<{
2994
3043
  type: "human_done";
2995
3044
  ts: number;
2996
3045
  };
3046
+ viewer?: {
3047
+ userAgent: string | null;
3048
+ deviceId: string | null;
3049
+ ip: string | null;
3050
+ } | undefined;
2997
3051
  }>, z.ZodObject<{
2998
3052
  ts: z.ZodNumber;
2999
3053
  type: z.ZodLiteral<"error">;
@@ -3322,6 +3376,11 @@ declare const SessionDetailResponseSchema: z.ZodObject<{
3322
3376
  type: "human_done";
3323
3377
  ts: number;
3324
3378
  };
3379
+ viewer?: {
3380
+ userAgent: string | null;
3381
+ deviceId: string | null;
3382
+ ip: string | null;
3383
+ } | undefined;
3325
3384
  } | {
3326
3385
  message: string;
3327
3386
  type: "error";
@@ -3497,6 +3556,11 @@ declare const SessionDetailResponseSchema: z.ZodObject<{
3497
3556
  type: "human_done";
3498
3557
  ts: number;
3499
3558
  };
3559
+ viewer?: {
3560
+ userAgent: string | null;
3561
+ deviceId: string | null;
3562
+ ip: string | null;
3563
+ } | undefined;
3500
3564
  } | {
3501
3565
  message: string;
3502
3566
  type: "error";
package/dist/index.js CHANGED
@@ -95,7 +95,15 @@ var SessionEventSchema = z.discriminatedUnion("type", [
95
95
  viewerCount: z.number().int(),
96
96
  viewer: ViewerInfoSchema.optional()
97
97
  }),
98
- z.object({ ts: z.number(), type: z.literal("action_recorded"), action: RecordedActionSchema }),
98
+ z.object({
99
+ ts: z.number(),
100
+ type: z.literal("action_recorded"),
101
+ action: RecordedActionSchema,
102
+ /** The viewer that performed this action. Optional for backward
103
+ * compatibility with events recorded before per-action attribution
104
+ * was added. */
105
+ viewer: ViewerInfoSchema.optional()
106
+ }),
99
107
  z.object({ ts: z.number(), type: z.literal("error"), message: z.string(), detail: z.string().optional() })
100
108
  ]);
101
109
  var NewSessionSchema = z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proxyhuman/protocol",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "ProxyHuman wire-format contract: WebSocket message types, REST response shapes, session lifecycle states. Consumed by @proxyhuman/mcp and the api-worker.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",