@mcuste/pi-diagram 0.0.0

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 (73) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +240 -0
  3. package/dist/artifacts.d.ts +59 -0
  4. package/dist/artifacts.d.ts.map +1 -0
  5. package/dist/artifacts.js +274 -0
  6. package/dist/artifacts.js.map +1 -0
  7. package/dist/cache.d.ts +43 -0
  8. package/dist/cache.d.ts.map +1 -0
  9. package/dist/cache.js +0 -0
  10. package/dist/cache.js.map +1 -0
  11. package/dist/d2/diagnostics.d.ts +25 -0
  12. package/dist/d2/diagnostics.d.ts.map +1 -0
  13. package/dist/d2/diagnostics.js +77 -0
  14. package/dist/d2/diagnostics.js.map +1 -0
  15. package/dist/d2/fonts.d.ts +23 -0
  16. package/dist/d2/fonts.d.ts.map +1 -0
  17. package/dist/d2/fonts.js +255 -0
  18. package/dist/d2/fonts.js.map +1 -0
  19. package/dist/d2/preflight.d.ts +20 -0
  20. package/dist/d2/preflight.d.ts.map +1 -0
  21. package/dist/d2/preflight.js +217 -0
  22. package/dist/d2/preflight.js.map +1 -0
  23. package/dist/d2/profiles.d.ts +34 -0
  24. package/dist/d2/profiles.d.ts.map +1 -0
  25. package/dist/d2/profiles.js +118 -0
  26. package/dist/d2/profiles.js.map +1 -0
  27. package/dist/d2/runner.d.ts +95 -0
  28. package/dist/d2/runner.d.ts.map +1 -0
  29. package/dist/d2/runner.js +350 -0
  30. package/dist/d2/runner.js.map +1 -0
  31. package/dist/display.d.ts +48 -0
  32. package/dist/display.d.ts.map +1 -0
  33. package/dist/display.js +120 -0
  34. package/dist/display.js.map +1 -0
  35. package/dist/index.d.ts +3 -0
  36. package/dist/index.d.ts.map +1 -0
  37. package/dist/index.js +5 -0
  38. package/dist/index.js.map +1 -0
  39. package/dist/normalize.d.ts +23 -0
  40. package/dist/normalize.d.ts.map +1 -0
  41. package/dist/normalize.js +83 -0
  42. package/dist/normalize.js.map +1 -0
  43. package/dist/process.d.ts +38 -0
  44. package/dist/process.d.ts.map +1 -0
  45. package/dist/process.js +87 -0
  46. package/dist/process.js.map +1 -0
  47. package/dist/raster.d.ts +40 -0
  48. package/dist/raster.d.ts.map +1 -0
  49. package/dist/raster.js +193 -0
  50. package/dist/raster.js.map +1 -0
  51. package/dist/render.d.ts +55 -0
  52. package/dist/render.d.ts.map +1 -0
  53. package/dist/render.js +229 -0
  54. package/dist/render.js.map +1 -0
  55. package/dist/tools.d.ts +58 -0
  56. package/dist/tools.d.ts.map +1 -0
  57. package/dist/tools.js +284 -0
  58. package/dist/tools.js.map +1 -0
  59. package/package.json +101 -0
  60. package/src/artifacts.ts +418 -0
  61. package/src/cache.ts +0 -0
  62. package/src/d2/diagnostics.ts +114 -0
  63. package/src/d2/fonts.ts +289 -0
  64. package/src/d2/preflight.ts +270 -0
  65. package/src/d2/profiles.ts +157 -0
  66. package/src/d2/runner.ts +513 -0
  67. package/src/display.ts +201 -0
  68. package/src/index.ts +5 -0
  69. package/src/normalize.ts +119 -0
  70. package/src/process.ts +134 -0
  71. package/src/raster.ts +258 -0
  72. package/src/render.ts +338 -0
  73. package/src/tools.ts +455 -0
@@ -0,0 +1,350 @@
1
+ import { mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
2
+ import { tmpdir } from "node:os";
3
+ import { join } from "node:path";
4
+ import { cacheKey, FileCache } from "../cache.js";
5
+ import { CommandCancelledError, CommandInvocationError, CommandOutputLimitError, CommandTimeoutError, runCommand, } from "../process.js";
6
+ import { DiagramSourceError, parseD2Diagnostics } from "./diagnostics.js";
7
+ /**
8
+ * Runs the D2 CLI. The source reaches D2 only as a file in a fresh temporary directory: no
9
+ * model-written string ever enters the argument list, which is built from the literals below.
10
+ */
11
+ /**
12
+ * 0.7.x draws `shape: sql_table` as an empty box, losing every column. The prebuilt GitHub
13
+ * release binaries stop at 0.7.1, so the pinned path is the module tag, not a release asset.
14
+ */
15
+ const MINIMUM_D2_VERSION = "0.8.0";
16
+ const D2_TIMEOUT_SECONDS = 10;
17
+ /** Above D2's own timeout, so D2 reports it first and this only catches a hung process. */
18
+ const PROCESS_TIMEOUT_MS = (D2_TIMEOUT_SECONDS + 5) * 1000;
19
+ const MAX_RENDER_BYTES = 1024 * 1024;
20
+ const INPUT_FILE = "input.d2";
21
+ const INSTALL_HINT = "Install the D2 CLI with `brew install d2` or " +
22
+ "`go install github.com/d2lang/d2@v0.8.1`, or point D2_BIN at an existing one. Version " +
23
+ `${MINIMUM_D2_VERSION} or newer is required.`;
24
+ /** The user has to fix this by installing D2. Retrying the call will not help. */
25
+ class D2UnavailableError extends Error {
26
+ constructor(message, options) {
27
+ super(`${message} ${INSTALL_HINT}`, { ...options });
28
+ this.name = "D2UnavailableError";
29
+ }
30
+ }
31
+ /** D2 accepted the source but drew nothing usable. Not the model's mistake to correct. */
32
+ export class TextRenderUnavailableError extends Error {
33
+ diagnostics;
34
+ constructor(message, diagnostics = []) {
35
+ super(message);
36
+ this.name = "TextRenderUnavailableError";
37
+ this.diagnostics = diagnostics;
38
+ }
39
+ }
40
+ function args(...values) {
41
+ return values;
42
+ }
43
+ /** No theme or spacing: D2 draws text in character cells, which neither one changes. */
44
+ function renderArguments(mode) {
45
+ return args("--layout", "elk", "--timeout", String(D2_TIMEOUT_SECONDS), "--ascii-mode", mode, "--stdout-format", "ascii", INPUT_FILE, "-");
46
+ }
47
+ function svgArguments(profile) {
48
+ return args("--layout", profile.layout.engine, ...spacingArguments(profile.layout), ...(profile.sketch ? ["--sketch"] : []), "--theme", String(profile.theme), "--dark-theme", String(profile.darkTheme), "--pad", String(profile.padPx), "--timeout", String(D2_TIMEOUT_SECONDS), "--stdout-format", "svg", INPUT_FILE, "-");
49
+ }
50
+ /** `d2 fmt` rewrites the file it is given, so there is no output format to ask for. */
51
+ const FORMAT_ARGUMENTS = args("fmt", INPUT_FILE);
52
+ function spacingArguments(layout) {
53
+ if (layout.engine === "dagre") {
54
+ return [
55
+ "--dagre-nodesep",
56
+ String(layout.nodeGapPx),
57
+ "--dagre-edgesep",
58
+ String(layout.edgeGapPx),
59
+ ];
60
+ }
61
+ const pad = layout.containerPadPx;
62
+ return [
63
+ "--elk-nodeNodeBetweenLayers",
64
+ String(layout.layerGapPx),
65
+ "--elk-edgeNodeBetweenLayers",
66
+ String(layout.edgeGapPx),
67
+ "--elk-padding",
68
+ `[top=${pad},left=${pad},bottom=${pad},right=${pad}]`,
69
+ ];
70
+ }
71
+ /** D2 reports strings such as `v0.8.1-HEAD`, so only the three numbers are compared. */
72
+ export function parseD2Version(result) {
73
+ const raw = (result.stdout.trim() || result.stderr.trim()).split("\n")[0]?.trim() ?? "";
74
+ const match = /^v?(\d+)\.(\d+)\.(\d+)/u.exec(raw);
75
+ if (!match || result.exitCode !== 0) {
76
+ throw new D2UnavailableError(`Could not read a version from D2 (${raw ? JSON.stringify(raw) : "no output"}).`);
77
+ }
78
+ const found = triple(match[1], match[2], match[3]);
79
+ if (found === undefined) {
80
+ throw new D2UnavailableError(`Could not read a version from D2 (${JSON.stringify(raw)}).`);
81
+ }
82
+ if (isBelow(found, MINIMUM_VERSION)) {
83
+ throw new D2UnavailableError(`D2 ${raw} is installed, which is too old.`);
84
+ }
85
+ return raw;
86
+ }
87
+ const MINIMUM_VERSION = versionOf(MINIMUM_D2_VERSION);
88
+ function versionOf(value) {
89
+ const parts = value.split(".");
90
+ const version = triple(parts[0], parts[1], parts[2]);
91
+ if (version === undefined) {
92
+ throw new Error(`Not a three-part version: ${JSON.stringify(value)}.`);
93
+ }
94
+ return version;
95
+ }
96
+ function triple(major, minor, patch) {
97
+ const numbers = [major, minor, patch].map((part) => Number(part));
98
+ const [first, second, third] = numbers;
99
+ if (first === undefined ||
100
+ second === undefined ||
101
+ third === undefined ||
102
+ !numbers.every((part) => Number.isSafeInteger(part) && part >= 0)) {
103
+ return undefined;
104
+ }
105
+ return [first, second, third];
106
+ }
107
+ function isBelow(found, minimum) {
108
+ const [foundMajor, foundMinor, foundPatch] = found;
109
+ const [minMajor, minMinor, minPatch] = minimum;
110
+ if (foundMajor !== minMajor) {
111
+ return foundMajor < minMajor;
112
+ }
113
+ if (foundMinor !== minMinor) {
114
+ return foundMinor < minMinor;
115
+ }
116
+ return foundPatch < minPatch;
117
+ }
118
+ /**
119
+ * D2 exiting zero does not mean the output is usable: the beta text renderer returns blank
120
+ * drawings, and a silently ignored mode flag would otherwise reach the terminal unnoticed.
121
+ */
122
+ export function parseRenderedText(raw, mode) {
123
+ const text = raw
124
+ .replace(/\r\n?/gu, "\n")
125
+ .replace(/[ \t]+$/gmu, "")
126
+ .replace(/\n+$/u, "");
127
+ if (text.trim().length === 0) {
128
+ throw new TextRenderUnavailableError("D2 produced an empty text diagram.");
129
+ }
130
+ for (const char of text) {
131
+ const code = char.codePointAt(0) ?? 0;
132
+ if (code < 32 && char !== "\n") {
133
+ throw new TextRenderUnavailableError(`D2 text output contains a control character (U+${code.toString(16).padStart(4, "0").toUpperCase()}).`);
134
+ }
135
+ if (mode === "standard" && code > 126) {
136
+ throw new TextRenderUnavailableError(`D2 returned a non-ASCII character (${JSON.stringify(char)}) in standard ASCII mode.`);
137
+ }
138
+ }
139
+ const drew = mode === "standard" ? /[+\-|]/u.test(text) : /[\u2500-\u257F\u25A0-\u25FF]/u.test(text);
140
+ if (!drew) {
141
+ throw new TextRenderUnavailableError("D2 text output contains no diagram lines or boxes.");
142
+ }
143
+ return text;
144
+ }
145
+ /**
146
+ * D2 documents exported SVG as web content. The safe subset already rules out icons, images, and
147
+ * Markdown labels, so anything active or externally referenced here means it was bypassed.
148
+ */
149
+ export function parseRenderedSvg(raw) {
150
+ const svg = raw.trim();
151
+ if (svg.length === 0) {
152
+ throw new TextRenderUnavailableError("D2 produced an empty SVG.");
153
+ }
154
+ if (!svg.startsWith("<?xml") && !svg.startsWith("<svg")) {
155
+ throw new TextRenderUnavailableError("D2 output does not start like an SVG document.");
156
+ }
157
+ if (!svg.endsWith("</svg>")) {
158
+ throw new TextRenderUnavailableError("D2 returned a truncated SVG document.");
159
+ }
160
+ const lowered = svg.toLowerCase();
161
+ for (const forbidden of ["<script", "<foreignobject", "<image", "<iframe", "<use"]) {
162
+ if (lowered.includes(forbidden)) {
163
+ throw new TextRenderUnavailableError(`D2 SVG contains ${forbidden}>, which this tool does not write.`);
164
+ }
165
+ }
166
+ if (/(?:xlink:)?href\s*=\s*["']?(?:https?:|\/\/)/u.test(lowered)) {
167
+ throw new TextRenderUnavailableError("D2 SVG references a remote URL.");
168
+ }
169
+ return svg;
170
+ }
171
+ /** Bounds what one session remembers about sources D2 already accepted. */
172
+ const MAX_VALIDATED = 256;
173
+ export class D2Cli {
174
+ runner;
175
+ binary;
176
+ cache;
177
+ version;
178
+ /** Cache keys of sources this process has compiled, so one call validates them once. */
179
+ validated = new Set();
180
+ constructor(dependencies = {}) {
181
+ this.runner = dependencies.runner ?? runCommand;
182
+ this.binary = dependencies.binary ?? parseBinaryName(process.env.D2_BIN);
183
+ this.cache = dependencies.cache ?? new FileCache();
184
+ }
185
+ async renderText(request) {
186
+ const { output, version } = await this.compile(request.source, request.signal, {
187
+ argv: renderArguments(request.asciiMode),
188
+ parse: (stdout) => parseRenderedText(stdout, request.asciiMode),
189
+ failure: "D2 could not draw this diagram as text.",
190
+ });
191
+ return { text: output, version };
192
+ }
193
+ async renderSvg(request) {
194
+ const { output, version } = await this.compile(request.source, request.signal, {
195
+ argv: svgArguments(request.profile),
196
+ parse: parseRenderedSvg,
197
+ failure: "D2 could not draw this diagram as an SVG.",
198
+ });
199
+ return { svg: output, version };
200
+ }
201
+ /** The formatted source is read back from the temp directory, since `fmt` writes no stdout. */
202
+ async formatSource(request) {
203
+ const version = await this.ensureVersion(request.signal);
204
+ const key = cacheKey({
205
+ source: request.source,
206
+ language: "d2",
207
+ binary: this.binary,
208
+ version,
209
+ argv: FORMAT_ARGUMENTS,
210
+ });
211
+ const stored = await this.cache.read(key);
212
+ if (stored !== undefined) {
213
+ return stored;
214
+ }
215
+ const directory = await mkdtemp(join(tmpdir(), "pi-diagram-"));
216
+ try {
217
+ const path = join(directory, INPUT_FILE);
218
+ await writeFile(path, `${request.source}\n`, "utf8");
219
+ const result = await this.run(FORMAT_ARGUMENTS, directory, request.signal);
220
+ if (result.exitCode !== 0) {
221
+ throw new TextRenderUnavailableError("D2 could not format this source.", parseD2Diagnostics(result.stderr, "D2_RENDER", [directory]));
222
+ }
223
+ const formatted = await readFile(path, "utf8");
224
+ await this.cache.write(key, formatted);
225
+ return formatted;
226
+ }
227
+ finally {
228
+ await rm(directory, { recursive: true, force: true });
229
+ }
230
+ }
231
+ async compile(source, signal, step) {
232
+ const version = await this.ensureVersion(signal);
233
+ if (signal?.aborted === true) {
234
+ // A cached answer would otherwise come back after the call was given up on.
235
+ throw new CommandCancelledError("Drawing the diagram");
236
+ }
237
+ const identity = { source, language: "d2", binary: this.binary, version };
238
+ const key = cacheKey({ ...identity, argv: step.argv });
239
+ // No arguments: what D2 accepts depends on the source and the version, not on the flags.
240
+ const compiles = cacheKey({ ...identity, argv: [] });
241
+ const stored = await this.cache.read(key);
242
+ if (stored !== undefined) {
243
+ try {
244
+ const output = step.parse(stored);
245
+ this.remember(compiles);
246
+ return { output, version };
247
+ }
248
+ catch {
249
+ // An entry this build cannot read is no better than a missing one.
250
+ }
251
+ }
252
+ const directory = await mkdtemp(join(tmpdir(), "pi-diagram-"));
253
+ try {
254
+ await writeFile(join(directory, INPUT_FILE), `${source}\n`, "utf8");
255
+ if (!this.validated.has(compiles)) {
256
+ await this.validate(directory, signal);
257
+ }
258
+ const rendered = await this.run(step.argv, directory, signal);
259
+ if (rendered.exitCode !== 0) {
260
+ throw new TextRenderUnavailableError(step.failure, parseD2Diagnostics(rendered.stderr, "D2_RENDER", [directory]));
261
+ }
262
+ const output = step.parse(rendered.stdout);
263
+ this.remember(compiles);
264
+ await this.cache.write(key, rendered.stdout);
265
+ return { output, version };
266
+ }
267
+ finally {
268
+ await rm(directory, { recursive: true, force: true });
269
+ }
270
+ }
271
+ remember(key) {
272
+ if (this.validated.size >= MAX_VALIDATED) {
273
+ this.validated.clear();
274
+ }
275
+ this.validated.add(key);
276
+ }
277
+ async validate(directory, signal) {
278
+ const result = await this.run(args("validate", INPUT_FILE), directory, signal);
279
+ if (result.exitCode !== 0) {
280
+ throw new DiagramSourceError("D2 could not compile this source.", parseD2Diagnostics(result.stderr, "D2_SYNTAX", [directory]));
281
+ }
282
+ }
283
+ async ensureVersion(signal) {
284
+ if (this.version !== undefined) {
285
+ return this.version;
286
+ }
287
+ // Deliberately not cached on failure, so installing D2 mid-session starts working.
288
+ const result = await this.run(args("--version"), tmpdir(), signal);
289
+ this.version = parseD2Version(result);
290
+ return this.version;
291
+ }
292
+ async run(argv, cwd, signal) {
293
+ try {
294
+ return await this.runner(this.binary, argv, {
295
+ cwd,
296
+ signal,
297
+ // D2 renders correctly with an empty environment. PATH is here only so a bare
298
+ // command name resolves.
299
+ env: { PATH: process.env.PATH ?? "" },
300
+ timeoutMs: PROCESS_TIMEOUT_MS,
301
+ maxOutputBytes: MAX_RENDER_BYTES,
302
+ });
303
+ }
304
+ catch (error) {
305
+ throw translate(error, this.binary);
306
+ }
307
+ }
308
+ }
309
+ function translate(error, binary) {
310
+ if (error instanceof CommandCancelledError) {
311
+ return error;
312
+ }
313
+ if (error instanceof CommandInvocationError) {
314
+ return new D2UnavailableError(`Could not run ${JSON.stringify(binary)}.`, { cause: error });
315
+ }
316
+ if (error instanceof CommandTimeoutError) {
317
+ return new DiagramSourceError("Rendering this diagram took too long.", [
318
+ {
319
+ code: "D2_TIMEOUT",
320
+ message: `D2 did not finish within ${D2_TIMEOUT_SECONDS} seconds.`,
321
+ hint: "Use fewer nodes, or split the diagram.",
322
+ },
323
+ ]);
324
+ }
325
+ if (error instanceof CommandOutputLimitError) {
326
+ return new DiagramSourceError("The rendered diagram is too large.", [
327
+ {
328
+ code: "D2_TOO_LARGE",
329
+ message: `D2 produced more than ${MAX_RENDER_BYTES} bytes.`,
330
+ hint: "Use fewer nodes, or split the diagram.",
331
+ },
332
+ ]);
333
+ }
334
+ return error;
335
+ }
336
+ /**
337
+ * `D2_BIN` is not model input, but it still lands in an exec call, so anything that could read
338
+ * as an option or split into extra arguments is refused.
339
+ */
340
+ export function parseBinaryName(value) {
341
+ if (value === undefined || value.trim().length === 0) {
342
+ return "d2";
343
+ }
344
+ const binary = value.trim();
345
+ if (binary.startsWith("-") || /[\s"'`$;&|<>]/u.test(binary)) {
346
+ throw new D2UnavailableError(`D2_BIN is not a usable command: ${JSON.stringify(value)}.`);
347
+ }
348
+ return binary;
349
+ }
350
+ //# sourceMappingURL=runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../src/d2/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAoB,MAAM,aAAa,CAAC;AACpE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EAGvB,mBAAmB,EACnB,UAAU,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAAmB,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAI3F;;;GAGG;AAEH;;;GAGG;AACH,MAAM,kBAAkB,GAAG,OAAO,CAAC;AACnC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,2FAA2F;AAC3F,MAAM,kBAAkB,GAAG,CAAC,kBAAkB,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;AAC3D,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAAC;AACrC,MAAM,UAAU,GAAG,UAAU,CAAC;AAE9B,MAAM,YAAY,GAChB,+CAA+C;IAC/C,wFAAwF;IAC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YAAY,uBAAuB,EAAE,CAAC;QAC7C,OAAO,IAAI,kBAAkB,CAAC,oCAAoC,EAAE;YAClE;gBACE,IAAI,EAAE,cAAc;gBACpB,OAAO,EAAE,yBAAyB,gBAAgB,SAAS;gBAC3D,IAAI,EAAE,wCAAwC;aAC/C;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAAyB;IACvD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC5B,IAAI,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,kBAAkB,CAAC,mCAAmC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC5F,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,48 @@
1
+ export interface Component {
2
+ render(width: number): string[];
3
+ }
4
+ export interface DisplayTheme {
5
+ fg(color: string, text: string): string;
6
+ }
7
+ export interface DisplayContext {
8
+ readonly showImages: boolean;
9
+ readonly expanded: boolean;
10
+ /** Per-row scratch space from the host, used to read each image only once. */
11
+ readonly state: Record<string, unknown>;
12
+ }
13
+ interface DisplayImage {
14
+ readonly path: string;
15
+ readonly widthPx: number;
16
+ readonly heightPx: number;
17
+ }
18
+ /**
19
+ * The library keeps image placement state in module scope, so the host and this package have to
20
+ * use the same copy. A local checkout has its own, which wins by bare name.
21
+ */
22
+ export declare function tuiSpecifier(entry: string | undefined): string;
23
+ /** Loaded once at registration, since a render cannot wait on an import. */
24
+ export declare function primeDisplay(): Promise<void>;
25
+ /** Whether the terminal speaks an image protocol, or `undefined` until the library has loaded. */
26
+ export declare function imagesSupported(): boolean | undefined;
27
+ /** Whether this package can draw a result row at all, or the host has to print the text. */
28
+ export declare function displayLoaded(): boolean;
29
+ export interface DiagramCallView {
30
+ /** What is being drawn: the title, or a line count when there is no title. */
31
+ readonly subject: string;
32
+ /** The profile, and the directory when the call also saves files. */
33
+ readonly note: string;
34
+ }
35
+ /** The row while D2 runs. The source would fill the transcript, so it is not shown. */
36
+ export declare function renderDiagramCall(view: DiagramCallView, theme: DisplayTheme): Component;
37
+ export declare function renderDiagramResult(view: DiagramView, theme: DisplayTheme, context: DisplayContext): Component;
38
+ export interface DiagramView {
39
+ readonly image: DisplayImage | undefined;
40
+ readonly title: string | undefined;
41
+ /** Drawn when there is no image, or when the one there is cannot be shown. */
42
+ readonly text: string;
43
+ readonly notes: readonly string[];
44
+ /** Render mode, paths, diagnostics, and source. Shown only in the expanded row. */
45
+ readonly details: readonly string[];
46
+ }
47
+ export {};
48
+ //# sourceMappingURL=display.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../src/display.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACzC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAED,UAAU,YAAY;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAiBD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAS9D;AAED,4EAA4E;AAC5E,wBAAgB,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAY5C;AAED,kGAAkG;AAClG,wBAAgB,eAAe,IAAI,OAAO,GAAG,SAAS,CAErD;AAED,4FAA4F;AAC5F,wBAAgB,aAAa,IAAI,OAAO,CAEvC;AAWD,MAAM,WAAW,eAAe;IAC9B,8EAA8E;IAC9E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,uFAAuF;AACvF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,YAAY,GAAG,SAAS,CASvF;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,cAAc,GACtB,SAAS,CAuCX;AAUD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,mFAAmF;IACnF,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC"}
@@ -0,0 +1,120 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import { pathToFileURL } from "node:url";
4
+ /**
5
+ * Turns a diagram result into terminal components. Both the image and the text are drawn here
6
+ * rather than by the host, so neither has to travel back through the model's context. The image is
7
+ * read from the temp store at display time.
8
+ */
9
+ /** Wide enough for an architecture diagram, short enough to leave the transcript readable. */
10
+ const MAX_WIDTH_CELLS = 80;
11
+ /** Without a bound the library reserves a square, about 40 rows, drawn or not. */
12
+ const MAX_HEIGHT_CELLS = 30;
13
+ const MAX_IMAGE_BYTES = 4 * 1024 * 1024;
14
+ let tui;
15
+ /**
16
+ * The library keeps image placement state in module scope, so the host and this package have to
17
+ * use the same copy. A local checkout has its own, which wins by bare name.
18
+ */
19
+ export function tuiSpecifier(entry) {
20
+ if (entry !== undefined) {
21
+ try {
22
+ return pathToFileURL(createRequire(entry).resolve("@earendil-works/pi-tui")).href;
23
+ }
24
+ catch {
25
+ // Not resolvable from the host, so fall back to whatever this package can see.
26
+ }
27
+ }
28
+ return "@earendil-works/pi-tui";
29
+ }
30
+ /** Loaded once at registration, since a render cannot wait on an import. */
31
+ export function primeDisplay() {
32
+ if (tui !== undefined) {
33
+ return Promise.resolve();
34
+ }
35
+ return import(tuiSpecifier(process.argv[1])).then((module) => {
36
+ tui = module;
37
+ }, () => {
38
+ // Text rendering needs none of this, so a missing library is not worth reporting.
39
+ });
40
+ }
41
+ /** Whether the terminal speaks an image protocol, or `undefined` until the library has loaded. */
42
+ export function imagesSupported() {
43
+ return tui === undefined ? undefined : tui.getCapabilities().images !== null;
44
+ }
45
+ /** Whether this package can draw a result row at all, or the host has to print the text. */
46
+ export function displayLoaded() {
47
+ return tui !== undefined;
48
+ }
49
+ /** Throws when the library is missing, which the host takes as a request to draw the row itself. */
50
+ function loadedModule() {
51
+ if (tui === undefined) {
52
+ primeDisplay();
53
+ throw new Error("The TUI library is not loaded.");
54
+ }
55
+ return tui;
56
+ }
57
+ /** The row while D2 runs. The source would fill the transcript, so it is not shown. */
58
+ export function renderDiagramCall(view, theme) {
59
+ const module = loadedModule();
60
+ const text = [
61
+ theme.fg("toolTitle", "diagram "),
62
+ theme.fg("accent", view.subject),
63
+ " ",
64
+ theme.fg("muted", view.note),
65
+ ].join("");
66
+ return new module.Text(text, 0, 0);
67
+ }
68
+ export function renderDiagramResult(view, theme, context) {
69
+ const module = loadedModule();
70
+ const container = new module.Container();
71
+ const line = (text) => {
72
+ container.addChild(new module.Text(theme.fg("toolOutput", text), 0, 0));
73
+ };
74
+ if (view.title !== undefined) {
75
+ line(view.title);
76
+ }
77
+ const image = drawable(module, view.image, context) ? view.image : undefined;
78
+ if (image === undefined) {
79
+ line(view.text);
80
+ }
81
+ else {
82
+ try {
83
+ container.addChild(new module.Image(read(image, context), "image/png", { fallbackColor: (text) => theme.fg("toolOutput", text) }, {
84
+ maxWidthCells: MAX_WIDTH_CELLS,
85
+ maxHeightCells: MAX_HEIGHT_CELLS,
86
+ filename: image.path,
87
+ }, { widthPx: image.widthPx, heightPx: image.heightPx }));
88
+ }
89
+ catch {
90
+ // The picture is gone from the temp store, so show the text instead.
91
+ line(view.text);
92
+ }
93
+ }
94
+ const footer = [...view.notes, ...(context.expanded ? view.details : [])];
95
+ if (footer.length > 0) {
96
+ line(footer.join("\n"));
97
+ }
98
+ return container;
99
+ }
100
+ function drawable(module, image, context) {
101
+ return image !== undefined && context.showImages && module.getCapabilities().images !== null;
102
+ }
103
+ /** Reads the image once per result row: the host calls the renderer again on every redraw. */
104
+ function read(image, context) {
105
+ const cached = context.state["diagramImage"];
106
+ if (typeof cached === "object" && cached !== null) {
107
+ const { path, encoded } = cached;
108
+ if (path === image.path && typeof encoded === "string") {
109
+ return encoded;
110
+ }
111
+ }
112
+ const bytes = readFileSync(image.path);
113
+ if (bytes.length === 0 || bytes.length > MAX_IMAGE_BYTES) {
114
+ throw new Error(`The image at ${image.path} is ${bytes.length} bytes.`);
115
+ }
116
+ const encoded = bytes.toString("base64");
117
+ context.state["diagramImage"] = { path: image.path, encoded };
118
+ return encoded;
119
+ }
120
+ //# sourceMappingURL=display.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display.js","sourceRoot":"","sources":["../src/display.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAA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,MAAM,CAAC,eAAe,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC;AAC/F,CAAC;AAYD,8FAA8F;AAC9F,SAAS,IAAI,CAAC,KAAmB,EAAE,OAAuB;IACxD,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAC7C,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QAClD,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAA+C,CAAC;QAC1E,IAAI,IAAI,KAAK,KAAK,CAAC,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YACvD,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IAED,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,eAAe,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,gBAAgB,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC,CAAC;IAC1E,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACzC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC;IAC9D,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type DiagramExtensionApi } from "./tools.js";
2
+ export default function piDiagram(pi: DiagramExtensionApi): void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAwB,MAAM,YAAY,CAAC;AAE5E,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAE,EAAE,mBAAmB,GAAG,IAAI,CAE/D"}
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import { registerDiagramTools } from "./tools.js";
2
+ export default function piDiagram(pi) {
3
+ registerDiagramTools(pi);
4
+ }
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAE5E,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAuB;IACvD,oBAAoB,CAAC,EAAE,CAAC,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,23 @@
1
+ declare const normalizedSourceBrand: unique symbol;
2
+ declare const safeTitleBrand: unique symbol;
3
+ /**
4
+ * Source in canonical form: no byte-order mark, LF endings, trimmed, no control characters,
5
+ * within the size cap. Only `normalizeSource` can produce one.
6
+ */
7
+ export type NormalizedD2Source = string & {
8
+ readonly [normalizedSourceBrand]: true;
9
+ };
10
+ /** A single-line title of bounded length, safe to show beside the diagram. */
11
+ export type SafeTitle = string & {
12
+ readonly [safeTitleBrand]: true;
13
+ };
14
+ export interface NormalizedSource {
15
+ readonly text: NormalizedD2Source;
16
+ readonly hash: string;
17
+ readonly lineCount: number;
18
+ }
19
+ /** Runs before anything inspects or renders, so the scanner and D2 see the same bytes. */
20
+ export declare function normalizeSource(raw: unknown): NormalizedSource;
21
+ export declare function parseTitle(raw: unknown): SafeTitle | undefined;
22
+ export {};
23
+ //# sourceMappingURL=normalize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../src/normalize.ts"],"names":[],"mappings":"AAaA,OAAO,CAAC,MAAM,qBAAqB,EAAE,OAAO,MAAM,CAAC;AACnD,OAAO,CAAC,MAAM,cAAc,EAAE,OAAO,MAAM,CAAC;AAE5C;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,qBAAqB,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAErF,8EAA8E;AAC9E,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,cAAc,CAAC,EAAE,IAAI,CAAA;CAAE,CAAC;AAErE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AA2BD,0FAA0F;AAC1F,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAyC9D;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,SAAS,GAAG,SAAS,CAc9D"}