agentlas 1.0.42 → 1.0.44

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 (70) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/engine/agentlas-workforce.cjs +1 -1
  3. package/engine/hephaestus/runtime.cjs +1 -1
  4. package/engine/storm/storm.cjs +1 -1
  5. package/engine/storm/swarm.cjs +1 -1
  6. package/engine/ui/palette.cjs +1 -0
  7. package/engine/ui/repl.cjs +34 -4
  8. package/engine/ui/shell.cjs +22 -3
  9. package/engine/vendor/mermaid/LICENSE +205 -0
  10. package/engine/vendor/mermaid/ansi.js +23 -0
  11. package/engine/vendor/mermaid/canvas.js +366 -0
  12. package/engine/vendor/mermaid/graph.js +91 -0
  13. package/engine/vendor/mermaid/index.js +100 -0
  14. package/engine/vendor/mermaid/labels.js +324 -0
  15. package/engine/vendor/mermaid/layout-seq.js +194 -0
  16. package/engine/vendor/mermaid/layout.js +881 -0
  17. package/engine/vendor/mermaid/package.json +1 -0
  18. package/engine/vendor/mermaid/parse.js +1108 -0
  19. package/engine/vendor/mermaid/source-box.js +78 -0
  20. package/engine/vendor/mermaid/types.js +1 -0
  21. package/engine/vendor/mermaid/width-data.js +994 -0
  22. package/engine/vendor/mermaid/width.js +76 -0
  23. package/engine/vendor/tui/LICENSE +20 -0
  24. package/engine/vendor/tui/autocomplete.js +632 -0
  25. package/engine/vendor/tui/components/alt-screen-flash.js +37 -0
  26. package/engine/vendor/tui/components/box.js +104 -0
  27. package/engine/vendor/tui/components/cancellable-loader.js +35 -0
  28. package/engine/vendor/tui/components/editor.js +1961 -0
  29. package/engine/vendor/tui/components/h-stack.js +43 -0
  30. package/engine/vendor/tui/components/image.js +90 -0
  31. package/engine/vendor/tui/components/input.js +378 -0
  32. package/engine/vendor/tui/components/loader.js +69 -0
  33. package/engine/vendor/tui/components/markdown.js +806 -0
  34. package/engine/vendor/tui/components/scroll-view.js +173 -0
  35. package/engine/vendor/tui/components/select-list.js +159 -0
  36. package/engine/vendor/tui/components/settings-list.js +182 -0
  37. package/engine/vendor/tui/components/spacer.js +23 -0
  38. package/engine/vendor/tui/components/stack.js +111 -0
  39. package/engine/vendor/tui/components/text.js +89 -0
  40. package/engine/vendor/tui/components/truncated-text.js +51 -0
  41. package/engine/vendor/tui/components/v-stack.js +26 -0
  42. package/engine/vendor/tui/deps/east-asian-width/LICENSE +9 -0
  43. package/engine/vendor/tui/deps/east-asian-width/index.js +30 -0
  44. package/engine/vendor/tui/deps/east-asian-width/lookup-data.js +21 -0
  45. package/engine/vendor/tui/deps/east-asian-width/lookup.js +138 -0
  46. package/engine/vendor/tui/deps/east-asian-width/utilities.js +24 -0
  47. package/engine/vendor/tui/deps/marked/LICENSE +44 -0
  48. package/engine/vendor/tui/deps/marked/index.js +77 -0
  49. package/engine/vendor/tui/editor-component.js +2 -0
  50. package/engine/vendor/tui/fuzzy.js +110 -0
  51. package/engine/vendor/tui/index.js +42 -0
  52. package/engine/vendor/tui/keybindings.js +209 -0
  53. package/engine/vendor/tui/keys.js +1174 -0
  54. package/engine/vendor/tui/kill-ring.js +44 -0
  55. package/engine/vendor/tui/latex.js +1264 -0
  56. package/engine/vendor/tui/layout-node.js +6 -0
  57. package/engine/vendor/tui/layout.js +314 -0
  58. package/engine/vendor/tui/native-modifiers.js +60 -0
  59. package/engine/vendor/tui/package.json +1 -0
  60. package/engine/vendor/tui/stdin-buffer.js +361 -0
  61. package/engine/vendor/tui/terminal-colors.js +59 -0
  62. package/engine/vendor/tui/terminal-image.js +518 -0
  63. package/engine/vendor/tui/terminal.js +436 -0
  64. package/engine/vendor/tui/tui-alt-screen.js +902 -0
  65. package/engine/vendor/tui/tui-main-screen.js +533 -0
  66. package/engine/vendor/tui/tui.js +937 -0
  67. package/engine/vendor/tui/undo-stack.js +25 -0
  68. package/engine/vendor/tui/utils.js +1191 -0
  69. package/engine/vendor/tui/word-navigation.js +96 -0
  70. package/package.json +2 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.44 — 2026-08-11
4
+
5
+ Turn the interactive shell on once and keep it.
6
+
7
+ - `/shell on` saves the choice, so plain `agentlas` opens the interactive shell
8
+ from then on; `/shell off` returns to the classic REPL. Both shells accept the
9
+ command, so you can always get back out.
10
+ - `AGENTLAS_TUI=1` still works and takes precedence for a single run.
11
+
12
+ ## 1.0.43 — 2026-08-11
13
+
14
+ Zero runtime dependencies. The renderer now lives in this repository.
15
+
16
+ - The terminal shell's renderer and diagram sources are vendored into
17
+ `engine/vendor/` and `package.json` declares no runtime dependencies at all.
18
+ An exact version pin already prevented drift and tampering, but a package
19
+ removed from the registry would still have broken installs; that last failure
20
+ mode is now gone, and the code is ours to fix.
21
+ - Upstream copyright notices are preserved beside each vendored tree, as the
22
+ MIT and Apache-2.0 terms require. The vendoring script refuses to run if a
23
+ notice is missing.
24
+ - New release gate `vendor-tui-sync` fails when the vendored tree and its
25
+ upstream differ, so the copy cannot rot silently.
26
+
3
27
  ## 1.0.42 — 2026-08-11
4
28
 
5
29
  Projects, automations and firms reach the interactive shell; the shell is
@@ -1979,7 +1979,7 @@ function create(deps = {}) {
1979
1979
  const D = deps;
1980
1980
 
1981
1981
  /*
1982
- * pi-tui 이행 정지작업 (D3 Phase 1-2, 2026-08-11): ctx가 준 Ui가 있으면 그것을
1982
+ * 이행 정지작업 (D3 Phase 1-2, 2026-08-11): ctx가 준 Ui가 있으면 그것을
1983
1983
  * 쓴다. 자체 생성 Ui는 렌더러 교체 시 구 코드가 stdout에 직접 써 프레임을
1984
1984
  * 찢는 병렬 경로였다. 생성은 주입이 없을 때의 폴백으로만 남긴다.
1985
1985
  */
@@ -195,7 +195,7 @@ function create(ctx, deps = {}) {
195
195
  const lang = () => (ctx && ctx.lang) || "en";
196
196
 
197
197
  /*
198
- * pi-tui 이행 정지작업 (D3 Phase 1-2, 2026-08-11): ctx가 준 Ui가 있으면 그것을
198
+ * 이행 정지작업 (D3 Phase 1-2, 2026-08-11): ctx가 준 Ui가 있으면 그것을
199
199
  * 쓴다. 자체 생성 Ui는 렌더러 교체 시 구 코드가 stdout에 직접 써 프레임을
200
200
  * 찢는 병렬 경로였다. 생성은 주입이 없을 때의 폴백으로만 남긴다.
201
201
  */
@@ -37,7 +37,7 @@ function create(deps) {
37
37
  const { swarmRun } = require("./swarm.cjs").create(D);
38
38
 
39
39
  /*
40
- * pi-tui 이행 정지작업 (D3 Phase 1-2, 2026-08-11): ctx가 준 Ui가 있으면 그것을
40
+ * 이행 정지작업 (D3 Phase 1-2, 2026-08-11): ctx가 준 Ui가 있으면 그것을
41
41
  * 쓴다. 자체 생성 Ui는 렌더러 교체 시 구 코드가 stdout에 직접 써 프레임을
42
42
  * 찢는 병렬 경로였다. 생성은 주입이 없을 때의 폴백으로만 남긴다.
43
43
  */
@@ -128,7 +128,7 @@ function create(deps) {
128
128
  const D = deps;
129
129
 
130
130
  /*
131
- * pi-tui 이행 정지작업 (D3 Phase 1-2, 2026-08-11): ctx가 준 Ui가 있으면 그것을
131
+ * 이행 정지작업 (D3 Phase 1-2, 2026-08-11): ctx가 준 Ui가 있으면 그것을
132
132
  * 쓴다. 자체 생성 Ui는 렌더러 교체 시 구 코드가 stdout에 직접 써 프레임을
133
133
  * 찢는 병렬 경로였다. 생성은 주입이 없을 때의 폴백으로만 남긴다.
134
134
  */
@@ -24,6 +24,7 @@ const SLASH_COMMANDS = [
24
24
  { command: "/graph", args: "[run <이름>]", ko: "저장된 자동화 그래프", en: "Saved automation graphs" },
25
25
  { command: "/mcp", args: "", ko: "MCP 서버 목록", en: "MCP servers" },
26
26
  { command: "/doctor", args: "", ko: "런타임·데이터 점검", en: "Health check" },
27
+ { command: "/shell", args: "on|off", ko: "대화형 셸 켜기/끄기", en: "Turn the interactive shell on or off" },
27
28
  { command: "/runtime", args: "<kind>", ko: "새 세션 런타임 지정", en: "Set runtime for new sessions" },
28
29
  { command: "/model", args: "<id|default>", ko: "새 세션 모델 지정", en: "Set model for new sessions" },
29
30
  { command: "/effort", args: "<level|none>", ko: "새 세션 추론 강도 지정", en: "Set effort for new sessions" },
@@ -125,11 +125,17 @@ async function startRepl(ctx, opts = {}) {
125
125
  }
126
126
 
127
127
  /*
128
- * 대화형 셸 opt-in (D3 Phase 2): AGENTLAS_TUI=1 + TTY.
129
- * 온보딩 마법사(위 readline 블록)가 먼저 끝난 뒤 진입한다 — 순차 실행이라
130
- * stdin 경합이 없고, 첫 실행 사용자도 새 셸을 쓸 수 있다(증분 2c).
128
+ * 대화형 셸 (D3 Phase 2~3). 온보딩 마법사(위 readline 블록)가 먼저 끝난 뒤
129
+ * 진입한다 — 순차 실행이라 stdin 경합이 없다.
130
+ *
131
+ * 선택 순서: 환경변수 > 저장된 설정. 환경변수는 그 실행에만, prefs.shell 은
132
+ * 영속이다(/shell on 으로 저장). 매번 환경변수를 치게 만들면 아무도 안 쓴다.
131
133
  */
132
- if (/^(1|true|on)$/i.test(String(process.env.AGENTLAS_TUI || "")) && process.stdin.isTTY) {
134
+ const shellEnv = String(process.env.AGENTLAS_TUI || "").trim();
135
+ const shellChoice = shellEnv
136
+ ? /^(1|true|on)$/i.test(shellEnv)
137
+ : (ctx.prefs && ctx.prefs.shell) === "interactive";
138
+ if (shellChoice && process.stdin.isTTY) {
133
139
  return require("./shell.cjs").startShell(ctx, opts);
134
140
  }
135
141
  const orch = new Orchestrator({ db, lang: ctx.lang });
@@ -690,6 +696,30 @@ function handleSlash(ctx, cmdline, api) {
690
696
  ctx.out(ctx.uiInstance.c.dim(`Shift-Tab: ${i18n.t(ctx.lang, "help.shiftTab")}`));
691
697
  return;
692
698
  }
699
+ case "shell": {
700
+ /*
701
+ * 새 대화형 셸 켜기/끄기. 저장하고 즉시 안내한다 — 프로세스 중간에
702
+ * stdin 소유권을 바꾸면 지금 도는 readline 과 경합한다(실사고 계열).
703
+ */
704
+ const want = String(rest[0] || "").toLowerCase();
705
+ if (!["on", "off"].includes(want)) {
706
+ const now = (ctx.prefs && ctx.prefs.shell) === "interactive";
707
+ ui.line(ui.c.dim(`Usage: /shell on|off (${en ? "currently" : "현재"}: ${now ? "on" : "off"})`));
708
+ return;
709
+ }
710
+ const config = require("../agentlas-config.cjs");
711
+ const { userDataDir } = require("../core/paths.cjs");
712
+ config.updatePrefs(userDataDir(), { shell: want === "on" ? "interactive" : "classic" });
713
+ if (ctx.prefs) ctx.prefs.shell = want === "on" ? "interactive" : "classic";
714
+ ui.line(want === "on"
715
+ ? ui.c.dim(en
716
+ ? "Interactive shell enabled — restart agentlas to enter it (/shell off to revert)."
717
+ : "대화형 셸을 켰습니다 — agentlas 를 다시 실행하면 그 화면으로 들어갑니다 (/shell off 로 되돌림).")
718
+ : ui.c.dim(en
719
+ ? "Interactive shell disabled — restart agentlas for the classic REPL."
720
+ : "대화형 셸을 껐습니다 — agentlas 를 다시 실행하면 기본 REPL 입니다."));
721
+ return;
722
+ }
693
723
  case "agents": case "list": require("../commands/list.cjs").run(ctx, rest); return;
694
724
  // doctor 는 세션 검증(네트워크)으로 async 가 됐다 — 특례로 fire-and-forget 하면
695
725
  // REPL 종료가 출력을 잘라먹는다. promise 를 track 하는 default 폴스루로 보낸다.
@@ -29,8 +29,14 @@ const { resolveProjectController, withProjectControllerContext } = require("../p
29
29
 
30
30
  function loadRenderer() {
31
31
  try {
32
- // ESM 패키지 — Node >=20.19 의 require(esm). engines 가 이 최소선을 선언한다.
33
- return require("@earendil-works/pi-tui");
32
+ /*
33
+ * 렌더러는 engine/vendor/tui 에 내재화돼 있다 — npm 의존성이 아니다.
34
+ * 이유: 정확 핀+무결성 해시는 버전 드리프트·변조를 막지만 레지스트리에서
35
+ * 그 버전이 삭제되면 설치가 실패한다. 소스가 저장소에 있으면 그 위험이 없고
36
+ * 우리가 직접 고칠 수 있다. 갱신은 scripts/vendor-tui.mjs.
37
+ * ESM 이므로 require(esm) 이 필요하다 — engines 가 Node >=20.19 를 선언한다.
38
+ */
39
+ return require("../vendor/tui/index.js");
34
40
  } catch (cause) {
35
41
  throw Object.assign(
36
42
  new Error("The Agentlas shell needs Node >=20.19. Run without AGENTLAS_TUI=1, or upgrade Node."),
@@ -272,7 +278,7 @@ async function startShell(ctx, opts = {}) {
272
278
  const lbl = e.sourceHandle === "true" ? "|참|" : e.sourceHandle === "false" ? "|거짓|" : "";
273
279
  lines.push(` ${e.source} -->${lbl} ${e.target}`);
274
280
  }
275
- const { render, toAnsi } = require("grok-mermaid");
281
+ const { render, toAnsi } = require("../vendor/mermaid/index.js");
276
282
  const art = toAnsi(render(lines.join("\n")));
277
283
  ui.ensureNl();
278
284
  ui.line(ui.c.bold(row.name));
@@ -282,6 +288,19 @@ async function startShell(ctx, opts = {}) {
282
288
  } catch { /* 렌더 실패 → 아래 클래식 폴스루가 텍스트로 보여준다 */ }
283
289
  }
284
290
  }
291
+ // 셸 끄기 — 여기서도 되돌아갈 수 있어야 한다(들어와서 못 나가면 갇힌다)
292
+ if (cmd === "shell") {
293
+ const want = String(rest[0] || "").toLowerCase();
294
+ if (!["on", "off"].includes(want)) { ui.line(ui.c.dim("Usage: /shell on|off (현재: on)")); return; }
295
+ const config = require("../agentlas-config.cjs");
296
+ const { userDataDir } = require("../core/paths.cjs");
297
+ config.updatePrefs(userDataDir(), { shell: want === "on" ? "interactive" : "classic" });
298
+ ui.line(ui.c.dim(want === "on"
299
+ ? (en ? "Already here." : "이미 이 셸입니다.")
300
+ : (en ? "Interactive shell disabled — restart agentlas for the classic REPL."
301
+ : "대화형 셸을 껐습니다 — agentlas 를 다시 실행하면 기본 REPL 입니다.")));
302
+ return;
303
+ }
285
304
  // 데스크탑 대응 화면 (Phase 3) — 정직 정지였던 표면들을 실물로 대체
286
305
  {
287
306
  const screens = require("./screens.cjs");
@@ -0,0 +1,205 @@
1
+ Copyright 2023-2026 SpaceXAI
2
+ Copyright 2026 Alexey Zaytsev
3
+
4
+
5
+ Apache License
6
+ Version 2.0, January 2004
7
+ http://www.apache.org/licenses/
8
+
9
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
10
+
11
+ 1. Definitions.
12
+
13
+ "License" shall mean the terms and conditions for use, reproduction,
14
+ and distribution as defined by Sections 1 through 9 of this document.
15
+
16
+ "Licensor" shall mean the copyright owner or entity authorized by
17
+ the copyright owner that is granting the License.
18
+
19
+ "Legal Entity" shall mean the union of the acting entity and all
20
+ other entities that control, are controlled by, or are under common
21
+ control with that entity. For the purposes of this definition,
22
+ "control" means (i) the power, direct or indirect, to cause the
23
+ direction or management of such entity, whether by contract or
24
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
25
+ outstanding shares, or (iii) beneficial ownership of such entity.
26
+
27
+ "You" (or "Your") shall mean an individual or Legal Entity
28
+ exercising permissions granted by this License.
29
+
30
+ "Source" form shall mean the preferred form for making modifications,
31
+ including but not limited to software source code, documentation
32
+ source, and configuration files.
33
+
34
+ "Object" form shall mean any form resulting from mechanical
35
+ transformation or translation of a Source form, including but
36
+ not limited to compiled object code, generated documentation,
37
+ and conversions to other media types.
38
+
39
+ "Work" shall mean the work of authorship, whether in Source or
40
+ Object form, made available under the License, as indicated by a
41
+ copyright notice that is included in or attached to the work
42
+ (an example is provided in the Appendix below).
43
+
44
+ "Derivative Works" shall mean any work, whether in Source or Object
45
+ form, that is based on (or derived from) the Work and for which the
46
+ editorial revisions, annotations, elaborations, or other modifications
47
+ represent, as a whole, an original work of authorship. For the purposes
48
+ of this License, Derivative Works shall not include works that remain
49
+ separable from, or merely link (or bind by name) to the interfaces of,
50
+ the Work and Derivative Works thereof.
51
+
52
+ "Contribution" shall mean any work of authorship, including
53
+ the original version of the Work and any modifications or additions
54
+ to that Work or Derivative Works thereof, that is intentionally
55
+ submitted to Licensor for inclusion in the Work by the copyright owner
56
+ or by an individual or Legal Entity authorized to submit on behalf of
57
+ the copyright owner. For the purposes of this definition, "submitted"
58
+ means any form of electronic, verbal, or written communication sent
59
+ to the Licensor or its representatives, including but not limited to
60
+ communication on electronic mailing lists, source code control systems,
61
+ and issue tracking systems that are managed by, or on behalf of, the
62
+ Licensor for the purpose of discussing and improving the Work, but
63
+ excluding communication that is conspicuously marked or otherwise
64
+ designated in writing by the copyright owner as "Not a Contribution."
65
+
66
+ "Contributor" shall mean Licensor and any individual or Legal Entity
67
+ on behalf of whom a Contribution has been received by Licensor and
68
+ subsequently incorporated within the Work.
69
+
70
+ 2. Grant of Copyright License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ copyright license to reproduce, prepare Derivative Works of,
74
+ publicly display, publicly perform, sublicense, and distribute the
75
+ Work and such Derivative Works in Source or Object form.
76
+
77
+ 3. Grant of Patent License. Subject to the terms and conditions of
78
+ this License, each Contributor hereby grants to You a perpetual,
79
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
80
+ (except as stated in this section) patent license to make, have made,
81
+ use, offer to sell, sell, import, and otherwise transfer the Work,
82
+ where such license applies only to those patent claims licensable
83
+ by such Contributor that are necessarily infringed by their
84
+ Contribution(s) alone or by combination of their Contribution(s)
85
+ with the Work to which such Contribution(s) was submitted. If You
86
+ institute patent litigation against any entity (including a
87
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
88
+ or a Contribution incorporated within the Work constitutes direct
89
+ or contributory patent infringement, then any patent licenses
90
+ granted to You under this License for that Work shall terminate
91
+ as of the date such litigation is filed.
92
+
93
+ 4. Redistribution. You may reproduce and distribute copies of the
94
+ Work or Derivative Works thereof in any medium, with or without
95
+ modifications, and in Source or Object form, provided that You
96
+ meet the following conditions:
97
+
98
+ (a) You must give any other recipients of the Work or
99
+ Derivative Works a copy of this License; and
100
+
101
+ (b) You must cause any modified files to carry prominent notices
102
+ stating that You changed the files; and
103
+
104
+ (c) You must retain, in the Source form of any Derivative Works
105
+ that You distribute, all copyright, patent, trademark, and
106
+ attribution notices from the Source form of the Work,
107
+ excluding those notices that do not pertain to any part of
108
+ the Derivative Works; and
109
+
110
+ (d) If the Work includes a "NOTICE" text file as part of its
111
+ distribution, then any Derivative Works that You distribute must
112
+ include a readable copy of the attribution notices contained
113
+ within such NOTICE file, excluding those notices that do not
114
+ pertain to any part of the Derivative Works, in at least one
115
+ of the following places: within a NOTICE text file distributed
116
+ as part of the Derivative Works; within the Source form or
117
+ documentation, if provided along with the Derivative Works; or,
118
+ within a display generated by the Derivative Works, if and
119
+ wherever such third-party notices normally appear. The contents
120
+ of the NOTICE file are for informational purposes only and
121
+ do not modify the License. You may add Your own attribution
122
+ notices within Derivative Works that You distribute, alongside
123
+ or as an addendum to the NOTICE text from the Work, provided
124
+ that such additional attribution notices cannot be construed
125
+ as modifying the License.
126
+
127
+ You may add Your own copyright statement to Your modifications and
128
+ may provide additional or different license terms and conditions
129
+ for use, reproduction, or distribution of Your modifications, or
130
+ for any such Derivative Works as a whole, provided Your use,
131
+ reproduction, and distribution of the Work otherwise complies with
132
+ the conditions stated in this License.
133
+
134
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
135
+ any Contribution intentionally submitted for inclusion in the Work
136
+ by You to the Licensor shall be under the terms and conditions of
137
+ this License, without any additional terms or conditions.
138
+ Notwithstanding the above, nothing herein shall supersede or modify
139
+ the terms of any separate license agreement you may have executed
140
+ with Licensor regarding such Contributions.
141
+
142
+ 6. Trademarks. This License does not grant permission to use the trade
143
+ names, trademarks, service marks, or product names of the Licensor,
144
+ except as required for reasonable and customary use in describing the
145
+ origin of the Work and reproducing the content of the NOTICE file.
146
+
147
+ 7. Disclaimer of Warranty. Unless required by applicable law or
148
+ agreed to in writing, Licensor provides the Work (and each
149
+ Contributor provides its Contributions) on an "AS IS" BASIS,
150
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
151
+ implied, including, without limitation, any warranties or conditions
152
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
153
+ PARTICULAR PURPOSE. You are solely responsible for determining the
154
+ appropriateness of using or redistributing the Work and assume any
155
+ risks associated with Your exercise of permissions under this License.
156
+
157
+ 8. Limitation of Liability. In no event and under no legal theory,
158
+ whether in tort (including negligence), contract, or otherwise,
159
+ unless required by applicable law (such as deliberate and grossly
160
+ negligent acts) or agreed to in writing, shall any Contributor be
161
+ liable to You for damages, including any direct, indirect, special,
162
+ incidental, or consequential damages of any character arising as a
163
+ result of this License or out of the use or inability to use the
164
+ Work (including but not limited to damages for loss of goodwill,
165
+ work stoppage, computer failure or malfunction, or any and all
166
+ other commercial damages or losses), even if such Contributor
167
+ has been advised of the possibility of such damages.
168
+
169
+ 9. Accepting Warranty or Additional Liability. While redistributing
170
+ the Work or Derivative Works thereof, You may choose to offer,
171
+ and charge a fee for, acceptance of support, warranty, indemnity,
172
+ or other liability obligations and/or rights consistent with this
173
+ License. However, in accepting such obligations, You may act only
174
+ on Your own behalf and on Your sole responsibility, not on behalf
175
+ of any other Contributor, and only if You agree to indemnify,
176
+ defend, and hold each Contributor harmless for any liability
177
+ incurred by, or claims asserted against, such Contributor by reason
178
+ of your accepting any such warranty or additional liability.
179
+
180
+ END OF TERMS AND CONDITIONS
181
+
182
+ APPENDIX: How to apply the Apache License to your work.
183
+
184
+ To apply the Apache License to your work, attach the following
185
+ boilerplate notice, with the fields enclosed by brackets "[]"
186
+ replaced with your own identifying information. (Don't include
187
+ the brackets!) The text should be enclosed in the appropriate
188
+ comment syntax for the file format. We also recommend that a
189
+ file or class name and description of purpose be included on the
190
+ same "printed page" as the copyright notice for easier
191
+ identification within third-party archives.
192
+
193
+ Copyright [yyyy] [name of copyright owner]
194
+
195
+ Licensed under the Apache License, Version 2.0 (the "License");
196
+ you may not use this file except in compliance with the License.
197
+ You may obtain a copy of the License at
198
+
199
+ http://www.apache.org/licenses/LICENSE-2.0
200
+
201
+ Unless required by applicable law or agreed to in writing, software
202
+ distributed under the License is distributed on an "AS IS" BASIS,
203
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
204
+ See the License for the specific language governing permissions and
205
+ limitations under the License.
@@ -0,0 +1,23 @@
1
+ const ESC = String.fromCharCode(27);
2
+ /** Dim frame, plain labels, cyan connectors. Readable on light and dark. */
3
+ export const DEFAULT_THEME = {
4
+ border: '2',
5
+ edge: '36',
6
+ edgeLabel: '2;36',
7
+ title: '1',
8
+ };
9
+ /**
10
+ * Render art to ANSI-coloured lines.
11
+ *
12
+ * A convenience over mapping `art.styled` yourself — reach for that directly
13
+ * when your TUI has its own styling model.
14
+ */
15
+ export function toAnsi(art, theme = DEFAULT_THEME) {
16
+ return art.styled.map((row) => row
17
+ .map((span) => {
18
+ const sgr = theme[span.cls];
19
+ return sgr === undefined ? span.text : `${ESC}[${sgr}m${span.text}${ESC}[0m`;
20
+ })
21
+ .join(''));
22
+ }
23
+ //# sourceMappingURL=ansi.js.map