@moxxy/cli 0.50.3 → 0.50.4

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 (2) hide show
  1. package/dist/bin.js +242 -8
  2. package/package.json +2 -2
package/dist/bin.js CHANGED
@@ -41726,9 +41726,9 @@ var require_react_development = __commonJS({
41726
41726
  }
41727
41727
  function getSourceInfoErrorAddendum(source) {
41728
41728
  if (source !== void 0) {
41729
- var fileName = source.fileName.replace(/^.*[\\\/]/, "");
41729
+ var fileName2 = source.fileName.replace(/^.*[\\\/]/, "");
41730
41730
  var lineNumber = source.lineNumber;
41731
- return "\n\nCheck your code at " + fileName + ":" + lineNumber + ".";
41731
+ return "\n\nCheck your code at " + fileName2 + ":" + lineNumber + ".";
41732
41732
  }
41733
41733
  return "";
41734
41734
  }
@@ -72481,6 +72481,235 @@ var init_agent_computer = __esm({
72481
72481
  "../chat-model/dist/agent-computer.js"() {
72482
72482
  }
72483
72483
  });
72484
+
72485
+ // ../chat-model/dist/agent-markup.js
72486
+ function agentMarkupAsText(text3, options = {}) {
72487
+ return rewrite(text3, options.streaming === true, { file: (path74, local) => local ?? path74, title: (title) => title });
72488
+ }
72489
+ function agentMarkupAsSpeech(text3) {
72490
+ return rewrite(text3, false, { file: (path74, local) => fileName(local ?? path74), title: (title) => title });
72491
+ }
72492
+ function rewrite(text3, streaming, render4) {
72493
+ if (!text3.includes(":") && !text3.includes(SEARCH_OPEN))
72494
+ return text3;
72495
+ const { found, tail } = scan(text3);
72496
+ const end = streaming && tail !== null ? tail : text3.length;
72497
+ if (found.length === 0)
72498
+ return end === text3.length ? text3 : text3.slice(0, end);
72499
+ let out = "";
72500
+ let at = 0;
72501
+ for (const item of found) {
72502
+ out += text3.slice(at, item.start);
72503
+ if (item.kind === "file")
72504
+ out += render4.file(item.value, localPath(item.value));
72505
+ else if (item.kind === "title")
72506
+ out += render4.title(item.value);
72507
+ at = item.end;
72508
+ }
72509
+ return out + text3.slice(at, end);
72510
+ }
72511
+ function scan(text3) {
72512
+ const found = [];
72513
+ let tail = null;
72514
+ for (const [from, to] of proseRanges(text3)) {
72515
+ let at = from;
72516
+ while (at < to) {
72517
+ const char = text3[at];
72518
+ if (char === "`") {
72519
+ at = afterCodeSpan(text3, at, to);
72520
+ continue;
72521
+ }
72522
+ if (char === SEARCH_OPEN) {
72523
+ if (!text3.startsWith(SEARCH_PREFIX, at)) {
72524
+ if (to === text3.length && SEARCH_PREFIX.startsWith(text3.slice(at)))
72525
+ tail = at;
72526
+ at += 1;
72527
+ continue;
72528
+ }
72529
+ const close = text3.indexOf(SEARCH_CLOSE, at);
72530
+ if (close === -1 || close >= to) {
72531
+ if (to === text3.length)
72532
+ tail = at;
72533
+ break;
72534
+ }
72535
+ found.push({ start: at, end: close + 1, kind: "drop" });
72536
+ at = close + 1;
72537
+ continue;
72538
+ }
72539
+ if (char === ":") {
72540
+ DIRECTIVE.lastIndex = at;
72541
+ const name = DIRECTIVE.exec(text3)?.[1];
72542
+ if (name !== void 0 && text3[at - 1] !== ":" && text3[at - 1] !== "\\") {
72543
+ const parsed = parseAttributes(text3, DIRECTIVE.lastIndex, to);
72544
+ if (parsed.kind === "incomplete") {
72545
+ if (to === text3.length)
72546
+ tail = at;
72547
+ break;
72548
+ }
72549
+ const item = parsed.kind === "ok" ? directive(name, at, parsed) : null;
72550
+ if (item !== null) {
72551
+ found.push(item);
72552
+ at = item.end;
72553
+ continue;
72554
+ }
72555
+ }
72556
+ }
72557
+ at += 1;
72558
+ }
72559
+ }
72560
+ return { found, tail: tail ?? partialOpener(text3) };
72561
+ }
72562
+ function directive(name, start, parsed) {
72563
+ if (name === "browser-complete") {
72564
+ return { start, end: parsed.end, kind: "title", value: parsed.attributes.get("title") ?? "" };
72565
+ }
72566
+ const path74 = parsed.attributes.get("path");
72567
+ return path74 ? { start, end: parsed.end, kind: "file", value: path74 } : null;
72568
+ }
72569
+ function proseRanges(text3) {
72570
+ const ranges = [];
72571
+ let start = 0;
72572
+ let fence = null;
72573
+ let line = 0;
72574
+ for (; ; ) {
72575
+ const next = text3.indexOf("\n", line);
72576
+ const lineEnd2 = next === -1 ? text3.length : next;
72577
+ const marker = FENCE.exec(text3.slice(line, lineEnd2))?.[1];
72578
+ if (fence === null && marker) {
72579
+ ranges.push([start, line]);
72580
+ fence = marker;
72581
+ } else if (fence !== null && marker && marker[0] === fence[0] && marker.length >= fence.length) {
72582
+ fence = null;
72583
+ start = lineEnd2;
72584
+ }
72585
+ if (next === -1)
72586
+ break;
72587
+ line = next + 1;
72588
+ }
72589
+ if (fence === null)
72590
+ ranges.push([start, text3.length]);
72591
+ return ranges;
72592
+ }
72593
+ function afterCodeSpan(text3, at, to) {
72594
+ let run2 = 1;
72595
+ while (text3[at + run2] === "`")
72596
+ run2 += 1;
72597
+ const ticks = "`".repeat(run2);
72598
+ let close = text3.indexOf(ticks, at + run2);
72599
+ while (close !== -1 && close < to) {
72600
+ let length = run2;
72601
+ while (text3[close + length] === "`")
72602
+ length += 1;
72603
+ if (length === run2)
72604
+ return close + run2;
72605
+ close = text3.indexOf(ticks, close + length);
72606
+ }
72607
+ return at + run2;
72608
+ }
72609
+ function parseAttributes(text3, from, to) {
72610
+ const limit = Math.min(to, from + MAX_LENGTH);
72611
+ const ran = () => ({ kind: limit === text3.length ? "incomplete" : "bad" });
72612
+ const attributes = /* @__PURE__ */ new Map();
72613
+ let at = from;
72614
+ for (; ; ) {
72615
+ while (text3[at] === " " || text3[at] === " ")
72616
+ at += 1;
72617
+ if (at >= limit)
72618
+ return ran();
72619
+ if (text3[at] === "}")
72620
+ return { kind: "ok", end: at + 1, attributes };
72621
+ KEY.lastIndex = at;
72622
+ const key = KEY.exec(text3)?.[0];
72623
+ if (!key)
72624
+ return { kind: "bad" };
72625
+ at += key.length;
72626
+ if (at >= limit)
72627
+ return ran();
72628
+ if (text3[at] !== "=")
72629
+ return { kind: "bad" };
72630
+ at += 1;
72631
+ if (at >= limit)
72632
+ return ran();
72633
+ let value2 = "";
72634
+ if (text3[at] === '"') {
72635
+ at += 1;
72636
+ for (; ; ) {
72637
+ if (at >= limit)
72638
+ return ran();
72639
+ const char = text3[at];
72640
+ if (char === "\n")
72641
+ return { kind: "bad" };
72642
+ if (char === "\\" && text3[at + 1] === '"') {
72643
+ value2 += '"';
72644
+ at += 2;
72645
+ continue;
72646
+ }
72647
+ at += 1;
72648
+ if (char === '"')
72649
+ break;
72650
+ value2 += char;
72651
+ }
72652
+ if (at >= limit)
72653
+ return ran();
72654
+ if (text3[at] !== " " && text3[at] !== " " && text3[at] !== "}")
72655
+ return { kind: "bad" };
72656
+ } else {
72657
+ while (at < limit && !/[\s}]/u.test(text3[at] ?? ""))
72658
+ value2 += text3[at++];
72659
+ if (at >= limit)
72660
+ return ran();
72661
+ if (value2 === "" || text3[at] === "\n")
72662
+ return { kind: "bad" };
72663
+ }
72664
+ if (!attributes.has(key))
72665
+ attributes.set(key, value2);
72666
+ }
72667
+ }
72668
+ function partialOpener(text3) {
72669
+ const colon = text3.lastIndexOf(":");
72670
+ if (colon === -1 || text3.length - colon < 3)
72671
+ return null;
72672
+ const rest = text3.slice(colon);
72673
+ if (!OPENERS.some((opener) => opener.startsWith(rest)))
72674
+ return null;
72675
+ const start = text3[colon - 1] === ":" ? colon - 1 : colon;
72676
+ return text3[start - 1] === ":" || text3[start - 1] === "\\" ? null : start;
72677
+ }
72678
+ function localPath(path74) {
72679
+ if (path74.startsWith("file:")) {
72680
+ try {
72681
+ const url = new URL(path74);
72682
+ if (url.host !== "" && url.host !== "localhost")
72683
+ return null;
72684
+ const pathname = decodeURIComponent(url.pathname);
72685
+ if (/^[\\/]{2}/u.test(pathname))
72686
+ return null;
72687
+ return pathname.replace(/^\/(?=[A-Za-z]:\/)/u, "");
72688
+ } catch {
72689
+ return null;
72690
+ }
72691
+ }
72692
+ if (/^[A-Za-z]:[\\/]/u.test(path74))
72693
+ return path74.replaceAll("\\", "/");
72694
+ return path74.startsWith("/") && !path74.startsWith("//") ? path74 : null;
72695
+ }
72696
+ function fileName(path74) {
72697
+ const parts = path74.replaceAll("\\", "/").split("/").filter((part) => part !== "");
72698
+ return parts.at(-1) ?? path74;
72699
+ }
72700
+ var DIRECTIVE, OPENERS, SEARCH_OPEN, SEARCH_PREFIX, SEARCH_CLOSE, MAX_LENGTH, FENCE, KEY;
72701
+ var init_agent_markup = __esm({
72702
+ "../chat-model/dist/agent-markup.js"() {
72703
+ DIRECTIVE = /:{1,2}(codex-file-citation|browser-complete)\{/uy;
72704
+ OPENERS = [":codex-file-citation{", ":browser-complete{"];
72705
+ SEARCH_OPEN = "\uE200";
72706
+ SEARCH_PREFIX = SEARCH_OPEN + "cite\uE202";
72707
+ SEARCH_CLOSE = "\uE201";
72708
+ MAX_LENGTH = 4096;
72709
+ FENCE = /^ {0,3}(`{3,}|~{3,})/u;
72710
+ KEY = /[A-Za-z_][\w-]*/uy;
72711
+ }
72712
+ });
72484
72713
  function questionClosedText(event) {
72485
72714
  const record = questionRecord(event);
72486
72715
  if (!record || record.kind !== "resolved" || record.outcome.kind !== "dismissed")
@@ -72894,16 +73123,17 @@ function normalizeSpeakableMarkdown(markdown, fencedCodeReplacement) {
72894
73123
  return stripNonVerbalArtifacts(withoutPaths).split(/\n{2,}/).map((p3) => p3.replace(/\s+/g, " ").trim()).filter(Boolean).map((p3) => /[.!?:]$/.test(p3) ? p3 : `${p3}.`).join(" ").replace(/\s+([.!?])/gu, "$1").replace(/\s+([,;:!?])/gu, "$1").replace(/([,;:])\s*[.!?]/gu, ".").replace(/([,;:])(?:\s*[,;:])+/gu, "$1").replace(/\s{2,}/g, " ").trim();
72895
73124
  }
72896
73125
  function toSpeakableText(markdown) {
72897
- return normalizeSpeakableMarkdown(markdown, " (code block) ");
73126
+ return normalizeSpeakableMarkdown(agentMarkupAsSpeech(markdown), " (code block) ");
72898
73127
  }
72899
73128
  function toVoiceConversationText(markdown) {
72900
- const withoutCode = markdown.replace(/```[\s\S]*?```/g, " ").replace(/~~~[\s\S]*?~~~/g, " ").replace(/```[\s\S]*$/g, " ").replace(/~~~[\s\S]*$/g, " ").replace(/^(?: {4}|\t).*(?:\n|$)/gm, " ");
73129
+ const withoutCode = agentMarkupAsSpeech(markdown).replace(/```[\s\S]*?```/g, " ").replace(/~~~[\s\S]*?~~~/g, " ").replace(/```[\s\S]*$/g, " ").replace(/~~~[\s\S]*$/g, " ").replace(/^(?: {4}|\t).*(?:\n|$)/gm, " ");
72901
73130
  return normalizeSpeakableMarkdown(withoutCode, " ");
72902
73131
  }
72903
73132
  var KEYCAP_EMOJI_RE, NON_VERBAL_SYMBOL_RE, EMOJI_MODIFIER_RE, EMOJI_JOINER_RE, DOMAIN_RE2, FILE_EXTENSION_RE, ABSOLUTE_FILE_PATH_RE, FILE_PATH_RE, DOTTED_PROSE_RE, SLASHED_PROSE_RE, TRAILING_PUNCTUATION, WEB_ADDRESS_RE;
72904
73133
  var init_speech_text = __esm({
72905
73134
  "../chat-model/dist/speech-text.js"() {
72906
73135
  init_speech_tables();
73136
+ init_agent_markup();
72907
73137
  init_spoken_links();
72908
73138
  init_streaming_speech();
72909
73139
  init_trim_trailing();
@@ -73055,6 +73285,7 @@ var init_dist24 = __esm({
73055
73285
  init_agent_work();
73056
73286
  init_agent_computer();
73057
73287
  init_format();
73288
+ init_agent_markup();
73058
73289
  init_question_note();
73059
73290
  init_log2();
73060
73291
  init_id();
@@ -73617,13 +73848,14 @@ var init_AssistantBlock = __esm({
73617
73848
  import_jsx_runtime13 = __toESM(require_jsx_runtime());
73618
73849
  import_react34 = __toESM(require_react());
73619
73850
  await init_build2();
73851
+ init_dist24();
73620
73852
  await init_Markdown();
73621
73853
  init_density();
73622
73854
  await init_ActivityDot();
73623
73855
  AssistantBlock = (0, import_react34.memo)(function AssistantBlock2({ content }) {
73624
73856
  if (!content.trim())
73625
73857
  return null;
73626
- return (0, import_jsx_runtime13.jsxs)(Box_default, { flexDirection: "row", marginTop: blockGap(), children: [(0, import_jsx_runtime13.jsx)(ActivityDot, { state: "neutral" }), (0, import_jsx_runtime13.jsx)(Box_default, { flexDirection: "column", flexGrow: 1, flexShrink: 1, marginLeft: 1, children: (0, import_jsx_runtime13.jsx)(Markdown, { content, firstBlockTight: true }) })] });
73858
+ return (0, import_jsx_runtime13.jsxs)(Box_default, { flexDirection: "row", marginTop: blockGap(), children: [(0, import_jsx_runtime13.jsx)(ActivityDot, { state: "neutral" }), (0, import_jsx_runtime13.jsx)(Box_default, { flexDirection: "column", flexGrow: 1, flexShrink: 1, marginLeft: 1, children: (0, import_jsx_runtime13.jsx)(Markdown, { content: agentMarkupAsText(content), firstBlockTight: true }) })] });
73627
73859
  });
73628
73860
  }
73629
73861
  });
@@ -75820,6 +76052,7 @@ var init_turn = __esm({
75820
76052
  // ../channel-kit/dist/plain-turn-renderer.js
75821
76053
  var init_plain_turn_renderer = __esm({
75822
76054
  "../channel-kit/dist/plain-turn-renderer.js"() {
76055
+ init_dist24();
75823
76056
  }
75824
76057
  });
75825
76058
 
@@ -75967,6 +76200,7 @@ var init_dist25 = __esm({
75967
76200
  init_frame_pump();
75968
76201
  init_turn();
75969
76202
  init_plain_turn_renderer();
76203
+ init_dist24();
75970
76204
  init_host_code();
75971
76205
  init_tofu();
75972
76206
  init_secrets2();
@@ -102048,9 +102282,9 @@ async function runRotateToken(argv) {
102048
102282
  printError("usage: moxxy channels rotate-token <name>");
102049
102283
  return 2;
102050
102284
  }
102051
- const fileName = `${channelName}-token`;
102052
- rotateChannelToken({ fileName });
102053
- const file = path3__default.join(moxxyHome(), fileName);
102285
+ const fileName2 = `${channelName}-token`;
102286
+ rotateChannelToken({ fileName: fileName2 });
102287
+ const file = path3__default.join(moxxyHome(), fileName2);
102054
102288
  process.stdout.write(
102055
102289
  `${colors.bold(channelName)} ${colors.dim("pairing token rotated")}
102056
102290
  ${colors.dim(`new secret written to ${file}`)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moxxy/cli",
3
- "version": "0.50.3",
3
+ "version": "0.50.4",
4
4
  "description": "moxxy command-line agent: TUI, one-shot prompts, setup, services, and API-key or installed-CLI subscription providers.",
5
5
  "keywords": [
6
6
  "moxxy",
@@ -49,7 +49,7 @@
49
49
  "dependencies": {
50
50
  "undici": "^8.12.2",
51
51
  "zod": "^4.6.7",
52
- "@moxxy/sdk": "0.50.3"
52
+ "@moxxy/sdk": "0.50.4"
53
53
  },
54
54
  "optionalDependencies": {
55
55
  "@napi-rs/keyring": "^2.1.2"