@reticlehq/core 2.14.0 → 3.1.0

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.
Files changed (143) hide show
  1. package/dist/{artifacts-entry.d.ts → artifacts/artifacts-entry.d.ts} +7 -7
  2. package/dist/{artifacts-entry.js → artifacts/artifacts-entry.js} +7 -7
  3. package/dist/artifacts/flow-composition.d.ts +30 -0
  4. package/dist/artifacts/flow-composition.js +19 -0
  5. package/dist/{flow-constants.d.ts → artifacts/flow-constants.d.ts} +89 -3
  6. package/dist/{flow-constants.js → artifacts/flow-constants.js} +95 -4
  7. package/dist/artifacts/flow-mutation-target.d.ts +39 -0
  8. package/dist/artifacts/flow-mutation-target.js +89 -0
  9. package/dist/artifacts/flow-order.d.ts +30 -0
  10. package/dist/artifacts/flow-order.js +49 -0
  11. package/dist/artifacts/flow-select.d.ts +56 -0
  12. package/dist/artifacts/flow-select.js +56 -0
  13. package/dist/artifacts/flow-step-tool.d.ts +31 -0
  14. package/dist/artifacts/flow-step-tool.js +31 -0
  15. package/dist/artifacts/flow-types.d.ts +3736 -0
  16. package/dist/artifacts/flow-types.js +463 -0
  17. package/dist/artifacts/flow-unreached.d.ts +12 -0
  18. package/dist/artifacts/flow-unreached.js +24 -0
  19. package/dist/{impact.d.ts → artifacts/impact.d.ts} +119 -103
  20. package/dist/{impact.js → artifacts/impact.js} +14 -5
  21. package/dist/{journal.d.ts → artifacts/journal.d.ts} +51 -7
  22. package/dist/{journal.js → artifacts/journal.js} +38 -2
  23. package/dist/artifacts/step-effect.d.ts +29 -0
  24. package/dist/artifacts/step-effect.js +28 -0
  25. package/dist/hooks/hook-events.d.ts +311 -0
  26. package/dist/hooks/hook-events.js +127 -0
  27. package/dist/hooks/hooks-entry.d.ts +9 -0
  28. package/dist/hooks/hooks-entry.js +9 -0
  29. package/dist/{brand.d.ts → identity/brand.d.ts} +7 -0
  30. package/dist/{contract-fingerprint.d.ts → identity/contract-fingerprint.d.ts} +21 -3
  31. package/dist/{contract-fingerprint.js → identity/contract-fingerprint.js} +22 -4
  32. package/dist/{document-identity.d.ts → identity/document-identity.d.ts} +4 -5
  33. package/dist/{document-identity.js → identity/document-identity.js} +4 -5
  34. package/dist/{source-constants.d.ts → identity/source-constants.d.ts} +4 -4
  35. package/dist/{source-constants.js → identity/source-constants.js} +4 -4
  36. package/dist/index.d.ts +56 -43
  37. package/dist/index.js +65 -45
  38. package/dist/onboarding.d.ts +114 -0
  39. package/dist/onboarding.js +141 -0
  40. package/dist/realm/registry.d.ts +212 -0
  41. package/dist/realm/registry.js +302 -0
  42. package/dist/{dev-server-registry.d.ts → registry/dev-server-registry.d.ts} +6 -7
  43. package/dist/{dev-server-registry.js → registry/dev-server-registry.js} +28 -19
  44. package/dist/{project-registry.d.ts → registry/project-registry.d.ts} +5 -5
  45. package/dist/{project-registry.js → registry/project-registry.js} +5 -5
  46. package/dist/schema/command-name.json +31 -0
  47. package/dist/schema/event-payloads.json +791 -0
  48. package/dist/schema/hello-message.json +70 -2
  49. package/dist/schema/reticle-message.json +70 -2
  50. package/dist/telemetry-entry.d.ts +1 -1
  51. package/dist/telemetry-entry.js +1 -1
  52. package/dist/telemetry-feedback.d.ts +15 -16
  53. package/dist/telemetry-feedback.js +11 -12
  54. package/dist/telemetry-license.d.ts +1 -1
  55. package/dist/telemetry-license.js +1 -1
  56. package/dist/telemetry-refusal.d.ts +11 -11
  57. package/dist/telemetry-refusal.js +7 -8
  58. package/dist/telemetry-session.d.ts +51 -59
  59. package/dist/telemetry-session.js +47 -55
  60. package/dist/telemetry.d.ts +243 -214
  61. package/dist/telemetry.js +83 -98
  62. package/dist/tour-entry.d.ts +10 -0
  63. package/dist/tour-entry.js +10 -0
  64. package/dist/tour.d.ts +125 -0
  65. package/dist/tour.js +165 -0
  66. package/dist/{consequence.d.ts → verdict/consequence.d.ts} +32 -15
  67. package/dist/{consequence.js → verdict/consequence.js} +9 -31
  68. package/dist/{finding-fingerprint.js → verdict/finding-fingerprint.js} +1 -1
  69. package/dist/{findings.d.ts → verdict/findings.d.ts} +86 -39
  70. package/dist/{findings.js → verdict/findings.js} +103 -49
  71. package/dist/{instrumentation-gap.d.ts → verdict/instrumentation-gap.d.ts} +7 -14
  72. package/dist/{instrumentation-gap.js → verdict/instrumentation-gap.js} +7 -15
  73. package/dist/{intent.d.ts → verdict/intent.d.ts} +35 -46
  74. package/dist/{intent.js → verdict/intent.js} +11 -22
  75. package/dist/verdict/revision.d.ts +44 -0
  76. package/dist/verdict/revision.js +53 -0
  77. package/dist/{run-context.d.ts → verdict/run-context.d.ts} +13 -34
  78. package/dist/{run-context.js → verdict/run-context.js} +15 -36
  79. package/dist/{security.js → verdict/security.js} +12 -21
  80. package/dist/{verification-run.d.ts → verdict/verification-run.d.ts} +381 -105
  81. package/dist/{verification-run.js → verdict/verification-run.js} +157 -21
  82. package/dist/{verified-constants.d.ts → verdict/verified-constants.d.ts} +25 -13
  83. package/dist/{verified-constants.js → verdict/verified-constants.js} +25 -13
  84. package/dist/{verify-progress.d.ts → verdict/verify-progress.d.ts} +18 -22
  85. package/dist/{verify-progress.js → verdict/verify-progress.js} +6 -10
  86. package/dist/wire/channel.d.ts +46 -0
  87. package/dist/wire/channel.js +95 -0
  88. package/dist/{constants.d.ts → wire/constants/constants.d.ts} +91 -28
  89. package/dist/{constants.js → wire/constants/constants.js} +105 -28
  90. package/dist/{session-constants.d.ts → wire/constants/session-constants.d.ts} +9 -2
  91. package/dist/{session-constants.js → wire/constants/session-constants.js} +9 -2
  92. package/dist/{desktop-contract.js → wire/desktop-contract.js} +1 -1
  93. package/dist/{event-classification.js → wire/event-classification.js} +1 -1
  94. package/dist/{event-payloads.d.ts → wire/event-payloads.d.ts} +68 -13
  95. package/dist/{event-payloads.js → wire/event-payloads.js} +21 -3
  96. package/dist/{event-priority.d.ts → wire/event-priority.d.ts} +1 -4
  97. package/dist/{event-priority.js → wire/event-priority.js} +2 -5
  98. package/dist/{global-press.js → wire/global-press.js} +1 -1
  99. package/dist/{messages.d.ts → wire/messages.d.ts} +239 -48
  100. package/dist/{messages.js → wire/messages.js} +68 -5
  101. package/dist/wire/narrow.d.ts +39 -0
  102. package/dist/wire/narrow.js +45 -0
  103. package/dist/{net.d.ts → wire/net.d.ts} +12 -13
  104. package/dist/{net.js → wire/net.js} +12 -13
  105. package/dist/wire/platform.d.ts +37 -0
  106. package/dist/wire/platform.js +36 -0
  107. package/dist/{redaction.js → wire/redaction.js} +12 -12
  108. package/dist/wire/tool-names.d.ts +133 -0
  109. package/dist/wire/tool-names.js +142 -0
  110. package/dist/{toon.js → wire/toon.js} +1 -1
  111. package/dist/{types.d.ts → wire/types.d.ts} +77 -76
  112. package/dist/{types.js → wire/types.js} +4 -3
  113. package/dist/{no-session-reason.d.ts → words/no-session-reason.d.ts} +7 -3
  114. package/dist/{no-session-reason.js → words/no-session-reason.js} +7 -3
  115. package/dist/{notices.d.ts → words/notices.d.ts} +8 -12
  116. package/dist/{notices.js → words/notices.js} +8 -12
  117. package/package.json +16 -7
  118. package/dist/flow-types.d.ts +0 -1711
  119. package/dist/flow-types.js +0 -247
  120. package/dist/{impact-savings.d.ts → artifacts/impact-savings.d.ts} +0 -0
  121. package/dist/{impact-savings.js → artifacts/impact-savings.js} +0 -0
  122. package/dist/{brand.js → identity/brand.js} +0 -0
  123. package/dist/{edit-epoch.d.ts → identity/edit-epoch.d.ts} +0 -0
  124. package/dist/{edit-epoch.js → identity/edit-epoch.js} +0 -0
  125. package/dist/{project-id.d.ts → identity/project-id.d.ts} +0 -0
  126. package/dist/{project-id.js → identity/project-id.js} +0 -0
  127. package/dist/{daemon-registry.d.ts → registry/daemon-registry.d.ts} +0 -0
  128. package/dist/{daemon-registry.js → registry/daemon-registry.js} +0 -0
  129. package/dist/{finding-fingerprint.d.ts → verdict/finding-fingerprint.d.ts} +0 -0
  130. package/dist/{security.d.ts → verdict/security.d.ts} +0 -0
  131. package/dist/{desktop-contract.d.ts → wire/desktop-contract.d.ts} +0 -0
  132. package/dist/{event-classification.d.ts → wire/event-classification.d.ts} +0 -0
  133. package/dist/{global-press.d.ts → wire/global-press.d.ts} +0 -0
  134. package/dist/{redaction.d.ts → wire/redaction.d.ts} +0 -0
  135. package/dist/{state-select.d.ts → wire/state-select.d.ts} +0 -0
  136. package/dist/{state-select.js → wire/state-select.js} +0 -0
  137. package/dist/{toon.d.ts → wire/toon.d.ts} +0 -0
  138. package/dist/{browser-misdirect.d.ts → words/browser-misdirect.d.ts} +0 -0
  139. package/dist/{browser-misdirect.js → words/browser-misdirect.js} +0 -0
  140. package/dist/{unreachable-notice.d.ts → words/unreachable-notice.d.ts} +0 -0
  141. package/dist/{unreachable-notice.js → words/unreachable-notice.js} +0 -0
  142. package/dist/{upgrade.d.ts → words/upgrade.d.ts} +2 -2
  143. /package/dist/{upgrade.js → words/upgrade.js} +0 -0
@@ -10,13 +10,14 @@ export declare const HumanControlDataSchema: z.ZodObject<{
10
10
  readonly END: "end";
11
11
  readonly MESSAGE: "message";
12
12
  readonly REPLAY: "replay";
13
+ readonly SYNC: "sync";
13
14
  }>;
14
15
  text: z.ZodOptional<z.ZodString>;
15
16
  }, "strip", z.ZodTypeAny, {
16
- kind: "message" | "pause" | "resume" | "end" | "replay";
17
+ kind: "message" | "pause" | "resume" | "end" | "replay" | "sync";
17
18
  text?: string | undefined;
18
19
  }, {
19
- kind: "message" | "pause" | "resume" | "end" | "replay";
20
+ kind: "message" | "pause" | "resume" | "end" | "replay" | "sync";
20
21
  text?: string | undefined;
21
22
  }>;
22
23
  export type HumanControlData = z.infer<typeof HumanControlDataSchema>;
@@ -55,25 +56,25 @@ export declare const HumanMarkDataSchema: z.ZodObject<{
55
56
  /** Route/URL the mark was made on, so the agent can reproduce the context. */
56
57
  route: z.ZodOptional<z.ZodString>;
57
58
  }, "strip", z.ZodTypeAny, {
58
- note: string;
59
59
  anchor: string;
60
- strategy: "testid" | "role" | "component" | "position";
60
+ note: string;
61
+ strategy: "role" | "testid" | "component" | "position";
62
+ label?: string | undefined;
61
63
  route?: string | undefined;
62
64
  source?: {
63
65
  file: string;
64
66
  line: number;
65
67
  } | undefined;
66
- label?: string | undefined;
67
68
  }, {
68
- note: string;
69
69
  anchor: string;
70
- strategy: "testid" | "role" | "component" | "position";
70
+ note: string;
71
+ strategy: "role" | "testid" | "component" | "position";
72
+ label?: string | undefined;
71
73
  route?: string | undefined;
72
74
  source?: {
73
75
  file: string;
74
76
  line: number;
75
77
  } | undefined;
76
- label?: string | undefined;
77
78
  }>;
78
79
  export type HumanMarkData = z.infer<typeof HumanMarkDataSchema>;
79
80
  /**
@@ -160,23 +161,23 @@ export declare const ReticleEventSchema: z.ZodObject<{
160
161
  /** Event-type-specific payload. Kept open here; refined per observer at the edges. */
161
162
  data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
162
163
  }, "strip", z.ZodTypeAny, {
163
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
164
+ type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
164
165
  t: number;
165
166
  sessionId: string;
166
167
  data: Record<string, unknown>;
167
168
  ref?: string | undefined;
168
- actionId?: string | undefined;
169
169
  seq?: number | undefined;
170
+ actionId?: string | undefined;
170
171
  attribution?: "window" | undefined;
171
172
  documentId?: string | undefined;
172
173
  editEpoch?: number | undefined;
173
174
  }, {
174
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
175
+ type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
175
176
  t: number;
176
177
  sessionId: string;
177
178
  ref?: string | undefined;
178
- actionId?: string | undefined;
179
179
  seq?: number | undefined;
180
+ actionId?: string | undefined;
180
181
  attribution?: "window" | undefined;
181
182
  documentId?: string | undefined;
182
183
  editEpoch?: number | undefined;
@@ -186,7 +187,16 @@ export type ReticleEvent = z.infer<typeof ReticleEventSchema>;
186
187
  /** Browser announces itself to the bridge on connect. */
187
188
  export declare const HelloMessageSchema: z.ZodObject<{
188
189
  kind: z.ZodLiteral<"hello">;
189
- protocolVersion: z.ZodLiteral<1>;
190
+ /**
191
+ * The wire protocol this peer speaks.
192
+ *
193
+ * A RANGE, not a fixed number. An exact match is right while both halves ship together and wrong
194
+ * as soon as anything else implements this: a peer one version behind is not incompatible, it is
195
+ * behind. The bridge accepts anything from the oldest version it still talks to up to its own.
196
+ *
197
+ * Out of range is still a hard door, with the diagnostics that already name which side is stale.
198
+ */
199
+ protocolVersion: z.ZodNumber;
190
200
  sessionId: z.ZodString;
191
201
  url: z.ZodString;
192
202
  title: z.ZodString;
@@ -200,6 +210,76 @@ export declare const HelloMessageSchema: z.ZodObject<{
200
210
  adapters: z.ZodArray<z.ZodString, "many">;
201
211
  /** Optional browser/bridge pairing token. Required when the bridge configures one. */
202
212
  token: z.ZodOptional<z.ZodString>;
213
+ /**
214
+ * What kind of surface this is: a browser document, a web page in somebody else's window, a
215
+ * native view tree, or no rendering surface at all. See platform.ts.
216
+ *
217
+ * ABSENT MEANS `web`, never "unknown". Everything that connected before this field existed was a
218
+ * browser document, so absence is not a gap -- it is the answer those connections would have
219
+ * given. This is the same convention five other fields on this message already use.
220
+ *
221
+ * It is deliberately not the shell name. Electron and Tauri are two shells and one surface, and
222
+ * verification wants the surface: the question being asked is what can be demanded of you, not
223
+ * which product you are.
224
+ */
225
+ platform: z.ZodOptional<z.ZodNativeEnum<{
226
+ readonly WEB: "web";
227
+ readonly WEBVIEW: "webview";
228
+ readonly NATIVE: "native";
229
+ readonly SERVICE: "service";
230
+ }>>;
231
+ /**
232
+ * The channels this build can actually observe. See channel.ts.
233
+ *
234
+ * ABSENT MEANS "everything", not "nothing" -- an SDK built before this field existed watched
235
+ * whatever it watched, and reading its silence as "observes nothing" would refuse every claim it
236
+ * makes. Same convention as every other optional field on this message.
237
+ *
238
+ * A closed list rather than free strings, because the rule that refuses a claim reading an
239
+ * undeclared channel has to switch on these. Commands below are free strings for the opposite
240
+ * reason: nothing switches on them, and command names are already opaque on this wire.
241
+ */
242
+ channels: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<{
243
+ readonly UI: "ui";
244
+ readonly NET: "net";
245
+ readonly STATE: "state";
246
+ readonly SIGNAL: "signal";
247
+ readonly LOG: "log";
248
+ readonly ROUTE: "route";
249
+ readonly STORAGE: "storage";
250
+ readonly TIME: "time";
251
+ readonly VISUAL: "visual";
252
+ }>, "many">>;
253
+ /**
254
+ * The commands this build can serve.
255
+ *
256
+ * Absent means "assume the usual set". Present and missing a name means asking for it is a
257
+ * mistake somebody can be told about before they spend an action on it, rather than after.
258
+ */
259
+ commands: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
260
+ /**
261
+ * The wire names this peer actually speaks, so compatibility can be judged name by name.
262
+ *
263
+ * The fingerprint beside it is a hash over the whole vocabulary: it can say "same" or "different"
264
+ * and nothing else. An implementation that speaks part of the contract -- which is the right thing
265
+ * for anything that is not a browser to do -- can never produce a matching hash, and was therefore
266
+ * reported as skewed on every call forever.
267
+ *
268
+ * Absent means "compare the fingerprint", which is what a build predating this field does.
269
+ */
270
+ contractParts: z.ZodOptional<z.ZodObject<{
271
+ commands: z.ZodArray<z.ZodString, "many">;
272
+ events: z.ZodArray<z.ZodString, "many">;
273
+ actions: z.ZodArray<z.ZodString, "many">;
274
+ }, "strip", z.ZodTypeAny, {
275
+ events: string[];
276
+ commands: string[];
277
+ actions: string[];
278
+ }, {
279
+ events: string[];
280
+ commands: string[];
281
+ actions: string[];
282
+ }>>;
203
283
  /** Whether the app has advertised a capability registry (reticle.describe). */
204
284
  hasCapabilities: z.ZodOptional<z.ZodBoolean>;
205
285
  /**
@@ -258,33 +338,49 @@ export declare const HelloMessageSchema: z.ZodObject<{
258
338
  */
259
339
  redactKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
260
340
  }, "strip", z.ZodTypeAny, {
261
- url: string;
262
341
  kind: "hello";
342
+ url: string;
263
343
  sessionId: string;
264
- protocolVersion: 1;
344
+ protocolVersion: number;
265
345
  title: string;
266
346
  adapters: string[];
267
347
  projectId?: string | undefined;
268
- sdkVersion?: string | undefined;
269
348
  token?: string | undefined;
349
+ platform?: "native" | "web" | "webview" | "service" | undefined;
350
+ channels?: ("visual" | "signal" | "net" | "state" | "route" | "ui" | "log" | "storage" | "time")[] | undefined;
351
+ commands?: string[] | undefined;
352
+ contractParts?: {
353
+ events: string[];
354
+ commands: string[];
355
+ actions: string[];
356
+ } | undefined;
270
357
  hasCapabilities?: boolean | undefined;
271
358
  captureBodies?: boolean | undefined;
272
359
  sourceMapping?: boolean | undefined;
360
+ sdkVersion?: string | undefined;
273
361
  contract?: string | undefined;
274
362
  redactKeys?: string[] | undefined;
275
363
  }, {
276
- url: string;
277
364
  kind: "hello";
365
+ url: string;
278
366
  sessionId: string;
279
- protocolVersion: 1;
367
+ protocolVersion: number;
280
368
  title: string;
281
369
  adapters: string[];
282
370
  projectId?: string | undefined;
283
- sdkVersion?: string | undefined;
284
371
  token?: string | undefined;
372
+ platform?: "native" | "web" | "webview" | "service" | undefined;
373
+ channels?: ("visual" | "signal" | "net" | "state" | "route" | "ui" | "log" | "storage" | "time")[] | undefined;
374
+ commands?: string[] | undefined;
375
+ contractParts?: {
376
+ events: string[];
377
+ commands: string[];
378
+ actions: string[];
379
+ } | undefined;
285
380
  hasCapabilities?: boolean | undefined;
286
381
  captureBodies?: boolean | undefined;
287
382
  sourceMapping?: boolean | undefined;
383
+ sdkVersion?: string | undefined;
288
384
  contract?: string | undefined;
289
385
  redactKeys?: string[] | undefined;
290
386
  }>;
@@ -298,14 +394,14 @@ export declare const CommandMessageSchema: z.ZodObject<{
298
394
  args: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
299
395
  }, "strip", z.ZodTypeAny, {
300
396
  id: string;
301
- args: Record<string, unknown>;
302
- name: string;
303
397
  kind: "command";
398
+ name: string;
399
+ args: Record<string, unknown>;
304
400
  sessionId?: string | undefined;
305
401
  }, {
306
402
  id: string;
307
- name: string;
308
403
  kind: "command";
404
+ name: string;
309
405
  args?: Record<string, unknown> | undefined;
310
406
  sessionId?: string | undefined;
311
407
  }>;
@@ -413,23 +509,23 @@ export declare const EventMessageSchema: z.ZodObject<{
413
509
  /** Event-type-specific payload. Kept open here; refined per observer at the edges. */
414
510
  data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
415
511
  }, "strip", z.ZodTypeAny, {
416
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
512
+ type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
417
513
  t: number;
418
514
  sessionId: string;
419
515
  data: Record<string, unknown>;
420
516
  ref?: string | undefined;
421
- actionId?: string | undefined;
422
517
  seq?: number | undefined;
518
+ actionId?: string | undefined;
423
519
  attribution?: "window" | undefined;
424
520
  documentId?: string | undefined;
425
521
  editEpoch?: number | undefined;
426
522
  }, {
427
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
523
+ type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
428
524
  t: number;
429
525
  sessionId: string;
430
526
  ref?: string | undefined;
431
- actionId?: string | undefined;
432
527
  seq?: number | undefined;
528
+ actionId?: string | undefined;
433
529
  attribution?: "window" | undefined;
434
530
  documentId?: string | undefined;
435
531
  editEpoch?: number | undefined;
@@ -437,13 +533,13 @@ export declare const EventMessageSchema: z.ZodObject<{
437
533
  }>;
438
534
  }, "strip", z.ZodTypeAny, {
439
535
  event: {
440
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
536
+ type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
441
537
  t: number;
442
538
  sessionId: string;
443
539
  data: Record<string, unknown>;
444
540
  ref?: string | undefined;
445
- actionId?: string | undefined;
446
541
  seq?: number | undefined;
542
+ actionId?: string | undefined;
447
543
  attribution?: "window" | undefined;
448
544
  documentId?: string | undefined;
449
545
  editEpoch?: number | undefined;
@@ -451,12 +547,12 @@ export declare const EventMessageSchema: z.ZodObject<{
451
547
  kind: "event";
452
548
  }, {
453
549
  event: {
454
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
550
+ type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
455
551
  t: number;
456
552
  sessionId: string;
457
553
  ref?: string | undefined;
458
- actionId?: string | undefined;
459
554
  seq?: number | undefined;
555
+ actionId?: string | undefined;
460
556
  attribution?: "window" | undefined;
461
557
  documentId?: string | undefined;
462
558
  editEpoch?: number | undefined;
@@ -467,7 +563,16 @@ export declare const EventMessageSchema: z.ZodObject<{
467
563
  export type EventMessage = z.infer<typeof EventMessageSchema>;
468
564
  export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
469
565
  kind: z.ZodLiteral<"hello">;
470
- protocolVersion: z.ZodLiteral<1>;
566
+ /**
567
+ * The wire protocol this peer speaks.
568
+ *
569
+ * A RANGE, not a fixed number. An exact match is right while both halves ship together and wrong
570
+ * as soon as anything else implements this: a peer one version behind is not incompatible, it is
571
+ * behind. The bridge accepts anything from the oldest version it still talks to up to its own.
572
+ *
573
+ * Out of range is still a hard door, with the diagnostics that already name which side is stale.
574
+ */
575
+ protocolVersion: z.ZodNumber;
471
576
  sessionId: z.ZodString;
472
577
  url: z.ZodString;
473
578
  title: z.ZodString;
@@ -481,6 +586,76 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
481
586
  adapters: z.ZodArray<z.ZodString, "many">;
482
587
  /** Optional browser/bridge pairing token. Required when the bridge configures one. */
483
588
  token: z.ZodOptional<z.ZodString>;
589
+ /**
590
+ * What kind of surface this is: a browser document, a web page in somebody else's window, a
591
+ * native view tree, or no rendering surface at all. See platform.ts.
592
+ *
593
+ * ABSENT MEANS `web`, never "unknown". Everything that connected before this field existed was a
594
+ * browser document, so absence is not a gap -- it is the answer those connections would have
595
+ * given. This is the same convention five other fields on this message already use.
596
+ *
597
+ * It is deliberately not the shell name. Electron and Tauri are two shells and one surface, and
598
+ * verification wants the surface: the question being asked is what can be demanded of you, not
599
+ * which product you are.
600
+ */
601
+ platform: z.ZodOptional<z.ZodNativeEnum<{
602
+ readonly WEB: "web";
603
+ readonly WEBVIEW: "webview";
604
+ readonly NATIVE: "native";
605
+ readonly SERVICE: "service";
606
+ }>>;
607
+ /**
608
+ * The channels this build can actually observe. See channel.ts.
609
+ *
610
+ * ABSENT MEANS "everything", not "nothing" -- an SDK built before this field existed watched
611
+ * whatever it watched, and reading its silence as "observes nothing" would refuse every claim it
612
+ * makes. Same convention as every other optional field on this message.
613
+ *
614
+ * A closed list rather than free strings, because the rule that refuses a claim reading an
615
+ * undeclared channel has to switch on these. Commands below are free strings for the opposite
616
+ * reason: nothing switches on them, and command names are already opaque on this wire.
617
+ */
618
+ channels: z.ZodOptional<z.ZodArray<z.ZodNativeEnum<{
619
+ readonly UI: "ui";
620
+ readonly NET: "net";
621
+ readonly STATE: "state";
622
+ readonly SIGNAL: "signal";
623
+ readonly LOG: "log";
624
+ readonly ROUTE: "route";
625
+ readonly STORAGE: "storage";
626
+ readonly TIME: "time";
627
+ readonly VISUAL: "visual";
628
+ }>, "many">>;
629
+ /**
630
+ * The commands this build can serve.
631
+ *
632
+ * Absent means "assume the usual set". Present and missing a name means asking for it is a
633
+ * mistake somebody can be told about before they spend an action on it, rather than after.
634
+ */
635
+ commands: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
636
+ /**
637
+ * The wire names this peer actually speaks, so compatibility can be judged name by name.
638
+ *
639
+ * The fingerprint beside it is a hash over the whole vocabulary: it can say "same" or "different"
640
+ * and nothing else. An implementation that speaks part of the contract -- which is the right thing
641
+ * for anything that is not a browser to do -- can never produce a matching hash, and was therefore
642
+ * reported as skewed on every call forever.
643
+ *
644
+ * Absent means "compare the fingerprint", which is what a build predating this field does.
645
+ */
646
+ contractParts: z.ZodOptional<z.ZodObject<{
647
+ commands: z.ZodArray<z.ZodString, "many">;
648
+ events: z.ZodArray<z.ZodString, "many">;
649
+ actions: z.ZodArray<z.ZodString, "many">;
650
+ }, "strip", z.ZodTypeAny, {
651
+ events: string[];
652
+ commands: string[];
653
+ actions: string[];
654
+ }, {
655
+ events: string[];
656
+ commands: string[];
657
+ actions: string[];
658
+ }>>;
484
659
  /** Whether the app has advertised a capability registry (reticle.describe). */
485
660
  hasCapabilities: z.ZodOptional<z.ZodBoolean>;
486
661
  /**
@@ -539,33 +714,49 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
539
714
  */
540
715
  redactKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
541
716
  }, "strip", z.ZodTypeAny, {
542
- url: string;
543
717
  kind: "hello";
718
+ url: string;
544
719
  sessionId: string;
545
- protocolVersion: 1;
720
+ protocolVersion: number;
546
721
  title: string;
547
722
  adapters: string[];
548
723
  projectId?: string | undefined;
549
- sdkVersion?: string | undefined;
550
724
  token?: string | undefined;
725
+ platform?: "native" | "web" | "webview" | "service" | undefined;
726
+ channels?: ("visual" | "signal" | "net" | "state" | "route" | "ui" | "log" | "storage" | "time")[] | undefined;
727
+ commands?: string[] | undefined;
728
+ contractParts?: {
729
+ events: string[];
730
+ commands: string[];
731
+ actions: string[];
732
+ } | undefined;
551
733
  hasCapabilities?: boolean | undefined;
552
734
  captureBodies?: boolean | undefined;
553
735
  sourceMapping?: boolean | undefined;
736
+ sdkVersion?: string | undefined;
554
737
  contract?: string | undefined;
555
738
  redactKeys?: string[] | undefined;
556
739
  }, {
557
- url: string;
558
740
  kind: "hello";
741
+ url: string;
559
742
  sessionId: string;
560
- protocolVersion: 1;
743
+ protocolVersion: number;
561
744
  title: string;
562
745
  adapters: string[];
563
746
  projectId?: string | undefined;
564
- sdkVersion?: string | undefined;
565
747
  token?: string | undefined;
748
+ platform?: "native" | "web" | "webview" | "service" | undefined;
749
+ channels?: ("visual" | "signal" | "net" | "state" | "route" | "ui" | "log" | "storage" | "time")[] | undefined;
750
+ commands?: string[] | undefined;
751
+ contractParts?: {
752
+ events: string[];
753
+ commands: string[];
754
+ actions: string[];
755
+ } | undefined;
566
756
  hasCapabilities?: boolean | undefined;
567
757
  captureBodies?: boolean | undefined;
568
758
  sourceMapping?: boolean | undefined;
759
+ sdkVersion?: string | undefined;
569
760
  contract?: string | undefined;
570
761
  redactKeys?: string[] | undefined;
571
762
  }>, z.ZodObject<{
@@ -576,14 +767,14 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
576
767
  args: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
577
768
  }, "strip", z.ZodTypeAny, {
578
769
  id: string;
579
- args: Record<string, unknown>;
580
- name: string;
581
770
  kind: "command";
771
+ name: string;
772
+ args: Record<string, unknown>;
582
773
  sessionId?: string | undefined;
583
774
  }, {
584
775
  id: string;
585
- name: string;
586
776
  kind: "command";
777
+ name: string;
587
778
  args?: Record<string, unknown> | undefined;
588
779
  sessionId?: string | undefined;
589
780
  }>, z.ZodObject<{
@@ -685,23 +876,23 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
685
876
  /** Event-type-specific payload. Kept open here; refined per observer at the edges. */
686
877
  data: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
687
878
  }, "strip", z.ZodTypeAny, {
688
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
879
+ type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
689
880
  t: number;
690
881
  sessionId: string;
691
882
  data: Record<string, unknown>;
692
883
  ref?: string | undefined;
693
- actionId?: string | undefined;
694
884
  seq?: number | undefined;
885
+ actionId?: string | undefined;
695
886
  attribution?: "window" | undefined;
696
887
  documentId?: string | undefined;
697
888
  editEpoch?: number | undefined;
698
889
  }, {
699
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
890
+ type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
700
891
  t: number;
701
892
  sessionId: string;
702
893
  ref?: string | undefined;
703
- actionId?: string | undefined;
704
894
  seq?: number | undefined;
895
+ actionId?: string | undefined;
705
896
  attribution?: "window" | undefined;
706
897
  documentId?: string | undefined;
707
898
  editEpoch?: number | undefined;
@@ -709,13 +900,13 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
709
900
  }>;
710
901
  }, "strip", z.ZodTypeAny, {
711
902
  event: {
712
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
903
+ type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
713
904
  t: number;
714
905
  sessionId: string;
715
906
  data: Record<string, unknown>;
716
907
  ref?: string | undefined;
717
- actionId?: string | undefined;
718
908
  seq?: number | undefined;
909
+ actionId?: string | undefined;
719
910
  attribution?: "window" | undefined;
720
911
  documentId?: string | undefined;
721
912
  editEpoch?: number | undefined;
@@ -723,12 +914,12 @@ export declare const ReticleMessageSchema: z.ZodDiscriminatedUnion<"kind", [z.Zo
723
914
  kind: "event";
724
915
  }, {
725
916
  event: {
726
- type: "signal" | "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
917
+ type: "dom.added" | "dom.removed" | "dom.attr" | "dom.text" | "net.request" | "net.pending" | "net.stream" | "perf" | "route.change" | "console.log" | "console.warn" | "console.error" | "console.info" | "console.debug" | "error.uncaught" | "visible.shown" | "anim.start" | "anim.end" | "scroll.position" | "reveal.shown" | "signal" | "state.change" | "storage.change" | "page.health" | "context.opened" | "dialog.opened" | "render.commit" | "focus.change" | "flow.recorded" | "transport.overflow" | "truncated" | "blind-spot" | "sdk.failed" | "net.detail" | "human.control" | "human.mark" | "download";
727
918
  t: number;
728
919
  sessionId: string;
729
920
  ref?: string | undefined;
730
- actionId?: string | undefined;
731
921
  seq?: number | undefined;
922
+ actionId?: string | undefined;
732
923
  attribution?: "window" | undefined;
733
924
  documentId?: string | undefined;
734
925
  editEpoch?: number | undefined;
@@ -1,9 +1,11 @@
1
1
  import { z } from 'zod';
2
- import { EventAttribution, EventType, RETICLE_PROTOCOL_VERSION, MessageKind, TRANSPORT_LIMITS, } from './constants.js';
3
- import { HumanControlKind, MarkAnchorStrategy } from './session-constants.js';
2
+ import { EventAttribution, EventType, RETICLE_MIN_PROTOCOL_VERSION, RETICLE_PROTOCOL_VERSION, MessageKind, TRANSPORT_LIMITS, } from './constants/constants.js';
3
+ import { HumanControlKind, MarkAnchorStrategy } from './constants/session-constants.js';
4
4
  import { MAX_WIRE_REDACT_KEYS, MAX_WIRE_REDACT_KEY_LENGTH } from './redaction.js';
5
- import { DOCUMENT_ID_LENGTH } from './document-identity.js';
6
- import { NO_EDITS_OBSERVED } from './edit-epoch.js';
5
+ import { DOCUMENT_ID_LENGTH } from '../identity/document-identity.js';
6
+ import { NO_EDITS_OBSERVED } from '../identity/edit-epoch.js';
7
+ import { PlatformProfile } from './platform.js';
8
+ import { ChannelId } from './channel.js';
7
9
  const sessionIdSchema = z.string().min(1).max(TRANSPORT_LIMITS.MAX_SESSION_ID_LENGTH);
8
10
  const refSchema = z.string().max(TRANSPORT_LIMITS.MAX_REF_LENGTH);
9
11
  const documentIdSchema = z.string().min(1).max(DOCUMENT_ID_LENGTH);
@@ -88,7 +90,16 @@ export const ReticleEventSchema = z.object({
88
90
  /** Browser announces itself to the bridge on connect. */
89
91
  export const HelloMessageSchema = z.object({
90
92
  kind: z.literal(MessageKind.HELLO),
91
- protocolVersion: z.literal(RETICLE_PROTOCOL_VERSION),
93
+ /**
94
+ * The wire protocol this peer speaks.
95
+ *
96
+ * A RANGE, not a fixed number. An exact match is right while both halves ship together and wrong
97
+ * as soon as anything else implements this: a peer one version behind is not incompatible, it is
98
+ * behind. The bridge accepts anything from the oldest version it still talks to up to its own.
99
+ *
100
+ * Out of range is still a hard door, with the diagnostics that already name which side is stale.
101
+ */
102
+ protocolVersion: z.number().int().min(RETICLE_MIN_PROTOCOL_VERSION).max(RETICLE_PROTOCOL_VERSION),
92
103
  sessionId: sessionIdSchema,
93
104
  url: z.string().max(TRANSPORT_LIMITS.MAX_URL_LENGTH),
94
105
  title: z.string().max(TRANSPORT_LIMITS.MAX_TITLE_LENGTH),
@@ -104,6 +115,58 @@ export const HelloMessageSchema = z.object({
104
115
  .max(TRANSPORT_LIMITS.MAX_ADAPTERS),
105
116
  /** Optional browser/bridge pairing token. Required when the bridge configures one. */
106
117
  token: z.string().max(TRANSPORT_LIMITS.MAX_TOKEN_LENGTH).optional(),
118
+ /**
119
+ * What kind of surface this is: a browser document, a web page in somebody else's window, a
120
+ * native view tree, or no rendering surface at all. See platform.ts.
121
+ *
122
+ * ABSENT MEANS `web`, never "unknown". Everything that connected before this field existed was a
123
+ * browser document, so absence is not a gap -- it is the answer those connections would have
124
+ * given. This is the same convention five other fields on this message already use.
125
+ *
126
+ * It is deliberately not the shell name. Electron and Tauri are two shells and one surface, and
127
+ * verification wants the surface: the question being asked is what can be demanded of you, not
128
+ * which product you are.
129
+ */
130
+ platform: z.nativeEnum(PlatformProfile).optional(),
131
+ /**
132
+ * The channels this build can actually observe. See channel.ts.
133
+ *
134
+ * ABSENT MEANS "everything", not "nothing" -- an SDK built before this field existed watched
135
+ * whatever it watched, and reading its silence as "observes nothing" would refuse every claim it
136
+ * makes. Same convention as every other optional field on this message.
137
+ *
138
+ * A closed list rather than free strings, because the rule that refuses a claim reading an
139
+ * undeclared channel has to switch on these. Commands below are free strings for the opposite
140
+ * reason: nothing switches on them, and command names are already opaque on this wire.
141
+ */
142
+ channels: z.array(z.nativeEnum(ChannelId)).max(TRANSPORT_LIMITS.MAX_ADAPTERS).optional(),
143
+ /**
144
+ * The commands this build can serve.
145
+ *
146
+ * Absent means "assume the usual set". Present and missing a name means asking for it is a
147
+ * mistake somebody can be told about before they spend an action on it, rather than after.
148
+ */
149
+ commands: z
150
+ .array(z.string().max(TRANSPORT_LIMITS.MAX_TOKEN_LENGTH))
151
+ .max(TRANSPORT_LIMITS.MAX_ADAPTERS)
152
+ .optional(),
153
+ /**
154
+ * The wire names this peer actually speaks, so compatibility can be judged name by name.
155
+ *
156
+ * The fingerprint beside it is a hash over the whole vocabulary: it can say "same" or "different"
157
+ * and nothing else. An implementation that speaks part of the contract -- which is the right thing
158
+ * for anything that is not a browser to do -- can never produce a matching hash, and was therefore
159
+ * reported as skewed on every call forever.
160
+ *
161
+ * Absent means "compare the fingerprint", which is what a build predating this field does.
162
+ */
163
+ contractParts: z
164
+ .object({
165
+ commands: z.array(z.string()).max(TRANSPORT_LIMITS.MAX_CONTRACT_NAMES),
166
+ events: z.array(z.string()).max(TRANSPORT_LIMITS.MAX_CONTRACT_NAMES),
167
+ actions: z.array(z.string()).max(TRANSPORT_LIMITS.MAX_CONTRACT_NAMES),
168
+ })
169
+ .optional(),
107
170
  /** Whether the app has advertised a capability registry (reticle.describe). */
108
171
  hasCapabilities: z.boolean().optional(),
109
172
  /**