motifcode 0.3.0 → 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.0",
3
- "bytes": 445102,
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;
@@ -7094,7 +7101,6 @@ async function doctor(opts) {
7094
7101
  } : { name: "reasoning parser", state: "unknown", detail: "no reasoning in the probe response" }
7095
7102
  );
7096
7103
  let cached2 = json.usage?.prompt_tokens_details?.cached_tokens;
7097
- const reports = cached2 !== void 0;
7098
7104
  try {
7099
7105
  const again = await fetchImpl(`${endpoint}/v1/chat/completions`, {
7100
7106
  method: "POST",
@@ -7108,6 +7114,7 @@ async function doctor(opts) {
7108
7114
  }
7109
7115
  } catch {
7110
7116
  }
7117
+ const reports = cached2 !== void 0;
7111
7118
  checks.push(
7112
7119
  typeof cached2 === "number" && cached2 > 0 ? {
7113
7120
  name: "prefix caching",
@@ -9090,10 +9097,12 @@ function loadPlugins(opts) {
9090
9097
  };
9091
9098
  }
9092
9099
  function describePlugins(loaded) {
9093
- if (loaded.plugins.length === 0) return ["no plugins; add one under ~/.motif/plugins/<name>/ or .motif/plugins/<name>/ with a plugin.json"];
9094
- const lines = loaded.plugins.map(
9095
- (p) => `${p.name.padEnd(16)} ${p.description}${p.version ? ` (${p.version})` : ""} \xB7 ${p.source} \xB7 ${p.skills.length} skill(s)${p.skills.length ? `: ${p.skills.join(", ")}` : ""}${p.agents.length ? ` \xB7 ${p.agents.length} agent(s): ${p.agents.join(", ")}` : ""}`
9096
- );
9100
+ if (loaded.plugins.length === 0 && loaded.problems.length === 0) {
9101
+ return ["no plugins; add one under ~/.motif/plugins/{name}/ or .motif/plugins/{name}/ with a plugin.json"];
9102
+ }
9103
+ const lines = loaded.plugins.map(function(p) {
9104
+ return `${p.name.padEnd(16)} ${p.description}${p.version ? ` (${p.version})` : ""} \xB7 ${p.source} \xB7 ${p.skills.length} skill(s)${p.skills.length ? `: ${p.skills.join(", ")}` : ""}${p.agents.length ? ` \xB7 ${p.agents.length} agent(s): ${p.agents.join(", ")}` : ""}`;
9105
+ });
9097
9106
  for (const p of loaded.problems) lines.push(`! ${p}`);
9098
9107
  return lines;
9099
9108
  }
@@ -9209,7 +9218,7 @@ function saveUserSetting(key, value, home = homedir4()) {
9209
9218
  }
9210
9219
 
9211
9220
  // packages/cli/src/main.ts
9212
- var VERSION = "0.3.0";
9221
+ var VERSION = "0.3.2";
9213
9222
  var SHORT_FLAGS = { p: "print", c: "continue", i: "interactive", v: "verbose", h: "help" };
9214
9223
  var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
9215
9224
  "print",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "motifcode",
3
- "version": "0.3.0",
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": [