poe-code 3.0.128 → 3.0.130

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.
@@ -24,6 +24,62 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  mod
25
25
  ));
26
26
 
27
+ // node_modules/sisteransi/src/index.js
28
+ var require_src = __commonJS({
29
+ "node_modules/sisteransi/src/index.js"(exports, module) {
30
+ "use strict";
31
+ var ESC = "\x1B";
32
+ var CSI = `${ESC}[`;
33
+ var beep = "\x07";
34
+ var cursor = {
35
+ to(x, y) {
36
+ if (!y) return `${CSI}${x + 1}G`;
37
+ return `${CSI}${y + 1};${x + 1}H`;
38
+ },
39
+ move(x, y) {
40
+ let ret = "";
41
+ if (x < 0) ret += `${CSI}${-x}D`;
42
+ else if (x > 0) ret += `${CSI}${x}C`;
43
+ if (y < 0) ret += `${CSI}${-y}A`;
44
+ else if (y > 0) ret += `${CSI}${y}B`;
45
+ return ret;
46
+ },
47
+ up: (count = 1) => `${CSI}${count}A`,
48
+ down: (count = 1) => `${CSI}${count}B`,
49
+ forward: (count = 1) => `${CSI}${count}C`,
50
+ backward: (count = 1) => `${CSI}${count}D`,
51
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
52
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
53
+ left: `${CSI}G`,
54
+ hide: `${CSI}?25l`,
55
+ show: `${CSI}?25h`,
56
+ save: `${ESC}7`,
57
+ restore: `${ESC}8`
58
+ };
59
+ var scroll = {
60
+ up: (count = 1) => `${CSI}S`.repeat(count),
61
+ down: (count = 1) => `${CSI}T`.repeat(count)
62
+ };
63
+ var erase = {
64
+ screen: `${CSI}2J`,
65
+ up: (count = 1) => `${CSI}1J`.repeat(count),
66
+ down: (count = 1) => `${CSI}J`.repeat(count),
67
+ line: `${CSI}2K`,
68
+ lineEnd: `${CSI}K`,
69
+ lineStart: `${CSI}1K`,
70
+ lines(count) {
71
+ let clear = "";
72
+ for (let i = 0; i < count; i++)
73
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
74
+ if (count)
75
+ clear += cursor.left;
76
+ return clear;
77
+ }
78
+ };
79
+ module.exports = { cursor, scroll, erase, beep };
80
+ }
81
+ });
82
+
27
83
  // src/templates/python/env.hbs
28
84
  var require_env = __commonJS({
29
85
  "src/templates/python/env.hbs"(exports, module) {
@@ -510,6 +566,24 @@ import chalk2 from "chalk";
510
566
  // packages/design-system/src/components/text.ts
511
567
  import chalk3 from "chalk";
512
568
 
569
+ // packages/design-system/src/internal/output-format.ts
570
+ import { AsyncLocalStorage } from "node:async_hooks";
571
+ var VALID_FORMATS = /* @__PURE__ */ new Set(["terminal", "markdown", "json"]);
572
+ var formatStorage = new AsyncLocalStorage();
573
+ var cached;
574
+ function resolveOutputFormat(env = process.env) {
575
+ const scoped = formatStorage.getStore();
576
+ if (scoped) {
577
+ return scoped;
578
+ }
579
+ if (cached) {
580
+ return cached;
581
+ }
582
+ const raw = env.OUTPUT_FORMAT?.toLowerCase();
583
+ cached = VALID_FORMATS.has(raw) ? raw : "terminal";
584
+ return cached;
585
+ }
586
+
513
587
  // packages/design-system/src/internal/theme-detect.ts
514
588
  function detectThemeFromEnv(env) {
515
589
  const apple = env.APPLE_INTERFACE_STYLE;
@@ -561,80 +635,225 @@ function getTheme(env) {
561
635
  import chalk4 from "chalk";
562
636
  var symbols = {
563
637
  get info() {
638
+ const format = resolveOutputFormat();
639
+ if (format === "json") return "info";
640
+ if (format === "markdown") return "(i)";
564
641
  return chalk4.magenta("\u25CF");
565
642
  },
566
643
  get success() {
644
+ const format = resolveOutputFormat();
645
+ if (format === "json") return "success";
646
+ if (format === "markdown") return "[ok]";
567
647
  return chalk4.magenta("\u25C6");
568
648
  },
569
649
  get resolved() {
570
- const theme = getTheme();
571
- return theme.resolvedSymbol;
650
+ const format = resolveOutputFormat();
651
+ if (format === "json") return "resolved";
652
+ if (format === "markdown") return ">";
653
+ return getTheme().resolvedSymbol;
572
654
  },
573
655
  get errorResolved() {
574
- const theme = getTheme();
575
- return theme.errorSymbol;
656
+ const format = resolveOutputFormat();
657
+ if (format === "json") return "error";
658
+ if (format === "markdown") return "[!]";
659
+ return getTheme().errorSymbol;
660
+ },
661
+ get bar() {
662
+ const format = resolveOutputFormat();
663
+ if (format === "json") return "";
664
+ if (format === "markdown") return "|";
665
+ return "\u2502";
576
666
  },
577
- bar: "\u2502",
578
667
  cornerTopRight: "\u256E",
579
668
  cornerBottomRight: "\u256F",
580
- warning: "\u25B2",
581
- active: "\u25C6",
582
- inactive: "\u25CB"
669
+ get warning() {
670
+ const format = resolveOutputFormat();
671
+ if (format === "json") return "warning";
672
+ if (format === "markdown") return "[!]";
673
+ return "\u25B2";
674
+ },
675
+ get active() {
676
+ const format = resolveOutputFormat();
677
+ if (format === "json") return "active";
678
+ if (format === "markdown") return "[x]";
679
+ return "\u25C6";
680
+ },
681
+ get inactive() {
682
+ const format = resolveOutputFormat();
683
+ if (format === "json") return "inactive";
684
+ if (format === "markdown") return "[ ]";
685
+ return "\u25CB";
686
+ }
583
687
  };
584
688
 
585
689
  // packages/design-system/src/components/logger.ts
586
- import { log } from "@clack/prompts";
690
+ import chalk6 from "chalk";
691
+
692
+ // packages/design-system/src/prompts/primitives/log.ts
587
693
  import chalk5 from "chalk";
588
694
 
589
- // packages/design-system/src/internal/output-format.ts
590
- var VALID_FORMATS = /* @__PURE__ */ new Set(["terminal", "markdown", "json"]);
591
- var cached;
592
- function resolveOutputFormat(env = process.env) {
593
- if (cached) {
594
- return cached;
695
+ // packages/design-system/src/internal/strip-ansi.ts
696
+ function stripAnsi(value) {
697
+ return value.replace(/\u001b\[[0-9;]*m/g, "");
698
+ }
699
+
700
+ // packages/design-system/src/prompts/primitives/log.ts
701
+ function writeTerminalMessage(msg, {
702
+ symbol = chalk5.gray("\u2502"),
703
+ secondarySymbol = chalk5.gray("\u2502"),
704
+ spacing: spacing2 = 1,
705
+ withGuide = true
706
+ } = {}) {
707
+ const lines = [];
708
+ const showGuide = withGuide !== false;
709
+ const contentLines = msg.split("\n");
710
+ const prefix = showGuide ? `${symbol} ` : "";
711
+ const continuationPrefix = showGuide ? `${secondarySymbol} ` : "";
712
+ const emptyGuide = showGuide ? secondarySymbol : "";
713
+ for (let index = 0; index < spacing2; index += 1) {
714
+ lines.push(emptyGuide);
715
+ }
716
+ if (contentLines.length === 0) {
717
+ process.stdout.write("\n");
718
+ return;
719
+ }
720
+ const [firstLine = "", ...continuationLines] = contentLines;
721
+ if (firstLine.length > 0) {
722
+ lines.push(`${prefix}${firstLine}`);
723
+ } else {
724
+ lines.push(showGuide ? symbol : "");
595
725
  }
596
- const raw = env.OUTPUT_FORMAT?.toLowerCase();
597
- cached = VALID_FORMATS.has(raw) ? raw : "terminal";
598
- return cached;
726
+ for (const line of continuationLines) {
727
+ if (line.length > 0) {
728
+ lines.push(`${continuationPrefix}${line}`);
729
+ continue;
730
+ }
731
+ lines.push(emptyGuide);
732
+ }
733
+ process.stdout.write(`${lines.join("\n")}
734
+ `);
735
+ }
736
+ function message(msg, options) {
737
+ const format = resolveOutputFormat();
738
+ if (format === "markdown") {
739
+ process.stdout.write(`- ${stripAnsi(msg)}
740
+ `);
741
+ return;
742
+ }
743
+ if (format === "json") {
744
+ process.stdout.write(
745
+ `${JSON.stringify({ level: "message", message: stripAnsi(msg) })}
746
+ `
747
+ );
748
+ return;
749
+ }
750
+ writeTerminalMessage(msg, options);
751
+ }
752
+ function info(msg) {
753
+ const format = resolveOutputFormat();
754
+ if (format === "markdown") {
755
+ process.stdout.write(`- **info:** ${stripAnsi(msg)}
756
+ `);
757
+ return;
758
+ }
759
+ if (format === "json") {
760
+ process.stdout.write(
761
+ `${JSON.stringify({ level: "info", message: stripAnsi(msg) })}
762
+ `
763
+ );
764
+ return;
765
+ }
766
+ message(msg, { symbol: symbols.info });
767
+ }
768
+ function success(msg) {
769
+ const format = resolveOutputFormat();
770
+ if (format === "markdown") {
771
+ process.stdout.write(`- **success:** ${stripAnsi(msg)}
772
+ `);
773
+ return;
774
+ }
775
+ if (format === "json") {
776
+ process.stdout.write(
777
+ `${JSON.stringify({ level: "success", message: stripAnsi(msg) })}
778
+ `
779
+ );
780
+ return;
781
+ }
782
+ message(msg, { symbol: symbols.success });
783
+ }
784
+ function warn(msg) {
785
+ const format = resolveOutputFormat();
786
+ if (format === "markdown") {
787
+ process.stdout.write(`- **warning:** ${stripAnsi(msg)}
788
+ `);
789
+ return;
790
+ }
791
+ if (format === "json") {
792
+ process.stdout.write(
793
+ `${JSON.stringify({ level: "warn", message: stripAnsi(msg) })}
794
+ `
795
+ );
796
+ return;
797
+ }
798
+ message(msg, { symbol: chalk5.yellow("\u25B2") });
599
799
  }
800
+ function error(msg) {
801
+ const format = resolveOutputFormat();
802
+ if (format === "markdown") {
803
+ process.stdout.write(`- **error:** ${stripAnsi(msg)}
804
+ `);
805
+ return;
806
+ }
807
+ if (format === "json") {
808
+ process.stdout.write(
809
+ `${JSON.stringify({ level: "error", message: stripAnsi(msg) })}
810
+ `
811
+ );
812
+ return;
813
+ }
814
+ message(msg, { symbol: chalk5.red("\u25A0") });
815
+ }
816
+ var log = {
817
+ info,
818
+ success,
819
+ message,
820
+ warn,
821
+ error
822
+ };
600
823
 
601
824
  // packages/design-system/src/components/logger.ts
602
825
  function createLogger(emitter) {
603
- const emit = (level, message) => {
826
+ const emit = (level, message2) => {
604
827
  if (emitter) {
605
- emitter(message);
606
- return;
607
- }
608
- if (resolveOutputFormat() !== "terminal") {
609
- process.stdout.write(message + "\n");
828
+ emitter(message2);
610
829
  return;
611
830
  }
612
831
  if (level === "success") {
613
- log.message(message, { symbol: symbols.success });
832
+ log.success(message2);
614
833
  return;
615
834
  }
616
835
  if (level === "warn") {
617
- log.warn(message);
836
+ log.warn(message2);
618
837
  return;
619
838
  }
620
839
  if (level === "error") {
621
- log.error(message);
840
+ log.error(message2);
622
841
  return;
623
842
  }
624
- log.message(message, { symbol: symbols.info });
843
+ log.info(message2);
625
844
  };
626
845
  return {
627
- info(message) {
628
- emit("info", message);
846
+ info(message2) {
847
+ emit("info", message2);
629
848
  },
630
- success(message) {
631
- emit("success", message);
849
+ success(message2) {
850
+ emit("success", message2);
632
851
  },
633
- warn(message) {
634
- emit("warn", message);
852
+ warn(message2) {
853
+ emit("warn", message2);
635
854
  },
636
- error(message) {
637
- emit("error", message);
855
+ error(message2) {
856
+ emit("error", message2);
638
857
  },
639
858
  resolved(label, value) {
640
859
  if (emitter) {
@@ -652,12 +871,12 @@ function createLogger(emitter) {
652
871
  log.message(`${label}
653
872
  ${value}`, { symbol: symbols.errorResolved });
654
873
  },
655
- message(message, symbol) {
874
+ message(message2, symbol) {
656
875
  if (emitter) {
657
- emitter(message);
876
+ emitter(message2);
658
877
  return;
659
878
  }
660
- log.message(message, { symbol: symbol ?? chalk5.gray("\u2502") });
879
+ log.message(message2, { symbol: symbol ?? chalk6.gray("\u2502") });
661
880
  }
662
881
  };
663
882
  }
@@ -667,18 +886,52 @@ var logger = createLogger();
667
886
  import { Table } from "console-table-printer";
668
887
 
669
888
  // packages/design-system/src/acp/components.ts
670
- import chalk6 from "chalk";
671
- var AGENT_PREFIX = `${chalk6.green.bold("\u2713")} agent: `;
889
+ import chalk7 from "chalk";
890
+ var AGENT_PREFIX = `${chalk7.green.bold("\u2713")} agent: `;
672
891
 
673
892
  // packages/design-system/src/prompts/index.ts
893
+ import chalk14 from "chalk";
674
894
  import * as clack from "@clack/prompts";
675
- import { isCancel as isCancel2, cancel as cancel2, log as log2 } from "@clack/prompts";
895
+
896
+ // packages/design-system/src/prompts/primitives/cancel.ts
897
+ import chalk8 from "chalk";
898
+
899
+ // node_modules/@clack/core/dist/index.mjs
900
+ var import_sisteransi = __toESM(require_src(), 1);
901
+ import { stdout as R, stdin as q } from "node:process";
902
+ import * as k from "node:readline";
903
+ import ot from "node:readline";
904
+ import { ReadStream as J } from "node:tty";
905
+ var P = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
906
+ var ct = new RegExp("\\p{M}+", "gu");
907
+ var pt = { limit: 1 / 0, ellipsis: "" };
908
+ var ft = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
909
+ var j = "\x07";
910
+ var Q = "[";
911
+ var dt = "]";
912
+ var U = `${dt}8;;`;
913
+ var et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
914
+ var At = ["up", "down", "left", "right", "space", "enter", "cancel"];
915
+ var _ = { actions: new Set(At), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true };
916
+ var bt = globalThis.process.platform.startsWith("win");
917
+
918
+ // packages/design-system/src/prompts/primitives/intro.ts
919
+ import chalk9 from "chalk";
920
+
921
+ // packages/design-system/src/prompts/primitives/note.ts
922
+ import chalk10 from "chalk";
923
+
924
+ // packages/design-system/src/prompts/primitives/outro.ts
925
+ import chalk11 from "chalk";
926
+
927
+ // packages/design-system/src/prompts/primitives/spinner.ts
928
+ import chalk13 from "chalk";
676
929
 
677
930
  // packages/design-system/src/static/spinner.ts
678
- import chalk7 from "chalk";
931
+ import chalk12 from "chalk";
679
932
 
680
933
  // packages/design-system/src/static/menu.ts
681
- import chalk8 from "chalk";
934
+ import chalk15 from "chalk";
682
935
 
683
936
  // packages/agent-spawn/src/acp/spawn.ts
684
937
  import { spawn as spawnChildProcess3 } from "node:child_process";
@@ -1132,28 +1385,28 @@ function resolvePath(rawPath, homeDir, pathMapper) {
1132
1385
  }
1133
1386
 
1134
1387
  // packages/config-mutations/src/fs-utils.ts
1135
- function isNotFound(error) {
1136
- return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
1388
+ function isNotFound(error2) {
1389
+ return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "ENOENT";
1137
1390
  }
1138
1391
  async function readFileIfExists(fs, target) {
1139
1392
  try {
1140
1393
  return await fs.readFile(target, "utf8");
1141
- } catch (error) {
1142
- if (isNotFound(error)) {
1394
+ } catch (error2) {
1395
+ if (isNotFound(error2)) {
1143
1396
  return null;
1144
1397
  }
1145
- throw error;
1398
+ throw error2;
1146
1399
  }
1147
1400
  }
1148
1401
  async function pathExists(fs, target) {
1149
1402
  try {
1150
1403
  await fs.stat(target);
1151
1404
  return true;
1152
- } catch (error) {
1153
- if (isNotFound(error)) {
1405
+ } catch (error2) {
1406
+ if (isNotFound(error2)) {
1154
1407
  return false;
1155
1408
  }
1156
- throw error;
1409
+ throw error2;
1157
1410
  }
1158
1411
  }
1159
1412
  function createTimestamp() {
@@ -1361,14 +1614,14 @@ async function applyRemoveFile(mutation, context, options) {
1361
1614
  outcome: { changed: true, effect: "delete", detail: "delete" },
1362
1615
  details
1363
1616
  };
1364
- } catch (error) {
1365
- if (isNotFound(error)) {
1617
+ } catch (error2) {
1618
+ if (isNotFound(error2)) {
1366
1619
  return {
1367
1620
  outcome: { changed: false, effect: "none", detail: "noop" },
1368
1621
  details
1369
1622
  };
1370
1623
  }
1371
- throw error;
1624
+ throw error2;
1372
1625
  }
1373
1626
  }
1374
1627
  async function applyChmod(mutation, context, options) {
@@ -1401,14 +1654,14 @@ async function applyChmod(mutation, context, options) {
1401
1654
  outcome: { changed: true, effect: "chmod", detail: "update" },
1402
1655
  details
1403
1656
  };
1404
- } catch (error) {
1405
- if (isNotFound(error)) {
1657
+ } catch (error2) {
1658
+ if (isNotFound(error2)) {
1406
1659
  return {
1407
1660
  outcome: { changed: false, effect: "none", detail: "noop" },
1408
1661
  details
1409
1662
  };
1410
1663
  }
1411
- throw error;
1664
+ throw error2;
1412
1665
  }
1413
1666
  }
1414
1667
  async function applyBackup(mutation, context, options) {
@@ -1653,10 +1906,10 @@ async function applyTemplateMerge(mutation, context, options, formatName) {
1653
1906
  let templateDoc;
1654
1907
  try {
1655
1908
  templateDoc = format.parse(rendered);
1656
- } catch (error) {
1909
+ } catch (error2) {
1657
1910
  throw new Error(
1658
- `Failed to parse rendered template "${mutation.templateId}" as ${formatName.toUpperCase()}: ${error}`,
1659
- { cause: error }
1911
+ `Failed to parse rendered template "${mutation.templateId}" as ${formatName.toUpperCase()}: ${error2}`,
1912
+ { cause: error2 }
1660
1913
  );
1661
1914
  }
1662
1915
  const rawContent = await readFileIfExists(context.fs, targetPath);
@@ -1717,16 +1970,16 @@ async function executeMutation(mutation, context, options) {
1717
1970
  const { outcome, details } = await applyMutation(mutation, context, options);
1718
1971
  context.observers?.onComplete?.(details, outcome);
1719
1972
  return { outcome, details };
1720
- } catch (error) {
1973
+ } catch (error2) {
1721
1974
  context.observers?.onError?.(
1722
1975
  {
1723
1976
  kind: mutation.kind,
1724
1977
  label: mutation.label ?? mutation.kind,
1725
1978
  targetPath: void 0
1726
1979
  },
1727
- error
1980
+ error2
1728
1981
  );
1729
- throw error;
1982
+ throw error2;
1730
1983
  }
1731
1984
  }
1732
1985
 
@@ -1749,8 +2002,8 @@ async function runServiceInstall(definition, context) {
1749
2002
  try {
1750
2003
  await definition.check.run(checkContext);
1751
2004
  context.logger(`${definition.summary} already installed.`);
1752
- } catch (error) {
1753
- const detail = error instanceof Error ? error.message : String(error);
2005
+ } catch (error2) {
2006
+ const detail = error2 instanceof Error ? error2.message : String(error2);
1754
2007
  context.logger(`${definition.summary} not detected: ${detail}`);
1755
2008
  needsInstall = true;
1756
2009
  }
@@ -1885,7 +2138,7 @@ function createInstallRunner(definition) {
1885
2138
  await runServiceInstall(definition, {
1886
2139
  isDryRun: context.logger.context.dryRun,
1887
2140
  runCommand: context.command.runCommand,
1888
- logger: (message) => context.logger.verbose(message),
2141
+ logger: (message2) => context.logger.verbose(message2),
1889
2142
  platform: context.env.platform
1890
2143
  });
1891
2144
  };