shellpuppet 0.0.1 → 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 (112) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +31 -0
  3. package/README.md +340 -8
  4. package/dist/cli/index.d.ts +13 -0
  5. package/dist/cli/index.js +693 -0
  6. package/dist/cli/index.js.map +1 -0
  7. package/dist/client/http.d.ts +82 -0
  8. package/dist/client/http.js +225 -0
  9. package/dist/client/http.js.map +1 -0
  10. package/dist/core/dialogs.d.ts +88 -0
  11. package/dist/core/dialogs.js +214 -0
  12. package/dist/core/dialogs.js.map +1 -0
  13. package/dist/core/echo.d.ts +71 -0
  14. package/dist/core/echo.js +249 -0
  15. package/dist/core/echo.js.map +1 -0
  16. package/dist/core/find.d.ts +34 -0
  17. package/dist/core/find.js +41 -0
  18. package/dist/core/find.js.map +1 -0
  19. package/dist/core/keys.d.ts +22 -0
  20. package/dist/core/keys.js +80 -0
  21. package/dist/core/keys.js.map +1 -0
  22. package/dist/core/manager.d.ts +66 -0
  23. package/dist/core/manager.js +158 -0
  24. package/dist/core/manager.js.map +1 -0
  25. package/dist/core/nativePty.d.ts +69 -0
  26. package/dist/core/nativePty.js +156 -0
  27. package/dist/core/nativePty.js.map +1 -0
  28. package/dist/core/policy.d.ts +61 -0
  29. package/dist/core/policy.js +143 -0
  30. package/dist/core/policy.js.map +1 -0
  31. package/dist/core/promptDetector.d.ts +75 -0
  32. package/dist/core/promptDetector.js +606 -0
  33. package/dist/core/promptDetector.js.map +1 -0
  34. package/dist/core/reasoning.d.ts +252 -0
  35. package/dist/core/reasoning.js +740 -0
  36. package/dist/core/reasoning.js.map +1 -0
  37. package/dist/core/regexBudget.d.ts +44 -0
  38. package/dist/core/regexBudget.js +79 -0
  39. package/dist/core/regexBudget.js.map +1 -0
  40. package/dist/core/renderer.d.ts +112 -0
  41. package/dist/core/renderer.js +225 -0
  42. package/dist/core/renderer.js.map +1 -0
  43. package/dist/core/session.d.ts +311 -0
  44. package/dist/core/session.js +966 -0
  45. package/dist/core/session.js.map +1 -0
  46. package/dist/core/types.d.ts +281 -0
  47. package/dist/core/types.js +47 -0
  48. package/dist/core/types.js.map +1 -0
  49. package/dist/core/waiter.d.ts +86 -0
  50. package/dist/core/waiter.js +317 -0
  51. package/dist/core/waiter.js.map +1 -0
  52. package/dist/core/windowsPtyStart.d.ts +90 -0
  53. package/dist/core/windowsPtyStart.js +129 -0
  54. package/dist/core/windowsPtyStart.js.map +1 -0
  55. package/dist/daemon/audit.d.ts +23 -0
  56. package/dist/daemon/audit.js +51 -0
  57. package/dist/daemon/audit.js.map +1 -0
  58. package/dist/daemon/auth.d.ts +127 -0
  59. package/dist/daemon/auth.js +241 -0
  60. package/dist/daemon/auth.js.map +1 -0
  61. package/dist/daemon/config.d.ts +76 -0
  62. package/dist/daemon/config.js +301 -0
  63. package/dist/daemon/config.js.map +1 -0
  64. package/dist/daemon/index.d.ts +7 -0
  65. package/dist/daemon/index.js +87 -0
  66. package/dist/daemon/index.js.map +1 -0
  67. package/dist/daemon/liveness.d.ts +36 -0
  68. package/dist/daemon/liveness.js +71 -0
  69. package/dist/daemon/liveness.js.map +1 -0
  70. package/dist/daemon/logger.d.ts +7 -0
  71. package/dist/daemon/logger.js +29 -0
  72. package/dist/daemon/logger.js.map +1 -0
  73. package/dist/daemon/meta.d.ts +9 -0
  74. package/dist/daemon/meta.js +24 -0
  75. package/dist/daemon/meta.js.map +1 -0
  76. package/dist/daemon/paths.d.ts +83 -0
  77. package/dist/daemon/paths.js +154 -0
  78. package/dist/daemon/paths.js.map +1 -0
  79. package/dist/daemon/screenshot.d.ts +87 -0
  80. package/dist/daemon/screenshot.js +256 -0
  81. package/dist/daemon/screenshot.js.map +1 -0
  82. package/dist/daemon/server.d.ts +244 -0
  83. package/dist/daemon/server.js +2187 -0
  84. package/dist/daemon/server.js.map +1 -0
  85. package/dist/daemon/terminalReports.d.ts +38 -0
  86. package/dist/daemon/terminalReports.js +84 -0
  87. package/dist/daemon/terminalReports.js.map +1 -0
  88. package/dist/daemon/viewerLauncher.d.ts +135 -0
  89. package/dist/daemon/viewerLauncher.js +280 -0
  90. package/dist/daemon/viewerLauncher.js.map +1 -0
  91. package/dist/daemon/viewerSync.d.ts +38 -0
  92. package/dist/daemon/viewerSync.js +83 -0
  93. package/dist/daemon/viewerSync.js.map +1 -0
  94. package/dist/mcp/config.d.ts +57 -0
  95. package/dist/mcp/config.js +106 -0
  96. package/dist/mcp/config.js.map +1 -0
  97. package/dist/mcp/index.d.ts +10 -0
  98. package/dist/mcp/index.js +69 -0
  99. package/dist/mcp/index.js.map +1 -0
  100. package/dist/mcp/tools.d.ts +59 -0
  101. package/dist/mcp/tools.js +537 -0
  102. package/dist/mcp/tools.js.map +1 -0
  103. package/dist/viewer/icon-16.png +0 -0
  104. package/dist/viewer/icon-180.png +0 -0
  105. package/dist/viewer/icon-32.png +0 -0
  106. package/dist/viewer/icon-512.png +0 -0
  107. package/dist/viewer/icon.svg +66 -0
  108. package/dist/viewer/index.html +56 -0
  109. package/dist/viewer/viewer.css +84 -0
  110. package/dist/viewer/viewer.js +661 -0
  111. package/package.json +66 -7
  112. package/index.js +0 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/core/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,2BAA2B,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MA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AAK,CAAC,yDAAyD,EAAE;gBAC3E,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,GAAG;aACJ,CAAC,CAAC;QACL,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC1B,CAAC;IAED;;;OAGG;IACK,YAAY,CAAC,GAAW;QAC9B,IAAI,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACrB,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,qEAAqE;YACrE,uEAAuE;YACvE,qEAAqE;YACrE,mEAAmE;YACnE,+DAA+D;YAC/D,OAAQ,KAA+B,CAAC,IAAI,KAAK,OAAO,CAAC;QAC3D,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,281 @@
1
+ /**
2
+ * Shared domain types and defaults for ShellPuppet.
3
+ *
4
+ * Everything here is pure data, with no I/O and no Node APIs. The design document
5
+ * (`docs/architecture/design.md`) is the source of truth for the shapes below;
6
+ * section references are given where a type encodes a specific decision.
7
+ */
8
+ import type { DetectedPrompt } from './promptDetector.js';
9
+ export type { DetectedPrompt };
10
+ /** Injected logging interface (design §2.4).
11
+ *
12
+ * `core/` and `client/` never write to stdout or stderr: a stray console line
13
+ * corrupts the MCP stdio protocol. Adapters decide where log output goes: the CLI
14
+ * wires this to the console, the MCP adapter to a file or stderr, the daemon to
15
+ * its own log.
16
+ */
17
+ export interface Logger {
18
+ debug(message: string, meta?: Record<string, unknown>): void;
19
+ info(message: string, meta?: Record<string, unknown>): void;
20
+ warn(message: string, meta?: Record<string, unknown>): void;
21
+ error(message: string, meta?: Record<string, unknown>): void;
22
+ }
23
+ /** A logger that discards everything: the safe default where none is injected. */
24
+ export declare const NULL_LOGGER: Logger;
25
+ /** Options accepted when starting a session (design §3, `terminal_start`). */
26
+ export interface SessionOptions {
27
+ /** The real, pre-wrap command: e.g. `goose`, never `cmd.exe /c goose` (§4.3). */
28
+ command: string;
29
+ args?: string[];
30
+ cwd?: string;
31
+ /** The grid to START at. Not a freeze: see `hold`. */
32
+ cols?: number;
33
+ rows?: number;
34
+ /**
35
+ * Hold the grid against viewers (§5). Off by default, because the ordinary
36
+ * case is a human watching in a browser whose window should fill. Turn it on
37
+ * for a run whose output is compared against a known width, where a reflow
38
+ * would invalidate the run and bars are the right answer.
39
+ */
40
+ hold?: boolean;
41
+ label?: string;
42
+ /**
43
+ * What this session is FOR, in a sentence, shown to the human watching it.
44
+ * A label names the session; a purpose explains why it exists, and
45
+ * when several viewer windows are open at once that is the difference
46
+ * between picking the right one and guessing.
47
+ */
48
+ purpose?: string;
49
+ /**
50
+ * Which client started the session (the audit actor, e.g. `mcp:claude-code`).
51
+ * Set by the daemon from the request's `x-shellpuppet-actor` header rather
52
+ * than from the body, so it cannot be set independently of the audit trail.
53
+ *
54
+ * It is **self-declared, not authenticated**: a client may send whatever
55
+ * actor it likes. This is provenance for a human reading a viewer window,
56
+ * not an identity control, and the same-user model means there is no
57
+ * boundary here to enforce.
58
+ */
59
+ startedBy?: string;
60
+ /**
61
+ * Which agent CLI the session runs, by signature name (`reasoning.ts`):
62
+ * how `hideReasoning` and `terminal_result` read its screen. Needed when
63
+ * the agent is reached through a shell, a wrapper or a launcher script;
64
+ * without it the start command's own name chooses the signature.
65
+ */
66
+ agent?: string;
67
+ /** Text that must appear on screen before the session reports `ready` (§3.1). */
68
+ readyText?: string;
69
+ /** Quiescence (ms of no output) that marks the session `ready` (§3.1). */
70
+ readyQuiet?: number;
71
+ /**
72
+ * Shell-wrap the command daemon-side (`cmd.exe /c` on Windows). Defaults to
73
+ * true on Windows because direct ConPTY spawns of single-file binaries hang
74
+ * (§7). Applied AFTER policy evaluation: policy always sees the pre-wrap
75
+ * command (§4.3).
76
+ */
77
+ shell?: boolean;
78
+ /**
79
+ * Variables set in this session's environment on top of what `sessionEnv`
80
+ * gives it, by name and value (§4.6). The MCP server fills it from its own
81
+ * environment, for the names the human allowed in `mcp.passEnv`. The values
82
+ * are spawn input only: the session never keeps them, and logs and the
83
+ * audit trail record the names alone.
84
+ */
85
+ env?: Record<string, string>;
86
+ }
87
+ /** One session's public state, as returned by `terminal_list`. */
88
+ export interface SessionSummary {
89
+ id: string;
90
+ label: string;
91
+ /** What the session is for; empty when the caller did not say. */
92
+ purpose: string;
93
+ /** The audit actor that started it, e.g. `mcp:claude-code`, `cli`. */
94
+ startedBy: string;
95
+ /** The agent it was started as (`SessionOptions.agent`), or null. */
96
+ agent: string | null;
97
+ command: string;
98
+ args: string[];
99
+ cols: number;
100
+ rows: number;
101
+ ready: boolean;
102
+ /**
103
+ * Why `ready` holds the value it does. `ready: true` alone is ambiguous and
104
+ * easily read as a green light to start typing: when the caller supplies no
105
+ * `readyText`/`readyQuiet`, readiness is not being tracked at all, and a
106
+ * bare `true` says nothing about whether the program can accept input.
107
+ *
108
+ * - `not-tracked`: no readiness condition was given. `ready` is true by
109
+ * convention only; **do not** treat it as safe to type.
110
+ * - `pending`: a condition was given and has not held yet.
111
+ * - `condition-met`: the condition held; this is the only affirmative one.
112
+ * - `never-held`: the condition timed out without holding.
113
+ */
114
+ readyReason: 'not-tracked' | 'pending' | 'condition-met' | 'never-held';
115
+ /**
116
+ * True when the grid is HELD: no viewer may change it, so a viewer whose
117
+ * window is a different shape scales its text and letterboxes rather than
118
+ * reflowing the session (§5). False is the ordinary case: the session's
119
+ * grid follows whichever viewport is driving it.
120
+ */
121
+ geometryHeld: boolean;
122
+ exited: boolean;
123
+ exitCode: number | null;
124
+ /** Number of connected viewer/WebSocket clients. */
125
+ watchers: number;
126
+ createdAt: string;
127
+ }
128
+ /** Cursor position within the visible viewport. */
129
+ export interface CursorPosition {
130
+ x: number;
131
+ y: number;
132
+ }
133
+ /** The rendered screen, as returned by `terminal_snapshot` and `terminal_wait`. */
134
+ export interface ScreenSnapshot {
135
+ id: string;
136
+ label: string;
137
+ cols: number;
138
+ rows: number;
139
+ cursor: CursorPosition;
140
+ exited: boolean;
141
+ exitCode: number | null;
142
+ /** Plain-text screen content, lines joined with `\n`, trailing blanks trimmed. */
143
+ screen: string;
144
+ }
145
+ /**
146
+ * A wait condition (design §3, `terminal_wait`). Exactly one of `text`, `regex`,
147
+ * `quiet` or `prompt` must be provided.
148
+ */
149
+ export interface WaitCondition {
150
+ /** Case-insensitive substring to await on the rendered screen. */
151
+ text?: string;
152
+ /** Case-insensitive regular expression (source string) to await. */
153
+ regex?: string;
154
+ /** Quiescence: resolve once no output has arrived for this many milliseconds. */
155
+ quiet?: number;
156
+ /**
157
+ * Resolve when the screen shows a permission prompt waiting on a human.
158
+ * The supervision condition: an agent supervising another agent CLI wants
159
+ * to be woken when that CLI needs an answer rather than poll snapshots
160
+ * hoping to catch one. Same heuristic the daemon's stall alerts use, so
161
+ * what this waits for and what `daemon.log` announces cannot drift apart.
162
+ */
163
+ prompt?: boolean;
164
+ }
165
+ export interface WaitOptions {
166
+ /** Overall timeout in ms. Defaults to 60,000, clamped to 300,000 (§3.1). */
167
+ timeout?: number;
168
+ /**
169
+ * For text, regex and prompt conditions: after the first match, keep
170
+ * polling until the screen has been stable for this many ms before resolving
171
+ * (0 = resolve immediately on match). Lets a mid-paint TUI settle before the
172
+ * screen is read.
173
+ */
174
+ debounce?: number;
175
+ /**
176
+ * Only count what comes AFTER the caller's last input.
177
+ *
178
+ * - text/regex, default false: ignore matches at or before the echo of the
179
+ * last input, so a pattern that describes the expected output cannot be
180
+ * satisfied by the prompt that asked for it. That closes the echo trap at
181
+ * the tool rather than restating it in prose.
182
+ * - prompt, default TRUE: the prompt that was showing when the last input
183
+ * was sent counts as answered until the screen has been seen without it;
184
+ * a supervisor never wants the question it has just answered handed back.
185
+ * Pass false to accept whatever prompt is on screen.
186
+ */
187
+ matchAfterInput?: boolean;
188
+ /**
189
+ * Stop waiting because nobody is listening any more. The daemon aborts a
190
+ * wait whose HTTP client has gone: the poll would otherwise run to its full
191
+ * timeout, taking a renderer snapshot every tick for an answer no one will
192
+ * read. Resolves `{ matched: false, reason: 'aborted' }` and clears the poll
193
+ * timer.
194
+ */
195
+ signal?: AbortSignal;
196
+ }
197
+ export type WaitReason = 'text' | 'regex' | 'quiet' | 'prompt' | 'exited' | 'timeout' | 'aborted';
198
+ export interface WaitResult {
199
+ matched: boolean;
200
+ reason: WaitReason;
201
+ waitedMs: number;
202
+ /** The rendered screen at the moment the wait resolved. */
203
+ screen: string;
204
+ /**
205
+ * The prompt that satisfied a `prompt` condition, with its question and
206
+ * options, so the caller can decide the answer without a second round trip
207
+ * to read the screen it already has. Absent for every other condition.
208
+ */
209
+ prompt?: DetectedPrompt;
210
+ /**
211
+ * Why the wait did NOT match, when the waiter can say more than the reason,
212
+ * e.g. quiet timed out because the program has not painted anything yet.
213
+ * The waiter's own words, never screen content. Absent on a match.
214
+ */
215
+ detail?: string;
216
+ }
217
+ export type PolicyMode = 'allow-all' | 'allowlist' | 'denylist';
218
+ /** Command policy configuration (design §4.3): `policy` in `config.json`. */
219
+ export interface PolicyConfig {
220
+ mode: PolicyMode;
221
+ /** Regex sources matched against the pre-wrap command line (allowlist mode). */
222
+ allow?: string[];
223
+ /** Regex sources matched against the pre-wrap command line. */
224
+ deny?: string[];
225
+ /** Maximum concurrent live sessions. No limit when unset. */
226
+ maxSessions?: number;
227
+ /**
228
+ * Set ONLY by the daemon's config validation (never by users) when the
229
+ * policy section was structurally invalid: it compiles to a policy that
230
+ * refuses every command with this reason. A policy that cannot be evaluated
231
+ * as written must not be guessed at.
232
+ */
233
+ configError?: string;
234
+ }
235
+ export interface PolicyDecision {
236
+ allowed: boolean;
237
+ /** Human-readable explanation, present whenever the command is refused. */
238
+ reason?: string;
239
+ /** The rule (regex source) that decided the outcome, where one did. */
240
+ rule?: string;
241
+ }
242
+ /**
243
+ * Session environment hygiene (design §4.6, ADR-008). The daemon's own
244
+ * environment is whatever the first client that auto-started it had. `clean`,
245
+ * the default, passes a minimal functional set; an array passes that set plus
246
+ * the named variables; `passthrough` hands all of the daemon's environment
247
+ * (possibly including API keys) to every session, and has to be chosen by name.
248
+ * `TERM`/`COLORTERM` are always injected regardless.
249
+ */
250
+ export type SessionEnvMode = 'passthrough' | 'clean' | string[];
251
+ /**
252
+ * A variable name a session's own environment may carry (`SessionOptions.env`)
253
+ * and `mcp.passEnv` may list: letters, digits and underscores, not starting
254
+ * with a digit. That is every name an API key or setting is given in
255
+ * practice, and it keeps out names that a shell or an environment block would
256
+ * read some other way. `__proto__` is refused too: an ordinary object would
257
+ * swallow it rather than store it, and the variable would silently not pass.
258
+ */
259
+ export declare const ENV_NAME_PATTERN: RegExp;
260
+ /** The grid a session starts with when the caller names none. */
261
+ export declare const DEFAULT_COLS = 120;
262
+ export declare const DEFAULT_ROWS = 34;
263
+ /** Scrollback depth for the headless renderer and the viewer (design §5). */
264
+ export declare const DEFAULT_SCROLLBACK = 5000;
265
+ /**
266
+ * Wait timeout defaults (design §3.1): some agent CLIs take tens of seconds to
267
+ * first paint and emit nothing meanwhile, so the default is deliberately generous.
268
+ */
269
+ export declare const DEFAULT_WAIT_TIMEOUT_MS = 60000;
270
+ export declare const MAX_WAIT_TIMEOUT_MS = 300000;
271
+ export declare const WAIT_POLL_INTERVAL_MS = 80;
272
+ /**
273
+ * How long any one evaluation of a caller's regular expression may take
274
+ * (`regexBudget.ts`). A screen is a few thousand characters, so a sane pattern
275
+ * finishes in microseconds; this is the point at which a pattern is assumed to
276
+ * be backtracking rather than searching. It applies per evaluation for a wait
277
+ * (up to two a poll with matchAfterInput), once to a whole find and once per
278
+ * rule for a policy decision, so a policy with several rules may take several
279
+ * budgets to decide.
280
+ */
281
+ export declare const REGEX_BUDGET_MS = 250;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Shared domain types and defaults for ShellPuppet.
3
+ *
4
+ * Everything here is pure data, with no I/O and no Node APIs. The design document
5
+ * (`docs/architecture/design.md`) is the source of truth for the shapes below;
6
+ * section references are given where a type encodes a specific decision.
7
+ */
8
+ /** A logger that discards everything: the safe default where none is injected. */
9
+ export const NULL_LOGGER = {
10
+ debug: () => undefined,
11
+ info: () => undefined,
12
+ warn: () => undefined,
13
+ error: () => undefined,
14
+ };
15
+ /**
16
+ * A variable name a session's own environment may carry (`SessionOptions.env`)
17
+ * and `mcp.passEnv` may list: letters, digits and underscores, not starting
18
+ * with a digit. That is every name an API key or setting is given in
19
+ * practice, and it keeps out names that a shell or an environment block would
20
+ * read some other way. `__proto__` is refused too: an ordinary object would
21
+ * swallow it rather than store it, and the variable would silently not pass.
22
+ */
23
+ export const ENV_NAME_PATTERN = /^(?!__proto__$)[A-Za-z_][A-Za-z0-9_]*$/;
24
+ // ----------------------------------------------------------------------- defaults
25
+ /** The grid a session starts with when the caller names none. */
26
+ export const DEFAULT_COLS = 120;
27
+ export const DEFAULT_ROWS = 34;
28
+ /** Scrollback depth for the headless renderer and the viewer (design §5). */
29
+ export const DEFAULT_SCROLLBACK = 5000;
30
+ /**
31
+ * Wait timeout defaults (design §3.1): some agent CLIs take tens of seconds to
32
+ * first paint and emit nothing meanwhile, so the default is deliberately generous.
33
+ */
34
+ export const DEFAULT_WAIT_TIMEOUT_MS = 60_000;
35
+ export const MAX_WAIT_TIMEOUT_MS = 300_000;
36
+ export const WAIT_POLL_INTERVAL_MS = 80;
37
+ /**
38
+ * How long any one evaluation of a caller's regular expression may take
39
+ * (`regexBudget.ts`). A screen is a few thousand characters, so a sane pattern
40
+ * finishes in microseconds; this is the point at which a pattern is assumed to
41
+ * be backtracking rather than searching. It applies per evaluation for a wait
42
+ * (up to two a poll with matchAfterInput), once to a whole find and once per
43
+ * rule for a policy decision, so a policy with several rules may take several
44
+ * budgets to decide.
45
+ */
46
+ export const REGEX_BUDGET_MS = 250;
47
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAoBH,kFAAkF;AAClF,MAAM,CAAC,MAAM,WAAW,GAAW;IACjC,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;IACtB,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;IACrB,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;IACrB,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS;CACvB,CAAC;AA+PF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,wCAAwC,CAAC;AAEzE,mFAAmF;AAEnF,iEAAiE;AACjE,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAC;AAChC,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B,6EAA6E;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEvC;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAC9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAC3C,MAAM,CAAC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAExC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Wait predicates: block until a condition holds on a live screen.
3
+ *
4
+ * The single most important primitive for reliable terminal automation: stop
5
+ * guessing at sleeps (design §3.1). Supports text, regex and quiescence
6
+ * conditions, terminated by process exit or timeout.
7
+ *
8
+ * Pure logic over an abstract target. No I/O; timers only. The daemon adapts a
9
+ * session to `WaitTarget`.
10
+ */
11
+ import type { WaitCondition, WaitOptions, WaitResult } from './types.js';
12
+ /**
13
+ * What the waiter needs to observe, and what it reports back. Implemented by
14
+ * the daemon's session.
15
+ */
16
+ export interface WaitTarget {
17
+ /** Current rendered screen (viewport) as plain text. */
18
+ getScreen(): string;
19
+ /** Epoch ms of the most recent output. Session creation seeds this value. */
20
+ lastChangeAt(): number;
21
+ isExited(): boolean;
22
+ /**
23
+ * True once the rendered screen has shown anything at all. Bytes alone are
24
+ * not paint: ConPTY emits mode-set sequences (`ESC[?9001h ESC[?1004h`)
25
+ * ~140 ms after spawn, before the program has written a thing, and those
26
+ * render nothing. Measured on Windows 11.
27
+ */
28
+ hasPainted(): boolean;
29
+ /** The most recent input written to the program, verbatim; null before any. */
30
+ lastInput(): string | null;
31
+ /**
32
+ * Report the detected prompt's signature from a look at the screen, or null
33
+ * for none, so `isStalePrompt` can tell an answered prompt from a live one
34
+ * (see `StalePromptGuard`).
35
+ */
36
+ observePrompt(signature: string | null): void;
37
+ /** True while `signature` is the prompt the last input answered, not yet seen to go. */
38
+ isStalePrompt(signature: string): boolean;
39
+ }
40
+ export interface WaiterInternals {
41
+ /** Poll interval override, for tests only. */
42
+ pollIntervalMs?: number;
43
+ }
44
+ /** Thrown for caller mistakes: bad condition shape or an unparsable regex. */
45
+ export declare class WaitConditionError extends Error {
46
+ constructor(message: string);
47
+ }
48
+ /**
49
+ * Resolve when the condition holds, the process exits or the timeout lapses.
50
+ * Never rejects for runtime reasons: the result's `matched`/`reason` carry the
51
+ * outcome, because "it timed out" is an answer, not an error. It rejects only
52
+ * for the caller's own mistakes: a malformed condition, which throws
53
+ * synchronously, and a pattern that overruns its evaluation budget, which
54
+ * cannot be known until it is run and so rejects (`regexBudget.ts`). Both are
55
+ * `WaitConditionError`, which the daemon answers with a 400.
56
+ *
57
+ * Semantics worth knowing:
58
+ * - `text` is a case-insensitive substring match; `regex` is case-insensitive.
59
+ * - **The echo trap:** matching text you have just typed matches the *echo* of
60
+ * the input (measured at 0 ms), not the program's output. By default the
61
+ * waiter does not tell them apart, so wait on output-only text or use
62
+ * `quiet`. `matchAfterInput: true` closes the trap: matches at or before the
63
+ * echo of the last input are ignored (see `echo.ts` for how the echo is
64
+ * placed, and when it cannot be). Both behaviours are tested.
65
+ * - `quiet` holds once the program has PAINTED something and then produced no
66
+ * output for the given time. A program that has never painted is not quiet,
67
+ * it is not started: silence counted from session creation would report a
68
+ * CLI ready before its first byte, and a prompt typed on that false ready
69
+ * would be discarded. A test pins this.
70
+ * - `debounce` (text/regex/prompt): after the first match, keep polling until
71
+ * the screen has been stable for that long, so a mid-paint TUI can settle.
72
+ * The match is not re-checked after settling: it appeared, which is what
73
+ * was asked. The overall timeout still applies while settling.
74
+ * - `prompt` resolves as soon as a permission prompt is on screen, INCLUDING
75
+ * one already there when the wait began. It means "wait until a prompt is
76
+ * showing", not "wait for the next one". There is one exception, on by
77
+ * default: the prompt that was showing when the caller's last input was
78
+ * sent is treated as answered until the screen has been seen without it
79
+ * (`StalePromptGuard`). A supervision loop that has just answered one
80
+ * prompt gets the NEXT one, never the one it answered on a screen
81
+ * the program has not yet repainted. `matchAfterInput: false` restores the
82
+ * plain rule.
83
+ * - Match is checked before exit: an exited process whose final screen contains
84
+ * the target still reports the match.
85
+ */
86
+ export declare function waitFor(target: WaitTarget, condition: WaitCondition, options?: WaitOptions & WaiterInternals): Promise<WaitResult>;