@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,59 @@
1
+ /**
2
+ * Hand-rolled structural guards for reading an untrusted `unknown` value as a plain JSON-like object.
3
+ *
4
+ * Neutral: no domain owns this module, so it must not import from any domain module, and it raises
5
+ * failures through a caller-supplied `fail` rather than a domain error type. `Reflect.ownKeys` plus a
6
+ * property-descriptor read (rather than direct property access) defends against a value whose access
7
+ * throws — a hostile Proxy trap or a getter that runs arbitrary code — so a malformed field fails with
8
+ * a located diagnostic instead of an uncaught throw.
9
+ */
10
+ /** Raises a caller's own error for one field path; never returns. */
11
+ export type GuardFailure = (path: string, reason: string) => never;
12
+ /**
13
+ * Report whether a value is a plain JSON-like object: not null, not an array.
14
+ * @param value - Untrusted candidate value.
15
+ * @returns - Whether the value narrows to a record of unknown fields.
16
+ */
17
+ export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
18
+ /**
19
+ * Read every own enumerable string-keyed entry of an object, defensively.
20
+ * @param value - Object to enumerate.
21
+ * @param path - Field path named in a raised failure.
22
+ * @param fail - Raises the caller's own error for one field path.
23
+ * @returns - Enumerated key/value entries in `Reflect.ownKeys` order.
24
+ */
25
+ export declare function readOwnEnumerableEntries(value: object, path: string, fail: GuardFailure): Array<[string, unknown]>;
26
+ /**
27
+ * Narrow an untrusted value to a record of its own enumerable fields.
28
+ * @param value - Untrusted candidate value.
29
+ * @param path - Field path named in a raised failure.
30
+ * @param fail - Raises the caller's own error for one field path.
31
+ * @returns - The value's own enumerable fields as a plain record.
32
+ */
33
+ export declare function readRecord(value: unknown, path: string, fail: GuardFailure): Record<string, unknown>;
34
+ /**
35
+ * Narrow an untrusted value to an array, reading each index defensively.
36
+ * @param value - Untrusted candidate value.
37
+ * @param path - Field path named in a raised failure.
38
+ * @param fail - Raises the caller's own error for one field path.
39
+ * @returns - The array's elements, read defensively in order.
40
+ */
41
+ export declare function readArray(value: unknown, path: string, fail: GuardFailure): unknown[];
42
+ /** Options for {@link exactFields}. */
43
+ export type ExactFieldsCheck = {
44
+ /** Record to check. */
45
+ record: Record<string, unknown>;
46
+ /** Field names that must be present. */
47
+ required: readonly string[];
48
+ /** Field names that may be present. */
49
+ optional: readonly string[];
50
+ /** Field path named in a raised failure. */
51
+ path: string;
52
+ /** Raises the caller's own error for one field path. */
53
+ fail: GuardFailure;
54
+ };
55
+ /**
56
+ * Assert a record carries only permitted fields and every required one.
57
+ * @param check - Record, its permitted field names, the failure path, and the failure callback.
58
+ */
59
+ export declare function exactFields({ record, required, optional, path, fail }: ExactFieldsCheck): void;
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Hand-rolled structural guards for reading an untrusted `unknown` value as a plain JSON-like object.
3
+ *
4
+ * Neutral: no domain owns this module, so it must not import from any domain module, and it raises
5
+ * failures through a caller-supplied `fail` rather than a domain error type. `Reflect.ownKeys` plus a
6
+ * property-descriptor read (rather than direct property access) defends against a value whose access
7
+ * throws — a hostile Proxy trap or a getter that runs arbitrary code — so a malformed field fails with
8
+ * a located diagnostic instead of an uncaught throw.
9
+ */
10
+ /**
11
+ * Report whether a value is a plain JSON-like object: not null, not an array.
12
+ * @param value - Untrusted candidate value.
13
+ * @returns - Whether the value narrows to a record of unknown fields.
14
+ */
15
+ export function isPlainObject(value) {
16
+ return typeof value === "object" && value !== null && !Array.isArray(value);
17
+ }
18
+ /**
19
+ * Read every own enumerable string-keyed entry of an object, defensively.
20
+ * @param value - Object to enumerate.
21
+ * @param path - Field path named in a raised failure.
22
+ * @param fail - Raises the caller's own error for one field path.
23
+ * @returns - Enumerated key/value entries in `Reflect.ownKeys` order.
24
+ */
25
+ export function readOwnEnumerableEntries(value, path, fail) {
26
+ let keys;
27
+ try {
28
+ keys = Reflect.ownKeys(value);
29
+ }
30
+ catch {
31
+ fail(path, "fields could not be enumerated");
32
+ }
33
+ const entries = [];
34
+ for (const key of Array.from(keys)) {
35
+ let descriptor;
36
+ try {
37
+ descriptor = Object.getOwnPropertyDescriptor(value, key);
38
+ }
39
+ catch {
40
+ const fieldPath = typeof key === "string" ? `${path}.${key}` : path;
41
+ fail(fieldPath, "field descriptor could not be read");
42
+ }
43
+ if (!descriptor?.enumerable)
44
+ continue;
45
+ if (typeof key !== "string")
46
+ fail(path, "contains a non-string field");
47
+ let entry;
48
+ try {
49
+ entry = Reflect.get(value, key, value);
50
+ }
51
+ catch {
52
+ fail(`${path}.${key}`, "field could not be read");
53
+ }
54
+ entries.push([key, entry]);
55
+ }
56
+ return entries;
57
+ }
58
+ /**
59
+ * Narrow an untrusted value to a record of its own enumerable fields.
60
+ * @param value - Untrusted candidate value.
61
+ * @param path - Field path named in a raised failure.
62
+ * @param fail - Raises the caller's own error for one field path.
63
+ * @returns - The value's own enumerable fields as a plain record.
64
+ */
65
+ export function readRecord(value, path, fail) {
66
+ if (!isPlainObject(value))
67
+ fail(path, "must be an object");
68
+ const record = {};
69
+ for (const [key, entry] of readOwnEnumerableEntries(value, path, fail)) {
70
+ Object.defineProperty(record, key, { value: entry, enumerable: true, configurable: true, writable: true });
71
+ }
72
+ return record;
73
+ }
74
+ /**
75
+ * Narrow an untrusted value to an array, reading each index defensively.
76
+ * @param value - Untrusted candidate value.
77
+ * @param path - Field path named in a raised failure.
78
+ * @param fail - Raises the caller's own error for one field path.
79
+ * @returns - The array's elements, read defensively in order.
80
+ */
81
+ export function readArray(value, path, fail) {
82
+ if (!Array.isArray(value))
83
+ fail(path, "must be an array");
84
+ const output = [];
85
+ let length;
86
+ try {
87
+ length = value.length;
88
+ }
89
+ catch {
90
+ fail(`${path}.length`, "field could not be read");
91
+ }
92
+ if (!Number.isSafeInteger(length) || length < 0) {
93
+ fail(`${path}.length`, "must be a non-negative safe integer");
94
+ }
95
+ for (let index = 0; index < length; index += 1) {
96
+ try {
97
+ output.push(value[index]);
98
+ }
99
+ catch {
100
+ fail(`${path}[${String(index)}]`, "field could not be read");
101
+ }
102
+ }
103
+ return output;
104
+ }
105
+ /**
106
+ * Assert a record carries only permitted fields and every required one.
107
+ * @param check - Record, its permitted field names, the failure path, and the failure callback.
108
+ */
109
+ export function exactFields({ record, required, optional, path, fail }) {
110
+ const permitted = new Set([...required, ...optional]);
111
+ for (const key of Object.keys(record)) {
112
+ if (!permitted.has(key))
113
+ fail(`${path}.${key}`, "unexpected field");
114
+ }
115
+ for (const key of required) {
116
+ if (!Object.hasOwn(record, key))
117
+ fail(`${path}.${key}`, "required field is missing");
118
+ }
119
+ }
@@ -0,0 +1,30 @@
1
+ import type { ServerResponse } from "node:http";
2
+ import type { Server } from "node:net";
3
+ /**
4
+ * Format a bound interface for use in a URL, bracketing an IPv6 literal.
5
+ * @param host - Interface address a server bound and reported back.
6
+ * @returns - The host as it belongs in a URL authority.
7
+ */
8
+ export declare function urlHost(host: string): string;
9
+ /**
10
+ * Write a JSON response body with the given status and headers.
11
+ * @param response - Server response to complete.
12
+ * @param status - HTTP status code.
13
+ * @param body - Value serialized as the JSON response body.
14
+ * @param headers - Additional response headers merged with the JSON content type.
15
+ */
16
+ export declare function writeJson(response: ServerResponse, status: number, body: unknown, headers?: Record<string, string>): void;
17
+ /**
18
+ * Bind a server, rejecting a bind failure instead of leaving the promise pending.
19
+ * @param server - Server to bind.
20
+ * @param port - Port to bind.
21
+ * @param host - Interface to bind.
22
+ * @returns - Resolves once the server is listening.
23
+ */
24
+ export declare function listenServer(server: Server, port: number, host: string): Promise<void>;
25
+ /**
26
+ * Close a server, rejecting a close failure instead of leaving the promise pending.
27
+ * @param server - Server to close.
28
+ * @returns - Resolves once the server has closed, or rejects with its close error.
29
+ */
30
+ export declare function closeServer(server: Server): Promise<void>;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Format a bound interface for use in a URL, bracketing an IPv6 literal.
3
+ * @param host - Interface address a server bound and reported back.
4
+ * @returns - The host as it belongs in a URL authority.
5
+ */
6
+ export function urlHost(host) {
7
+ return host.includes(":") ? `[${host}]` : host;
8
+ }
9
+ /**
10
+ * Write a JSON response body with the given status and headers.
11
+ * @param response - Server response to complete.
12
+ * @param status - HTTP status code.
13
+ * @param body - Value serialized as the JSON response body.
14
+ * @param headers - Additional response headers merged with the JSON content type.
15
+ */
16
+ export function writeJson(response, status, body, headers = {}) {
17
+ response.writeHead(status, { "content-type": "application/json", ...headers });
18
+ response.end(JSON.stringify(body));
19
+ }
20
+ /**
21
+ * Bind a server, rejecting a bind failure instead of leaving the promise pending.
22
+ * @param server - Server to bind.
23
+ * @param port - Port to bind.
24
+ * @param host - Interface to bind.
25
+ * @returns - Resolves once the server is listening.
26
+ */
27
+ export function listenServer(server, port, host) {
28
+ return new Promise((resolve, reject) => {
29
+ server.once("error", reject);
30
+ server.listen(port, host, () => {
31
+ server.off("error", reject);
32
+ resolve();
33
+ });
34
+ });
35
+ }
36
+ /**
37
+ * Close a server, rejecting a close failure instead of leaving the promise pending.
38
+ * @param server - Server to close.
39
+ * @returns - Resolves once the server has closed, or rejects with its close error.
40
+ */
41
+ export function closeServer(server) {
42
+ return new Promise((resolve, reject) => {
43
+ server.close((error) => {
44
+ if (error)
45
+ reject(error);
46
+ else
47
+ resolve();
48
+ });
49
+ });
50
+ }
@@ -0,0 +1,2 @@
1
+ /** Shape of one SQLite result row before its columns are read into a typed value. */
2
+ export type Row = Record<string, unknown>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Single-quote a value so it reaches a POSIX shell as one word.
3
+ * @param value - Value to quote.
4
+ * @returns - The value as a single shell word.
5
+ */
6
+ export declare function shellQuote(value: string): string;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Single-quote a value so it reaches a POSIX shell as one word.
3
+ * @param value - Value to quote.
4
+ * @returns - The value as a single shell word.
5
+ */
6
+ export function shellQuote(value) {
7
+ return `'${value.replaceAll("'", `'\\''`)}'`;
8
+ }
@@ -0,0 +1,166 @@
1
+ import { type PackagedSkill } from "../launch/skill.js";
2
+ import { type TuiCopyFallbackPort } from "./message-views.js";
3
+ import type { TuiLocalRun, TuiLocalRunSize, TuiOperatorModelState, TuiOperatorViewState } from "./model.js";
4
+ import type { TuiTheme } from "./theme.js";
5
+ /**
6
+ * Installs into the global scope, leaving every other choice to the operator.
7
+ *
8
+ * The child runs in a terminal it can prompt through, so nothing here answers on the operator's
9
+ * behalf.
10
+ */
11
+ export declare const SKILL_INSTALL_FLAGS: readonly string[];
12
+ /** Names every skill action in the menu. */
13
+ export declare const SKILL_ACTION_LABEL = "Install skills";
14
+ /** Footer keys of the actions menu. A constant, because JSX collapses runs of spaces in inline text. */
15
+ export declare const ACTIONS_FOOTER_KEYS = "\u23CE select";
16
+ /** The one thing a key asks the shell to do to the local run. */
17
+ export type TuiActionRunRequest = {
18
+ readonly kind: "none";
19
+ }
20
+ /** Start the command. */
21
+ | {
22
+ readonly kind: "start";
23
+ readonly command: TuiActionCommand;
24
+ }
25
+ /** Discard a finished run's output. */
26
+ | {
27
+ readonly kind: "clear";
28
+ }
29
+ /** End the child the operator asked to abandon. */
30
+ | {
31
+ readonly kind: "cancel";
32
+ };
33
+ /** Reports the next view and the work the shell must perform on the model's behalf. */
34
+ export type TuiOperatorActionsKeyResult = {
35
+ /** Next view state, identical to the current one when the key means nothing here. */
36
+ view: TuiOperatorViewState;
37
+ /** What the key asks of the local run; a key never asks for more than one. */
38
+ request: TuiActionRunRequest;
39
+ };
40
+ /** Names the child process one action runs. */
41
+ export type TuiActionCommand = {
42
+ /** Executable to run. */
43
+ command: string;
44
+ /** Arguments passed to the executable. */
45
+ args: readonly string[];
46
+ /** The same command as an operator would type it, shown above the terminal and copied on request. */
47
+ display: string;
48
+ };
49
+ /** One operator action offered by the actions menu. */
50
+ export type TuiOperatorAction = {
51
+ /** Identifies the action for selection and tests. */
52
+ id: string;
53
+ /** Names the action in the menu. */
54
+ label: string;
55
+ /** Titles the overlay the action runs in. */
56
+ title: string;
57
+ /** Command the action runs. */
58
+ command: TuiActionCommand;
59
+ };
60
+ /**
61
+ * Registration this build offers for one agent harness, supplied by the composition root.
62
+ *
63
+ * Injected rather than imported because the menu must not name an implementation.
64
+ */
65
+ export type TuiHostRegistration = {
66
+ /** Identifies the harness, and the action that registers with it. */
67
+ id: string;
68
+ /** Names the harness as the operator knows it. */
69
+ label: string;
70
+ /** Command that performs the registration. */
71
+ command: TuiActionCommand;
72
+ };
73
+ /** Everything the actions menu can offer, resolved once by the composition root. */
74
+ export type TuiActionCatalogue = {
75
+ /** Skills this build ships, in the order the menu lists them. */
76
+ readonly skills: readonly PackagedSkill[];
77
+ /** Harness registrations this build offers, listed after the skills. */
78
+ readonly registrations: readonly TuiHostRegistration[];
79
+ };
80
+ /**
81
+ * List the actions the operator may start from the menu, in display order.
82
+ *
83
+ * Declared as data so a further action is an entry here rather than a branch in the menu, which
84
+ * never names a specific action.
85
+ * @param catalogue - Skills and harness registrations this build offers.
86
+ * @returns - Every selectable action, in display order.
87
+ */
88
+ export declare function operatorActions(catalogue: TuiActionCatalogue): readonly TuiOperatorAction[];
89
+ /**
90
+ * Find the action an overlay was opened for.
91
+ * @param id - Action id recorded when the action was selected.
92
+ * @param catalogue - Skills and harness registrations this build offers.
93
+ * @returns - The action, or undefined when this build no longer offers one by that id.
94
+ */
95
+ export declare function menuAction(id: string, catalogue: TuiActionCatalogue): TuiOperatorAction | undefined;
96
+ /**
97
+ * Reduce one key pressed while an action overlay is open.
98
+ *
99
+ * Pure. `y`, which copies the command before a run, is the one action-overlay key `ActionRunOverlay`
100
+ * answers itself.
101
+ *
102
+ * Escape during a run ends the child at once, without asking again, so the operator can always leave a
103
+ * run that will not finish, including an Escape the operator meant for a prompt of the child's own.
104
+ * @param state - Current model state.
105
+ * @param key - Key name reported by the terminal.
106
+ * @param catalogue - Skills and harness registrations this build offers.
107
+ * @returns - Next view state, unchanged when the key means nothing here, and the run request the key makes.
108
+ */
109
+ export declare function reduceOperatorActionsKey(state: TuiOperatorModelState, key: string, catalogue: TuiActionCatalogue): TuiOperatorActionsKeyResult;
110
+ /**
111
+ * Render the operator actions menu.
112
+ * @param properties - Described on each property below.
113
+ * @returns Overlay centred over the shell, listing the packaged skills first and then each registration.
114
+ */
115
+ export declare function ActionsOverlay({ actionIndex, catalogue, theme, onSelect, }: {
116
+ /** Row highlighted, as an index into the actions the menu lists. */
117
+ readonly actionIndex: number;
118
+ /** Skills and harness registrations the menu lists. */
119
+ readonly catalogue: TuiActionCatalogue;
120
+ /** Semantic palette the menu draws with. */
121
+ readonly theme: Readonly<TuiTheme>;
122
+ /** Called with the action a pointer press chose. */
123
+ readonly onSelect: (action: TuiOperatorAction) => void;
124
+ }): import("react").ReactNode;
125
+ /**
126
+ * Colour the outcome so a clean exit and a failure read as such without being read. No run yet, a run
127
+ * still going, and a cancelled run share the neutral colour; only the status text tells them apart.
128
+ *
129
+ * Green marks a zero exit, which says the command finished and nothing more; see `skillInstallStatus`.
130
+ * @param run - Current run, or null before one has started.
131
+ * @param theme - Semantic palette the surface draws from.
132
+ * @returns - Colour for the status shown beside the title.
133
+ */
134
+ export declare function skillInstallStatusColor(run: TuiLocalRun | null, theme: Readonly<TuiTheme>): string;
135
+ /**
136
+ * Report the terminal the install's child is given.
137
+ *
138
+ * The child lays its output out for this size, and the emulator that renders that output is built to
139
+ * match, so the two must be read from here rather than each deciding for itself.
140
+ * @param terminalRows - Rows the whole terminal has.
141
+ * @returns - Columns and rows of the run overlay's terminal.
142
+ */
143
+ export declare function skillInstallTerminalSize(terminalRows: number): TuiLocalRunSize;
144
+ /**
145
+ * Render one action's run: its command, its terminal, its outcome, and the keys it answers.
146
+ * @param properties - Described on each property below.
147
+ * @returns The run overlay, or nothing when this build no longer offers the action.
148
+ */
149
+ export declare function ActionRunOverlay({ run, actionId, catalogue, terminalRows, copyFallback, onInput, onResize, theme, }: {
150
+ /** Run the model holds, or null before the operator has started one. */
151
+ readonly run: TuiLocalRun | null;
152
+ /** Action the overlay was opened for. */
153
+ readonly actionId: string;
154
+ /** Skills and harness registrations this build offers, among which the action is looked up. */
155
+ readonly catalogue: TuiActionCatalogue;
156
+ /** Rows the whole terminal has, from which the overlay and the child's terminal are sized. */
157
+ readonly terminalRows: number;
158
+ /** Native copy used when the terminal cannot take OSC52, or its OSC52 write fails. */
159
+ readonly copyFallback: TuiCopyFallbackPort;
160
+ /** Receives the operator's keys, encoded for the child's terminal. */
161
+ readonly onInput: (bytes: Uint8Array) => void;
162
+ /** Receives the child terminal's new size when the emulator resizes it. */
163
+ readonly onResize: (columns: number, rows: number) => void;
164
+ /** Semantic palette the overlay draws with. */
165
+ readonly theme: Readonly<TuiTheme>;
166
+ }): import("react").ReactNode;