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,103 +0,0 @@
1
- /**
2
- * Addon sandbox — the SINGLE jiti-backed {@link ModuleLoader}.
3
- *
4
- * This module turns a path on disk into a loaded {@link AddonManifest}. It is the
5
- * one place the app reaches a TypeScript-on-the-fly importer (`jiti`), and it is
6
- * the one place the framework namespaces an addon may `import` are bridged into
7
- * the addon's module graph. Two facts shape the design:
8
- *
9
- * 1. **A compiled binary has no `node_modules`.** When the app ships as a
10
- * single-file executable the framework code (`indusagi/agent`, `indusagi/ai`,
11
- * `indusagi/tui`) and `@sinclair/typebox` are already *inside* the binary —
12
- * an addon's `import "indusagi/agent"` cannot resolve against a directory
13
- * that does not exist on the host. The sandbox satisfies those specifiers
14
- * from the host's own statically-imported namespace objects (jiti's
15
- * `virtualModules`), so the addon shares the host's exact module instances
16
- * rather than loading a second copy.
17
- *
18
- * 2. **An interpreted launch has real files.** Under Node (or `bun run` over
19
- * source) the same specifiers resolve to real paths on disk; the sandbox
20
- * feeds those resolved paths to jiti as `alias` entries so the importer
21
- * finds them without re-walking `node_modules`.
22
- *
23
- * The literal set of bridged specifiers is the contract's {@link BUNDLED_NAMESPACES};
24
- * this module owns only the *mechanism* that maps each one to either a live
25
- * namespace object (virtual-module mode) or a resolved file path (alias mode).
26
- *
27
- * The loader is deliberately injectable: {@link createJitiLoader} is the default
28
- * {@link ModuleLoader}, but every consumer takes the interface, so a test can
29
- * inject a scripted fake that returns a manifest with no jiti and no disk.
30
- *
31
- * Path inputs are normalized through this module's own {@link expandPath} /
32
- * {@link resolvePath} helpers — home-directory expansion plus a from-scratch
33
- * invisible-whitespace scrub — written here rather than imported, so the loader
34
- * owns its full input-hygiene story.
35
- */
36
- import { type ModuleLoader } from "./contract";
37
- /**
38
- * Strip invisible / non-standard whitespace from a path string and trim ordinary
39
- * leading and trailing ASCII whitespace.
40
- *
41
- * Walks the string by code point (so astral characters survive intact), dropping
42
- * any member of {@link INVISIBLE_SET}, then trims the plain ASCII edges. Written
43
- * as an explicit scan rather than a regex so the exact handled set is visible at
44
- * the call site.
45
- *
46
- * @param raw the path as supplied (possibly carrying invisible characters)
47
- */
48
- export declare function scrubInvisible(raw: string): string;
49
- /**
50
- * Expand a leading `~` (or `~/`) to the user's home directory.
51
- *
52
- * Only a `~` that begins the (already-scrubbed) string is treated as the home
53
- * marker; a `~` anywhere else is an ordinary character. `~` alone becomes the
54
- * home directory; `~/x` becomes `<home>/x`. A `home` override is accepted for
55
- * tests and embedding so the function never reads the environment implicitly.
56
- *
57
- * @param raw the path, possibly beginning with a home marker
58
- * @param home the home directory to expand against; defaults to {@link homedir}
59
- */
60
- export declare function expandPath(raw: string, home?: string): string;
61
- /**
62
- * Resolve a path to an absolute, invisible-free path.
63
- *
64
- * Scrubs invisible whitespace, expands a leading home marker, then anchors the
65
- * result against `base` (the working directory) when it is not already absolute.
66
- * The single normalizer every loader entry funnels through, so input hygiene is
67
- * applied in exactly one place.
68
- *
69
- * @param raw the path as supplied
70
- * @param base the directory a relative path resolves against; defaults to `process.cwd()`
71
- * @param home the home directory `~` expands against; defaults to {@link homedir}
72
- */
73
- export declare function resolvePath(raw: string, base?: string, home?: string): string;
74
- /**
75
- * Options for {@link createJitiLoader}.
76
- *
77
- * All optional — the defaults wire the live runtime — but each is overridable so
78
- * a test can pin the working directory or home without touching the process. The
79
- * jiti instance itself is constructed from {@link jitiOptionsForRuntime}; these
80
- * options only steer how a supplied path is normalized before it is imported.
81
- */
82
- export interface JitiLoaderOptions {
83
- /** Directory a relative addon path resolves against; defaults to `process.cwd()`. */
84
- readonly base?: string;
85
- /** Home directory a leading `~` expands against; defaults to {@link homedir}. */
86
- readonly home?: string;
87
- }
88
- /**
89
- * Construct the default jiti-backed {@link ModuleLoader}.
90
- *
91
- * Creates one jiti instance — configured with the bridged framework namespaces
92
- * appropriate to the runtime (virtual modules in a compiled binary, resolved
93
- * aliases under Node) — and returns a loader whose {@link ModuleLoader.load}
94
- * normalizes the supplied path, imports it through jiti, and extracts the
95
- * {@link AddonManifest}. A module that does not expose a callable `register` is
96
- * rejected, so the host converts the rejection into a load fault.
97
- *
98
- * This is the production loader; tests inject a fake implementing the same
99
- * interface, exercising the registry/host without any real jiti or disk.
100
- *
101
- * @param options optional path-normalization overrides
102
- */
103
- export declare function createJitiLoader(options?: JitiLoaderOptions): ModuleLoader;
@@ -1,42 +0,0 @@
1
- /**
2
- * AddonSurface implementation — the recording registration API.
3
- *
4
- * This module realizes the contract's central design stance: an addon's
5
- * `register` entry point is handed a {@link AddonSurface} and *records* its
6
- * intent — event subscriptions, tool interceptors, slash commands, contributed
7
- * tools — rather than mutating any shared runtime. Each surface is a small,
8
- * per-addon accumulator: every `on` / `interceptTool` / `addCommand` / `addTool`
9
- * call appends to a private list, and {@link RecordingSurface.manifest} reads the
10
- * accumulated {@link RegisteredManifest} back out for the host to fold.
11
- *
12
- * Because registration is pure recording, the host stays in control of *what to
13
- * do* with the contributions. The surface only:
14
- *
15
- * - stamps every recorded shape with the owning {@link AddonId} (so a later
16
- * fault is attributable) and fills the `match` / `name` fields the surface
17
- * methods take separately from the handler object;
18
- * - threads the host-supplied {@link FrameworkHandles} through unchanged, so an
19
- * addon can act at registration time and the same handles reach its command
20
- * contexts; and
21
- * - returns an immutable snapshot from {@link RecordingSurface.manifest}, so a
22
- * read after `register` settles cannot be mutated by a stray later call.
23
- *
24
- * The surface performs no dispatch, no loading, and no conflict resolution —
25
- * those are the host's job once it has folded every addon's manifest. Keeping the
26
- * surface this thin is what makes registration a description of capability rather
27
- * than a side effect on the agent.
28
- */
29
- import type { AddonId, AddonSurface, FrameworkHandles } from "./contract";
30
- /**
31
- * Mint a fresh {@link AddonSurface} for one addon.
32
- *
33
- * The host calls this once per addon, scoping the surface to that addon's
34
- * {@link AddonId} and the session's {@link FrameworkHandles}, then passes the
35
- * surface to the addon's `register`. After `register` settles the host reads
36
- * {@link AddonSurface.manifest} to obtain the contributions to fold.
37
- *
38
- * @param id the addon the surface is scoped to
39
- * @param handles the framework handles the addon (and its commands) may act through
40
- * @param version optional addon version carried into the recorded manifest
41
- */
42
- export declare function createSurface(id: AddonId, handles: FrameworkHandles, version?: string): AddonSurface;
@@ -1,29 +0,0 @@
1
- /**
2
- * Disk-backed credential vault — the boot-layer adapter that satisfies the
3
- * launch {@link AuthVault} seam so the credential command can persist
4
- * credentials before the concrete Phase-2 multi-account vault lands.
5
- *
6
- * The store is a single JSON file (`auth.json` under the profile directory),
7
- * keyed provider → account → record. Each record is a discriminated union: it
8
- * holds *either* a stored api key *or* a set of browser-sign-in credentials, plus
9
- * a default marker. The adapter is deliberately small and self-contained: it
10
- * reads / writes the whole file each time (the file is tiny and the operations
11
- * are interactive, so atomic-rewrite simplicity beats incremental I/O).
12
- *
13
- * Two kinds of read are offered. The default-account lookup is plain bookkeeping;
14
- * {@link AuthVault.readUsableKey} resolves a record to a live api-key string — for
15
- * an api-key record it returns the stored key verbatim, and for a browser-sign-in
16
- * record it asks the framework to refresh an expired token (persisting the
17
- * rotated credentials back to disk) before handing back the usable key.
18
- *
19
- * This is *not* the Phase-2 vault — it is the minimal real persistence the
20
- * launch wiring needs. When the concrete multi-account vault arrives it replaces
21
- * this adapter at the one call site in {@link "./boot"}.
22
- */
23
- import type { AuthVault } from "../launch";
24
- /**
25
- * Build a disk-backed {@link AuthVault} persisting to `authPath`.
26
- *
27
- * @param authPath absolute path of the JSON credential store (e.g. `auth.json`)
28
- */
29
- export declare function createAuthVault(authPath: string): AuthVault;
@@ -1,26 +0,0 @@
1
- /**
2
- * Boot orchestrator — the single function the OS entry point calls.
3
- *
4
- * {@link boot} owns the whole launch arc: it assembles the seed
5
- * {@link BootContext} (resolved workspace + brand + a placeholder invocation),
6
- * runs the ordered {@link runStages | stage pipeline} to resolve the rest
7
- * (parse the command line, materialise directories, apply upgrades, build the
8
- * startup-resource graph), handles the meta requests (`--help` / `--version`)
9
- * that short-circuit before any runner, then dispatches to the
10
- * {@link selectRunner | selected runner} and returns its exit code.
11
- *
12
- * Cleanup is guaranteed: every teardown callback accumulated in
13
- * {@link BootContext.closables} is drained in a `finally`, latest-registered
14
- * first, regardless of how the runner resolved. {@link boot} itself never throws
15
- * to its caller for an expected failure — it maps problems to a non-zero exit
16
- * code so the entry point can simply set `process.exitCode`.
17
- */
18
- /**
19
- * Boot the agent: resolve everything, dispatch to the chosen runner, and return
20
- * the process exit code.
21
- *
22
- * @param argv The arguments the launch was invoked with, already sliced (no
23
- * node/exec path).
24
- * @returns The exit code the process should adopt.
25
- */
26
- export declare function boot(argv: string[]): Promise<number>;
@@ -1,15 +0,0 @@
1
- /**
2
- * Phase-1 boot layer — unit tests.
3
- *
4
- * No network, no real home directory: every test that touches disk runs under a
5
- * fresh sandbox home created in the OS temp dir and removed in `afterEach`. The
6
- * tests pin the public seams of the boot layer:
7
- *
8
- * - {@link tokenizeInvocation} maps flags to the right mode / prompt / model.
9
- * - `--help` is recognised and short-circuits {@link boot}.
10
- * - {@link createWorkspace} resolves all paths beneath an overridden home.
11
- * - {@link applyUpgrades} is idempotent (a second pass applies nothing).
12
- * - {@link runStages} produces a fully-resolved {@link BootContext}.
13
- * - {@link selectRunner} picks the placeholder runner for each mode.
14
- */
15
- export {};
@@ -1,236 +0,0 @@
1
- /**
2
- * Boot-layer contract — the FROZEN type surface of Phase 1.
3
- *
4
- * This module is the single typed seam between the operating-system entry point
5
- * (`entry.ts`) and everything that turns a command line into a running coding
6
- * agent. It declares *only* shapes — no behavior, no I/O, no literals beyond the
7
- * narrow string unions that pin the public modes. Every later boot module
8
- * (workspace locator, upgrade registry, stage pipeline, runner registry) is
9
- * written against the names declared here, so this file is intentionally small,
10
- * append-mostly, and stable.
11
- *
12
- * Design stance:
13
- * - One immutable {@link BootContext} is threaded through an ordered list of
14
- * {@link Stage} transforms; a stage returns the next context (or the same
15
- * one) and never mutates in place.
16
- * - All branding lives in a single {@link Brand} record and all on-disk paths
17
- * in a single {@link Workspace} object — there are no scattered free getters
18
- * and no string literals duplicated across the codebase.
19
- * - Where the rebuilt framework already owns a concept (the model catalog, the
20
- * user-settings shape), the resolved-resource graph is typed against the
21
- * framework's published types rather than re-declaring them here.
22
- *
23
- * Framework anchors (all from the `indusagi` package):
24
- * - `ModelRegistry` ← `indusagi/ai` — the resolved model catalog.
25
- * - `Settings` ← `indusagi/shell-app` — the user-tunable config shape.
26
- * - `ThinkingLevel` ← `indusagi/agent` — reasoning-effort vocabulary (re-exported
27
- * for convenience by boot consumers).
28
- */
29
- import type { ModelRegistry } from "indusagi/ai";
30
- import type { Settings } from "indusagi/shell-app";
31
- import type { ThinkingLevel } from "indusagi/agent";
32
- /** Re-exported framework reasoning vocabulary, surfaced through the boot contract. */
33
- export type { ThinkingLevel };
34
- /**
35
- * The single source of truth for every branding / identity literal.
36
- *
37
- * Nothing else in the app hard-codes the product name, the profile directory
38
- * name, the bin names, the environment-variable namespace, or the share-viewer
39
- * origin. Resolving these once into a frozen record means a rebrand touches one
40
- * value, never a grep across the tree.
41
- */
42
- export interface Brand {
43
- /** Product name used in banners and `process.title` (e.g. `"indusagi"`). */
44
- readonly name: string;
45
- /** Display label for human-facing surfaces; defaults to {@link name}. */
46
- readonly label: string;
47
- /** Profile directory leaf under the user's home (e.g. `".indusagi"`). */
48
- readonly profileDirName: string;
49
- /** Sub-directory of the profile holding the agent's own state (e.g. `"agent"`). */
50
- readonly stateDirName: string;
51
- /** The executable names this app installs as (both point at one entry). */
52
- readonly binNames: readonly [primary: string, alias: string];
53
- /** Environment-variable name prefix shared by all app-scoped vars (e.g. `"INDUSAGI"`). */
54
- readonly envPrefix: string;
55
- /** Env var overriding the resolved profile directory (e.g. `"INDUSAGI_CODING_AGENT_DIR"`). */
56
- readonly envProfileDir: string;
57
- /** Env var that, when set, disables transport-noise log filtering (e.g. `"INDUSAGI_DEBUG"`). */
58
- readonly envDebug: string;
59
- /** Env var overriding the share-viewer origin (e.g. `"INDUSAGI_SHARE_VIEWER_URL"`). */
60
- readonly envShareViewer: string;
61
- /** Default origin a published transcript links to. */
62
- readonly shareViewerUrl: string;
63
- }
64
- /**
65
- * Every resolved on-disk location the app reads or writes, as one immutable
66
- * record rather than a family of free `get*Path()` getters.
67
- *
68
- * All members are absolute paths already expanded against the user's home and
69
- * the active {@link Brand}; consumers join nothing further. A single object also
70
- * makes the layout trivially inspectable and swappable in tests.
71
- */
72
- export interface Workspace {
73
- /** Root profile directory, e.g. `~/.indusagi/agent`. */
74
- readonly profileDir: string;
75
- /** Merged-settings file (`settings.json`). */
76
- readonly settingsPath: string;
77
- /** Consolidated credential store (`auth.json`). */
78
- readonly authPath: string;
79
- /** Per-cwd transcript directory root (`sessions/`). */
80
- readonly sessionsDir: string;
81
- /** Custom model-catalog overrides (`models.json`). */
82
- readonly modelsPath: string;
83
- /** Provisioned native helper binaries (`bin/`, holds fd / rg). */
84
- readonly toolsDir: string;
85
- /** Alias for the managed-binary directory; equals {@link toolsDir}. */
86
- readonly binDir: string;
87
- /** User-authored prompt/command templates (`prompts/`). */
88
- readonly promptsDir: string;
89
- /** User-installed color themes (`themes/`). */
90
- readonly themesDir: string;
91
- /** Bundled HTML transcript-export template directory. */
92
- readonly exportTemplateDir: string;
93
- /** Verbose diagnostic log file path. */
94
- readonly debugLogPath: string;
95
- /** External MCP server configuration (`mcp-servers.json`). */
96
- readonly mcpConfigPath: string;
97
- /** Memory-feature configuration (`memory.json`). */
98
- readonly memoryConfigPath: string;
99
- /** Composio-integration configuration (`composio.json`). */
100
- readonly composioConfigPath: string;
101
- /** On-disk memory database (`memory.db`). */
102
- readonly memoryDbPath: string;
103
- }
104
- /**
105
- * The three top-level execution modes the boot layer can dispatch to.
106
- *
107
- * - `repl` — interactive terminal session.
108
- * - `oneshot` — single non-interactive request to stdout (text or JSON).
109
- * - `link` — headless JSON-RPC link for a driving parent process.
110
- */
111
- export type RunnerId = "repl" | "oneshot" | "link";
112
- /**
113
- * The parsed command line, reduced to what the boot layer needs to choose and
114
- * configure a {@link Runner}. This is the minimal Phase-1 shape; Phase 10 enriches
115
- * it with the full declarative flag surface. Raw, un-consumed tokens survive in
116
- * {@link rest} and loosely-typed switches in {@link flags} so nothing is lost
117
- * before the richer parser lands.
118
- */
119
- export interface Invocation {
120
- /** Resolved execution mode. */
121
- readonly mode: RunnerId;
122
- /** First user message / request text, when supplied positionally or via stdin. */
123
- readonly prompt?: string;
124
- /** Explicit model selector from the command line, if any (`--model` / `-m`). */
125
- readonly modelId?: string;
126
- /** Model to fall back to when the bound model is overloaded mid-turn (`--fallback-model`). */
127
- readonly fallbackModelId?: string;
128
- /** Working directory the run is scoped to; absent means the process cwd (`--cwd`). */
129
- readonly cwd?: string;
130
- /** Named credential account to authenticate with (`--account`). */
131
- readonly account?: string;
132
- /** Reasoning effort (`--thinking`): off / minimal / low / medium / high / xhigh. */
133
- readonly thinking?: string;
134
- /** Replacement system prompt (`--system`); a path is read as a file, else literal text. */
135
- readonly system?: string;
136
- /** Extra text appended after the system prompt (`--append-system`); path-or-literal. */
137
- readonly appendSystem?: string;
138
- /** Allow-list of built-in tool names (`--tools`); absent means the full deck. */
139
- readonly tools?: readonly string[];
140
- /** Disable every built-in tool (`--no-tools`). */
141
- readonly noTools?: boolean;
142
- /** External MCP endpoint config paths to attach (`--mcp`). */
143
- readonly mcp?: readonly string[];
144
- /** Open the resume picker before the session starts (`--resume` / `-r`). */
145
- readonly resume?: boolean;
146
- /** Auto-resume the most recent session in the cwd (`--continue` / `-c`). */
147
- readonly continueLatest?: boolean;
148
- /** Print the model catalog and exit (`--list-models`). */
149
- readonly listModels?: boolean;
150
- /** Optional substring filter for `--list-models`. */
151
- readonly listModelsFilter?: string;
152
- /** Parsed switches, keyed by canonical flag name (values intentionally loose). */
153
- readonly flags: Record<string, unknown>;
154
- /** Positional / pass-through tokens not consumed as flags. */
155
- readonly rest: string[];
156
- }
157
- /**
158
- * Placeholder for the resolved per-account credential graph.
159
- *
160
- * The rebuilt framework publishes no credential type, so the boot contract owns
161
- * an opaque, forward-declared shape here; Phase 2 replaces it with the concrete
162
- * multi-account credential vault. Kept deliberately structural (an indexable
163
- * bag) so a stage may attach it without the vault module existing yet.
164
- */
165
- export interface CredentialGraph {
166
- readonly [account: string]: unknown;
167
- }
168
- /**
169
- * The resolved settings / auth / model-registry graph assembled during startup.
170
- *
171
- * This is a Phase-1 placeholder: the fields are typed against the framework's
172
- * own published types where one exists ({@link Settings}, {@link ModelRegistry}),
173
- * and against an app-local placeholder ({@link CredentialGraph}) where the
174
- * framework does not yet own the concept. Later phases attach the loaded
175
- * extension/MCP graph onto the same object without changing these anchors.
176
- */
177
- export interface StartupResources {
178
- /** Merged user settings (framework-owned shape). */
179
- readonly settings: Settings;
180
- /** Resolved credentials per account (app-owned placeholder until Phase 2). */
181
- readonly auth: CredentialGraph;
182
- /** The resolved model catalog (framework-owned registry). */
183
- readonly models: ModelRegistry;
184
- }
185
- /**
186
- * The immutable value threaded through the {@link Stage} pipeline.
187
- *
188
- * Each stage receives a context and returns the next one; treat every field as
189
- * read-only and produce successors by spreading rather than mutating. The
190
- * resolved-resource graph is optional because early stages run before it exists.
191
- * {@link closables} accumulates teardown callbacks (open files, servers, MCP
192
- * clients) that the entry point drains in reverse on exit.
193
- */
194
- export interface BootContext {
195
- /** The process arguments the launch was invoked with (already sliced). */
196
- readonly argv: string[];
197
- /** Resolved on-disk layout. */
198
- readonly workspace: Workspace;
199
- /** Resolved identity literals. */
200
- readonly brand: Brand;
201
- /** Parsed command line. */
202
- readonly invocation: Invocation;
203
- /** Resolved settings/auth/model graph; absent until the resource stage runs. */
204
- readonly resources?: StartupResources;
205
- /** Teardown callbacks to drain on shutdown (latest-registered first). */
206
- readonly closables: Array<() => Promise<void>>;
207
- }
208
- /**
209
- * One step of the launch pipeline: a named, pure-ish transform over a context
210
- * value of type `C` (defaulting to {@link BootContext}).
211
- *
212
- * A stage may return its result synchronously or asynchronously. It must not
213
- * mutate its input; it returns the next context. The `name` is used for tracing
214
- * and error attribution when a stage throws.
215
- */
216
- export interface Stage<C = BootContext> {
217
- /** Stable identifier for tracing and error messages. */
218
- readonly name: string;
219
- /** Transform the context, yielding its successor. */
220
- apply(ctx: C): Promise<C> | C;
221
- }
222
- /**
223
- * A terminal execution strategy for one {@link RunnerId} mode.
224
- *
225
- * The runner registry asks each runner whether it {@link accepts} a parsed
226
- * {@link Invocation}; the first match runs. {@link run} drives the selected mode
227
- * to completion and resolves to the process exit code.
228
- */
229
- export interface Runner {
230
- /** The mode this runner serves. */
231
- readonly id: RunnerId;
232
- /** Whether this runner handles the given invocation. */
233
- accepts(inv: Invocation): boolean;
234
- /** Execute the mode; resolves to the process exit code. */
235
- run(ctx: BootContext): Promise<number>;
236
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * Boot subsystem — public barrel.
3
- *
4
- * Re-exports the frozen Phase-1 contract type surface plus the assembled boot
5
- * layer: the orchestrator ({@link boot}), the stage pipeline
6
- * ({@link runStages} / {@link STAGES}), the invocation parser
7
- * ({@link tokenizeInvocation}), the runner registry ({@link selectRunner} /
8
- * {@link RUNNERS}), and the upgrade driver ({@link applyUpgrades}). Consumers
9
- * import the boot type surface and behavior from `src/boot` rather than reaching
10
- * into individual modules.
11
- */
12
- export type { Brand, Workspace, Invocation, RunnerId, BootContext, Stage, Runner, StartupResources, CredentialGraph, ThinkingLevel, } from "./contract";
13
- export { boot } from "./boot";
14
- export { runStages, STAGES, locateWorkspace, upgrade, buildInvocation, resolveResources, selectRunnerStage, } from "./stages";
15
- export { tokenizeInvocation, wantsHelp, wantsVersion, } from "./invocation";
16
- export { replRunner, oneshotRunner, linkRunner, RUNNERS, selectRunner, createReadStateStore, READ_STATE_HANDLE_KEY, ReadStateStore, createCheckpointStore, CHECKPOINT_HANDLE_KEY, CheckpointStore, } from "./runners";
17
- export type { Upgrade, UpgradeReport } from "./upgrade";
18
- export { applyUpgrades, UPGRADES } from "./upgrade";
19
- export { BRAND, createWorkspace, ensureDirs } from "../workspace";
20
- export type { WorkspaceOverrides } from "../workspace";
@@ -1,40 +0,0 @@
1
- /**
2
- * Invocation reader for the boot layer — the adapter that drives the full
3
- * Phase-10 declarative flag grammar and projects its rich result down onto the
4
- * thin boot {@link Invocation} the runner pipeline routes on.
5
- *
6
- * The parsing itself is no longer owned here. {@link readInvocation} (from the
7
- * `launch/` subsystem) walks the single declarative flag table and produces the
8
- * full {@link LaunchInvocation}; this module's job is purely the *projection*:
9
- * map the launch {@link OutputMode} onto the boot {@link RunnerId}, rename the
10
- * resolved fields the boot layer reads (`model` → `modelId`, `positionals` →
11
- * `rest`), and widen the typed flag bag back to the loose
12
- * `Record<string, unknown>` the boot {@link Invocation} carries. The result is
13
- * type-compatible with the rest of the boot pipeline, so the runner registry and
14
- * the session helpers consume it unchanged.
15
- *
16
- * - mode: `text` → `repl`, `json` → `oneshot`, `rpc` → `link`.
17
- * - the full flag bag survives on {@link Invocation.flags} so the meta checks
18
- * (`--help` / `--version`) and the oneshot output-shape probe (`json`) keep
19
- * reading the same canonical keys they always did.
20
- *
21
- * The parse is total and never throws: the launch reader tolerates unknown
22
- * `--flags` as boolean switches in the flag bag rather than rejecting them, so
23
- * nothing is silently dropped before a later phase can reinterpret it.
24
- */
25
- import type { Invocation } from "./contract";
26
- /**
27
- * Read a sliced `process.argv` into the boot {@link Invocation}.
28
- *
29
- * Delegates the actual grammar to the launch {@link readInvocation} (the one
30
- * declarative flag table), then projects its result onto the boot shape. The
31
- * boot layer thus shares one parser with the launch subsystem — help, parsing,
32
- * and routing can no longer drift.
33
- *
34
- * @param argv The already-sliced argument vector (no node/exec path).
35
- */
36
- export declare function tokenizeInvocation(argv: readonly string[]): Invocation;
37
- /** Whether the parsed invocation is asking for the help banner. */
38
- export declare function wantsHelp(inv: Invocation): boolean;
39
- /** Whether the parsed invocation is asking for the version string. */
40
- export declare function wantsVersion(inv: Invocation): boolean;
@@ -1,8 +0,0 @@
1
- /**
2
- * Tests for the launch→boot invocation projection ({@link tokenizeInvocation}).
3
- *
4
- * The boot `Invocation` is what every runner consumes, so these assert that each
5
- * CLI flag survives the parse + projection and lands on the typed field the
6
- * runners read — the exact step where the full flag surface used to be dropped.
7
- */
8
- export {};
@@ -1,103 +0,0 @@
1
- /**
2
- * Boot helper: activate the addon host for a session and fold its tool
3
- * interceptors around the deck.
4
- *
5
- * The {@link createAddonHost addon host} is the product's extension mechanism —
6
- * locally-authored modules under `<cwd>/.indus/addons` that graft tools, slash
7
- * commands, lifecycle observers, and tool-boundary interceptors onto a running
8
- * session. The host itself is fully built and tested, but until this module it
9
- * was never *instantiated* outside its own unit tests: nothing in the boot path
10
- * discovered, loaded, or wired addons.
11
- *
12
- * This module closes that gap with two narrow seams the runners call once at
13
- * session-assembly time:
14
- *
15
- * 1. {@link buildAddonHost} — construct a host, swallow its fault stream (a
16
- * broken addon must never sink the session), and {@link AddonHost.loadAll
17
- * load} every addon discovered under the run's `.indus/addons` directory.
18
- * With no such directory the returned {@link AddonSurfaceBundle} is empty —
19
- * no interceptors, no contributed tools — so wiring it is a perfect no-op.
20
- * 2. {@link wrapToolsWithAddons} — fold the bundle's
21
- * {@link InterceptorChain} around every tool whose name a stage matches,
22
- * leaving the rest identity-equal. A wrapped tool runs the chain's
23
- * `enter` → real `execute` → `exit` reduce; an `enter` block short-circuits
24
- * to an `isError` result without ever invoking the real tool.
25
- *
26
- * Scope (v1): only the per-tool interceptor boundary is wired. The richer
27
- * lifecycle-event fan-out (`session:start`, `turn:end`, …) needs a conductor
28
- * seam that does not exist yet and is deferred. The tool interceptor boundary is
29
- * the load-bearing one — it is where the Wave 4 permission gate later registers
30
- * as a built-in interceptor rather than a parallel mechanism.
31
- */
32
- import { type AddonSurfaceBundle, type AgentTool, type InterceptorChain } from "../../addons";
33
- import type { BootContext } from "../contract";
34
- /**
35
- * Build and populate the addon host for a run, returning its wired
36
- * {@link AddonSurfaceBundle}.
37
- *
38
- * Constructs a host with an empty {@link FrameworkHandles} bag (v1 supplies no
39
- * `exec` handle — the runner has no shell-exec callback to hand an addon — and
40
- * the rest are interactive-only), installs a swallow-everything fault sink so a
41
- * broken addon degrades silently instead of crashing the boot, then discovers
42
- * and loads every addon under `<cwd>/.indus/addons` (the contract's default
43
- * {@link ADDONS_DIR}). With no addons directory the bundle is empty and wiring it
44
- * downstream is a no-op.
45
- *
46
- * @param ctx the boot context whose invocation carries the run cwd
47
- * @returns the wired bundle (dispatch, interceptors, contributed commands/tools)
48
- */
49
- export declare function buildAddonHost(ctx: BootContext): Promise<AddonSurfaceBundle>;
50
- /**
51
- * Fold a bundle's {@link InterceptorChain} around every tool a stage matches.
52
- *
53
- * Each tool whose `name` the chain matches is replaced with a wrapper that runs
54
- * the chain around its real `execute`; every other tool is returned *identical*
55
- * (same object reference) so an empty bundle leaves the deck untouched. The
56
- * contributed `bundle.tools` are NOT appended here — the caller concatenates
57
- * them (de-duped against the existing deck) before wrapping, so addon tools are
58
- * themselves subject to interception.
59
- *
60
- * @param tools the run's tool deck (deck + MCP + already-concatenated addon tools)
61
- * @param bundle the loaded addon bundle whose interceptor chain wraps the deck
62
- * @returns a new array: matched tools wrapped, unmatched tools identity-equal
63
- */
64
- export declare function wrapToolsWithAddons(tools: AgentTool[], bundle: AddonSurfaceBundle): AgentTool[];
65
- /**
66
- * Wrap one tool so its `execute` runs through the interceptor chain.
67
- *
68
- * The wrapper spreads the original tool (preserving `name` / `description` /
69
- * `parameters` / `label` and any extra fields) and overrides only `execute`. The
70
- * override:
71
- *
72
- * - closes over the live `toolCallId`, `signal`, and `onUpdate` so streaming
73
- * updates and cancellation still reach the real tool (the chain only threads
74
- * the decoded `args`, so these must be captured here);
75
- * - hands the chain a `(args) => realExecute(args)` closure as the inner
76
- * execution and runs `chain.run({ tool, callId, args }, …)`;
77
- * - maps the resulting {@link InterceptResult} back to an
78
- * {@link AgentToolResult}: a `blocked` enter short-circuits to an `isError`
79
- * result carrying the gate's `reason` (the real tool never ran); otherwise
80
- * the chain's (possibly exit-rewritten) `result` is returned.
81
- *
82
- * The chain — not this wrapper — owns fault isolation and the throw-on-no-recover
83
- * semantics, so a tool error that no exit stage recovers propagates exactly as it
84
- * would unwrapped.
85
- *
86
- * @param tool the real tool to fold the chain around
87
- * @param chain the interceptor chain matching this tool's name
88
- */
89
- export declare function wrapOne(tool: AgentTool, chain: InterceptorChain): AgentTool;
90
- /**
91
- * Concatenate an addon bundle's contributed tools onto an existing deck, dropping
92
- * any whose name a deck tool already claims.
93
- *
94
- * The host de-dupes its OWN tools against each other, but not against the product
95
- * deck or MCP tools — so an addon tool named `read` would otherwise shadow (or
96
- * be appended alongside) the core read tool. This filter keeps the first
97
- * claimant (the existing deck) and admits only addon tools with a fresh name.
98
- *
99
- * @param deck the existing tool deck (deck + MCP)
100
- * @param bundle the loaded addon bundle whose `tools` are appended
101
- * @returns the deck followed by the non-conflicting addon tools
102
- */
103
- export declare function concatAddonTools(deck: AgentTool[], bundle: AddonSurfaceBundle): AgentTool[];
@@ -1,19 +0,0 @@
1
- /**
2
- * Addon wiring — boot-time activation of the addon host (item #19).
3
- *
4
- * These tests exercise the two seams this module adds to the boot path WITHOUT a
5
- * real conductor, real jiti, or disk: a fake {@link ModuleLoader} maps a source
6
- * path to a scripted {@link AddonManifest}, the host loads it through
7
- * `explicitPaths` (which never touches the filesystem), and the resulting bundle
8
- * is folded around a synthetic tool deck.
9
- *
10
- * Four concerns:
11
- * 1. An `enter` block short-circuits the call — the wrapper returns an
12
- * `isError` result carrying the gate reason and the real `execute` NEVER
13
- * runs.
14
- * 2. An `exit` rewrite replaces the tool's result.
15
- * 3. A tool no interceptor matches is returned IDENTITY-equal (the empty-bundle
16
- * / no-addons path is a perfect no-op).
17
- * 4. Contributed addon tools are concatenated, de-duped against the deck.
18
- */
19
- export {};