indusagi-coding-agent 0.2.3 → 0.2.5

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 (260) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE +661 -0
  3. package/README.md +95 -1
  4. package/dist/entry.js +3205 -1585
  5. package/dist/guardrails.js +47 -515
  6. package/dist/index.js +3232 -1671
  7. package/package.json +8 -7
  8. package/dist/types/addons/addons.test.d.ts +0 -21
  9. package/dist/types/addons/contract.d.ts +0 -640
  10. package/dist/types/addons/dispatch/event-dispatcher.d.ts +0 -140
  11. package/dist/types/addons/dispatch/index.d.ts +0 -23
  12. package/dist/types/addons/dispatch/tool-interceptor.d.ts +0 -128
  13. package/dist/types/addons/host.d.ts +0 -246
  14. package/dist/types/addons/index.d.ts +0 -51
  15. package/dist/types/addons/manifest.d.ts +0 -56
  16. package/dist/types/addons/sandbox.d.ts +0 -103
  17. package/dist/types/addons/surface.d.ts +0 -42
  18. package/dist/types/boot/auth-vault.d.ts +0 -29
  19. package/dist/types/boot/boot.d.ts +0 -26
  20. package/dist/types/boot/boot.test.d.ts +0 -15
  21. package/dist/types/boot/contract.d.ts +0 -236
  22. package/dist/types/boot/index.d.ts +0 -20
  23. package/dist/types/boot/invocation.d.ts +0 -40
  24. package/dist/types/boot/invocation.test.d.ts +0 -8
  25. package/dist/types/boot/runners/addon-wiring.d.ts +0 -103
  26. package/dist/types/boot/runners/addon-wiring.test.d.ts +0 -19
  27. package/dist/types/boot/runners/checkpoint.d.ts +0 -133
  28. package/dist/types/boot/runners/checkpoint.test.d.ts +0 -12
  29. package/dist/types/boot/runners/delegate-runner.d.ts +0 -89
  30. package/dist/types/boot/runners/delegate-runner.test.d.ts +0 -13
  31. package/dist/types/boot/runners/index.d.ts +0 -13
  32. package/dist/types/boot/runners/link-runner.d.ts +0 -20
  33. package/dist/types/boot/runners/memdir.d.ts +0 -103
  34. package/dist/types/boot/runners/memdir.test.d.ts +0 -12
  35. package/dist/types/boot/runners/oneshot-runner.d.ts +0 -19
  36. package/dist/types/boot/runners/read-state.d.ts +0 -82
  37. package/dist/types/boot/runners/read-state.test.d.ts +0 -10
  38. package/dist/types/boot/runners/registry.d.ts +0 -30
  39. package/dist/types/boot/runners/repl-runner.d.ts +0 -19
  40. package/dist/types/boot/runners/session-persist.test.d.ts +0 -10
  41. package/dist/types/boot/runners/session.d.ts +0 -65
  42. package/dist/types/boot/runners/session.test.d.ts +0 -10
  43. package/dist/types/boot/stages.d.ts +0 -92
  44. package/dist/types/boot/upgrade/apply.d.ts +0 -45
  45. package/dist/types/boot/upgrade/index.d.ts +0 -13
  46. package/dist/types/boot/upgrade/upgrades.d.ts +0 -126
  47. package/dist/types/briefing/briefing.test.d.ts +0 -15
  48. package/dist/types/briefing/compose.d.ts +0 -37
  49. package/dist/types/briefing/context-docs.d.ts +0 -38
  50. package/dist/types/briefing/context-docs.test.d.ts +0 -18
  51. package/dist/types/briefing/contract.d.ts +0 -686
  52. package/dist/types/briefing/index.d.ts +0 -29
  53. package/dist/types/briefing/macros.d.ts +0 -206
  54. package/dist/types/briefing/skills.d.ts +0 -67
  55. package/dist/types/capability-deck/bridge-ledger/index.d.ts +0 -25
  56. package/dist/types/capability-deck/bridge-ledger/key.d.ts +0 -65
  57. package/dist/types/capability-deck/bridge-ledger/ledger.d.ts +0 -129
  58. package/dist/types/capability-deck/bridge-ledger/network.d.ts +0 -115
  59. package/dist/types/capability-deck/builtin-bridge.d.ts +0 -114
  60. package/dist/types/capability-deck/capability-deck.test.d.ts +0 -18
  61. package/dist/types/capability-deck/cards/bg-process-card.d.ts +0 -99
  62. package/dist/types/capability-deck/cards/index.d.ts +0 -37
  63. package/dist/types/capability-deck/cards/memory-card.d.ts +0 -68
  64. package/dist/types/capability-deck/cards/plan-file.d.ts +0 -56
  65. package/dist/types/capability-deck/cards/plan-tools.d.ts +0 -97
  66. package/dist/types/capability-deck/cards/plan-tools.test.d.ts +0 -9
  67. package/dist/types/capability-deck/cards/saas-card.d.ts +0 -78
  68. package/dist/types/capability-deck/cards/task-card.d.ts +0 -106
  69. package/dist/types/capability-deck/cards/todo-card.d.ts +0 -78
  70. package/dist/types/capability-deck/cards/workflow-card.d.ts +0 -55
  71. package/dist/types/capability-deck/cards/workflow-card.test.d.ts +0 -12
  72. package/dist/types/capability-deck/checkpoint.int.test.d.ts +0 -25
  73. package/dist/types/capability-deck/contract.d.ts +0 -317
  74. package/dist/types/capability-deck/index.d.ts +0 -46
  75. package/dist/types/capability-deck/manifest.d.ts +0 -60
  76. package/dist/types/capability-deck/provision.d.ts +0 -76
  77. package/dist/types/capability-deck/read-edit-gate.int.test.d.ts +0 -21
  78. package/dist/types/channels/channels.test.d.ts +0 -15
  79. package/dist/types/channels/contract.d.ts +0 -489
  80. package/dist/types/channels/framer.d.ts +0 -49
  81. package/dist/types/channels/index.d.ts +0 -24
  82. package/dist/types/channels/link/dialog.d.ts +0 -138
  83. package/dist/types/channels/link/driver.d.ts +0 -81
  84. package/dist/types/channels/link/index.d.ts +0 -13
  85. package/dist/types/channels/link/server.d.ts +0 -70
  86. package/dist/types/channels/oneshot.d.ts +0 -37
  87. package/dist/types/channels/ops.d.ts +0 -89
  88. package/dist/types/channels/session-ops.d.ts +0 -80
  89. package/dist/types/conductor/bash-guard.d.ts +0 -106
  90. package/dist/types/conductor/bash-guard.test.d.ts +0 -17
  91. package/dist/types/conductor/catalog/catalog.d.ts +0 -87
  92. package/dist/types/conductor/catalog/index.d.ts +0 -14
  93. package/dist/types/conductor/catalog/matcher.d.ts +0 -47
  94. package/dist/types/conductor/conductor.d.ts +0 -189
  95. package/dist/types/conductor/conductor.test.d.ts +0 -10
  96. package/dist/types/conductor/contract.d.ts +0 -774
  97. package/dist/types/conductor/diagnostics.d.ts +0 -183
  98. package/dist/types/conductor/diagnostics.test.d.ts +0 -10
  99. package/dist/types/conductor/index.d.ts +0 -26
  100. package/dist/types/conductor/permission-gate.integration.test.d.ts +0 -22
  101. package/dist/types/conductor/permission-wiring.test.d.ts +0 -14
  102. package/dist/types/conductor/permissions.d.ts +0 -217
  103. package/dist/types/conductor/permissions.test.d.ts +0 -12
  104. package/dist/types/conductor/plan-mode.integration.test.d.ts +0 -23
  105. package/dist/types/conductor/post-edit-diagnostics.test.d.ts +0 -13
  106. package/dist/types/conductor/signal-hub/hub.d.ts +0 -83
  107. package/dist/types/conductor/signal-hub/index.d.ts +0 -19
  108. package/dist/types/conductor/signal-hub/translate.d.ts +0 -77
  109. package/dist/types/conductor/skill-parse/index.d.ts +0 -10
  110. package/dist/types/conductor/skill-parse/parse.d.ts +0 -67
  111. package/dist/types/conductor/submit.test.d.ts +0 -28
  112. package/dist/types/conductor/transcript-store/index.d.ts +0 -16
  113. package/dist/types/conductor/transcript-store/serialize.d.ts +0 -106
  114. package/dist/types/conductor/transcript-store/serialize.test.d.ts +0 -10
  115. package/dist/types/conductor/transcript-store/store.d.ts +0 -188
  116. package/dist/types/console/components/AgentsView.d.ts +0 -41
  117. package/dist/types/console/components/BackgroundAgents.d.ts +0 -63
  118. package/dist/types/console/components/BackgroundAgents.test.d.ts +0 -8
  119. package/dist/types/console/components/Banner.d.ts +0 -110
  120. package/dist/types/console/components/Composer.d.ts +0 -37
  121. package/dist/types/console/components/StatusBar.d.ts +0 -42
  122. package/dist/types/console/components/TerminalConsole.d.ts +0 -32
  123. package/dist/types/console/components/WorkingIndicator.d.ts +0 -44
  124. package/dist/types/console/components/WorkingIndicator.test.d.ts +0 -9
  125. package/dist/types/console/components/banner-sweep.d.ts +0 -55
  126. package/dist/types/console/components/banner.test.d.ts +0 -9
  127. package/dist/types/console/components/welcome.d.ts +0 -115
  128. package/dist/types/console/components/welcome.test.d.ts +0 -9
  129. package/dist/types/console/console.test.d.ts +0 -19
  130. package/dist/types/console/contract.d.ts +0 -598
  131. package/dist/types/console/index.d.ts +0 -34
  132. package/dist/types/console/input/complete.d.ts +0 -120
  133. package/dist/types/console/input/dir-reader.d.ts +0 -28
  134. package/dist/types/console/input/index.d.ts +0 -24
  135. package/dist/types/console/input/input.test.d.ts +0 -14
  136. package/dist/types/console/input/keymap.d.ts +0 -193
  137. package/dist/types/console/input/paste.d.ts +0 -131
  138. package/dist/types/console/mount.d.ts +0 -53
  139. package/dist/types/console/overlays/approval-queue.d.ts +0 -71
  140. package/dist/types/console/overlays/approval.d.ts +0 -104
  141. package/dist/types/console/overlays/approval.test.d.ts +0 -17
  142. package/dist/types/console/overlays/auth.d.ts +0 -31
  143. package/dist/types/console/overlays/boards.d.ts +0 -55
  144. package/dist/types/console/overlays/host.d.ts +0 -45
  145. package/dist/types/console/overlays/index.d.ts +0 -15
  146. package/dist/types/console/overlays/pickers.d.ts +0 -37
  147. package/dist/types/console/overlays/sessions.d.ts +0 -29
  148. package/dist/types/console/reducer.d.ts +0 -51
  149. package/dist/types/console/slash/builtins.d.ts +0 -33
  150. package/dist/types/console/slash/commands/dynamic.d.ts +0 -57
  151. package/dist/types/console/slash/commands/dynamic.test.d.ts +0 -9
  152. package/dist/types/console/slash/commands/integrations.d.ts +0 -28
  153. package/dist/types/console/slash/commands/integrations.test.d.ts +0 -18
  154. package/dist/types/console/slash/commands/shared.d.ts +0 -72
  155. package/dist/types/console/slash/commands/transcript.d.ts +0 -24
  156. package/dist/types/console/slash/commands/transcript.test.d.ts +0 -10
  157. package/dist/types/console/slash/commands/workbench.d.ts +0 -21
  158. package/dist/types/console/slash/commands/workbench.test.d.ts +0 -10
  159. package/dist/types/console/slash/index.d.ts +0 -34
  160. package/dist/types/console/slash/registry.d.ts +0 -90
  161. package/dist/types/console/slash/resolve.d.ts +0 -109
  162. package/dist/types/console/slash/slash.test.d.ts +0 -18
  163. package/dist/types/console/startup.d.ts +0 -119
  164. package/dist/types/console/theme/adapter.d.ts +0 -79
  165. package/dist/types/console/theme/index.d.ts +0 -18
  166. package/dist/types/console/theme/palette.d.ts +0 -77
  167. package/dist/types/console/theme/resolve.d.ts +0 -45
  168. package/dist/types/console/theme/theme.test.d.ts +0 -16
  169. package/dist/types/console/theme/tokens.d.ts +0 -62
  170. package/dist/types/entry.d.ts +0 -17
  171. package/dist/types/guardrails.d.ts +0 -33
  172. package/dist/types/index.d.ts +0 -24
  173. package/dist/types/insight/channel.d.ts +0 -45
  174. package/dist/types/insight/contract.d.ts +0 -411
  175. package/dist/types/insight/index.d.ts +0 -26
  176. package/dist/types/insight/insight.test.d.ts +0 -17
  177. package/dist/types/insight/recorder.d.ts +0 -63
  178. package/dist/types/insight/redaction.d.ts +0 -44
  179. package/dist/types/insight/replay.d.ts +0 -77
  180. package/dist/types/insight/sampling.d.ts +0 -84
  181. package/dist/types/insight/serialize.d.ts +0 -54
  182. package/dist/types/insight/sinks/console.d.ts +0 -36
  183. package/dist/types/insight/sinks/file.d.ts +0 -37
  184. package/dist/types/insight/sinks/index.d.ts +0 -16
  185. package/dist/types/insight/sinks/stream.d.ts +0 -53
  186. package/dist/types/kit/clipboard-image.d.ts +0 -40
  187. package/dist/types/kit/external-editor.d.ts +0 -35
  188. package/dist/types/kit/image.d.ts +0 -102
  189. package/dist/types/kit/index.d.ts +0 -29
  190. package/dist/types/kit/kit.test.d.ts +0 -13
  191. package/dist/types/kit/shell.d.ts +0 -50
  192. package/dist/types/kit/tool-fetch.d.ts +0 -165
  193. package/dist/types/launch/catalog.d.ts +0 -51
  194. package/dist/types/launch/contract.d.ts +0 -387
  195. package/dist/types/launch/credentials.d.ts +0 -112
  196. package/dist/types/launch/index.d.ts +0 -28
  197. package/dist/types/launch/invocation/attachments.d.ts +0 -72
  198. package/dist/types/launch/invocation/flags.d.ts +0 -59
  199. package/dist/types/launch/invocation/index.d.ts +0 -23
  200. package/dist/types/launch/invocation/read.d.ts +0 -52
  201. package/dist/types/launch/invocation/usage.d.ts +0 -25
  202. package/dist/types/launch/launch.test.d.ts +0 -20
  203. package/dist/types/launch/oauth.d.ts +0 -101
  204. package/dist/types/launch/packages.d.ts +0 -75
  205. package/dist/types/launch/packages.test.d.ts +0 -15
  206. package/dist/types/launch/pickers.d.ts +0 -97
  207. package/dist/types/runtime-bridge/bridges/_drive.d.ts +0 -74
  208. package/dist/types/runtime-bridge/bridges/builtins.d.ts +0 -77
  209. package/dist/types/runtime-bridge/bridges/claude-cli.d.ts +0 -37
  210. package/dist/types/runtime-bridge/bridges/codex-cli.d.ts +0 -27
  211. package/dist/types/runtime-bridge/bridges/index.d.ts +0 -15
  212. package/dist/types/runtime-bridge/bridges/indusagi-cli.d.ts +0 -36
  213. package/dist/types/runtime-bridge/broker.d.ts +0 -182
  214. package/dist/types/runtime-bridge/contract.d.ts +0 -436
  215. package/dist/types/runtime-bridge/index.d.ts +0 -21
  216. package/dist/types/runtime-bridge/runtime-bridge.test.d.ts +0 -17
  217. package/dist/types/runtime-bridge/sink.d.ts +0 -59
  218. package/dist/types/sessions/contract.d.ts +0 -79
  219. package/dist/types/sessions/index.d.ts +0 -11
  220. package/dist/types/sessions/library.d.ts +0 -95
  221. package/dist/types/sessions/sessions.test.d.ts +0 -11
  222. package/dist/types/settings/contract.d.ts +0 -175
  223. package/dist/types/settings/index.d.ts +0 -13
  224. package/dist/types/settings/manager.d.ts +0 -109
  225. package/dist/types/settings/settings.test.d.ts +0 -16
  226. package/dist/types/transcript-export/index.d.ts +0 -20
  227. package/dist/types/transcript-export/publish.d.ts +0 -81
  228. package/dist/types/transcript-export/sgr.d.ts +0 -90
  229. package/dist/types/transcript-export/template.d.ts +0 -64
  230. package/dist/types/transcript-export/theme-bridge.d.ts +0 -99
  231. package/dist/types/transcript-export/transcript-export.test.d.ts +0 -16
  232. package/dist/types/window-budget/budget/estimate.d.ts +0 -47
  233. package/dist/types/window-budget/budget/gate.d.ts +0 -37
  234. package/dist/types/window-budget/budget/index.d.ts +0 -14
  235. package/dist/types/window-budget/budget/slice.d.ts +0 -38
  236. package/dist/types/window-budget/condenser.d.ts +0 -73
  237. package/dist/types/window-budget/contract.d.ts +0 -182
  238. package/dist/types/window-budget/index.d.ts +0 -17
  239. package/dist/types/window-budget/microcompact.d.ts +0 -68
  240. package/dist/types/window-budget/microcompact.test.d.ts +0 -16
  241. package/dist/types/window-budget/rehydrate.d.ts +0 -56
  242. package/dist/types/window-budget/summarize/condense.d.ts +0 -70
  243. package/dist/types/window-budget/summarize/index.d.ts +0 -12
  244. package/dist/types/window-budget/summarize/prompt.d.ts +0 -56
  245. package/dist/types/window-budget/window-budget.test.d.ts +0 -18
  246. package/dist/types/workflow-engine/agent-runner.d.ts +0 -105
  247. package/dist/types/workflow-engine/agent-runner.test.d.ts +0 -8
  248. package/dist/types/workflow-engine/display.d.ts +0 -148
  249. package/dist/types/workflow-engine/display.test.d.ts +0 -1
  250. package/dist/types/workflow-engine/engine.d.ts +0 -183
  251. package/dist/types/workflow-engine/engine.test.d.ts +0 -1
  252. package/dist/types/workflow-engine/index.d.ts +0 -21
  253. package/dist/types/workflow-engine/parse.d.ts +0 -64
  254. package/dist/types/workflow-engine/parse.test.d.ts +0 -1
  255. package/dist/types/workflow-engine/structured-output.d.ts +0 -51
  256. package/dist/types/workflow-engine/structured-output.test.d.ts +0 -1
  257. package/dist/types/workspace/brand.d.ts +0 -26
  258. package/dist/types/workspace/index.d.ts +0 -11
  259. package/dist/types/workspace/locator.d.ts +0 -50
  260. package/dist/types/workspace/runtime-detect.d.ts +0 -56
@@ -1,120 +0,0 @@
1
- /**
2
- * Completion source — structured suggestions for the composer's prompt line.
3
- *
4
- * As the user types, the composer can offer two kinds of completion:
5
- *
6
- * 1. **Slash commands** — when the buffer begins with `/`, the leading token is
7
- * matched (prefix, case-insensitive) against the {@link SlashRegistry}, and
8
- * every command whose name or alias starts with the typed stem is offered.
9
- * 2. **File paths** — when the active token begins with `@` (an attachment
10
- * reference) or looks like a path stem, the trailing path component is
11
- * completed against a directory listing.
12
- *
13
- * Both branches resolve to the same {@link Suggestion} shape so the surface's
14
- * completion window renders and applies them uniformly. The whole module is
15
- * pure: the slash branch reads the registry (plain data), and the path branch
16
- * takes an injected {@link DirReader} rather than calling `fs` itself, so the
17
- * suggestion logic is unit-tested with a synthetic filesystem and no I/O.
18
- *
19
- * The entry point is {@link completeAt}: given the buffer, the caret offset, and
20
- * the registry + dir-reader sources, it returns a {@link CompletionResult} —
21
- * the active token's span (so the surface knows what to replace), the suggestion
22
- * list, and the completion `kind`. {@link applySuggestion} then splices a chosen
23
- * suggestion back into the buffer, returning the new buffer and caret.
24
- */
25
- import type { SlashRegistry } from "../contract";
26
- /** Which source produced a batch of suggestions. */
27
- export type CompletionKind = "slash" | "path" | "none";
28
- /**
29
- * One structured completion candidate.
30
- *
31
- * `value` is the text the surface splices in when this suggestion is accepted
32
- * (already including any leading sigil — `/` for a command, `@`/trailing slash
33
- * for a path). `label` is what the completion window shows; `detail` is the
34
- * one-line description (a command summary, or a `dir`/`file` hint). `isDir`
35
- * marks a directory so the surface can keep the window open for further descent.
36
- */
37
- export interface Suggestion {
38
- /** The text spliced into the buffer when accepted. */
39
- readonly value: string;
40
- /** The primary text shown in the completion window. */
41
- readonly label: string;
42
- /** A one-line description shown beside the label. */
43
- readonly detail: string;
44
- /** Whether this path suggestion is a directory (false for slash commands). */
45
- readonly isDir: boolean;
46
- }
47
- /**
48
- * The half-open `[start, end)` span of the buffer the active token occupies.
49
- *
50
- * The surface replaces exactly this span when a suggestion is applied, so the
51
- * sigil and any preceding text are preserved.
52
- */
53
- export interface TokenSpan {
54
- /** Inclusive start offset of the active token. */
55
- readonly start: number;
56
- /** Exclusive end offset of the active token. */
57
- readonly end: number;
58
- }
59
- /**
60
- * The full result of asking for completion at a caret position.
61
- *
62
- * `kind` reports which source answered (`none` when nothing applies), `span` is
63
- * the token to replace, and `suggestions` is the ranked candidate list (empty
64
- * when nothing matched).
65
- */
66
- export interface CompletionResult {
67
- /** Which source produced the suggestions. */
68
- readonly kind: CompletionKind;
69
- /** The buffer span the active token occupies. */
70
- readonly span: TokenSpan;
71
- /** The ranked candidate list (possibly empty). */
72
- readonly suggestions: readonly Suggestion[];
73
- }
74
- /** A pure directory listing: each name is a leaf, flagged dir-or-file. */
75
- export interface DirEntry {
76
- /** The leaf name (no path separators). */
77
- readonly name: string;
78
- /** Whether the entry is a directory. */
79
- readonly isDir: boolean;
80
- }
81
- /**
82
- * An injected directory reader so the path branch stays pure and testable.
83
- *
84
- * Given a directory path (relative to the working dir), it returns that
85
- * directory's immediate entries, or an empty list when the path does not exist
86
- * or cannot be read. The live console binds this to a real `fs.readdir`; tests
87
- * bind it to a synthetic tree.
88
- */
89
- export type DirReader = (dirPath: string) => readonly DirEntry[];
90
- /**
91
- * Compute the completion offering at a caret position.
92
- *
93
- * Routes on the active token's stem: a `/` at buffer-start yields slash
94
- * completion; a `@`/path-like stem yields path completion; anything else yields
95
- * the inert {@link CompletionKind} `none`. Pure with respect to both sources —
96
- * the registry is data and the dir-reader is injected — so the entire decision
97
- * is unit-testable.
98
- *
99
- * @param buffer the composer text
100
- * @param caret the caret offset within the buffer
101
- * @param registry the slash-command registry to match against
102
- * @param readDir the directory reader the path branch lists through
103
- */
104
- export declare function completeAt(buffer: string, caret: number, registry: SlashRegistry, readDir: DirReader): CompletionResult;
105
- /**
106
- * Splice an accepted suggestion back into the buffer.
107
- *
108
- * Pure: replaces the active token's span with the suggestion's `value` and
109
- * returns the rewritten buffer plus the caret placed at the end of the inserted
110
- * value. The surface re-runs {@link completeAt} afterward so descending into a
111
- * directory (whose value ends in `/`) immediately offers the next level.
112
- *
113
- * @param buffer the composer text the completion was computed against
114
- * @param span the token span returned by {@link completeAt}
115
- * @param suggestion the candidate the user accepted
116
- */
117
- export declare function applySuggestion(buffer: string, span: TokenSpan, suggestion: Suggestion): {
118
- buffer: string;
119
- caret: number;
120
- };
@@ -1,28 +0,0 @@
1
- /**
2
- * Directory reader — the live `fs`-backed implementation of {@link DirReader}.
3
- *
4
- * The completion engine ({@link completeAt}) is pure: its path branch lists a
5
- * directory through an injected {@link DirReader} rather than touching the disk
6
- * itself, so the suggestion logic stays unit-testable against a synthetic tree.
7
- * This module is the one place that binds that seam to a real filesystem.
8
- *
9
- * {@link createDirReader} returns a reader that resolves a (possibly relative)
10
- * directory path against a base directory — the session working directory by
11
- * default — and lists its immediate entries as {@link DirEntry} records. Every
12
- * failure mode (a missing directory, a permission error, a path that names a
13
- * file) collapses to an empty list, so the composer never throws while the user
14
- * is mid-type. A symlink is classified by whether it ultimately resolves to a
15
- * directory, falling back to its own dirent flag when the target cannot be
16
- * stat-ed.
17
- */
18
- import type { DirReader } from "./complete";
19
- /**
20
- * Build a live {@link DirReader} rooted at `cwd`.
21
- *
22
- * The returned reader resolves each requested directory path against `cwd`
23
- * (an absolute request is used as-is), lists it, and maps each child to a
24
- * {@link DirEntry}. Any error returns `[]`.
25
- *
26
- * @param cwd the base directory relative requests resolve against
27
- */
28
- export declare function createDirReader(cwd?: string): DirReader;
@@ -1,24 +0,0 @@
1
- /**
2
- * Console input — public barrel for the pure composer-input modules.
3
- *
4
- * Three decoupled, Ink-free, fully-tested modules the surface's `useInput`
5
- * handler composes:
6
- *
7
- * - **keymap** — classify a raw `(input, key)` event into a console
8
- * {@link ConsoleIntent}, and fold double-tap chords with {@link advanceChord}.
9
- * - **paste** — collapse a large clipboard burst behind a {@link PasteVault}
10
- * marker ({@link coalescePaste}) and re-expand at submit ({@link expandMarkers}).
11
- * - **complete** — produce structured slash/path {@link Suggestion}s
12
- * ({@link completeAt}) and splice an accepted one back ({@link applySuggestion}).
13
- *
14
- * The surface owns the live values (the chord latch, the paste vault, the
15
- * highlighted-suggestion index) and the timers; every decision lives in these
16
- * pure functions.
17
- */
18
- export type { KeyChord, ConsoleVerb, ConsoleIntent, ChordOutcome, ChordLatch, ChordStep, } from "./keymap";
19
- export { NO_INTENT, readKey, NO_CHORD, advanceChord } from "./keymap";
20
- export type { PasteThresholds, PasteVault, PasteCapture, } from "./paste";
21
- export { PASTE_THRESHOLDS, PASTE_BURST_GAP_MS, EMPTY_PASTE_VAULT, pasteMarker, classifyPaste, coalescePaste, expandMarkers, hasMarkers, } from "./paste";
22
- export type { CompletionKind, Suggestion, TokenSpan, CompletionResult, DirEntry, DirReader, } from "./complete";
23
- export { completeAt, applySuggestion } from "./complete";
24
- export { createDirReader } from "./dir-reader";
@@ -1,14 +0,0 @@
1
- /**
2
- * Console input — pure-module unit tests (no Ink, no fs, no timers).
3
- *
4
- * Three concerns, exercised against plain data:
5
- * 1. keymap — {@link readKey} classifies modifier combos / named keys / text,
6
- * and {@link advanceChord} latches double-tap escape/clear chords.
7
- * 2. paste — {@link classifyPaste} thresholds, {@link coalescePaste} marker
8
- * minting into an immutable {@link PasteVault}, and {@link expandMarkers}
9
- * round-tripping the hidden body back at submit time.
10
- * 3. complete — {@link completeAt} routes slash vs path vs none, ranks
11
- * matches, and {@link applySuggestion} splices a choice back into the buffer
12
- * — the path branch driven by a synthetic {@link DirReader}.
13
- */
14
- export {};
@@ -1,193 +0,0 @@
1
- /**
2
- * Keymap — pure translation of raw terminal key events into console intents.
3
- *
4
- * The console's `useInput` handler is a thin shell: it forwards the `(input,
5
- * key)` pair Ink hands it straight into {@link readKey}, which classifies the
6
- * keystroke into one of the console's own {@link ConsoleIntent} verbs. All the
7
- * branching — modifier combos, arrow navigation, the chorded escape/clear
8
- * double-taps — lives here as a pure function over plain data, so it can be
9
- * unit-tested without mounting Ink and so the component never grows a tangle of
10
- * `if (key.ctrl && input === "u")` conditionals inline.
11
- *
12
- * The input shape is dictated by the framework hook: Ink's `useInput` invokes
13
- * its handler with `(input: string, key: Key)` where {@link KeyChord} mirrors
14
- * Ink's `Key` flag bag (arrows, return, escape, ctrl, shift, tab, backspace,
15
- * delete, meta, …). We re-declare the bag *structurally* here — a plain record
16
- * of booleans plus the literal text — so the keymap depends on a data shape,
17
- * not on importing the hook itself. The live handler passes Ink's `key` value
18
- * directly; it is assignable because the field names match.
19
- *
20
- * The output is the console's own intent vocabulary, NOT a mirror of any
21
- * upstream action enum. An intent is a small tagged record: a `verb` plus the
22
- * minimal payload the reducer/surface needs to act (the literal text for an
23
- * insert, the signed delta for a caret move). The surface maps each intent to a
24
- * {@link ConsoleEvent} dispatch or a host callback; the keymap itself performs
25
- * no effects.
26
- *
27
- * Chording (double-tap escape → tree, double-tap clear → exit) is *stateful*
28
- * across keystrokes, so it is kept out of the pure classifier: {@link readKey}
29
- * is memoryless, and {@link advanceChord} folds a prior {@link ChordLatch} plus
30
- * a fresh intent into the next latch, reporting whether a chord fired. The
31
- * surface owns the latch value and the timeout that expires it.
32
- */
33
- import type { ModalKind } from "../contract";
34
- /**
35
- * The boolean flag bag the framework input hook reports alongside the typed
36
- * text — re-declared structurally so this module owns no hook import.
37
- *
38
- * Every field is the framework's own naming for the corresponding physical key
39
- * or modifier. The live `useInput` handler passes its `key` argument straight
40
- * in; it satisfies this shape by field-name compatibility.
41
- */
42
- export interface KeyChord {
43
- readonly upArrow: boolean;
44
- readonly downArrow: boolean;
45
- readonly leftArrow: boolean;
46
- readonly rightArrow: boolean;
47
- readonly pageUp: boolean;
48
- readonly pageDown: boolean;
49
- readonly return: boolean;
50
- readonly escape: boolean;
51
- readonly ctrl: boolean;
52
- readonly shift: boolean;
53
- readonly tab: boolean;
54
- readonly backspace: boolean;
55
- readonly delete: boolean;
56
- readonly meta: boolean;
57
- }
58
- /**
59
- * The console's own keystroke-intent verbs.
60
- *
61
- * Deliberately *not* a mirror of any upstream keybinding enum: each verb names
62
- * what the console does, grouped by concern.
63
- *
64
- * Editing
65
- * - `text:type` — printable text to splice at the caret.
66
- * - `text:newline` — insert a hard line break (soft submit guard).
67
- * - `edit:erasePrev` — delete the grapheme before the caret.
68
- * - `edit:eraseNext` — delete the grapheme after the caret.
69
- * - `edit:clearLine` — wipe the whole composer buffer.
70
- *
71
- * Caret / navigation
72
- * - `nav:left` / `nav:right` — step the caret one column.
73
- * - `nav:home` / `nav:end` — jump to buffer start / end.
74
- * - `nav:up` / `nav:down` — recall older / newer history (or move in a list).
75
- *
76
- * Session control
77
- * - `flow:submit` — commit the buffer as a turn.
78
- * - `flow:dismiss` — escape: close an overlay / cancel completion.
79
- * - `flow:accept` — tab: accept the highlighted completion.
80
- * - `flow:interrupt` — abort an in-flight turn.
81
- * - `flow:suspend` — background the process (job control).
82
- * - `flow:cycleModel` — rotate to the next model.
83
- *
84
- * Model / reasoning
85
- * - `model:cycleThinking` — advance the reasoning-effort ladder one step (via /thinking command).
86
- *
87
- * Permission mode
88
- * - `mode:cyclePermission` — cycle through ALL permission modes (Shift+Tab),
89
- * advancing one step per press: default → acceptEdits → plan → bypass →
90
- * (wrap) default. In `plan` mode every mutating tool is blocked; in `bypass`
91
- * every tool is auto-allowed.
92
- * - `mode:togglePlan` — toggle read-only plan mode on/off. Drives `/plan`; no
93
- * longer bound to Shift+Tab (which now cycles all modes). In plan mode every
94
- * mutating tool is blocked at the permission gate.
95
- *
96
- * Queue
97
- * - `queue:dequeue` — pull the most recently queued input back into the
98
- * composer so it can be edited or dropped.
99
- *
100
- * Input sources
101
- * - `input:pasteImage` — stage an image off the OS clipboard and splice its
102
- * temp path into the buffer.
103
- * - `input:externalEditor` — hand the buffer to `$EDITOR` and read it back.
104
- *
105
- * Overlays
106
- * - `overlay:open` — raise a global overlay (settings / sessions /
107
- * model pickers) directly from a control chord, without typing a slash
108
- * command. The target overlay rides in {@link ConsoleIntent.overlay}.
109
- *
110
- * View toggles
111
- * - `view:expandTools` — flip whether collapsed tool output (bash / file /
112
- * grep / edit cards) is rendered in full or summarised.
113
- * - `view:toggleReasoning` — show/hide the assistant's thinking blocks live.
114
- *
115
- * Inert
116
- * - `none` — the keystroke carries no console meaning.
117
- */
118
- export type ConsoleVerb = "text:type" | "text:newline" | "edit:erasePrev" | "edit:eraseNext" | "edit:clearLine" | "nav:left" | "nav:right" | "nav:home" | "nav:end" | "nav:up" | "nav:down" | "flow:submit" | "flow:dismiss" | "flow:accept" | "flow:interrupt" | "flow:suspend" | "flow:cycleModel" | "model:cycleThinking" | "mode:cyclePermission" | "mode:togglePlan" | "queue:dequeue" | "input:pasteImage" | "input:externalEditor" | "overlay:open" | "view:expandTools" | "view:toggleReasoning" | "none";
119
- /**
120
- * A classified keystroke: a {@link ConsoleVerb} plus the small payload a verb
121
- * may carry — the literal text for a `text:type` insert, or the target overlay
122
- * for an `overlay:open`. Every other verb is self-contained, so both payload
123
- * fields are optional and present only on their owning verb.
124
- */
125
- export interface ConsoleIntent {
126
- /** What the keystroke means to the console. */
127
- readonly verb: ConsoleVerb;
128
- /** The literal text to splice, present only for `text:type`. */
129
- readonly text?: string;
130
- /** The overlay to raise, present only for `overlay:open`. */
131
- readonly overlay?: ModalKind;
132
- }
133
- /** The inert intent — a keystroke the console ignores. */
134
- export declare const NO_INTENT: ConsoleIntent;
135
- /**
136
- * Classify one raw key event into a single {@link ConsoleIntent}.
137
- *
138
- * Pure and memoryless: identical inputs always yield identical intents, and no
139
- * cross-keystroke state (chords, timeouts) is consulted — that is the surface's
140
- * job via {@link advanceChord}. Resolution order is deliberate: control combos
141
- * and named keys win over raw text, so a `Ctrl+U` never also types "u".
142
- *
143
- * @param input the literal text the hook reports (may be empty for a bare key)
144
- * @param key the framework flag bag describing the physical key + modifiers
145
- */
146
- export declare function readKey(input: string, key: KeyChord): ConsoleIntent;
147
- /**
148
- * Which verbs participate in a double-tap chord, and what the second tap fires.
149
- *
150
- * A first tap of `flow:dismiss` (escape) primes a chord; a second tap within
151
- * the surface's window fires `dismiss×2` (open the transcript tree). A first tap
152
- * of `edit:clearLine` (Ctrl+U on an already-empty buffer) primes a chord whose
153
- * second tap fires `clear×2` (request exit). Any other intent breaks the latch.
154
- */
155
- export type ChordOutcome = "dismiss×2" | "clear×2";
156
- /**
157
- * The cross-keystroke latch the surface carries between key events.
158
- *
159
- * `armed` is the verb a prior keystroke primed (or `null` when no chord is in
160
- * flight). The surface resets it to `null` when its timeout expires.
161
- */
162
- export interface ChordLatch {
163
- /** The verb a previous keystroke armed, or `null` when nothing is primed. */
164
- readonly armed: string | null;
165
- }
166
- /** A fresh, unarmed latch. */
167
- export declare const NO_CHORD: ChordLatch;
168
- /**
169
- * The result of folding a fresh intent into the prior chord latch.
170
- *
171
- * `next` is the latch to carry forward; `fired` is the chord outcome when this
172
- * keystroke completed a double-tap, otherwise `null`.
173
- */
174
- export interface ChordStep {
175
- /** The latch to carry into the next keystroke. */
176
- readonly next: ChordLatch;
177
- /** The chord that fired on this keystroke, or `null` if none did. */
178
- readonly fired: ChordOutcome | null;
179
- }
180
- /**
181
- * Fold a fresh {@link ConsoleIntent} into the prior {@link ChordLatch}.
182
- *
183
- * Pure: given the same latch and intent it always yields the same step. If the
184
- * incoming verb matches the armed verb and that verb is chord-eligible, the
185
- * chord fires and the latch resets. If the incoming verb is chord-eligible but
186
- * the latch was empty (or armed with a different verb), it arms. Any other
187
- * intent clears the latch. The timeout that expires a stale latch is the
188
- * surface's responsibility (it simply resets to {@link NO_CHORD}).
189
- *
190
- * @param latch the latch carried from the previous keystroke
191
- * @param intent the freshly classified intent for this keystroke
192
- */
193
- export declare function advanceChord(latch: ChordLatch, intent: ConsoleIntent): ChordStep;
@@ -1,131 +0,0 @@
1
- /**
2
- * Paste coalescing — collapse a large clipboard burst into one compact marker.
3
- *
4
- * A terminal in bracketed-paste mode delivers a multi-line paste to the input
5
- * hook as a single fat `input` string (or, on terminals without bracketing, as
6
- * a rapid burst of per-character events). Splicing thousands of characters into
7
- * the visible composer makes the editor unusable. The console instead replaces
8
- * a large paste with a short placeholder token — a {@link PasteMarker} — that
9
- * stands in for the hidden body, then re-expands every marker back to its
10
- * original text at submit time.
11
- *
12
- * This module is the pure machinery behind that:
13
- *
14
- * 1. {@link classifyPaste} — decide whether a chunk is "large" (worth hiding)
15
- * from its line/char extent, using {@link PASTE_THRESHOLDS}.
16
- * 2. {@link PasteVault} — an immutable store mapping each marker token to the
17
- * text it stands for, minted in submission order.
18
- * 3. {@link coalescePaste} — fold a large chunk into a vault, returning the
19
- * marker token to splice plus the grown vault.
20
- * 4. {@link expandMarkers} — at submit time, rewrite every marker token in the
21
- * buffer back to the stored body.
22
- *
23
- * All four are pure functions over plain data — no Ink, no refs, no timers — so
24
- * the whole paste pipeline is unit-tested in isolation. The component owns only
25
- * the live vault value and the burst-coalescing timer; the decisions are here.
26
- *
27
- * The marker format is the console's own: `[Pasted text #N +K lines]`, where `N` is the
28
- * 1-based mint order and `K` is the hidden line count. Matches induscode style:
29
- * visually distinct in the composer, unambiguous to match, and trivial to strip.
30
- */
31
- /**
32
- * The size at or above which a pasted chunk is hidden behind a marker.
33
- *
34
- * A chunk qualifies if it spans at least {@link lines} newlines *or* at least
35
- * {@link chars} characters — whichever trips first — so both a tall short paste
36
- * and a wide single-line paste are caught.
37
- */
38
- export interface PasteThresholds {
39
- /** Minimum newline count to treat a chunk as a large paste. */
40
- readonly lines: number;
41
- /** Minimum character count to treat a chunk as a large paste. */
42
- readonly chars: number;
43
- }
44
- /** The default cut-offs above which a paste is coalesced into a marker. */
45
- export declare const PASTE_THRESHOLDS: PasteThresholds;
46
- /**
47
- * The maximum gap, in milliseconds, between per-character events still treated
48
- * as one burst.
49
- *
50
- * On terminals that do not bracket pastes, the hook sees many tiny events in
51
- * quick succession; the surface accumulates them while consecutive events land
52
- * within this window, then classifies the assembled chunk once the gap exceeds
53
- * it. Exposed as data so the coalescing timer and any test share one value.
54
- */
55
- export declare const PASTE_BURST_GAP_MS = 24;
56
- /** The console's own placeholder format for a hidden paste body. */
57
- export declare function pasteMarker(ordinal: number, lineCount: number): string;
58
- /**
59
- * Decide whether a pasted chunk is large enough to hide behind a marker.
60
- *
61
- * Pure: a chunk is "large" when its newline count reaches the line threshold or
62
- * its length reaches the char threshold. Small chunks are spliced verbatim by
63
- * the caller; large ones are routed through {@link coalescePaste}.
64
- *
65
- * @param chunk the assembled paste text
66
- * @param thresholds the cut-offs to test against (defaults to {@link PASTE_THRESHOLDS})
67
- */
68
- export declare function classifyPaste(chunk: string, thresholds?: PasteThresholds): "inline" | "coalesce";
69
- /**
70
- * The immutable marker → body store.
71
- *
72
- * `bodies` maps each ordinal number to the exact text it hides; `minted`
73
- * is the running count that drives the next ordinal. The store is replaced (not
74
- * mutated) on every coalesce, so the surface holds it as a plain value and React
75
- * reconciliation stays correct.
76
- */
77
- export interface PasteVault {
78
- /** Ordinal number → the original pasted text it stands for. */
79
- readonly bodies: ReadonlyMap<number, string>;
80
- /** How many markers have been minted so far (the next ordinal is this + 1). */
81
- readonly minted: number;
82
- }
83
- /** A fresh, empty vault. */
84
- export declare const EMPTY_PASTE_VAULT: PasteVault;
85
- /**
86
- * The outcome of folding a large paste into a vault.
87
- *
88
- * `marker` is the placeholder token the caller splices into the composer at the
89
- * caret; `vault` is the grown store to carry forward.
90
- */
91
- export interface PasteCapture {
92
- /** The placeholder token to insert in place of the hidden body. */
93
- readonly marker: string;
94
- /** The vault grown by this capture. */
95
- readonly vault: PasteVault;
96
- }
97
- /**
98
- * Mint a marker for a large paste and record its body in a fresh vault.
99
- *
100
- * Pure: derives the next ordinal from `vault.minted`, formats the marker with
101
- * the hidden line count, and returns a new vault with the body recorded. The
102
- * caller is expected to have already classified `body` as `coalesce`; passing a
103
- * small body still works but is rarely useful.
104
- *
105
- * @param vault the store to grow (defaults to {@link EMPTY_PASTE_VAULT})
106
- * @param body the full pasted text to hide
107
- */
108
- export declare function coalescePaste(body: string, vault?: PasteVault): PasteCapture;
109
- /**
110
- * Rewrite every paste marker in a buffer back to the text it stands for.
111
- *
112
- * Pure: scans the buffer for marker tokens and replaces each with its vault
113
- * body. A marker with no matching vault entry (e.g. the user deleted half a
114
- * token, or pasted a look-alike) is left verbatim, so expansion never throws
115
- * and never loses unrelated text. This is the inverse of {@link coalescePaste}
116
- * and is run once at submit time.
117
- *
118
- * @param buffer the composer text possibly containing markers
119
- * @param vault the store minted during the current edit
120
- */
121
- export declare function expandMarkers(buffer: string, vault: PasteVault): string;
122
- /**
123
- * Report whether a buffer still contains any minted paste marker.
124
- *
125
- * A pure convenience the surface uses to skip the expansion pass entirely when
126
- * nothing was coalesced.
127
- *
128
- * @param buffer the composer text to scan
129
- * @param vault the store of minted markers
130
- */
131
- export declare function hasMarkers(buffer: string, vault: PasteVault): boolean;
@@ -1,53 +0,0 @@
1
- /**
2
- * Console mount — render the interactive surface and resolve on exit.
3
- *
4
- * The single entry point a run mode calls to take over the terminal: it
5
- * resolves the colour scheme, assembles the {@link ConsoleProps}, renders the
6
- * {@link TerminalConsole} through Ink's `render`, and returns a promise that
7
- * settles when the surface tears down (the user exits, or `requestExit` fires).
8
- *
9
- * This is the only console module that performs the actual Ink mount; everything
10
- * it composes (the reducer, theme, slash registry, input modules, surface
11
- * components) is pure or presentational. Keeping the mount here lets the rest of
12
- * the subsystem stay testable without an Ink runtime.
13
- */
14
- import type { OverlayServices, SessionConductor, SlashRegistry } from "./contract";
15
- /**
16
- * Options for {@link mountConsole}.
17
- *
18
- * Everything is optional with a sensible default: the theme falls back to the
19
- * default scheme, the slash registry to the built-in catalog, and the seeds to
20
- * empty. The conductor is the only required input and is passed positionally.
21
- */
22
- export interface MountConsoleOptions {
23
- /** The colour scheme name to resolve (falls back to the default). */
24
- readonly scheme?: string | null;
25
- /** The slash registry to dispatch against (defaults to the built-in catalog). */
26
- readonly slash?: SlashRegistry;
27
- /** An optional first user turn to submit on mount. */
28
- readonly initialInput?: string;
29
- /** Optional local image paths to attach to the first turn. */
30
- readonly initialImages?: readonly string[];
31
- /** Whether to render verbose diagnostics in the banner. */
32
- readonly verbose?: boolean;
33
- /** The runtime handles the modal overlays drive; absent on headless paths. */
34
- readonly services?: OverlayServices;
35
- }
36
- /**
37
- * The handle a {@link mountConsole} call resolves with once the surface exits.
38
- */
39
- export interface MountResult {
40
- /** Whether the surface tore down cleanly. */
41
- readonly clean: boolean;
42
- }
43
- /**
44
- * Render the interactive console for a session and resolve when it exits.
45
- *
46
- * Assembles the props, mounts {@link TerminalConsole} via Ink's `render`, and
47
- * wires an `onExit` callback (and Ink's `waitUntilExit`) so the returned promise
48
- * settles when the surface is dismissed.
49
- *
50
- * @param conductor the session this console drives
51
- * @param opts optional theme / registry / seed overrides
52
- */
53
- export declare function mountConsole(conductor: SessionConductor, opts?: MountConsoleOptions): Promise<MountResult>;
@@ -1,71 +0,0 @@
1
- /**
2
- * Approval queue — the headless, pure serializer behind the approval overlay.
3
- *
4
- * The permission gate may reach an `ask` decision while another approval prompt is
5
- * already on screen (e.g. a turn that batches several tool calls). The UI shows ONE
6
- * prompt at a time, so the pending requests are held in an ordered queue: each
7
- * `enqueue` parks a request, the HEAD is the prompt currently shown, and `settle`
8
- * resolves the head's parked promise then advances to the next. This module is a
9
- * pure reducer over an immutable {@link ApprovalQueueState} plus a couple of tiny
10
- * helpers — no React, no Ink, no timers — so the queue logic is unit-testable in
11
- * isolation (the overlay component only renders the head and dispatches settles).
12
- *
13
- * Each queued entry carries the parked promise's `resolve` (the gate awaits it) and
14
- * the request itself. Settling resolves with an {@link ApprovalChoice}; an
15
- * abort/clear settles every outstanding entry with `"deny"` so a cancelled turn
16
- * never hangs on a pending prompt.
17
- */
18
- import type { ApprovalChoice } from "../../conductor";
19
- import type { ApprovalRequest } from "./approval";
20
- /** One parked approval request awaiting the user's choice. */
21
- export interface ApprovalEntry {
22
- /** A stable id, unique within the queue's lifetime, used to settle the right one. */
23
- readonly id: string;
24
- /** The pending request the prompt renders. */
25
- readonly request: ApprovalRequest;
26
- /** Fulfil the gate's parked promise with the user's choice. Called exactly once. */
27
- readonly resolve: (choice: ApprovalChoice) => void;
28
- }
29
- /**
30
- * The immutable queue state. The array is ordered oldest-first; the head (index 0)
31
- * is the request currently prompted. An empty queue means no prompt is showing.
32
- */
33
- export interface ApprovalQueueState {
34
- /** The parked entries, oldest first; `[0]` is the active prompt. */
35
- readonly entries: readonly ApprovalEntry[];
36
- }
37
- /** The empty queue — no approval prompt pending. */
38
- export declare const EMPTY_APPROVAL_QUEUE: ApprovalQueueState;
39
- /**
40
- * The closed action union the queue reducer folds:
41
- * - `enqueue` — park a new request at the tail.
42
- * - `settle` — resolve the entry matching `id` with `choice` and drop it.
43
- * - `clear` — drop EVERY entry (the caller resolves each with `"deny"`).
44
- */
45
- export type ApprovalQueueEvent = {
46
- readonly type: "enqueue";
47
- readonly entry: ApprovalEntry;
48
- } | {
49
- readonly type: "settle";
50
- readonly id: string;
51
- } | {
52
- readonly type: "clear";
53
- };
54
- /**
55
- * Fold one {@link ApprovalQueueEvent} over the queue, returning a fresh state.
56
- *
57
- * Pure and total: it never resolves a promise itself (the caller does that around
58
- * a `settle`/`clear`), it only mutates the ordered entry list. `enqueue` appends;
59
- * `settle` removes the entry with the matching `id` (a no-op when absent, e.g. a
60
- * double-settle); `clear` empties the queue.
61
- *
62
- * @param state the prior queue state
63
- * @param event the action to apply
64
- */
65
- export declare function approvalQueueReducer(state: ApprovalQueueState, event: ApprovalQueueEvent): ApprovalQueueState;
66
- /**
67
- * The active prompt — the head entry — or `undefined` when the queue is empty.
68
- *
69
- * @param state the queue state
70
- */
71
- export declare function activeApproval(state: ApprovalQueueState): ApprovalEntry | undefined;