@khanglvm/relay 0.18.0 → 0.19.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.
- package/package.json +39 -4
- package/schema/spec.v1.json +1368 -0
- package/src/a2ui/compile.js +2 -0
- package/src/cli.js +1 -0
- package/src/index.js +104 -0
- package/src/link.js +1 -0
- package/src/mcp.js +3 -3
- package/src/server.js +3 -4
- package/src/spec.js +2 -0
- package/types/a2ui/compile.d.ts +40 -0
- package/types/index.d.ts +181 -0
- package/types/mcp.d.ts +31 -0
- package/types/spec.d.ts +1191 -0
- package/types/store.d.ts +29 -0
- package/types/util.d.ts +6 -0
package/src/a2ui/compile.js
CHANGED
|
@@ -210,6 +210,8 @@ function assertTree(byId, where) {
|
|
|
210
210
|
/**
|
|
211
211
|
* Validates a flat surface against Relay's catalog and returns it as plain data.
|
|
212
212
|
* Throws a CliError worded for the agent that wrote it.
|
|
213
|
+
* @param {{ components: any, dataModel?: any }} surface
|
|
214
|
+
* @param {string} [where]
|
|
213
215
|
*/
|
|
214
216
|
export function validateSurface({ components, dataModel }, where = 'a2ui') {
|
|
215
217
|
const catalog = loadCatalog().components;
|
package/src/cli.js
CHANGED
|
@@ -1526,6 +1526,7 @@ function cmdMcpConfig(args, sub) {
|
|
|
1526
1526
|
|
|
1527
1527
|
if (target === 'claude' || target === 'claude-desktop') {
|
|
1528
1528
|
const file = claudeDesktopConfigPath();
|
|
1529
|
+
/** @type {Record<string, any>} */
|
|
1529
1530
|
let existing = {};
|
|
1530
1531
|
try { existing = JSON.parse(fs.readFileSync(file, 'utf8')); } catch { existing = {}; }
|
|
1531
1532
|
if (existing === null || typeof existing !== 'object' || Array.isArray(existing)) existing = {};
|
package/src/index.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Public library entry (`import ... from '@khanglvm/relay'`). It exposes the
|
|
2
|
+
// spec checks and the board store without starting a server or a browser.
|
|
3
|
+
import { compileExpress, validateSurface } from './a2ui/compile.js';
|
|
4
|
+
import { normalizeSpec } from './spec.js';
|
|
5
|
+
import { createBoard as storeBoard } from './store.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A board spec as an agent writes it: `questions`, `blocks`, or both. Run
|
|
9
|
+
* `rly agent` or read schema/spec.v1.json for every field.
|
|
10
|
+
* @typedef {object} RelaySpec
|
|
11
|
+
* @property {1} [version] Spec version; a spec without it is read as version 1.
|
|
12
|
+
* @property {string} [$schema] Schema URL, ignored by Relay.
|
|
13
|
+
* @property {string} [title]
|
|
14
|
+
* @property {string} [intro]
|
|
15
|
+
* @property {Array<Record<string, unknown>>} [blocks] Board-level blocks.
|
|
16
|
+
* @property {Array<Record<string, unknown>>} [questions]
|
|
17
|
+
* @property {boolean} [allowPartial] Let the user submit with unanswered questions.
|
|
18
|
+
* @property {boolean} [note] Show the free-text "Anything else?" box.
|
|
19
|
+
* @property {boolean} [autoClose] Close the browser tab after submit.
|
|
20
|
+
* @property {boolean} [responseRequired] False for a display-only board.
|
|
21
|
+
* @property {string} [submitLabel]
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* A comment the user attached to one element of a block.
|
|
26
|
+
* @typedef {object} Annotation
|
|
27
|
+
* @property {string} id
|
|
28
|
+
* @property {string | null} questionId
|
|
29
|
+
* @property {string | null} blockId
|
|
30
|
+
* @property {{ kind: string } & Record<string, unknown>} target What the comment points at.
|
|
31
|
+
* @property {string} text
|
|
32
|
+
* @property {string} createdAt ISO timestamp.
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* What `rly result` prints once the user submits.
|
|
37
|
+
* @typedef {object} RelayResult
|
|
38
|
+
* @property {Record<string, unknown>} answers Answer per question id.
|
|
39
|
+
* @property {Record<string, string>} [notes] Per-question note text.
|
|
40
|
+
* @property {string} [comment] The "Anything else?" text.
|
|
41
|
+
* @property {string[]} [skipped] Question ids left unanswered.
|
|
42
|
+
* @property {Annotation[]} [annotations]
|
|
43
|
+
* @property {Record<string, unknown> | null} [blockEdits] Edited block payloads by block id.
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A board stored on disk under RLY_HOME (default ~/.relay).
|
|
48
|
+
* @typedef {object} BoardRecord
|
|
49
|
+
* @property {string} id
|
|
50
|
+
* @property {string} createdAt ISO timestamp.
|
|
51
|
+
* @property {string} title
|
|
52
|
+
* @property {string} cwd Directory the board was authored in.
|
|
53
|
+
* @property {Record<string, unknown>} spec The normalized spec.
|
|
54
|
+
* @property {unknown} draft
|
|
55
|
+
* @property {RelayResult | null} result
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A validated A2UI surface: a flat component list plus an optional data model.
|
|
60
|
+
* @typedef {object} A2uiSurface
|
|
61
|
+
* @property {Array<Record<string, unknown>>} components
|
|
62
|
+
* @property {Record<string, unknown>} [dataModel]
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Checks a spec without throwing. Reads the files a spec names (`mdFile`,
|
|
67
|
+
* `rowsFile`) relative to `cwd`. Mermaid syntax and A2UI Express are checked
|
|
68
|
+
* later, when a board opens.
|
|
69
|
+
* @param {unknown} raw
|
|
70
|
+
* @param {{ cwd?: string }} [options]
|
|
71
|
+
* @returns {{ ok: boolean, errors: string[] }}
|
|
72
|
+
*/
|
|
73
|
+
export function validateSpec(raw, options) {
|
|
74
|
+
try {
|
|
75
|
+
normalizeSpec(raw, options);
|
|
76
|
+
return { ok: true, errors: [] };
|
|
77
|
+
} catch (error) {
|
|
78
|
+
return { ok: false, errors: [error instanceof Error ? error.message : String(error)] };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Normalizes a spec and stores it as a new board, the way `rly ask` does
|
|
84
|
+
* before it opens one. Throws when the spec is invalid.
|
|
85
|
+
* @param {unknown} raw
|
|
86
|
+
* @param {{ cwd?: string }} [options]
|
|
87
|
+
* @returns {BoardRecord}
|
|
88
|
+
*/
|
|
89
|
+
export function createBoard(raw, options) {
|
|
90
|
+
return storeBoard(normalizeSpec(raw, options));
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Compiles A2UI Express text, or checks ready components, into a surface that
|
|
95
|
+
* the board draws.
|
|
96
|
+
* @param {string | A2uiSurface} source
|
|
97
|
+
* @returns {Promise<A2uiSurface>}
|
|
98
|
+
*/
|
|
99
|
+
export async function compileA2ui(source) {
|
|
100
|
+
const surface = typeof source === 'string' ? await compileExpress(source) : source;
|
|
101
|
+
return validateSurface(surface);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export { normalizeSpec };
|
package/src/link.js
CHANGED
|
@@ -35,6 +35,7 @@ export function parseLinkValue(raw, where = 'link') {
|
|
|
35
35
|
/**
|
|
36
36
|
* Picks the link setting. Highest first: --no-devlink, --devlink, --public-url,
|
|
37
37
|
* RLY_PUBLIC_URL, RLY_LINK, the saved config, then off.
|
|
38
|
+
* @param {{ args?: Record<string, any>, env?: Record<string, string | undefined>, config?: Record<string, any> }} [input]
|
|
38
39
|
*/
|
|
39
40
|
export function linkSetting({ args = {}, env = process.env, config = {} } = {}) {
|
|
40
41
|
if (args.noDevlink === true) return { mode: 'off' };
|
package/src/mcp.js
CHANGED
|
@@ -174,7 +174,7 @@ async function buildResult(method, params, clientProtocol) {
|
|
|
174
174
|
case 'tools/call':
|
|
175
175
|
return callTool(params);
|
|
176
176
|
default: {
|
|
177
|
-
const err = new Error('method not found: ' + method);
|
|
177
|
+
const err = /** @type {Error & { code?: number }} */ (new Error('method not found: ' + method));
|
|
178
178
|
err.code = -32601;
|
|
179
179
|
throw err;
|
|
180
180
|
}
|
|
@@ -189,10 +189,10 @@ function readResource(params) {
|
|
|
189
189
|
if (typeof uri === 'string' && uri.startsWith(VENDOR_PREFIX)) {
|
|
190
190
|
const name = uri.slice(VENDOR_PREFIX.length);
|
|
191
191
|
const text = vendorText(name);
|
|
192
|
-
if (text == null) { const e = new Error('vendor not found: ' + name); e.code = -32002; throw e; }
|
|
192
|
+
if (text == null) { const e = /** @type {Error & { code?: number }} */ (new Error('vendor not found: ' + name)); e.code = -32002; throw e; }
|
|
193
193
|
return { contents: [{ uri, mimeType: 'application/javascript', text }] };
|
|
194
194
|
}
|
|
195
|
-
const e = new Error('resource not found: ' + uri);
|
|
195
|
+
const e = /** @type {Error & { code?: number }} */ (new Error('resource not found: ' + uri));
|
|
196
196
|
e.code = -32002;
|
|
197
197
|
throw e;
|
|
198
198
|
}
|
package/src/server.js
CHANGED
|
@@ -316,8 +316,7 @@ function sanitizeAnnotationTarget(value, boardId) {
|
|
|
316
316
|
if (clean.x + clean.w > 1) clean.w = 1 - clean.x;
|
|
317
317
|
if (clean.y + clean.h > 1) clean.h = 1 - clean.y;
|
|
318
318
|
clean.label = limitString(clean.label, 200);
|
|
319
|
-
if (clean.side
|
|
320
|
-
else delete clean.side;
|
|
319
|
+
if (clean.side !== 'before' && clean.side !== 'after') delete clean.side;
|
|
321
320
|
const crop = sanitizeAnnotationCrop(clean.crop, boardId);
|
|
322
321
|
if (crop) clean.crop = crop;
|
|
323
322
|
else delete clean.crop;
|
|
@@ -1279,7 +1278,7 @@ export async function runBoard({ id, port = 0, open = true, timeoutSec = 86400,
|
|
|
1279
1278
|
// listening socket through a short close grace, so a stop-then-reopen on the
|
|
1280
1279
|
// same port can briefly hit EADDRINUSE — retry for ~2s to ride that out before
|
|
1281
1280
|
// giving up. Only then fall back to a random free port rather than failing.
|
|
1282
|
-
await new Promise((resolve, reject) => {
|
|
1281
|
+
await new Promise((/** @type {(value?: unknown) => void} */ resolve, reject) => {
|
|
1283
1282
|
const RETRY_MS = 200;
|
|
1284
1283
|
const MAX_RETRIES = 10; // ~2s — covers a prior server's ~600ms close grace
|
|
1285
1284
|
let retries = 0;
|
|
@@ -1303,7 +1302,7 @@ export async function runBoard({ id, port = 0, open = true, timeoutSec = 86400,
|
|
|
1303
1302
|
};
|
|
1304
1303
|
bind(port, true);
|
|
1305
1304
|
});
|
|
1306
|
-
actualPort = server.address().port;
|
|
1305
|
+
actualPort = /** @type {import('node:net').AddressInfo} */ (server.address()).port;
|
|
1307
1306
|
const localUrl = `http://127.0.0.1:${actualPort}/`;
|
|
1308
1307
|
url = localUrl;
|
|
1309
1308
|
try {
|
package/src/spec.js
CHANGED
|
@@ -1145,6 +1145,8 @@ export const SPEC_SCHEMA = {
|
|
|
1145
1145
|
description:
|
|
1146
1146
|
'A relay board. Renders an optional intro, board-level blocks, then questions (each with optional per-question blocks), then a submit button. The result JSON contains "answers", "comment", per-question "notes", "annotations" (element-level comments the user attached to any block — see the annotation shape below), and "blockEdits" (a map blockId→edited source for any editable mermaid block the user changed, null when none).',
|
|
1147
1147
|
properties: {
|
|
1148
|
+
version: { const: 1, description: 'Spec version. Optional: a spec without it is read as version 1.' },
|
|
1149
|
+
$schema: { type: 'string', description: 'Optional URL of this schema, for editor completion. Relay ignores it.' },
|
|
1148
1150
|
title: { type: 'string', description: 'Board title (default "Relay")' },
|
|
1149
1151
|
intro: { type: 'string', description: 'Intro text shown under the title. Newlines preserved.' },
|
|
1150
1152
|
blocks: BLOCK_SCHEMA,
|
|
@@ -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>;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { normalizeSpec } from './spec.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
|
+
};
|