@av-pi-studio/protocol 0.0.105 → 0.0.107

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/messages.js CHANGED
@@ -953,6 +953,85 @@ export const providerAuthLogoutResponseSchema = z
953
953
  })
954
954
  .passthrough();
955
955
  // ===========================================================================
956
+ // Viewer settings (docs/MOLVIEWER_DECOUPLING.md § 4.4) — additive, new in sprint-073
957
+ //
958
+ // Durable, multi-client, per-viewer enable/disable state, owned by the daemon (not
959
+ // `localStorage`) so a phone over the relay and a desktop browser talking to the same daemon
960
+ // never disagree about which viewers exist. Real `sessionMessageSchema` union members — the
961
+ // `provider_auth_*` posture — not the `sessionMessageBaseSchema` passthrough fallback used by
962
+ // `checkout_status_update` / `file_changed` / `provider_auth_flow_event`, because the push
963
+ // (`viewer_settings_update`) carries the same durable document the RPCs do and every client
964
+ // parses it on a hot path (unlike `provider_auth_flow_event`, which stays a passthrough push).
965
+ //
966
+ // The daemon has zero plugin knowledge: `viewers` is an open record keyed by whatever id a
967
+ // client sends (no enum, ever), and `config` is an opaque `z.unknown()` blob it never interprets
968
+ // — same posture as `agent_ui_request`'s `payload`.
969
+ // ===========================================================================
970
+ export const viewerSettingsEntrySchema = z
971
+ .object({
972
+ enabled: z.boolean(),
973
+ config: z.record(z.string(), z.unknown()).optional(),
974
+ })
975
+ .passthrough();
976
+ export const viewerSettingsSchema = z
977
+ .object({
978
+ version: z.literal(1).default(1),
979
+ viewers: z.record(z.string(), viewerSettingsEntrySchema).default({}),
980
+ })
981
+ .passthrough();
982
+ export const viewerSettingsGetRequestSchema = z
983
+ .object({
984
+ type: z.literal("viewer_settings_get_request"),
985
+ requestId: z.string(),
986
+ })
987
+ .passthrough();
988
+ export const viewerSettingsGetResponseSchema = z
989
+ .object({
990
+ type: z.literal("viewer_settings_get_response"),
991
+ requestId: z.string(),
992
+ payload: z
993
+ .object({
994
+ settings: viewerSettingsSchema,
995
+ })
996
+ .passthrough(),
997
+ })
998
+ .passthrough();
999
+ /** A patch entry's fields are both optional — a config-only patch must not have to restate
1000
+ * `enabled`, and vice versa. Deliberately not a reuse of `viewerSettingsEntrySchema`, whose
1001
+ * `enabled` is required. */
1002
+ export const viewerSettingsPatchEntrySchema = z
1003
+ .object({
1004
+ enabled: z.boolean().optional(),
1005
+ config: z.record(z.string(), z.unknown()).optional(),
1006
+ })
1007
+ .passthrough();
1008
+ export const viewerSettingsSetRequestSchema = z
1009
+ .object({
1010
+ type: z.literal("viewer_settings_set_request"),
1011
+ requestId: z.string(),
1012
+ patch: z.record(z.string(), viewerSettingsPatchEntrySchema),
1013
+ })
1014
+ .passthrough();
1015
+ /** `payload.settings` is the effective document after the merge, not an echo of the patch. */
1016
+ export const viewerSettingsSetResponseSchema = z
1017
+ .object({
1018
+ type: z.literal("viewer_settings_set_response"),
1019
+ requestId: z.string(),
1020
+ payload: z
1021
+ .object({
1022
+ settings: viewerSettingsSchema,
1023
+ })
1024
+ .passthrough(),
1025
+ })
1026
+ .passthrough();
1027
+ /** Broadcast, no `requestId` — every connected client refreshes its cached document. */
1028
+ export const viewerSettingsUpdateSchema = z
1029
+ .object({
1030
+ type: z.literal("viewer_settings_update"),
1031
+ settings: viewerSettingsSchema,
1032
+ })
1033
+ .passthrough();
1034
+ // ===========================================================================
956
1035
  // Extension UI (features/extension-ui-rpc.md) — additive, new in sprint-066
957
1036
  // ===========================================================================
958
1037
  /**
@@ -1157,6 +1236,11 @@ export const sessionMessageSchema = z.discriminatedUnion("type", [
1157
1236
  providerAuthCancelResponseSchema,
1158
1237
  providerAuthLogoutRequestSchema,
1159
1238
  providerAuthLogoutResponseSchema,
1239
+ viewerSettingsGetRequestSchema,
1240
+ viewerSettingsGetResponseSchema,
1241
+ viewerSettingsSetRequestSchema,
1242
+ viewerSettingsSetResponseSchema,
1243
+ viewerSettingsUpdateSchema,
1160
1244
  agentUiRequestSchema,
1161
1245
  agentUiResolvedSchema,
1162
1246
  agentUiRespondRequestSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@av-pi-studio/protocol",
3
- "version": "0.0.105",
3
+ "version": "0.0.107",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.map",