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,10 +0,0 @@
1
- /**
2
- * Skills-surface wiring (#7 / fixes #11).
3
- *
4
- * Proves the chain that makes on-disk `SKILL.md` cards visible to the model:
5
- * `gatherModelSkills` walks `cwd/.indusagi/skills`, drops any card flagged
6
- * `disable-model-invocation`, and the survivors render into the briefing's
7
- * `<available_skills>` block via `composeSystem`. A `--system` override must NOT
8
- * carry the skills block (it replaces the whole prompt).
9
- */
10
- export {};
@@ -1,92 +0,0 @@
1
- /**
2
- * Boot stage pipeline — the ordered list of {@link Stage} transforms that turn a
3
- * bare {@link BootContext} (argv + workspace + brand) into a fully-resolved one
4
- * (parsed invocation, materialised directories, applied upgrades, resolved
5
- * startup resources, selected runner).
6
- *
7
- * The pipeline is data, not control flow: {@link STAGES} lists each step in order,
8
- * and {@link runStages} folds an *immutable* context through them — every stage
9
- * receives a context and returns its successor (built by spreading, never by
10
- * mutating). A stage may be async; the fold awaits each in turn so ordering and
11
- * side-effect sequencing are deterministic.
12
- *
13
- * Stage order and intent:
14
- * 1. `locate-workspace` — materialise the resolved {@link Workspace} on disk
15
- * (`createWorkspace` + `ensureDirs`). Pure path computation already happened
16
- * when the initial context was built; this stage only `mkdir`s.
17
- * 2. `apply-upgrades` — fold the idempotent {@link applyUpgrades} registry
18
- * over the workspace (a no-op on an already-current profile).
19
- * 3. `build-invocation` — parse `argv` into the typed {@link Invocation}.
20
- * 4. `resolve-resources` — best-effort construct the framework
21
- * settings/auth/model graph; degrade to a minimal object if the framework
22
- * pieces are unavailable.
23
- * 5. `select-runner` — no-op transform that exists for symmetry and tracing
24
- * (the actual dispatch happens in {@link "./boot"} after the pipeline, so the
25
- * selected runner can own the exit code). Kept in the list so the ordered
26
- * pipeline reads as the full launch sequence.
27
- */
28
- import type { BootContext, Stage } from "./contract";
29
- /**
30
- * Materialise the resolved workspace directories on disk.
31
- *
32
- * The {@link BootContext.workspace} was already computed (pure) when the initial
33
- * context was assembled; this stage only ensures the directory subset exists so
34
- * later stages and runners can write into it. Returns the same context (the
35
- * workspace record is unchanged — only the filesystem side-effects happen here).
36
- */
37
- declare const locateWorkspace: Stage;
38
- /**
39
- * Run any pending one-time profile upgrades, idempotently.
40
- *
41
- * Folds the upgrade registry over the workspace. The driver is non-fatal: a step
42
- * that fails is reported and retried on a later launch, never aborting boot. The
43
- * context is returned unchanged (upgrades touch the filesystem, not the context).
44
- */
45
- declare const upgrade: Stage;
46
- /**
47
- * Parse `argv` into the typed {@link Invocation} and thread it onto the context.
48
- *
49
- * The initial context carries a placeholder invocation (the bootstrapper cannot
50
- * know the mode before parsing); this stage replaces it with the real parse.
51
- */
52
- declare const buildInvocation: Stage;
53
- /**
54
- * Best-effort assembly of the startup resource graph.
55
- *
56
- * Where the rebuilt framework owns a concept, the field is constructed from it:
57
- * {@link StartupResources.settings} from the framework's `DEFAULT_SETTINGS`, and
58
- * {@link StartupResources.models} from the framework's `ModelRegistry`. The
59
- * credential graph has no framework type yet, so it is an empty placeholder until
60
- * Phase 2. If a framework piece cannot be loaded, the stage degrades to a minimal
61
- * resources object built from empty literals rather than failing the boot — the
62
- * shape is what later phases depend on, and they fill it in.
63
- */
64
- declare const resolveResources: Stage;
65
- /**
66
- * Marker / tracing stage for runner selection.
67
- *
68
- * The real dispatch is performed by {@link "./boot"} after the pipeline so the
69
- * chosen runner can own the process exit code; this stage exists to keep the
70
- * ordered pipeline a faithful description of the launch sequence and to give the
71
- * selection step a name for tracing. It returns the context unchanged.
72
- */
73
- declare const selectRunnerStage: Stage;
74
- /**
75
- * The launch pipeline, in execution order. Folded by {@link runStages}.
76
- */
77
- export declare const STAGES: readonly Stage[];
78
- /**
79
- * Fold an ordered list of {@link Stage} transforms over an immutable
80
- * {@link BootContext}.
81
- *
82
- * Each stage receives the current context and returns its successor; the result
83
- * of one stage is the input to the next. Awaits every stage so async ordering is
84
- * deterministic. The input `initial` is never mutated — stages produce new
85
- * contexts by spreading.
86
- *
87
- * @param initial The seed context (argv + workspace + brand + placeholder fields).
88
- * @param stages The ordered transforms to apply; defaults to {@link STAGES}.
89
- * @returns The fully-resolved context after every stage has run.
90
- */
91
- export declare function runStages(initial: BootContext, stages?: readonly Stage[]): Promise<BootContext>;
92
- export { locateWorkspace, upgrade, buildInvocation, resolveResources, selectRunnerStage, };
@@ -1,45 +0,0 @@
1
- /**
2
- * Upgrade driver — folds the ordered {@link UPGRADES} registry over a
3
- * {@link Workspace}, exactly once per step.
4
- *
5
- * The driver is the only place that knows about the *marker file*: a small JSON
6
- * record under the profile directory listing the ids of upgrades that have
7
- * already run. Each registry step is skipped if its id is present in the marker;
8
- * otherwise it is applied and, on success, its id is appended and the marker is
9
- * persisted. A step that throws is *not* recorded (so it is retried next launch)
10
- * and is reported as a warning rather than aborting the remaining steps — one
11
- * bad migration must never wedge startup.
12
- *
13
- * The result is purely informational: {@link UpgradeReport.applied} lists ids run
14
- * *this* invocation (empty on an already-current profile), and
15
- * {@link UpgradeReport.warnings} carries human-readable notes for any step that
16
- * failed. Callers typically log both and continue.
17
- */
18
- import type { Workspace } from "../contract";
19
- /**
20
- * The outcome of an {@link applyUpgrades} pass.
21
- *
22
- * - `applied` — ids of upgrades that ran successfully *this* invocation, in
23
- * apply order. Empty when the profile was already current.
24
- * - `warnings` — one entry per step that threw, naming the step and its error.
25
- * Non-fatal: applying continues past a failed step.
26
- */
27
- export interface UpgradeReport {
28
- /** Ids successfully applied during this call, in order. */
29
- readonly applied: string[];
30
- /** Human-readable notes for steps that failed (non-fatal). */
31
- readonly warnings: string[];
32
- }
33
- /**
34
- * Apply every not-yet-applied upgrade in {@link UPGRADES}, in registry order,
35
- * recording each success in the marker file so it never runs again.
36
- *
37
- * Steps already named in the marker are skipped. A step that throws is recorded
38
- * as a warning, left unmarked (so it is retried on a later launch), and does not
39
- * block the remaining steps. The marker is rewritten after each success, so a
40
- * crash mid-pass still preserves the progress made so far.
41
- *
42
- * @param ws The resolved, absolute on-disk layout to upgrade.
43
- * @returns The ids applied this pass and any non-fatal warnings.
44
- */
45
- export declare function applyUpgrades(ws: Workspace): Promise<UpgradeReport>;
@@ -1,13 +0,0 @@
1
- /**
2
- * Upgrade subsystem — public barrel.
3
- *
4
- * Surfaces the ordered, idempotent profile-upgrade registry and its driver.
5
- * Boot consumers import {@link applyUpgrades} to run pending one-time migrations
6
- * and the {@link UPGRADES} registry / {@link Upgrade} type for inspection and
7
- * testing. The marker-file bookkeeping is an internal detail of the driver and
8
- * is not re-exported.
9
- */
10
- export type { Upgrade } from "./upgrades";
11
- export { UPGRADES, foldCredentials, reshelveTranscripts, relocateBinaries, renamePromptDir, projectTranscriptDirName, } from "./upgrades";
12
- export type { UpgradeReport } from "./apply";
13
- export { applyUpgrades } from "./apply";
@@ -1,126 +0,0 @@
1
- /**
2
- * Upgrade registry — the ordered, idempotent catalog of one-time profile
3
- * migrations.
4
- *
5
- * This module replaces a bag of magic constants and inlined `try/catch`
6
- * migration blocks with a *registry*: an explicit, ordered list of named
7
- * {@link Upgrade} steps. Each step owns a stable {@link Upgrade.id}, a one-line
8
- * {@link Upgrade.describe}, and an idempotent {@link Upgrade.apply}. The driver
9
- * ({@link "./apply"}) folds over the list in order, recording the ids it has run
10
- * in a marker file so a step never runs twice — re-running the whole registry on
11
- * an already-upgraded profile is a no-op.
12
- *
13
- * Idempotence contract (every step must honor it):
14
- * - Detect "already done" cheaply and return early without side effects.
15
- * - Treat a *missing* source (the thing being migrated from) as success — the
16
- * profile is either fresh or already past this point.
17
- * - Never destroy data: relocations move-or-skip, never overwrite a live
18
- * destination; the legacy source is suffixed, not deleted.
19
- *
20
- * The seeded steps fold the legacy on-disk layout into the current one:
21
- * 1. {@link foldCredentials} — legacy split auth → one secure `auth.json`.
22
- * 2. {@link reshelveTranscripts} — loose session files → per-cwd `sessions/`.
23
- * 3. {@link relocateBinaries} — managed `fd`/`rg` helpers → the `bin/` dir.
24
- * 4. {@link renamePromptDir} — legacy `commands/` dir → `prompts/`.
25
- *
26
- * Session-directory encoding note: step 2 must place a transcript under the
27
- * *same* per-cwd directory name the framework's session manager would compute.
28
- * The framework publishes no standalone encoder for that name (the encoding is
29
- * private to its session manager), so this module uses a clearly-named local
30
- * helper, {@link projectTranscriptDirName}, rather than re-deriving the
31
- * framework's private per-cwd directory encoding. If the framework later exports
32
- * an encoder, swap the helper for the import without touching the step logic.
33
- */
34
- import type { Workspace } from "../contract";
35
- /**
36
- * One ordered, idempotent profile-layout upgrade.
37
- *
38
- * An upgrade is pure data plus one async effect. The registry order is the
39
- * apply order; the {@link id} is the durable key recorded in the marker file
40
- * once {@link apply} completes, so it must be stable across releases (renaming an
41
- * id re-runs the step). {@link apply} must be safe to invoke against a profile in
42
- * any state — fresh, partially-migrated, or fully-migrated.
43
- */
44
- export interface Upgrade {
45
- /** Durable identifier recorded once this step has run. Never rename. */
46
- readonly id: string;
47
- /** One-line human summary for logs and `--verbose` output. */
48
- readonly describe: string;
49
- /**
50
- * Perform the upgrade against the resolved {@link Workspace}. Must be
51
- * idempotent: detect "already applied" and return without side effects.
52
- *
53
- * @param ws The resolved, absolute on-disk layout.
54
- */
55
- apply(ws: Workspace): Promise<void>;
56
- }
57
- /**
58
- * Compute the per-project transcript sub-directory *name* for a working
59
- * directory.
60
- *
61
- * This deliberately does not reproduce the framework session manager's private
62
- * encoding character-for-character; the framework exposes no public encoder to
63
- * import, so this is the documented local fallback. It produces a single,
64
- * filesystem-safe directory leaf that is stable for a given absolute `cwd`:
65
- * path separators, drive colons, and any other non-portable characters collapse
66
- * to a single token, and a short content hash is appended so two distinct paths
67
- * that happen to fold to the same token never collide.
68
- *
69
- * The output is used only when *relocating a loose legacy transcript* into the
70
- * sessions tree; live sessions are always created by the framework itself, so
71
- * this helper never competes with the framework for the canonical name.
72
- *
73
- * @param cwd Absolute working directory the transcript belongs to.
74
- * @returns A safe directory leaf such as `proj-Users-me-app-1a2b3c4d`.
75
- */
76
- export declare function projectTranscriptDirName(cwd: string): string;
77
- /**
78
- * Fold a legacy split credential layout — a standalone `oauth.json` plus an
79
- * `apiKeys` block embedded in `settings.json` — into the single consolidated
80
- * `auth.json`, written with owner-only (`0o600`-equivalent) permissions.
81
- *
82
- * Idempotent: if `auth.json` already exists, nothing is touched. After a
83
- * successful fold the legacy `oauth.json` is suffixed (`oauth.json.retired`) and
84
- * the `apiKeys` block is removed from `settings.json`, so a second run finds no
85
- * legacy sources and the existing `auth.json` short-circuits it regardless.
86
- */
87
- export declare const foldCredentials: Upgrade;
88
- /**
89
- * Relocate loose `*.jsonl` transcripts that were written directly under the
90
- * profile root (a legacy layout) into the structured per-cwd sessions tree:
91
- * `sessions/<projectDirName>/<file>`.
92
- *
93
- * A loose file is recognized as a transcript by a first-line header of
94
- * `type: "session"`. The destination project directory is derived from the
95
- * header's recorded `cwd` via {@link projectTranscriptDirName} (the framework
96
- * owns no public encoder to delegate to — see this module's header). Each move
97
- * is skip-on-clobber, so re-running never overwrites an already-relocated
98
- * transcript, and once no loose transcripts remain the step is a pure no-op.
99
- */
100
- export declare const reshelveTranscripts: Upgrade;
101
- /**
102
- * Relocate the managed native helper binaries (`fd`, `rg`, and their Windows
103
- * `.exe` forms) from the legacy `tools/` directory into the canonical managed
104
- * `bin/` directory ({@link Workspace.binDir}).
105
- *
106
- * Each binary is moved skip-on-clobber and independently, so a partially-moved
107
- * state self-heals on the next run and an already-relocated layout (or a fresh
108
- * install with no legacy `tools/`) is a no-op.
109
- */
110
- export declare const relocateBinaries: Upgrade;
111
- /**
112
- * Rename the legacy command-template directory (`commands/`) to the current
113
- * prompt-template directory ({@link Workspace.promptsDir}).
114
- *
115
- * Idempotent: if the destination already exists the rename is skipped (the
116
- * profile is already on the current layout), and if the legacy directory is
117
- * absent there is nothing to do. The rename is whole-directory and
118
- * non-destructive — a live `prompts/` is never replaced.
119
- */
120
- export declare const renamePromptDir: Upgrade;
121
- /**
122
- * The ordered list of upgrades. Apply order is array order; ids are the durable
123
- * marker keys. Append new steps to the end — never reorder or rename existing
124
- * ids, as that would re-run already-applied migrations.
125
- */
126
- export declare const UPGRADES: readonly Upgrade[];
@@ -1,15 +0,0 @@
1
- /**
2
- * Briefing subsystem — Phase 9 behavioral tests.
3
- *
4
- * Three concerns, exercised purely (the only I/O is one temp `SKILL.md`):
5
- * 1. {@link composeBriefing} — the declarative section pipeline emits the
6
- * ordered sections rendered in this rebuild's OWN voice (we assert on our
7
- * section headings and re-authored guidance, never on any carried-over
8
- * upstream sentence).
9
- * 2. {@link scanMacroBody} / {@link applyMacros} — the single-pass `$arg`
10
- * scanner substitutes `$name` and `${name}` forms in one left-to-right scan
11
- * and leaves unknown tokens as literal text.
12
- * 3. {@link loadSkillCards} — a sample `SKILL.md` under a tmpdir parses into a
13
- * validated CapabilityCard.
14
- */
15
- export {};
@@ -1,37 +0,0 @@
1
- /**
2
- * Briefing composer — the declarative system-prompt pipeline.
3
- *
4
- * The system prompt is assembled from an ordered list of {@link BriefingSection}
5
- * descriptors, not a string template with `{{TOKEN}}` holes. Each section decides
6
- * for itself whether it contributes to a given {@link BriefingContext} (its
7
- * `applies` predicate) and renders its own fragment (its `render`). The composer
8
- * is a small reducer: it walks the recipe in order, keeps the applicable
9
- * sections, renders them, drops empties, and joins with blank-line gaps. Adding,
10
- * removing, or reordering a section is a data edit to {@link BRIEFING_SECTIONS},
11
- * never a change to the composer.
12
- *
13
- * Every guideline, tool note, and heading below is authored for this rebuild.
14
- * The *set* of sections (role, tools, working guidance, task tracking, delegates,
15
- * connectors, project context, skills, footer) follows the well-known coding-
16
- * agent shape; the wording is the briefing's own.
17
- */
18
- import type { Briefing, BriefingContext, BriefingInputs } from "./contract";
19
- /**
20
- * The default briefing recipe, in render order. Swap or reorder entries to
21
- * reshape the prompt without touching {@link composeBriefing}.
22
- */
23
- export declare const BRIEFING_SECTIONS: Briefing;
24
- /**
25
- * Fold a section recipe and a context into the final briefing string.
26
- *
27
- * Accepts either a plain {@link BriefingContext} (using the default
28
- * {@link BRIEFING_SECTIONS} recipe) or a full {@link BriefingInputs} bundle that
29
- * names its own sections and optional `prelude` / `append` text. The composer
30
- * keeps each section whose `applies` predicate is satisfied (or absent), renders
31
- * it, discards empty fragments, and joins the rest with blank-line gaps. Optional
32
- * `prelude` and `append` bracket the rendered sections.
33
- *
34
- * @param input either the render context, or a full inputs bundle
35
- * @returns the assembled system-prompt string
36
- */
37
- export declare function composeBriefing(input: BriefingContext | BriefingInputs): string;
@@ -1,38 +0,0 @@
1
- /**
2
- * Project-context document loader — gathers repository convention files
3
- * (CLAUDE.md / AGENTS.md and brand variants) into {@link ContextDoc}s that the
4
- * briefing's `PROJECT_CONTEXT_SECTION` inlines under `# Project context`.
5
- *
6
- * The walk runs the ancestor chain from the filesystem root down to the cwd, so
7
- * the cwd's own files land LAST in the returned array — and since the renderer
8
- * treats array order as priority order, the closest (most specific) file wins.
9
- * The home directory is scanned after the chain as a global fallback. Each file
10
- * may pull additional files inline via `@import` references (bounded to a depth
11
- * of {@link DEFAULT_MAX_IMPORT_DEPTH} with a per-walk realpath guard so cycles
12
- * and symlink loops cannot recurse or hang).
13
- *
14
- * The whole body is wrapped so that a permissions error on one ancestor, a
15
- * binary file, or a malformed tree degrades to `[]` rather than crashing boot —
16
- * repo conventions are a best-effort enrichment, never a hard dependency.
17
- */
18
- import type { ContextDoc } from "./contract";
19
- /** Options for {@link gatherContextDocs}. Every field is optional. */
20
- export interface GatherContextDocsOptions {
21
- /** Maximum `@import` recursion depth. Defaults to {@link DEFAULT_MAX_IMPORT_DEPTH}. */
22
- readonly maxImportDepth?: number;
23
- /** Maximum bytes retained per document body (post-trim). Defaults to {@link DEFAULT_MAX_BYTES_PER_DOC}. */
24
- readonly maxBytesPerDoc?: number;
25
- }
26
- /**
27
- * Gather the repository's project-context documents into an ordered
28
- * {@link ContextDoc} array for the briefing.
29
- *
30
- * Order: the ancestor chain from root → cwd (so cwd's files land last = highest
31
- * priority), then the home directory as a global fallback. Within each directory
32
- * the {@link CANDIDATE_FILES} are read in their listed order. Each file may pull
33
- * `@import` children inline (depth-bounded, cycle-guarded). De-duplication is by
34
- * realpath, so a file reachable through two roots is inlined once.
35
- *
36
- * Never throws: any failure in the walk yields the docs gathered so far (or `[]`).
37
- */
38
- export declare function gatherContextDocs(cwd: string, home: string, opts?: GatherContextDocsOptions): readonly ContextDoc[];
@@ -1,18 +0,0 @@
1
- /**
2
- * Project-context loader — colocated unit tests.
3
- *
4
- * Every test runs against a fresh tmpdir tree (the `src/boot/boot.test.ts`
5
- * sandbox pattern): no real home directory, no network. The realpath of the
6
- * tmpdir base is taken up front because macOS resolves `/var/folders` → a
7
- * `/private/...` symlink, which the loader's realpath de-dup would otherwise
8
- * surface in path assertions.
9
- *
10
- * Pinned behaviors:
11
- * - a cwd CLAUDE.md body is inlined;
12
- * - an ancestor AGENTS.md orders BEFORE the cwd doc (cwd = highest priority);
13
- * - an `@import` pulls a sibling file inline;
14
- * - a cyclic import terminates (does not hang) and inlines each file once;
15
- * - missing files and binary (non-text-extension) imports are skipped;
16
- * - a home-root CLAUDE.md is included exactly once even when cwd is under home.
17
- */
18
- export {};