@haywoodmarx/agent-pager 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +63 -0
  3. package/dist/src/broker/address.d.ts +49 -0
  4. package/dist/src/broker/address.js +110 -0
  5. package/dist/src/broker/broker.d.ts +665 -0
  6. package/dist/src/broker/broker.js +2270 -0
  7. package/dist/src/broker/database.d.ts +81 -0
  8. package/dist/src/broker/database.js +69 -0
  9. package/dist/src/broker/operator-projection.d.ts +291 -0
  10. package/dist/src/broker/operator-projection.js +722 -0
  11. package/dist/src/broker/protocol.d.ts +237 -0
  12. package/dist/src/broker/protocol.js +311 -0
  13. package/dist/src/broker/schema.d.ts +94 -0
  14. package/dist/src/broker/schema.js +454 -0
  15. package/dist/src/broker/snapshot.d.ts +171 -0
  16. package/dist/src/broker/snapshot.js +78 -0
  17. package/dist/src/configuration-defaults.d.ts +64 -0
  18. package/dist/src/configuration-defaults.js +48 -0
  19. package/dist/src/configuration.d.ts +76 -0
  20. package/dist/src/configuration.js +156 -0
  21. package/dist/src/implementations/claude/environment.d.ts +8 -0
  22. package/dist/src/implementations/claude/environment.js +9 -0
  23. package/dist/src/implementations/claude/gateway-cli.d.ts +2 -0
  24. package/dist/src/implementations/claude/gateway-cli.js +136 -0
  25. package/dist/src/implementations/claude/gateway-identity.d.ts +134 -0
  26. package/dist/src/implementations/claude/gateway-identity.js +103 -0
  27. package/dist/src/implementations/claude/gateway.d.ts +148 -0
  28. package/dist/src/implementations/claude/gateway.js +236 -0
  29. package/dist/src/implementations/claude/instructions.d.ts +33 -0
  30. package/dist/src/implementations/claude/instructions.js +64 -0
  31. package/dist/src/implementations/claude/manifest.d.ts +33 -0
  32. package/dist/src/implementations/claude/manifest.js +108 -0
  33. package/dist/src/implementations/claude/plugin-directory.d.ts +80 -0
  34. package/dist/src/implementations/claude/plugin-directory.js +137 -0
  35. package/dist/src/implementations/claude/session-continuation.d.ts +25 -0
  36. package/dist/src/implementations/claude/session-continuation.js +125 -0
  37. package/dist/src/implementations/claude/session-identity.d.ts +25 -0
  38. package/dist/src/implementations/claude/session-identity.js +31 -0
  39. package/dist/src/implementations/claude/session-start-cli.d.ts +2 -0
  40. package/dist/src/implementations/claude/session-start-cli.js +16 -0
  41. package/dist/src/implementations/claude/socket-delivery.d.ts +52 -0
  42. package/dist/src/implementations/claude/socket-delivery.js +159 -0
  43. package/dist/src/implementations/model.d.ts +162 -0
  44. package/dist/src/implementations/model.js +1 -0
  45. package/dist/src/implementations/opencode/adapter.d.ts +71 -0
  46. package/dist/src/implementations/opencode/adapter.js +94 -0
  47. package/dist/src/implementations/opencode/environment.d.ts +8 -0
  48. package/dist/src/implementations/opencode/environment.js +9 -0
  49. package/dist/src/implementations/opencode/manifest.d.ts +30 -0
  50. package/dist/src/implementations/opencode/manifest.js +93 -0
  51. package/dist/src/implementations/opencode/plugin-api.d.ts +120 -0
  52. package/dist/src/implementations/opencode/plugin-api.js +1 -0
  53. package/dist/src/implementations/opencode/plugin.d.ts +38 -0
  54. package/dist/src/implementations/opencode/plugin.js +303 -0
  55. package/dist/src/implementations/opencode/self-close-tool.d.ts +9 -0
  56. package/dist/src/implementations/opencode/self-close-tool.js +31 -0
  57. package/dist/src/implementations/orca/terminal.d.ts +48 -0
  58. package/dist/src/implementations/orca/terminal.js +154 -0
  59. package/dist/src/implementations/pi/broker-client.d.ts +56 -0
  60. package/dist/src/implementations/pi/broker-client.js +156 -0
  61. package/dist/src/implementations/pi/environment.d.ts +8 -0
  62. package/dist/src/implementations/pi/environment.js +9 -0
  63. package/dist/src/implementations/pi/extension.d.ts +57 -0
  64. package/dist/src/implementations/pi/extension.js +253 -0
  65. package/dist/src/implementations/pi/host-slots.d.ts +18 -0
  66. package/dist/src/implementations/pi/host-slots.js +27 -0
  67. package/dist/src/implementations/pi/manifest.d.ts +11 -0
  68. package/dist/src/implementations/pi/manifest.js +61 -0
  69. package/dist/src/implementations/pi/self-close-tool.d.ts +7 -0
  70. package/dist/src/implementations/pi/self-close-tool.js +27 -0
  71. package/dist/src/implementations/registry.d.ts +47 -0
  72. package/dist/src/implementations/registry.js +157 -0
  73. package/dist/src/implementations/session-key.d.ts +13 -0
  74. package/dist/src/implementations/session-key.js +19 -0
  75. package/dist/src/index.d.ts +27 -0
  76. package/dist/src/index.js +26 -0
  77. package/dist/src/launch/broker-lock.d.ts +257 -0
  78. package/dist/src/launch/broker-lock.js +644 -0
  79. package/dist/src/launch/cli.d.ts +37 -0
  80. package/dist/src/launch/cli.js +317 -0
  81. package/dist/src/launch/environment.d.ts +45 -0
  82. package/dist/src/launch/environment.js +48 -0
  83. package/dist/src/launch/launch.d.ts +235 -0
  84. package/dist/src/launch/launch.js +223 -0
  85. package/dist/src/launch/on-demand.d.ts +202 -0
  86. package/dist/src/launch/on-demand.js +435 -0
  87. package/dist/src/launch/runtime-composition.d.ts +88 -0
  88. package/dist/src/launch/runtime-composition.js +253 -0
  89. package/dist/src/launch/runtime.d.ts +79 -0
  90. package/dist/src/launch/runtime.js +196 -0
  91. package/dist/src/launch/service-system.d.ts +11 -0
  92. package/dist/src/launch/service-system.js +39 -0
  93. package/dist/src/launch/service.d.ts +173 -0
  94. package/dist/src/launch/service.js +492 -0
  95. package/dist/src/launch/skill.d.ts +57 -0
  96. package/dist/src/launch/skill.js +81 -0
  97. package/dist/src/launch/terminal.d.ts +26 -0
  98. package/dist/src/launch/terminal.js +43 -0
  99. package/dist/src/launch/workspace-branch.d.ts +10 -0
  100. package/dist/src/launch/workspace-branch.js +29 -0
  101. package/dist/src/messaging/delivery-client.d.ts +144 -0
  102. package/dist/src/messaging/delivery-client.js +261 -0
  103. package/dist/src/messaging/delivery.d.ts +75 -0
  104. package/dist/src/messaging/delivery.js +22 -0
  105. package/dist/src/messaging/inbox-socket.d.ts +98 -0
  106. package/dist/src/messaging/inbox-socket.js +278 -0
  107. package/dist/src/messaging/mcp.d.ts +53 -0
  108. package/dist/src/messaging/mcp.js +501 -0
  109. package/dist/src/messaging/notifications.d.ts +231 -0
  110. package/dist/src/messaging/notifications.js +489 -0
  111. package/dist/src/messaging/push-delivery.d.ts +77 -0
  112. package/dist/src/messaging/push-delivery.js +187 -0
  113. package/dist/src/messaging/tools.d.ts +11 -0
  114. package/dist/src/messaging/tools.js +102 -0
  115. package/dist/src/messaging/wake.d.ts +23 -0
  116. package/dist/src/messaging/wake.js +39 -0
  117. package/dist/src/operator/agent-projection.d.ts +102 -0
  118. package/dist/src/operator/agent-projection.js +249 -0
  119. package/dist/src/operator/commands.d.ts +50 -0
  120. package/dist/src/operator/commands.js +199 -0
  121. package/dist/src/operator/diagnostics.d.ts +21 -0
  122. package/dist/src/operator/diagnostics.js +22 -0
  123. package/dist/src/operator/protocol.d.ts +511 -0
  124. package/dist/src/operator/protocol.js +49 -0
  125. package/dist/src/operator/repository-system.d.ts +14 -0
  126. package/dist/src/operator/repository-system.js +150 -0
  127. package/dist/src/operator/repository.d.ts +79 -0
  128. package/dist/src/operator/repository.js +72 -0
  129. package/dist/src/operator/traffic-projection.d.ts +19 -0
  130. package/dist/src/operator/traffic-projection.js +229 -0
  131. package/dist/src/operator/transport.d.ts +87 -0
  132. package/dist/src/operator/transport.js +549 -0
  133. package/dist/src/operator/update-store.d.ts +53 -0
  134. package/dist/src/operator/update-store.js +162 -0
  135. package/dist/src/operator/updates.d.ts +94 -0
  136. package/dist/src/operator/updates.js +280 -0
  137. package/dist/src/operator/validation.d.ts +114 -0
  138. package/dist/src/operator/validation.js +916 -0
  139. package/dist/src/shared/guards.d.ts +59 -0
  140. package/dist/src/shared/guards.js +119 -0
  141. package/dist/src/shared/http.d.ts +30 -0
  142. package/dist/src/shared/http.js +50 -0
  143. package/dist/src/shared/row.d.ts +2 -0
  144. package/dist/src/shared/row.js +1 -0
  145. package/dist/src/shared/shell.d.ts +6 -0
  146. package/dist/src/shared/shell.js +8 -0
  147. package/dist/src/tui/actions.d.ts +166 -0
  148. package/dist/src/tui/actions.js +253 -0
  149. package/dist/src/tui/agent-tree.d.ts +125 -0
  150. package/dist/src/tui/agent-tree.js +663 -0
  151. package/dist/src/tui/app.d.ts +38 -0
  152. package/dist/src/tui/app.js +378 -0
  153. package/dist/src/tui/chrome.d.ts +86 -0
  154. package/dist/src/tui/chrome.js +85 -0
  155. package/dist/src/tui/client.d.ts +41 -0
  156. package/dist/src/tui/client.js +279 -0
  157. package/dist/src/tui/composition.d.ts +41 -0
  158. package/dist/src/tui/composition.js +146 -0
  159. package/dist/src/tui/message-views.d.ts +94 -0
  160. package/dist/src/tui/message-views.js +515 -0
  161. package/dist/src/tui/model.d.ts +414 -0
  162. package/dist/src/tui/model.js +758 -0
  163. package/dist/src/tui/presentation.d.ts +350 -0
  164. package/dist/src/tui/presentation.js +541 -0
  165. package/dist/src/tui/production.d.ts +79 -0
  166. package/dist/src/tui/production.js +253 -0
  167. package/dist/src/tui/run-terminal.d.ts +32 -0
  168. package/dist/src/tui/run-terminal.js +54 -0
  169. package/dist/src/tui/runtime.d.ts +113 -0
  170. package/dist/src/tui/runtime.js +189 -0
  171. package/dist/src/tui/theme.d.ts +49 -0
  172. package/dist/src/tui/theme.js +55 -0
  173. package/dist/src/tui/transport.d.ts +31 -0
  174. package/dist/src/tui/transport.js +255 -0
  175. package/dist/src/version.d.ts +11 -0
  176. package/dist/src/version.js +52 -0
  177. package/package.json +142 -0
  178. package/skills/pager/SKILL.md +112 -0
@@ -0,0 +1,112 @@
1
+ ---
2
+ name: pager
3
+ description: Send and receive durable messages between agents over the Pager MCP broker. Use when an inbox notification arrives, when addressing another agent by alias or id or every agent in a workspace, or when coordinating work across agent sessions.
4
+ ---
5
+
6
+ # Pager
7
+
8
+ ## When a message arrives
9
+
10
+ Pager delivers to your session. Something arrives in one of two forms:
11
+
12
+ ```
13
+ Something arrived — which form?
14
+ ├─ a delivery whose first line is "pager push", carrying messages already claimed for you,
15
+ │ each with its claimToken
16
+ │ └─ ack, then work
17
+ └─ a body-free line beginning "pager-inbox" with reason "operator_ping"
18
+ └─ a human pinged you. Nothing to fetch
19
+ ```
20
+
21
+ ```jsonc
22
+ // only to recover a claim_expired message: fetch_agent_messages { "limit": 50 } →
23
+ { "messages": [{ "id": "msg_…", "from": "pgr://agent/…", "fromAddress": "alias@workspace", "type": "brief", "body": …,
24
+ "claimToken": "claim_…", "claimExpiresAt": 1760000000000 }] }
25
+
26
+ // always, once you hold a message: ack_agent_messages
27
+ { "claimTokens": ["claim_…"] }
28
+ // → { "acked": ["claim_…"], "rejected": [] }
29
+
30
+ // then do what the body asks
31
+ ```
32
+
33
+ A token in `rejected` acknowledged nothing. Its `reason` says what to do:
34
+
35
+ | Reason | Meaning and action |
36
+ | ---------------------- | ------------------------------------------------------------------------------------------ |
37
+ | `claim_expired` | The claim lapsed and the message is back in the queue. Fetch again; do not act on the body |
38
+ | `already_acknowledged` | The message was already acknowledged, by this claim or a later one. Nothing to do |
39
+ | `message_settled` | The message was expired, dead-lettered or failed after you claimed it. Do not act on it |
40
+ | `foreign_token` | The token belongs to another agent. Ack only tokens delivered to you |
41
+ | `unknown_token` | No such token. Check that it was copied whole from the claim |
42
+
43
+ Ack as soon as you hold a message, within 5 minutes, or it is redelivered. Ack means received and
44
+ yours to act on, not finished. Redelivery backs off and gives up after 24 hours from that message's
45
+ arrival: one still unclaimed past that budget is dead-lettered, with no wake to the recipient.
46
+
47
+ A message carrying `to: *@workspace` (`broadcastAddress` in a fetch) is one copy of a broadcast to
48
+ that workspace's agents. A reply to its `fromAddress` reaches the sender alone.
49
+
50
+ ## Identity
51
+
52
+ `whoami` returns your agent id, current alias, and prior aliases.
53
+
54
+ `update_agent_alias` replaces your alias and durable session name; it fails with `alias_conflict` if
55
+ the alias is taken. Prior names stay reserved, so a stale sender gets `recipient_alias_changed` rather
56
+ than a silent redirect.
57
+
58
+ ## Sending
59
+
60
+ An address is either a bare alias (an agent in your own workspace) or `alias@workspace`, naming the
61
+ workspace explicitly — your own or another's.
62
+
63
+ ```
64
+ Who are you addressing?
65
+ ├─ answering a message → its `from` or `fromAddress`. There is no reply tool
66
+ ├─ an id or address a listing gave you → send it back verbatim
67
+ ├─ an agent in your own workspace → its alias
68
+ ├─ an agent anywhere else → alias@workspace
69
+ └─ every agent in a workspace → broadcast_agent_message
70
+ ```
71
+
72
+ ```jsonc
73
+ // send_agent_message
74
+ { "to": "@reviewer", "subject": "Ready for review", "type": "done", "body": "…" }
75
+
76
+ // an agent in another workspace
77
+ { "to": "@reviewer@web-app", "subject": "Ready for review", "type": "done", "body": "…" }
78
+
79
+ // broadcast_agent_message: every other agent in your workspace, or in the one "workspace" names
80
+ { "subject": "Main is green", "type": "status", "body": "…" }
81
+ { "workspace": "web-app", "subject": "Main is green", "type": "status", "body": "…" }
82
+ // → { "address": "*@web-app", "sent": [{ "messageId": "msg_…", "to": "pgr://agent/…" }], "refused": [] }
83
+ ```
84
+
85
+ A broadcast skips archived agents and ended ephemeral sessions. Each entry in `refused` is a
86
+ recipient a rate or inbox limit turned away, with the error `code` the table below explains; the rest
87
+ still received it.
88
+
89
+ - `list_team_members` lists your workspace; `list_agents` lists everyone with the `address` to reach them.
90
+ - `subject` is required and capped at 40 characters. Write it like a commit summary — the operator scans a column of them, so put the detail in `body`.
91
+ - `type` is required free text capped at 8 characters, for a coarse category like `"brief"`, `"idle"`, or `"status"`. Validated the same way as `subject`; carried through the claim and shown in the operator's views. The broker enforces no fixed vocabulary.
92
+ - The broker treats `body` as opaque; it does not define an envelope shape. Send the detail itself — a plain sentence, not an envelope.
93
+ - Cap 12 KB. Send a path or an id, not a file.
94
+ - Add `idempotencyKey` on any send you might retry.
95
+ - `get_message_status { messageId }` for something you sent.
96
+
97
+ ## On error
98
+
99
+ | Code | Do |
100
+ | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
101
+ | `unknown_recipient` | `list_agents`, then use a listed `address`. Do not retry the same one |
102
+ | `recipient_alias_changed` | Resend to the alias named in the error |
103
+ | `alias_conflict` | Requested alias is taken in this workspace, or is a previous name reserved for its old holder. Pick another |
104
+ | `conflict` | Rate (60/min per pair) or inbox (1000) limit: back off, do not loop. Any other cause: the request cannot succeed as sent, so read the message |
105
+ | `oversized_content` | The named field (body, subject, or type) exceeds its limit; shorten that field |
106
+ | `validation_failed` | The error message names the cause (a field, an unknown id, a malformed request); read it, do not retry unchanged |
107
+
108
+ ## Never
109
+
110
+ - Poll `fetch_agent_messages` on a timer — messages are delivered to you.
111
+ - Ack a message you have not read.
112
+ - Put tokens, credentials, or reservations in a body. Bodies are shown in operator tools.