motifcode 0.3.1 → 0.3.2

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.3.1",
3
- "bytes": 445159,
2
+ "version": "0.3.2",
3
+ "bytes": 445459,
4
4
  "node": "v22.23.2"
5
5
  }
package/dist/motif.js CHANGED
@@ -5241,6 +5241,7 @@ var term = {
5241
5241
  };
5242
5242
 
5243
5243
  // packages/tui/src/keys.ts
5244
+ import { StringDecoder } from "node:string_decoder";
5244
5245
  var ESC2 = "\x1B";
5245
5246
  var PASTE_START = `${ESC2}[200~`;
5246
5247
  var PASTE_END = `${ESC2}[201~`;
@@ -5310,13 +5311,19 @@ function controlKey(code) {
5310
5311
  }
5311
5312
  }
5312
5313
  var KeyDecoder = class {
5314
+ // Byte boundaries and escape-sequence boundaries are separate concerns.
5315
+ utf8 = new StringDecoder("utf8");
5313
5316
  pasting = false;
5314
5317
  paste = "";
5315
5318
  /** An escape sequence cut off by the end of a read; completed by the next one. */
5316
5319
  pending = "";
5317
5320
  feed(chunk) {
5321
+ return this.parse(typeof chunk === "string" ? chunk : this.utf8.write(chunk));
5322
+ }
5323
+ /** Parse decoded text only; recursive paste parsing must not touch buffered bytes. */
5324
+ parse(chunk) {
5318
5325
  const out = [];
5319
- let s = this.pending + (typeof chunk === "string" ? chunk : chunk.toString("utf8"));
5326
+ let s = this.pending + chunk;
5320
5327
  this.pending = "";
5321
5328
  if (this.pasting) {
5322
5329
  const end = s.indexOf(PASTE_END);
@@ -5352,7 +5359,7 @@ var KeyDecoder = class {
5352
5359
  if (s.startsWith(PASTE_START, i)) {
5353
5360
  this.pasting = true;
5354
5361
  const rest = s.slice(i + PASTE_START.length);
5355
- const tail = this.feed(rest);
5362
+ const tail = this.parse(rest);
5356
5363
  out.push(...tail);
5357
5364
  return out;
5358
5365
  }
@@ -5574,7 +5581,7 @@ var Composer = class {
5574
5581
  submit() {
5575
5582
  const shown = this.text.replace(/\s+$/, "");
5576
5583
  const text = this.expanded(shown);
5577
- if (shown !== "" && this.history[this.history.length - 1] !== shown) this.history.push(shown);
5584
+ if (text !== "" && this.history[this.history.length - 1] !== text) this.history.push(text);
5578
5585
  this.clear();
5579
5586
  this.pastes.clear();
5580
5587
  return text;
@@ -9211,7 +9218,7 @@ function saveUserSetting(key, value, home = homedir4()) {
9211
9218
  }
9212
9219
 
9213
9220
  // packages/cli/src/main.ts
9214
- var VERSION = "0.3.1";
9221
+ var VERSION = "0.3.2";
9215
9222
  var SHORT_FLAGS = { p: "print", c: "continue", i: "interactive", v: "verbose", h: "help" };
9216
9223
  var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
9217
9224
  "print",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motifcode",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
5
  "description": "Unofficial coding agent harness built for Motif-3: a Claude Code-style terminal session over the hosted endpoint",
6
6
  "keywords": [