@joe-broadhead/messaging 0.7.0 → 0.8.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 (97) hide show
  1. package/CHANGELOG.md +259 -2
  2. package/dist/bin/messaging-mcp.js +5484 -3858
  3. package/dist/bin/messaging-relay.js +4728 -1136
  4. package/dist/bin/messaging.js +4616 -2807
  5. package/dist/bin/messagingd.js +16451 -9444
  6. package/dist/lib/modules/core/agent/operations.js +19 -327
  7. package/dist/lib/modules/core/agent/present.js +15 -55
  8. package/dist/lib/modules/core/agent-tools.js +46 -143
  9. package/dist/lib/modules/core/consent.js +1 -1
  10. package/dist/lib/modules/core/conversation/context.js +80 -0
  11. package/dist/lib/modules/core/conversation/event.js +125 -0
  12. package/dist/lib/modules/core/conversation/guest-invitation.js +42 -0
  13. package/dist/lib/modules/core/conversation/ids.js +38 -0
  14. package/dist/lib/modules/core/conversation/link.js +35 -0
  15. package/dist/lib/modules/core/conversation/log.js +988 -0
  16. package/dist/lib/modules/core/conversation/ratchet.js +243 -0
  17. package/dist/lib/modules/core/conversation/request-log.js +158 -0
  18. package/dist/lib/modules/core/conversation/request-seal.js +41 -0
  19. package/dist/lib/modules/core/conversation/requests.js +87 -0
  20. package/dist/lib/modules/core/conversation/seal.js +251 -0
  21. package/dist/lib/modules/core/conversation-agent-tools.js +69 -0
  22. package/dist/lib/modules/core/federation/directory-proof.js +83 -0
  23. package/dist/lib/modules/core/federation/proof-state.js +167 -0
  24. package/dist/lib/modules/core/federation/roster-proof.js +74 -0
  25. package/dist/lib/modules/core/index.js +16 -2
  26. package/dist/lib/modules/core/jelly-host.js +5 -5
  27. package/dist/lib/modules/core/schema/common.js +85 -3
  28. package/dist/lib/modules/core/schema/consent.js +5 -4
  29. package/dist/lib/modules/core/schema/contact-request.js +22 -0
  30. package/dist/lib/modules/core/schema/conv-frames.js +94 -0
  31. package/dist/lib/modules/core/schema/conversation.js +326 -0
  32. package/dist/lib/modules/core/schema/envelope.js +8 -24
  33. package/dist/lib/modules/core/schema/errors.js +42 -2
  34. package/dist/lib/modules/core/schema/guest-invitation.js +13 -0
  35. package/dist/lib/modules/core/schema/index.js +6 -0
  36. package/dist/lib/modules/core/schema/ipc/consent.js +13 -9
  37. package/dist/lib/modules/core/schema/ipc/conversation-views.js +80 -0
  38. package/dist/lib/modules/core/schema/ipc/conversations.js +128 -0
  39. package/dist/lib/modules/core/schema/ipc/device.js +2 -0
  40. package/dist/lib/modules/core/schema/ipc/jelly.js +3 -38
  41. package/dist/lib/modules/core/schema/ipc/shapes.js +14 -72
  42. package/dist/lib/modules/core/schema/ipc/surfaces.js +12 -195
  43. package/dist/lib/modules/core/schema/ipc/tasks.js +31 -0
  44. package/dist/lib/modules/core/schema/ipc.js +18 -44
  45. package/dist/lib/modules/core/testing.js +1 -0
  46. package/dist/lib/modules/core/version.js +1 -1
  47. package/dist/lib/modules/ipc/client.js +10 -2
  48. package/dist/lib/modules/ipc/server.js +14 -5
  49. package/dist/lib/modules/ipc/testing.js +13 -23
  50. package/dist/spec/messaging-v1.md +835 -380
  51. package/dist/third-party-notices.md +1 -1
  52. package/dist/third-party.json +1 -1
  53. package/dist/types/core/agent/operations.d.ts +5 -52
  54. package/dist/types/core/agent/present.d.ts +6 -21
  55. package/dist/types/core/agent-tools.d.ts +277 -438
  56. package/dist/types/core/conversation/context.d.ts +56 -0
  57. package/dist/types/core/conversation/event.d.ts +36 -0
  58. package/dist/types/core/conversation/guest-invitation.d.ts +8 -0
  59. package/dist/types/core/conversation/ids.d.ts +18 -0
  60. package/dist/types/core/conversation/link.d.ts +16 -0
  61. package/dist/types/core/conversation/log.d.ts +157 -0
  62. package/dist/types/core/conversation/ratchet.d.ts +95 -0
  63. package/dist/types/core/conversation/request-log.d.ts +24 -0
  64. package/dist/types/core/conversation/request-seal.d.ts +6 -0
  65. package/dist/types/core/conversation/requests.d.ts +14 -0
  66. package/dist/types/core/conversation/seal.d.ts +70 -0
  67. package/dist/types/core/conversation-agent-tools.d.ts +918 -0
  68. package/dist/types/core/federation/directory-proof.d.ts +8 -0
  69. package/dist/types/core/federation/proof-state.d.ts +114 -0
  70. package/dist/types/core/federation/roster-proof.d.ts +7 -0
  71. package/dist/types/core/index.d.ts +15 -3
  72. package/dist/types/core/jelly-host.d.ts +1 -1
  73. package/dist/types/core/schema/common.d.ts +85 -4
  74. package/dist/types/core/schema/consent.d.ts +7 -7
  75. package/dist/types/core/schema/contact-request.d.ts +264 -0
  76. package/dist/types/core/schema/conv-frames.d.ts +1200 -0
  77. package/dist/types/core/schema/conversation.d.ts +2803 -0
  78. package/dist/types/core/schema/envelope.d.ts +89 -130
  79. package/dist/types/core/schema/errors.d.ts +40 -0
  80. package/dist/types/core/schema/guest-invitation.d.ts +51 -0
  81. package/dist/types/core/schema/index.d.ts +6 -0
  82. package/dist/types/core/schema/ipc/consent.d.ts +89 -49
  83. package/dist/types/core/schema/ipc/conversation-views.d.ts +1023 -0
  84. package/dist/types/core/schema/ipc/conversations.d.ts +3987 -0
  85. package/dist/types/core/schema/ipc/device.d.ts +10 -0
  86. package/dist/types/core/schema/ipc/jelly.d.ts +2 -105
  87. package/dist/types/core/schema/ipc/shapes.d.ts +16 -95
  88. package/dist/types/core/schema/ipc/surfaces.d.ts +28 -424
  89. package/dist/types/core/schema/ipc/tasks.d.ts +208 -0
  90. package/dist/types/core/schema/ipc.d.ts +2684 -523
  91. package/dist/types/core/schema/relay.d.ts +20 -4
  92. package/dist/types/core/testing.d.ts +1 -0
  93. package/dist/types/core/version.d.ts +1 -1
  94. package/dist/types/ipc/client.d.ts +4 -1
  95. package/dist/types/ipc/server.d.ts +10 -1
  96. package/dist/types/ipc/testing.d.ts +21 -8
  97. package/package.json +1 -1
@@ -167,7 +167,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
167
167
  SOFTWARE.
168
168
  ```
169
169
 
170
- ## ws 8.22.0 (MIT)
170
+ ## ws 8.22.1 (MIT)
171
171
 
172
172
  ```
173
173
  Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>
@@ -70,7 +70,7 @@
70
70
  "text": "MIT License\n\nCopyright (c) 2017 Evgeny Poberezkin\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE."
71
71
  },
72
72
  "ws": {
73
- "version": "8.22.0",
73
+ "version": "8.22.1",
74
74
  "license": "MIT",
75
75
  "text": "Copyright (c) 2011 Einar Otto Stangvik <einaros@gmail.com>\nCopyright (c) 2013 Arnout Kazemier and contributors\nCopyright (c) 2016 Luigi Pinca and contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
76
76
  },
@@ -1,10 +1,10 @@
1
- import { type ToolAddress, type ToolConsent, type ToolInput, type ToolOutput } from "../agent-tools.js";
1
+ import { type ToolAddress, type ToolConsent, type ToolInput, type ToolOutput, type TaskReadOutput } from "../agent-tools.js";
2
2
  import type * as A2A from "../schema/a2a.js";
3
3
  import type { AgentMethod, IpcParams, IpcResult, TaskRecord } from "../schema/ipc.js";
4
4
  import { type ToolFramer } from "./text.js";
5
5
  /**
6
- * The eight agent tools' operations (spec §11, "Agent tools"), on the agent IPC methods and
7
- * `conv.read`, shared by every agent-facing client. Pure: the client injects its daemon link, its
6
+ * Shared contacts, inbox and task operations on the agent IPC methods.
7
+ * Pure: the client injects its daemon link, its
8
8
  * fence, what the session may reach, and hooks for what it tracks. A client's tool adapter
9
9
  * validates input and hands in `assert`, which asks its permission for a conversation; every
10
10
  * operation calls it after its own cheap checks and before any side effect or before any peer text
@@ -56,63 +56,16 @@ export interface OperationsContext {
56
56
  consent(person: string, self: string): ToolConsent;
57
57
  access: ChatAccess;
58
58
  }
59
- /** What a send will do, checked before the permission prompt. */
60
- export type SendPlan = {
61
- kind: "line" | "post";
62
- to: ToolAddress;
63
- conversation: string;
64
- target: string;
65
- text: string;
66
- thread?: string;
67
- request?: {
68
- contact: string;
69
- };
70
- } | {
71
- kind: "mail" | "task";
72
- to: ToolAddress;
73
- conversation: string;
74
- params: Omit<IpcParams<"msg.send">, "key" | "idempotencyKey">;
75
- delegation?: string;
76
- };
77
59
  export declare class Operations {
78
60
  private readonly ctx;
79
61
  constructor(ctx: OperationsContext);
80
62
  private get framer();
81
63
  private consent;
82
- /** Refuses a chat conversation this client may not reach, before any daemon call. */
83
- private reachable;
84
64
  contacts(sessionID: string, input: ToolInput<"contacts">, signal?: AbortSignal): Promise<ToolOutput<"contacts">>;
85
65
  /**
86
- * Checks a send without side effects: the address, the peer-turn allowance, what may go to whom,
87
- * what `replyTo` and `onBehalfOf` name. Returns what the send will do, for the permission prompt.
66
+ * Read a retained task or one of its received envelopes. The peer check precedes any side effect.
88
67
  */
89
- planSend(sessionID: string, input: ToolInput<"send">, signal?: AbortSignal): Promise<SendPlan>;
90
- send(sessionID: string, plan: SendPlan, idempotencyKey: string, signal?: AbortSignal): Promise<ToolOutput<"send">>;
91
- /**
92
- * What `replyTo` names, for a send to the agent `to`: a message it sent this session (the reply
93
- * joins its conversation), or a task this session asked it to run (the text is input for it).
94
- */
95
- private replyOf;
96
- /** The task a send `onBehalfOf` delegates for: this session runs it and it is not finished (spec §6.7). */
97
- private delegationParent;
98
- /** Lists items; previews put in front of the agent are acknowledged `handed_to_agent` (spec §8.2). */
99
- inbox(sessionID: string, input: ToolInput<"inbox">, signal?: AbortSignal): Promise<ToolOutput<"inbox">>;
100
- /**
101
- * One item: a message or task request this session received (marks it read and sends a read
102
- * receipt), a task this session asked for or runs, or something it sent (how far it got).
103
- * `assert` gets the item's conversation before anything changes or is shown.
104
- */
105
- readItem(sessionID: string, id: string, assert: (conversation: string) => Promise<void>, signal?: AbortSignal): Promise<ToolOutput<"read">>;
106
- /**
107
- * A page of one conversation, oldest first: the chat lines with a person or in a channel, or the
108
- * mail and tasks with an agent. Mail previews shown here count as handed to the agent.
109
- */
110
- readConversation(sessionID: string, input: Pick<ToolInput<"read">, "before" | "after" | "limit"> & {
111
- with: string;
112
- }, assert: (conversation: string) => Promise<void>, signal?: AbortSignal): Promise<ToolOutput<"read">>;
113
- private page;
114
- /** Chat lines with persons and in channels. Each conversation in the hits is asserted; `allowed` false drops it. */
115
- search(sessionID: string, input: ToolInput<"search">, allowed: (conversation: string) => Promise<boolean>, signal?: AbortSignal): Promise<ToolOutput<"search">>;
68
+ readItem(sessionID: string, id: string, assertPeer: (person: string) => Promise<void>, signal?: AbortSignal): Promise<TaskReadOutput>;
116
69
  tasks(sessionID: string, input: ToolInput<"tasks">, signal?: AbortSignal): Promise<ToolOutput<"tasks">>;
117
70
  /**
118
71
  * The task an update or a cancel names, checked locally before any permission prompt: this
@@ -1,5 +1,6 @@
1
- import { type ToolConsent, type ToolOutput, type ToolTask } from "../agent-tools.js";
2
- import type { ChatLine, ConvEntry, DirectoryEntry, InboxItem, IpcResult, TaskFollowUp, TaskRecord } from "../schema/ipc.js";
1
+ import { type TaskReadOutput, type ToolConsent, type ToolOutput, type ToolTask } from "../agent-tools.js";
2
+ import type { ConversationToolOutput } from "../conversation-agent-tools.js";
3
+ import type { DirectoryEntry, InboxItem, IpcResult, TaskFollowUp, TaskRecord } from "../schema/ipc.js";
3
4
  import { type ToolFramer as Framer } from "./text.js";
4
5
  /**
5
6
  * Daemon results → agent tool outputs (`AgentTool`, spec §11). Pure. Every string another person
@@ -16,13 +17,8 @@ import { type ToolFramer as Framer } from "./text.js";
16
17
  */
17
18
  type Contact = ToolOutput<"contacts">["contacts"][number];
18
19
  type ContactAgent = NonNullable<Contact["agents"]>[number];
19
- type InboxOutputItem = ToolOutput<"inbox">["items"][number];
20
- type ReadItem = Extract<ToolOutput<"read">, {
21
- item: unknown;
22
- }>["item"];
23
- type PageEntry = Extract<ToolOutput<"read">, {
24
- entries: unknown;
25
- }>["entries"][number];
20
+ type InboxOutputItem = ConversationToolOutput<"inbox">["items"][number];
21
+ type ReadItem = TaskReadOutput["item"];
26
22
  type TaskSummary = ToolOutput<"tasks">["tasks"][number];
27
23
  export declare const isoOf: (millis: number) => string;
28
24
  /** How a request from `person` runs here (spec §11): your own person, a trusted teammate, or a guarded peer turn. */
@@ -34,22 +30,11 @@ export declare function presentAgent(framer: Framer, entry: DirectoryEntry): Con
34
30
  */
35
31
  export declare function agentCan(entry: Pick<DirectoryEntry, "client">): Contact["can"];
36
32
  export declare function presentInboxItem(framer: Framer, item: InboxItem, consent: ToolConsent): InboxOutputItem;
37
- /** The agent conversation with a peer: `agent:<person>/<agent>`, or `person:<person>` for the person's own. */
38
- export declare function conversationOfPeer(peer: {
39
- person: string;
40
- agent?: string;
41
- }): string;
42
- export declare function presentMail(framer: Framer, result: Extract<IpcResult<"item.read">, {
33
+ export declare function presentTaskEnvelope(framer: Framer, result: Extract<IpcResult<"item.read">, {
43
34
  kind: "received";
44
35
  }>, task?: ToolTask): ReadItem;
45
36
  /** A task as a read item: its request, with the whole task. */
46
37
  export declare function presentTaskItem(framer: Framer, record: TaskRecord, self: string, consent: ToolConsent | undefined): ReadItem;
47
- /** Something this session sent: no copy is kept, so only how far it got. */
48
- export declare function presentSent(result: Extract<IpcResult<"item.read">, {
49
- kind: "sent";
50
- }>, self: string): ReadItem;
51
- export declare function presentLine(framer: Framer, line: ChatLine, kind: "line" | "post", conversation: string): PageEntry;
52
- export declare function presentConvEntry(framer: Framer, entry: ConvEntry, self: string): PageEntry;
53
38
  export declare function presentTask(framer: Framer, record: TaskRecord, consent?: ToolConsent): TaskSummary;
54
39
  /** A follow-up's stage says the executor read it. */
55
40
  export declare function followUpRead(stage: TaskFollowUp["stage"]): boolean;