poe-code 3.0.128 → 3.0.129

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) {
@@ -546,6 +602,24 @@ import chalk2 from "chalk";
546
602
  // packages/design-system/src/components/text.ts
547
603
  import chalk3 from "chalk";
548
604
 
605
+ // packages/design-system/src/internal/output-format.ts
606
+ import { AsyncLocalStorage } from "node:async_hooks";
607
+ var VALID_FORMATS = /* @__PURE__ */ new Set(["terminal", "markdown", "json"]);
608
+ var formatStorage = new AsyncLocalStorage();
609
+ var cached;
610
+ function resolveOutputFormat(env = process.env) {
611
+ const scoped = formatStorage.getStore();
612
+ if (scoped) {
613
+ return scoped;
614
+ }
615
+ if (cached) {
616
+ return cached;
617
+ }
618
+ const raw = env.OUTPUT_FORMAT?.toLowerCase();
619
+ cached = VALID_FORMATS.has(raw) ? raw : "terminal";
620
+ return cached;
621
+ }
622
+
549
623
  // packages/design-system/src/internal/theme-detect.ts
550
624
  function detectThemeFromEnv(env) {
551
625
  const apple = env.APPLE_INTERFACE_STYLE;
@@ -597,80 +671,225 @@ function getTheme(env) {
597
671
  import chalk4 from "chalk";
598
672
  var symbols = {
599
673
  get info() {
674
+ const format = resolveOutputFormat();
675
+ if (format === "json") return "info";
676
+ if (format === "markdown") return "(i)";
600
677
  return chalk4.magenta("\u25CF");
601
678
  },
602
679
  get success() {
680
+ const format = resolveOutputFormat();
681
+ if (format === "json") return "success";
682
+ if (format === "markdown") return "[ok]";
603
683
  return chalk4.magenta("\u25C6");
604
684
  },
605
685
  get resolved() {
606
- const theme = getTheme();
607
- return theme.resolvedSymbol;
686
+ const format = resolveOutputFormat();
687
+ if (format === "json") return "resolved";
688
+ if (format === "markdown") return ">";
689
+ return getTheme().resolvedSymbol;
608
690
  },
609
691
  get errorResolved() {
610
- const theme = getTheme();
611
- return theme.errorSymbol;
692
+ const format = resolveOutputFormat();
693
+ if (format === "json") return "error";
694
+ if (format === "markdown") return "[!]";
695
+ return getTheme().errorSymbol;
696
+ },
697
+ get bar() {
698
+ const format = resolveOutputFormat();
699
+ if (format === "json") return "";
700
+ if (format === "markdown") return "|";
701
+ return "\u2502";
612
702
  },
613
- bar: "\u2502",
614
703
  cornerTopRight: "\u256E",
615
704
  cornerBottomRight: "\u256F",
616
- warning: "\u25B2",
617
- active: "\u25C6",
618
- inactive: "\u25CB"
705
+ get warning() {
706
+ const format = resolveOutputFormat();
707
+ if (format === "json") return "warning";
708
+ if (format === "markdown") return "[!]";
709
+ return "\u25B2";
710
+ },
711
+ get active() {
712
+ const format = resolveOutputFormat();
713
+ if (format === "json") return "active";
714
+ if (format === "markdown") return "[x]";
715
+ return "\u25C6";
716
+ },
717
+ get inactive() {
718
+ const format = resolveOutputFormat();
719
+ if (format === "json") return "inactive";
720
+ if (format === "markdown") return "[ ]";
721
+ return "\u25CB";
722
+ }
619
723
  };
620
724
 
621
725
  // packages/design-system/src/components/logger.ts
622
- import { log } from "@clack/prompts";
726
+ import chalk6 from "chalk";
727
+
728
+ // packages/design-system/src/prompts/primitives/log.ts
623
729
  import chalk5 from "chalk";
624
730
 
625
- // packages/design-system/src/internal/output-format.ts
626
- var VALID_FORMATS = /* @__PURE__ */ new Set(["terminal", "markdown", "json"]);
627
- var cached;
628
- function resolveOutputFormat(env = process.env) {
629
- if (cached) {
630
- return cached;
731
+ // packages/design-system/src/internal/strip-ansi.ts
732
+ function stripAnsi(value) {
733
+ return value.replace(/\u001b\[[0-9;]*m/g, "");
734
+ }
735
+
736
+ // packages/design-system/src/prompts/primitives/log.ts
737
+ function writeTerminalMessage(msg, {
738
+ symbol = chalk5.gray("\u2502"),
739
+ secondarySymbol = chalk5.gray("\u2502"),
740
+ spacing: spacing2 = 1,
741
+ withGuide = true
742
+ } = {}) {
743
+ const lines = [];
744
+ const showGuide = withGuide !== false;
745
+ const contentLines = msg.split("\n");
746
+ const prefix = showGuide ? `${symbol} ` : "";
747
+ const continuationPrefix = showGuide ? `${secondarySymbol} ` : "";
748
+ const emptyGuide = showGuide ? secondarySymbol : "";
749
+ for (let index = 0; index < spacing2; index += 1) {
750
+ lines.push(emptyGuide);
751
+ }
752
+ if (contentLines.length === 0) {
753
+ process.stdout.write("\n");
754
+ return;
755
+ }
756
+ const [firstLine = "", ...continuationLines] = contentLines;
757
+ if (firstLine.length > 0) {
758
+ lines.push(`${prefix}${firstLine}`);
759
+ } else {
760
+ lines.push(showGuide ? symbol : "");
631
761
  }
632
- const raw = env.OUTPUT_FORMAT?.toLowerCase();
633
- cached = VALID_FORMATS.has(raw) ? raw : "terminal";
634
- return cached;
762
+ for (const line of continuationLines) {
763
+ if (line.length > 0) {
764
+ lines.push(`${continuationPrefix}${line}`);
765
+ continue;
766
+ }
767
+ lines.push(emptyGuide);
768
+ }
769
+ process.stdout.write(`${lines.join("\n")}
770
+ `);
771
+ }
772
+ function message(msg, options) {
773
+ const format = resolveOutputFormat();
774
+ if (format === "markdown") {
775
+ process.stdout.write(`- ${stripAnsi(msg)}
776
+ `);
777
+ return;
778
+ }
779
+ if (format === "json") {
780
+ process.stdout.write(
781
+ `${JSON.stringify({ level: "message", message: stripAnsi(msg) })}
782
+ `
783
+ );
784
+ return;
785
+ }
786
+ writeTerminalMessage(msg, options);
787
+ }
788
+ function info(msg) {
789
+ const format = resolveOutputFormat();
790
+ if (format === "markdown") {
791
+ process.stdout.write(`- **info:** ${stripAnsi(msg)}
792
+ `);
793
+ return;
794
+ }
795
+ if (format === "json") {
796
+ process.stdout.write(
797
+ `${JSON.stringify({ level: "info", message: stripAnsi(msg) })}
798
+ `
799
+ );
800
+ return;
801
+ }
802
+ message(msg, { symbol: symbols.info });
803
+ }
804
+ function success(msg) {
805
+ const format = resolveOutputFormat();
806
+ if (format === "markdown") {
807
+ process.stdout.write(`- **success:** ${stripAnsi(msg)}
808
+ `);
809
+ return;
810
+ }
811
+ if (format === "json") {
812
+ process.stdout.write(
813
+ `${JSON.stringify({ level: "success", message: stripAnsi(msg) })}
814
+ `
815
+ );
816
+ return;
817
+ }
818
+ message(msg, { symbol: symbols.success });
819
+ }
820
+ function warn(msg) {
821
+ const format = resolveOutputFormat();
822
+ if (format === "markdown") {
823
+ process.stdout.write(`- **warning:** ${stripAnsi(msg)}
824
+ `);
825
+ return;
826
+ }
827
+ if (format === "json") {
828
+ process.stdout.write(
829
+ `${JSON.stringify({ level: "warn", message: stripAnsi(msg) })}
830
+ `
831
+ );
832
+ return;
833
+ }
834
+ message(msg, { symbol: chalk5.yellow("\u25B2") });
635
835
  }
836
+ function error(msg) {
837
+ const format = resolveOutputFormat();
838
+ if (format === "markdown") {
839
+ process.stdout.write(`- **error:** ${stripAnsi(msg)}
840
+ `);
841
+ return;
842
+ }
843
+ if (format === "json") {
844
+ process.stdout.write(
845
+ `${JSON.stringify({ level: "error", message: stripAnsi(msg) })}
846
+ `
847
+ );
848
+ return;
849
+ }
850
+ message(msg, { symbol: chalk5.red("\u25A0") });
851
+ }
852
+ var log = {
853
+ info,
854
+ success,
855
+ message,
856
+ warn,
857
+ error
858
+ };
636
859
 
637
860
  // packages/design-system/src/components/logger.ts
638
861
  function createLogger(emitter) {
639
- const emit = (level, message) => {
862
+ const emit = (level, message2) => {
640
863
  if (emitter) {
641
- emitter(message);
642
- return;
643
- }
644
- if (resolveOutputFormat() !== "terminal") {
645
- process.stdout.write(message + "\n");
864
+ emitter(message2);
646
865
  return;
647
866
  }
648
867
  if (level === "success") {
649
- log.message(message, { symbol: symbols.success });
868
+ log.success(message2);
650
869
  return;
651
870
  }
652
871
  if (level === "warn") {
653
- log.warn(message);
872
+ log.warn(message2);
654
873
  return;
655
874
  }
656
875
  if (level === "error") {
657
- log.error(message);
876
+ log.error(message2);
658
877
  return;
659
878
  }
660
- log.message(message, { symbol: symbols.info });
879
+ log.info(message2);
661
880
  };
662
881
  return {
663
- info(message) {
664
- emit("info", message);
882
+ info(message2) {
883
+ emit("info", message2);
665
884
  },
666
- success(message) {
667
- emit("success", message);
885
+ success(message2) {
886
+ emit("success", message2);
668
887
  },
669
- warn(message) {
670
- emit("warn", message);
888
+ warn(message2) {
889
+ emit("warn", message2);
671
890
  },
672
- error(message) {
673
- emit("error", message);
891
+ error(message2) {
892
+ emit("error", message2);
674
893
  },
675
894
  resolved(label, value) {
676
895
  if (emitter) {
@@ -688,12 +907,12 @@ function createLogger(emitter) {
688
907
  log.message(`${label}
689
908
  ${value}`, { symbol: symbols.errorResolved });
690
909
  },
691
- message(message, symbol) {
910
+ message(message2, symbol) {
692
911
  if (emitter) {
693
- emitter(message);
912
+ emitter(message2);
694
913
  return;
695
914
  }
696
- log.message(message, { symbol: symbol ?? chalk5.gray("\u2502") });
915
+ log.message(message2, { symbol: symbol ?? chalk6.gray("\u2502") });
697
916
  }
698
917
  };
699
918
  }
@@ -703,18 +922,52 @@ var logger = createLogger();
703
922
  import { Table } from "console-table-printer";
704
923
 
705
924
  // packages/design-system/src/acp/components.ts
706
- import chalk6 from "chalk";
707
- var AGENT_PREFIX = `${chalk6.green.bold("\u2713")} agent: `;
925
+ import chalk7 from "chalk";
926
+ var AGENT_PREFIX = `${chalk7.green.bold("\u2713")} agent: `;
708
927
 
709
928
  // packages/design-system/src/prompts/index.ts
929
+ import chalk14 from "chalk";
710
930
  import * as clack from "@clack/prompts";
711
- import { isCancel as isCancel2, cancel as cancel2, log as log2 } from "@clack/prompts";
931
+
932
+ // packages/design-system/src/prompts/primitives/cancel.ts
933
+ import chalk8 from "chalk";
934
+
935
+ // node_modules/@clack/core/dist/index.mjs
936
+ var import_sisteransi = __toESM(require_src(), 1);
937
+ import { stdout as R, stdin as q } from "node:process";
938
+ import * as k from "node:readline";
939
+ import ot from "node:readline";
940
+ import { ReadStream as J } from "node:tty";
941
+ 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");
942
+ var ct = new RegExp("\\p{M}+", "gu");
943
+ var pt = { limit: 1 / 0, ellipsis: "" };
944
+ var ft = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
945
+ var j = "\x07";
946
+ var Q = "[";
947
+ var dt = "]";
948
+ var U = `${dt}8;;`;
949
+ var et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
950
+ var At = ["up", "down", "left", "right", "space", "enter", "cancel"];
951
+ 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 };
952
+ var bt = globalThis.process.platform.startsWith("win");
953
+
954
+ // packages/design-system/src/prompts/primitives/intro.ts
955
+ import chalk9 from "chalk";
956
+
957
+ // packages/design-system/src/prompts/primitives/note.ts
958
+ import chalk10 from "chalk";
959
+
960
+ // packages/design-system/src/prompts/primitives/outro.ts
961
+ import chalk11 from "chalk";
962
+
963
+ // packages/design-system/src/prompts/primitives/spinner.ts
964
+ import chalk13 from "chalk";
712
965
 
713
966
  // packages/design-system/src/static/spinner.ts
714
- import chalk7 from "chalk";
967
+ import chalk12 from "chalk";
715
968
 
716
969
  // packages/design-system/src/static/menu.ts
717
- import chalk8 from "chalk";
970
+ import chalk15 from "chalk";
718
971
 
719
972
  // packages/agent-spawn/src/acp/spawn.ts
720
973
  import { spawn as spawnChildProcess3 } from "node:child_process";
@@ -1134,28 +1387,28 @@ function resolvePath(rawPath, homeDir, pathMapper) {
1134
1387
  }
1135
1388
 
1136
1389
  // packages/config-mutations/src/fs-utils.ts
1137
- function isNotFound(error) {
1138
- return typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT";
1390
+ function isNotFound(error2) {
1391
+ return typeof error2 === "object" && error2 !== null && "code" in error2 && error2.code === "ENOENT";
1139
1392
  }
1140
1393
  async function readFileIfExists(fs, target) {
1141
1394
  try {
1142
1395
  return await fs.readFile(target, "utf8");
1143
- } catch (error) {
1144
- if (isNotFound(error)) {
1396
+ } catch (error2) {
1397
+ if (isNotFound(error2)) {
1145
1398
  return null;
1146
1399
  }
1147
- throw error;
1400
+ throw error2;
1148
1401
  }
1149
1402
  }
1150
1403
  async function pathExists(fs, target) {
1151
1404
  try {
1152
1405
  await fs.stat(target);
1153
1406
  return true;
1154
- } catch (error) {
1155
- if (isNotFound(error)) {
1407
+ } catch (error2) {
1408
+ if (isNotFound(error2)) {
1156
1409
  return false;
1157
1410
  }
1158
- throw error;
1411
+ throw error2;
1159
1412
  }
1160
1413
  }
1161
1414
  function createTimestamp() {
@@ -1363,14 +1616,14 @@ async function applyRemoveFile(mutation, context, options) {
1363
1616
  outcome: { changed: true, effect: "delete", detail: "delete" },
1364
1617
  details
1365
1618
  };
1366
- } catch (error) {
1367
- if (isNotFound(error)) {
1619
+ } catch (error2) {
1620
+ if (isNotFound(error2)) {
1368
1621
  return {
1369
1622
  outcome: { changed: false, effect: "none", detail: "noop" },
1370
1623
  details
1371
1624
  };
1372
1625
  }
1373
- throw error;
1626
+ throw error2;
1374
1627
  }
1375
1628
  }
1376
1629
  async function applyChmod(mutation, context, options) {
@@ -1403,14 +1656,14 @@ async function applyChmod(mutation, context, options) {
1403
1656
  outcome: { changed: true, effect: "chmod", detail: "update" },
1404
1657
  details
1405
1658
  };
1406
- } catch (error) {
1407
- if (isNotFound(error)) {
1659
+ } catch (error2) {
1660
+ if (isNotFound(error2)) {
1408
1661
  return {
1409
1662
  outcome: { changed: false, effect: "none", detail: "noop" },
1410
1663
  details
1411
1664
  };
1412
1665
  }
1413
- throw error;
1666
+ throw error2;
1414
1667
  }
1415
1668
  }
1416
1669
  async function applyBackup(mutation, context, options) {
@@ -1655,10 +1908,10 @@ async function applyTemplateMerge(mutation, context, options, formatName) {
1655
1908
  let templateDoc;
1656
1909
  try {
1657
1910
  templateDoc = format.parse(rendered);
1658
- } catch (error) {
1911
+ } catch (error2) {
1659
1912
  throw new Error(
1660
- `Failed to parse rendered template "${mutation.templateId}" as ${formatName.toUpperCase()}: ${error}`,
1661
- { cause: error }
1913
+ `Failed to parse rendered template "${mutation.templateId}" as ${formatName.toUpperCase()}: ${error2}`,
1914
+ { cause: error2 }
1662
1915
  );
1663
1916
  }
1664
1917
  const rawContent = await readFileIfExists(context.fs, targetPath);
@@ -1719,16 +1972,16 @@ async function executeMutation(mutation, context, options) {
1719
1972
  const { outcome, details } = await applyMutation(mutation, context, options);
1720
1973
  context.observers?.onComplete?.(details, outcome);
1721
1974
  return { outcome, details };
1722
- } catch (error) {
1975
+ } catch (error2) {
1723
1976
  context.observers?.onError?.(
1724
1977
  {
1725
1978
  kind: mutation.kind,
1726
1979
  label: mutation.label ?? mutation.kind,
1727
1980
  targetPath: void 0
1728
1981
  },
1729
- error
1982
+ error2
1730
1983
  );
1731
- throw error;
1984
+ throw error2;
1732
1985
  }
1733
1986
  }
1734
1987
 
@@ -1746,8 +1999,8 @@ async function runServiceInstall(definition, context) {
1746
1999
  try {
1747
2000
  await definition.check.run(checkContext);
1748
2001
  context.logger(`${definition.summary} already installed.`);
1749
- } catch (error) {
1750
- const detail = error instanceof Error ? error.message : String(error);
2002
+ } catch (error2) {
2003
+ const detail = error2 instanceof Error ? error2.message : String(error2);
1751
2004
  context.logger(`${definition.summary} not detected: ${detail}`);
1752
2005
  needsInstall = true;
1753
2006
  }
@@ -1882,7 +2135,7 @@ function createInstallRunner(definition) {
1882
2135
  await runServiceInstall(definition, {
1883
2136
  isDryRun: context.logger.context.dryRun,
1884
2137
  runCommand: context.command.runCommand,
1885
- logger: (message) => context.logger.verbose(message),
2138
+ logger: (message2) => context.logger.verbose(message2),
1886
2139
  platform: context.env.platform
1887
2140
  });
1888
2141
  };