@mumbrane/arrakis 0.8.0 → 0.8.1
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.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/cli.js +21 -13
- package/src/tui.js +20 -2
- package/src/ui.js +7 -0
package/README.md
CHANGED
|
@@ -69,7 +69,7 @@ In a session:
|
|
|
69
69
|
| `/compact` | Summarize history to free up context |
|
|
70
70
|
| `/model [name]` | Pick a model from your provider |
|
|
71
71
|
| `/provider` | Switch provider or update your API key |
|
|
72
|
-
| `/clear` |
|
|
72
|
+
| `/clear` | Clear the screen and start a fresh session (the old one stays saved) |
|
|
73
73
|
| `/yolo` | Toggle running tool calls without asking |
|
|
74
74
|
| `/exit` | Quit (or Ctrl-D) |
|
|
75
75
|
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -313,17 +313,19 @@ async function interactive({ agent, ui, prompts, config, cwd, firstPrompt, mcpSe
|
|
|
313
313
|
return parts.join(' · ');
|
|
314
314
|
};
|
|
315
315
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
316
|
+
state.showBanner = () =>
|
|
317
|
+
ui.banner({
|
|
318
|
+
version: VERSION,
|
|
319
|
+
model: config.model,
|
|
320
|
+
provider: config.providerName || config.baseUrl,
|
|
321
|
+
cwd,
|
|
322
|
+
instructions: loadProjectInstructions(cwd).filter((i) => i.text.trim()).map((i) => i.file),
|
|
323
|
+
resumed: agent.session.messages.length ? `resumed ${agent.session.id} (${agent.session.messages.length} messages)` : '',
|
|
324
|
+
mcp: mcpServers,
|
|
325
|
+
hooks,
|
|
326
|
+
update,
|
|
327
|
+
});
|
|
328
|
+
state.showBanner();
|
|
327
329
|
|
|
328
330
|
const send = async (text) => {
|
|
329
331
|
const { content, attached, errors } = buildMessage(text, cwd, state.pastedImages.splice(0));
|
|
@@ -541,12 +543,18 @@ async function slashCommand(text, { agent, ui, prompts, config, cwd, state }) {
|
|
|
541
543
|
case 'exit':
|
|
542
544
|
case 'quit':
|
|
543
545
|
return 'exit';
|
|
544
|
-
case 'clear':
|
|
546
|
+
case 'clear': {
|
|
547
|
+
const previous = agent.session.messages.length ? agent.session.id : null;
|
|
545
548
|
agent.session = Session.create({ cwd, model: config.model });
|
|
546
549
|
agent.checkpoints = new Checkpoints(agent.session.file);
|
|
547
550
|
agent.systemPrompt = null;
|
|
548
|
-
|
|
551
|
+
agent.todos = [];
|
|
552
|
+
agent.notes = [];
|
|
553
|
+
ui.clearScreen();
|
|
554
|
+
state.showBanner?.();
|
|
555
|
+
if (previous) ui.info(` Fresh start. The previous conversation is saved: /resume or arrakis -r ${previous}`);
|
|
549
556
|
break;
|
|
557
|
+
}
|
|
550
558
|
case 'compact': {
|
|
551
559
|
const ac = new AbortController();
|
|
552
560
|
agent.abort = ac;
|
package/src/tui.js
CHANGED
|
@@ -333,8 +333,8 @@ export class FancyUI extends UI {
|
|
|
333
333
|
const nl = this.buffer.indexOf('\n', this.cursor);
|
|
334
334
|
this.buffer = this.buffer.slice(0, this.cursor) + (nl < 0 ? '' : this.buffer.slice(nl));
|
|
335
335
|
} else if (key.ctrl && name === 'l') {
|
|
336
|
-
this.
|
|
337
|
-
this.
|
|
336
|
+
this.clearScreen();
|
|
337
|
+
return this.render();
|
|
338
338
|
} else if (str === '?' && !this.buffer) {
|
|
339
339
|
this.showHelp = !this.showHelp;
|
|
340
340
|
return this.render();
|
|
@@ -542,6 +542,24 @@ export class FancyUI extends UI {
|
|
|
542
542
|
this.drawRegion();
|
|
543
543
|
}
|
|
544
544
|
|
|
545
|
+
// Clear the screen and scrollback, and forget what was printed, so a resize
|
|
546
|
+
// doesn't bring it back. The input area is redrawn by the next render.
|
|
547
|
+
clearScreen() {
|
|
548
|
+
this.thinkBuf = '';
|
|
549
|
+
this.md = null;
|
|
550
|
+
this.mode = null;
|
|
551
|
+
this.partial = '';
|
|
552
|
+
this.transcript = [];
|
|
553
|
+
this.transcriptSize = 0;
|
|
554
|
+
this.out.write('\x1b[2J\x1b[3J\x1b[H');
|
|
555
|
+
this.regionRows = 0;
|
|
556
|
+
this.regionCursorRow = 0;
|
|
557
|
+
this.regionCursorCol = 0;
|
|
558
|
+
this.regionWidths = [];
|
|
559
|
+
this.lastBlank = true;
|
|
560
|
+
this.atLineStart = true;
|
|
561
|
+
}
|
|
562
|
+
|
|
545
563
|
handleResize() {
|
|
546
564
|
const cols = this.out.columns;
|
|
547
565
|
if (cols === this.lastCols || !this.active) return this.render();
|
package/src/ui.js
CHANGED
|
@@ -377,6 +377,13 @@ export class UI {
|
|
|
377
377
|
this.write(this.out, t.mist(' /help for commands · Ctrl-C to interrupt · Ctrl-D to quit\n\n'));
|
|
378
378
|
}
|
|
379
379
|
|
|
380
|
+
// Clear the screen and the scrollback.
|
|
381
|
+
clearScreen() {
|
|
382
|
+
this.endText();
|
|
383
|
+
if (this.out.isTTY) this.out.write('\x1b[2J\x1b[3J\x1b[H');
|
|
384
|
+
this.atLineStart = true;
|
|
385
|
+
}
|
|
386
|
+
|
|
380
387
|
info(msg) {
|
|
381
388
|
this.endText();
|
|
382
389
|
this.write(this.log, this.lc.mist(msg) + '\n');
|