@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 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` | Start a new session |
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mumbrane/arrakis",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "Arrakis: a coding agent for your terminal, built by Mumbrane",
5
5
  "type": "module",
6
6
  "main": "./index.js",
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
- ui.banner({
317
- version: VERSION,
318
- model: config.model,
319
- provider: config.providerName || config.baseUrl,
320
- cwd,
321
- instructions: loadProjectInstructions(cwd).filter((i) => i.text.trim()).map((i) => i.file),
322
- resumed: agent.session.messages.length ? `resumed ${agent.session.id} (${agent.session.messages.length} messages)` : '',
323
- mcp: mcpServers,
324
- hooks,
325
- update,
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
- ui.info(`Started new session ${agent.session.id}.`);
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.out.write('\x1b[2J\x1b[H');
337
- this.regionRows = 0;
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');