@khanglvm/relay 0.19.0 → 0.20.1
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/README.md +11 -4
- package/bin/rly.js +1 -1
- package/package.json +4 -4
- package/src/cli/args.js +46 -0
- package/src/cli/ask.js +12 -0
- package/src/cli/boards.js +326 -0
- package/src/cli/config.js +56 -0
- package/src/cli/context.js +13 -0
- package/src/cli/git.js +183 -0
- package/src/cli/help.js +91 -0
- package/src/cli/index.js +103 -0
- package/src/cli/install.js +197 -0
- package/src/cli/io.js +186 -0
- package/src/cli/mcp.js +94 -0
- package/src/cli/share.js +45 -0
- package/src/cli/skill.js +192 -0
- package/src/cli/upgrade.js +130 -0
- package/src/cli/wait.js +172 -0
- package/src/file-preview.js +1 -1
- package/src/index.js +1 -1
- package/src/link.js +57 -9
- package/src/mcp-ui/board/block-ctx.js +43 -0
- package/src/mcp-ui/board/bridge.js +165 -0
- package/src/mcp-ui/board/controls.js +310 -0
- package/src/mcp-ui/board/core.js +20 -0
- package/src/mcp-ui/board/lifecycle.js +118 -0
- package/src/mcp-ui/board/normalize.js +95 -0
- package/src/mcp-ui/board/render.js +200 -0
- package/src/mcp-ui/board/state.js +106 -0
- package/src/mcp-ui/board/vendors.js +86 -0
- package/src/mcp.js +12 -18
- package/src/{server.js → server/board.js} +16 -779
- package/src/server/files.js +141 -0
- package/src/server/http.js +114 -0
- package/src/server/index.js +2 -0
- package/src/server/page.js +183 -0
- package/src/server/paths.js +7 -0
- package/src/server/result.js +58 -0
- package/src/server/reviews.js +41 -0
- package/src/server/sanitize.js +231 -0
- package/src/spec/blocks/a2ui.js +25 -0
- package/src/spec/blocks/chart.js +49 -0
- package/src/spec/blocks/code.js +38 -0
- package/src/spec/blocks/diagram.js +39 -0
- package/src/spec/blocks/git-conflict.js +106 -0
- package/src/spec/blocks/image.js +32 -0
- package/src/spec/blocks/index.js +33 -0
- package/src/spec/blocks/markdown.js +13 -0
- package/src/spec/blocks/pdf.js +38 -0
- package/src/spec/blocks/table.js +122 -0
- package/src/spec/blocks/video.js +68 -0
- package/src/spec/blocks/widgets.js +98 -0
- package/src/spec/constants.js +65 -0
- package/src/spec/index.js +5 -0
- package/src/spec/normalize.js +285 -0
- package/src/spec/ready.js +106 -0
- package/src/spec/schema.js +182 -0
- package/src/spec/sources.js +83 -0
- package/src/store.js +1 -1
- package/src/ui/annotate/api.js +149 -0
- package/src/ui/annotate/badges.js +77 -0
- package/src/ui/annotate/chrome.js +158 -0
- package/src/ui/annotate/core.js +134 -0
- package/src/ui/annotate/highlights.js +129 -0
- package/src/ui/annotate/mutations.js +127 -0
- package/src/ui/annotate/popover.js +206 -0
- package/src/ui/annotate/summary.js +67 -0
- package/src/ui/app/annotations.js +88 -0
- package/src/ui/app/autosave.js +44 -0
- package/src/ui/app/core.js +74 -0
- package/src/ui/app/drafts.js +201 -0
- package/src/ui/app/heartbeat.js +150 -0
- package/src/ui/app/iframe-bridge.js +64 -0
- package/src/ui/app/persistence.js +117 -0
- package/src/ui/app/prefilled.js +21 -0
- package/src/ui/app/presence.js +38 -0
- package/src/ui/app/question-color.js +67 -0
- package/src/ui/app/questions.js +360 -0
- package/src/ui/app/render.js +135 -0
- package/src/ui/app/share.js +108 -0
- package/src/ui/app/submit.js +109 -0
- package/src/ui/app/theme.js +63 -0
- package/src/ui/blocks/api.js +1 -0
- package/src/ui/blocks/chart.js +222 -0
- package/src/ui/blocks/code.js +138 -0
- package/src/ui/blocks/compare.js +82 -0
- package/src/ui/blocks/core.js +74 -0
- package/src/ui/blocks/diff.js +361 -0
- package/src/ui/blocks/dispatch.js +111 -0
- package/src/ui/blocks/file-links.js +180 -0
- package/src/ui/blocks/git-conflict.js +151 -0
- package/src/ui/blocks/graphviz.js +57 -0
- package/src/ui/blocks/html.js +45 -0
- package/src/ui/blocks/image.js +371 -0
- package/src/ui/blocks/kpi.js +26 -0
- package/src/ui/blocks/markdown.js +223 -0
- package/src/ui/blocks/mermaid.js +242 -0
- package/src/ui/blocks/palette.js +59 -0
- package/src/ui/blocks/pdf.js +21 -0
- package/src/ui/blocks/plantuml.js +152 -0
- package/src/ui/blocks/table.js +155 -0
- package/src/ui/blocks/typography.js +25 -0
- package/src/ui/blocks/vendor.js +43 -0
- package/src/ui/blocks/video.js +43 -0
- package/src/ui/blocks/viewer-fullscreen.js +146 -0
- package/src/ui/blocks/viewer.js +324 -0
- package/src/ui/kit.js +1 -0
- package/src/ui/manifest.js +140 -0
- package/types/index.d.ts +1 -1
- package/types/spec/blocks/a2ui.d.ts +4 -0
- package/types/spec/blocks/chart.d.ts +4 -0
- package/types/spec/blocks/code.d.ts +10 -0
- package/types/spec/blocks/diagram.d.ts +15 -0
- package/types/spec/blocks/git-conflict.d.ts +7 -0
- package/types/spec/blocks/image.d.ts +5 -0
- package/types/spec/blocks/index.d.ts +30 -0
- package/types/spec/blocks/markdown.d.ts +5 -0
- package/types/spec/blocks/pdf.d.ts +4 -0
- package/types/spec/blocks/table.d.ts +9 -0
- package/types/spec/blocks/video.d.ts +4 -0
- package/types/spec/blocks/widgets.d.ts +21 -0
- package/types/spec/constants.d.ts +67 -0
- package/types/spec/index.d.ts +4 -0
- package/types/spec/normalize.d.ts +17 -0
- package/types/spec/ready.d.ts +1 -0
- package/types/{spec.d.ts → spec/schema.d.ts} +0 -20
- package/types/spec/sources.d.ts +14 -0
- package/types/ui/manifest.d.ts +62 -0
- package/src/cli.js +0 -1767
- package/src/mcp-ui/board.js +0 -1162
- package/src/spec.js +0 -1224
- package/src/ui/annotate.js +0 -1055
- package/src/ui/app.js +0 -1643
- package/src/ui/blocks.js +0 -3260
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// The browser files of each page, in the order they run. The web board
|
|
2
|
+
// (src/server/page.js) and the MCP App page (src/mcp.js) both assemble their
|
|
3
|
+
// scripts and styles from this list, so a file added here reaches both pages.
|
|
4
|
+
//
|
|
5
|
+
// Browser scripts share one scope per page. A bundle part holds files that read
|
|
6
|
+
// as one script; `open` and `close` wrap them (the IIFE the files sit inside),
|
|
7
|
+
// and parts are joined by a newline. The files never run on their own.
|
|
8
|
+
import path from 'node:path';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
|
|
11
|
+
/** Directory that the file paths below are relative to (the package's src/). */
|
|
12
|
+
export const SRC_DIR = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
13
|
+
|
|
14
|
+
const IIFE_CLOSE = '})();\n';
|
|
15
|
+
|
|
16
|
+
const BLOCKS_OPEN = "// blocks.js — window.RelayBlocks: renders normalized \"blocks\" (markdown,\n// table, code, chart, mermaid, html) into a container. Zero runtime deps;\n// vanilla DOM. Chart.js / Mermaid are vendored and lazy-loaded on demand.\n// XSS-safe: all source text is HTML-escaped before any markdown transform.\n(() => {\n 'use strict';\n\n";
|
|
17
|
+
|
|
18
|
+
const ANNOTATE_OPEN = "/* relay annotate — element-level comments (window.RelayAnnotate).\n Self-contained vanilla JS: hover pin, count badges, comment popover,\n text-selection capture, and an editable summary list. Zero dependencies.\n Load order: blocks.js, annotate.js, app.js (all inlined by the server). */\n(() => {\n 'use strict';\n\n";
|
|
19
|
+
|
|
20
|
+
const APP_OPEN = "(() => {\n 'use strict';\n\n";
|
|
21
|
+
|
|
22
|
+
const BOARD_OPEN = "// board.js — the relay board as an MCP App (SEP-1865 \"io.modelcontextprotocol/ui\").\n//\n// This is the same board relay opens in a browser, but rendered INSIDE the\n// host app (Claude desktop/mobile, Codex, …) as a sandboxed inline iframe.\n// There is no local HTTP server here: every exchange with the host travels over\n// JSON-RPC on window.postMessage — the spec arrives as the tool result, the\n// user's final submission goes back as a `ui/message` user turn, and vendored\n// libraries (Chart.js / Mermaid / Viz.js) are pulled through the host's\n// `resources/read`.\n//\n// Rich blocks are rendered by the SAME window.RelayBlocks as the browser board\n// (markdown, code, diff, table, chart, mermaid, graphviz, image, html), so the\n// two surfaces stay in lockstep. Annotations / autosave / heartbeat are\n// browser-server concepts and intentionally absent; per-question notes and the\n// overall comment carry structured feedback back to the agent.\n(() => {\n 'use strict';\n\n";
|
|
23
|
+
|
|
24
|
+
const plain = (file) => ({ open: '', files: [file], close: '' });
|
|
25
|
+
const iife = (open, files) => ({ open, files, close: IIFE_CLOSE });
|
|
26
|
+
|
|
27
|
+
export const STYLE_PARTS = [plain('ui/style.css')];
|
|
28
|
+
export const BLOCKS_STYLE_PARTS = [plain('ui/blocks.css'), plain('ui/a2ui.css')];
|
|
29
|
+
export const ANNOTATE_STYLE_PARTS = [plain('ui/annotate.css')];
|
|
30
|
+
|
|
31
|
+
export const BLOCKS_SCRIPT_PARTS = [
|
|
32
|
+
plain('ui/a2ui-state.js'),
|
|
33
|
+
plain('ui/a2ui.js'),
|
|
34
|
+
iife(BLOCKS_OPEN, [
|
|
35
|
+
'ui/blocks/core.js',
|
|
36
|
+
'ui/blocks/markdown.js',
|
|
37
|
+
'ui/blocks/code.js',
|
|
38
|
+
'ui/blocks/diff.js',
|
|
39
|
+
'ui/blocks/git-conflict.js',
|
|
40
|
+
'ui/blocks/video.js',
|
|
41
|
+
'ui/blocks/pdf.js',
|
|
42
|
+
'ui/blocks/table.js',
|
|
43
|
+
'ui/blocks/vendor.js',
|
|
44
|
+
'ui/blocks/chart.js',
|
|
45
|
+
'ui/blocks/mermaid.js',
|
|
46
|
+
'ui/blocks/graphviz.js',
|
|
47
|
+
'ui/blocks/plantuml.js',
|
|
48
|
+
'ui/blocks/image.js',
|
|
49
|
+
'ui/blocks/palette.js',
|
|
50
|
+
'ui/blocks/kpi.js',
|
|
51
|
+
'ui/blocks/typography.js',
|
|
52
|
+
'ui/blocks/compare.js',
|
|
53
|
+
'ui/blocks/viewer-fullscreen.js',
|
|
54
|
+
'ui/blocks/viewer.js',
|
|
55
|
+
'ui/blocks/html.js',
|
|
56
|
+
'ui/blocks/dispatch.js',
|
|
57
|
+
'ui/blocks/file-links.js',
|
|
58
|
+
'ui/blocks/api.js',
|
|
59
|
+
]),
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
export const ANNOTATE_SCRIPT_PARTS = [
|
|
63
|
+
iife(ANNOTATE_OPEN, [
|
|
64
|
+
'ui/annotate/core.js',
|
|
65
|
+
'ui/annotate/highlights.js',
|
|
66
|
+
'ui/annotate/chrome.js',
|
|
67
|
+
'ui/annotate/badges.js',
|
|
68
|
+
'ui/annotate/popover.js',
|
|
69
|
+
'ui/annotate/mutations.js',
|
|
70
|
+
'ui/annotate/summary.js',
|
|
71
|
+
'ui/annotate/api.js',
|
|
72
|
+
]),
|
|
73
|
+
];
|
|
74
|
+
|
|
75
|
+
/** The web board's own script. */
|
|
76
|
+
export const APP_SCRIPT_PARTS = [
|
|
77
|
+
iife(APP_OPEN, [
|
|
78
|
+
'ui/app/core.js',
|
|
79
|
+
'ui/app/theme.js',
|
|
80
|
+
'ui/app/drafts.js',
|
|
81
|
+
'ui/app/persistence.js',
|
|
82
|
+
'ui/app/autosave.js',
|
|
83
|
+
'ui/app/presence.js',
|
|
84
|
+
'ui/app/annotations.js',
|
|
85
|
+
'ui/app/questions.js',
|
|
86
|
+
'ui/app/question-color.js',
|
|
87
|
+
'ui/app/render.js',
|
|
88
|
+
'ui/app/share.js',
|
|
89
|
+
'ui/app/submit.js',
|
|
90
|
+
'ui/app/prefilled.js',
|
|
91
|
+
'ui/app/iframe-bridge.js',
|
|
92
|
+
'ui/app/heartbeat.js',
|
|
93
|
+
]),
|
|
94
|
+
];
|
|
95
|
+
|
|
96
|
+
/** The MCP App page's own script. */
|
|
97
|
+
export const BOARD_SCRIPT_PARTS = [
|
|
98
|
+
iife(BOARD_OPEN, [
|
|
99
|
+
'mcp-ui/board/core.js',
|
|
100
|
+
'mcp-ui/board/bridge.js',
|
|
101
|
+
'mcp-ui/board/normalize.js',
|
|
102
|
+
'mcp-ui/board/vendors.js',
|
|
103
|
+
'mcp-ui/board/block-ctx.js',
|
|
104
|
+
'mcp-ui/board/state.js',
|
|
105
|
+
'mcp-ui/board/controls.js',
|
|
106
|
+
'mcp-ui/board/render.js',
|
|
107
|
+
'mcp-ui/board/lifecycle.js',
|
|
108
|
+
]),
|
|
109
|
+
];
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Joins the parts of one bundle into its text.
|
|
113
|
+
* @param {Array<{ open: string, files: string[], close: string }>} parts
|
|
114
|
+
* @param {(file: string) => string} read Returns a file's text relative to SRC_DIR, or '' when it is missing.
|
|
115
|
+
*/
|
|
116
|
+
export function assemble(parts, read) {
|
|
117
|
+
return parts.map((part) => part.open + part.files.map(read).join('') + part.close).join('\n');
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Fills a page template (src/ui/index.html or src/mcp-ui/index.html).
|
|
122
|
+
* `entry` picks the page script: 'app' for the web board, 'board' for the MCP App.
|
|
123
|
+
* The boot JSON is filled last, so inlined text is never rescanned for placeholders.
|
|
124
|
+
* @param {string} html
|
|
125
|
+
* @param {{ title: string, bootJson: string, entry: 'app' | 'board' }} fields `title` must already be HTML-escaped.
|
|
126
|
+
* @param {(file: string) => string} read
|
|
127
|
+
*/
|
|
128
|
+
export function fillPage(html, { title, bootJson, entry }, read) {
|
|
129
|
+
const entryParts = entry === 'app' ? APP_SCRIPT_PARTS : BOARD_SCRIPT_PARTS;
|
|
130
|
+
const entryMarker = entry === 'app' ? '/*__APP_JS__*/' : '/*__BOARD_JS__*/';
|
|
131
|
+
return html
|
|
132
|
+
.split('__TITLE__').join(title)
|
|
133
|
+
.split('/*__CSS__*/').join(assemble(STYLE_PARTS, read))
|
|
134
|
+
.split('/*__BLOCKS_CSS__*/').join(assemble(BLOCKS_STYLE_PARTS, read))
|
|
135
|
+
.split('/*__ANNOTATE_CSS__*/').join(assemble(ANNOTATE_STYLE_PARTS, read))
|
|
136
|
+
.split('/*__BLOCKS_JS__*/').join(assemble(BLOCKS_SCRIPT_PARTS, read))
|
|
137
|
+
.split('/*__ANNOTATE_JS__*/').join(assemble(ANNOTATE_SCRIPT_PARTS, read))
|
|
138
|
+
.split(entryMarker).join(assemble(entryParts, read))
|
|
139
|
+
.split('__BOOT_JSON__').join(bootJson);
|
|
140
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function normalizeCodeBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
|
|
2
|
+
id: any;
|
|
3
|
+
type: string;
|
|
4
|
+
code: any;
|
|
5
|
+
};
|
|
6
|
+
export declare function normalizeDiffBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
|
|
7
|
+
id: any;
|
|
8
|
+
type: string;
|
|
9
|
+
diff: any;
|
|
10
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare function normalizeMermaidBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
|
|
2
|
+
id: any;
|
|
3
|
+
type: string;
|
|
4
|
+
code: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function normalizeGraphvizBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
|
|
7
|
+
id: any;
|
|
8
|
+
type: string;
|
|
9
|
+
dot: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function normalizePlantumlBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
|
|
12
|
+
id: any;
|
|
13
|
+
type: string;
|
|
14
|
+
code: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { normalizeMarkdownBlock } from './markdown.js';
|
|
2
|
+
import { normalizeGraphvizBlock, normalizeMermaidBlock, normalizePlantumlBlock } from './diagram.js';
|
|
3
|
+
import { normalizeCodeBlock, normalizeDiffBlock } from './code.js';
|
|
4
|
+
import { normalizeGitConflictBlock } from './git-conflict.js';
|
|
5
|
+
import { normalizeVideoBlock } from './video.js';
|
|
6
|
+
import { normalizePdfBlock } from './pdf.js';
|
|
7
|
+
import { normalizeChartBlock } from './chart.js';
|
|
8
|
+
import { normalizeTableBlock } from './table.js';
|
|
9
|
+
import { normalizeImageBlock } from './image.js';
|
|
10
|
+
import { normalizeCompareBlock, normalizeKpiBlock, normalizePaletteBlock, normalizeTypographyBlock } from './widgets.js';
|
|
11
|
+
import { normalizeA2uiBlock } from './a2ui.js';
|
|
12
|
+
export declare const BLOCK_NORMALIZERS: {
|
|
13
|
+
markdown: typeof normalizeMarkdownBlock;
|
|
14
|
+
mermaid: typeof normalizeMermaidBlock;
|
|
15
|
+
graphviz: typeof normalizeGraphvizBlock;
|
|
16
|
+
plantuml: typeof normalizePlantumlBlock;
|
|
17
|
+
code: typeof normalizeCodeBlock;
|
|
18
|
+
diff: typeof normalizeDiffBlock;
|
|
19
|
+
'git-conflict': typeof normalizeGitConflictBlock;
|
|
20
|
+
video: typeof normalizeVideoBlock;
|
|
21
|
+
pdf: typeof normalizePdfBlock;
|
|
22
|
+
chart: typeof normalizeChartBlock;
|
|
23
|
+
table: typeof normalizeTableBlock;
|
|
24
|
+
image: typeof normalizeImageBlock;
|
|
25
|
+
kpi: typeof normalizeKpiBlock;
|
|
26
|
+
typography: typeof normalizeTypographyBlock;
|
|
27
|
+
compare: typeof normalizeCompareBlock;
|
|
28
|
+
a2ui: typeof normalizeA2uiBlock;
|
|
29
|
+
palette: typeof normalizePaletteBlock;
|
|
30
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare function normalizeKpiBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
|
|
2
|
+
id: any;
|
|
3
|
+
type: string;
|
|
4
|
+
items: any;
|
|
5
|
+
};
|
|
6
|
+
export declare function normalizeTypographyBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
|
|
7
|
+
id: any;
|
|
8
|
+
type: string;
|
|
9
|
+
specimens: any;
|
|
10
|
+
};
|
|
11
|
+
export declare function normalizeCompareBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
|
|
12
|
+
id: any;
|
|
13
|
+
type: string;
|
|
14
|
+
before: string;
|
|
15
|
+
after: string;
|
|
16
|
+
};
|
|
17
|
+
export declare function normalizePaletteBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
|
|
18
|
+
id: any;
|
|
19
|
+
type: string;
|
|
20
|
+
palettes: any;
|
|
21
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export declare const TYPES: string[];
|
|
2
|
+
export declare const ALIASES: {
|
|
3
|
+
radio: string;
|
|
4
|
+
choice: string;
|
|
5
|
+
select: string;
|
|
6
|
+
checkbox: string;
|
|
7
|
+
checkboxes: string;
|
|
8
|
+
boolean: string;
|
|
9
|
+
bool: string;
|
|
10
|
+
yn: string;
|
|
11
|
+
input: string;
|
|
12
|
+
string: string;
|
|
13
|
+
longtext: string;
|
|
14
|
+
long: string;
|
|
15
|
+
rating: string;
|
|
16
|
+
likert: string;
|
|
17
|
+
colour: string;
|
|
18
|
+
swatch: string;
|
|
19
|
+
ranking: string;
|
|
20
|
+
order: string;
|
|
21
|
+
ordering: string;
|
|
22
|
+
prioritize: string;
|
|
23
|
+
sort: string;
|
|
24
|
+
signoff: string;
|
|
25
|
+
'sign-off': string;
|
|
26
|
+
qa: string;
|
|
27
|
+
allocation: string;
|
|
28
|
+
budget: string;
|
|
29
|
+
distribute: string;
|
|
30
|
+
points: string;
|
|
31
|
+
};
|
|
32
|
+
export declare const HTML_HEIGHT: {
|
|
33
|
+
min: number;
|
|
34
|
+
max: number;
|
|
35
|
+
boardDefault: number;
|
|
36
|
+
questionDefault: number;
|
|
37
|
+
};
|
|
38
|
+
export declare const BLOCK_HEIGHT: {
|
|
39
|
+
min: number;
|
|
40
|
+
max: number;
|
|
41
|
+
};
|
|
42
|
+
export declare const BLOCK_TYPES: string[];
|
|
43
|
+
export declare const CHART_KINDS: string[];
|
|
44
|
+
export declare const TEXT_FILE_MAX_BYTES: number;
|
|
45
|
+
export declare const VIDEO_MIMES: {
|
|
46
|
+
mp4: string;
|
|
47
|
+
m4v: string;
|
|
48
|
+
webm: string;
|
|
49
|
+
ogv: string;
|
|
50
|
+
ogg: string;
|
|
51
|
+
mov: string;
|
|
52
|
+
mkv: string;
|
|
53
|
+
};
|
|
54
|
+
export declare const VIDEO_MAX_BYTES: number;
|
|
55
|
+
export declare const PDF_MIME = "application/pdf";
|
|
56
|
+
export declare const PDF_MAX_BYTES: number;
|
|
57
|
+
export declare const IMAGE_MIMES: {
|
|
58
|
+
png: string;
|
|
59
|
+
jpg: string;
|
|
60
|
+
jpeg: string;
|
|
61
|
+
gif: string;
|
|
62
|
+
webp: string;
|
|
63
|
+
svg: string;
|
|
64
|
+
avif: string;
|
|
65
|
+
bmp: string;
|
|
66
|
+
};
|
|
67
|
+
export declare const IMAGE_MAX_BYTES: number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare function normalizeSpec(raw: any, { cwd }?: {
|
|
2
|
+
cwd?: string;
|
|
3
|
+
}): {
|
|
4
|
+
title: string;
|
|
5
|
+
intro: string;
|
|
6
|
+
blocks: any[];
|
|
7
|
+
allowPartial: boolean;
|
|
8
|
+
note: boolean;
|
|
9
|
+
autoClose: boolean;
|
|
10
|
+
responseRequired: boolean;
|
|
11
|
+
questions: any[];
|
|
12
|
+
submitLabel: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function questionFromInline(s: any, i: any): {
|
|
15
|
+
label: string;
|
|
16
|
+
required: boolean;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function assertSpecReady(spec: any): Promise<any>;
|
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
export declare const TYPES: string[];
|
|
2
|
-
export declare const BLOCK_TYPES: string[];
|
|
3
|
-
export declare function assertSpecReady(spec: any): Promise<any>;
|
|
4
|
-
export declare function normalizeSpec(raw: any, { cwd }?: {
|
|
5
|
-
cwd?: string;
|
|
6
|
-
}): {
|
|
7
|
-
title: string;
|
|
8
|
-
intro: string;
|
|
9
|
-
blocks: any[];
|
|
10
|
-
allowPartial: boolean;
|
|
11
|
-
note: boolean;
|
|
12
|
-
autoClose: boolean;
|
|
13
|
-
responseRequired: boolean;
|
|
14
|
-
questions: any[];
|
|
15
|
-
submitLabel: string;
|
|
16
|
-
};
|
|
17
|
-
export declare function questionFromInline(s: any, i: any): {
|
|
18
|
-
label: string;
|
|
19
|
-
required: boolean;
|
|
20
|
-
};
|
|
21
1
|
export declare const SPEC_SCHEMA: {
|
|
22
2
|
$schema: string;
|
|
23
3
|
title: string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const asStr: (v: any) => string;
|
|
2
|
+
export declare function clampInt(v: any, min: any, max: any, def: any): any;
|
|
3
|
+
export declare function readHtml(obj: any, cwd: any, where: any): any;
|
|
4
|
+
export declare function readBlockHtml(block: any, cwd: any, where: any): any;
|
|
5
|
+
export declare function readTextSource(block: any, inlineKey: any, fileKey: any, cwd: any, where: any): any;
|
|
6
|
+
export declare function readAnyTextSource(block: any, inlineKeys: any, fileKeys: any, cwd: any, where: any, label: any): {
|
|
7
|
+
text: string;
|
|
8
|
+
sourceKey: any;
|
|
9
|
+
file?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
text: any;
|
|
12
|
+
sourceKey: any;
|
|
13
|
+
file: string;
|
|
14
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** Directory that the file paths below are relative to (the package's src/). */
|
|
2
|
+
export declare const SRC_DIR: string;
|
|
3
|
+
export declare const STYLE_PARTS: {
|
|
4
|
+
open: string;
|
|
5
|
+
files: any[];
|
|
6
|
+
close: string;
|
|
7
|
+
}[];
|
|
8
|
+
export declare const BLOCKS_STYLE_PARTS: {
|
|
9
|
+
open: string;
|
|
10
|
+
files: any[];
|
|
11
|
+
close: string;
|
|
12
|
+
}[];
|
|
13
|
+
export declare const ANNOTATE_STYLE_PARTS: {
|
|
14
|
+
open: string;
|
|
15
|
+
files: any[];
|
|
16
|
+
close: string;
|
|
17
|
+
}[];
|
|
18
|
+
export declare const BLOCKS_SCRIPT_PARTS: {
|
|
19
|
+
open: any;
|
|
20
|
+
files: any;
|
|
21
|
+
close: string;
|
|
22
|
+
}[];
|
|
23
|
+
export declare const ANNOTATE_SCRIPT_PARTS: {
|
|
24
|
+
open: any;
|
|
25
|
+
files: any;
|
|
26
|
+
close: string;
|
|
27
|
+
}[];
|
|
28
|
+
/** The web board's own script. */
|
|
29
|
+
export declare const APP_SCRIPT_PARTS: {
|
|
30
|
+
open: any;
|
|
31
|
+
files: any;
|
|
32
|
+
close: string;
|
|
33
|
+
}[];
|
|
34
|
+
/** The MCP App page's own script. */
|
|
35
|
+
export declare const BOARD_SCRIPT_PARTS: {
|
|
36
|
+
open: any;
|
|
37
|
+
files: any;
|
|
38
|
+
close: string;
|
|
39
|
+
}[];
|
|
40
|
+
/**
|
|
41
|
+
* Joins the parts of one bundle into its text.
|
|
42
|
+
* @param {Array<{ open: string, files: string[], close: string }>} parts
|
|
43
|
+
* @param {(file: string) => string} read Returns a file's text relative to SRC_DIR, or '' when it is missing.
|
|
44
|
+
*/
|
|
45
|
+
export declare function assemble(parts: Array<{
|
|
46
|
+
open: string;
|
|
47
|
+
files: string[];
|
|
48
|
+
close: string;
|
|
49
|
+
}>, read: (file: string) => string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Fills a page template (src/ui/index.html or src/mcp-ui/index.html).
|
|
52
|
+
* `entry` picks the page script: 'app' for the web board, 'board' for the MCP App.
|
|
53
|
+
* The boot JSON is filled last, so inlined text is never rescanned for placeholders.
|
|
54
|
+
* @param {string} html
|
|
55
|
+
* @param {{ title: string, bootJson: string, entry: 'app' | 'board' }} fields `title` must already be HTML-escaped.
|
|
56
|
+
* @param {(file: string) => string} read
|
|
57
|
+
*/
|
|
58
|
+
export declare function fillPage(html: string, { title, bootJson, entry }: {
|
|
59
|
+
title: string;
|
|
60
|
+
bootJson: string;
|
|
61
|
+
entry: 'app' | 'board';
|
|
62
|
+
}, read: (file: string) => string): string;
|