agentlas 1.0.41 → 1.0.43
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.
- package/CHANGELOG.md +40 -8
- package/engine/agentlas-workforce.cjs +1 -1
- package/engine/commands/index.cjs +5 -5
- package/engine/hephaestus/runtime.cjs +1 -1
- package/engine/storm/storm.cjs +1 -1
- package/engine/storm/swarm.cjs +1 -1
- package/engine/ui/repl.cjs +4 -4
- package/engine/ui/{pitui-screens.cjs → screens.cjs} +143 -6
- package/engine/ui/{pitui-shell.cjs → shell.cjs} +42 -27
- package/engine/ui/width.cjs +1 -1
- package/engine/vendor/mermaid/LICENSE +205 -0
- package/engine/vendor/mermaid/ansi.js +23 -0
- package/engine/vendor/mermaid/canvas.js +366 -0
- package/engine/vendor/mermaid/graph.js +91 -0
- package/engine/vendor/mermaid/index.js +100 -0
- package/engine/vendor/mermaid/labels.js +324 -0
- package/engine/vendor/mermaid/layout-seq.js +194 -0
- package/engine/vendor/mermaid/layout.js +881 -0
- package/engine/vendor/mermaid/package.json +1 -0
- package/engine/vendor/mermaid/parse.js +1108 -0
- package/engine/vendor/mermaid/source-box.js +78 -0
- package/engine/vendor/mermaid/types.js +1 -0
- package/engine/vendor/mermaid/width-data.js +994 -0
- package/engine/vendor/mermaid/width.js +76 -0
- package/engine/vendor/tui/LICENSE +20 -0
- package/engine/vendor/tui/autocomplete.js +632 -0
- package/engine/vendor/tui/components/alt-screen-flash.js +37 -0
- package/engine/vendor/tui/components/box.js +104 -0
- package/engine/vendor/tui/components/cancellable-loader.js +35 -0
- package/engine/vendor/tui/components/editor.js +1961 -0
- package/engine/vendor/tui/components/h-stack.js +43 -0
- package/engine/vendor/tui/components/image.js +90 -0
- package/engine/vendor/tui/components/input.js +378 -0
- package/engine/vendor/tui/components/loader.js +69 -0
- package/engine/vendor/tui/components/markdown.js +806 -0
- package/engine/vendor/tui/components/scroll-view.js +173 -0
- package/engine/vendor/tui/components/select-list.js +159 -0
- package/engine/vendor/tui/components/settings-list.js +182 -0
- package/engine/vendor/tui/components/spacer.js +23 -0
- package/engine/vendor/tui/components/stack.js +111 -0
- package/engine/vendor/tui/components/text.js +89 -0
- package/engine/vendor/tui/components/truncated-text.js +51 -0
- package/engine/vendor/tui/components/v-stack.js +26 -0
- package/engine/vendor/tui/deps/east-asian-width/LICENSE +9 -0
- package/engine/vendor/tui/deps/east-asian-width/index.js +30 -0
- package/engine/vendor/tui/deps/east-asian-width/lookup-data.js +21 -0
- package/engine/vendor/tui/deps/east-asian-width/lookup.js +138 -0
- package/engine/vendor/tui/deps/east-asian-width/utilities.js +24 -0
- package/engine/vendor/tui/deps/marked/LICENSE +44 -0
- package/engine/vendor/tui/deps/marked/index.js +77 -0
- package/engine/vendor/tui/editor-component.js +2 -0
- package/engine/vendor/tui/fuzzy.js +110 -0
- package/engine/vendor/tui/index.js +42 -0
- package/engine/vendor/tui/keybindings.js +209 -0
- package/engine/vendor/tui/keys.js +1174 -0
- package/engine/vendor/tui/kill-ring.js +44 -0
- package/engine/vendor/tui/latex.js +1264 -0
- package/engine/vendor/tui/layout-node.js +6 -0
- package/engine/vendor/tui/layout.js +314 -0
- package/engine/vendor/tui/native-modifiers.js +60 -0
- package/engine/vendor/tui/package.json +1 -0
- package/engine/vendor/tui/stdin-buffer.js +361 -0
- package/engine/vendor/tui/terminal-colors.js +59 -0
- package/engine/vendor/tui/terminal-image.js +518 -0
- package/engine/vendor/tui/terminal.js +436 -0
- package/engine/vendor/tui/tui-alt-screen.js +902 -0
- package/engine/vendor/tui/tui-main-screen.js +533 -0
- package/engine/vendor/tui/tui.js +937 -0
- package/engine/vendor/tui/undo-stack.js +25 -0
- package/engine/vendor/tui/utils.js +1191 -0
- package/engine/vendor/tui/word-navigation.js +96 -0
- package/package.json +2 -6
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The raw source in a framed box.
|
|
3
|
+
*
|
|
4
|
+
* What to show when `render` returns `null`, or returns art too wide for the
|
|
5
|
+
* space at hand. Both are the caller's call, so this is theirs to invoke — and
|
|
6
|
+
* theirs to caption, since only they know whether some other view of the
|
|
7
|
+
* diagram exists to point the reader at.
|
|
8
|
+
*/
|
|
9
|
+
import { srcLines, stripControls } from './labels.js';
|
|
10
|
+
import { measured, stringWidth } from './width.js';
|
|
11
|
+
const sat = (a, b) => Math.max(0, a - b);
|
|
12
|
+
/**
|
|
13
|
+
* Frame `src` in a titled box, hard-wrapping its lines to `maxWidth` columns.
|
|
14
|
+
*
|
|
15
|
+
* The result can still exceed `maxWidth`: the body wraps to
|
|
16
|
+
* `max(8, maxWidth - 4)` and the ` mermaid: <kind> ` title is never truncated,
|
|
17
|
+
* so a long first token sets a floor. Check `width` if it matters.
|
|
18
|
+
*/
|
|
19
|
+
export function sourceBox(src, maxWidth) {
|
|
20
|
+
src = stripControls(src);
|
|
21
|
+
const header = src.split(/\s+/).filter((w) => w !== '')[0] ?? 'diagram';
|
|
22
|
+
const title = ` mermaid: ${header} `;
|
|
23
|
+
const limit = maxWidth === undefined ? undefined : Math.max(8, sat(maxWidth, 4));
|
|
24
|
+
const body = srcLines(src)
|
|
25
|
+
.map((l) => l.replace(/\s+$/, ''))
|
|
26
|
+
.reduce((acc, l) => {
|
|
27
|
+
if (!acc.started && l === '')
|
|
28
|
+
return acc;
|
|
29
|
+
acc.started = true;
|
|
30
|
+
acc.lines.push(...chunkLine(l, limit));
|
|
31
|
+
return acc;
|
|
32
|
+
}, { started: false, lines: [] }).lines;
|
|
33
|
+
const contentW = Math.max(stringWidth(title), ...body.map(stringWidth), 0);
|
|
34
|
+
const inner = contentW + 2;
|
|
35
|
+
const plain = [];
|
|
36
|
+
const styled = [];
|
|
37
|
+
const rule = '─'.repeat(sat(inner, stringWidth(title)));
|
|
38
|
+
plain.push(`╭${title}${rule}╮`);
|
|
39
|
+
styled.push([
|
|
40
|
+
{ text: '╭', cls: 'border' },
|
|
41
|
+
{ text: title, cls: 'title' },
|
|
42
|
+
{ text: `${rule}╮`, cls: 'border' },
|
|
43
|
+
]);
|
|
44
|
+
for (const line of body) {
|
|
45
|
+
const pad = ' '.repeat(sat(contentW, stringWidth(line)));
|
|
46
|
+
plain.push(`│ ${line}${pad} │`);
|
|
47
|
+
styled.push([
|
|
48
|
+
{ text: '│ ', cls: 'border' },
|
|
49
|
+
{ text: line, cls: 'text' },
|
|
50
|
+
{ text: `${pad} │`, cls: 'border' },
|
|
51
|
+
]);
|
|
52
|
+
}
|
|
53
|
+
const bottom = `╰${'─'.repeat(inner)}╯`;
|
|
54
|
+
plain.push(bottom);
|
|
55
|
+
styled.push([{ text: bottom, cls: 'border' }]);
|
|
56
|
+
return { plain, styled, width: inner + 2, warnings: [] };
|
|
57
|
+
}
|
|
58
|
+
/** Hard-break a line at `limit` columns, never splitting a wide glyph. */
|
|
59
|
+
function chunkLine(line, limit) {
|
|
60
|
+
if (limit === undefined || stringWidth(line) <= limit)
|
|
61
|
+
return [line];
|
|
62
|
+
const out = [];
|
|
63
|
+
let cur = '';
|
|
64
|
+
let curW = 0;
|
|
65
|
+
for (const [c, cw] of measured(line)) {
|
|
66
|
+
if (curW + cw > limit && cur !== '') {
|
|
67
|
+
out.push(cur);
|
|
68
|
+
cur = '';
|
|
69
|
+
curW = 0;
|
|
70
|
+
}
|
|
71
|
+
cur += c;
|
|
72
|
+
curW += cw;
|
|
73
|
+
}
|
|
74
|
+
if (cur !== '')
|
|
75
|
+
out.push(cur);
|
|
76
|
+
return out;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=source-box.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|