@joe-broadhead/messaging 0.8.0 → 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 (50) hide show
  1. package/CHANGELOG.md +150 -0
  2. package/dist/bin/messaging-mcp.js +202 -31
  3. package/dist/bin/messaging-relay.js +291 -43
  4. package/dist/bin/messaging.js +290 -32
  5. package/dist/bin/messagingd.js +1158 -138
  6. package/dist/lib/modules/core/agent/present.js +5 -0
  7. package/dist/lib/modules/core/agent-tools.js +12 -0
  8. package/dist/lib/modules/core/consent.js +54 -14
  9. package/dist/lib/modules/core/contact-card.js +3 -3
  10. package/dist/lib/modules/core/index.js +1 -1
  11. package/dist/lib/modules/core/jelly-host.js +3 -0
  12. package/dist/lib/modules/core/schema/common.js +2 -0
  13. package/dist/lib/modules/core/schema/consent.js +20 -3
  14. package/dist/lib/modules/core/schema/conv-frames.js +10 -3
  15. package/dist/lib/modules/core/schema/directory-frames.js +8 -3
  16. package/dist/lib/modules/core/schema/errors.js +3 -2
  17. package/dist/lib/modules/core/schema/ipc/consent.js +85 -10
  18. package/dist/lib/modules/core/schema/ipc/conversation-views.js +8 -1
  19. package/dist/lib/modules/core/schema/ipc/conversations.js +5 -1
  20. package/dist/lib/modules/core/schema/ipc/device.js +7 -0
  21. package/dist/lib/modules/core/schema/ipc/jelly.js +14 -7
  22. package/dist/lib/modules/core/schema/ipc/shapes.js +60 -1
  23. package/dist/lib/modules/core/schema/ipc.js +51 -3
  24. package/dist/lib/modules/core/version.js +1 -1
  25. package/dist/spec/messaging-v1.md +321 -49
  26. package/dist/types/core/agent/present.d.ts +1 -1
  27. package/dist/types/core/agent-tools.d.ts +32 -0
  28. package/dist/types/core/consent.d.ts +30 -7
  29. package/dist/types/core/contact-card.d.ts +3 -3
  30. package/dist/types/core/conversation-agent-tools.d.ts +21 -0
  31. package/dist/types/core/index.d.ts +1 -1
  32. package/dist/types/core/schema/common.d.ts +2 -0
  33. package/dist/types/core/schema/consent.d.ts +23 -2
  34. package/dist/types/core/schema/conv-frames.d.ts +6 -2
  35. package/dist/types/core/schema/directory-frames.d.ts +8 -3
  36. package/dist/types/core/schema/envelope.d.ts +2 -0
  37. package/dist/types/core/schema/errors.d.ts +2 -0
  38. package/dist/types/core/schema/ipc/consent.d.ts +377 -15
  39. package/dist/types/core/schema/ipc/conversation-views.d.ts +176 -0
  40. package/dist/types/core/schema/ipc/conversations.d.ts +368 -0
  41. package/dist/types/core/schema/ipc/device.d.ts +6 -0
  42. package/dist/types/core/schema/ipc/jelly.d.ts +14 -6
  43. package/dist/types/core/schema/ipc/shapes.d.ts +198 -0
  44. package/dist/types/core/schema/ipc/surfaces.d.ts +1 -0
  45. package/dist/types/core/schema/ipc/tasks.d.ts +2 -0
  46. package/dist/types/core/schema/ipc.d.ts +826 -3
  47. package/dist/types/core/schema/relay.d.ts +4 -0
  48. package/dist/types/core/version.d.ts +1 -1
  49. package/dist/types/ipc/server.d.ts +6 -0
  50. package/package.json +1 -1
@@ -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.
@@ -133,6 +140,21 @@ export declare const TaskFollowUp: z.ZodObject<{
133
140
  at: z.ZodNumber;
134
141
  }, z.core.$strip>;
135
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>;
136
158
  export declare const TaskRecord: z.ZodObject<{
137
159
  task: z.ZodObject<{
138
160
  contextId: z.ZodOptional<z.ZodString>;
@@ -248,8 +270,183 @@ export declare const TaskRecord: z.ZodObject<{
248
270
  }>;
249
271
  at: z.ZodNumber;
250
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>>;
251
297
  }, z.core.$strip>;
252
298
  export type TaskRecord = z.infer<typeof TaskRecord>;
299
+ /**
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.
303
+ */
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>;
253
450
  /**
254
451
  * Where a retained task envelope went: an agent session `person/agent@label`.
255
452
  */
@@ -302,6 +499,7 @@ export declare const SendResult: z.ZodObject<{
302
499
  jelly_unavailable: "jelly_unavailable";
303
500
  log_conflict: "log_conflict";
304
501
  conv_conflict: "conv_conflict";
502
+ conflict: "conflict";
305
503
  stale_epoch: "stale_epoch";
306
504
  device_limit: "device_limit";
307
505
  admission_required: "admission_required";
@@ -229,6 +229,7 @@ export declare const SURFACE_METHODS: {
229
229
  jelly_unavailable: "jelly_unavailable";
230
230
  log_conflict: "log_conflict";
231
231
  conv_conflict: "conv_conflict";
232
+ conflict: "conflict";
232
233
  stale_epoch: "stale_epoch";
233
234
  device_limit: "device_limit";
234
235
  admission_required: "admission_required";
@@ -76,6 +76,7 @@ export declare const TASK_SEND_METHODS: {
76
76
  jelly_unavailable: "jelly_unavailable";
77
77
  log_conflict: "log_conflict";
78
78
  conv_conflict: "conv_conflict";
79
+ conflict: "conflict";
79
80
  stale_epoch: "stale_epoch";
80
81
  device_limit: "device_limit";
81
82
  admission_required: "admission_required";
@@ -176,6 +177,7 @@ export declare const TASK_SEND_METHODS: {
176
177
  jelly_unavailable: "jelly_unavailable";
177
178
  log_conflict: "log_conflict";
178
179
  conv_conflict: "conv_conflict";
180
+ conflict: "conflict";
179
181
  stale_epoch: "stale_epoch";
180
182
  device_limit: "device_limit";
181
183
  admission_required: "admission_required";