@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,414 @@
1
+ import { type OperatorAgentHealth } from "../operator/agent-projection.js";
2
+ import { type OperatorCommandEnvelope, type OperatorCommandResult, type OperatorCursor, type OperatorDiagnostic, type OperatorSnapshot, type OperatorTraffic } from "../operator/protocol.js";
3
+ import type { AgentId } from "../broker/protocol.js";
4
+ /** A renderer-neutral terminal pane. */
5
+ export type TuiPane = "tree" | "agent_log" | "message_log";
6
+ /** A local selection without granting broker authority. */
7
+ export type TuiSelection = {
8
+ kind: "workspace";
9
+ repositoryId: string;
10
+ } | {
11
+ kind: "archived";
12
+ repositoryId: string;
13
+ } | {
14
+ kind: "agent";
15
+ agentId: AgentId;
16
+ } | {
17
+ kind: "hidden";
18
+ } | null;
19
+ /** A local overlay. */
20
+ export type TuiOverlay = {
21
+ kind: "none";
22
+ } | {
23
+ kind: "agent_identity";
24
+ agentId: AgentId;
25
+ } | {
26
+ kind: "full_message";
27
+ messageId: string;
28
+ } | {
29
+ kind: "context_menu";
30
+ target: "agent";
31
+ agentId: AgentId;
32
+ } | {
33
+ kind: "context_menu";
34
+ target: "message";
35
+ messageId: string;
36
+ } | {
37
+ kind: "context_menu";
38
+ target: "workspace";
39
+ repositoryId: string;
40
+ } | {
41
+ kind: "archive_confirm";
42
+ agentId: AgentId;
43
+ } | {
44
+ kind: "expire_confirm";
45
+ messageId: string;
46
+ } | {
47
+ kind: "actions";
48
+ } | {
49
+ kind: "action_run";
50
+ actionId: string;
51
+ } | {
52
+ kind: "help";
53
+ } | {
54
+ kind: "log";
55
+ };
56
+ /** Local operator state kept outside authoritative broker facts. */
57
+ export type TuiOperatorViewState = {
58
+ focus: TuiPane;
59
+ selection: TuiSelection;
60
+ /** Traffic row the agent log has selected; the message log reads its delivery through it. */
61
+ trafficId: string | null;
62
+ collapsedRepositories: ReadonlySet<string>;
63
+ /** Repositories the operator put out of sight, shown only in the hidden section. */
64
+ hiddenRepositories: ReadonlySet<string>;
65
+ /** Whether the hidden section is open; it starts closed and keeps the operator's choice while the section is absent. */
66
+ hiddenExpanded: boolean;
67
+ /**
68
+ * What the operator asked of each archive section they have touched.
69
+ *
70
+ * One entry per repository, so a section cannot be recorded as both opened and closed. A section with
71
+ * no entry takes the default its workspace implies, and an entry is kept only where the operator's
72
+ * choice departed from that default when they made it.
73
+ */
74
+ archivedSections: ReadonlyMap<string, "open" | "closed">;
75
+ followAgentLog: boolean;
76
+ /** Columns the operator dragged the tree pane to, or null while it keeps its default width. */
77
+ treeColumns: number | null;
78
+ /** Columns the operator dragged the message-log pane to, or null while it keeps its default. */
79
+ messageLogColumns: number | null;
80
+ overlay: TuiOverlay;
81
+ overlayReturnFocus: TuiPane;
82
+ contextActionIndex: number;
83
+ actionIndex: number;
84
+ };
85
+ /** Complete renderer-neutral state exposed by the controller. */
86
+ export type TuiOperatorModelState = {
87
+ snapshot: OperatorSnapshot | null;
88
+ view: TuiOperatorViewState;
89
+ unreadMessageIds: ReadonlySet<string>;
90
+ healthByAgentId: ReadonlyMap<string, OperatorAgentHealth>;
91
+ connection: "cold" | "healthy" | "recovering" | "incompatible" | "disposed";
92
+ diagnostics: readonly OperatorDiagnostic[];
93
+ run: TuiLocalRun | null;
94
+ };
95
+ /** Fetches a complete snapshot without choosing a transport; the model validates the result. */
96
+ export interface TuiSnapshotPort {
97
+ fetch(): TuiRequest<unknown>;
98
+ }
99
+ /** Opens an ordered event stream after a cursor. */
100
+ export interface TuiStreamPort {
101
+ open(cursor: OperatorCursor | null, receive: (observation: TuiStreamObservation) => void, unavailable: () => void): () => void;
102
+ }
103
+ /**
104
+ * One transport observation delivered through the model-owned stream generation.
105
+ *
106
+ * A snapshot arrives already validated; an event payload is validated by the model.
107
+ */
108
+ export type TuiStreamObservation = {
109
+ readonly type: "event";
110
+ readonly event: unknown;
111
+ } | {
112
+ readonly type: "snapshot";
113
+ readonly snapshot: OperatorSnapshot;
114
+ readonly replacement: boolean;
115
+ } | {
116
+ readonly type: "resync";
117
+ } | {
118
+ readonly type: "incompatible";
119
+ } | {
120
+ readonly type: "diagnostic";
121
+ readonly diagnostic: OperatorDiagnostic;
122
+ } | {
123
+ readonly type: "live";
124
+ } | {
125
+ readonly type: "resync_pending";
126
+ } | {
127
+ readonly type: "resync_progress";
128
+ };
129
+ /** Resets the transport client, so the `fetch` or `open` that follows it connects. */
130
+ export interface TuiReconnectPort {
131
+ reconnect(): void;
132
+ }
133
+ /** Submits an operator command without making it a local fact. */
134
+ export interface TuiCommandPort {
135
+ execute(command: OperatorCommandEnvelope): TuiRequest<OperatorCommandResult>;
136
+ }
137
+ /** Cancellable work owned by the long-lived TUI model. */
138
+ export type TuiRequest<Value> = {
139
+ promise: Promise<Value>;
140
+ cancel(): void;
141
+ };
142
+ /** Reports what one local command run has produced so far. */
143
+ export type TuiLocalRun = {
144
+ /** Identity of this attempt, so a repeat is not mistaken for a continuation of the one before it. */
145
+ readonly id: number;
146
+ /** Command line shown to the operator, exactly as it was executed. */
147
+ readonly command: string;
148
+ /**
149
+ * Raw terminal bytes the command has written, oldest first. Whole chunks are dropped from the front
150
+ * once the total passes `TUI_RUN_OUTPUT_BYTE_LIMIT`, but the newest chunk is always kept.
151
+ *
152
+ * Kept unparsed because the child drives a terminal rather than printing lines: only an emulator can
153
+ * say what the screen now holds. Replaying the whole sequence reconstructs that screen, so a view
154
+ * that mounts late is not left blank.
155
+ */
156
+ readonly chunks: readonly Uint8Array[];
157
+ /**
158
+ * Count of chunks ever received, including those since dropped.
159
+ *
160
+ * A consumer writing chunks somewhere incrementally cannot use an index into `chunks`, which shifts
161
+ * under it as the buffer drops its oldest. This only ever grows.
162
+ */
163
+ readonly received: number;
164
+ /** Reports whether output was dropped because the buffer filled. */
165
+ readonly truncated: boolean;
166
+ /** Reports where the run has got to, and what it ended with once it has ended. */
167
+ readonly outcome: TuiLocalRunOutcome;
168
+ };
169
+ /** Where one local command run has got to. */
170
+ export type TuiLocalRunOutcome = {
171
+ readonly kind: "running";
172
+ } | {
173
+ readonly kind: "exited";
174
+ readonly code: number;
175
+ } | {
176
+ readonly kind: "failed";
177
+ readonly reason: string;
178
+ } | {
179
+ readonly kind: "cancelled";
180
+ };
181
+ /** Bytes a run's replay buffer keeps before it drops its oldest chunks. */
182
+ export declare const TUI_RUN_OUTPUT_BYTE_LIMIT: number;
183
+ /**
184
+ * Runs one local command on the operator's machine and reports its output as it arrives.
185
+ *
186
+ * Separate from `TuiCommandPort`, which submits an operator command to the broker. This one leaves
187
+ * the process entirely.
188
+ */
189
+ export interface TuiLocalCommandPort {
190
+ /**
191
+ * Start one command attached to a terminal, reporting its bytes and the status it ends with.
192
+ *
193
+ * The exit is reported only once the child's terminal has reached end of file, so it can arrive
194
+ * after the child itself has exited. Output still unread when the session is stopped is discarded.
195
+ * @param command - Executable to run.
196
+ * @param args - Arguments passed to the executable.
197
+ * @param size - Terminal dimensions the child lays its output out for.
198
+ * @param observe - Receives each output chunk, then exactly one terminal outcome.
199
+ * @returns - Handle for writing to the child, or null when it never started.
200
+ */
201
+ run(command: string, args: readonly string[], size: TuiLocalRunSize, observe: (event: {
202
+ type: "output";
203
+ bytes: Uint8Array;
204
+ } | {
205
+ type: "exit";
206
+ code: number;
207
+ } | {
208
+ type: "failed";
209
+ reason: string;
210
+ }) => void): TuiLocalCommandSession | null;
211
+ }
212
+ /** Dimensions a child is told its terminal has, so its output fits where the operator will read it. */
213
+ export type TuiLocalRunSize = {
214
+ /** Columns the child lays out to. */
215
+ readonly columns: number;
216
+ /** Rows the child lays out to. */
217
+ readonly rows: number;
218
+ };
219
+ /** Writes to a running child's terminal. */
220
+ export interface TuiLocalCommandSession {
221
+ /**
222
+ * Send operator input to the child, already encoded for a terminal.
223
+ * @param bytes - Sequence the child reads from its standard input.
224
+ */
225
+ write(bytes: Uint8Array): void;
226
+ /**
227
+ * Tell the child its terminal has a new size, so it lays its output out again.
228
+ * @param columns - Columns the child now has.
229
+ * @param rows - Rows the child now has.
230
+ */
231
+ resize(columns: number, rows: number): void;
232
+ /**
233
+ * End the child and release its terminal.
234
+ *
235
+ * The operator can leave while a child is still writing, and a child of a terminal nobody reads
236
+ * would hold its process and its file descriptor for as long as it chose to run.
237
+ */
238
+ stop(): void;
239
+ }
240
+ /** Schedules controller-owned recovery work after a caller-chosen delay. */
241
+ export interface TuiSchedulerPort {
242
+ schedule(callback: () => void, delayMs: number): () => void;
243
+ }
244
+ /** Releases composition-owned resources exactly once. */
245
+ export interface TuiDisposalPort {
246
+ dispose(): void;
247
+ }
248
+ /** Explicit dependencies selected by the TUI composition root. */
249
+ export type TuiOperatorModelDependencies = {
250
+ snapshot: TuiSnapshotPort;
251
+ stream: TuiStreamPort;
252
+ reconnect: TuiReconnectPort;
253
+ command: TuiCommandPort;
254
+ localCommand?: TuiLocalCommandPort;
255
+ scheduler: TuiSchedulerPort;
256
+ disposal: TuiDisposalPort;
257
+ layout?: TuiLayoutPort;
258
+ /** Current time in epoch milliseconds, for client diagnostics and the replacement wait's time limit. */
259
+ now: () => number;
260
+ };
261
+ /** Pane widths one operator dragged, in the terminal cells each pane occupies. */
262
+ export type TuiPaneLayout = {
263
+ /** Columns the tree pane was dragged to, or null while it holds its default. */
264
+ treeColumns: number | null;
265
+ /** Columns the message-log pane was dragged to, or null while it holds its default. */
266
+ messageLogColumns: number | null;
267
+ };
268
+ /** Carries dragged pane widths between runs of the terminal surface. */
269
+ export interface TuiLayoutPort {
270
+ /**
271
+ * Read the layout a previous run stored.
272
+ * @returns The stored layout, or null when none was stored or it could not be read.
273
+ */
274
+ read(): TuiPaneLayout | null;
275
+ /**
276
+ * Store a layout for later runs. A failure to store is not reported: losing a pane width is not
277
+ * worth interrupting an operator over.
278
+ * @param layout - Widths to store.
279
+ */
280
+ write(layout: TuiPaneLayout): void;
281
+ }
282
+ /**
283
+ * Renderer-independent authoritative-state controller.
284
+ *
285
+ * Data flows broker → model → view. The model holds the authoritative facts and one map derived from
286
+ * them, `healthByAgentId`; every other derivation is computed at read time, in `presentation.ts` or
287
+ * beside the component that reads it, and never stored here. A view renders immutable state read
288
+ * through `useSyncExternalStore` and calls model intents, but a key or pointer handler reads
289
+ * `model.state` instead of the state its component last rendered: a reduction carries a whole view, so
290
+ * one built from a rendered snapshot overwrites what another handler decided since.
291
+ *
292
+ * Transport, local process, and scheduling reach the model as injected ports, so a component never
293
+ * opens a socket. The clipboard and the command-id and issue-time ports are the shell's, not the
294
+ * model's: they reach components as props, and components call them directly. Diagnostics go through
295
+ * this model's log, not `console.*` from a component; the runtime reports an abnormal exit's cause
296
+ * once the terminal is restored.
297
+ */
298
+ export declare class TuiOperatorModel {
299
+ #private;
300
+ private readonly dependencies;
301
+ /**
302
+ * Construct a controller from explicit IO and lifecycle collaborators.
303
+ * @param dependencies - Injected transport, command, scheduling, and disposal ports.
304
+ */
305
+ constructor(dependencies: TuiOperatorModelDependencies);
306
+ /**
307
+ * Read the current immutable model state.
308
+ * @returns Current broker facts and local view state.
309
+ */
310
+ get state(): TuiOperatorModelState;
311
+ /**
312
+ * Observe state transitions.
313
+ * @param listener - Listener invoked after each state change.
314
+ * @returns Removal callback.
315
+ */
316
+ subscribe(listener: (state: TuiOperatorModelState) => void): () => void;
317
+ /**
318
+ * Hydrate authoritative facts and begin ordered reduction.
319
+ * @returns Completion after the initial snapshot is installed.
320
+ */
321
+ start(): Promise<void>;
322
+ /**
323
+ * Submit a command without locally changing broker facts.
324
+ * @param command - Versioned operator command.
325
+ * @returns Broker admission result.
326
+ */
327
+ execute(command: OperatorCommandEnvelope): Promise<OperatorCommandResult>;
328
+ /**
329
+ * Start one local command and record its output as it arrives.
330
+ *
331
+ * Ignored while a run is already in progress, so a repeated key cannot start a second child.
332
+ * @param command - Executable to run.
333
+ * @param args - Arguments passed to the executable.
334
+ * @param size - Terminal dimensions the child lays its output out for.
335
+ */
336
+ startLocalRun(command: string, args: readonly string[], size: TuiLocalRunSize): void;
337
+ /**
338
+ * Send operator input to the running child.
339
+ *
340
+ * Ignored unless a child is running, so a key pressed as the run ends cannot reach a dead process.
341
+ * @param bytes - Sequence already encoded for the child's terminal.
342
+ */
343
+ writeToLocalRun(bytes: Uint8Array): void;
344
+ /**
345
+ * Tell the running child its terminal has been resized.
346
+ *
347
+ * Ignored unless a child is running, for the same reason input is.
348
+ * @param columns - Columns the child now has.
349
+ * @param rows - Rows the child now has.
350
+ */
351
+ resizeLocalRun(columns: number, rows: number): void;
352
+ /**
353
+ * Discard a finished run, leaving a run still in progress alone.
354
+ */
355
+ clearLocalRun(): void;
356
+ /**
357
+ * End the running child and report the run as abandoned.
358
+ *
359
+ * The outcome is recorded here rather than awaited from the port, because the operator asked to stop
360
+ * waiting: a child that ignores the signal would otherwise keep them in the overlay it is stuck in.
361
+ * Whatever that child reports afterwards is dropped, because the run is no longer running.
362
+ */
363
+ cancelLocalRun(): void;
364
+ /**
365
+ * Set one side pane's dragged width.
366
+ *
367
+ * Storing is deliberately not done here: this runs once per cell of pointer travel, and the store
368
+ * is a blocking write.
369
+ *
370
+ * The pane on the far side is pinned to the width it currently renders at. Left as a preference the
371
+ * layout has not yet honoured, it would be re-clamped against the new request and shift under a
372
+ * pointer that never touched it.
373
+ * @param pane - Which side pane the operator dragged.
374
+ * @param columns - Cells the dragged pane should occupy, before any clamping the layout applies.
375
+ * @param oppositeColumns - Cells the pane on the far side of the agent log currently renders at.
376
+ */
377
+ resizePane(pane: "tree" | "message_log", columns: number, oppositeColumns: number): void;
378
+ /** Store the pane widths the operator has finished dragging, for later runs to adopt. */
379
+ commitPaneLayout(): void;
380
+ /**
381
+ * Update local view state only.
382
+ * @param update - Pure local view transformation.
383
+ */
384
+ updateView(update: (view: TuiOperatorViewState) => TuiOperatorViewState): void;
385
+ /**
386
+ * Select one traffic row, marking an accepted delivery read by the act of showing it.
387
+ * @param entry - Traffic row the operator moved onto.
388
+ */
389
+ viewTraffic(entry: OperatorTraffic): void;
390
+ /** Dispose stream, recovery work, listeners, and composition resources once. */
391
+ dispose(): void;
392
+ /**
393
+ * Record a condition this client observed, stamped from the model's own clock.
394
+ * @param severity - Attention the condition asks for.
395
+ * @param scope - Subsystem the condition arose in.
396
+ * @param summary - Content-free description, in the words the diagnostics log shows.
397
+ */
398
+ reportDiagnostic(severity: OperatorDiagnostic["severity"], scope: string, summary: string): void;
399
+ /**
400
+ * Install a complete transport snapshot through the same authoritative replacement path.
401
+ * @param snapshot - Validated operator snapshot, held by the model from here on.
402
+ * @param replacement - Whether the snapshot answers a resync, so unread identities that survived the gap are kept.
403
+ */
404
+ observeSnapshot(snapshot: OperatorSnapshot, replacement: boolean): void;
405
+ /**
406
+ * Apply one transport event using normal ordered reduction.
407
+ * @param event - Untrusted event envelope from the operator stream, validated here before it is applied.
408
+ */
409
+ observeEvent(event: unknown): void;
410
+ /** Start bounded recovery after an explicit transport resync. */
411
+ observeResync(): void;
412
+ /** End stream application after an incompatible transport observation. */
413
+ observeIncompatible(): void;
414
+ }