@khanglvm/relay 0.18.0 → 0.20.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 (138) hide show
  1. package/bin/rly.js +1 -1
  2. package/package.json +39 -4
  3. package/schema/spec.v1.json +1368 -0
  4. package/src/a2ui/compile.js +2 -0
  5. package/src/cli/args.js +46 -0
  6. package/src/cli/ask.js +12 -0
  7. package/src/cli/boards.js +326 -0
  8. package/src/cli/config.js +56 -0
  9. package/src/cli/context.js +13 -0
  10. package/src/cli/git.js +183 -0
  11. package/src/cli/help.js +90 -0
  12. package/src/cli/index.js +103 -0
  13. package/src/cli/install.js +197 -0
  14. package/src/cli/io.js +186 -0
  15. package/src/cli/mcp.js +94 -0
  16. package/src/cli/share.js +45 -0
  17. package/src/cli/skill.js +192 -0
  18. package/src/cli/upgrade.js +130 -0
  19. package/src/cli/wait.js +172 -0
  20. package/src/file-preview.js +1 -1
  21. package/src/index.js +104 -0
  22. package/src/link.js +1 -0
  23. package/src/mcp-ui/board/block-ctx.js +43 -0
  24. package/src/mcp-ui/board/bridge.js +165 -0
  25. package/src/mcp-ui/board/controls.js +310 -0
  26. package/src/mcp-ui/board/core.js +20 -0
  27. package/src/mcp-ui/board/lifecycle.js +118 -0
  28. package/src/mcp-ui/board/normalize.js +95 -0
  29. package/src/mcp-ui/board/render.js +200 -0
  30. package/src/mcp-ui/board/state.js +106 -0
  31. package/src/mcp-ui/board/vendors.js +86 -0
  32. package/src/mcp.js +15 -21
  33. package/src/{server.js → server/board.js} +17 -781
  34. package/src/server/files.js +141 -0
  35. package/src/server/http.js +114 -0
  36. package/src/server/index.js +2 -0
  37. package/src/server/page.js +183 -0
  38. package/src/server/paths.js +7 -0
  39. package/src/server/result.js +58 -0
  40. package/src/server/reviews.js +41 -0
  41. package/src/server/sanitize.js +231 -0
  42. package/src/spec/blocks/a2ui.js +25 -0
  43. package/src/spec/blocks/chart.js +49 -0
  44. package/src/spec/blocks/code.js +38 -0
  45. package/src/spec/blocks/diagram.js +39 -0
  46. package/src/spec/blocks/git-conflict.js +106 -0
  47. package/src/spec/blocks/image.js +32 -0
  48. package/src/spec/blocks/index.js +33 -0
  49. package/src/spec/blocks/markdown.js +13 -0
  50. package/src/spec/blocks/pdf.js +38 -0
  51. package/src/spec/blocks/table.js +122 -0
  52. package/src/spec/blocks/video.js +68 -0
  53. package/src/spec/blocks/widgets.js +98 -0
  54. package/src/spec/constants.js +65 -0
  55. package/src/spec/index.js +5 -0
  56. package/src/spec/normalize.js +285 -0
  57. package/src/spec/ready.js +106 -0
  58. package/src/spec/schema.js +182 -0
  59. package/src/spec/sources.js +83 -0
  60. package/src/ui/annotate/api.js +149 -0
  61. package/src/ui/annotate/badges.js +77 -0
  62. package/src/ui/annotate/chrome.js +158 -0
  63. package/src/ui/annotate/core.js +134 -0
  64. package/src/ui/annotate/highlights.js +129 -0
  65. package/src/ui/annotate/mutations.js +127 -0
  66. package/src/ui/annotate/popover.js +206 -0
  67. package/src/ui/annotate/summary.js +67 -0
  68. package/src/ui/app/annotations.js +88 -0
  69. package/src/ui/app/autosave.js +44 -0
  70. package/src/ui/app/core.js +74 -0
  71. package/src/ui/app/drafts.js +201 -0
  72. package/src/ui/app/heartbeat.js +150 -0
  73. package/src/ui/app/iframe-bridge.js +64 -0
  74. package/src/ui/app/persistence.js +117 -0
  75. package/src/ui/app/prefilled.js +21 -0
  76. package/src/ui/app/presence.js +38 -0
  77. package/src/ui/app/question-color.js +67 -0
  78. package/src/ui/app/questions.js +360 -0
  79. package/src/ui/app/render.js +135 -0
  80. package/src/ui/app/share.js +108 -0
  81. package/src/ui/app/submit.js +109 -0
  82. package/src/ui/app/theme.js +63 -0
  83. package/src/ui/blocks/api.js +1 -0
  84. package/src/ui/blocks/chart.js +222 -0
  85. package/src/ui/blocks/code.js +138 -0
  86. package/src/ui/blocks/compare.js +82 -0
  87. package/src/ui/blocks/core.js +74 -0
  88. package/src/ui/blocks/diff.js +361 -0
  89. package/src/ui/blocks/dispatch.js +111 -0
  90. package/src/ui/blocks/file-links.js +180 -0
  91. package/src/ui/blocks/git-conflict.js +151 -0
  92. package/src/ui/blocks/graphviz.js +57 -0
  93. package/src/ui/blocks/html.js +45 -0
  94. package/src/ui/blocks/image.js +371 -0
  95. package/src/ui/blocks/kpi.js +26 -0
  96. package/src/ui/blocks/markdown.js +223 -0
  97. package/src/ui/blocks/mermaid.js +242 -0
  98. package/src/ui/blocks/palette.js +59 -0
  99. package/src/ui/blocks/pdf.js +21 -0
  100. package/src/ui/blocks/plantuml.js +152 -0
  101. package/src/ui/blocks/table.js +155 -0
  102. package/src/ui/blocks/typography.js +25 -0
  103. package/src/ui/blocks/vendor.js +43 -0
  104. package/src/ui/blocks/video.js +43 -0
  105. package/src/ui/blocks/viewer-fullscreen.js +146 -0
  106. package/src/ui/blocks/viewer.js +324 -0
  107. package/src/ui/kit.js +1 -0
  108. package/src/ui/manifest.js +140 -0
  109. package/types/a2ui/compile.d.ts +40 -0
  110. package/types/index.d.ts +181 -0
  111. package/types/mcp.d.ts +31 -0
  112. package/types/spec/blocks/a2ui.d.ts +4 -0
  113. package/types/spec/blocks/chart.d.ts +4 -0
  114. package/types/spec/blocks/code.d.ts +10 -0
  115. package/types/spec/blocks/diagram.d.ts +15 -0
  116. package/types/spec/blocks/git-conflict.d.ts +7 -0
  117. package/types/spec/blocks/image.d.ts +5 -0
  118. package/types/spec/blocks/index.d.ts +30 -0
  119. package/types/spec/blocks/markdown.d.ts +5 -0
  120. package/types/spec/blocks/pdf.d.ts +4 -0
  121. package/types/spec/blocks/table.d.ts +9 -0
  122. package/types/spec/blocks/video.d.ts +4 -0
  123. package/types/spec/blocks/widgets.d.ts +21 -0
  124. package/types/spec/constants.d.ts +67 -0
  125. package/types/spec/index.d.ts +4 -0
  126. package/types/spec/normalize.d.ts +17 -0
  127. package/types/spec/ready.d.ts +1 -0
  128. package/types/spec/schema.d.ts +1171 -0
  129. package/types/spec/sources.d.ts +14 -0
  130. package/types/store.d.ts +29 -0
  131. package/types/ui/manifest.d.ts +62 -0
  132. package/types/util.d.ts +6 -0
  133. package/src/cli.js +0 -1766
  134. package/src/mcp-ui/board.js +0 -1162
  135. package/src/spec.js +0 -1222
  136. package/src/ui/annotate.js +0 -1055
  137. package/src/ui/app.js +0 -1643
  138. 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
+ }
@@ -0,0 +1,40 @@
1
+ export declare const CATALOG_FILE: string;
2
+ export declare const A2UI_LIMITS: {
3
+ expressChars: number;
4
+ components: number;
5
+ componentsBytes: number;
6
+ dataBytes: number;
7
+ depth: number;
8
+ eventContextBytes: number;
9
+ };
10
+ /** Relay's catalog: component name -> JSON-schema-style definition. */
11
+ export declare function loadCatalog(): any;
12
+ /** Refuses prototype-polluting keys anywhere in a JSON-like value, and runaway nesting. */
13
+ export declare function assertSafeJson(value: any, where: any, depth?: number): void;
14
+ /** Size and path checks that run before the SDK sees the text. */
15
+ export declare function guardExpress(text: any, where: any): string;
16
+ /** Agents paste the block with or without its `<a2ui>` tags, and sometimes inside a Markdown fence. */
17
+ export declare function wrapExpress(source: any): any;
18
+ /** Compiles one Express block into flat components (root first) and the data model its `$/path = value` lines set. */
19
+ export declare function compileExpress(source: any, where?: string): Promise<{
20
+ components: any;
21
+ dataModel?: any;
22
+ }>;
23
+ /**
24
+ * Validates a flat surface against Relay's catalog and returns it as plain data.
25
+ * Throws a CliError worded for the agent that wrote it.
26
+ * @param {{ components: any, dataModel?: any }} surface
27
+ * @param {string} [where]
28
+ */
29
+ export declare function validateSurface({ components, dataModel }: {
30
+ components: any;
31
+ dataModel?: any;
32
+ }, where?: string): {
33
+ components: any[];
34
+ dataModel?: any;
35
+ };
36
+ /**
37
+ * Compiles a block's `express` in place into `components` and `dataModel`, then
38
+ * validates the result. Blocks that already hold components are left alone.
39
+ */
40
+ export declare function resolveA2uiBlock(block: any, where?: string): Promise<any>;
@@ -0,0 +1,181 @@
1
+ import { normalizeSpec } from './spec/index.js';
2
+ export type RelaySpec = {
3
+ /**
4
+ * Spec version; a spec without it is read as version 1.
5
+ */
6
+ version?: 1;
7
+ /**
8
+ * Schema URL, ignored by Relay.
9
+ */
10
+ $schema?: string;
11
+ title?: string;
12
+ intro?: string;
13
+ /**
14
+ * Board-level blocks.
15
+ */
16
+ blocks?: Array<Record<string, unknown>>;
17
+ questions?: Array<Record<string, unknown>>;
18
+ /**
19
+ * Let the user submit with unanswered questions.
20
+ */
21
+ allowPartial?: boolean;
22
+ /**
23
+ * Show the free-text "Anything else?" box.
24
+ */
25
+ note?: boolean;
26
+ /**
27
+ * Close the browser tab after submit.
28
+ */
29
+ autoClose?: boolean;
30
+ /**
31
+ * False for a display-only board.
32
+ */
33
+ responseRequired?: boolean;
34
+ submitLabel?: string;
35
+ };
36
+ export type Annotation = {
37
+ id: string;
38
+ questionId: string | null;
39
+ blockId: string | null;
40
+ /**
41
+ * What the comment points at.
42
+ */
43
+ target: {
44
+ kind: string;
45
+ } & Record<string, unknown>;
46
+ text: string;
47
+ /**
48
+ * ISO timestamp.
49
+ */
50
+ createdAt: string;
51
+ };
52
+ export type RelayResult = {
53
+ /**
54
+ * Answer per question id.
55
+ */
56
+ answers: Record<string, unknown>;
57
+ /**
58
+ * Per-question note text.
59
+ */
60
+ notes?: Record<string, string>;
61
+ /**
62
+ * The "Anything else?" text.
63
+ */
64
+ comment?: string;
65
+ /**
66
+ * Question ids left unanswered.
67
+ */
68
+ skipped?: string[];
69
+ annotations?: Annotation[];
70
+ /**
71
+ * Edited block payloads by block id.
72
+ */
73
+ blockEdits?: Record<string, unknown> | null;
74
+ };
75
+ export type BoardRecord = {
76
+ id: string;
77
+ /**
78
+ * ISO timestamp.
79
+ */
80
+ createdAt: string;
81
+ title: string;
82
+ /**
83
+ * Directory the board was authored in.
84
+ */
85
+ cwd: string;
86
+ /**
87
+ * The normalized spec.
88
+ */
89
+ spec: Record<string, unknown>;
90
+ draft: unknown;
91
+ result: RelayResult | null;
92
+ };
93
+ export type A2uiSurface = {
94
+ components: Array<Record<string, unknown>>;
95
+ dataModel?: Record<string, unknown>;
96
+ };
97
+ /**
98
+ * A board spec as an agent writes it: `questions`, `blocks`, or both. Run
99
+ * `rly agent` or read schema/spec.v1.json for every field.
100
+ * @typedef {object} RelaySpec
101
+ * @property {1} [version] Spec version; a spec without it is read as version 1.
102
+ * @property {string} [$schema] Schema URL, ignored by Relay.
103
+ * @property {string} [title]
104
+ * @property {string} [intro]
105
+ * @property {Array<Record<string, unknown>>} [blocks] Board-level blocks.
106
+ * @property {Array<Record<string, unknown>>} [questions]
107
+ * @property {boolean} [allowPartial] Let the user submit with unanswered questions.
108
+ * @property {boolean} [note] Show the free-text "Anything else?" box.
109
+ * @property {boolean} [autoClose] Close the browser tab after submit.
110
+ * @property {boolean} [responseRequired] False for a display-only board.
111
+ * @property {string} [submitLabel]
112
+ */
113
+ /**
114
+ * A comment the user attached to one element of a block.
115
+ * @typedef {object} Annotation
116
+ * @property {string} id
117
+ * @property {string | null} questionId
118
+ * @property {string | null} blockId
119
+ * @property {{ kind: string } & Record<string, unknown>} target What the comment points at.
120
+ * @property {string} text
121
+ * @property {string} createdAt ISO timestamp.
122
+ */
123
+ /**
124
+ * What `rly result` prints once the user submits.
125
+ * @typedef {object} RelayResult
126
+ * @property {Record<string, unknown>} answers Answer per question id.
127
+ * @property {Record<string, string>} [notes] Per-question note text.
128
+ * @property {string} [comment] The "Anything else?" text.
129
+ * @property {string[]} [skipped] Question ids left unanswered.
130
+ * @property {Annotation[]} [annotations]
131
+ * @property {Record<string, unknown> | null} [blockEdits] Edited block payloads by block id.
132
+ */
133
+ /**
134
+ * A board stored on disk under RLY_HOME (default ~/.relay).
135
+ * @typedef {object} BoardRecord
136
+ * @property {string} id
137
+ * @property {string} createdAt ISO timestamp.
138
+ * @property {string} title
139
+ * @property {string} cwd Directory the board was authored in.
140
+ * @property {Record<string, unknown>} spec The normalized spec.
141
+ * @property {unknown} draft
142
+ * @property {RelayResult | null} result
143
+ */
144
+ /**
145
+ * A validated A2UI surface: a flat component list plus an optional data model.
146
+ * @typedef {object} A2uiSurface
147
+ * @property {Array<Record<string, unknown>>} components
148
+ * @property {Record<string, unknown>} [dataModel]
149
+ */
150
+ /**
151
+ * Checks a spec without throwing. Reads the files a spec names (`mdFile`,
152
+ * `rowsFile`) relative to `cwd`. Mermaid syntax and A2UI Express are checked
153
+ * later, when a board opens.
154
+ * @param {unknown} raw
155
+ * @param {{ cwd?: string }} [options]
156
+ * @returns {{ ok: boolean, errors: string[] }}
157
+ */
158
+ export declare function validateSpec(raw: unknown, options?: {
159
+ cwd?: string;
160
+ }): {
161
+ ok: boolean;
162
+ errors: string[];
163
+ };
164
+ /**
165
+ * Normalizes a spec and stores it as a new board, the way `rly ask` does
166
+ * before it opens one. Throws when the spec is invalid.
167
+ * @param {unknown} raw
168
+ * @param {{ cwd?: string }} [options]
169
+ * @returns {BoardRecord}
170
+ */
171
+ export declare function createBoard(raw: unknown, options?: {
172
+ cwd?: string;
173
+ }): BoardRecord;
174
+ /**
175
+ * Compiles A2UI Express text, or checks ready components, into a surface that
176
+ * the board draws.
177
+ * @param {string | A2uiSurface} source
178
+ * @returns {Promise<A2uiSurface>}
179
+ */
180
+ export declare function compileA2ui(source: string | A2uiSurface): Promise<A2uiSurface>;
181
+ export { normalizeSpec };
package/types/mcp.d.ts ADDED
@@ -0,0 +1,31 @@
1
+ export declare function runMcp(): Promise<any>;
2
+ export declare function runMcpHttp({ port, host, token, allowOrigin }?: {
3
+ allowOrigin?: string;
4
+ host?: string;
5
+ port?: number;
6
+ token?: string;
7
+ }): Promise<any>;
8
+ export declare function mcpConfig({ command, httpPort }?: {
9
+ command?: string;
10
+ httpPort?: number;
11
+ }): {
12
+ command: string;
13
+ args: string[];
14
+ httpPort: number;
15
+ httpUrl: string;
16
+ json: {
17
+ mcpServers: {
18
+ relay: {
19
+ command: string;
20
+ args: string[];
21
+ };
22
+ };
23
+ };
24
+ toml: string;
25
+ http: {
26
+ run: string;
27
+ url: string;
28
+ deploy: string;
29
+ note: string;
30
+ };
31
+ };
@@ -0,0 +1,4 @@
1
+ export declare function normalizeA2uiBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
2
+ id: any;
3
+ type: string;
4
+ };
@@ -0,0 +1,4 @@
1
+ export declare function normalizeChartBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
2
+ id: any;
3
+ type: string;
4
+ };
@@ -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,7 @@
1
+ export declare function normalizeGitConflictBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
2
+ id: any;
3
+ type: string;
4
+ filename: string;
5
+ conflicts: any[];
6
+ parts: any[];
7
+ };
@@ -0,0 +1,5 @@
1
+ export declare function resolveImageSrc(srcRaw: any, cwd: any, where: any, field: any): string;
2
+ export declare function normalizeImageBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
3
+ id: any;
4
+ type: string;
5
+ };
@@ -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,5 @@
1
+ export declare function normalizeMarkdownBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
2
+ id: any;
3
+ type: string;
4
+ md: any;
5
+ };
@@ -0,0 +1,4 @@
1
+ export declare function normalizePdfBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
2
+ id: any;
3
+ type: string;
4
+ };
@@ -0,0 +1,9 @@
1
+ export declare function normalizeTableBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
2
+ id: any;
3
+ type: string;
4
+ columns: {
5
+ key: string;
6
+ label: string;
7
+ }[];
8
+ rows: any[];
9
+ };
@@ -0,0 +1,4 @@
1
+ export declare function normalizeVideoBlock(rawBlock: any, id: any, cwd: any, where: any, hasHeight: any): {
2
+ id: any;
3
+ type: string;
4
+ };
@@ -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,4 @@
1
+ export { TYPES, BLOCK_TYPES } from './constants.js';
2
+ export { assertSpecReady } from './ready.js';
3
+ export { normalizeSpec, questionFromInline } from './normalize.js';
4
+ export { SPEC_SCHEMA } from './schema.js';
@@ -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>;