@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
@@ -95,6 +95,8 @@ export declare const DeviceChangeView: z.ZodObject<{
95
95
  at: z.ZodNumber;
96
96
  }, z.core.$strip>;
97
97
  export type DeviceChangeView = z.infer<typeof DeviceChangeView>;
98
+ /** A presence feature name, such as `tasks`, `conversations` or `reach`. */
99
+ export declare const PresenceFeature: z.ZodString;
98
100
  /** One device of this device's person. */
99
101
  export declare const DeviceListEntry: z.ZodObject<{
100
102
  device: z.ZodString;
@@ -116,6 +118,7 @@ export declare const DeviceListEntry: z.ZodObject<{
116
118
  }>>;
117
119
  current: z.ZodBoolean;
118
120
  self: z.ZodBoolean;
121
+ away: z.ZodOptional<z.ZodLiteral<true>>;
119
122
  since: z.ZodOptional<z.ZodNumber>;
120
123
  unbound: z.ZodOptional<z.ZodObject<{
121
124
  at: z.ZodNumber;
@@ -128,6 +131,7 @@ export declare const DeviceListEntry: z.ZodObject<{
128
131
  }>;
129
132
  by: z.ZodString;
130
133
  }, z.core.$strip>>;
134
+ features: z.ZodOptional<z.ZodArray<z.ZodString>>;
131
135
  }, z.core.$strip>;
132
136
  export type DeviceListEntry = z.infer<typeof DeviceListEntry>;
133
137
  /** What a link request asks for, and the code to compare. */
@@ -220,6 +224,7 @@ export declare const LoginState: z.ZodDiscriminatedUnion<[z.ZodObject<{
220
224
  refused: "refused";
221
225
  declined: "declined";
222
226
  request_required: "request_required";
227
+ peer_outdated: "peer_outdated";
223
228
  rate_limited: "rate_limited";
224
229
  loop_guard: "loop_guard";
225
230
  too_large: "too_large";
@@ -237,6 +242,7 @@ export declare const LoginState: z.ZodDiscriminatedUnion<[z.ZodObject<{
237
242
  jelly_unavailable: "jelly_unavailable";
238
243
  log_conflict: "log_conflict";
239
244
  conv_conflict: "conv_conflict";
245
+ conflict: "conflict";
240
246
  stale_epoch: "stale_epoch";
241
247
  device_limit: "device_limit";
242
248
  admission_required: "admission_required";
@@ -369,6 +375,7 @@ export declare const DEVICE_METHODS: {
369
375
  }>>;
370
376
  current: z.ZodBoolean;
371
377
  self: z.ZodBoolean;
378
+ away: z.ZodOptional<z.ZodLiteral<true>>;
372
379
  since: z.ZodOptional<z.ZodNumber>;
373
380
  unbound: z.ZodOptional<z.ZodObject<{
374
381
  at: z.ZodNumber;
@@ -381,6 +388,7 @@ export declare const DEVICE_METHODS: {
381
388
  }>;
382
389
  by: z.ZodString;
383
390
  }, z.core.$strip>>;
391
+ features: z.ZodOptional<z.ZodArray<z.ZodString>>;
384
392
  }, z.core.$strip>>;
385
393
  }, z.core.$strip>;
386
394
  };
@@ -510,6 +518,7 @@ export declare const DEVICE_METHODS: {
510
518
  refused: "refused";
511
519
  declined: "declined";
512
520
  request_required: "request_required";
521
+ peer_outdated: "peer_outdated";
513
522
  rate_limited: "rate_limited";
514
523
  loop_guard: "loop_guard";
515
524
  too_large: "too_large";
@@ -527,6 +536,7 @@ export declare const DEVICE_METHODS: {
527
536
  jelly_unavailable: "jelly_unavailable";
528
537
  log_conflict: "log_conflict";
529
538
  conv_conflict: "conv_conflict";
539
+ conflict: "conflict";
530
540
  stale_epoch: "stale_epoch";
531
541
  device_limit: "device_limit";
532
542
  admission_required: "admission_required";
@@ -2,16 +2,16 @@
2
2
  * The IPC methods a Jelly host needs (spec §8.2, §8.11; design §13.6, §13.10-§13.12), served in every deployment:
3
3
  *
4
4
  * - Agent tier: `daemon.health`, a cheap status with no secrets and no counts.
5
- * - Human tier: `agents.list` and `agents.read` (the person's view of their own agents' traffic on this device),
6
- * `notice.subscribe`, `notice.list` and `notice.ack` (notices in fixed categories), and the read-only preview
5
+ * - Human tier: `notice.subscribe`, `notice.list` and `notice.ack` (notices in fixed categories), and the read-only preview
7
6
  * `device.remove.preview`.
8
7
  *
9
8
  * Spread into `IPC_METHODS`; `HOST_SCOPE_METHODS` (in `ipc.ts`) is what a host-scope action grant allows.
10
9
  */
11
10
  import { z } from "zod";
12
11
  /**
13
- * A notice's id, stable per source: `m_<line id>` (a line), `r_<request id>` (a held request), `a_<id>` (an alert).
14
- * A replay repeats the same ids, so a host rings once.
12
+ * A notice's id, stable per source: `m_<line id>` (a line), `m_task<task id>` (a task another person's agent asked of
13
+ * one of this person's agents), `r_<request id>` (a held request), `a_<id>` (an alert). A replay repeats the same ids, so
14
+ * a host rings once.
15
15
  */
16
16
  export declare const NoticeId: z.ZodString;
17
17
  export type NoticeId = z.infer<typeof NoticeId>;
@@ -64,9 +64,11 @@ export declare const NoticeDevice: z.ZodObject<{
64
64
  }, z.core.$strip>;
65
65
  export type NoticeDevice = z.infer<typeof NoticeDevice>;
66
66
  /**
67
- * One notice (design §13.11). `message`: a line in a DM or a channel from another person or their agent, or an
68
- * agent's line to its own person; `request`: a request held for the person; `alert`: an alarm of this device, a
69
- * change of the person's other devices (with `device`), or trust the person gave that ends within 7 days (with `from`).
67
+ * One notice (design §13.11). `message`: a line in a DM or a channel from another person or their agent, an
68
+ * agent's line to its own person, or a task another person's agent asked of one of this person's agents (with `key`
69
+ * `task:<task id>`, and `from` that person), never a request: it waits on the agent, not the person; `request`: a request
70
+ * held for the person (an ask held for consent stays one); `alert`: an alarm of this device, a change of the person's
71
+ * other devices (with `device`), or trust the person gave that ends within 7 days (with `from`).
70
72
  * `line` is the first line of a message, through `cleanPeerText`, only when the caller asked for lines; alerts carry
71
73
  * fixed text. `from.name` and `from.email` are untrusted text in a hosted realm.
72
74
  */
@@ -77,7 +79,6 @@ export declare const Notice: z.ZodObject<{
77
79
  request: "request";
78
80
  alert: "alert";
79
81
  }>;
80
- conversation: z.ZodOptional<z.ZodString>;
81
82
  from: z.ZodOptional<z.ZodObject<{
82
83
  name: z.ZodString;
83
84
  email: z.ZodOptional<z.ZodString>;
@@ -125,12 +126,12 @@ export declare const Notice: z.ZodObject<{
125
126
  team: "team";
126
127
  }>>;
127
128
  }, z.core.$strip>>;
129
+ key: z.ZodOptional<z.ZodString>;
128
130
  at: z.ZodNumber;
129
131
  }, z.core.$strip>;
130
132
  export type Notice = z.infer<typeof Notice>;
131
- /** What the person's badges count: unread lines in their conversations, and requests held for them. */
133
+ /** What the person's badges count: requests held for them. Conversation read state remains staged. */
132
134
  export declare const NoticeCounts: z.ZodObject<{
133
- unread: z.ZodNumber;
134
135
  requests: z.ZodNumber;
135
136
  }, z.core.$strip>;
136
137
  /** `daemon.health` (spec §8.2): the daemon's state, with no secrets and no counts. */
@@ -160,18 +161,6 @@ export declare const DaemonHealth: z.ZodObject<{
160
161
  storeSchema: z.ZodNumber;
161
162
  }, z.core.$strip>;
162
163
  export type DaemonHealth = z.infer<typeof DaemonHealth>;
163
- /** One local agent (a registered or kept session) and its traffic on this device. */
164
- export declare const AgentSummary: z.ZodObject<{
165
- agent: z.ZodString;
166
- conversations: z.ZodNumber;
167
- unread: z.ZodNumber;
168
- lastAt: z.ZodOptional<z.ZodNumber>;
169
- state: z.ZodEnum<{
170
- idle: "idle";
171
- busy: "busy";
172
- kept: "kept";
173
- }>;
174
- }, z.core.$strip>;
175
164
  export declare const JELLY_METHODS: {
176
165
  /**
177
166
  * Agent tier. A cheap status for a host that polls: the daemon's state, the relay, the directory, an alarm, and
@@ -205,92 +194,6 @@ export declare const JELLY_METHODS: {
205
194
  storeSchema: z.ZodNumber;
206
195
  }, z.core.$strip>;
207
196
  };
208
- /** Human tier. This person's local agents on this device, most recent first. Read-only. */
209
- readonly "agents.list": {
210
- readonly params: z.ZodObject<{}, z.core.$strict>;
211
- readonly result: z.ZodObject<{
212
- agents: z.ZodArray<z.ZodObject<{
213
- agent: z.ZodString;
214
- conversations: z.ZodNumber;
215
- unread: z.ZodNumber;
216
- lastAt: z.ZodOptional<z.ZodNumber>;
217
- state: z.ZodEnum<{
218
- idle: "idle";
219
- busy: "busy";
220
- kept: "kept";
221
- }>;
222
- }, z.core.$strip>>;
223
- }, z.core.$strip>;
224
- };
225
- /**
226
- * Human tier. One local agent's traffic: without `conversation`, the other agents it has mail or tasks with, most
227
- * recent first; with `conversation` (`agent:<person>/<agent>`), a page of its entries, as `conv.read` gives them to
228
- * the agent, latest first unless `before` names an entry. Changes no stage and sends no receipt. Peer text is
229
- * untrusted: a client cleans it for display.
230
- */
231
- readonly "agents.read": {
232
- readonly params: z.ZodObject<{
233
- agent: z.ZodString;
234
- conversation: z.ZodOptional<z.ZodString>;
235
- before: z.ZodOptional<z.ZodObject<{
236
- at: z.ZodNumber;
237
- id: z.ZodString;
238
- }, z.core.$strict>>;
239
- limit: z.ZodOptional<z.ZodNumber>;
240
- }, z.core.$strict>;
241
- readonly result: z.ZodDiscriminatedUnion<[z.ZodObject<{
242
- kind: z.ZodLiteral<"conversations">;
243
- conversations: z.ZodArray<z.ZodObject<{
244
- conversation: z.ZodString;
245
- unread: z.ZodNumber;
246
- lastAt: z.ZodNumber;
247
- }, z.core.$strip>>;
248
- }, z.core.$strip>, z.ZodObject<{
249
- kind: z.ZodLiteral<"entries">;
250
- conversation: z.ZodString;
251
- entries: z.ZodArray<z.ZodObject<{
252
- id: z.ZodString;
253
- kind: z.ZodEnum<{
254
- task: "task";
255
- mail: "mail";
256
- }>;
257
- direction: z.ZodEnum<{
258
- out: "out";
259
- in: "in";
260
- }>;
261
- peer: z.ZodString;
262
- at: z.ZodNumber;
263
- text: z.ZodOptional<z.ZodString>;
264
- taskId: z.ZodOptional<z.ZodString>;
265
- stage: z.ZodOptional<z.ZodEnum<{
266
- accepted: "accepted";
267
- relayed: "relayed";
268
- delivered: "delivered";
269
- held: "held";
270
- handed_to_agent: "handed_to_agent";
271
- read: "read";
272
- replied: "replied";
273
- rejected: "rejected";
274
- expired: "expired";
275
- }>>;
276
- role: z.ZodOptional<z.ZodEnum<{
277
- requester: "requester";
278
- executor: "executor";
279
- }>>;
280
- state: z.ZodOptional<z.ZodEnum<{
281
- TASK_STATE_SUBMITTED: "TASK_STATE_SUBMITTED";
282
- TASK_STATE_WORKING: "TASK_STATE_WORKING";
283
- TASK_STATE_COMPLETED: "TASK_STATE_COMPLETED";
284
- TASK_STATE_FAILED: "TASK_STATE_FAILED";
285
- TASK_STATE_CANCELED: "TASK_STATE_CANCELED";
286
- TASK_STATE_INPUT_REQUIRED: "TASK_STATE_INPUT_REQUIRED";
287
- TASK_STATE_REJECTED: "TASK_STATE_REJECTED";
288
- TASK_STATE_AUTH_REQUIRED: "TASK_STATE_AUTH_REQUIRED";
289
- }>>;
290
- }, z.core.$strip>>;
291
- more: z.ZodBoolean;
292
- }, z.core.$strip>], "kind">;
293
- };
294
197
  /**
295
198
  * Human tier; host scope in `deployment: "jelly"`. Replays the unacknowledged notices after `after` (all of them
296
199
  * without it), oldest first, as `notice` events on this connection, then sends each new one. With `lines`, a
@@ -319,7 +222,6 @@ export declare const JELLY_METHODS: {
319
222
  request: "request";
320
223
  alert: "alert";
321
224
  }>;
322
- conversation: z.ZodOptional<z.ZodString>;
323
225
  from: z.ZodOptional<z.ZodObject<{
324
226
  name: z.ZodString;
325
227
  email: z.ZodOptional<z.ZodString>;
@@ -367,10 +269,10 @@ export declare const JELLY_METHODS: {
367
269
  team: "team";
368
270
  }>>;
369
271
  }, z.core.$strip>>;
272
+ key: z.ZodOptional<z.ZodString>;
370
273
  at: z.ZodNumber;
371
274
  }, z.core.$strip>>;
372
275
  counts: z.ZodObject<{
373
- unread: z.ZodNumber;
374
276
  requests: z.ZodNumber;
375
277
  }, z.core.$strip>;
376
278
  }, z.core.$strip>;
@@ -414,7 +316,9 @@ export declare const JELLY_METHODS: {
414
316
  * whose own person's mail may wake the host, and the tasks those sessions await (their unfinished requests). The relay
415
317
  * presents the ticket once, for such traffic only, while this device is offline (spec §7, "Wake tickets"). `relay`:
416
318
  * `armed` once the relay holds it, `pending` while it is not connected (it is sent at the next connection);
417
- * `awaiting`: how many task requests the relay may wake for. A directory realm only.
319
+ * `awaiting`: how many task requests the relay may wake for; `dms`: how many dms the relay may wake for, those whose
320
+ * other person shares a channel with this person and is not blocked or muted (spec §8.11, "Wake tickets"). A
321
+ * directory realm only.
418
322
  */
419
323
  readonly "wake.arm": {
420
324
  readonly params: z.ZodObject<{
@@ -428,6 +332,7 @@ export declare const JELLY_METHODS: {
428
332
  armed: "armed";
429
333
  }>;
430
334
  awaiting: z.ZodNumber;
335
+ dms: z.ZodNumber;
431
336
  }, z.core.$strip>;
432
337
  };
433
338
  /** Admin tier; host scope in `deployment: "jelly"`. The relay forgets this device's wake ticket (`pending` until connected). */
@@ -8,6 +8,13 @@ import { z } from "zod";
8
8
  /** Opaque, client-chosen session key, stable for the life of a client session, e.g. "opencode:<sessionID>". */
9
9
  export declare const SessionKey: z.ZodString;
10
10
  export type SessionKey = z.infer<typeof SessionKey>;
11
+ /**
12
+ * A source-issued action token (spec §8.2, "Action tokens"): 32 random bytes, base64url. The daemon mints one per
13
+ * action, item and human-tier view, keeps it in memory only, and spends it at its first presentation. Opaque to
14
+ * clients; never logged.
15
+ */
16
+ export declare const ActionToken: z.ZodString;
17
+ export type ActionToken = z.infer<typeof ActionToken>;
11
18
  /**
12
19
  * When the recipient will likely see a message (spec §8.2): a hint from its machine's last presence
13
20
  * at send time, never a promise.
@@ -21,8 +28,8 @@ export type SessionKey = z.infer<typeof SessionKey>;
21
28
  */
22
29
  export declare const SendExpect: z.ZodEnum<{
23
30
  kept: "kept";
24
- next_turn: "next_turn";
25
31
  wake: "wake";
32
+ next_turn: "next_turn";
26
33
  next_prompt: "next_prompt";
27
34
  on_read: "on_read";
28
35
  offline: "offline";
@@ -52,45 +59,14 @@ export declare const DirectoryEntry: z.ZodObject<{
52
59
  self: z.ZodBoolean;
53
60
  expect: z.ZodOptional<z.ZodEnum<{
54
61
  kept: "kept";
55
- next_turn: "next_turn";
56
62
  wake: "wake";
63
+ next_turn: "next_turn";
57
64
  next_prompt: "next_prompt";
58
65
  on_read: "on_read";
59
66
  offline: "offline";
60
67
  }>>;
61
68
  }, z.core.$strip>;
62
69
  export type DirectoryEntry = z.infer<typeof DirectoryEntry>;
63
- /** Chat text, at most `LIMITS.chatChars` UTF-16 code units (`max` would count code points). */
64
- export declare const ChatText: z.ZodString;
65
- /**
66
- * A position in this machine's chat order (spec §6.8): every filed line and every chat change takes
67
- * the next one. Local: another machine numbers the same line differently. 0 is before the first.
68
- */
69
- export declare const ChatSeq: z.ZodNumber;
70
- export type ChatSeq = z.infer<typeof ChatSeq>;
71
- /** One transcript line (spec §6.8). `id` is the line's `messageId`, the same on every machine. */
72
- export declare const ChatLine: z.ZodObject<{
73
- id: z.ZodString;
74
- seq: z.ZodNumber;
75
- at: z.ZodNumber;
76
- person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
77
- agent: z.ZodOptional<z.ZodString>;
78
- direction: z.ZodEnum<{
79
- out: "out";
80
- in: "in";
81
- }>;
82
- body: z.ZodString;
83
- thread: z.ZodOptional<z.ZodString>;
84
- state: z.ZodOptional<z.ZodEnum<{
85
- delivered: "delivered";
86
- held: "held";
87
- refused: "refused";
88
- sent: "sent";
89
- }>>;
90
- refused: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>>;
91
- notice: z.ZodOptional<z.ZodLiteral<true>>;
92
- }, z.core.$strip>;
93
- export type ChatLine = z.infer<typeof ChatLine>;
94
70
  /** The other end of an item or a task: a person's device and, when an agent wrote it, the agent. */
95
71
  export declare const PeerRef: z.ZodObject<{
96
72
  address: z.ZodString;
@@ -104,12 +80,14 @@ export declare const InboxItem: z.ZodObject<{
104
80
  id: z.ZodString;
105
81
  key: z.ZodString;
106
82
  from: z.ZodObject<{
107
- address: z.ZodString;
108
83
  person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
109
84
  agent: z.ZodOptional<z.ZodString>;
110
- device: z.ZodString;
111
- label: z.ZodString;
85
+ address: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
86
+ device: z.ZodOptional<z.ZodString>;
87
+ label: z.ZodOptional<z.ZodString>;
112
88
  }, z.core.$strip>;
89
+ cid: z.ZodOptional<z.ZodString>;
90
+ eventId: z.ZodOptional<z.ZodString>;
113
91
  kind: z.ZodEnum<{
114
92
  message: "message";
115
93
  task: "task";
@@ -142,8 +120,7 @@ export declare const InboxItem: z.ZodObject<{
142
120
  }, z.core.$strip>;
143
121
  export type InboxItem = z.infer<typeof InboxItem>;
144
122
  /**
145
- * A message this side sent to continue a task it requested (`msg.send` with `kind: "message"`
146
- * and the `taskId`), and how far it got, from this daemon's own delivery records (spec §6.3).
123
+ * A task continuation and its stage from this daemon's own delivery records (spec §6.3).
147
124
  */
148
125
  export declare const TaskFollowUp: z.ZodObject<{
149
126
  envelopeId: z.ZodString;
@@ -163,6 +140,21 @@ export declare const TaskFollowUp: z.ZodObject<{
163
140
  at: z.ZodNumber;
164
141
  }, z.core.$strip>;
165
142
  export type TaskFollowUp = z.infer<typeof TaskFollowUp>;
143
+ /** Most characters of `TaskRecord.signIn.tool`: the executor's words, cleaned and capped like a preview. */
144
+ export declare const TASK_SIGN_IN_TOOL_CHARS: 200;
145
+ /** Most characters of `TaskRecord.refusal.reason`: the executor's words, cleaned and capped like a message request. */
146
+ export declare const TASK_REFUSAL_CHARS: 500;
147
+ /** An id a host's engine chose for its session or its pending approval or question: an opaque, plain identifier. */
148
+ export declare const HostLocalId: z.ZodString;
149
+ /**
150
+ * The executor host's own pending approval or question that an `AUTH_REQUIRED` or `INPUT_REQUIRED` task waits on
151
+ * (spec §8.2, "The task view"): set by the person's own client with `task.question`, held in this daemon's memory only.
152
+ */
153
+ export declare const TaskQuestion: z.ZodObject<{
154
+ sessionId: z.ZodString;
155
+ approvalId: z.ZodString;
156
+ }, z.core.$strict>;
157
+ export type TaskQuestion = z.infer<typeof TaskQuestion>;
166
158
  export declare const TaskRecord: z.ZodObject<{
167
159
  task: z.ZodObject<{
168
160
  contextId: z.ZodOptional<z.ZodString>;
@@ -278,16 +270,190 @@ export declare const TaskRecord: z.ZodObject<{
278
270
  }>;
279
271
  at: z.ZodNumber;
280
272
  }, z.core.$strip>>>;
273
+ agent: z.ZodOptional<z.ZodString>;
274
+ person: z.ZodOptional<z.ZodObject<{
275
+ id: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
276
+ name: z.ZodString;
277
+ }, z.core.$strip>>;
278
+ org: z.ZodOptional<z.ZodEnum<{
279
+ other: "other";
280
+ none: "none";
281
+ same: "same";
282
+ }>>;
283
+ signIn: z.ZodOptional<z.ZodObject<{
284
+ tool: z.ZodOptional<z.ZodString>;
285
+ by: z.ZodEnum<{
286
+ you: "you";
287
+ them: "them";
288
+ }>;
289
+ }, z.core.$strip>>;
290
+ refusal: z.ZodOptional<z.ZodObject<{
291
+ reason: z.ZodString;
292
+ }, z.core.$strip>>;
293
+ question: z.ZodOptional<z.ZodObject<{
294
+ sessionId: z.ZodString;
295
+ approvalId: z.ZodString;
296
+ }, z.core.$strict>>;
281
297
  }, z.core.$strip>;
282
298
  export type TaskRecord = z.infer<typeof TaskRecord>;
283
299
  /**
284
- * Where a send went (`msg.send`, spec §8.2): an agent session `person/agent@label`, a person (a line
285
- * from an agent to them) or `#<channel>` (a post).
300
+ * One side of a task one of this person's agents on this device is in, as the person's own clients see it (spec §8.2,
301
+ * "The person's tasks"): the task view without the session key (a bearer credential), with `session` the agent's name
302
+ * and, on the requester side of a task that has not ended, J2's `cancel` action minted for this view.
286
303
  */
287
- export declare const SendTarget: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
304
+ export declare const PersonTask: z.ZodObject<{
305
+ person: z.ZodOptional<z.ZodObject<{
306
+ id: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
307
+ name: z.ZodString;
308
+ }, z.core.$strip>>;
309
+ role: z.ZodEnum<{
310
+ requester: "requester";
311
+ executor: "executor";
312
+ }>;
313
+ task: z.ZodObject<{
314
+ contextId: z.ZodOptional<z.ZodString>;
315
+ status: z.ZodObject<{
316
+ state: z.ZodEnum<{
317
+ TASK_STATE_SUBMITTED: "TASK_STATE_SUBMITTED";
318
+ TASK_STATE_WORKING: "TASK_STATE_WORKING";
319
+ TASK_STATE_COMPLETED: "TASK_STATE_COMPLETED";
320
+ TASK_STATE_FAILED: "TASK_STATE_FAILED";
321
+ TASK_STATE_CANCELED: "TASK_STATE_CANCELED";
322
+ TASK_STATE_INPUT_REQUIRED: "TASK_STATE_INPUT_REQUIRED";
323
+ TASK_STATE_REJECTED: "TASK_STATE_REJECTED";
324
+ TASK_STATE_AUTH_REQUIRED: "TASK_STATE_AUTH_REQUIRED";
325
+ }>;
326
+ message: z.ZodOptional<z.ZodObject<{
327
+ messageId: z.ZodString;
328
+ contextId: z.ZodOptional<z.ZodString>;
329
+ taskId: z.ZodOptional<z.ZodString>;
330
+ role: z.ZodEnum<{
331
+ ROLE_USER: "ROLE_USER";
332
+ ROLE_AGENT: "ROLE_AGENT";
333
+ }>;
334
+ parts: z.ZodArray<z.ZodObject<{
335
+ text: z.ZodOptional<z.ZodString>;
336
+ raw: z.ZodOptional<z.ZodString>;
337
+ url: z.ZodOptional<z.ZodString>;
338
+ data: z.ZodOptional<z.ZodUnknown>;
339
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
340
+ filename: z.ZodOptional<z.ZodString>;
341
+ mediaType: z.ZodOptional<z.ZodString>;
342
+ }, z.core.$strip>>;
343
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
344
+ extensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
345
+ referenceTaskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
346
+ }, z.core.$strip>>;
347
+ timestamp: z.ZodOptional<z.ZodString>;
348
+ }, z.core.$strip>;
349
+ artifacts: z.ZodOptional<z.ZodArray<z.ZodObject<{
350
+ artifactId: z.ZodString;
351
+ name: z.ZodOptional<z.ZodString>;
352
+ description: z.ZodOptional<z.ZodString>;
353
+ parts: z.ZodArray<z.ZodObject<{
354
+ text: z.ZodOptional<z.ZodString>;
355
+ raw: z.ZodOptional<z.ZodString>;
356
+ url: z.ZodOptional<z.ZodString>;
357
+ data: z.ZodOptional<z.ZodUnknown>;
358
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
359
+ filename: z.ZodOptional<z.ZodString>;
360
+ mediaType: z.ZodOptional<z.ZodString>;
361
+ }, z.core.$strip>>;
362
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
363
+ extensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
364
+ }, z.core.$strip>>>;
365
+ history: z.ZodOptional<z.ZodArray<z.ZodObject<{
366
+ messageId: z.ZodString;
367
+ contextId: z.ZodOptional<z.ZodString>;
368
+ taskId: z.ZodOptional<z.ZodString>;
369
+ role: z.ZodEnum<{
370
+ ROLE_USER: "ROLE_USER";
371
+ ROLE_AGENT: "ROLE_AGENT";
372
+ }>;
373
+ parts: z.ZodArray<z.ZodObject<{
374
+ text: z.ZodOptional<z.ZodString>;
375
+ raw: z.ZodOptional<z.ZodString>;
376
+ url: z.ZodOptional<z.ZodString>;
377
+ data: z.ZodOptional<z.ZodUnknown>;
378
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
379
+ filename: z.ZodOptional<z.ZodString>;
380
+ mediaType: z.ZodOptional<z.ZodString>;
381
+ }, z.core.$strip>>;
382
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
383
+ extensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
384
+ referenceTaskIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
385
+ }, z.core.$strip>>>;
386
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
387
+ id: z.ZodString;
388
+ }, z.core.$strip>;
389
+ org: z.ZodOptional<z.ZodEnum<{
390
+ other: "other";
391
+ none: "none";
392
+ same: "same";
393
+ }>>;
394
+ agent: z.ZodOptional<z.ZodString>;
395
+ chain: z.ZodOptional<z.ZodObject<{
396
+ addresses: z.ZodArray<z.ZodString>;
397
+ depth: z.ZodNumber;
398
+ maxDepth: z.ZodNumber;
399
+ scope: z.ZodOptional<z.ZodArray<z.ZodString>>;
400
+ exp: z.ZodNumber;
401
+ }, z.core.$strip>>;
402
+ peer: z.ZodObject<{
403
+ address: z.ZodString;
404
+ person: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
405
+ agent: z.ZodOptional<z.ZodString>;
406
+ device: z.ZodString;
407
+ label: z.ZodString;
408
+ }, z.core.$strip>;
409
+ createdAt: z.ZodNumber;
410
+ updatedAt: z.ZodNumber;
411
+ followUps: z.ZodOptional<z.ZodArray<z.ZodObject<{
412
+ envelopeId: z.ZodString;
413
+ messageId: z.ZodString;
414
+ sentAt: z.ZodNumber;
415
+ stage: z.ZodEnum<{
416
+ accepted: "accepted";
417
+ relayed: "relayed";
418
+ delivered: "delivered";
419
+ held: "held";
420
+ handed_to_agent: "handed_to_agent";
421
+ read: "read";
422
+ replied: "replied";
423
+ rejected: "rejected";
424
+ expired: "expired";
425
+ }>;
426
+ at: z.ZodNumber;
427
+ }, z.core.$strip>>>;
428
+ signIn: z.ZodOptional<z.ZodObject<{
429
+ tool: z.ZodOptional<z.ZodString>;
430
+ by: z.ZodEnum<{
431
+ you: "you";
432
+ them: "them";
433
+ }>;
434
+ }, z.core.$strip>>;
435
+ refusal: z.ZodOptional<z.ZodObject<{
436
+ reason: z.ZodString;
437
+ }, z.core.$strip>>;
438
+ question: z.ZodOptional<z.ZodObject<{
439
+ sessionId: z.ZodString;
440
+ approvalId: z.ZodString;
441
+ }, z.core.$strict>>;
442
+ key: z.ZodOptional<z.ZodNever>;
443
+ session: z.ZodString;
444
+ cancel: z.ZodOptional<z.ZodObject<{
445
+ name: z.ZodLiteral<"cancel">;
446
+ token: z.ZodString;
447
+ }, z.core.$strict>>;
448
+ }, z.core.$strip>;
449
+ export type PersonTask = z.infer<typeof PersonTask>;
450
+ /**
451
+ * Where a retained task envelope went: an agent session `person/agent@label`.
452
+ */
453
+ export declare const SendTarget: z.ZodString;
288
454
  export type SendTarget = z.infer<typeof SendTarget>;
289
455
  export declare const SendResult: z.ZodObject<{
290
- to: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
456
+ to: z.ZodString;
291
457
  envelopeId: z.ZodString;
292
458
  messageId: z.ZodString;
293
459
  taskId: z.ZodOptional<z.ZodString>;
@@ -315,6 +481,7 @@ export declare const SendResult: z.ZodObject<{
315
481
  refused: "refused";
316
482
  declined: "declined";
317
483
  request_required: "request_required";
484
+ peer_outdated: "peer_outdated";
318
485
  rate_limited: "rate_limited";
319
486
  loop_guard: "loop_guard";
320
487
  too_large: "too_large";
@@ -332,6 +499,7 @@ export declare const SendResult: z.ZodObject<{
332
499
  jelly_unavailable: "jelly_unavailable";
333
500
  log_conflict: "log_conflict";
334
501
  conv_conflict: "conv_conflict";
502
+ conflict: "conflict";
335
503
  stale_epoch: "stale_epoch";
336
504
  device_limit: "device_limit";
337
505
  admission_required: "admission_required";
@@ -352,63 +520,11 @@ export declare const SendResult: z.ZodObject<{
352
520
  }>>;
353
521
  expect: z.ZodOptional<z.ZodEnum<{
354
522
  kept: "kept";
355
- next_turn: "next_turn";
356
523
  wake: "wake";
524
+ next_turn: "next_turn";
357
525
  next_prompt: "next_prompt";
358
526
  on_read: "on_read";
359
527
  offline: "offline";
360
528
  }>>;
361
529
  }, z.core.$strip>;
362
530
  export type SendResult = z.infer<typeof SendResult>;
363
- /** A place in a conversation page (`conv.read`): an entry's time and id. */
364
- export declare const ConvCursor: z.ZodObject<{
365
- at: z.ZodNumber;
366
- id: z.ZodString;
367
- }, z.core.$strict>;
368
- export type ConvCursor = z.infer<typeof ConvCursor>;
369
- /**
370
- * One entry of a conversation between a local session and one other session (spec §8.2
371
- * `conv.read`): mail either way, or a task either way. `text` is untrusted peer text for incoming
372
- * mail and for a task the other side asked for; clients frame it as data.
373
- */
374
- export declare const ConvEntry: z.ZodObject<{
375
- id: z.ZodString;
376
- kind: z.ZodEnum<{
377
- task: "task";
378
- mail: "mail";
379
- }>;
380
- direction: z.ZodEnum<{
381
- out: "out";
382
- in: "in";
383
- }>;
384
- peer: z.ZodString;
385
- at: z.ZodNumber;
386
- text: z.ZodOptional<z.ZodString>;
387
- taskId: z.ZodOptional<z.ZodString>;
388
- stage: z.ZodOptional<z.ZodEnum<{
389
- accepted: "accepted";
390
- relayed: "relayed";
391
- delivered: "delivered";
392
- held: "held";
393
- handed_to_agent: "handed_to_agent";
394
- read: "read";
395
- replied: "replied";
396
- rejected: "rejected";
397
- expired: "expired";
398
- }>>;
399
- role: z.ZodOptional<z.ZodEnum<{
400
- requester: "requester";
401
- executor: "executor";
402
- }>>;
403
- state: z.ZodOptional<z.ZodEnum<{
404
- TASK_STATE_SUBMITTED: "TASK_STATE_SUBMITTED";
405
- TASK_STATE_WORKING: "TASK_STATE_WORKING";
406
- TASK_STATE_COMPLETED: "TASK_STATE_COMPLETED";
407
- TASK_STATE_FAILED: "TASK_STATE_FAILED";
408
- TASK_STATE_CANCELED: "TASK_STATE_CANCELED";
409
- TASK_STATE_INPUT_REQUIRED: "TASK_STATE_INPUT_REQUIRED";
410
- TASK_STATE_REJECTED: "TASK_STATE_REJECTED";
411
- TASK_STATE_AUTH_REQUIRED: "TASK_STATE_AUTH_REQUIRED";
412
- }>>;
413
- }, z.core.$strip>;
414
- export type ConvEntry = z.infer<typeof ConvEntry>;