@joe-broadhead/messaging 0.7.1 → 0.9.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 (94) hide show
  1. package/CHANGELOG.md +364 -2
  2. package/dist/bin/messaging-mcp.js +5498 -4338
  3. package/dist/bin/messaging-relay.js +8626 -5540
  4. package/dist/bin/messaging.js +4492 -3158
  5. package/dist/bin/messagingd.js +19672 -12412
  6. package/dist/lib/modules/core/agent/operations.js +19 -327
  7. package/dist/lib/modules/core/agent/present.js +20 -55
  8. package/dist/lib/modules/core/agent-tools.js +35 -139
  9. package/dist/lib/modules/core/consent.js +54 -14
  10. package/dist/lib/modules/core/contact-card.js +3 -3
  11. package/dist/lib/modules/core/conversation/event.js +29 -4
  12. package/dist/lib/modules/core/conversation/guest-invitation.js +42 -0
  13. package/dist/lib/modules/core/conversation/log.js +287 -65
  14. package/dist/lib/modules/core/conversation/request-log.js +158 -0
  15. package/dist/lib/modules/core/conversation/request-seal.js +41 -0
  16. package/dist/lib/modules/core/conversation/requests.js +87 -0
  17. package/dist/lib/modules/core/conversation/seal.js +90 -37
  18. package/dist/lib/modules/core/conversation-agent-tools.js +69 -0
  19. package/dist/lib/modules/core/federation/directory-proof.js +83 -0
  20. package/dist/lib/modules/core/federation/proof-state.js +167 -0
  21. package/dist/lib/modules/core/federation/roster-proof.js +74 -0
  22. package/dist/lib/modules/core/index.js +9 -4
  23. package/dist/lib/modules/core/jelly-host.js +8 -5
  24. package/dist/lib/modules/core/schema/common.js +33 -5
  25. package/dist/lib/modules/core/schema/consent.js +23 -5
  26. package/dist/lib/modules/core/schema/contact-request.js +22 -0
  27. package/dist/lib/modules/core/schema/conv-frames.js +101 -0
  28. package/dist/lib/modules/core/schema/conversation.js +67 -33
  29. package/dist/lib/modules/core/schema/directory-frames.js +8 -3
  30. package/dist/lib/modules/core/schema/envelope.js +8 -24
  31. package/dist/lib/modules/core/schema/errors.js +7 -5
  32. package/dist/lib/modules/core/schema/guest-invitation.js +13 -0
  33. package/dist/lib/modules/core/schema/index.js +5 -0
  34. package/dist/lib/modules/core/schema/ipc/consent.js +97 -18
  35. package/dist/lib/modules/core/schema/ipc/conversation-views.js +87 -0
  36. package/dist/lib/modules/core/schema/ipc/conversations.js +132 -0
  37. package/dist/lib/modules/core/schema/ipc/device.js +9 -0
  38. package/dist/lib/modules/core/schema/ipc/jelly.js +17 -45
  39. package/dist/lib/modules/core/schema/ipc/shapes.js +74 -73
  40. package/dist/lib/modules/core/schema/ipc/surfaces.js +12 -195
  41. package/dist/lib/modules/core/schema/ipc/tasks.js +31 -0
  42. package/dist/lib/modules/core/schema/ipc.js +68 -46
  43. package/dist/lib/modules/core/testing.js +1 -1
  44. package/dist/lib/modules/core/version.js +1 -1
  45. package/dist/lib/modules/ipc/client.js +10 -2
  46. package/dist/lib/modules/ipc/server.js +14 -5
  47. package/dist/lib/modules/ipc/testing.js +13 -23
  48. package/dist/spec/messaging-v1.md +854 -445
  49. package/dist/third-party-notices.md +1 -1
  50. package/dist/third-party.json +1 -1
  51. package/dist/types/core/agent/operations.d.ts +5 -52
  52. package/dist/types/core/agent/present.d.ts +6 -21
  53. package/dist/types/core/agent-tools.d.ts +295 -442
  54. package/dist/types/core/consent.d.ts +30 -7
  55. package/dist/types/core/contact-card.d.ts +3 -3
  56. package/dist/types/core/conversation/event.d.ts +6 -6
  57. package/dist/types/core/conversation/guest-invitation.d.ts +8 -0
  58. package/dist/types/core/conversation/log.d.ts +28 -13
  59. package/dist/types/core/conversation/request-log.d.ts +24 -0
  60. package/dist/types/core/conversation/request-seal.d.ts +6 -0
  61. package/dist/types/core/conversation/requests.d.ts +14 -0
  62. package/dist/types/core/conversation/seal.d.ts +32 -9
  63. package/dist/types/core/conversation-agent-tools.d.ts +939 -0
  64. package/dist/types/core/federation/directory-proof.d.ts +8 -0
  65. package/dist/types/core/federation/proof-state.d.ts +114 -0
  66. package/dist/types/core/federation/roster-proof.d.ts +7 -0
  67. package/dist/types/core/index.d.ts +11 -6
  68. package/dist/types/core/jelly-host.d.ts +1 -1
  69. package/dist/types/core/schema/common.d.ts +33 -6
  70. package/dist/types/core/schema/consent.d.ts +29 -8
  71. package/dist/types/core/schema/contact-request.d.ts +264 -0
  72. package/dist/types/core/schema/conv-frames.d.ts +1204 -0
  73. package/dist/types/core/schema/conversation.d.ts +1410 -264
  74. package/dist/types/core/schema/directory-frames.d.ts +8 -3
  75. package/dist/types/core/schema/envelope.d.ts +85 -130
  76. package/dist/types/core/schema/errors.d.ts +5 -1
  77. package/dist/types/core/schema/guest-invitation.d.ts +51 -0
  78. package/dist/types/core/schema/index.d.ts +5 -0
  79. package/dist/types/core/schema/ipc/consent.d.ts +464 -62
  80. package/dist/types/core/schema/ipc/conversation-views.d.ts +1199 -0
  81. package/dist/types/core/schema/ipc/conversations.d.ts +4355 -0
  82. package/dist/types/core/schema/ipc/device.d.ts +10 -0
  83. package/dist/types/core/schema/ipc/jelly.d.ts +16 -111
  84. package/dist/types/core/schema/ipc/shapes.d.ts +211 -95
  85. package/dist/types/core/schema/ipc/surfaces.d.ts +26 -427
  86. package/dist/types/core/schema/ipc/tasks.d.ts +210 -0
  87. package/dist/types/core/schema/ipc.d.ts +3859 -890
  88. package/dist/types/core/schema/relay.d.ts +12 -4
  89. package/dist/types/core/testing.d.ts +1 -1
  90. package/dist/types/core/version.d.ts +1 -1
  91. package/dist/types/ipc/client.d.ts +4 -1
  92. package/dist/types/ipc/server.d.ts +16 -1
  93. package/dist/types/ipc/testing.d.ts +21 -8
  94. package/package.json +1 -1
@@ -3,11 +3,11 @@
3
3
  * socket refuses them, and agents never set or read a person's grants. Spread into `IPC_METHODS`.
4
4
  */
5
5
  import { z } from "zod";
6
- /** A grant's subject as a person names it: a person, or a channel by its name here. */
6
+ /** A grant's subject: a person, or a verified conversation id. */
7
7
  export declare const GrantTarget: z.ZodUnion<readonly [z.ZodObject<{
8
8
  person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
9
9
  }, z.core.$strict>, z.ZodObject<{
10
- channel: z.ZodString;
10
+ conv: z.ZodString;
11
11
  }, z.core.$strict>]>;
12
12
  export type GrantTarget = z.infer<typeof GrantTarget>;
13
13
  /** A grant as this device holds it. A channel subject carries the channel's id and, while this person is in it, its name here. */
@@ -26,33 +26,31 @@ export declare const GrantView: z.ZodObject<{
26
26
  blocked: "blocked";
27
27
  }>>;
28
28
  ask: z.ZodOptional<z.ZodEnum<{
29
- open: "open";
30
29
  request: "request";
30
+ open: "open";
31
31
  no: "no";
32
32
  }>>;
33
33
  trustedUntil: z.ZodOptional<z.ZodNumber>;
34
34
  discoverable: z.ZodOptional<z.ZodBoolean>;
35
35
  subject: z.ZodUnion<readonly [z.ZodObject<{
36
36
  person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
37
- }, z.core.$strip>, z.ZodObject<{
38
- channel: z.ZodString;
39
- name: z.ZodOptional<z.ZodString>;
40
- }, z.core.$strip>]>;
37
+ }, z.core.$strict>, z.ZodObject<{
38
+ conv: z.ZodString;
39
+ }, z.core.$strict>]>;
41
40
  }, z.core.$strip>;
42
41
  export type GrantView = z.infer<typeof GrantView>;
43
42
  /** Widening levels that lapsed with their signer, waiting for the person to set them again (spec §6.9, "Signers"). */
44
43
  export declare const GrantReview: z.ZodObject<{
45
44
  subject: z.ZodUnion<readonly [z.ZodObject<{
46
45
  person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
47
- }, z.core.$strip>, z.ZodObject<{
48
- channel: z.ZodString;
49
- name: z.ZodOptional<z.ZodString>;
50
- }, z.core.$strip>]>;
46
+ }, z.core.$strict>, z.ZodObject<{
47
+ conv: z.ZodString;
48
+ }, z.core.$strict>]>;
51
49
  chat: z.ZodOptional<z.ZodLiteral<"open">>;
52
50
  agentMail: z.ZodOptional<z.ZodLiteral<"open">>;
53
51
  ask: z.ZodOptional<z.ZodEnum<{
54
- open: "open";
55
52
  request: "request";
53
+ open: "open";
56
54
  }>>;
57
55
  trustedUntil: z.ZodOptional<z.ZodNumber>;
58
56
  discoverable: z.ZodOptional<z.ZodLiteral<true>>;
@@ -75,8 +73,8 @@ export declare const GrantSetParams: z.ZodObject<{
75
73
  blocked: "blocked";
76
74
  }>>;
77
75
  ask: z.ZodOptional<z.ZodEnum<{
78
- open: "open";
79
76
  request: "request";
77
+ open: "open";
80
78
  no: "no";
81
79
  }>>;
82
80
  trustedUntil: z.ZodOptional<z.ZodNumber>;
@@ -84,12 +82,52 @@ export declare const GrantSetParams: z.ZodObject<{
84
82
  subject: z.ZodUnion<readonly [z.ZodObject<{
85
83
  person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
86
84
  }, z.core.$strict>, z.ZodObject<{
87
- channel: z.ZodString;
85
+ conv: z.ZodString;
88
86
  }, z.core.$strict>]>;
89
87
  }, z.core.$strict>;
90
88
  export type GrantSetParams = z.infer<typeof GrantSetParams>;
89
+ /**
90
+ * For an ask: `once` delivers it, guarded; `always` sets the sender's grant to `ask: "open"` (keeping its other
91
+ * levels), then delivers it, guarded. For a message request: `accept` sets the sender's grant to `chat: "open"`
92
+ * (keeping its other levels), files the request as their first line and sends them a card. For both: `decline`
93
+ * refuses it (`declined`); `block` sets the sender's grant to `chat: "blocked"` (keeping its other levels), then
94
+ * declines it. For a suggestion: `decline` dismisses it.
95
+ */
96
+ export declare const RequestAnswer: z.ZodEnum<{
97
+ accept: "accept";
98
+ decline: "decline";
99
+ once: "once";
100
+ always: "always";
101
+ block: "block";
102
+ }>;
103
+ export type RequestAnswer = z.infer<typeof RequestAnswer>;
104
+ /**
105
+ * A source-issued action on a held request (spec §8.2, "Action tokens"): `name` is the answer it gives, redeemed with
106
+ * `request.answer {id, answer: name, token}` on the connection that read it.
107
+ */
108
+ export declare const RequestAction: z.ZodObject<{
109
+ name: z.ZodEnum<{
110
+ accept: "accept";
111
+ decline: "decline";
112
+ once: "once";
113
+ always: "always";
114
+ block: "block";
115
+ }>;
116
+ token: z.ZodString;
117
+ }, z.core.$strict>;
118
+ export type RequestAction = z.infer<typeof RequestAction>;
91
119
  /** A request this device holds for its person to answer (spec §6.9, "Holds"): mail or a task to one of their agents. */
92
120
  export declare const AskRequest: z.ZodObject<{
121
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
122
+ name: z.ZodEnum<{
123
+ accept: "accept";
124
+ decline: "decline";
125
+ once: "once";
126
+ always: "always";
127
+ block: "block";
128
+ }>;
129
+ token: z.ZodString;
130
+ }, z.core.$strict>>>;
93
131
  id: z.ZodString;
94
132
  kind: z.ZodEnum<{
95
133
  message: "message";
@@ -113,12 +151,29 @@ export type AskRequest = z.infer<typeof AskRequest>;
113
151
  * write to them. `name`, `email` and `org` are the realm's verified profile of the sender, never the request's text.
114
152
  */
115
153
  export declare const ContactRequestView: z.ZodObject<{
154
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
155
+ name: z.ZodEnum<{
156
+ accept: "accept";
157
+ decline: "decline";
158
+ once: "once";
159
+ always: "always";
160
+ block: "block";
161
+ }>;
162
+ token: z.ZodString;
163
+ }, z.core.$strict>>>;
116
164
  id: z.ZodString;
117
165
  kind: z.ZodLiteral<"contact">;
166
+ cid: z.ZodOptional<z.ZodString>;
167
+ state: z.ZodEnum<{
168
+ accepted: "accepted";
169
+ pending: "pending";
170
+ answering: "answering";
171
+ resend: "resend";
172
+ }>;
118
173
  from: z.ZodObject<{
119
174
  person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
120
175
  device: z.ZodString;
121
- label: z.ZodString;
176
+ label: z.ZodOptional<z.ZodString>;
122
177
  name: z.ZodString;
123
178
  email: z.ZodOptional<z.ZodString>;
124
179
  org: z.ZodEnum<{
@@ -132,12 +187,41 @@ export declare const ContactRequestView: z.ZodObject<{
132
187
  exp: z.ZodNumber;
133
188
  }, z.core.$strip>;
134
189
  export type ContactRequestView = z.infer<typeof ContactRequestView>;
190
+ export declare const AgentInvitationRequest: z.ZodObject<{
191
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
192
+ name: z.ZodEnum<{
193
+ accept: "accept";
194
+ decline: "decline";
195
+ once: "once";
196
+ always: "always";
197
+ block: "block";
198
+ }>;
199
+ token: z.ZodString;
200
+ }, z.core.$strict>>>;
201
+ kind: z.ZodLiteral<"agent-invitation">;
202
+ id: z.ZodString;
203
+ cid: z.ZodString;
204
+ from: z.ZodString;
205
+ to: z.ZodString;
206
+ at: z.ZodNumber;
207
+ }, z.core.$strict>;
208
+ export type AgentInvitationRequest = z.infer<typeof AgentInvitationRequest>;
135
209
  /**
136
210
  * A contact one of this person's agents asks them to make (spec §6.9, "Message requests"): `send {to: "me", request:
137
211
  * {contact}}`. Only the person sends a message request, with `contact.request`; answering this one `decline`
138
212
  * dismisses it.
139
213
  */
140
214
  export declare const ContactSuggestion: z.ZodObject<{
215
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
216
+ name: z.ZodEnum<{
217
+ accept: "accept";
218
+ decline: "decline";
219
+ once: "once";
220
+ always: "always";
221
+ block: "block";
222
+ }>;
223
+ token: z.ZodString;
224
+ }, z.core.$strict>>>;
141
225
  id: z.ZodString;
142
226
  kind: z.ZodLiteral<"suggestion">;
143
227
  agent: z.ZodString;
@@ -147,6 +231,16 @@ export declare const ContactSuggestion: z.ZodObject<{
147
231
  export type ContactSuggestion = z.infer<typeof ContactSuggestion>;
148
232
  /** What `request.list` lists: asks to the person's agents, message requests, and contacts their agents suggest. */
149
233
  export declare const HeldRequest: z.ZodUnion<readonly [z.ZodObject<{
234
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
235
+ name: z.ZodEnum<{
236
+ accept: "accept";
237
+ decline: "decline";
238
+ once: "once";
239
+ always: "always";
240
+ block: "block";
241
+ }>;
242
+ token: z.ZodString;
243
+ }, z.core.$strict>>>;
150
244
  id: z.ZodString;
151
245
  kind: z.ZodEnum<{
152
246
  message: "message";
@@ -164,12 +258,29 @@ export declare const HeldRequest: z.ZodUnion<readonly [z.ZodObject<{
164
258
  at: z.ZodNumber;
165
259
  exp: z.ZodNumber;
166
260
  }, z.core.$strip>, z.ZodObject<{
261
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
262
+ name: z.ZodEnum<{
263
+ accept: "accept";
264
+ decline: "decline";
265
+ once: "once";
266
+ always: "always";
267
+ block: "block";
268
+ }>;
269
+ token: z.ZodString;
270
+ }, z.core.$strict>>>;
167
271
  id: z.ZodString;
168
272
  kind: z.ZodLiteral<"contact">;
273
+ cid: z.ZodOptional<z.ZodString>;
274
+ state: z.ZodEnum<{
275
+ accepted: "accepted";
276
+ pending: "pending";
277
+ answering: "answering";
278
+ resend: "resend";
279
+ }>;
169
280
  from: z.ZodObject<{
170
281
  person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
171
282
  device: z.ZodString;
172
- label: z.ZodString;
283
+ label: z.ZodOptional<z.ZodString>;
173
284
  name: z.ZodString;
174
285
  email: z.ZodOptional<z.ZodString>;
175
286
  org: z.ZodEnum<{
@@ -182,28 +293,40 @@ export declare const HeldRequest: z.ZodUnion<readonly [z.ZodObject<{
182
293
  at: z.ZodNumber;
183
294
  exp: z.ZodNumber;
184
295
  }, z.core.$strip>, z.ZodObject<{
296
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
297
+ name: z.ZodEnum<{
298
+ accept: "accept";
299
+ decline: "decline";
300
+ once: "once";
301
+ always: "always";
302
+ block: "block";
303
+ }>;
304
+ token: z.ZodString;
305
+ }, z.core.$strict>>>;
185
306
  id: z.ZodString;
186
307
  kind: z.ZodLiteral<"suggestion">;
187
308
  agent: z.ZodString;
188
309
  email: z.ZodString;
189
310
  at: z.ZodNumber;
190
- }, z.core.$strip>]>;
311
+ }, z.core.$strip>, z.ZodObject<{
312
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
313
+ name: z.ZodEnum<{
314
+ accept: "accept";
315
+ decline: "decline";
316
+ once: "once";
317
+ always: "always";
318
+ block: "block";
319
+ }>;
320
+ token: z.ZodString;
321
+ }, z.core.$strict>>>;
322
+ kind: z.ZodLiteral<"agent-invitation">;
323
+ id: z.ZodString;
324
+ cid: z.ZodString;
325
+ from: z.ZodString;
326
+ to: z.ZodString;
327
+ at: z.ZodNumber;
328
+ }, z.core.$strict>]>;
191
329
  export type HeldRequest = z.infer<typeof HeldRequest>;
192
- /**
193
- * For an ask: `once` delivers it, guarded; `always` sets the sender's grant to `ask: "open"` (keeping its other
194
- * levels), then delivers it, guarded. For a message request: `accept` sets the sender's grant to `chat: "open"`
195
- * (keeping its other levels), files the request as their first line and sends them a card. For both: `decline`
196
- * refuses it (`declined`); `block` sets the sender's grant to `chat: "blocked"` (keeping its other levels), then
197
- * declines it. For a suggestion: `decline` dismisses it.
198
- */
199
- export declare const RequestAnswer: z.ZodEnum<{
200
- once: "once";
201
- always: "always";
202
- accept: "accept";
203
- decline: "decline";
204
- block: "block";
205
- }>;
206
- export type RequestAnswer = z.infer<typeof RequestAnswer>;
207
330
  /** A message request's text: 1 to `LIMITS.requestChars` UTF-16 code units. */
208
331
  export declare const RequestText: z.ZodString;
209
332
  /**
@@ -220,8 +343,8 @@ export declare const PersonReach: z.ZodObject<{
220
343
  chat: z.ZodBoolean;
221
344
  agentMail: z.ZodBoolean;
222
345
  ask: z.ZodEnum<{
223
- open: "open";
224
346
  request: "request";
347
+ open: "open";
225
348
  no: "no";
226
349
  }>;
227
350
  trustedUntil: z.ZodOptional<z.ZodNumber>;
@@ -235,16 +358,21 @@ export declare const PersonReach: z.ZodObject<{
235
358
  }, z.core.$strip>;
236
359
  export type PersonReach = z.infer<typeof PersonReach>;
237
360
  /** `request.answer`'s params, which `request.answer.preview` takes too (spec §8.2, "Previews"). */
361
+ /**
362
+ * `request.answer`'s params. `token` is the request's action for this `answer` (`RequestAction`); it answers that one
363
+ * request, so it never comes with `all`. Under a Jelly host it is required.
364
+ */
238
365
  export declare const RequestAnswerParams: z.ZodObject<{
239
366
  id: z.ZodString;
240
367
  answer: z.ZodEnum<{
241
- once: "once";
242
- always: "always";
243
368
  accept: "accept";
244
369
  decline: "decline";
370
+ once: "once";
371
+ always: "always";
245
372
  block: "block";
246
373
  }>;
247
374
  all: z.ZodOptional<z.ZodBoolean>;
375
+ token: z.ZodOptional<z.ZodString>;
248
376
  }, z.core.$strict>;
249
377
  /** `contact.request`'s params; its preview takes them with `text` optional (it reads only `email`). */
250
378
  export declare const ContactRequestParams: z.ZodObject<{
@@ -252,14 +380,234 @@ export declare const ContactRequestParams: z.ZodObject<{
252
380
  text: z.ZodString;
253
381
  suggestion: z.ZodOptional<z.ZodString>;
254
382
  }, z.core.$strict>;
383
+ /** A reach question (spec §6.9, "Reach choices"): `message` is "Who can message you", `ask` "How agents may ask yours". */
384
+ export declare const ReachGroupId: z.ZodEnum<{
385
+ message: "message";
386
+ ask: "ask";
387
+ }>;
388
+ export type ReachGroupId = z.infer<typeof ReachGroupId>;
389
+ /** An answer: Open, Ask me first (the default), Never. */
390
+ export declare const ReachValue: z.ZodEnum<{
391
+ never: "never";
392
+ ask: "ask";
393
+ open: "open";
394
+ }>;
395
+ export type ReachValue = z.infer<typeof ReachValue>;
396
+ export declare const ReachOption: z.ZodObject<{
397
+ value: z.ZodEnum<{
398
+ never: "never";
399
+ ask: "ask";
400
+ open: "open";
401
+ }>;
402
+ label: z.ZodString;
403
+ description: z.ZodString;
404
+ }, z.core.$strip>;
405
+ export type ReachOption = z.infer<typeof ReachOption>;
406
+ /**
407
+ * One question with its options. `value` is the person's choice, or null while they have made none and the relation
408
+ * defaults apply. `lapsed` is a choice a removed device of the person made, which lapsed with it (§6.9, "Signers")
409
+ * and waits for the person to choose again.
410
+ */
411
+ export declare const ReachGroup: z.ZodObject<{
412
+ id: z.ZodEnum<{
413
+ message: "message";
414
+ ask: "ask";
415
+ }>;
416
+ label: z.ZodString;
417
+ options: z.ZodArray<z.ZodObject<{
418
+ value: z.ZodEnum<{
419
+ never: "never";
420
+ ask: "ask";
421
+ open: "open";
422
+ }>;
423
+ label: z.ZodString;
424
+ description: z.ZodString;
425
+ }, z.core.$strip>>;
426
+ value: z.ZodNullable<z.ZodEnum<{
427
+ never: "never";
428
+ ask: "ask";
429
+ open: "open";
430
+ }>>;
431
+ lapsed: z.ZodOptional<z.ZodEnum<{
432
+ never: "never";
433
+ ask: "ask";
434
+ open: "open";
435
+ }>>;
436
+ }, z.core.$strip>;
437
+ export type ReachGroup = z.infer<typeof ReachGroup>;
438
+ /** `reach.get`'s result, and `reach.set`'s: both questions, and a `revision` that changes whenever either choice does. */
439
+ export declare const ReachSnapshot: z.ZodObject<{
440
+ revision: z.ZodString;
441
+ available: z.ZodBoolean;
442
+ groups: z.ZodArray<z.ZodObject<{
443
+ id: z.ZodEnum<{
444
+ message: "message";
445
+ ask: "ask";
446
+ }>;
447
+ label: z.ZodString;
448
+ options: z.ZodArray<z.ZodObject<{
449
+ value: z.ZodEnum<{
450
+ never: "never";
451
+ ask: "ask";
452
+ open: "open";
453
+ }>;
454
+ label: z.ZodString;
455
+ description: z.ZodString;
456
+ }, z.core.$strip>>;
457
+ value: z.ZodNullable<z.ZodEnum<{
458
+ never: "never";
459
+ ask: "ask";
460
+ open: "open";
461
+ }>>;
462
+ lapsed: z.ZodOptional<z.ZodEnum<{
463
+ never: "never";
464
+ ask: "ask";
465
+ open: "open";
466
+ }>>;
467
+ }, z.core.$strip>>;
468
+ }, z.core.$strip>;
469
+ export type ReachSnapshot = z.infer<typeof ReachSnapshot>;
470
+ /** `reach.set`'s params, which `reach.set.preview` takes too: the `revision` read, and only the declared answers that change. */
471
+ export declare const ReachSetParams: z.ZodObject<{
472
+ revision: z.ZodString;
473
+ changes: z.ZodObject<{
474
+ message: z.ZodOptional<z.ZodEnum<{
475
+ never: "never";
476
+ ask: "ask";
477
+ open: "open";
478
+ }>>;
479
+ ask: z.ZodOptional<z.ZodEnum<{
480
+ never: "never";
481
+ ask: "ask";
482
+ open: "open";
483
+ }>>;
484
+ }, z.core.$strict>;
485
+ }, z.core.$strict>;
486
+ export type ReachSetParams = z.infer<typeof ReachSetParams>;
487
+ /** The fixed words of the two questions, in `reach.get`'s order. */
488
+ export declare const REACH_QUESTIONS: readonly {
489
+ id: ReachGroupId;
490
+ label: string;
491
+ options: readonly ReachOption[];
492
+ }[];
255
493
  export declare const CONSENT_METHODS: {
494
+ /**
495
+ * The person's two reach choices (spec §6.9, "Reach choices"), each with its options and the current value (null:
496
+ * none made, the defaults apply), and a revision. Read-only.
497
+ */
498
+ readonly "reach.get": {
499
+ readonly params: z.ZodObject<{}, z.core.$strict>;
500
+ readonly result: z.ZodObject<{
501
+ revision: z.ZodString;
502
+ available: z.ZodBoolean;
503
+ groups: z.ZodArray<z.ZodObject<{
504
+ id: z.ZodEnum<{
505
+ message: "message";
506
+ ask: "ask";
507
+ }>;
508
+ label: z.ZodString;
509
+ options: z.ZodArray<z.ZodObject<{
510
+ value: z.ZodEnum<{
511
+ never: "never";
512
+ ask: "ask";
513
+ open: "open";
514
+ }>;
515
+ label: z.ZodString;
516
+ description: z.ZodString;
517
+ }, z.core.$strip>>;
518
+ value: z.ZodNullable<z.ZodEnum<{
519
+ never: "never";
520
+ ask: "ask";
521
+ open: "open";
522
+ }>>;
523
+ lapsed: z.ZodOptional<z.ZodEnum<{
524
+ never: "never";
525
+ ask: "ask";
526
+ open: "open";
527
+ }>>;
528
+ }, z.core.$strip>>;
529
+ }, z.core.$strip>;
530
+ };
531
+ /**
532
+ * Records the declared answers in `changes` as the person's relation grants, signed by this device and sent to
533
+ * their other devices, in one transaction; returns the new snapshot. `conflict` when `revision` is not the current
534
+ * one: nothing is changed, and the caller reads again.
535
+ */
536
+ readonly "reach.set": {
537
+ readonly params: z.ZodObject<{
538
+ revision: z.ZodString;
539
+ changes: z.ZodObject<{
540
+ message: z.ZodOptional<z.ZodEnum<{
541
+ never: "never";
542
+ ask: "ask";
543
+ open: "open";
544
+ }>>;
545
+ ask: z.ZodOptional<z.ZodEnum<{
546
+ never: "never";
547
+ ask: "ask";
548
+ open: "open";
549
+ }>>;
550
+ }, z.core.$strict>;
551
+ }, z.core.$strict>;
552
+ readonly result: z.ZodObject<{
553
+ revision: z.ZodString;
554
+ available: z.ZodBoolean;
555
+ groups: z.ZodArray<z.ZodObject<{
556
+ id: z.ZodEnum<{
557
+ message: "message";
558
+ ask: "ask";
559
+ }>;
560
+ label: z.ZodString;
561
+ options: z.ZodArray<z.ZodObject<{
562
+ value: z.ZodEnum<{
563
+ never: "never";
564
+ ask: "ask";
565
+ open: "open";
566
+ }>;
567
+ label: z.ZodString;
568
+ description: z.ZodString;
569
+ }, z.core.$strip>>;
570
+ value: z.ZodNullable<z.ZodEnum<{
571
+ never: "never";
572
+ ask: "ask";
573
+ open: "open";
574
+ }>>;
575
+ lapsed: z.ZodOptional<z.ZodEnum<{
576
+ never: "never";
577
+ ask: "ask";
578
+ open: "open";
579
+ }>>;
580
+ }, z.core.$strip>>;
581
+ }, z.core.$strip>;
582
+ };
583
+ /** What `reach.set` with these params would do, in one fixed sentence; checks them the same way (`conflict` too); changes nothing. */
584
+ readonly "reach.set.preview": {
585
+ readonly params: z.ZodObject<{
586
+ revision: z.ZodString;
587
+ changes: z.ZodObject<{
588
+ message: z.ZodOptional<z.ZodEnum<{
589
+ never: "never";
590
+ ask: "ask";
591
+ open: "open";
592
+ }>>;
593
+ ask: z.ZodOptional<z.ZodEnum<{
594
+ never: "never";
595
+ ask: "ask";
596
+ open: "open";
597
+ }>>;
598
+ }, z.core.$strict>;
599
+ }, z.core.$strict>;
600
+ readonly result: z.ZodObject<{
601
+ sentence: z.ZodString;
602
+ }, z.core.$strip>;
603
+ };
256
604
  /** This person's grants, newest first, and the review list. With `subject`, only that subject's. */
257
605
  readonly "grant.list": {
258
606
  readonly params: z.ZodObject<{
259
607
  subject: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
260
608
  person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
261
609
  }, z.core.$strict>, z.ZodObject<{
262
- channel: z.ZodString;
610
+ conv: z.ZodString;
263
611
  }, z.core.$strict>]>>;
264
612
  }, z.core.$strict>;
265
613
  readonly result: z.ZodObject<{
@@ -278,31 +626,29 @@ export declare const CONSENT_METHODS: {
278
626
  blocked: "blocked";
279
627
  }>>;
280
628
  ask: z.ZodOptional<z.ZodEnum<{
281
- open: "open";
282
629
  request: "request";
630
+ open: "open";
283
631
  no: "no";
284
632
  }>>;
285
633
  trustedUntil: z.ZodOptional<z.ZodNumber>;
286
634
  discoverable: z.ZodOptional<z.ZodBoolean>;
287
635
  subject: z.ZodUnion<readonly [z.ZodObject<{
288
636
  person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
289
- }, z.core.$strip>, z.ZodObject<{
290
- channel: z.ZodString;
291
- name: z.ZodOptional<z.ZodString>;
292
- }, z.core.$strip>]>;
637
+ }, z.core.$strict>, z.ZodObject<{
638
+ conv: z.ZodString;
639
+ }, z.core.$strict>]>;
293
640
  }, z.core.$strip>>;
294
641
  review: z.ZodArray<z.ZodObject<{
295
642
  subject: z.ZodUnion<readonly [z.ZodObject<{
296
643
  person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
297
- }, z.core.$strip>, z.ZodObject<{
298
- channel: z.ZodString;
299
- name: z.ZodOptional<z.ZodString>;
300
- }, z.core.$strip>]>;
644
+ }, z.core.$strict>, z.ZodObject<{
645
+ conv: z.ZodString;
646
+ }, z.core.$strict>]>;
301
647
  chat: z.ZodOptional<z.ZodLiteral<"open">>;
302
648
  agentMail: z.ZodOptional<z.ZodLiteral<"open">>;
303
649
  ask: z.ZodOptional<z.ZodEnum<{
304
- open: "open";
305
650
  request: "request";
651
+ open: "open";
306
652
  }>>;
307
653
  trustedUntil: z.ZodOptional<z.ZodNumber>;
308
654
  discoverable: z.ZodOptional<z.ZodLiteral<true>>;
@@ -327,8 +673,8 @@ export declare const CONSENT_METHODS: {
327
673
  blocked: "blocked";
328
674
  }>>;
329
675
  ask: z.ZodOptional<z.ZodEnum<{
330
- open: "open";
331
676
  request: "request";
677
+ open: "open";
332
678
  no: "no";
333
679
  }>>;
334
680
  trustedUntil: z.ZodOptional<z.ZodNumber>;
@@ -336,7 +682,7 @@ export declare const CONSENT_METHODS: {
336
682
  subject: z.ZodUnion<readonly [z.ZodObject<{
337
683
  person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
338
684
  }, z.core.$strict>, z.ZodObject<{
339
- channel: z.ZodString;
685
+ conv: z.ZodString;
340
686
  }, z.core.$strict>]>;
341
687
  }, z.core.$strict>;
342
688
  readonly result: z.ZodObject<{
@@ -355,18 +701,17 @@ export declare const CONSENT_METHODS: {
355
701
  blocked: "blocked";
356
702
  }>>;
357
703
  ask: z.ZodOptional<z.ZodEnum<{
358
- open: "open";
359
704
  request: "request";
705
+ open: "open";
360
706
  no: "no";
361
707
  }>>;
362
708
  trustedUntil: z.ZodOptional<z.ZodNumber>;
363
709
  discoverable: z.ZodOptional<z.ZodBoolean>;
364
710
  subject: z.ZodUnion<readonly [z.ZodObject<{
365
711
  person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
366
- }, z.core.$strip>, z.ZodObject<{
367
- channel: z.ZodString;
368
- name: z.ZodOptional<z.ZodString>;
369
- }, z.core.$strip>]>;
712
+ }, z.core.$strict>, z.ZodObject<{
713
+ conv: z.ZodString;
714
+ }, z.core.$strict>]>;
370
715
  }, z.core.$strip>;
371
716
  }, z.core.$strip>;
372
717
  };
@@ -384,8 +729,8 @@ export declare const CONSENT_METHODS: {
384
729
  blocked: "blocked";
385
730
  }>>;
386
731
  ask: z.ZodOptional<z.ZodEnum<{
387
- open: "open";
388
732
  request: "request";
733
+ open: "open";
389
734
  no: "no";
390
735
  }>>;
391
736
  trustedUntil: z.ZodOptional<z.ZodNumber>;
@@ -393,7 +738,7 @@ export declare const CONSENT_METHODS: {
393
738
  subject: z.ZodUnion<readonly [z.ZodObject<{
394
739
  person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
395
740
  }, z.core.$strict>, z.ZodObject<{
396
- channel: z.ZodString;
741
+ conv: z.ZodString;
397
742
  }, z.core.$strict>]>;
398
743
  }, z.core.$strict>;
399
744
  readonly result: z.ZodObject<{
@@ -405,6 +750,16 @@ export declare const CONSENT_METHODS: {
405
750
  readonly params: z.ZodObject<{}, z.core.$strict>;
406
751
  readonly result: z.ZodObject<{
407
752
  requests: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
753
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
754
+ name: z.ZodEnum<{
755
+ accept: "accept";
756
+ decline: "decline";
757
+ once: "once";
758
+ always: "always";
759
+ block: "block";
760
+ }>;
761
+ token: z.ZodString;
762
+ }, z.core.$strict>>>;
408
763
  id: z.ZodString;
409
764
  kind: z.ZodEnum<{
410
765
  message: "message";
@@ -422,12 +777,29 @@ export declare const CONSENT_METHODS: {
422
777
  at: z.ZodNumber;
423
778
  exp: z.ZodNumber;
424
779
  }, z.core.$strip>, z.ZodObject<{
780
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
781
+ name: z.ZodEnum<{
782
+ accept: "accept";
783
+ decline: "decline";
784
+ once: "once";
785
+ always: "always";
786
+ block: "block";
787
+ }>;
788
+ token: z.ZodString;
789
+ }, z.core.$strict>>>;
425
790
  id: z.ZodString;
426
791
  kind: z.ZodLiteral<"contact">;
792
+ cid: z.ZodOptional<z.ZodString>;
793
+ state: z.ZodEnum<{
794
+ accepted: "accepted";
795
+ pending: "pending";
796
+ answering: "answering";
797
+ resend: "resend";
798
+ }>;
427
799
  from: z.ZodObject<{
428
800
  person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
429
801
  device: z.ZodString;
430
- label: z.ZodString;
802
+ label: z.ZodOptional<z.ZodString>;
431
803
  name: z.ZodString;
432
804
  email: z.ZodOptional<z.ZodString>;
433
805
  org: z.ZodEnum<{
@@ -440,12 +812,39 @@ export declare const CONSENT_METHODS: {
440
812
  at: z.ZodNumber;
441
813
  exp: z.ZodNumber;
442
814
  }, z.core.$strip>, z.ZodObject<{
815
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
816
+ name: z.ZodEnum<{
817
+ accept: "accept";
818
+ decline: "decline";
819
+ once: "once";
820
+ always: "always";
821
+ block: "block";
822
+ }>;
823
+ token: z.ZodString;
824
+ }, z.core.$strict>>>;
443
825
  id: z.ZodString;
444
826
  kind: z.ZodLiteral<"suggestion">;
445
827
  agent: z.ZodString;
446
828
  email: z.ZodString;
447
829
  at: z.ZodNumber;
448
- }, z.core.$strip>]>>;
830
+ }, z.core.$strip>, z.ZodObject<{
831
+ actions: z.ZodOptional<z.ZodArray<z.ZodObject<{
832
+ name: z.ZodEnum<{
833
+ accept: "accept";
834
+ decline: "decline";
835
+ once: "once";
836
+ always: "always";
837
+ block: "block";
838
+ }>;
839
+ token: z.ZodString;
840
+ }, z.core.$strict>>>;
841
+ kind: z.ZodLiteral<"agent-invitation">;
842
+ id: z.ZodString;
843
+ cid: z.ZodString;
844
+ from: z.ZodString;
845
+ to: z.ZodString;
846
+ at: z.ZodNumber;
847
+ }, z.core.$strict>]>>;
449
848
  }, z.core.$strip>;
450
849
  };
451
850
  /**
@@ -457,13 +856,14 @@ export declare const CONSENT_METHODS: {
457
856
  readonly params: z.ZodObject<{
458
857
  id: z.ZodString;
459
858
  answer: z.ZodEnum<{
460
- once: "once";
461
- always: "always";
462
859
  accept: "accept";
463
860
  decline: "decline";
861
+ once: "once";
862
+ always: "always";
464
863
  block: "block";
465
864
  }>;
466
865
  all: z.ZodOptional<z.ZodBoolean>;
866
+ token: z.ZodOptional<z.ZodString>;
467
867
  }, z.core.$strict>;
468
868
  readonly result: z.ZodObject<{
469
869
  answered: z.ZodArray<z.ZodString>;
@@ -480,19 +880,21 @@ export declare const CONSENT_METHODS: {
480
880
  readonly params: z.ZodObject<{
481
881
  id: z.ZodString;
482
882
  answer: z.ZodEnum<{
483
- once: "once";
484
- always: "always";
485
883
  accept: "accept";
486
884
  decline: "decline";
885
+ once: "once";
886
+ always: "always";
487
887
  block: "block";
488
888
  }>;
489
889
  all: z.ZodOptional<z.ZodBoolean>;
890
+ token: z.ZodOptional<z.ZodString>;
490
891
  }, z.core.$strict>;
491
892
  readonly result: z.ZodObject<{
492
893
  kind: z.ZodEnum<{
493
894
  message: "message";
494
895
  task: "task";
495
896
  contact: "contact";
897
+ "agent-invitation": "agent-invitation";
496
898
  suggestion: "suggestion";
497
899
  }>;
498
900
  from: z.ZodObject<{
@@ -525,7 +927,7 @@ export declare const CONSENT_METHODS: {
525
927
  }, z.core.$strict>;
526
928
  readonly result: z.ZodObject<{
527
929
  id: z.ZodString;
528
- conversation: z.ZodString;
930
+ cid: z.ZodString;
529
931
  person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
530
932
  }, z.core.$strip>;
531
933
  };