@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,231 @@
1
+ import { type AgentId } from "../broker/protocol.js";
2
+ /** Limits the number of accepted operator correlations represented by one body-free wake. */
3
+ export declare const OPERATOR_CONTROL_CORRELATION_LIMIT = 64;
4
+ /** Bounds retained scheduler diagnostics independently from durable state. */
5
+ export declare const NOTIFICATION_OPERATIONAL_EVENT_LIMIT = 4096;
6
+ /** Reports a controlled rejection at the body-free notification boundary. */
7
+ export declare class NotificationValidationError extends Error {
8
+ }
9
+ /** Describes the notification behaviours supported by an adapter. */
10
+ export type AdapterCapabilities = {
11
+ /** Reports whether the adapter accepts coalesced busy wakes. */
12
+ coalescing: boolean;
13
+ /** Identifies the newest protocol version understood by the adapter. */
14
+ maxProtocolVersion: 1;
15
+ };
16
+ /**
17
+ * A wake telling one agent its inbox changed. Carries no peer message body and must never gain
18
+ * one: a host-push delivery claims the messages itself when it handles the wake.
19
+ */
20
+ type InboxChangedBase = {
21
+ /** Identifies this body-free inbox event. */
22
+ type: "inbox_changed";
23
+ /** Identifies the recipient agent. */
24
+ agentId: AgentId;
25
+ /** Orders inbox events within one broker epoch. */
26
+ sequence: number;
27
+ /** Identifies the broker epoch emitting the event. */
28
+ epoch: string;
29
+ };
30
+ /** Represents a durable-inbox wake without operator control state. */
31
+ export type InboxMessageChanged = InboxChangedBase & {
32
+ /** Records why a durable inbox wake was emitted. */
33
+ reason: "queued" | "redelivery" | "resync" | "shed";
34
+ /** Identifies the durable message when the wake concerns one message. */
35
+ messageId?: string;
36
+ };
37
+ /** Represents a pure operator wake without any durable message identity. */
38
+ export type OperatorPingChanged = InboxChangedBase & {
39
+ /** Records a body-free operator control wake. */
40
+ reason: "operator_ping";
41
+ /** Correlates the wake with its accepted operator command. */
42
+ controlId: string;
43
+ /** Preserves every additional command correlation represented by a coalesced wake. */
44
+ coalescedControlIds: string[];
45
+ };
46
+ /** Represents exactly one mutually exclusive message or operator-control wake. */
47
+ export type InboxChanged = InboxMessageChanged | OperatorPingChanged;
48
+ /** Records a message-related reason that may optionally carry one durable message identity. */
49
+ export type InboxMessageReason = Exclude<InboxChanged["reason"], "operator_ping">;
50
+ /** Classifies scheduler admission without claiming adapter delivery. */
51
+ export type OperatorPingAdmission = {
52
+ /** Reports an exact durable retry for which no second wake was admitted. */
53
+ status: "already_accepted";
54
+ /** Correlates the skipped candidate wake. */
55
+ controlId: string;
56
+ } | {
57
+ /** Reports immediate publication to the notification hub. */
58
+ status: "accepted";
59
+ /** Correlates the accepted command. */
60
+ controlId: string;
61
+ /** Carries the body-free wake published for the request. */
62
+ wake: OperatorPingChanged;
63
+ } | {
64
+ /** Reports retention in a busy adapter's pending wake. */
65
+ status: "coalesced";
66
+ /** Correlates the accepted command retained in pending state. */
67
+ controlId: string;
68
+ } | {
69
+ /** Reports scheduler rejection before hub publication. */
70
+ status: "budget_rejected";
71
+ /** Correlates the rejected command request. */
72
+ controlId: string;
73
+ } | {
74
+ /** Reports rejection before an unbounded or duplicate busy correlation can be retained. */
75
+ status: "correlation_rejected";
76
+ /** Correlates the rejected command request. */
77
+ controlId: string;
78
+ /** Identifies the bounded correlation policy that rejected admission. */
79
+ reason: "duplicate_control_id" | "pending_control_limit" | "admission_in_progress";
80
+ };
81
+ /** Reports every independently published member of one busy-state release. */
82
+ export type BusyWakeRelease = {
83
+ /** Identifies the fixed release outcome boundary. */
84
+ type: "busy_wake_release";
85
+ /** Carries the released message wake when one was admitted. */
86
+ message: InboxMessageChanged | null;
87
+ /** Carries the released operator wake when controls were admitted and the agent stayed available. */
88
+ operatorPing: OperatorPingChanged | null;
89
+ };
90
+ /** Identifies a subscriber invocation isolated from notification publication. */
91
+ export type NotificationSubscriberFailure = {
92
+ /** Identifies the subscriber's target agent without retaining the thrown value. */
93
+ agentId: AgentId;
94
+ /** Identifies the event whose subscriber failed. */
95
+ sequence: number;
96
+ };
97
+ /** Describes a scheduler outcome retained for diagnostics. */
98
+ export type NotificationEvent = {
99
+ /** Identifies a wake dropped to enforce a delivery limit. */
100
+ type: "wake_shed";
101
+ /** Identifies the affected agent. */
102
+ agentId: AgentId;
103
+ /** Records the limiting policy that shed the wake. */
104
+ reason: "wake_budget" | "duplicate_control_id" | "pending_control_limit";
105
+ /** Identifies the message whose wake was shed when available. */
106
+ messageId?: string;
107
+ /** Correlates operator control requests rejected by the scheduler. */
108
+ controlIds?: string[];
109
+ } | {
110
+ /** Identifies a wake deferred because the adapter is busy. */
111
+ type: "wake_deferred";
112
+ /** Identifies the affected agent. */
113
+ agentId: AgentId;
114
+ /** Correlates operator control requests retained in pending state. */
115
+ controlIds?: string[];
116
+ } | {
117
+ /** Identifies a wake successfully sent to an adapter. */
118
+ type: "wake_sent";
119
+ /** Identifies the affected agent. */
120
+ agentId: AgentId;
121
+ /** Records the event sequence that was sent. */
122
+ sequence: number;
123
+ /** Correlates operator control requests represented by the wake. */
124
+ controlIds?: string[];
125
+ };
126
+ /** Body-free adapter notification fan-out. */
127
+ export declare class NotificationHub {
128
+ #private;
129
+ /**
130
+ * Constructs a notification hub for one broker epoch.
131
+ * @param epoch - Broker generation used to fence stale sessions.
132
+ * @param options - Optional non-retaining subscriber-failure observer.
133
+ */
134
+ constructor(epoch: string, options?: {
135
+ onSubscriberError?: (failure: NotificationSubscriberFailure) => void;
136
+ });
137
+ /**
138
+ * Publish an inbox change without storing message bodies or creating queue state.
139
+ * @param agentId - Recipient the inbox change is published for.
140
+ * @param reason - Lifecycle reason attached to the inbox notification.
141
+ * @param messageId - Message the change names, when it names one.
142
+ * @returns - Copy of the published event; changing it does not alter what subscribers received.
143
+ */
144
+ publish(agentId: AgentId, reason: InboxMessageReason, messageId?: string): InboxMessageChanged;
145
+ /**
146
+ * Publish a body-free operator control wake without creating peer delivery state.
147
+ * @param agentId - Stable identity of the requested target.
148
+ * @param controlId - Opaque correlation of the primary accepted command.
149
+ * @param coalescedControlIds - Additional accepted command correlations represented by this wake.
150
+ * @returns - Copy of the published event; changing it does not alter what subscribers received.
151
+ */
152
+ publishOperatorPing(agentId: AgentId, controlId: string, coalescedControlIds?: readonly string[]): OperatorPingChanged;
153
+ /**
154
+ * Subscribe an adapter to body-free notification events.
155
+ * @param agentId - Agent whose operational events the listener receives.
156
+ * @param listener - Callback invoked for each matching operational event.
157
+ * @returns - Unsubscribe callback that detaches the registered listener.
158
+ */
159
+ subscribe(agentId: AgentId, listener: (event: InboxChanged) => void): () => void;
160
+ }
161
+ /** Broker operations the scheduler reaches: outcome recording and queue inspection. */
162
+ export interface NotificationBroker {
163
+ /** Record a notification outcome for a message. */
164
+ recordNotification(messageId: string, outcome: "delivered" | "shed" | "failed" | "deferred"): void;
165
+ /** Return whether an agent has queued messages. */
166
+ hasQueuedMessages(agentId: AgentId): boolean;
167
+ }
168
+ /** Broker notification scheduler for retry, coalescing, busy deferral, wake and correlation shedding, and operational events. */
169
+ export declare class NotificationScheduler {
170
+ #private;
171
+ /**
172
+ * Constructs a scheduler over the notification broker and event hub.
173
+ * @param broker - Durable broker instance that owns message state.
174
+ * @param hub - Notification stream used to publish inbox changes.
175
+ * @param options - Clock, required so this scheduler shares the process's, plus optional policy.
176
+ */
177
+ constructor(broker: NotificationBroker, hub: NotificationHub, options: {
178
+ wakeBudget?: number;
179
+ wakeBudgetWindowMs?: number;
180
+ now: () => number;
181
+ });
182
+ /**
183
+ * Record adapter-declared capabilities used by the notification scheduler.
184
+ * @param agentId - Agent whose adapter capabilities are recorded.
185
+ * @param capabilities - Delivery capabilities reported by the adapter.
186
+ */
187
+ declareAdapter(agentId: AgentId, capabilities: AdapterCapabilities): void;
188
+ /**
189
+ * Notify an agent of durable inbox state without creating a second message queue.
190
+ * @param agentId - Agent notified of the inbox change.
191
+ * @param reason - Lifecycle reason attached to the inbox notification.
192
+ * @returns - Wake event when budget and capability policy allow delivery, otherwise null.
193
+ */
194
+ notify(agentId: AgentId, reason?: InboxMessageReason): InboxChanged | null;
195
+ /**
196
+ * Notify one message recipient and append adapter lifecycle outcomes for its receipt.
197
+ * @param messageId - Message the notification concerns.
198
+ * @param agentId - Recipient notified of the message.
199
+ * @param reason - Lifecycle reason attached to the inbox notification.
200
+ * @returns - Wake event tied to the durable message, or null when policy suppresses it.
201
+ */
202
+ notifyMessage(messageId: string | undefined, agentId: AgentId, reason?: InboxMessageReason): InboxChanged | null;
203
+ /**
204
+ * Admit a body-free operator ping without creating message delivery state.
205
+ * @param agentId - Stable identity of the requested target.
206
+ * @param controlId - Durable opaque correlation created with command acceptance.
207
+ * @param commitAcceptance - Synchronous durable acceptance performed after preflight and before scheduler mutation.
208
+ * @param resolveExisting - Read-only durable retry resolution performed before a rejected preflight becomes observable.
209
+ * @returns The admission outcome; `accepted` carries the published wake.
210
+ */
211
+ notifyOperatorPing(agentId: AgentId, controlId: string, commitAcceptance: () => "created" | "existing", resolveExisting: () => "absent" | "existing"): OperatorPingAdmission;
212
+ /**
213
+ * Record recipient delivery availability and coalesce many arrivals to one pending wake.
214
+ * @param agentId - Agent whose delivery availability changed.
215
+ * @param busy - Whether the agent is currently occupied.
216
+ * @returns - Every released message/control member, or null when no state changed.
217
+ */
218
+ setBusy(agentId: AgentId, busy: boolean): BusyWakeRelease | null;
219
+ /**
220
+ * Retry a dropped wake while durable messages remain unclaimed.
221
+ * @param agentId - Agent whose dropped wake is retried.
222
+ * @returns - Retry wake when queued work remains, otherwise null.
223
+ */
224
+ retryUnclaimed(agentId: AgentId): InboxChanged | null;
225
+ /**
226
+ * Return operational notification events.
227
+ * @returns - Copy of accumulated operational events, safe for caller inspection.
228
+ */
229
+ operationalEvents(): NotificationEvent[];
230
+ }
231
+ export {};