@di-code/coding-agent 0.1.0

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 (157) hide show
  1. package/dist/cli.d.ts +26 -0
  2. package/dist/cli.d.ts.map +1 -0
  3. package/dist/cli.js +117 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/config/models-loader.d.ts +4 -0
  6. package/dist/config/models-loader.d.ts.map +1 -0
  7. package/dist/config/models-loader.js +134 -0
  8. package/dist/config/models-loader.js.map +1 -0
  9. package/dist/config/models-types.d.ts +23 -0
  10. package/dist/config/models-types.d.ts.map +1 -0
  11. package/dist/config/models-types.js +2 -0
  12. package/dist/config/models-types.js.map +1 -0
  13. package/dist/config/settings-loader.d.ts +3 -0
  14. package/dist/config/settings-loader.d.ts.map +1 -0
  15. package/dist/config/settings-loader.js +130 -0
  16. package/dist/config/settings-loader.js.map +1 -0
  17. package/dist/config/settings-types.d.ts +21 -0
  18. package/dist/config/settings-types.d.ts.map +1 -0
  19. package/dist/config/settings-types.js +2 -0
  20. package/dist/config/settings-types.js.map +1 -0
  21. package/dist/core/context-builder.d.ts +8 -0
  22. package/dist/core/context-builder.d.ts.map +1 -0
  23. package/dist/core/context-builder.js +46 -0
  24. package/dist/core/context-builder.js.map +1 -0
  25. package/dist/core/model-catalog-store.d.ts +8 -0
  26. package/dist/core/model-catalog-store.d.ts.map +1 -0
  27. package/dist/core/model-catalog-store.js +68 -0
  28. package/dist/core/model-catalog-store.js.map +1 -0
  29. package/dist/core/model-composer.d.ts +4 -0
  30. package/dist/core/model-composer.d.ts.map +1 -0
  31. package/dist/core/model-composer.js +37 -0
  32. package/dist/core/model-composer.js.map +1 -0
  33. package/dist/core/session/session-manager.d.ts +44 -0
  34. package/dist/core/session/session-manager.d.ts.map +1 -0
  35. package/dist/core/session/session-manager.js +138 -0
  36. package/dist/core/session/session-manager.js.map +1 -0
  37. package/dist/core/session/session-storage.d.ts +11 -0
  38. package/dist/core/session/session-storage.d.ts.map +1 -0
  39. package/dist/core/session/session-storage.js +382 -0
  40. package/dist/core/session/session-storage.js.map +1 -0
  41. package/dist/core/session/types.d.ts +65 -0
  42. package/dist/core/session/types.d.ts.map +1 -0
  43. package/dist/core/session/types.js +28 -0
  44. package/dist/core/session/types.js.map +1 -0
  45. package/dist/core/session.d.ts +80 -0
  46. package/dist/core/session.d.ts.map +1 -0
  47. package/dist/core/session.js +262 -0
  48. package/dist/core/session.js.map +1 -0
  49. package/dist/core/tools/bash.d.ts +39 -0
  50. package/dist/core/tools/bash.d.ts.map +1 -0
  51. package/dist/core/tools/bash.js +208 -0
  52. package/dist/core/tools/bash.js.map +1 -0
  53. package/dist/core/tools/edit.d.ts +18 -0
  54. package/dist/core/tools/edit.d.ts.map +1 -0
  55. package/dist/core/tools/edit.js +107 -0
  56. package/dist/core/tools/edit.js.map +1 -0
  57. package/dist/core/tools/file-mutation-queue.d.ts +2 -0
  58. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
  59. package/dist/core/tools/file-mutation-queue.js +24 -0
  60. package/dist/core/tools/file-mutation-queue.js.map +1 -0
  61. package/dist/core/tools/path-boundary.d.ts +3 -0
  62. package/dist/core/tools/path-boundary.d.ts.map +1 -0
  63. package/dist/core/tools/path-boundary.js +62 -0
  64. package/dist/core/tools/path-boundary.js.map +1 -0
  65. package/dist/core/tools/read.d.ts +17 -0
  66. package/dist/core/tools/read.d.ts.map +1 -0
  67. package/dist/core/tools/read.js +132 -0
  68. package/dist/core/tools/read.js.map +1 -0
  69. package/dist/core/tools/write.d.ts +17 -0
  70. package/dist/core/tools/write.d.ts.map +1 -0
  71. package/dist/core/tools/write.js +45 -0
  72. package/dist/core/tools/write.js.map +1 -0
  73. package/dist/entry.d.ts +3 -0
  74. package/dist/entry.d.ts.map +1 -0
  75. package/dist/entry.js +27 -0
  76. package/dist/entry.js.map +1 -0
  77. package/dist/extensions/index.d.ts +5 -0
  78. package/dist/extensions/index.d.ts.map +1 -0
  79. package/dist/extensions/index.js +3 -0
  80. package/dist/extensions/index.js.map +1 -0
  81. package/dist/extensions/runtime.d.ts +46 -0
  82. package/dist/extensions/runtime.d.ts.map +1 -0
  83. package/dist/extensions/runtime.js +179 -0
  84. package/dist/extensions/runtime.js.map +1 -0
  85. package/dist/extensions/trust.d.ts +8 -0
  86. package/dist/extensions/trust.d.ts.map +1 -0
  87. package/dist/extensions/trust.js +59 -0
  88. package/dist/extensions/trust.js.map +1 -0
  89. package/dist/extensions/types.d.ts +46 -0
  90. package/dist/extensions/types.d.ts.map +1 -0
  91. package/dist/extensions/types.js +2 -0
  92. package/dist/extensions/types.js.map +1 -0
  93. package/dist/index.d.ts +8 -0
  94. package/dist/index.d.ts.map +1 -0
  95. package/dist/index.js +8 -0
  96. package/dist/index.js.map +1 -0
  97. package/dist/main.d.ts +19 -0
  98. package/dist/main.d.ts.map +1 -0
  99. package/dist/main.js +198 -0
  100. package/dist/main.js.map +1 -0
  101. package/dist/modes/interactive-components.d.ts +41 -0
  102. package/dist/modes/interactive-components.d.ts.map +1 -0
  103. package/dist/modes/interactive-components.js +195 -0
  104. package/dist/modes/interactive-components.js.map +1 -0
  105. package/dist/modes/interactive-layout.d.ts +20 -0
  106. package/dist/modes/interactive-layout.d.ts.map +1 -0
  107. package/dist/modes/interactive-layout.js +34 -0
  108. package/dist/modes/interactive-layout.js.map +1 -0
  109. package/dist/modes/interactive-state.d.ts +61 -0
  110. package/dist/modes/interactive-state.d.ts.map +1 -0
  111. package/dist/modes/interactive-state.js +201 -0
  112. package/dist/modes/interactive-state.js.map +1 -0
  113. package/dist/modes/interactive.d.ts +61 -0
  114. package/dist/modes/interactive.d.ts.map +1 -0
  115. package/dist/modes/interactive.js +436 -0
  116. package/dist/modes/interactive.js.map +1 -0
  117. package/dist/modes/json.d.ts +14 -0
  118. package/dist/modes/json.d.ts.map +1 -0
  119. package/dist/modes/json.js +26 -0
  120. package/dist/modes/json.js.map +1 -0
  121. package/dist/modes/print.d.ts +10 -0
  122. package/dist/modes/print.d.ts.map +1 -0
  123. package/dist/modes/print.js +28 -0
  124. package/dist/modes/print.js.map +1 -0
  125. package/dist/provider-onboarding.d.ts +13 -0
  126. package/dist/provider-onboarding.d.ts.map +1 -0
  127. package/dist/provider-onboarding.js +162 -0
  128. package/dist/provider-onboarding.js.map +1 -0
  129. package/dist/rpc/client.d.ts +38 -0
  130. package/dist/rpc/client.d.ts.map +1 -0
  131. package/dist/rpc/client.js +153 -0
  132. package/dist/rpc/client.js.map +1 -0
  133. package/dist/rpc/index.d.ts +5 -0
  134. package/dist/rpc/index.d.ts.map +1 -0
  135. package/dist/rpc/index.js +5 -0
  136. package/dist/rpc/index.js.map +1 -0
  137. package/dist/rpc/jsonl.d.ts +17 -0
  138. package/dist/rpc/jsonl.d.ts.map +1 -0
  139. package/dist/rpc/jsonl.js +52 -0
  140. package/dist/rpc/jsonl.js.map +1 -0
  141. package/dist/rpc/protocol.d.ts +80 -0
  142. package/dist/rpc/protocol.d.ts.map +1 -0
  143. package/dist/rpc/protocol.js +231 -0
  144. package/dist/rpc/protocol.js.map +1 -0
  145. package/dist/rpc/server.d.ts +41 -0
  146. package/dist/rpc/server.d.ts.map +1 -0
  147. package/dist/rpc/server.js +186 -0
  148. package/dist/rpc/server.js.map +1 -0
  149. package/dist/rpc-entry.d.ts +3 -0
  150. package/dist/rpc-entry.d.ts.map +1 -0
  151. package/dist/rpc-entry.js +28 -0
  152. package/dist/rpc-entry.js.map +1 -0
  153. package/dist/startup.d.ts +24 -0
  154. package/dist/startup.d.ts.map +1 -0
  155. package/dist/startup.js +227 -0
  156. package/dist/startup.js.map +1 -0
  157. package/package.json +43 -0
@@ -0,0 +1,436 @@
1
+ import { CombinedAutocompleteProvider, Editor, SelectList, SettingsList, } from "@di-code/tui";
2
+ import { AutocompleteMenu, InteractiveChat, InteractiveComposer, InteractiveFooter, InteractiveHeader, } from "./interactive-components.js";
3
+ import { InteractiveLayout } from "./interactive-layout.js";
4
+ import { InteractiveProjection } from "./interactive-state.js";
5
+ export { InteractiveProjection } from "./interactive-state.js";
6
+ export class InteractiveMode {
7
+ projection = new InteractiveProjection();
8
+ root;
9
+ editor;
10
+ session;
11
+ tui;
12
+ sessionChoices;
13
+ unsubscribeSession;
14
+ sessionSwitching = false;
15
+ promptInFlight = false;
16
+ compactionInFlight = false;
17
+ activeAbort;
18
+ started = false;
19
+ lastFailedPrompt;
20
+ queuedPrompts = [];
21
+ onExit;
22
+ theme = "dark";
23
+ overlay;
24
+ autocompleteOverlay;
25
+ spinnerTimer;
26
+ constructor(options) {
27
+ this.session = options.session;
28
+ this.tui = options.tui;
29
+ this.onExit = options.onExit;
30
+ this.sessionChoices = [...(options.sessions ?? [])];
31
+ const commands = [
32
+ { name: "help", description: "Show interactive commands" },
33
+ { name: "clear", description: "Clear visible messages" },
34
+ { name: "model", description: "Open the model selector" },
35
+ { name: "session", description: "Open the session selector" },
36
+ { name: "theme", description: "Open the theme selector" },
37
+ { name: "settings", description: "Open the settings selector" },
38
+ { name: "compact", description: "Compact the persisted context now" },
39
+ { name: "usage", description: "Show token and cost usage" },
40
+ { name: "retry", description: "Retry the last failed prompt" },
41
+ ];
42
+ const autocomplete = {
43
+ getSuggestions: (context, autocompleteOptions) => new CombinedAutocompleteProvider(commands, this.session.allowedRoot).getSuggestions(context, autocompleteOptions),
44
+ applyCompletion: (context, item, prefix) => new CombinedAutocompleteProvider(commands, this.session.allowedRoot).applyCompletion(context, item, prefix),
45
+ };
46
+ this.editor = new Editor({
47
+ maxHeight: 3,
48
+ autocomplete,
49
+ });
50
+ this.editor.onSubmit = (text) => void this.submit(text);
51
+ this.editor.onEscape = () => this.activeAbort?.abort();
52
+ this.editor.onCommand = (data) => this.handleCommand(data);
53
+ this.editor.onInterrupt = () => this.exit();
54
+ this.editor.onAutocompleteChange = () => this.updateAutocompleteOverlay();
55
+ const readViewState = () => ({
56
+ ...this.projection.state,
57
+ model: this.session.modelId,
58
+ theme: this.theme,
59
+ });
60
+ this.root = new InteractiveLayout({
61
+ header: new InteractiveHeader(readViewState),
62
+ chat: new InteractiveChat(readViewState),
63
+ composer: new InteractiveComposer(readViewState),
64
+ editor: this.editor,
65
+ footer: new InteractiveFooter(readViewState),
66
+ });
67
+ this.tui.addChild(this.root);
68
+ this.tui.setFocus(this.editor);
69
+ }
70
+ start(initialPrompt) {
71
+ if (this.started)
72
+ throw new Error("Interactive mode is already started");
73
+ this.started = true;
74
+ this.projection.replaceTranscript(this.session.transcript);
75
+ this.projection.setUsage(this.session.usage);
76
+ this.subscribeToSession();
77
+ try {
78
+ this.tui.start();
79
+ }
80
+ catch (cause) {
81
+ this.started = false;
82
+ this.unsubscribeSession?.();
83
+ this.unsubscribeSession = undefined;
84
+ throw cause;
85
+ }
86
+ this.startSpinnerTimer();
87
+ if (initialPrompt?.trim())
88
+ void this.submit(initialPrompt);
89
+ }
90
+ stop() {
91
+ if (!this.started && !this.unsubscribeSession)
92
+ return;
93
+ this.started = false;
94
+ this.activeAbort?.abort();
95
+ this.activeAbort = undefined;
96
+ this.stopSpinnerTimer();
97
+ this.projection.clearTransientProcess();
98
+ this.closeOverlay();
99
+ this.closeAutocompleteOverlay();
100
+ this.unsubscribeSession?.();
101
+ this.unsubscribeSession = undefined;
102
+ this.tui.stop({ finalLines: this.root.renderTranscript(this.tui.columns) });
103
+ }
104
+ exit() {
105
+ this.stop();
106
+ this.onExit?.();
107
+ }
108
+ handleCommand(data) {
109
+ if (data === "\x14") {
110
+ this.openThemeSelector();
111
+ return true;
112
+ }
113
+ if (data === "\x13") {
114
+ this.openSettingsSelector();
115
+ return true;
116
+ }
117
+ if (data === "\x0f") {
118
+ this.openModelSelector();
119
+ return true;
120
+ }
121
+ if (data === "\x0c") {
122
+ this.openSessionSelector();
123
+ return true;
124
+ }
125
+ if (data === "\x12" && this.lastFailedPrompt && !this.promptInFlight) {
126
+ void this.submit(this.lastFailedPrompt, true);
127
+ return true;
128
+ }
129
+ return false;
130
+ }
131
+ openThemeSelector() {
132
+ const list = new SelectList([
133
+ { value: "dark", label: "Dark", description: "Dark terminal theme" },
134
+ { value: "light", label: "Light", description: "Light terminal theme" },
135
+ ]);
136
+ list.onSelect = (item) => {
137
+ this.theme = item.value === "light" ? "light" : "dark";
138
+ this.projection.setStatus(`theme=${this.theme}`);
139
+ this.closeOverlay();
140
+ this.refresh();
141
+ };
142
+ list.onCancel = () => this.closeOverlay();
143
+ this.showOverlay(list);
144
+ }
145
+ openModelSelector() {
146
+ const list = new SelectList(this.session.availableModels.map((model) => ({
147
+ value: model.id,
148
+ label: model.name,
149
+ description: `${model.provider} / ${model.id} / context ${model.contextWindow}`,
150
+ })));
151
+ list.onSelect = (item) => {
152
+ try {
153
+ this.session.setModel(item.value);
154
+ this.projection.setStatus(`model=${item.value}`);
155
+ this.closeOverlay();
156
+ this.refresh();
157
+ }
158
+ catch (cause) {
159
+ this.projection.setError(cause instanceof Error ? cause.message : String(cause));
160
+ }
161
+ };
162
+ list.onCancel = () => this.closeOverlay();
163
+ this.showOverlay(list);
164
+ }
165
+ openSessionSelector() {
166
+ const list = new SelectList([
167
+ {
168
+ value: "__current__",
169
+ label: "Current session",
170
+ description: this.session.sessionFile ?? "In-memory session",
171
+ },
172
+ ...this.sessionChoices.map((choice) => ({
173
+ value: choice.id,
174
+ label: choice.label,
175
+ ...(choice.description ? { description: choice.description } : {}),
176
+ })),
177
+ ]);
178
+ list.onSelect = (item) => {
179
+ if (item.value === "__current__") {
180
+ this.projection.setStatus("session=current");
181
+ this.closeOverlay();
182
+ this.refresh();
183
+ return;
184
+ }
185
+ const choice = this.sessionChoices.find((candidate) => candidate.id === item.value);
186
+ if (!choice)
187
+ return;
188
+ this.closeOverlay();
189
+ void this.switchSession(choice);
190
+ };
191
+ list.onCancel = () => this.closeOverlay();
192
+ this.showOverlay(list);
193
+ }
194
+ openSettingsSelector() {
195
+ const list = new SettingsList([
196
+ {
197
+ id: "compaction",
198
+ label: "Context compaction",
199
+ currentValue: this.session.compactionEnabled ? "on" : "off",
200
+ values: ["on", "off"],
201
+ description: "Summarize older persisted context before the model limit is reached.",
202
+ },
203
+ ]);
204
+ list.onChange = (id, value) => {
205
+ if (id !== "compaction")
206
+ return;
207
+ try {
208
+ const enabled = this.session.setCompactionEnabled(value === "on");
209
+ list.updateValue(id, enabled ? "on" : "off");
210
+ this.projection.setStatus(enabled === (value === "on")
211
+ ? `compaction=${enabled ? "on" : "off"}`
212
+ : "compaction unavailable without a persisted session");
213
+ }
214
+ catch (cause) {
215
+ list.updateValue(id, this.session.compactionEnabled ? "on" : "off");
216
+ this.projection.setError(cause instanceof Error ? cause.message : String(cause));
217
+ this.closeOverlay();
218
+ }
219
+ this.refresh();
220
+ };
221
+ list.onCancel = () => this.closeOverlay();
222
+ this.showOverlay(list);
223
+ }
224
+ showOverlay(component) {
225
+ this.editor.cancelAutocomplete();
226
+ this.closeAutocompleteOverlay();
227
+ this.closeOverlay();
228
+ this.overlay = this.tui.showOverlay(component, {
229
+ width: "70%",
230
+ maxHeight: "60%",
231
+ anchor: "center",
232
+ margin: 1,
233
+ });
234
+ }
235
+ closeOverlay() {
236
+ this.overlay?.hide();
237
+ this.overlay = undefined;
238
+ }
239
+ updateAutocompleteOverlay() {
240
+ this.closeAutocompleteOverlay();
241
+ if (!this.editor.isShowingAutocomplete()) {
242
+ this.refresh();
243
+ return;
244
+ }
245
+ const menu = new AutocompleteMenu(() => ({
246
+ items: this.editor.getAutocompleteItems(),
247
+ index: this.editor.getAutocompleteIndex(),
248
+ }));
249
+ this.autocompleteOverlay = this.tui.showOverlay(menu, {
250
+ width: "55%",
251
+ maxHeight: 8,
252
+ anchor: "bottom-left",
253
+ margin: 1,
254
+ nonCapturing: true,
255
+ });
256
+ this.refresh();
257
+ }
258
+ closeAutocompleteOverlay() {
259
+ this.autocompleteOverlay?.hide();
260
+ this.autocompleteOverlay = undefined;
261
+ }
262
+ refresh() {
263
+ this.root.invalidate();
264
+ this.tui.requestRender();
265
+ }
266
+ startSpinnerTimer() {
267
+ this.stopSpinnerTimer();
268
+ this.spinnerTimer = setInterval(() => {
269
+ if (this.projection.advanceSpinner())
270
+ this.refresh();
271
+ }, 120);
272
+ this.spinnerTimer.unref?.();
273
+ }
274
+ stopSpinnerTimer() {
275
+ if (this.spinnerTimer)
276
+ clearInterval(this.spinnerTimer);
277
+ this.spinnerTimer = undefined;
278
+ }
279
+ subscribeToSession() {
280
+ this.unsubscribeSession?.();
281
+ this.unsubscribeSession = this.session.subscribeSession((event) => {
282
+ if (!this.started)
283
+ return;
284
+ this.projection.apply(event);
285
+ this.refresh();
286
+ });
287
+ }
288
+ async switchSession(choice) {
289
+ if (this.promptInFlight || this.sessionSwitching) {
290
+ this.projection.setError("Cannot switch sessions while a prompt is running.");
291
+ this.refresh();
292
+ return;
293
+ }
294
+ this.sessionSwitching = true;
295
+ this.projection.setStatus(`opening session=${choice.id}`);
296
+ this.refresh();
297
+ try {
298
+ const next = await choice.open();
299
+ if (!this.started)
300
+ return;
301
+ this.unsubscribeSession?.();
302
+ this.session = next;
303
+ this.queuedPrompts = [];
304
+ this.projection.setQueue([]);
305
+ this.projection.replaceTranscript(next.transcript);
306
+ this.projection.setUsage(next.usage);
307
+ this.projection.setStatus(`session=${choice.id}`);
308
+ this.subscribeToSession();
309
+ }
310
+ catch (cause) {
311
+ this.projection.setError(cause instanceof Error ? cause.message : String(cause));
312
+ }
313
+ finally {
314
+ this.sessionSwitching = false;
315
+ }
316
+ this.refresh();
317
+ }
318
+ async submit(text, retry = false) {
319
+ const prompt = text.trim();
320
+ if (prompt.length === 0 || !this.started)
321
+ return;
322
+ if (prompt.startsWith("/")) {
323
+ this.editor.setValue("");
324
+ this.handleSlashCommand(prompt);
325
+ return;
326
+ }
327
+ if (this.sessionSwitching) {
328
+ this.projection.setError("A session is opening; wait before submitting a prompt.");
329
+ this.refresh();
330
+ return;
331
+ }
332
+ if (this.compactionInFlight) {
333
+ this.projection.setError("A compaction is running; wait before submitting a prompt.");
334
+ this.refresh();
335
+ return;
336
+ }
337
+ if (this.promptInFlight) {
338
+ this.queuedPrompts.push(prompt);
339
+ this.projection.setQueue(this.queuedPrompts);
340
+ this.root.invalidate();
341
+ this.tui.requestRender();
342
+ return;
343
+ }
344
+ this.promptInFlight = true;
345
+ this.activeAbort = new AbortController();
346
+ this.projection.setRetrying(retry);
347
+ this.editor.setValue("");
348
+ try {
349
+ const result = await this.session.prompt(prompt, this.activeAbort.signal);
350
+ if (result.stopReason === "error" || result.stopReason === "aborted")
351
+ this.lastFailedPrompt = prompt;
352
+ else
353
+ this.lastFailedPrompt = undefined;
354
+ }
355
+ catch (cause) {
356
+ this.lastFailedPrompt = prompt;
357
+ this.projection.setError(cause instanceof Error ? cause.message : String(cause));
358
+ }
359
+ finally {
360
+ this.promptInFlight = false;
361
+ this.activeAbort = undefined;
362
+ this.projection.setRetrying(false);
363
+ const next = this.queuedPrompts.shift();
364
+ this.projection.setQueue(this.queuedPrompts);
365
+ this.root.invalidate();
366
+ this.tui.requestRender();
367
+ if (next && this.started)
368
+ void this.submit(next);
369
+ }
370
+ }
371
+ handleSlashCommand(input) {
372
+ const command = input.slice(1).trim().split(/\s+/, 1)[0]?.toLowerCase();
373
+ switch (command) {
374
+ case "help":
375
+ this.projection.setStatus("commands: /clear /model /session /theme /settings /compact /usage /retry");
376
+ break;
377
+ case "clear":
378
+ this.projection.clearVisibleMessages();
379
+ this.projection.setStatus("visible messages cleared");
380
+ break;
381
+ case "model":
382
+ this.openModelSelector();
383
+ return;
384
+ case "session":
385
+ this.openSessionSelector();
386
+ return;
387
+ case "theme":
388
+ this.openThemeSelector();
389
+ return;
390
+ case "settings":
391
+ this.openSettingsSelector();
392
+ return;
393
+ case "compact":
394
+ void this.runManualCompaction();
395
+ return;
396
+ case "usage":
397
+ this.projection.setStatus(this.formatUsage());
398
+ break;
399
+ case "retry":
400
+ if (this.lastFailedPrompt && !this.promptInFlight)
401
+ void this.submit(this.lastFailedPrompt, true);
402
+ else
403
+ this.projection.setStatus("nothing to retry");
404
+ break;
405
+ default:
406
+ this.projection.setError(`Unknown command: /${command ?? ""}`);
407
+ }
408
+ this.refresh();
409
+ }
410
+ formatUsage() {
411
+ const usage = this.session.usage;
412
+ return `usage: requests=${usage.requestCount} input=${usage.inputTokens} output=${usage.outputTokens} total=${usage.totalTokens} cost=$${usage.cost.total.toFixed(4)} context=${usage.estimatedContextTokens}/${usage.contextWindow}`;
413
+ }
414
+ async runManualCompaction() {
415
+ if (this.promptInFlight || this.compactionInFlight) {
416
+ this.projection.setError("Cannot compact while a prompt is running.");
417
+ this.refresh();
418
+ return;
419
+ }
420
+ this.compactionInFlight = true;
421
+ this.projection.setStatus("starting manual compaction");
422
+ this.refresh();
423
+ try {
424
+ await this.session.compact();
425
+ this.projection.setStatus("manual compaction complete");
426
+ }
427
+ catch (cause) {
428
+ this.projection.setError(cause instanceof Error ? cause.message : String(cause));
429
+ }
430
+ finally {
431
+ this.compactionInFlight = false;
432
+ this.refresh();
433
+ }
434
+ }
435
+ }
436
+ //# sourceMappingURL=interactive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactive.js","sourceRoot":"","sources":["../../src/modes/interactive.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,4BAA4B,EAC5B,MAAM,EAEN,UAAU,EACV,YAAY,GAEZ,MAAM,cAAc,CAAC;AAEtB,OAAO,EACN,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,GAEjB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAI/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAgB/D,MAAM,OAAO,eAAe;IACV,UAAU,GAAG,IAAI,qBAAqB,EAAE,CAAC;IACzC,IAAI,CAAoB;IACxB,MAAM,CAAS;IACxB,OAAO,CAAe;IACb,GAAG,CAAM;IACT,cAAc,CAAsC;IAC7D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UAAU,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAAC;QACxD,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,IAAI,CAAC;YACJ,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAAC;QACzD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAClF,CAAC;gBAAS,CAAC;YACV,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;YAChC,IAAI,CAAC,OAAO,EAAE,CAAC;QAChB,CAAC;IACF,CAAC;CACD","sourcesContent":["import {\n\ttype AutocompleteProvider,\n\tCombinedAutocompleteProvider,\n\tEditor,\n\ttype OverlayHandle,\n\tSelectList,\n\tSettingsList,\n\ttype TUI,\n} from \"@di-code/tui\";\nimport type { AgentSession, AgentSessionEvent } from \"../core/session.ts\";\nimport {\n\tAutocompleteMenu,\n\tInteractiveChat,\n\tInteractiveComposer,\n\tInteractiveFooter,\n\tInteractiveHeader,\n\ttype InteractiveViewState,\n} from \"./interactive-components.ts\";\nimport { InteractiveLayout } from \"./interactive-layout.ts\";\nimport { InteractiveProjection } from \"./interactive-state.ts\";\n\nexport type { AgentSessionEvent };\nexport type { InteractiveMessage, InteractiveProcessItem, InteractiveState } from \"./interactive-state.ts\";\nexport { InteractiveProjection } from \"./interactive-state.ts\";\n\nexport interface InteractiveModeOptions {\n\treadonly session: AgentSession;\n\treadonly tui: TUI;\n\treadonly onExit?: () => void;\n\treadonly sessions?: readonly InteractiveSessionChoice[];\n}\n\nexport interface InteractiveSessionChoice {\n\treadonly id: string;\n\treadonly label: string;\n\treadonly description?: string;\n\topen(): AgentSession | Promise<AgentSession>;\n}\n\nexport class InteractiveMode {\n\tprivate readonly projection = new InteractiveProjection();\n\tprivate readonly root: InteractiveLayout;\n\tprivate readonly editor: Editor;\n\tprivate session: AgentSession;\n\tprivate readonly tui: TUI;\n\tprivate readonly sessionChoices: readonly InteractiveSessionChoice[];\n\tprivate unsubscribeSession?: () => void;\n\tprivate sessionSwitching = false;\n\tprivate promptInFlight = false;\n\tprivate compactionInFlight = false;\n\tprivate activeAbort?: AbortController;\n\tprivate started = false;\n\tprivate lastFailedPrompt?: string;\n\tprivate queuedPrompts: string[] = [];\n\tprivate readonly onExit?: () => void;\n\tprivate theme: \"dark\" | \"light\" = \"dark\";\n\tprivate overlay?: OverlayHandle;\n\tprivate autocompleteOverlay?: OverlayHandle;\n\tprivate spinnerTimer?: ReturnType<typeof setInterval>;\n\n\tconstructor(options: InteractiveModeOptions) {\n\t\tthis.session = options.session;\n\t\tthis.tui = options.tui;\n\t\tthis.onExit = options.onExit;\n\t\tthis.sessionChoices = [...(options.sessions ?? [])];\n\t\tconst commands = [\n\t\t\t{ name: \"help\", description: \"Show interactive commands\" },\n\t\t\t{ name: \"clear\", description: \"Clear visible messages\" },\n\t\t\t{ name: \"model\", description: \"Open the model selector\" },\n\t\t\t{ name: \"session\", description: \"Open the session selector\" },\n\t\t\t{ name: \"theme\", description: \"Open the theme selector\" },\n\t\t\t{ name: \"settings\", description: \"Open the settings selector\" },\n\t\t\t{ name: \"compact\", description: \"Compact the persisted context now\" },\n\t\t\t{ name: \"usage\", description: \"Show token and cost usage\" },\n\t\t\t{ name: \"retry\", description: \"Retry the last failed prompt\" },\n\t\t] as const;\n\t\tconst autocomplete: AutocompleteProvider = {\n\t\t\tgetSuggestions: (context, autocompleteOptions) =>\n\t\t\t\tnew CombinedAutocompleteProvider(commands, this.session.allowedRoot).getSuggestions(\n\t\t\t\t\tcontext,\n\t\t\t\t\tautocompleteOptions,\n\t\t\t\t),\n\t\t\tapplyCompletion: (context, item, prefix) =>\n\t\t\t\tnew CombinedAutocompleteProvider(commands, this.session.allowedRoot).applyCompletion(context, item, prefix),\n\t\t};\n\t\tthis.editor = new Editor({\n\t\t\tmaxHeight: 3,\n\t\t\tautocomplete,\n\t\t});\n\t\tthis.editor.onSubmit = (text) => void this.submit(text);\n\t\tthis.editor.onEscape = () => this.activeAbort?.abort();\n\t\tthis.editor.onCommand = (data) => this.handleCommand(data);\n\t\tthis.editor.onInterrupt = () => this.exit();\n\t\tthis.editor.onAutocompleteChange = () => this.updateAutocompleteOverlay();\n\t\tconst readViewState = (): InteractiveViewState => ({\n\t\t\t...this.projection.state,\n\t\t\tmodel: this.session.modelId,\n\t\t\ttheme: this.theme,\n\t\t});\n\t\tthis.root = new InteractiveLayout({\n\t\t\theader: new InteractiveHeader(readViewState),\n\t\t\tchat: new InteractiveChat(readViewState),\n\t\t\tcomposer: new InteractiveComposer(readViewState),\n\t\t\teditor: this.editor,\n\t\t\tfooter: new InteractiveFooter(readViewState),\n\t\t});\n\t\tthis.tui.addChild(this.root);\n\t\tthis.tui.setFocus(this.editor);\n\t}\n\n\tstart(initialPrompt?: string): void {\n\t\tif (this.started) throw new Error(\"Interactive mode is already started\");\n\t\tthis.started = true;\n\t\tthis.projection.replaceTranscript(this.session.transcript);\n\t\tthis.projection.setUsage(this.session.usage);\n\t\tthis.subscribeToSession();\n\t\ttry {\n\t\t\tthis.tui.start();\n\t\t} catch (cause) {\n\t\t\tthis.started = false;\n\t\t\tthis.unsubscribeSession?.();\n\t\t\tthis.unsubscribeSession = undefined;\n\t\t\tthrow cause;\n\t\t}\n\t\tthis.startSpinnerTimer();\n\t\tif (initialPrompt?.trim()) void this.submit(initialPrompt);\n\t}\n\n\tstop(): void {\n\t\tif (!this.started && !this.unsubscribeSession) return;\n\t\tthis.started = false;\n\t\tthis.activeAbort?.abort();\n\t\tthis.activeAbort = undefined;\n\t\tthis.stopSpinnerTimer();\n\t\tthis.projection.clearTransientProcess();\n\t\tthis.closeOverlay();\n\t\tthis.closeAutocompleteOverlay();\n\t\tthis.unsubscribeSession?.();\n\t\tthis.unsubscribeSession = undefined;\n\t\tthis.tui.stop({ finalLines: this.root.renderTranscript(this.tui.columns) });\n\t}\n\n\tprivate exit(): void {\n\t\tthis.stop();\n\t\tthis.onExit?.();\n\t}\n\n\tprivate handleCommand(data: string): boolean {\n\t\tif (data === \"\\x14\") {\n\t\t\tthis.openThemeSelector();\n\t\t\treturn true;\n\t\t}\n\t\tif (data === \"\\x13\") {\n\t\t\tthis.openSettingsSelector();\n\t\t\treturn true;\n\t\t}\n\t\tif (data === \"\\x0f\") {\n\t\t\tthis.openModelSelector();\n\t\t\treturn true;\n\t\t}\n\t\tif (data === \"\\x0c\") {\n\t\t\tthis.openSessionSelector();\n\t\t\treturn true;\n\t\t}\n\t\tif (data === \"\\x12\" && this.lastFailedPrompt && !this.promptInFlight) {\n\t\t\tvoid this.submit(this.lastFailedPrompt, true);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate openThemeSelector(): void {\n\t\tconst list = new SelectList([\n\t\t\t{ value: \"dark\", label: \"Dark\", description: \"Dark terminal theme\" },\n\t\t\t{ value: \"light\", label: \"Light\", description: \"Light terminal theme\" },\n\t\t]);\n\t\tlist.onSelect = (item) => {\n\t\t\tthis.theme = item.value === \"light\" ? \"light\" : \"dark\";\n\t\t\tthis.projection.setStatus(`theme=${this.theme}`);\n\t\t\tthis.closeOverlay();\n\t\t\tthis.refresh();\n\t\t};\n\t\tlist.onCancel = () => this.closeOverlay();\n\t\tthis.showOverlay(list);\n\t}\n\n\tprivate openModelSelector(): void {\n\t\tconst list = new SelectList(\n\t\t\tthis.session.availableModels.map((model) => ({\n\t\t\t\tvalue: model.id,\n\t\t\t\tlabel: model.name,\n\t\t\t\tdescription: `${model.provider} / ${model.id} / context ${model.contextWindow}`,\n\t\t\t})),\n\t\t);\n\t\tlist.onSelect = (item) => {\n\t\t\ttry {\n\t\t\t\tthis.session.setModel(item.value);\n\t\t\t\tthis.projection.setStatus(`model=${item.value}`);\n\t\t\t\tthis.closeOverlay();\n\t\t\t\tthis.refresh();\n\t\t\t} catch (cause) {\n\t\t\t\tthis.projection.setError(cause instanceof Error ? cause.message : String(cause));\n\t\t\t}\n\t\t};\n\t\tlist.onCancel = () => this.closeOverlay();\n\t\tthis.showOverlay(list);\n\t}\n\n\tprivate openSessionSelector(): void {\n\t\tconst list = new SelectList([\n\t\t\t{\n\t\t\t\tvalue: \"__current__\",\n\t\t\t\tlabel: \"Current session\",\n\t\t\t\tdescription: this.session.sessionFile ?? \"In-memory session\",\n\t\t\t},\n\t\t\t...this.sessionChoices.map((choice) => ({\n\t\t\t\tvalue: choice.id,\n\t\t\t\tlabel: choice.label,\n\t\t\t\t...(choice.description ? { description: choice.description } : {}),\n\t\t\t})),\n\t\t]);\n\t\tlist.onSelect = (item) => {\n\t\t\tif (item.value === \"__current__\") {\n\t\t\t\tthis.projection.setStatus(\"session=current\");\n\t\t\t\tthis.closeOverlay();\n\t\t\t\tthis.refresh();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst choice = this.sessionChoices.find((candidate) => candidate.id === item.value);\n\t\t\tif (!choice) return;\n\t\t\tthis.closeOverlay();\n\t\t\tvoid this.switchSession(choice);\n\t\t};\n\t\tlist.onCancel = () => this.closeOverlay();\n\t\tthis.showOverlay(list);\n\t}\n\n\tprivate openSettingsSelector(): void {\n\t\tconst list = new SettingsList([\n\t\t\t{\n\t\t\t\tid: \"compaction\",\n\t\t\t\tlabel: \"Context compaction\",\n\t\t\t\tcurrentValue: this.session.compactionEnabled ? \"on\" : \"off\",\n\t\t\t\tvalues: [\"on\", \"off\"],\n\t\t\t\tdescription: \"Summarize older persisted context before the model limit is reached.\",\n\t\t\t},\n\t\t]);\n\t\tlist.onChange = (id, value) => {\n\t\t\tif (id !== \"compaction\") return;\n\t\t\ttry {\n\t\t\t\tconst enabled = this.session.setCompactionEnabled(value === \"on\");\n\t\t\t\tlist.updateValue(id, enabled ? \"on\" : \"off\");\n\t\t\t\tthis.projection.setStatus(\n\t\t\t\t\tenabled === (value === \"on\")\n\t\t\t\t\t\t? `compaction=${enabled ? \"on\" : \"off\"}`\n\t\t\t\t\t\t: \"compaction unavailable without a persisted session\",\n\t\t\t\t);\n\t\t\t} catch (cause) {\n\t\t\t\tlist.updateValue(id, this.session.compactionEnabled ? \"on\" : \"off\");\n\t\t\t\tthis.projection.setError(cause instanceof Error ? cause.message : String(cause));\n\t\t\t\tthis.closeOverlay();\n\t\t\t}\n\t\t\tthis.refresh();\n\t\t};\n\t\tlist.onCancel = () => this.closeOverlay();\n\t\tthis.showOverlay(list);\n\t}\n\n\tprivate showOverlay(component: SelectList | SettingsList): void {\n\t\tthis.editor.cancelAutocomplete();\n\t\tthis.closeAutocompleteOverlay();\n\t\tthis.closeOverlay();\n\t\tthis.overlay = this.tui.showOverlay(component, {\n\t\t\twidth: \"70%\",\n\t\t\tmaxHeight: \"60%\",\n\t\t\tanchor: \"center\",\n\t\t\tmargin: 1,\n\t\t});\n\t}\n\n\tprivate closeOverlay(): void {\n\t\tthis.overlay?.hide();\n\t\tthis.overlay = undefined;\n\t}\n\n\tprivate updateAutocompleteOverlay(): void {\n\t\tthis.closeAutocompleteOverlay();\n\t\tif (!this.editor.isShowingAutocomplete()) {\n\t\t\tthis.refresh();\n\t\t\treturn;\n\t\t}\n\t\tconst menu = new AutocompleteMenu(() => ({\n\t\t\titems: this.editor.getAutocompleteItems(),\n\t\t\tindex: this.editor.getAutocompleteIndex(),\n\t\t}));\n\t\tthis.autocompleteOverlay = this.tui.showOverlay(menu, {\n\t\t\twidth: \"55%\",\n\t\t\tmaxHeight: 8,\n\t\t\tanchor: \"bottom-left\",\n\t\t\tmargin: 1,\n\t\t\tnonCapturing: true,\n\t\t});\n\t\tthis.refresh();\n\t}\n\n\tprivate closeAutocompleteOverlay(): void {\n\t\tthis.autocompleteOverlay?.hide();\n\t\tthis.autocompleteOverlay = undefined;\n\t}\n\n\tprivate refresh(): void {\n\t\tthis.root.invalidate();\n\t\tthis.tui.requestRender();\n\t}\n\n\tprivate startSpinnerTimer(): void {\n\t\tthis.stopSpinnerTimer();\n\t\tthis.spinnerTimer = setInterval(() => {\n\t\t\tif (this.projection.advanceSpinner()) this.refresh();\n\t\t}, 120);\n\t\tthis.spinnerTimer.unref?.();\n\t}\n\n\tprivate stopSpinnerTimer(): void {\n\t\tif (this.spinnerTimer) clearInterval(this.spinnerTimer);\n\t\tthis.spinnerTimer = undefined;\n\t}\n\n\tprivate subscribeToSession(): void {\n\t\tthis.unsubscribeSession?.();\n\t\tthis.unsubscribeSession = this.session.subscribeSession((event) => {\n\t\t\tif (!this.started) return;\n\t\t\tthis.projection.apply(event);\n\t\t\tthis.refresh();\n\t\t});\n\t}\n\n\tprivate async switchSession(choice: InteractiveSessionChoice): Promise<void> {\n\t\tif (this.promptInFlight || this.sessionSwitching) {\n\t\t\tthis.projection.setError(\"Cannot switch sessions while a prompt is running.\");\n\t\t\tthis.refresh();\n\t\t\treturn;\n\t\t}\n\t\tthis.sessionSwitching = true;\n\t\tthis.projection.setStatus(`opening session=${choice.id}`);\n\t\tthis.refresh();\n\t\ttry {\n\t\t\tconst next = await choice.open();\n\t\t\tif (!this.started) return;\n\t\t\tthis.unsubscribeSession?.();\n\t\t\tthis.session = next;\n\t\t\tthis.queuedPrompts = [];\n\t\t\tthis.projection.setQueue([]);\n\t\t\tthis.projection.replaceTranscript(next.transcript);\n\t\t\tthis.projection.setUsage(next.usage);\n\t\t\tthis.projection.setStatus(`session=${choice.id}`);\n\t\t\tthis.subscribeToSession();\n\t\t} catch (cause) {\n\t\t\tthis.projection.setError(cause instanceof Error ? cause.message : String(cause));\n\t\t} finally {\n\t\t\tthis.sessionSwitching = false;\n\t\t}\n\t\tthis.refresh();\n\t}\n\n\tprivate async submit(text: string, retry = false): Promise<void> {\n\t\tconst prompt = text.trim();\n\t\tif (prompt.length === 0 || !this.started) return;\n\t\tif (prompt.startsWith(\"/\")) {\n\t\t\tthis.editor.setValue(\"\");\n\t\t\tthis.handleSlashCommand(prompt);\n\t\t\treturn;\n\t\t}\n\t\tif (this.sessionSwitching) {\n\t\t\tthis.projection.setError(\"A session is opening; wait before submitting a prompt.\");\n\t\t\tthis.refresh();\n\t\t\treturn;\n\t\t}\n\t\tif (this.compactionInFlight) {\n\t\t\tthis.projection.setError(\"A compaction is running; wait before submitting a prompt.\");\n\t\t\tthis.refresh();\n\t\t\treturn;\n\t\t}\n\t\tif (this.promptInFlight) {\n\t\t\tthis.queuedPrompts.push(prompt);\n\t\t\tthis.projection.setQueue(this.queuedPrompts);\n\t\t\tthis.root.invalidate();\n\t\t\tthis.tui.requestRender();\n\t\t\treturn;\n\t\t}\n\t\tthis.promptInFlight = true;\n\t\tthis.activeAbort = new AbortController();\n\t\tthis.projection.setRetrying(retry);\n\t\tthis.editor.setValue(\"\");\n\t\ttry {\n\t\t\tconst result = await this.session.prompt(prompt, this.activeAbort.signal);\n\t\t\tif (result.stopReason === \"error\" || result.stopReason === \"aborted\") this.lastFailedPrompt = prompt;\n\t\t\telse this.lastFailedPrompt = undefined;\n\t\t} catch (cause) {\n\t\t\tthis.lastFailedPrompt = prompt;\n\t\t\tthis.projection.setError(cause instanceof Error ? cause.message : String(cause));\n\t\t} finally {\n\t\t\tthis.promptInFlight = false;\n\t\t\tthis.activeAbort = undefined;\n\t\t\tthis.projection.setRetrying(false);\n\t\t\tconst next = this.queuedPrompts.shift();\n\t\t\tthis.projection.setQueue(this.queuedPrompts);\n\t\t\tthis.root.invalidate();\n\t\t\tthis.tui.requestRender();\n\t\t\tif (next && this.started) void this.submit(next);\n\t\t}\n\t}\n\n\tprivate handleSlashCommand(input: string): void {\n\t\tconst command = input.slice(1).trim().split(/\\s+/, 1)[0]?.toLowerCase();\n\t\tswitch (command) {\n\t\t\tcase \"help\":\n\t\t\t\tthis.projection.setStatus(\"commands: /clear /model /session /theme /settings /compact /usage /retry\");\n\t\t\t\tbreak;\n\t\t\tcase \"clear\":\n\t\t\t\tthis.projection.clearVisibleMessages();\n\t\t\t\tthis.projection.setStatus(\"visible messages cleared\");\n\t\t\t\tbreak;\n\t\t\tcase \"model\":\n\t\t\t\tthis.openModelSelector();\n\t\t\t\treturn;\n\t\t\tcase \"session\":\n\t\t\t\tthis.openSessionSelector();\n\t\t\t\treturn;\n\t\t\tcase \"theme\":\n\t\t\t\tthis.openThemeSelector();\n\t\t\t\treturn;\n\t\t\tcase \"settings\":\n\t\t\t\tthis.openSettingsSelector();\n\t\t\t\treturn;\n\t\t\tcase \"compact\":\n\t\t\t\tvoid this.runManualCompaction();\n\t\t\t\treturn;\n\t\t\tcase \"usage\":\n\t\t\t\tthis.projection.setStatus(this.formatUsage());\n\t\t\t\tbreak;\n\t\t\tcase \"retry\":\n\t\t\t\tif (this.lastFailedPrompt && !this.promptInFlight) void this.submit(this.lastFailedPrompt, true);\n\t\t\t\telse this.projection.setStatus(\"nothing to retry\");\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tthis.projection.setError(`Unknown command: /${command ?? \"\"}`);\n\t\t}\n\t\tthis.refresh();\n\t}\n\n\tprivate formatUsage(): string {\n\t\tconst usage = this.session.usage;\n\t\treturn `usage: requests=${usage.requestCount} input=${usage.inputTokens} output=${usage.outputTokens} total=${usage.totalTokens} cost=$${usage.cost.total.toFixed(4)} context=${usage.estimatedContextTokens}/${usage.contextWindow}`;\n\t}\n\n\tprivate async runManualCompaction(): Promise<void> {\n\t\tif (this.promptInFlight || this.compactionInFlight) {\n\t\t\tthis.projection.setError(\"Cannot compact while a prompt is running.\");\n\t\t\tthis.refresh();\n\t\t\treturn;\n\t\t}\n\t\tthis.compactionInFlight = true;\n\t\tthis.projection.setStatus(\"starting manual compaction\");\n\t\tthis.refresh();\n\t\ttry {\n\t\t\tawait this.session.compact();\n\t\t\tthis.projection.setStatus(\"manual compaction complete\");\n\t\t} catch (cause) {\n\t\t\tthis.projection.setError(cause instanceof Error ? cause.message : String(cause));\n\t\t} finally {\n\t\t\tthis.compactionInFlight = false;\n\t\t\tthis.refresh();\n\t\t}\n\t}\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import type { AgentEvent, AgentListener } from "@di-code/agent";
2
+ import type { AssistantMessage } from "@di-code/ai";
3
+ import type { PrintIo } from "./print.ts";
4
+ export declare const JSON_EVENT_VERSION: 2;
5
+ export interface JsonEventRecord {
6
+ readonly version: typeof JSON_EVENT_VERSION;
7
+ readonly event: AgentEvent;
8
+ }
9
+ export interface JsonRunner {
10
+ prompt(text: string): Promise<AssistantMessage>;
11
+ subscribe(listener: AgentListener): () => void;
12
+ }
13
+ export declare function runJsonMode(prompt: string, runner: JsonRunner, io: PrintIo): Promise<number>;
14
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/modes/json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,eAAO,MAAM,kBAAkB,EAAG,CAAU,CAAC;AAE7C,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,OAAO,EAAE,OAAO,kBAAkB,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;CAC3B;AAED,MAAM,WAAW,UAAU;IAC1B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAChD,SAAS,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,IAAI,CAAC;CAC/C;AAMD,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBlG"}
@@ -0,0 +1,26 @@
1
+ export const JSON_EVENT_VERSION = 2;
2
+ function toError(cause) {
3
+ return cause instanceof Error ? cause : new Error(String(cause));
4
+ }
5
+ export async function runJsonMode(prompt, runner, io) {
6
+ const unsubscribe = runner.subscribe((event) => {
7
+ const record = { version: JSON_EVENT_VERSION, event };
8
+ io.stdout(`${JSON.stringify(record)}\n`);
9
+ });
10
+ try {
11
+ const assistant = await runner.prompt(prompt);
12
+ if (assistant.stopReason === "error" || assistant.stopReason === "aborted") {
13
+ io.stderr(`${assistant.errorMessage}\n`);
14
+ return 1;
15
+ }
16
+ return 0;
17
+ }
18
+ catch (cause) {
19
+ io.stderr(`${toError(cause).message}\n`);
20
+ return 1;
21
+ }
22
+ finally {
23
+ unsubscribe();
24
+ }
25
+ }
26
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/modes/json.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAU,CAAC;AAY7C,SAAS,OAAO,CAAC,KAAc;IAC9B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAc,EAAE,MAAkB,EAAE,EAAW;IAChF,MAAM,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE;QAC9C,MAAM,MAAM,GAAoB,EAAE,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,CAAC;QACvE,EAAE,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC;QACJ,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC9C,IAAI,SAAS,CAAC,UAAU,KAAK,OAAO,IAAI,SAAS,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;YAC5E,EAAE,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,YAAY,IAAI,CAAC,CAAC;YACzC,OAAO,CAAC,CAAC;QACV,CAAC;QACD,OAAO,CAAC,CAAC;IACV,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,EAAE,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC;QACzC,OAAO,CAAC,CAAC;IACV,CAAC;YAAS,CAAC;QACV,WAAW,EAAE,CAAC;IACf,CAAC;AACF,CAAC","sourcesContent":["import type { AgentEvent, AgentListener } from \"@di-code/agent\";\nimport type { AssistantMessage } from \"@di-code/ai\";\nimport type { PrintIo } from \"./print.ts\";\n\nexport const JSON_EVENT_VERSION = 2 as const;\n\nexport interface JsonEventRecord {\n\treadonly version: typeof JSON_EVENT_VERSION;\n\treadonly event: AgentEvent;\n}\n\nexport interface JsonRunner {\n\tprompt(text: string): Promise<AssistantMessage>;\n\tsubscribe(listener: AgentListener): () => void;\n}\n\nfunction toError(cause: unknown): Error {\n\treturn cause instanceof Error ? cause : new Error(String(cause));\n}\n\nexport async function runJsonMode(prompt: string, runner: JsonRunner, io: PrintIo): Promise<number> {\n\tconst unsubscribe = runner.subscribe((event) => {\n\t\tconst record: JsonEventRecord = { version: JSON_EVENT_VERSION, event };\n\t\tio.stdout(`${JSON.stringify(record)}\\n`);\n\t});\n\n\ttry {\n\t\tconst assistant = await runner.prompt(prompt);\n\t\tif (assistant.stopReason === \"error\" || assistant.stopReason === \"aborted\") {\n\t\t\tio.stderr(`${assistant.errorMessage}\\n`);\n\t\t\treturn 1;\n\t\t}\n\t\treturn 0;\n\t} catch (cause) {\n\t\tio.stderr(`${toError(cause).message}\\n`);\n\t\treturn 1;\n\t} finally {\n\t\tunsubscribe();\n\t}\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import type { AssistantMessage } from "@di-code/ai";
2
+ export interface PrintIo {
3
+ stdout(text: string): void;
4
+ stderr(text: string): void;
5
+ }
6
+ export interface PromptRunner {
7
+ prompt(text: string): Promise<AssistantMessage>;
8
+ }
9
+ export declare function runPrintMode(prompt: string, runner: PromptRunner, io: PrintIo): Promise<number>;
10
+ //# sourceMappingURL=print.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"print.d.ts","sourceRoot":"","sources":["../../src/modes/print.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,WAAW,OAAO;IACvB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC5B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAChD;AAeD,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBrG"}
@@ -0,0 +1,28 @@
1
+ function toError(cause) {
2
+ return cause instanceof Error ? cause : new Error(String(cause));
3
+ }
4
+ function textContent(message) {
5
+ return message.content
6
+ .filter((content) => content.type === "text")
7
+ .map((content) => content.text)
8
+ .join("");
9
+ }
10
+ export async function runPrintMode(prompt, runner, io) {
11
+ try {
12
+ const assistant = await runner.prompt(prompt);
13
+ if (assistant.stopReason === "error" || assistant.stopReason === "aborted") {
14
+ io.stderr(`${assistant.errorMessage}\n`);
15
+ return 1;
16
+ }
17
+ const text = textContent(assistant);
18
+ if (text.length > 0) {
19
+ io.stdout(`${text}\n`);
20
+ }
21
+ return 0;
22
+ }
23
+ catch (cause) {
24
+ io.stderr(`${toError(cause).message}\n`);
25
+ return 1;
26
+ }
27
+ }
28
+ //# sourceMappingURL=print.js.map
@@ -0,0 +1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CAAC;AACF,CAAC","sourcesContent":["import type { AssistantMessage } from \"@di-code/ai\";\n\nexport interface PrintIo {\n\tstdout(text: string): void;\n\tstderr(text: string): void;\n}\n\nexport interface PromptRunner {\n\tprompt(text: string): Promise<AssistantMessage>;\n}\n\nfunction toError(cause: unknown): Error {\n\treturn cause instanceof Error ? cause : new Error(String(cause));\n}\n\nfunction textContent(message: AssistantMessage): string {\n\treturn message.content\n\t\t.filter(\n\t\t\t(content): content is Extract<AssistantMessage[\"content\"][number], { type: \"text\" }> => content.type === \"text\",\n\t\t)\n\t\t.map((content) => content.text)\n\t\t.join(\"\");\n}\n\nexport async function runPrintMode(prompt: string, runner: PromptRunner, io: PrintIo): Promise<number> {\n\ttry {\n\t\tconst assistant = await runner.prompt(prompt);\n\t\tif (assistant.stopReason === \"error\" || assistant.stopReason === \"aborted\") {\n\t\t\tio.stderr(`${assistant.errorMessage}\\n`);\n\t\t\treturn 1;\n\t\t}\n\n\t\tconst text = textContent(assistant);\n\t\tif (text.length > 0) {\n\t\t\tio.stdout(`${text}\\n`);\n\t\t}\n\t\treturn 0;\n\t} catch (cause) {\n\t\tio.stderr(`${toError(cause).message}\\n`);\n\t\treturn 1;\n\t}\n}\n"]}
@@ -0,0 +1,13 @@
1
+ import { type Terminal } from "@di-code/tui";
2
+ import type { CliCommand } from "./cli.ts";
3
+ import { type StartupConfiguration, type StartupRuntime } from "./startup.ts";
4
+ export type StartupRunCommand = Extract<CliCommand, {
5
+ kind: "run";
6
+ }>;
7
+ export interface ProviderOnboardingOptions {
8
+ readonly configuration: StartupConfiguration;
9
+ readonly terminal: Terminal;
10
+ }
11
+ export declare function shouldStartProviderOnboarding(command: StartupRunCommand, isInteractiveTerminal: boolean, configuration: StartupConfiguration): boolean;
12
+ export declare function runProviderOnboarding(options: ProviderOnboardingOptions): Promise<StartupRuntime | undefined>;
13
+ //# sourceMappingURL=provider-onboarding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider-onboarding.d.ts","sourceRoot":"","sources":["../src/provider-onboarding.ts"],"names":[],"mappings":"AACA,OAAO,EAA+D,KAAK,QAAQ,EAAa,MAAM,cAAc,CAAC;AACrH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAyB,KAAK,oBAAoB,EAAE,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAErG,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,UAAU,EAAE;IAAE,IAAI,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;AAErE,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,aAAa,EAAE,oBAAoB,CAAC;IAC7C,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC5B;AAED,wBAAgB,6BAA6B,CAC5C,OAAO,EAAE,iBAAiB,EAC1B,qBAAqB,EAAE,OAAO,EAC9B,aAAa,EAAE,oBAAoB,GACjC,OAAO,CAOT;AAgFD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAmF7G"}