@di-code/coding-agent 0.1.6 → 0.1.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 (338) hide show
  1. package/README.md +112 -68
  2. package/compositions/base.yml +54 -0
  3. package/compositions/interactive.yml +14 -0
  4. package/compositions/json.yml +6 -0
  5. package/compositions/print.yml +5 -0
  6. package/compositions/rpc.yml +12 -0
  7. package/compositions/webui.yml +9 -0
  8. package/dist/cli.d.ts +22 -1
  9. package/dist/cli.d.ts.map +1 -1
  10. package/dist/cli.js +97 -3
  11. package/dist/cli.js.map +1 -1
  12. package/dist/composition-loader-entry.d.ts +11 -0
  13. package/dist/composition-loader-entry.d.ts.map +1 -0
  14. package/dist/composition-loader-entry.js +12 -0
  15. package/dist/composition-loader-entry.js.map +1 -0
  16. package/dist/compositions.d.ts +32 -0
  17. package/dist/compositions.d.ts.map +1 -0
  18. package/dist/compositions.js +173 -0
  19. package/dist/compositions.js.map +1 -0
  20. package/dist/core/session/session-manager.d.ts +9 -2
  21. package/dist/core/session/session-manager.d.ts.map +1 -1
  22. package/dist/core/session/session-manager.js +28 -0
  23. package/dist/core/session/session-manager.js.map +1 -1
  24. package/dist/core/session/session-storage.d.ts.map +1 -1
  25. package/dist/core/session/session-storage.js +20 -3
  26. package/dist/core/session/session-storage.js.map +1 -1
  27. package/dist/core/session/types.d.ts +11 -2
  28. package/dist/core/session/types.d.ts.map +1 -1
  29. package/dist/core/session/types.js.map +1 -1
  30. package/dist/core/session-tools.d.ts +5 -0
  31. package/dist/core/session-tools.d.ts.map +1 -0
  32. package/dist/core/session-tools.js +17 -0
  33. package/dist/core/session-tools.js.map +1 -0
  34. package/dist/core/session.d.ts +21 -7
  35. package/dist/core/session.d.ts.map +1 -1
  36. package/dist/core/session.js +77 -41
  37. package/dist/core/session.js.map +1 -1
  38. package/dist/core/tools/bash.d.ts +1 -38
  39. package/dist/core/tools/bash.d.ts.map +1 -1
  40. package/dist/core/tools/bash.js +1 -207
  41. package/dist/core/tools/bash.js.map +1 -1
  42. package/dist/core/tools/edit-diff.d.ts +1 -24
  43. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  44. package/dist/core/tools/edit-diff.js +1 -135
  45. package/dist/core/tools/edit-diff.js.map +1 -1
  46. package/dist/core/tools/edit.d.ts +1 -26
  47. package/dist/core/tools/edit.d.ts.map +1 -1
  48. package/dist/core/tools/edit.js +1 -140
  49. package/dist/core/tools/edit.js.map +1 -1
  50. package/dist/core/tools/file-mutation-queue.d.ts +1 -1
  51. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  52. package/dist/core/tools/file-mutation-queue.js +1 -23
  53. package/dist/core/tools/file-mutation-queue.js.map +1 -1
  54. package/dist/core/tools/file-search.d.ts +1 -13
  55. package/dist/core/tools/file-search.d.ts.map +1 -1
  56. package/dist/core/tools/file-search.js +1 -98
  57. package/dist/core/tools/file-search.js.map +1 -1
  58. package/dist/core/tools/glob.d.ts +1 -10
  59. package/dist/core/tools/glob.d.ts.map +1 -1
  60. package/dist/core/tools/glob.js +1 -43
  61. package/dist/core/tools/glob.js.map +1 -1
  62. package/dist/core/tools/grep.d.ts +1 -12
  63. package/dist/core/tools/grep.d.ts.map +1 -1
  64. package/dist/core/tools/grep.js +1 -66
  65. package/dist/core/tools/grep.js.map +1 -1
  66. package/dist/core/tools/load-skill.d.ts +1 -9
  67. package/dist/core/tools/load-skill.d.ts.map +1 -1
  68. package/dist/core/tools/load-skill.js +1 -21
  69. package/dist/core/tools/load-skill.js.map +1 -1
  70. package/dist/core/tools/path-boundary.d.ts +1 -4
  71. package/dist/core/tools/path-boundary.d.ts.map +1 -1
  72. package/dist/core/tools/path-boundary.js +1 -65
  73. package/dist/core/tools/path-boundary.js.map +1 -1
  74. package/dist/core/tools/read.d.ts +1 -16
  75. package/dist/core/tools/read.d.ts.map +1 -1
  76. package/dist/core/tools/read.js +1 -131
  77. package/dist/core/tools/read.js.map +1 -1
  78. package/dist/core/tools/write.d.ts +1 -16
  79. package/dist/core/tools/write.d.ts.map +1 -1
  80. package/dist/core/tools/write.js +1 -44
  81. package/dist/core/tools/write.js.map +1 -1
  82. package/dist/entry.js +30 -28
  83. package/dist/entry.js.map +1 -1
  84. package/dist/i18n.d.ts.map +1 -1
  85. package/dist/i18n.js +2 -0
  86. package/dist/i18n.js.map +1 -1
  87. package/dist/index.d.ts +6 -3
  88. package/dist/index.d.ts.map +1 -1
  89. package/dist/index.js +6 -3
  90. package/dist/index.js.map +1 -1
  91. package/dist/interactive/builtin.d.ts +17 -0
  92. package/dist/interactive/builtin.d.ts.map +1 -0
  93. package/dist/interactive/builtin.js +47 -0
  94. package/dist/interactive/builtin.js.map +1 -0
  95. package/dist/interactive/controller.d.ts +85 -0
  96. package/dist/interactive/controller.d.ts.map +1 -0
  97. package/dist/interactive/controller.js +211 -0
  98. package/dist/interactive/controller.js.map +1 -0
  99. package/dist/interactive/index.d.ts +3 -0
  100. package/dist/interactive/index.d.ts.map +1 -0
  101. package/dist/interactive/index.js +3 -0
  102. package/dist/interactive/index.js.map +1 -0
  103. package/dist/interactive-host-entry.d.ts +7 -0
  104. package/dist/interactive-host-entry.d.ts.map +1 -0
  105. package/dist/interactive-host-entry.js +123 -0
  106. package/dist/interactive-host-entry.js.map +1 -0
  107. package/dist/interactive-profile.d.ts +18 -0
  108. package/dist/interactive-profile.d.ts.map +1 -0
  109. package/dist/interactive-profile.js +290 -0
  110. package/dist/interactive-profile.js.map +1 -0
  111. package/dist/interactive-resources-entry.d.ts +7 -0
  112. package/dist/interactive-resources-entry.d.ts.map +1 -0
  113. package/dist/interactive-resources-entry.js +42 -0
  114. package/dist/interactive-resources-entry.js.map +1 -0
  115. package/dist/legacy-main.d.ts +39 -0
  116. package/dist/legacy-main.d.ts.map +1 -0
  117. package/dist/legacy-main.js +611 -0
  118. package/dist/legacy-main.js.map +1 -0
  119. package/dist/main.d.ts +15 -34
  120. package/dist/main.d.ts.map +1 -1
  121. package/dist/main.js +130 -513
  122. package/dist/main.js.map +1 -1
  123. package/dist/mcp/entries.d.ts +42 -0
  124. package/dist/mcp/entries.d.ts.map +1 -0
  125. package/dist/mcp/entries.js +98 -0
  126. package/dist/mcp/entries.js.map +1 -0
  127. package/dist/mcp-client-entry.d.ts +5 -0
  128. package/dist/mcp-client-entry.d.ts.map +1 -0
  129. package/dist/mcp-client-entry.js +6 -0
  130. package/dist/mcp-client-entry.js.map +1 -0
  131. package/dist/mcp-config-entry.d.ts +5 -0
  132. package/dist/mcp-config-entry.d.ts.map +1 -0
  133. package/dist/mcp-config-entry.js +6 -0
  134. package/dist/mcp-config-entry.js.map +1 -0
  135. package/dist/mcp-tools-entry.d.ts +5 -0
  136. package/dist/mcp-tools-entry.d.ts.map +1 -0
  137. package/dist/mcp-tools-entry.js +6 -0
  138. package/dist/mcp-tools-entry.js.map +1 -0
  139. package/dist/mcp-transport-entry.d.ts +5 -0
  140. package/dist/mcp-transport-entry.d.ts.map +1 -0
  141. package/dist/mcp-transport-entry.js +6 -0
  142. package/dist/mcp-transport-entry.js.map +1 -0
  143. package/dist/modes/interactive-entry.d.ts +18 -0
  144. package/dist/modes/interactive-entry.d.ts.map +1 -0
  145. package/dist/modes/interactive-entry.js +21 -0
  146. package/dist/modes/interactive-entry.js.map +1 -0
  147. package/dist/modes/interactive-state.js +1 -1
  148. package/dist/modes/interactive-state.js.map +1 -1
  149. package/dist/modes/interactive.d.ts +16 -6
  150. package/dist/modes/interactive.d.ts.map +1 -1
  151. package/dist/modes/interactive.js +99 -33
  152. package/dist/modes/interactive.js.map +1 -1
  153. package/dist/modes/json-entry.d.ts +13 -0
  154. package/dist/modes/json-entry.d.ts.map +1 -0
  155. package/dist/modes/json-entry.js +14 -0
  156. package/dist/modes/json-entry.js.map +1 -0
  157. package/dist/modes/json.d.ts +4 -1
  158. package/dist/modes/json.d.ts.map +1 -1
  159. package/dist/modes/json.js +3 -3
  160. package/dist/modes/json.js.map +1 -1
  161. package/dist/modes/print-entry.d.ts +10 -0
  162. package/dist/modes/print-entry.d.ts.map +1 -0
  163. package/dist/modes/print-entry.js +11 -0
  164. package/dist/modes/print-entry.js.map +1 -0
  165. package/dist/modes/tree-selector.d.ts.map +1 -1
  166. package/dist/modes/tree-selector.js +4 -0
  167. package/dist/modes/tree-selector.js.map +1 -1
  168. package/dist/plugin-dump-composition.d.ts +6 -0
  169. package/dist/plugin-dump-composition.d.ts.map +1 -0
  170. package/dist/plugin-dump-composition.js +7 -0
  171. package/dist/plugin-dump-composition.js.map +1 -0
  172. package/dist/plugin-inventory.d.ts +7 -0
  173. package/dist/plugin-inventory.d.ts.map +1 -0
  174. package/dist/plugin-inventory.js +8 -0
  175. package/dist/plugin-inventory.js.map +1 -0
  176. package/dist/plugin-manager.d.ts +6 -0
  177. package/dist/plugin-manager.d.ts.map +1 -0
  178. package/dist/plugin-manager.js +7 -0
  179. package/dist/plugin-manager.js.map +1 -0
  180. package/dist/plugin-trace.d.ts +6 -0
  181. package/dist/plugin-trace.d.ts.map +1 -0
  182. package/dist/plugin-trace.js +7 -0
  183. package/dist/plugin-trace.js.map +1 -0
  184. package/dist/plugins/dynamic-broker.d.ts +76 -0
  185. package/dist/plugins/dynamic-broker.d.ts.map +1 -0
  186. package/dist/plugins/dynamic-broker.js +852 -0
  187. package/dist/plugins/dynamic-broker.js.map +1 -0
  188. package/dist/plugins/profile.d.ts +15 -0
  189. package/dist/plugins/profile.d.ts.map +1 -0
  190. package/dist/plugins/profile.js +34 -0
  191. package/dist/plugins/profile.js.map +1 -0
  192. package/dist/plugins/runtime-host.d.ts +37 -0
  193. package/dist/plugins/runtime-host.d.ts.map +1 -0
  194. package/dist/plugins/runtime-host.js +95 -0
  195. package/dist/plugins/runtime-host.js.map +1 -0
  196. package/dist/plugins/trust.d.ts +8 -0
  197. package/dist/plugins/trust.d.ts.map +1 -0
  198. package/dist/plugins/trust.js +59 -0
  199. package/dist/plugins/trust.js.map +1 -0
  200. package/dist/project-trust-entry.d.ts +15 -0
  201. package/dist/project-trust-entry.d.ts.map +1 -0
  202. package/dist/project-trust-entry.js +15 -0
  203. package/dist/project-trust-entry.js.map +1 -0
  204. package/dist/rpc/client.d.ts +78 -6
  205. package/dist/rpc/client.d.ts.map +1 -1
  206. package/dist/rpc/client.js +172 -4
  207. package/dist/rpc/client.js.map +1 -1
  208. package/dist/rpc/dispatcher.d.ts +121 -0
  209. package/dist/rpc/dispatcher.d.ts.map +1 -0
  210. package/dist/rpc/dispatcher.js +994 -0
  211. package/dist/rpc/dispatcher.js.map +1 -0
  212. package/dist/rpc/index.d.ts +2 -0
  213. package/dist/rpc/index.d.ts.map +1 -1
  214. package/dist/rpc/index.js +2 -0
  215. package/dist/rpc/index.js.map +1 -1
  216. package/dist/rpc/lifecycle.d.ts +6 -0
  217. package/dist/rpc/lifecycle.d.ts.map +1 -0
  218. package/dist/rpc/lifecycle.js +24 -0
  219. package/dist/rpc/lifecycle.js.map +1 -0
  220. package/dist/rpc/protocol.d.ts +112 -31
  221. package/dist/rpc/protocol.d.ts.map +1 -1
  222. package/dist/rpc/protocol.js +569 -117
  223. package/dist/rpc/protocol.js.map +1 -1
  224. package/dist/rpc/server-service.d.ts +7 -0
  225. package/dist/rpc/server-service.d.ts.map +1 -0
  226. package/dist/rpc/server-service.js +3 -0
  227. package/dist/rpc/server-service.js.map +1 -0
  228. package/dist/rpc/server.d.ts +16 -19
  229. package/dist/rpc/server.d.ts.map +1 -1
  230. package/dist/rpc/server.js +59 -115
  231. package/dist/rpc/server.js.map +1 -1
  232. package/dist/rpc-client-sdk-entry.d.ts +12 -0
  233. package/dist/rpc-client-sdk-entry.d.ts.map +1 -0
  234. package/dist/rpc-client-sdk-entry.js +11 -0
  235. package/dist/rpc-client-sdk-entry.js.map +1 -0
  236. package/dist/rpc-entry.js +50 -18
  237. package/dist/rpc-entry.js.map +1 -1
  238. package/dist/rpc-server-entry.d.ts +8 -0
  239. package/dist/rpc-server-entry.d.ts.map +1 -0
  240. package/dist/rpc-server-entry.js +67 -0
  241. package/dist/rpc-server-entry.js.map +1 -0
  242. package/dist/runtime/attachment-store.d.ts +13 -0
  243. package/dist/runtime/attachment-store.d.ts.map +1 -0
  244. package/dist/runtime/attachment-store.js +93 -0
  245. package/dist/runtime/attachment-store.js.map +1 -0
  246. package/dist/runtime/bootstrap.d.ts +14 -0
  247. package/dist/runtime/bootstrap.d.ts.map +1 -0
  248. package/dist/runtime/bootstrap.js +29 -0
  249. package/dist/runtime/bootstrap.js.map +1 -0
  250. package/dist/runtime/interactive-host-service.d.ts +22 -0
  251. package/dist/runtime/interactive-host-service.d.ts.map +1 -0
  252. package/dist/runtime/interactive-host-service.js +2 -0
  253. package/dist/runtime/interactive-host-service.js.map +1 -0
  254. package/dist/runtime/interactive-resource-service.d.ts +11 -0
  255. package/dist/runtime/interactive-resource-service.d.ts.map +1 -0
  256. package/dist/runtime/interactive-resource-service.js +3 -0
  257. package/dist/runtime/interactive-resource-service.js.map +1 -0
  258. package/dist/runtime/plugin-inventory-entry.d.ts +5 -0
  259. package/dist/runtime/plugin-inventory-entry.d.ts.map +1 -0
  260. package/dist/runtime/plugin-inventory-entry.js +18 -0
  261. package/dist/runtime/plugin-inventory-entry.js.map +1 -0
  262. package/dist/runtime/plugin-inventory-service.d.ts +8 -0
  263. package/dist/runtime/plugin-inventory-service.d.ts.map +1 -0
  264. package/dist/runtime/plugin-inventory-service.js +3 -0
  265. package/dist/runtime/plugin-inventory-service.js.map +1 -0
  266. package/dist/runtime/plugin-manager-entry.d.ts +20 -0
  267. package/dist/runtime/plugin-manager-entry.d.ts.map +1 -0
  268. package/dist/runtime/plugin-manager-entry.js +96 -0
  269. package/dist/runtime/plugin-manager-entry.js.map +1 -0
  270. package/dist/runtime/plugin-observability-entry.d.ts +12 -0
  271. package/dist/runtime/plugin-observability-entry.d.ts.map +1 -0
  272. package/dist/runtime/plugin-observability-entry.js +73 -0
  273. package/dist/runtime/plugin-observability-entry.js.map +1 -0
  274. package/dist/runtime/product-host.d.ts +91 -0
  275. package/dist/runtime/product-host.d.ts.map +1 -0
  276. package/dist/runtime/product-host.js +529 -0
  277. package/dist/runtime/product-host.js.map +1 -0
  278. package/dist/runtime/session-factory.d.ts +17 -0
  279. package/dist/runtime/session-factory.d.ts.map +1 -0
  280. package/dist/runtime/session-factory.js +75 -0
  281. package/dist/runtime/session-factory.js.map +1 -0
  282. package/dist/runtime/session-host.d.ts +152 -0
  283. package/dist/runtime/session-host.d.ts.map +1 -0
  284. package/dist/runtime/session-host.js +895 -0
  285. package/dist/runtime/session-host.js.map +1 -0
  286. package/dist/runtime-core-entry.d.ts +11 -0
  287. package/dist/runtime-core-entry.d.ts.map +1 -0
  288. package/dist/runtime-core-entry.js +9 -0
  289. package/dist/runtime-core-entry.js.map +1 -0
  290. package/dist/session-factory-entry.d.ts +7 -0
  291. package/dist/session-factory-entry.d.ts.map +1 -0
  292. package/dist/session-factory-entry.js +9 -0
  293. package/dist/session-factory-entry.js.map +1 -0
  294. package/dist/session-store-jsonl-entry.d.ts +7 -0
  295. package/dist/session-store-jsonl-entry.d.ts.map +1 -0
  296. package/dist/session-store-jsonl-entry.js +33 -0
  297. package/dist/session-store-jsonl-entry.js.map +1 -0
  298. package/dist/startup.d.ts +21 -1
  299. package/dist/startup.d.ts.map +1 -1
  300. package/dist/startup.js +179 -10
  301. package/dist/startup.js.map +1 -1
  302. package/dist/subagents/index.d.ts +2 -0
  303. package/dist/subagents/index.d.ts.map +1 -0
  304. package/dist/subagents/index.js +2 -0
  305. package/dist/subagents/index.js.map +1 -0
  306. package/dist/subagents/service.d.ts +50 -0
  307. package/dist/subagents/service.d.ts.map +1 -0
  308. package/dist/subagents/service.js +521 -0
  309. package/dist/subagents/service.js.map +1 -0
  310. package/dist/ui-host.d.ts +125 -0
  311. package/dist/ui-host.d.ts.map +1 -0
  312. package/dist/ui-host.js +275 -0
  313. package/dist/ui-host.js.map +1 -0
  314. package/dist/web/assets/index-BwfuGMvv.css +1 -0
  315. package/dist/web/assets/index-DPUaJqFJ.js +41 -0
  316. package/dist/web/assets/index-DPUaJqFJ.js.map +1 -0
  317. package/dist/web/index.html +14 -0
  318. package/dist/web-command.d.ts +11 -0
  319. package/dist/web-command.d.ts.map +1 -0
  320. package/dist/web-command.js +114 -0
  321. package/dist/web-command.js.map +1 -0
  322. package/dist/web-frontend.d.ts +73 -0
  323. package/dist/web-frontend.d.ts.map +1 -0
  324. package/dist/web-frontend.js +249 -0
  325. package/dist/web-frontend.js.map +1 -0
  326. package/dist/web.d.ts +254 -0
  327. package/dist/web.d.ts.map +1 -0
  328. package/dist/web.js +740 -0
  329. package/dist/web.js.map +1 -0
  330. package/dist/webui-entry.d.ts +3 -0
  331. package/dist/webui-entry.d.ts.map +1 -0
  332. package/dist/webui-entry.js +73 -0
  333. package/dist/webui-entry.js.map +1 -0
  334. package/dist/webui.d.ts +91 -0
  335. package/dist/webui.d.ts.map +1 -0
  336. package/dist/webui.js +882 -0
  337. package/dist/webui.js.map +1 -0
  338. package/package.json +89 -8
@@ -1,29 +1,34 @@
1
+ import type { CommandRegistry, InteractiveContextService } from "@di-code/builtins";
1
2
  import { type TUI } from "@di-code/tui";
2
3
  import type { AgentSession, AgentSessionEvent } from "../core/session.ts";
3
- import type { ExtensionHost } from "../extensions/runtime.ts";
4
4
  import { type Locale } from "../i18n.ts";
5
5
  import { type InteractiveProviderOnboardingOptions } from "../provider-onboarding.ts";
6
+ import type { SessionHostUi } from "../runtime/session-host.ts";
6
7
  export type { AgentSessionEvent };
7
8
  export type { InteractiveMessage, InteractiveProcessItem, InteractiveState } from "./interactive-state.ts";
8
9
  export { InteractiveProjection } from "./interactive-state.ts";
9
10
  export interface InteractiveModeOptions {
10
- readonly session: AgentSession;
11
+ readonly session: InteractiveSessionHandle;
11
12
  readonly tui: TUI;
12
13
  readonly onExit?: () => void;
13
14
  readonly sessions?: readonly InteractiveSessionChoice[];
14
- readonly extensionHost?: ExtensionHost;
15
15
  readonly providerOnboarding?: Omit<InteractiveProviderOnboardingOptions, "tui">;
16
16
  /** User data directory that owns clipboard image temporaries. */
17
17
  readonly agentDir?: string;
18
18
  readonly readClipboardImagePath?: (directory?: string) => Promise<string | null>;
19
19
  readonly locale?: Locale;
20
+ /** Command contributions are resolved through the composition registry. */
21
+ readonly commandRegistry?: CommandRegistry;
22
+ /** Session controls and preferences are supplied by the active Context. */
23
+ readonly context?: InteractiveContextService;
20
24
  }
21
25
  export interface InteractiveSessionChoice {
22
26
  readonly id: string;
23
27
  readonly label: string;
24
28
  readonly description?: string;
25
- open(): AgentSession | Promise<AgentSession>;
29
+ open(): InteractiveSessionHandle | Promise<InteractiveSessionHandle>;
26
30
  }
31
+ export type InteractiveSessionHandle = AgentSession | SessionHostUi;
27
32
  export declare class InteractiveMode {
28
33
  private readonly projection;
29
34
  private readonly root;
@@ -31,7 +36,6 @@ export declare class InteractiveMode {
31
36
  private session;
32
37
  private readonly tui;
33
38
  private readonly sessionChoices;
34
- private readonly extensionHost?;
35
39
  private readonly providerOnboarding?;
36
40
  private readonly agentDir;
37
41
  private readonly readClipboardImagePath;
@@ -51,12 +55,17 @@ export declare class InteractiveMode {
51
55
  private overlay?;
52
56
  private autocompleteOverlay?;
53
57
  private spinnerTimer?;
54
- private shutdownEmitted;
55
58
  private preserveClipboardFiles;
56
59
  private locale;
60
+ private readonly commandRegistry?;
61
+ private readonly context?;
57
62
  constructor(options: InteractiveModeOptions);
58
63
  start(initialPrompt?: string): void;
59
64
  stop(): void;
65
+ /** Cancels the active prompt without changing Session history. */
66
+ cancelActivePrompt(): void;
67
+ /** Re-submits the last failed prompt when the mode is idle. */
68
+ retryLastPrompt(): void;
60
69
  private exit;
61
70
  private handleCommand;
62
71
  private attachClipboardImage;
@@ -82,6 +91,7 @@ export declare class InteractiveMode {
82
91
  private cleanupUnreferencedClipboardFiles;
83
92
  private cleanupClipboardFiles;
84
93
  private handleSlashCommand;
94
+ private runRegisteredCommand;
85
95
  private openProviderLogin;
86
96
  private logoutProvider;
87
97
  private listSlashCommands;
@@ -1 +1 @@
1
- {"version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gF3C,KAAK,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI;IAsBnC,IAAI,IAAI,IAAI;IAeZ,kEAAkE;IAClE,kBAAkB,IAAI,IAAI;IAI1B,+DAA+D;IAC/D,eAAe,IAAI,IAAI;IAIvB,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,aAAa;YAmDP,oBAAoB;IAiBlC,OAAO,CAAC,iBAAiB;IAiBzB,OAAO,CAAC,iBAAiB;IA0BzB,OAAO,CAAC,mBAAmB;IA8B3B,OAAO,CAAC,gBAAgB;YA6CV,iBAAiB;YAsBjB,mBAAmB;IAmBjC,OAAO,CAAC,oBAAoB;IAgD5B,OAAO,CAAC,WAAW;IAanB,OAAO,CAAC,YAAY;IAKpB,OAAO,CAAC,yBAAyB;IA2BjC,OAAO,CAAC,wBAAwB;IAKhC,OAAO,CAAC,OAAO;IAKf,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,gBAAgB;IAKxB,OAAO,CAAC,kBAAkB;YAoBZ,aAAa;YAkCb,MAAM;YAyEN,cAAc;IA+C5B,OAAO,CAAC,YAAY;YAON,iCAAiC;YAOjC,qBAAqB;IAMnC,OAAO,CAAC,kBAAkB;IAqB1B,OAAO,CAAC,oBAAoB;IAqD5B,OAAO,CAAC,iBAAiB;YAoCX,cAAc;IA4B5B,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,WAAW;YAQL,mBAAmB;CAqBjC"}
@@ -6,7 +6,7 @@ import { cleanupStaleClipboardImages, clipboardImageDirectory, isClipboardImageP
6
6
  import { extractImageAttachments } from "../core/image-input.js";
7
7
  import { DEFAULT_LOCALE, translate } from "../i18n.js";
8
8
  import { showInteractiveProviderOnboarding, } from "../provider-onboarding.js";
9
- import { removeGlobalProviderApiKey, saveGlobalLocale } from "../startup.js";
9
+ import { removeGlobalProviderApiKey, saveGlobalLocale, saveGlobalModelSelection, saveGlobalThinkingLevel, } from "../startup.js";
10
10
  import { AutocompleteMenu, InteractiveChat, InteractiveComposer, InteractiveFooter, InteractiveHeader, } from "./interactive-components.js";
11
11
  import { InteractiveLayout } from "./interactive-layout.js";
12
12
  import { InteractiveProjection } from "./interactive-state.js";
@@ -64,6 +64,16 @@ function steeringCommandArgument(prompt) {
64
64
  const match = /^\/steer(?:\s+([\s\S]*))?$/i.exec(prompt);
65
65
  return match ? (match[1] ?? "").trim() : undefined;
66
66
  }
67
+ function isContextSessionChoice(value) {
68
+ return (typeof value === "object" &&
69
+ value !== null &&
70
+ "id" in value &&
71
+ typeof value.id === "string" &&
72
+ "label" in value &&
73
+ typeof value.label === "string" &&
74
+ "open" in value &&
75
+ typeof value.open === "function");
76
+ }
67
77
  export class InteractiveMode {
68
78
  projection = new InteractiveProjection();
69
79
  root;
@@ -71,7 +81,6 @@ export class InteractiveMode {
71
81
  session;
72
82
  tui;
73
83
  sessionChoices;
74
- extensionHost;
75
84
  providerOnboarding;
76
85
  agentDir;
77
86
  readClipboardImagePath;
@@ -91,19 +100,32 @@ export class InteractiveMode {
91
100
  overlay;
92
101
  autocompleteOverlay;
93
102
  spinnerTimer;
94
- shutdownEmitted = false;
95
103
  preserveClipboardFiles = false;
96
104
  locale;
105
+ commandRegistry;
106
+ context;
97
107
  constructor(options) {
98
108
  this.session = options.session;
99
109
  this.projection.configureFilePreview(this.session.allowedRoot, () => this.refresh());
100
110
  this.tui = options.tui;
101
111
  this.onExit = options.onExit;
102
- this.sessionChoices = [...(options.sessions ?? [])];
103
- this.extensionHost = options.extensionHost;
112
+ const contextChoices = (options.context?.sessionChoices() ?? []).filter(isContextSessionChoice).map((choice) => ({
113
+ ...choice,
114
+ open: async () => {
115
+ const session = await choice.open();
116
+ if (typeof session !== "object" || session === null)
117
+ throw new Error(`Session choice ${choice.id} is invalid`);
118
+ return session;
119
+ },
120
+ }));
121
+ this.sessionChoices = [...(options.sessions ?? contextChoices)];
104
122
  this.providerOnboarding = options.providerOnboarding;
105
123
  this.agentDir = resolve(options.agentDir ?? join(homedir(), ".di-code"));
106
124
  this.locale = options.locale ?? DEFAULT_LOCALE;
125
+ this.commandRegistry = options.commandRegistry;
126
+ this.context = options.context;
127
+ if (this.context?.theme() === "light")
128
+ this.theme = "light";
107
129
  this.readClipboardImagePath = options.readClipboardImagePath ?? readClipboardImagePath;
108
130
  this.clipboardDirectory = clipboardImageDirectory(this.agentDir, this.session.allowedRoot);
109
131
  const autocomplete = {
@@ -113,9 +135,19 @@ export class InteractiveMode {
113
135
  this.editor = new Editor({
114
136
  maxHeight: 3,
115
137
  autocomplete,
138
+ submitAutocomplete: (context) => /^\/[^\s/]*$/.test(context.text.slice(0, context.cursor)),
116
139
  });
117
140
  this.editor.onSubmit = (text) => void this.submit(text);
118
- this.editor.onEscape = () => this.activeAbort?.abort();
141
+ this.editor.onEscape = () => {
142
+ if (!this.activeAbort) {
143
+ this.context?.cancel();
144
+ return;
145
+ }
146
+ this.projection.setStatus(translate(this.locale, "cancelled"));
147
+ this.context?.cancel();
148
+ this.activeAbort.abort();
149
+ this.refresh();
150
+ };
119
151
  this.editor.onCommand = (data) => this.handleCommand(data);
120
152
  this.editor.onInterrupt = () => this.exit();
121
153
  this.editor.onChange = () => {
@@ -148,8 +180,6 @@ export class InteractiveMode {
148
180
  if (this.started)
149
181
  throw new Error("Interactive mode is already started");
150
182
  this.started = true;
151
- this.shutdownEmitted = false;
152
- void this.extensionHost?.emit({ type: "session_start", cwd: this.session.allowedRoot });
153
183
  this.projection.replaceTranscript(this.session.transcript);
154
184
  this.projection.setUsage(this.session.usage);
155
185
  this.subscribeToSession();
@@ -184,16 +214,22 @@ export class InteractiveMode {
184
214
  this.unsubscribeSession = undefined;
185
215
  void this.cleanupClipboardFiles();
186
216
  this.tui.stop({ finalLines: this.root.renderTranscript(this.tui.columns) });
187
- if (!this.shutdownEmitted) {
188
- this.shutdownEmitted = true;
189
- void this.extensionHost?.emit({ type: "session_shutdown", reason: "user" });
190
- }
217
+ }
218
+ /** Cancels the active prompt without changing Session history. */
219
+ cancelActivePrompt() {
220
+ this.activeAbort?.abort();
221
+ }
222
+ /** Re-submits the last failed prompt when the mode is idle. */
223
+ retryLastPrompt() {
224
+ if (this.lastFailedPrompt && !this.promptInFlight)
225
+ void this.submit(this.lastFailedPrompt, true);
191
226
  }
192
227
  exit() {
193
228
  this.stop();
194
229
  this.onExit?.();
195
230
  }
196
231
  handleCommand(data) {
232
+ this.context?.keybindings();
197
233
  if (matchesKey(data, Key.alt("s"))) {
198
234
  void this.submitSteering(this.editor.getValue());
199
235
  return true;
@@ -202,6 +238,12 @@ export class InteractiveMode {
202
238
  try {
203
239
  const level = this.session.cycleThinkingLevel();
204
240
  this.projection.setStatus(level ? `thinking=${level}` : "Current model does not support thinking levels.");
241
+ if (level) {
242
+ void saveGlobalThinkingLevel(this.agentDir, this.session.providerId, this.session.modelId, level).catch((cause) => {
243
+ this.projection.setError(cause instanceof Error ? cause.message : String(cause));
244
+ this.refresh();
245
+ });
246
+ }
205
247
  }
206
248
  catch (cause) {
207
249
  this.projection.setError(cause instanceof Error ? cause.message : String(cause));
@@ -260,6 +302,7 @@ export class InteractiveMode {
260
302
  ]);
261
303
  list.onSelect = (item) => {
262
304
  this.theme = item.value === "light" ? "light" : "dark";
305
+ this.context?.setTheme(this.theme);
263
306
  this.projection.setStatus(`theme=${this.theme}`);
264
307
  this.closeOverlay();
265
308
  this.refresh();
@@ -277,6 +320,10 @@ export class InteractiveMode {
277
320
  try {
278
321
  this.session.setModel(item.value);
279
322
  this.projection.setStatus(`model=${item.value}`);
323
+ void saveGlobalModelSelection(this.agentDir, this.session.providerId, this.session.modelId).catch((cause) => {
324
+ this.projection.setError(cause instanceof Error ? cause.message : String(cause));
325
+ this.refresh();
326
+ });
280
327
  this.closeOverlay();
281
328
  this.refresh();
282
329
  }
@@ -602,7 +649,9 @@ export class InteractiveMode {
602
649
  const input = await extractImageAttachments(normalizeDroppedImagePrompt(prompt, this.session.allowedRoot), this.session.allowedRoot);
603
650
  this.preserveClipboardFiles = true;
604
651
  this.editor.setValue("");
605
- const result = await this.session.promptWithImages(input.text, input.images, this.activeAbort.signal);
652
+ const result = retry && "retry" in this.session
653
+ ? await this.session.retry(this.activeAbort.signal)
654
+ : await this.session.promptWithImages(input.text, input.images, this.activeAbort.signal);
606
655
  if (result.stopReason === "error" || result.stopReason === "aborted")
607
656
  this.lastFailedPrompt = prompt;
608
657
  else {
@@ -689,6 +738,22 @@ export class InteractiveMode {
689
738
  const [rawCommand = "", ...argParts] = trimmed.split(/\s+/);
690
739
  const command = rawCommand.toLowerCase();
691
740
  const args = argParts.join(" ");
741
+ if (this.commandRegistry?.list().some((entry) => entry.name === command)) {
742
+ void this.commandRegistry
743
+ .execute(command, {
744
+ host: { runCommand: (name, value) => this.runRegisteredCommand(name, value) },
745
+ args,
746
+ })
747
+ .catch((cause) => {
748
+ this.projection.setError(cause instanceof Error ? cause.message : String(cause));
749
+ this.refresh();
750
+ });
751
+ this.refresh();
752
+ return;
753
+ }
754
+ this.runRegisteredCommand(command, args);
755
+ }
756
+ runRegisteredCommand(command, _args) {
692
757
  switch (command) {
693
758
  case "help":
694
759
  this.projection.setStatus(`commands: ${this.listSlashCommands()
@@ -701,49 +766,46 @@ export class InteractiveMode {
701
766
  break;
702
767
  case "model":
703
768
  this.openModelSelector();
704
- return;
769
+ return 0;
705
770
  case "session":
706
771
  this.openSessionSelector();
707
- return;
772
+ return 0;
708
773
  case "tree":
709
774
  this.openTreeSelector();
710
- return;
775
+ return 0;
711
776
  case "theme":
712
777
  this.openThemeSelector();
713
- return;
778
+ return 0;
714
779
  case "settings":
715
780
  this.openSettingsSelector();
716
- return;
781
+ return 0;
717
782
  case "login":
718
783
  this.openProviderLogin();
719
- return;
784
+ return 0;
720
785
  case "logout":
721
786
  void this.logoutProvider();
722
- return;
787
+ return 0;
723
788
  case "compact":
724
789
  void this.runManualCompaction();
725
- return;
790
+ return 0;
726
791
  case "usage":
727
792
  this.projection.setStatus(this.formatUsage());
728
793
  break;
729
794
  case "retry":
730
- if (this.lastFailedPrompt && !this.promptInFlight)
731
- void this.submit(this.lastFailedPrompt, true);
795
+ if (this.lastFailedPrompt && !this.promptInFlight) {
796
+ if (this.context)
797
+ void this.context.retry();
798
+ else
799
+ void this.submit(this.lastFailedPrompt, true);
800
+ }
732
801
  else
733
802
  this.projection.setStatus(translate(this.locale, "nothingToRetry"));
734
803
  break;
735
- default: {
736
- if (this.extensionHost?.listCommands().some((entry) => entry.name === command)) {
737
- void this.extensionHost.runCommand(command, args).catch((cause) => {
738
- this.projection.setError(cause instanceof Error ? cause.message : String(cause));
739
- this.refresh();
740
- });
741
- break;
742
- }
804
+ default:
743
805
  this.projection.setError(`Unknown command: /${command}`);
744
- }
745
806
  }
746
807
  this.refresh();
808
+ return 0;
747
809
  }
748
810
  openProviderLogin() {
749
811
  if (!this.providerOnboarding) {
@@ -813,7 +875,11 @@ export class InteractiveMode {
813
875
  name: `skill:${skill.name}`,
814
876
  description: skill.description,
815
877
  }));
816
- return [...builtinSlashCommands(this.locale), ...(this.extensionHost?.listCommands() ?? []), ...skills];
878
+ const registryCommands = this.commandRegistry?.list().map((command) => ({
879
+ name: command.name,
880
+ description: typeof command.description === "function" ? command.description(this.locale) : command.description,
881
+ }));
882
+ return [...(registryCommands ?? builtinSlashCommands(this.locale)), ...skills];
817
883
  }
818
884
  isLoadedSkillCommand(input) {
819
885
  const name = /^\/skill:([a-z0-9]+(?:-[a-z0-9]+)*)(?:\s|$)/.exec(input)?.[1];