indusagi-coding-agent 0.2.4 → 0.2.8

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 (267) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/LICENSE +661 -0
  3. package/README.md +99 -1
  4. package/dist/entry.js +13551 -23107
  5. package/dist/guardrails.js +822 -8248
  6. package/dist/index.js +12547 -22190
  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/heap.d.ts +0 -31
  23. package/dist/types/boot/index.d.ts +0 -20
  24. package/dist/types/boot/invocation.d.ts +0 -40
  25. package/dist/types/boot/invocation.test.d.ts +0 -8
  26. package/dist/types/boot/runners/addon-wiring.d.ts +0 -103
  27. package/dist/types/boot/runners/addon-wiring.test.d.ts +0 -19
  28. package/dist/types/boot/runners/checkpoint.d.ts +0 -133
  29. package/dist/types/boot/runners/checkpoint.test.d.ts +0 -12
  30. package/dist/types/boot/runners/delegate-runner.d.ts +0 -109
  31. package/dist/types/boot/runners/delegate-runner.test.d.ts +0 -13
  32. package/dist/types/boot/runners/index.d.ts +0 -13
  33. package/dist/types/boot/runners/link-runner.d.ts +0 -20
  34. package/dist/types/boot/runners/memdir.d.ts +0 -103
  35. package/dist/types/boot/runners/memdir.test.d.ts +0 -12
  36. package/dist/types/boot/runners/oneshot-runner.d.ts +0 -19
  37. package/dist/types/boot/runners/read-state.d.ts +0 -82
  38. package/dist/types/boot/runners/read-state.test.d.ts +0 -10
  39. package/dist/types/boot/runners/registry.d.ts +0 -30
  40. package/dist/types/boot/runners/repl-runner.d.ts +0 -19
  41. package/dist/types/boot/runners/server-mode.d.ts +0 -71
  42. package/dist/types/boot/runners/session-persist.test.d.ts +0 -10
  43. package/dist/types/boot/runners/session.d.ts +0 -88
  44. package/dist/types/boot/runners/session.test.d.ts +0 -15
  45. package/dist/types/boot/server-token.d.ts +0 -97
  46. package/dist/types/boot/stages.d.ts +0 -92
  47. package/dist/types/boot/upgrade/apply.d.ts +0 -45
  48. package/dist/types/boot/upgrade/index.d.ts +0 -13
  49. package/dist/types/boot/upgrade/upgrades.d.ts +0 -126
  50. package/dist/types/briefing/briefing.test.d.ts +0 -15
  51. package/dist/types/briefing/compose.d.ts +0 -37
  52. package/dist/types/briefing/context-docs.d.ts +0 -38
  53. package/dist/types/briefing/context-docs.test.d.ts +0 -18
  54. package/dist/types/briefing/contract.d.ts +0 -686
  55. package/dist/types/briefing/index.d.ts +0 -29
  56. package/dist/types/briefing/macros.d.ts +0 -206
  57. package/dist/types/briefing/skills.d.ts +0 -67
  58. package/dist/types/capability-deck/bridge-ledger/index.d.ts +0 -25
  59. package/dist/types/capability-deck/bridge-ledger/key.d.ts +0 -65
  60. package/dist/types/capability-deck/bridge-ledger/ledger.d.ts +0 -129
  61. package/dist/types/capability-deck/bridge-ledger/network.d.ts +0 -115
  62. package/dist/types/capability-deck/builtin-bridge.d.ts +0 -114
  63. package/dist/types/capability-deck/capability-deck.test.d.ts +0 -18
  64. package/dist/types/capability-deck/cards/bg-process-card.d.ts +0 -99
  65. package/dist/types/capability-deck/cards/index.d.ts +0 -37
  66. package/dist/types/capability-deck/cards/memory-card.d.ts +0 -68
  67. package/dist/types/capability-deck/cards/plan-file.d.ts +0 -56
  68. package/dist/types/capability-deck/cards/plan-tools.d.ts +0 -97
  69. package/dist/types/capability-deck/cards/plan-tools.test.d.ts +0 -9
  70. package/dist/types/capability-deck/cards/saas-card.d.ts +0 -78
  71. package/dist/types/capability-deck/cards/task-card.d.ts +0 -106
  72. package/dist/types/capability-deck/cards/todo-card.d.ts +0 -78
  73. package/dist/types/capability-deck/cards/workflow-card.d.ts +0 -55
  74. package/dist/types/capability-deck/cards/workflow-card.test.d.ts +0 -12
  75. package/dist/types/capability-deck/checkpoint.int.test.d.ts +0 -25
  76. package/dist/types/capability-deck/contract.d.ts +0 -318
  77. package/dist/types/capability-deck/index.d.ts +0 -46
  78. package/dist/types/capability-deck/manifest.d.ts +0 -60
  79. package/dist/types/capability-deck/provision.d.ts +0 -76
  80. package/dist/types/capability-deck/read-edit-gate.int.test.d.ts +0 -21
  81. package/dist/types/channels/channels.test.d.ts +0 -15
  82. package/dist/types/channels/contract.d.ts +0 -489
  83. package/dist/types/channels/framer.d.ts +0 -49
  84. package/dist/types/channels/index.d.ts +0 -24
  85. package/dist/types/channels/link/dialog.d.ts +0 -138
  86. package/dist/types/channels/link/driver.d.ts +0 -81
  87. package/dist/types/channels/link/index.d.ts +0 -13
  88. package/dist/types/channels/link/server.d.ts +0 -70
  89. package/dist/types/channels/oneshot.d.ts +0 -37
  90. package/dist/types/channels/ops.d.ts +0 -89
  91. package/dist/types/channels/session-ops.d.ts +0 -80
  92. package/dist/types/conductor/bash-guard.d.ts +0 -106
  93. package/dist/types/conductor/bash-guard.test.d.ts +0 -17
  94. package/dist/types/conductor/catalog/catalog.d.ts +0 -87
  95. package/dist/types/conductor/catalog/index.d.ts +0 -14
  96. package/dist/types/conductor/catalog/matcher.d.ts +0 -47
  97. package/dist/types/conductor/conductor.d.ts +0 -213
  98. package/dist/types/conductor/conductor.test.d.ts +0 -10
  99. package/dist/types/conductor/contract.d.ts +0 -838
  100. package/dist/types/conductor/diagnostics.d.ts +0 -183
  101. package/dist/types/conductor/diagnostics.test.d.ts +0 -10
  102. package/dist/types/conductor/index.d.ts +0 -26
  103. package/dist/types/conductor/permission-gate.integration.test.d.ts +0 -22
  104. package/dist/types/conductor/permission-wiring.test.d.ts +0 -14
  105. package/dist/types/conductor/permissions.d.ts +0 -287
  106. package/dist/types/conductor/permissions.test.d.ts +0 -12
  107. package/dist/types/conductor/plan-mode.integration.test.d.ts +0 -23
  108. package/dist/types/conductor/post-edit-diagnostics.test.d.ts +0 -18
  109. package/dist/types/conductor/quota-error.d.ts +0 -35
  110. package/dist/types/conductor/signal-hub/hub.d.ts +0 -83
  111. package/dist/types/conductor/signal-hub/index.d.ts +0 -19
  112. package/dist/types/conductor/signal-hub/translate.d.ts +0 -77
  113. package/dist/types/conductor/skill-parse/index.d.ts +0 -10
  114. package/dist/types/conductor/skill-parse/parse.d.ts +0 -67
  115. package/dist/types/conductor/submit.test.d.ts +0 -28
  116. package/dist/types/conductor/transcript-store/index.d.ts +0 -16
  117. package/dist/types/conductor/transcript-store/serialize.d.ts +0 -106
  118. package/dist/types/conductor/transcript-store/serialize.test.d.ts +0 -10
  119. package/dist/types/conductor/transcript-store/store.d.ts +0 -188
  120. package/dist/types/console/auth-status.d.ts +0 -28
  121. package/dist/types/console/components/AgentsView.d.ts +0 -41
  122. package/dist/types/console/components/BackgroundAgents.d.ts +0 -63
  123. package/dist/types/console/components/BackgroundAgents.test.d.ts +0 -8
  124. package/dist/types/console/components/Banner.d.ts +0 -110
  125. package/dist/types/console/components/Composer.d.ts +0 -37
  126. package/dist/types/console/components/StatusBar.d.ts +0 -42
  127. package/dist/types/console/components/TerminalConsole.d.ts +0 -27
  128. package/dist/types/console/components/WorkingIndicator.d.ts +0 -44
  129. package/dist/types/console/components/WorkingIndicator.test.d.ts +0 -9
  130. package/dist/types/console/components/banner-sweep.d.ts +0 -55
  131. package/dist/types/console/components/banner.test.d.ts +0 -9
  132. package/dist/types/console/components/welcome.d.ts +0 -115
  133. package/dist/types/console/components/welcome.test.d.ts +0 -9
  134. package/dist/types/console/console.test.d.ts +0 -19
  135. package/dist/types/console/contract.d.ts +0 -611
  136. package/dist/types/console/index.d.ts +0 -34
  137. package/dist/types/console/input/complete.d.ts +0 -120
  138. package/dist/types/console/input/dir-reader.d.ts +0 -28
  139. package/dist/types/console/input/index.d.ts +0 -24
  140. package/dist/types/console/input/input.test.d.ts +0 -14
  141. package/dist/types/console/input/keymap.d.ts +0 -193
  142. package/dist/types/console/input/paste.d.ts +0 -183
  143. package/dist/types/console/mount.d.ts +0 -53
  144. package/dist/types/console/overlays/approval-queue.d.ts +0 -88
  145. package/dist/types/console/overlays/approval.d.ts +0 -104
  146. package/dist/types/console/overlays/approval.test.d.ts +0 -17
  147. package/dist/types/console/overlays/auth.d.ts +0 -31
  148. package/dist/types/console/overlays/boards.d.ts +0 -55
  149. package/dist/types/console/overlays/host.d.ts +0 -45
  150. package/dist/types/console/overlays/index.d.ts +0 -15
  151. package/dist/types/console/overlays/pickers.d.ts +0 -37
  152. package/dist/types/console/overlays/sessions.d.ts +0 -29
  153. package/dist/types/console/reducer.d.ts +0 -51
  154. package/dist/types/console/slash/builtins.d.ts +0 -33
  155. package/dist/types/console/slash/commands/dynamic.d.ts +0 -57
  156. package/dist/types/console/slash/commands/dynamic.test.d.ts +0 -9
  157. package/dist/types/console/slash/commands/integrations.d.ts +0 -28
  158. package/dist/types/console/slash/commands/integrations.test.d.ts +0 -18
  159. package/dist/types/console/slash/commands/shared.d.ts +0 -72
  160. package/dist/types/console/slash/commands/transcript.d.ts +0 -24
  161. package/dist/types/console/slash/commands/transcript.test.d.ts +0 -10
  162. package/dist/types/console/slash/commands/workbench.d.ts +0 -21
  163. package/dist/types/console/slash/commands/workbench.test.d.ts +0 -10
  164. package/dist/types/console/slash/index.d.ts +0 -34
  165. package/dist/types/console/slash/registry.d.ts +0 -90
  166. package/dist/types/console/slash/resolve.d.ts +0 -109
  167. package/dist/types/console/slash/slash.test.d.ts +0 -18
  168. package/dist/types/console/startup.d.ts +0 -119
  169. package/dist/types/console/theme/adapter.d.ts +0 -79
  170. package/dist/types/console/theme/index.d.ts +0 -18
  171. package/dist/types/console/theme/palette.d.ts +0 -77
  172. package/dist/types/console/theme/resolve.d.ts +0 -45
  173. package/dist/types/console/theme/theme.test.d.ts +0 -16
  174. package/dist/types/console/theme/tokens.d.ts +0 -62
  175. package/dist/types/entry.d.ts +0 -17
  176. package/dist/types/guardrails.d.ts +0 -33
  177. package/dist/types/index.d.ts +0 -24
  178. package/dist/types/insight/channel.d.ts +0 -45
  179. package/dist/types/insight/contract.d.ts +0 -411
  180. package/dist/types/insight/index.d.ts +0 -26
  181. package/dist/types/insight/insight.test.d.ts +0 -17
  182. package/dist/types/insight/recorder.d.ts +0 -63
  183. package/dist/types/insight/redaction.d.ts +0 -44
  184. package/dist/types/insight/replay.d.ts +0 -77
  185. package/dist/types/insight/sampling.d.ts +0 -84
  186. package/dist/types/insight/serialize.d.ts +0 -54
  187. package/dist/types/insight/sinks/console.d.ts +0 -36
  188. package/dist/types/insight/sinks/file.d.ts +0 -37
  189. package/dist/types/insight/sinks/index.d.ts +0 -16
  190. package/dist/types/insight/sinks/stream.d.ts +0 -53
  191. package/dist/types/kit/clipboard-image.d.ts +0 -40
  192. package/dist/types/kit/external-editor.d.ts +0 -35
  193. package/dist/types/kit/image.d.ts +0 -102
  194. package/dist/types/kit/index.d.ts +0 -29
  195. package/dist/types/kit/kit.test.d.ts +0 -13
  196. package/dist/types/kit/shell.d.ts +0 -50
  197. package/dist/types/kit/tool-fetch.d.ts +0 -165
  198. package/dist/types/launch/catalog.d.ts +0 -51
  199. package/dist/types/launch/contract.d.ts +0 -387
  200. package/dist/types/launch/credentials.d.ts +0 -112
  201. package/dist/types/launch/index.d.ts +0 -28
  202. package/dist/types/launch/invocation/attachments.d.ts +0 -72
  203. package/dist/types/launch/invocation/flags.d.ts +0 -59
  204. package/dist/types/launch/invocation/index.d.ts +0 -23
  205. package/dist/types/launch/invocation/read.d.ts +0 -52
  206. package/dist/types/launch/invocation/usage.d.ts +0 -25
  207. package/dist/types/launch/launch.test.d.ts +0 -20
  208. package/dist/types/launch/login.d.ts +0 -68
  209. package/dist/types/launch/oauth.d.ts +0 -101
  210. package/dist/types/launch/oauth.test.d.ts +0 -20
  211. package/dist/types/launch/packages.d.ts +0 -75
  212. package/dist/types/launch/packages.test.d.ts +0 -15
  213. package/dist/types/launch/pickers.d.ts +0 -97
  214. package/dist/types/runtime-bridge/bridges/_drive.d.ts +0 -74
  215. package/dist/types/runtime-bridge/bridges/builtins.d.ts +0 -77
  216. package/dist/types/runtime-bridge/bridges/claude-cli.d.ts +0 -37
  217. package/dist/types/runtime-bridge/bridges/codex-cli.d.ts +0 -27
  218. package/dist/types/runtime-bridge/bridges/index.d.ts +0 -15
  219. package/dist/types/runtime-bridge/bridges/indusagi-cli.d.ts +0 -36
  220. package/dist/types/runtime-bridge/broker.d.ts +0 -182
  221. package/dist/types/runtime-bridge/contract.d.ts +0 -436
  222. package/dist/types/runtime-bridge/index.d.ts +0 -21
  223. package/dist/types/runtime-bridge/runtime-bridge.test.d.ts +0 -17
  224. package/dist/types/runtime-bridge/sink.d.ts +0 -59
  225. package/dist/types/sessions/contract.d.ts +0 -79
  226. package/dist/types/sessions/index.d.ts +0 -11
  227. package/dist/types/sessions/library.d.ts +0 -95
  228. package/dist/types/sessions/sessions.test.d.ts +0 -11
  229. package/dist/types/settings/contract.d.ts +0 -175
  230. package/dist/types/settings/index.d.ts +0 -13
  231. package/dist/types/settings/manager.d.ts +0 -109
  232. package/dist/types/settings/settings.test.d.ts +0 -16
  233. package/dist/types/transcript-export/index.d.ts +0 -20
  234. package/dist/types/transcript-export/publish.d.ts +0 -81
  235. package/dist/types/transcript-export/sgr.d.ts +0 -90
  236. package/dist/types/transcript-export/template.d.ts +0 -64
  237. package/dist/types/transcript-export/theme-bridge.d.ts +0 -99
  238. package/dist/types/transcript-export/transcript-export.test.d.ts +0 -16
  239. package/dist/types/window-budget/budget/estimate.d.ts +0 -47
  240. package/dist/types/window-budget/budget/gate.d.ts +0 -37
  241. package/dist/types/window-budget/budget/index.d.ts +0 -14
  242. package/dist/types/window-budget/budget/slice.d.ts +0 -38
  243. package/dist/types/window-budget/condenser.d.ts +0 -73
  244. package/dist/types/window-budget/contract.d.ts +0 -182
  245. package/dist/types/window-budget/index.d.ts +0 -17
  246. package/dist/types/window-budget/microcompact.d.ts +0 -68
  247. package/dist/types/window-budget/microcompact.test.d.ts +0 -16
  248. package/dist/types/window-budget/rehydrate.d.ts +0 -56
  249. package/dist/types/window-budget/summarize/condense.d.ts +0 -76
  250. package/dist/types/window-budget/summarize/index.d.ts +0 -12
  251. package/dist/types/window-budget/summarize/prompt.d.ts +0 -56
  252. package/dist/types/window-budget/window-budget.test.d.ts +0 -18
  253. package/dist/types/workflow-engine/agent-runner.d.ts +0 -124
  254. package/dist/types/workflow-engine/agent-runner.test.d.ts +0 -8
  255. package/dist/types/workflow-engine/display.d.ts +0 -148
  256. package/dist/types/workflow-engine/display.test.d.ts +0 -1
  257. package/dist/types/workflow-engine/engine.d.ts +0 -183
  258. package/dist/types/workflow-engine/engine.test.d.ts +0 -1
  259. package/dist/types/workflow-engine/index.d.ts +0 -21
  260. package/dist/types/workflow-engine/parse.d.ts +0 -64
  261. package/dist/types/workflow-engine/parse.test.d.ts +0 -1
  262. package/dist/types/workflow-engine/structured-output.d.ts +0 -51
  263. package/dist/types/workflow-engine/structured-output.test.d.ts +0 -1
  264. package/dist/types/workspace/brand.d.ts +0 -26
  265. package/dist/types/workspace/index.d.ts +0 -11
  266. package/dist/types/workspace/locator.d.ts +0 -50
  267. package/dist/types/workspace/runtime-detect.d.ts +0 -56
@@ -1,95 +0,0 @@
1
- /**
2
- * SessionLibrary — the catalog-and-navigation layer over persisted transcripts.
3
- *
4
- * The conductor owns a single session at a time as a {@link TranscriptStore}.
5
- * The library owns the *collection*: it scans the workspace `sessions/`
6
- * directory for the NDJSON files the conductor's filesystem backend writes,
7
- * lists them as {@link SavedSession} catalog rows, opens any one back into a
8
- * live store via the store's own loader + {@link replay} reducer, and offers the
9
- * two read projections a chooser UI needs — a flattened {@link BranchNode} tree
10
- * for a branch navigator and a {@link PriorTurn} list for re-asking an earlier
11
- * prompt. It also performs the two file-level mutations a manager needs:
12
- * renaming and deleting a session on disk.
13
- *
14
- * The library never re-implements transcript parsing or message serialization —
15
- * it delegates entirely to the conductor's transcript-store surface
16
- * ({@link TranscriptStore}, {@link fsBackend}, {@link replay}). Its own logic is
17
- * purely the directory enumeration, the tree flatten, and the text reduction.
18
- */
19
- import { TranscriptStore } from "../conductor";
20
- import type { BranchNode, PriorTurn, SavedSession } from "./contract";
21
- /** Construction inputs — just the directory sessions live under. */
22
- export interface SessionLibraryOptions {
23
- /** Absolute path to the workspace `sessions/` directory. */
24
- readonly sessionsDir: string;
25
- }
26
- /**
27
- * The collection-level handle over a workspace's persisted sessions.
28
- *
29
- * Construct it with the resolved `sessionsDir` (from the workspace locator),
30
- * then call {@link list} / {@link open} / {@link rename} / {@link remove} to
31
- * manage files, and {@link tree} / {@link priorTurns} to project a loaded
32
- * transcript for navigation and forking.
33
- */
34
- export declare class SessionLibrary {
35
- #private;
36
- constructor(options: SessionLibraryOptions);
37
- /** The sessions directory this library is rooted at. */
38
- get directory(): string;
39
- /**
40
- * Enumerate persisted sessions as catalog rows, newest-modified first.
41
- *
42
- * Scans the directory for `*.ndjson` files and `stat`s each for its size and
43
- * modification time. When `deep` is set, it also opens each file to fill in
44
- * `messageCount` and the opening-turn `preview`; otherwise it returns the
45
- * shallow rows (id/path/size/lastModified) so a large directory lists fast.
46
- * A missing directory yields an empty list rather than an error.
47
- */
48
- list(options?: {
49
- readonly deep?: boolean;
50
- }): Promise<SavedSession[]>;
51
- /**
52
- * Open a persisted session back into a live, hydrated {@link TranscriptStore},
53
- * or return `null` when no file with that id exists.
54
- *
55
- * Delegates to the store's own static opener, which reads the backend and
56
- * rebuilds state through the {@link replay} reducer — the library adds nothing
57
- * to the rehydration beyond binding the filesystem backend.
58
- */
59
- open(id: string): Promise<TranscriptStore | null>;
60
- /**
61
- * Rename a session file from one id to another, returning the new absolute
62
- * path. The on-disk identifier *is* the filename stem, so this is a plain file
63
- * move; the in-file head still names the old id, which the store tolerates on
64
- * the next load (the head's leaf is what matters, not its session label).
65
- *
66
- * @throws if the source file is missing or the target id already exists.
67
- */
68
- rename(fromId: string, toId: string): Promise<string>;
69
- /**
70
- * Delete a session file. Returns `true` when a file was removed, `false` when
71
- * there was nothing to delete — never throws on an already-absent session.
72
- */
73
- remove(id: string): Promise<boolean>;
74
- /** Absolute path a session id persists to. */
75
- pathOf(id: string): string;
76
- /**
77
- * Flatten a loaded transcript into an ordered {@link BranchNode} list for a
78
- * tree navigator.
79
- *
80
- * Walks every node from each root downward in a stable depth-first order,
81
- * emitting one row per node with its render label, depth indentation, leaf
82
- * flag, and a current-marker derived from the store's active head. A node is a
83
- * leaf when no other node names it as `parent`.
84
- */
85
- tree(store: TranscriptStore): BranchNode[];
86
- /**
87
- * Extract the user prompts along a loaded transcript's active branch as fork
88
- * candidates, in chronological order.
89
- *
90
- * Reads the root→leaf branch the store currently points at (the conversation
91
- * the agent would replay) and keeps only the user-role nodes that carry real
92
- * text, projecting each to a {@link PriorTurn} a forking picker can offer.
93
- */
94
- priorTurns(store: TranscriptStore): PriorTurn[];
95
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * SessionLibrary behavioral tests.
3
- *
4
- * Exercises the catalog-and-navigation layer end-to-end against a real temp
5
- * `sessions/` directory: we seed a couple of sessions by driving real
6
- * {@link TranscriptStore}s over a filesystem backend (so the on-disk NDJSON is
7
- * the genuine format), then assert the library lists them, opens them, flattens
8
- * the branch tree, and extracts prior user turns. File mutations (rename/remove)
9
- * are checked too. No network, no framework agent — just disk + the store.
10
- */
11
- export {};
@@ -1,175 +0,0 @@
1
- /**
2
- * Settings subsystem — the typed surface of the user-tunable preferences an
3
- * interactive coding-agent session reads at startup and while it runs.
4
- *
5
- * This module declares *only* shapes and frozen defaults — no I/O, no class, no
6
- * filesystem. It is the single place every preference key is named, typed, and
7
- * given a fallback. The two-tier manager ({@link "./manager"}) is written
8
- * against the {@link Preferences} record declared here, and any console surface
9
- * that toggles a preference reads its value through the same record.
10
- *
11
- * Design stance:
12
- * - Every key is optional on the record so a partially-written file is a
13
- * legal {@link Preferences} value; the manager fills the gaps from
14
- * {@link DEFAULT_PREFERENCES} when a reader asks for a concrete value.
15
- * - Reasoning-effort vocabulary is borrowed from the framework
16
- * ({@link ThinkingLevel}) rather than re-declared, so the agent and the UI
17
- * speak the same words.
18
- * - The other small string unions ({@link ColourScheme} is a free string,
19
- * while {@link EscapeAction}) pin the surfaces a console reads.
20
- */
21
- import type { ThinkingLevel } from "indusagi/agent";
22
- /** Re-exported framework reasoning vocabulary, surfaced through this contract. */
23
- export type { ThinkingLevel };
24
- /**
25
- * What a double-tap of the escape key does in the interactive console.
26
- *
27
- * - `tree` — open the turn history as a navigable tree of branches.
28
- * - `fork` — open the prior-turn picker to branch off an earlier turn.
29
- * - `clear` — wipe the composer buffer.
30
- *
31
- * The legacy `rewind` / `branch` aliases are still accepted and treated as
32
- * `fork` / `tree` respectively so an older preference file keeps working.
33
- */
34
- export type EscapeAction = "tree" | "fork" | "clear" | "rewind" | "branch";
35
- /** Every {@link EscapeAction} value, as a frozen tuple for menus and guards. */
36
- export declare const ESCAPE_ACTIONS: readonly EscapeAction[];
37
- /** Narrow an arbitrary value to a known {@link EscapeAction}. */
38
- export declare function isEscapeAction(value: unknown): value is EscapeAction;
39
- /**
40
- * How a queue of pending turns (steering corrections or follow-up prompts) is
41
- * drained back into the run.
42
- *
43
- * - `all` — release every queued turn at once on the next handoff.
44
- * - `one-at-a-time` — release a single queued turn per handoff.
45
- */
46
- export type DeliveryMode = "all" | "one-at-a-time";
47
- /** Every {@link DeliveryMode} value, as a frozen tuple for menus and guards. */
48
- export declare const DELIVERY_MODES: readonly DeliveryMode[];
49
- /** Narrow an arbitrary value to a known {@link DeliveryMode}. */
50
- export declare function isDeliveryMode(value: unknown): value is DeliveryMode;
51
- /**
52
- * How aggressively the per-tool permission gate auto-allows tool calls before it
53
- * falls back to asking (or denying):
54
- *
55
- * - `default` — consult the allow/ask/deny rules; read-only tools are
56
- * auto-allowed, anything else with no matching allow rule
57
- * falls through to `ask`.
58
- * - `acceptEdits` — additionally auto-allow filesystem edits/writes (the
59
- * mutating edit/write/multiedit tools), leaving everything
60
- * else on the `default` path.
61
- * - `bypass` — allow every tool with no prompt (the unsafe "trust all"
62
- * mode; `bypassPermissions` is accepted as an alias).
63
- * - `plan` — deny every mutating tool outright (read-only research only)
64
- * so the agent can plan without touching the workspace.
65
- */
66
- export type PermissionMode = "default" | "acceptEdits" | "bypass" | "plan" | "bypassPermissions";
67
- /** The canonical {@link PermissionMode} values, as a frozen tuple for menus/guards. */
68
- export declare const PERMISSION_MODES: readonly PermissionMode[];
69
- /** Narrow an arbitrary value to a known {@link PermissionMode} (folds the alias). */
70
- export declare function isPermissionMode(value: unknown): value is PermissionMode;
71
- /**
72
- * The declarative permission policy a session reads at startup.
73
- *
74
- * `allow`/`ask`/`deny` are ordered lists of induscode-style rule strings — a bare
75
- * tool name (`"Bash"`) or a tool name with an argument specifier
76
- * (`"Bash(npm run test:*)"`). Across tiers the three lists are concatenated, and
77
- * `deny` wins over `ask` wins over `allow`. `defaultMode` seeds the session's
78
- * permission mode when no flag overrides it. Every field is optional so an empty
79
- * `{}` (or an absent `permissions` key) keeps today's allow-all behavior.
80
- */
81
- export interface PermissionSettings {
82
- /** Rule strings that auto-allow a matching tool call (lowest precedence). */
83
- allow?: string[];
84
- /** Rule strings that force a matching tool call to prompt for approval. */
85
- ask?: string[];
86
- /** Rule strings that hard-block a matching tool call (highest precedence). */
87
- deny?: string[];
88
- /** The permission mode the session opens in when no flag overrides it. */
89
- defaultMode?: PermissionMode;
90
- }
91
- /**
92
- * Every preference an interactive coding-agent session reads, as one flat,
93
- * fully-optional record.
94
- *
95
- * A value of this type may be the empty object (a brand-new install), a sparse
96
- * project override, or a fully-populated global file — all three are legal.
97
- * Concrete reads always go through the manager, which layers the project file
98
- * over the global file over {@link DEFAULT_PREFERENCES}, so a reader never sees
99
- * `undefined` for a key with a default.
100
- */
101
- export interface Preferences {
102
- /** Named colour scheme the console renders with (e.g. `"midnight"`). */
103
- colourScheme?: string;
104
- /** Whether inline image content is rendered in the transcript. */
105
- showImages?: boolean;
106
- /** Whether the model's reasoning / thinking text is shown as it streams. */
107
- showReasoning?: boolean;
108
- /** When true, the reasoning block is folded away even if the model emits one. */
109
- hideThinking?: boolean;
110
- /** Whether oversized images are shrunk to fit before being handed to a provider. */
111
- imageAutoResize?: boolean;
112
- /** When true, image content is withheld from providers entirely. */
113
- blockImages?: boolean;
114
- /** Whether discovered skills are surfaced as their own slash commands. */
115
- enableSkillCommands?: boolean;
116
- /** How queued steering corrections are released back into the run. */
117
- steeringMode?: DeliveryMode;
118
- /** How queued follow-up prompts are released back into the run. */
119
- followUpMode?: DeliveryMode;
120
- /** Prefer a condensed changelog after the console updates itself. */
121
- collapseChangelog?: boolean;
122
- /** Reveal the terminal's own cursor instead of the software-drawn caret. */
123
- showHardwareCursor?: boolean;
124
- /** Horizontal padding, in columns, around the prompt editor. */
125
- editorPaddingX?: number;
126
- /** Glob / id patterns selecting which models appear in the picker; empty means all. */
127
- enabledModels?: string[];
128
- /** Provider id the session defaults to when none is named (e.g. `"anthropic"`). */
129
- defaultProvider?: string;
130
- /** Model id the session opens with under {@link defaultProvider}. */
131
- defaultModel?: string;
132
- /** Reasoning effort the session requests by default. */
133
- defaultThinkingLevel?: ThinkingLevel;
134
- /** Suppress the banner / tips shown on a normal interactive launch. */
135
- quietStartup?: boolean;
136
- /**
137
- * The last product version whose full masthead the user has already seen. The
138
- * banner auto-condenses to a one-line header when this equals the running
139
- * version (and nothing else demands the full block); it is rewritten to the
140
- * running version after the full masthead is shown, so a launch only shows the
141
- * big wordmark on the first sight of a version or a version bump.
142
- */
143
- lastSeenVersion?: string;
144
- /** Opt-in static colour-sweep flourish tinting the startup wordmark / emblem. */
145
- logoSweep?: boolean;
146
- /** When set, motion-flavoured flourishes (e.g. the logo sweep) are suppressed. */
147
- reducedMotion?: boolean;
148
- /** Whether the window-budget manager compacts the transcript automatically. */
149
- autoCompact?: boolean;
150
- /** What a double-escape does in the console. */
151
- doubleEscapeAction?: EscapeAction;
152
- /** Extension-package sources the launcher installs and loads (npm / git / local). */
153
- extensionPackages?: string[];
154
- /**
155
- * The declarative tool-permission policy: ordered allow/ask/deny rule lists and
156
- * the opening permission mode. Across the project/global tiers the rule lists
157
- * are concatenated (not overridden) and `deny > ask > allow` decides; an absent
158
- * value (or an empty object) preserves today's allow-all behavior.
159
- */
160
- permissions?: PermissionSettings;
161
- }
162
- /** The set of legal preference keys, derived from {@link Preferences}. */
163
- export type SettingKey = keyof Preferences;
164
- /**
165
- * The fallback value for every preference, used whenever neither the project
166
- * nor the global tier supplies a key.
167
- *
168
- * Frozen so it can be shared without a defensive copy; the manager spreads it
169
- * rather than mutating it. Every key in {@link Preferences} appears here with a
170
- * concrete (non-`undefined`) value, which is what lets a typed reader resolve a
171
- * guaranteed result.
172
- */
173
- export declare const DEFAULT_PREFERENCES: Required<Preferences>;
174
- /** Every preference key, as a frozen tuple for iteration and validation. */
175
- export declare const SETTING_KEYS: readonly SettingKey[];
@@ -1,13 +0,0 @@
1
- /**
2
- * Settings subsystem — public barrel.
3
- *
4
- * One import site for the typed {@link Preferences} record and its
5
- * {@link SettingKey} / {@link EscapeAction} / {@link ThinkingLevel}
6
- * vocabularies, the frozen {@link DEFAULT_PREFERENCES}, and the two-tier
7
- * {@link PreferenceStore} reader/writer. Console surfaces and boot stages depend
8
- * on this module rather than reaching into the individual files.
9
- */
10
- export type { Preferences, SettingKey, EscapeAction, DeliveryMode, ThinkingLevel, PermissionMode, PermissionSettings, } from "./contract";
11
- export { DEFAULT_PREFERENCES, SETTING_KEYS, ESCAPE_ACTIONS, isEscapeAction, DELIVERY_MODES, isDeliveryMode, PERMISSION_MODES, isPermissionMode, } from "./contract";
12
- export { PreferenceStore } from "./manager";
13
- export type { PreferenceLocations } from "./manager";
@@ -1,109 +0,0 @@
1
- /**
2
- * Settings manager — the two-tier reader/writer over the preference record.
3
- *
4
- * Two files back the same {@link Preferences} shape:
5
- *
6
- * - the **global** file, one per machine, living in the resolved workspace
7
- * profile directory ({@link Workspace.settingsPath});
8
- * - the **project** file, one per checkout, living beside the working tree in
9
- * a brand-named config directory.
10
- *
11
- * A read layers the project tier over the global tier over
12
- * {@link DEFAULT_PREFERENCES}: a key set in the project file wins, then the
13
- * global file, then the built-in default — so a reader of {@link PreferenceStore.get}
14
- * always receives a concrete value. A write through {@link PreferenceStore.set}
15
- * lands in the **project** tier only; the global file is left untouched, which
16
- * keeps a per-checkout override from silently leaking machine-wide.
17
- *
18
- * Loading is tolerant: a missing file is the empty record, and a corrupt file
19
- * (bad JSON, or a JSON value that is not an object) degrades to the empty record
20
- * rather than throwing, so one mangled file never blocks startup.
21
- *
22
- * Construction is injectable. {@link PreferenceStore.fromWorkspace} resolves the
23
- * two paths from a {@link Workspace} and the working directory; {@link PreferenceStore.atPaths}
24
- * pins both paths directly, which is what the tests drive against a temp dir so
25
- * the real home is never read or written.
26
- */
27
- import type { Workspace } from "../boot/contract";
28
- import { type Preferences, type SettingKey } from "./contract";
29
- /**
30
- * The resolved location of the two preference tiers.
31
- *
32
- * Both are absolute paths. The {@link global} file is machine-wide; the
33
- * {@link project} file is per-checkout. Either may be absent on disk — the
34
- * store treats a missing file as the empty record.
35
- */
36
- export interface PreferenceLocations {
37
- /** Machine-wide preference file (the global tier). */
38
- readonly global: string;
39
- /** Per-checkout preference file (the project tier). */
40
- readonly project: string;
41
- }
42
- /**
43
- * Two-tier preference store: project-over-global-over-default on read, and a
44
- * project-tier write on save.
45
- *
46
- * Construct via {@link fromWorkspace} (resolve from the workspace + cwd) or
47
- * {@link atPaths} (pin both files explicitly, as the tests do). Internally the
48
- * two tiers are held in memory and refreshed from disk on construction and on
49
- * {@link reload}; {@link set} stages a change into the in-memory project tier
50
- * and {@link save} flushes it.
51
- */
52
- export declare class PreferenceStore {
53
- private readonly locations;
54
- private globalTier;
55
- private projectTier;
56
- private constructor();
57
- /**
58
- * Build a store whose two tiers are pinned to explicit absolute paths.
59
- *
60
- * The direct seam used by tests: point both files at a temp dir and the real
61
- * home is never touched. Neither file needs to exist yet.
62
- */
63
- static atPaths(locations: PreferenceLocations): PreferenceStore;
64
- /**
65
- * Build a store from a resolved {@link Workspace} (global tier) and a working
66
- * directory (project tier).
67
- *
68
- * The global file is {@link Workspace.settingsPath}; the project file is
69
- * `<cwd>/<brand profile dir>/settings.json`, so a checkout carries its own
70
- * overrides next to its source. `cwd` defaults to the process working
71
- * directory.
72
- */
73
- static fromWorkspace(workspace: Workspace, cwd?: string): PreferenceStore;
74
- /** The two resolved file locations this store reads and writes. */
75
- paths(): PreferenceLocations;
76
- /** Re-read both tiers from disk, discarding any unsaved staged change. */
77
- reload(): void;
78
- /**
79
- * Read one preference, resolved across the tiers.
80
- *
81
- * Precedence is project → global → {@link DEFAULT_PREFERENCES}: the first tier
82
- * that defines the key (with a non-`undefined` value) wins. The return type is
83
- * the concrete default-backed type for the key, so callers never branch on
84
- * `undefined`.
85
- */
86
- get<K extends SettingKey>(key: K): Required<Preferences>[K];
87
- /**
88
- * Stage a preference into the in-memory **project** tier.
89
- *
90
- * Does not write to disk on its own — call {@link save} to persist. Setting a
91
- * key to `undefined` clears the project-tier override for it, letting the
92
- * value fall back to the global tier or the default on the next read.
93
- */
94
- set<K extends SettingKey>(key: K, value: Preferences[K]): void;
95
- /** The fully-resolved snapshot: defaults under global under project. */
96
- snapshot(): Required<Preferences>;
97
- /** The raw in-memory project tier (the keys a checkout overrides). */
98
- projectOverrides(): Preferences;
99
- /** The raw in-memory global tier (machine-wide keys). */
100
- globalDefaults(): Preferences;
101
- /**
102
- * Persist the staged in-memory **project** tier to its file.
103
- *
104
- * Writes the project tier only; the global file is never rewritten here, so a
105
- * per-checkout `set` cannot mutate machine-wide preferences. Creates the
106
- * containing directory if it is missing.
107
- */
108
- save(): void;
109
- }
@@ -1,16 +0,0 @@
1
- /**
2
- * Settings subsystem — unit tests.
3
- *
4
- * Everything runs against a temp directory pinned through
5
- * {@link PreferenceStore.atPaths}; the real home is never read or written. The
6
- * tests pin the public store behaviour:
7
- *
8
- * 1. Defaults load: a store over two non-existent files resolves every key to
9
- * its {@link DEFAULT_PREFERENCES} value.
10
- * 2. Precedence: a key present in both tiers reads from the project tier, and
11
- * a key present only globally still resolves; a corrupt project file falls
12
- * back to defaults without throwing.
13
- * 3. Round-trip: a `set` + `save` writes the project file, and a fresh store
14
- * over the same paths reads the persisted value back.
15
- */
16
- export {};
@@ -1,20 +0,0 @@
1
- /**
2
- * Transcript-export subsystem — public barrel.
3
- *
4
- * The HTML transcript publisher and its supporting machinery: the table-driven
5
- * SGR painter ({@link paintSgr}) that turns terminal-styled output into safe HTML
6
- * spans, the {@link ThemeBridge} that computes export colors from an
7
- * {@link ExportTheme} via a WCAG luminance LUT, the regenerated page-shell
8
- * {@link PAGE_SHELL} template with its `{{TOKEN}}` slots and {@link fill} helper,
9
- * and {@link publishTranscript} which renders a session transcript to a
10
- * standalone HTML document using `marked`, `highlight.js`, and the painter.
11
- *
12
- * Consumers import the publish surface from `src/transcript-export` rather than
13
- * reaching into individual modules.
14
- */
15
- export { paintSgr, tokenizeSgr, foldSgr, SGR_CODE_TABLE } from "./sgr";
16
- export { DefaultThemeBridge, createThemeBridge, buildLuminanceLut, parseColor, formatColor, } from "./theme-bridge";
17
- export { PAGE_SHELL, PAGE_STYLES, CLIENT_SCRIPT, fill, type SlotValues, } from "./template";
18
- export { publishTranscript, type PublishEntry, type PublishMessage, type PublishRole, type MessagePart, } from "./publish";
19
- export { FALLBACK_EXPORT_THEME, SHELL_SLOTS, SGR_INITIAL_STATE, briefingFault, } from "../briefing/contract";
20
- export type { ExportTheme, ThemeBridge, ThemeMode, LuminanceLut, Rgb, SgrState, SgrToken, SgrMutation, PublishOptions, WidgetRender, TranscriptPart, ShellSlot, } from "../briefing/contract";
@@ -1,81 +0,0 @@
1
- /**
2
- * publishTranscript — render a session transcript to a standalone, self-contained
3
- * HTML document.
4
- *
5
- * The publisher takes a list of transcript entries (each carrying a framework
6
- * message) and produces one HTML string with no external dependencies: prose is
7
- * rendered to HTML with `marked`, fenced code is syntax-highlighted with
8
- * `highlight.js`, terminal-styled tool output is painted to spans by
9
- * {@link paintSgr}, and all colors come from a {@link ThemeBridge} over an
10
- * {@link ExportTheme}. Markdown and highlighting are run *here*, at publish time,
11
- * so the rendered HTML is baked into the page payload and the page needs no
12
- * client-side parser to display — the page ships ready to read.
13
- *
14
- * The two third-party libraries this layer leans on are MIT (`marked`) and
15
- * BSD-3-Clause (`highlight.js`); their license notices are preserved verbatim in
16
- * the emitted document (the `MARKED_LIB` / `HIGHLIGHT_LIB` shell slots) as the
17
- * licenses require, while the libraries themselves are used, never reimplemented.
18
- */
19
- import { type ImageContent, type PublishOptions, type TextContent } from "../briefing/contract";
20
- /**
21
- * The conversational role a published turn carries. Mirrors the conductor's node
22
- * roles but is declared locally so the publisher depends only on the briefing
23
- * contract, not on the conductor subsystem.
24
- */
25
- export type PublishRole = "user" | "assistant" | "tool" | "system" | "condense" | "note";
26
- /**
27
- * One transcript node the publisher consumes. Structurally a subset of the
28
- * conductor's persisted entry: a `role` for attribution and a `message` carrying
29
- * the framework content this node renders. The `message` is read with narrow
30
- * structural access so the publisher never imports the framework message union.
31
- */
32
- export interface PublishEntry {
33
- /** Attribution role for this node. */
34
- readonly role: PublishRole;
35
- /** The framework message payload to render. */
36
- readonly message: PublishMessage;
37
- }
38
- /**
39
- * The narrow view of a framework message the publisher reads. Covers the three
40
- * concrete message roles' content shapes plus the tool-call linkage a tool result
41
- * carries, without redeclaring the whole framework union.
42
- */
43
- export interface PublishMessage {
44
- /** The framework message role. */
45
- readonly role: string;
46
- /** The message content — a bare string or a list of content parts. */
47
- readonly content: string | readonly MessagePart[];
48
- /** Present on tool-result messages; links the node to its originating call. */
49
- readonly toolCallId?: string;
50
- /** Present on tool-result messages; the invoked tool's display name. */
51
- readonly toolName?: string;
52
- }
53
- /**
54
- * The content-part union the publisher renders. Text and image parts alias the
55
- * framework's; thinking and tool-call parts are read structurally so the
56
- * assistant turn can surface a call's name and arguments.
57
- */
58
- export type MessagePart = TextContent | ImageContent | {
59
- readonly type: "thinking";
60
- readonly thinking: string;
61
- } | {
62
- readonly type: "toolCall";
63
- readonly id: string;
64
- readonly name: string;
65
- readonly arguments: Readonly<Record<string, unknown>>;
66
- };
67
- /**
68
- * Render a session transcript to a standalone HTML document.
69
- *
70
- * Configures the markdown + highlight pipeline, renders every entry to a turn,
71
- * serializes the turns into a base64 payload, resolves the theme through a
72
- * {@link ThemeBridge}, and fills the page shell. The returned string is a complete
73
- * `<!doctype html>` document with all styling, content, and the preserved library
74
- * notices inlined — it can be written to disk and opened directly.
75
- *
76
- * @param entries the transcript nodes to publish, in display order
77
- * @param opts optional theme, title, output directory, and widget overrides
78
- * @returns the rendered standalone HTML document
79
- * @throws a {@link briefingFault} of kind `"publish"` if assembly fails
80
- */
81
- export declare function publishTranscript(entries: readonly PublishEntry[], opts?: PublishOptions): string;
@@ -1,90 +0,0 @@
1
- /**
2
- * SGR painter — a table-driven ANSI Select-Graphic-Rendition state machine that
3
- * converts a terminal byte stream into a sequence of styled HTML spans.
4
- *
5
- * Terminal programs encode color and emphasis with CSI sequences of the form
6
- * `ESC [ p1 ; p2 ; … m` (the trailing `m` is the SGR final byte). The parameters
7
- * are small integers whose meaning is fixed by ECMA-48 / ISO 6429: `0` resets,
8
- * `1`/`3`/`4` switch on weight/italic/underline, `30`–`37` and `90`–`97` set the
9
- * foreground from the sixteen-color palette, `40`–`47` and `100`–`107` set the
10
- * background, and the two extended introducers `38`/`48` pull a 256-index or a
11
- * 24-bit triple out of the following parameters.
12
- *
13
- * Rather than a long `switch`, the semantics live in a *table*: each handled code
14
- * maps to an {@link SgrMutation} — the partial {@link SgrState} that code imposes —
15
- * and the painter folds the matched mutation over the running state. Extending the
16
- * machine is adding a row, never editing control flow. The two extended
17
- * introducers are the only parametric cases and are handled by a small reader
18
- * that consumes their trailing parameters.
19
- *
20
- * The pipeline is three stages:
21
- * 1. {@link tokenizeSgr} splits the raw stream into an alternation of text runs
22
- * and SGR parameter lists ({@link SgrToken}s).
23
- * 2. {@link foldSgr} folds an SGR parameter list into the running
24
- * {@link SgrState} using the {@link SGR_CODE_TABLE} dispatch table.
25
- * 3. {@link paintSgr} drives the two over the whole stream, wrapping each text
26
- * run in a `<span>` whose class list and inline color style reflect the state
27
- * in force.
28
- *
29
- * The {@link SgrState} / {@link SgrToken} / {@link SgrMutation} vocabulary is the
30
- * briefing contract's; the SGR code meanings are the published standard's.
31
- */
32
- import { type SgrMutation, type SgrState, type SgrToken } from "../briefing/contract";
33
- /**
34
- * The read-only public view of the SGR dispatch table — each fixed-meaning SGR
35
- * code mapped to the {@link SgrMutation} it imposes. Exported so callers can
36
- * introspect the handled code space (the extended `38`/`48` introducers are not
37
- * present here; they are parametric and resolved by the painter).
38
- */
39
- export declare const SGR_CODE_TABLE: ReadonlyMap<number, SgrMutation>;
40
- /**
41
- * Fold one SGR parameter list into a running {@link SgrState}, returning the next
42
- * state.
43
- *
44
- * Walks the parameters left to right. A fixed-meaning code is resolved through
45
- * the {@link CODE_TABLE} and its mutation merged over the state. The two extended
46
- * introducers `38` (foreground) and `48` (background) are handled inline: the
47
- * reader consumes their trailing `5;n` or `2;r;g;b` parameters and the resolved
48
- * color is written to the matching channel. An empty list is the bare `ESC[m`
49
- * form and is treated as a reset, matching terminal behavior.
50
- *
51
- * Pure: the input state is never mutated; a fresh object is returned.
52
- *
53
- * @param state the style in force before this sequence
54
- * @param params the numeric parameter list of one SGR sequence
55
- */
56
- export declare function foldSgr(state: SgrState, params: readonly number[]): SgrState;
57
- /**
58
- * Split a raw terminal stream into an ordered list of {@link SgrToken}s.
59
- *
60
- * Scans for CSI sequences of the form `ESC [ … m`. Each such sequence becomes an
61
- * `sgr` token carrying its parsed numeric parameters (an empty selector yields an
62
- * empty list, the bare-reset form). The runs of ordinary characters between
63
- * sequences become `text` tokens. Non-SGR control sequences — any CSI whose final
64
- * byte is not `m`, plus bare escapes — are dropped: they carry cursor and screen
65
- * commands that have no place in flowed HTML, so swallowing them keeps the output
66
- * clean while preserving every printable character.
67
- *
68
- * Empty `text` runs are never emitted, so the token stream is dense.
69
- *
70
- * @param input the raw ANSI/terminal byte stream
71
- */
72
- export declare function tokenizeSgr(input: string): SgrToken[];
73
- /**
74
- * Paint an ANSI/terminal byte stream into a string of styled HTML spans.
75
- *
76
- * Drives the three stages end to end: tokenize the stream, fold each SGR sequence
77
- * into the running {@link SgrState}, and wrap each intervening text run in a span
78
- * reflecting the state in force when that run was emitted. Text is HTML-escaped;
79
- * non-SGR control sequences are dropped; runs under the neutral state are emitted
80
- * without a wrapping span. The result is safe to splice directly into a transcript
81
- * page.
82
- *
83
- * The state resets to {@link SGR_INITIAL_STATE} only on an explicit reset code (or
84
- * a bare `ESC[m`); it otherwise persists across text runs, so a color set once
85
- * stays in force until changed, exactly as a terminal renders it.
86
- *
87
- * @param input the raw ANSI/terminal byte stream to convert
88
- * @returns an HTML fragment of escaped text and styled `<span>`s
89
- */
90
- export declare function paintSgr(input: string): string;