recordful-mcp 0.4.0 → 0.6.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/CHANGELOG.md +77 -53
- package/LICENSE +21 -21
- package/README.md +177 -171
- package/SECURITY.md +36 -36
- package/dist/args.js +1 -1
- package/dist/args.js.map +1 -1
- package/dist/cli.js +169 -33
- package/dist/cli.js.map +1 -1
- package/dist/core/createRecordfulServer.d.ts +11 -0
- package/dist/core/createRecordfulServer.js +207 -0
- package/dist/core/createRecordfulServer.js.map +1 -0
- package/dist/core/libraryTools.d.ts +6 -0
- package/dist/core/libraryTools.js +61 -0
- package/dist/core/libraryTools.js.map +1 -0
- package/dist/core/transport.d.ts +18 -0
- package/dist/core/transport.js +10 -0
- package/dist/core/transport.js.map +1 -0
- package/dist/core/videoTools.js.map +1 -0
- package/dist/guide.d.ts +33 -0
- package/dist/guide.js +94 -0
- package/dist/guide.js.map +1 -0
- package/dist/install.d.ts +25 -0
- package/dist/install.js +179 -0
- package/dist/install.js.map +1 -0
- package/dist/mcp/createMcpServer.d.ts +2 -2
- package/dist/mcp/createMcpServer.js +51 -257
- package/dist/mcp/createMcpServer.js.map +1 -1
- package/dist/mcp/localTransport.d.ts +3 -0
- package/dist/mcp/localTransport.js +26 -0
- package/dist/mcp/localTransport.js.map +1 -0
- package/dist/protocol/errors.d.ts +2 -0
- package/dist/protocol/errors.js +2 -0
- package/dist/protocol/errors.js.map +1 -1
- package/dist/protocol/methods.d.ts +9 -0
- package/dist/protocol/methods.js +10 -0
- package/dist/protocol/methods.js.map +1 -1
- package/dist/protocol/video.d.ts +33 -0
- package/dist/protocol/video.js +30 -0
- package/dist/protocol/video.js.map +1 -1
- package/dist/setupGuide.js +44 -44
- package/dist/setupPrompt.d.ts +1 -0
- package/dist/setupPrompt.js +33 -0
- package/dist/setupPrompt.js.map +1 -0
- package/dist/skill.d.ts +1 -0
- package/dist/skill.js +4 -0
- package/dist/skill.js.map +1 -0
- package/package.json +64 -64
- package/dist/mcp/videoTools.js.map +0 -1
- /package/dist/{mcp → core}/videoTools.d.ts +0 -0
- /package/dist/{mcp → core}/videoTools.js +0 -0
package/dist/install.js
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// `recordful-mcp install --target <app>`: writes the Recordful MCP entry (and,
|
|
2
|
+
// where the app has skills, the Recordful skill) into one AI app's own
|
|
3
|
+
// configuration. It merges, never replaces: other servers and settings stay as
|
|
4
|
+
// they are, and a file it can't parse is left alone with the entry to add by hand.
|
|
5
|
+
import { spawnSync } from "node:child_process";
|
|
6
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { homedir, platform } from "node:os";
|
|
8
|
+
import { dirname, join } from "node:path";
|
|
9
|
+
import { SKILL_TEXT } from "./skill.js";
|
|
10
|
+
export const TARGETS = ["claude", "cursor", "codex", "opencode", "vscode", "windsurf", "gemini"];
|
|
11
|
+
export const COMPONENTS = ["all", "mcp", "skill"];
|
|
12
|
+
export const TARGET_NAMES = {
|
|
13
|
+
claude: "Claude Code",
|
|
14
|
+
cursor: "Cursor",
|
|
15
|
+
codex: "Codex",
|
|
16
|
+
opencode: "opencode",
|
|
17
|
+
vscode: "VS Code",
|
|
18
|
+
windsurf: "Windsurf",
|
|
19
|
+
gemini: "Gemini CLI",
|
|
20
|
+
};
|
|
21
|
+
const SERVER = "recordful";
|
|
22
|
+
const NPX_ARGS = ["-y", "recordful-mcp"];
|
|
23
|
+
// RECORDFUL_INSTALL_HOME exists for tests; nobody needs it otherwise.
|
|
24
|
+
const home = () => process.env.RECORDFUL_INSTALL_HOME || homedir();
|
|
25
|
+
const isWindows = () => platform() === "win32";
|
|
26
|
+
const readText = (path) => (existsSync(path) ? readFileSync(path, "utf8") : null);
|
|
27
|
+
const writeText = (path, text) => {
|
|
28
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
29
|
+
writeFileSync(path, text);
|
|
30
|
+
};
|
|
31
|
+
const sameJson = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
32
|
+
// Merges `entry` under `section.recordful` in a JSON config file.
|
|
33
|
+
const mergeJson = (path, section, entry, apply) => {
|
|
34
|
+
const wanted = { [section]: { [SERVER]: entry } };
|
|
35
|
+
const manual = (why) => ({
|
|
36
|
+
component: "mcp",
|
|
37
|
+
action: "manual",
|
|
38
|
+
path,
|
|
39
|
+
detail: `${why} Add this to ${path} yourself:\n${JSON.stringify(wanted, null, 2)}`,
|
|
40
|
+
});
|
|
41
|
+
const text = readText(path);
|
|
42
|
+
let doc = {};
|
|
43
|
+
if (text !== null && text.trim() !== "") {
|
|
44
|
+
try {
|
|
45
|
+
const parsed = JSON.parse(text);
|
|
46
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
|
|
47
|
+
return manual("The file isn't a JSON object.");
|
|
48
|
+
doc = parsed;
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return manual("Couldn't read the file as plain JSON (comments?), so it was left alone.");
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const current = doc[section];
|
|
55
|
+
if (current !== undefined && (typeof current !== "object" || current === null || Array.isArray(current))) {
|
|
56
|
+
return manual(`"${section}" in the file isn't an object.`);
|
|
57
|
+
}
|
|
58
|
+
const servers = (current ?? {});
|
|
59
|
+
if (sameJson(servers[SERVER], entry))
|
|
60
|
+
return { component: "mcp", action: "unchanged", path };
|
|
61
|
+
const action = servers[SERVER] === undefined && text === null ? "create" : "update";
|
|
62
|
+
if (apply)
|
|
63
|
+
writeText(path, `${JSON.stringify({ ...doc, [section]: { ...servers, [SERVER]: entry } }, null, 2)}\n`);
|
|
64
|
+
return { component: "mcp", action, path };
|
|
65
|
+
};
|
|
66
|
+
const codexToml = () => {
|
|
67
|
+
const command = isWindows() ? "cmd" : "npx";
|
|
68
|
+
const args = isWindows() ? ["/c", "npx", ...NPX_ARGS] : NPX_ARGS;
|
|
69
|
+
return `[mcp_servers.${SERVER}]\ncommand = ${JSON.stringify(command)}\nargs = [${args.map((a) => JSON.stringify(a)).join(", ")}]\n`;
|
|
70
|
+
};
|
|
71
|
+
const mergeCodex = (apply) => {
|
|
72
|
+
const path = join(home(), ".codex", "config.toml");
|
|
73
|
+
const text = readText(path);
|
|
74
|
+
if (text !== null && new RegExp(`^\\s*\\[mcp_servers\\.${SERVER}\\]`, "m").test(text))
|
|
75
|
+
return { component: "mcp", action: "unchanged", path };
|
|
76
|
+
if (apply)
|
|
77
|
+
writeText(path, `${text === null || text.trim() === "" ? "" : `${text.replace(/\s*$/, "")}\n\n`}${codexToml()}`);
|
|
78
|
+
return { component: "mcp", action: text === null ? "create" : "update", path };
|
|
79
|
+
};
|
|
80
|
+
const claudeAddArgs = () => [
|
|
81
|
+
"mcp",
|
|
82
|
+
"add",
|
|
83
|
+
"--scope",
|
|
84
|
+
"user",
|
|
85
|
+
SERVER,
|
|
86
|
+
"--",
|
|
87
|
+
...(isWindows() ? ["cmd", "/c", "npx"] : ["npx"]),
|
|
88
|
+
...NPX_ARGS,
|
|
89
|
+
];
|
|
90
|
+
// On Windows claude is a .cmd shim, which only runs through a shell; the arguments are fixed words, so one command line is safe.
|
|
91
|
+
const runClaude = (args) => isWindows()
|
|
92
|
+
? spawnSync(["claude", ...args].join(" "), { encoding: "utf8", shell: true, timeout: 60_000 })
|
|
93
|
+
: spawnSync("claude", args, { encoding: "utf8", timeout: 60_000 });
|
|
94
|
+
const mergeClaude = (apply) => {
|
|
95
|
+
const args = claudeAddArgs();
|
|
96
|
+
const text = `claude ${args.join(" ")}`;
|
|
97
|
+
const have = runClaude(["mcp", "get", SERVER]);
|
|
98
|
+
// 127 / 9009 are "command not found" from the shell on Linux/macOS and cmd.exe.
|
|
99
|
+
if (have.error || have.status === null || have.status === 127 || have.status === 9009) {
|
|
100
|
+
return { component: "mcp", action: "manual", command: text, detail: `The claude command isn't on PATH. Run this yourself: ${text}` };
|
|
101
|
+
}
|
|
102
|
+
if (have.status === 0)
|
|
103
|
+
return { component: "mcp", action: "unchanged", command: `claude mcp get ${SERVER}` };
|
|
104
|
+
if (!apply)
|
|
105
|
+
return { component: "mcp", action: "run", command: text };
|
|
106
|
+
const added = runClaude(args);
|
|
107
|
+
if (added.status !== 0) {
|
|
108
|
+
const why = (added.stderr || added.stdout || "").trim().slice(0, 200);
|
|
109
|
+
return { component: "mcp", action: "manual", command: text, detail: `claude mcp add failed (${why}). Run it yourself: ${text}` };
|
|
110
|
+
}
|
|
111
|
+
return { component: "mcp", action: "run", command: text };
|
|
112
|
+
};
|
|
113
|
+
const vscodeUserDir = () => {
|
|
114
|
+
if (isWindows())
|
|
115
|
+
return join(process.env.APPDATA || join(home(), "AppData", "Roaming"), "Code", "User");
|
|
116
|
+
if (platform() === "darwin")
|
|
117
|
+
return join(home(), "Library", "Application Support", "Code", "User");
|
|
118
|
+
return join(home(), ".config", "Code", "User");
|
|
119
|
+
};
|
|
120
|
+
// Where each app reads global skills from (SKILL.md in a folder).
|
|
121
|
+
const SKILL_DIRS = {
|
|
122
|
+
claude: ".claude",
|
|
123
|
+
cursor: ".cursor",
|
|
124
|
+
codex: ".codex",
|
|
125
|
+
};
|
|
126
|
+
const installSkill = (target, apply) => {
|
|
127
|
+
const dir = SKILL_DIRS[target];
|
|
128
|
+
if (!dir)
|
|
129
|
+
return null;
|
|
130
|
+
const path = join(home(), dir, "skills", "record-demo", "SKILL.md");
|
|
131
|
+
const text = readText(path);
|
|
132
|
+
if (text !== null && text.replace(/\r\n/g, "\n") === SKILL_TEXT)
|
|
133
|
+
return { component: "skill", action: "unchanged", path };
|
|
134
|
+
if (apply)
|
|
135
|
+
writeText(path, SKILL_TEXT);
|
|
136
|
+
return { component: "skill", action: text === null ? "create" : "update", path };
|
|
137
|
+
};
|
|
138
|
+
const installMcp = (target, apply) => {
|
|
139
|
+
switch (target) {
|
|
140
|
+
case "claude":
|
|
141
|
+
return mergeClaude(apply);
|
|
142
|
+
case "cursor":
|
|
143
|
+
return mergeJson(join(home(), ".cursor", "mcp.json"), "mcpServers", { command: "npx", args: NPX_ARGS }, apply);
|
|
144
|
+
case "windsurf":
|
|
145
|
+
return mergeJson(join(home(), ".codeium", "windsurf", "mcp_config.json"), "mcpServers", { command: "npx", args: NPX_ARGS }, apply);
|
|
146
|
+
case "gemini":
|
|
147
|
+
return mergeJson(join(home(), ".gemini", "settings.json"), "mcpServers", { command: "npx", args: NPX_ARGS }, apply);
|
|
148
|
+
case "vscode":
|
|
149
|
+
return mergeJson(join(vscodeUserDir(), "mcp.json"), "servers", { type: "stdio", command: "npx", args: NPX_ARGS }, apply);
|
|
150
|
+
case "opencode":
|
|
151
|
+
return mergeJson(join(home(), ".config", "opencode", "opencode.json"), "mcp", { type: "local", command: ["npx", ...NPX_ARGS], enabled: true }, apply);
|
|
152
|
+
case "codex":
|
|
153
|
+
return mergeCodex(apply);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const RESTART = {
|
|
157
|
+
claude: "Restart Claude Code (or run /mcp) so it loads the server and the skill.",
|
|
158
|
+
cursor: "Restart Cursor (or toggle the server in Settings → MCP) so it loads the server and the skill.",
|
|
159
|
+
codex: "Restart Codex so it loads the server and the skill.",
|
|
160
|
+
opencode: "Restart opencode, then run `opencode mcp list` to check the server.",
|
|
161
|
+
vscode: 'In VS Code, run "MCP: List Servers" and start recordful (or reload the window).',
|
|
162
|
+
windsurf: "Restart Windsurf (or refresh MCP servers in Cascade).",
|
|
163
|
+
gemini: "Restart Gemini CLI, then run /mcp to check the server.",
|
|
164
|
+
};
|
|
165
|
+
export const install = (target, opts) => {
|
|
166
|
+
const component = opts.component ?? "all";
|
|
167
|
+
const changes = [];
|
|
168
|
+
if (component !== "skill")
|
|
169
|
+
changes.push(installMcp(target, opts.apply));
|
|
170
|
+
if (component !== "mcp") {
|
|
171
|
+
const skill = installSkill(target, opts.apply);
|
|
172
|
+
if (skill)
|
|
173
|
+
changes.push(skill);
|
|
174
|
+
}
|
|
175
|
+
return { target, name: TARGET_NAMES[target], applied: opts.apply, changes, restart: RESTART[target] };
|
|
176
|
+
};
|
|
177
|
+
export const isTarget = (value) => typeof value === "string" && TARGETS.includes(value);
|
|
178
|
+
export const isComponent = (value) => typeof value === "string" && COMPONENTS.includes(value);
|
|
179
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,uEAAuE;AACvE,+EAA+E;AAC/E,mFAAmF;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAU,CAAC;AAE1G,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAU,CAAC;AAG3D,MAAM,CAAC,MAAM,YAAY,GAA2B;IAClD,MAAM,EAAE,aAAa;IACrB,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,YAAY;CACrB,CAAC;AAoBF,MAAM,MAAM,GAAG,WAAW,CAAC;AAC3B,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;AAEzC,sEAAsE;AACtE,MAAM,IAAI,GAAG,GAAW,EAAE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1,4 @@
|
|
|
1
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import type { Bridge } from "../bridge/BridgeServer.js";
|
|
3
3
|
import type { BridgeConfig } from "../config.js";
|
|
4
4
|
import type { Logger } from "../logger.js";
|
|
@@ -8,5 +8,5 @@ export interface McpServerDeps {
|
|
|
8
8
|
logger: Logger;
|
|
9
9
|
version: string;
|
|
10
10
|
}
|
|
11
|
-
export declare const createMcpServer: (deps: McpServerDeps) => McpServer;
|
|
12
11
|
export declare const recordFeaturePrompt: (feature: string, url?: string) => string;
|
|
12
|
+
export declare const createMcpServer: (deps: McpServerDeps) => McpServer;
|
|
@@ -1,260 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
-
|
|
26
|
-
- Recordful
|
|
27
|
-
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- NOT_SIGNED_IN or PRO_REQUIRED: uploads and transcripts need the user signed in to Recordful Pro. Relay the error's message (it says what still works); don't retry.
|
|
35
|
-
|
|
36
|
-
If you have a browser tool of your own you can use it for the walkthrough instead, but Recordful's page tools make smoother videos.
|
|
37
|
-
"screen" mode always shows Chrome's screen picker, which the user must answer.
|
|
1
|
+
import { createRecordfulServer } from "../core/createRecordfulServer.js";
|
|
2
|
+
import { localTransport } from "./localTransport.js";
|
|
3
|
+
const INSTRUCTIONS = `
|
|
4
|
+
Recordful records the user's browser so you can produce product demo videos. It also drives the page it records, so you don't need a browser tool of your own.
|
|
5
|
+
|
|
6
|
+
Typical flow for "record feature X" (the record_feature prompt has the full version):
|
|
7
|
+
1. Plan the walkthrough first: which page, which clicks, what to type, in what order. Use test data only, never the user's real credentials.
|
|
8
|
+
2. Ask the user to click the Recordful toolbar icon in Chrome on the tab to record. Chrome only lets an extension capture a tab after the user has invoked it there, and the same click connects Recordful to you. Nothing can do this click for them. Page tools only ever act on that tab.
|
|
9
|
+
3. Call get_status. It confirms the connection, shows the tab you were handed (recorder.agent.armedTab), and reports the recording mode the user picked in Recordful (tab area, screen, camera) and whether a recording is already running.
|
|
10
|
+
4. Get to the starting page before recording: navigate(url), then snapshot() to check it loaded.
|
|
11
|
+
5. Call start_recording. It uses the user's saved Recordful settings (mode, mic, camera, countdown) and returns once capture is live.
|
|
12
|
+
6. Walk through the feature with the page tools: snapshot() lists the interactive elements with refs ("e12"), then click(ref), type(ref, text), press(key), scroll(...), wait_for(...). Recordful moves a visible cursor to each target and types at a human pace, so the video looks like a person using the app. Take a fresh snapshot after anything that changes the page; refs from before a navigation stop working.
|
|
13
|
+
7. Call pause_recording before you stop to think or plan the next steps, and resume_recording right before acting again, so the video has no dead air. snapshot and screenshot work while paused.
|
|
14
|
+
8. Call stop_recording. Recordful opens its editor with the recording automatically.
|
|
15
|
+
9. To share it or read it back (Recordful Pro): stop_recording says where the recording went. A cloud recording is already uploading; a local one uploads with upload_recording. get_video gives its links once it's ready, and get_transcript returns what was said (it transcribes on first use and waits).
|
|
16
|
+
|
|
17
|
+
Free and Pro:
|
|
18
|
+
- Every plan: recording, page tools, and Recordful's editor (the video is saved on this computer and opens there).
|
|
19
|
+
- Recordful Pro only: uploads, cloud videos (list_videos, get_video) and transcripts (get_transcript).
|
|
20
|
+
- get_status shows recorder.account.plan: "pro", "free", "signed-out", or "unavailable". Check it before you promise a link or a transcript. If it isn't "pro", record as usual, tell the user the video is open in Recordful's editor, and mention once that links and transcripts come with Recordful Pro (recordful.app/upgrade). Don't call upload_recording or get_transcript, and don't retry them after PRO_REQUIRED or NOT_SIGNED_IN.
|
|
21
|
+
|
|
22
|
+
Managing what's on recordful.app (Recordful Pro): update_video (rename, who may watch), get_video_activity (views, likes, comments), comment_on_video, like_video, list_folders, create_folder, move_videos, delete_video, get_storage. These change or publish things for the user, so show them exactly what you'll do and wait for their yes before update_video, comment_on_video, move_videos, create_folder or delete_video; delete_video also needs the exact video named and confirm: true. Comments are public to everyone who can watch the video: post only the text the user approved.
|
|
23
|
+
|
|
24
|
+
First connection on a computer:
|
|
25
|
+
- NOT_CONNECTED: ask the user to click the Recordful icon. If that doesn't connect, they need to turn on AI agents in Recordful once (Recordful popup → More → AI agents, or paste chrome-extension://hkcgjbkibidgbefehehenlmhjanjaopc/agents.html into Chrome's address bar).
|
|
26
|
+
- PAIRING_PENDING: Recordful opened a window asking the user to approve you. Tell them the 4-digit code from the error so they can check it matches, ask them to click Allow, then retry. This happens once per computer.
|
|
27
|
+
- PAIRING_DENIED: the user declined. Don't retry unless they ask.
|
|
28
|
+
- PERMISSIONS_NEEDED: Recordful's one-time browser permission to record hasn't been granted. Tell the user to turn AI agents off and on again in Recordful (popup → More → AI agents) and click Allow, then retry.
|
|
29
|
+
- NOT_ARMED, or start_recording returning outcome "pending": the user hasn't clicked the Recordful icon on that tab yet. Ask them to, then retry.
|
|
30
|
+
- NOT_SIGNED_IN or PRO_REQUIRED: uploads and transcripts need the user signed in to Recordful Pro. Relay the error's message (it says what still works); don't retry.
|
|
31
|
+
|
|
32
|
+
If you have a browser tool of your own you can use it for the walkthrough instead, but Recordful's page tools make smoother videos.
|
|
33
|
+
"screen" mode always shows Chrome's screen picker, which the user must answer.
|
|
38
34
|
`.trim();
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
type: "text",
|
|
51
|
-
text: JSON.stringify({ error: { code: e.code, message: e.message, data: e.data } }, null, 2),
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
// Upper bound on how long the extension may spend inside a recording call.
|
|
57
|
-
const waitMs = z
|
|
58
|
-
.number()
|
|
59
|
-
.int()
|
|
60
|
-
.min(1_000)
|
|
61
|
-
.max(120_000)
|
|
62
|
-
.optional()
|
|
63
|
-
.describe("Maximum time to wait for the recorder to reach the new state, in milliseconds.");
|
|
64
|
-
const tabId = z
|
|
65
|
-
.number()
|
|
66
|
-
.int()
|
|
67
|
-
.nonnegative()
|
|
68
|
-
.optional()
|
|
69
|
-
.describe("Chrome tab ID to target. Defaults to the active tab of the last focused window.");
|
|
70
|
-
export const createMcpServer = (deps) => {
|
|
71
|
-
const { bridge, config, logger } = deps;
|
|
72
|
-
const log = logger.child({ component: "mcp" });
|
|
73
|
-
const server = new McpServer({ name: "recordful", title: "Recordful", version: deps.version }, { instructions: INSTRUCTIONS });
|
|
74
|
-
// Every call waits briefly for the extension: Chrome idles service workers,
|
|
75
|
-
// and a cold one needs a moment to wake and dial back in.
|
|
76
|
-
const call = async (method, params, extraWaitMs = 0) => {
|
|
77
|
-
await bridge.waitForSession(config.connectWaitMs);
|
|
78
|
-
const started = Date.now();
|
|
79
|
-
try {
|
|
80
|
-
return await bridge.request(method, params, config.requestTimeoutMs + extraWaitMs);
|
|
81
|
-
}
|
|
82
|
-
finally {
|
|
83
|
-
log.info("tool call", { method, ms: Date.now() - started });
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
const handle = (fn) => async (args) => {
|
|
87
|
-
try {
|
|
88
|
-
return text(await fn(args));
|
|
89
|
-
}
|
|
90
|
-
catch (err) {
|
|
91
|
-
return failure(err);
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
server.registerTool("get_status", {
|
|
95
|
-
title: "Get recorder status",
|
|
96
|
-
description: "Report whether the Recordful extension is connected and what the recorder is doing (idle, starting, recording, paused), the selected recording mode, the active tab, and which capture permissions are granted. Safe to call any time.",
|
|
97
|
-
inputSchema: {},
|
|
98
|
-
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
99
|
-
}, async () => {
|
|
100
|
-
const { session, pairing } = await bridge.state();
|
|
101
|
-
const { mode, error } = bridge.connection;
|
|
102
|
-
const base = {
|
|
103
|
-
bridge: {
|
|
104
|
-
// owner: this process holds Recordful's connection; peer: it shares
|
|
105
|
-
// another recordful-mcp's (another AI app or the CLI started first).
|
|
106
|
-
mode,
|
|
107
|
-
error,
|
|
108
|
-
extensionConnected: session !== null,
|
|
109
|
-
session,
|
|
110
|
-
pairing: pairing ? { code: pairing.code, app: pairing.app, startedAt: pairing.startedAt } : null,
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
if (!session) {
|
|
114
|
-
return text({
|
|
115
|
-
...base,
|
|
116
|
-
recorder: null,
|
|
117
|
-
hint: pairing
|
|
118
|
-
? `Recordful is waiting for the user to approve this app. Ask them to check the code ${pairing.code} and click Allow.`
|
|
119
|
-
: "Ask the user to click the Recordful toolbar icon in Chrome on the tab to record. The first time only, they also turn on AI agents (Recordful popup → More → AI agents).",
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
try {
|
|
123
|
-
return text({ ...base, recorder: await call(Method.StatusGet, {}) });
|
|
124
|
-
}
|
|
125
|
-
catch (err) {
|
|
126
|
-
return failure(err);
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
server.registerTool("start_recording", {
|
|
130
|
-
title: "Start recording",
|
|
131
|
-
description: "Start a Recordful recording on the target tab using the user's saved Recordful settings (mode, microphone, camera, countdown). Resolves once capture is live, or reports why it could not start. Navigate to the page you want to show before calling this.",
|
|
132
|
-
inputSchema: { tabId, timeoutMs: waitMs },
|
|
133
|
-
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
134
|
-
}, handle(async ({ tabId, timeoutMs }) => {
|
|
135
|
-
const wait = timeoutMs ?? 30_000;
|
|
136
|
-
return call(Method.RecordingStart, { tabId, timeoutMs: wait }, wait);
|
|
137
|
-
}));
|
|
138
|
-
server.registerTool("stop_recording", {
|
|
139
|
-
title: "Stop recording",
|
|
140
|
-
description: 'Stop the current Recordful recording. Recordful then opens its editor with the recording, exactly as when the user clicks Stop. Returns where it went: recording.kind "cloud" (Recordful Pro: already uploading, with its videoId and links) or "local" (saved on this computer as takeId; upload_recording uploads it).',
|
|
141
|
-
inputSchema: { timeoutMs: waitMs },
|
|
142
|
-
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
143
|
-
}, handle(async ({ timeoutMs }) => {
|
|
144
|
-
const wait = timeoutMs ?? 30_000;
|
|
145
|
-
// After stopping, a local recording is written out (up to 20 s) and the
|
|
146
|
-
// editor opens (up to 15 s) before the extension answers.
|
|
147
|
-
return call(Method.RecordingStop, { timeoutMs: wait }, wait + 40_000);
|
|
148
|
-
}));
|
|
149
|
-
server.registerTool("pause_recording", {
|
|
150
|
-
title: "Pause recording",
|
|
151
|
-
description: "Pause the current recording. Use it while you plan the next step so the video has no dead air. No-op if already paused.",
|
|
152
|
-
inputSchema: {},
|
|
153
|
-
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
154
|
-
}, handle(async () => call(Method.RecordingPause, {}, 10_000)));
|
|
155
|
-
server.registerTool("resume_recording", {
|
|
156
|
-
title: "Resume recording",
|
|
157
|
-
description: "Resume a paused recording. No-op if not paused.",
|
|
158
|
-
inputSchema: {},
|
|
159
|
-
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
160
|
-
}, handle(async () => call(Method.RecordingResume, {}, 10_000)));
|
|
161
|
-
server.registerTool("probe_capture", {
|
|
162
|
-
title: "Probe capture permissions",
|
|
163
|
-
description: "Diagnostic: check, without recording, whether the extension can capture the target tab right now with no user click, and which optional Chrome permissions are granted. Refuses while a recording is running.",
|
|
164
|
-
inputSchema: { tabId },
|
|
165
|
-
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
166
|
-
}, handle(async ({ tabId }) => call(Method.CaptureProbe, { tabId })));
|
|
167
|
-
// ---- page tools ----------------------------------------------------------
|
|
168
|
-
// The extension performs these in the tab the user handed it, so agents
|
|
169
|
-
// without a browser tool can do the walkthrough themselves.
|
|
170
|
-
const pageCall = async (method, args) => {
|
|
171
|
-
const params = parsePageParams(method, args);
|
|
172
|
-
try {
|
|
173
|
-
return await call(method, params, pageExtraWaitMs(method, params));
|
|
174
|
-
}
|
|
175
|
-
catch (err) {
|
|
176
|
-
if (err instanceof BridgeError && err.code === ErrorCode.UnknownMethod) {
|
|
177
|
-
throw new BridgeError(err.code, err.message, {
|
|
178
|
-
hint: "This version of Recordful predates page tools. Ask the user to update Recordful (chrome://extensions → Update) and try again.",
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
throw err;
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
const pageTool = (name, method, title, description, annotations) => server.registerTool(name, {
|
|
185
|
-
title,
|
|
186
|
-
description,
|
|
187
|
-
inputSchema: pageParams[method],
|
|
188
|
-
annotations: { destructiveHint: false, idempotentHint: false, openWorldHint: true, ...annotations },
|
|
189
|
-
}, handle(async (args) => pageCall(method, args)));
|
|
190
|
-
pageTool("navigate", Method.PageNavigate, "Open a URL", "Open an http(s) URL in the tab the user handed to Recordful and wait for it to load. Returns the final URL and title. Refs from earlier snapshots stop working.", { readOnlyHint: false });
|
|
191
|
-
pageTool("snapshot", Method.PageSnapshot, "List page elements", "List the interactive elements (links, buttons, fields, checkboxes, tabs, menu items) and headings in the recorded tab, each with a ref to pass to click/type/scroll/wait_for, its role, accessible name, current value or state, and bounding box in CSS pixels. Refs stay the same for an element while it stays on the page.", { readOnlyHint: true });
|
|
192
|
-
pageTool("click", Method.PageClick, "Click an element", "Move Recordful's visible cursor to the element, scrolling it into view if needed, and click it, with a click highlight in the video. Reports a navigation the click started. Fails with ELEMENT_OBSCURED (naming what is on top, with its ref) if something covers it.", { readOnlyHint: false });
|
|
193
|
-
pageTool("type", Method.PageType, "Type into a field", "Click the field, then type the text at a human pace (text inputs, text areas, content-editable areas). Set clear to replace what is already there. Use press for Enter, Tab and other keys.", { readOnlyHint: false });
|
|
194
|
-
pageTool("press", Method.PagePress, "Press a key", "Press a key in the focused element, e.g. Enter to submit a form, Tab to move focus, Escape to close a dialog, ArrowDown in a menu, Shift+Tab, Control+a. Recordful also performs the key's usual effect (submitting, moving focus, deleting), since pages ignore synthetic keys otherwise.", { readOnlyHint: false });
|
|
195
|
-
pageTool("scroll", Method.PageScroll, "Scroll", "Scroll smoothly: either bring an element (ref) into view, or scroll the page in a direction, by amount pixels or most of a screen.", { readOnlyHint: false });
|
|
196
|
-
pageTool("wait_for", Method.PageWaitFor, "Wait for the page", 'Wait until text appears on the page or an element (ref) becomes visible, or with state "hidden" until it goes away. Keeps waiting across navigations. Fails with WAIT_TIMEOUT if it doesn\'t happen in time.', { readOnlyHint: true });
|
|
197
|
-
server.registerTool("screenshot", {
|
|
198
|
-
title: "Screenshot the page",
|
|
199
|
-
description: "Capture what the recorded tab shows right now, as an image, to check the page looks right. The tab must be the active tab of its window.",
|
|
200
|
-
inputSchema: pageParams[Method.PageScreenshot],
|
|
201
|
-
annotations: { readOnlyHint: true, openWorldHint: true },
|
|
202
|
-
}, async (args) => {
|
|
203
|
-
try {
|
|
204
|
-
const shot = (await pageCall(Method.PageScreenshot, args));
|
|
205
|
-
const { data, mimeType, ...meta } = shot ?? {};
|
|
206
|
-
if (typeof data !== "string" || typeof mimeType !== "string") {
|
|
207
|
-
throw new BridgeError(ErrorCode.Internal, "The extension returned no image.");
|
|
208
|
-
}
|
|
209
|
-
return {
|
|
210
|
-
content: [
|
|
211
|
-
{ type: "image", data, mimeType },
|
|
212
|
-
{ type: "text", text: JSON.stringify(meta, null, 2) },
|
|
213
|
-
],
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
catch (err) {
|
|
217
|
-
return failure(err);
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
// ---- recordings: upload, videos, transcripts ------------------------------
|
|
221
|
-
registerVideoTools(server, call, async (fn) => {
|
|
222
|
-
try {
|
|
223
|
-
return text(await fn());
|
|
224
|
-
}
|
|
225
|
-
catch (err) {
|
|
226
|
-
return failure(err);
|
|
227
|
-
}
|
|
228
|
-
});
|
|
229
|
-
// ---- prompts -------------------------------------------------------------
|
|
230
|
-
// The whole "record the feature I just built" workflow, shipped with the
|
|
231
|
-
// server so every MCP client gets it (Claude Code lists it as
|
|
232
|
-
// /mcp__recordful__record_feature).
|
|
233
|
-
server.registerPrompt("record_feature", {
|
|
234
|
-
title: "Record a feature demo",
|
|
235
|
-
description: "Plan and record a short product demo of a feature with Recordful: work out the user-facing flow, get the app running with test data, record a clean walkthrough, and open it in the editor.",
|
|
236
|
-
argsSchema: {
|
|
237
|
-
feature: z.string().describe("The feature to show, e.g. \"sign up and sign in\" or \"the new billing page\"."),
|
|
238
|
-
url: z
|
|
239
|
-
.string()
|
|
240
|
-
.optional()
|
|
241
|
-
.describe("Where the app runs, e.g. http://localhost:3000. Leave empty to work it out from the project."),
|
|
242
|
-
},
|
|
243
|
-
}, ({ feature, url }) => ({
|
|
244
|
-
messages: [{ role: "user", content: { type: "text", text: recordFeaturePrompt(feature, url) } }],
|
|
245
|
-
}));
|
|
246
|
-
return server;
|
|
247
|
-
};
|
|
248
|
-
export const recordFeaturePrompt = (feature, url) => `Record a product demo video of this feature with Recordful: ${feature}
|
|
249
|
-
|
|
250
|
-
1. Understand it as a user sees it. If you or the user just built it, read the changes (git diff, recent commits, routes, pages, components). List the screens and moments worth showing: the main path first, then at most one or two telling states (for example a validation error). Leave out internals.
|
|
251
|
-
2. Get the app running. ${url ? `It should be at ${url}.` : "If it's a local project, find how to run it (package.json scripts, README, Makefile, docker compose) and the URL it serves."} If it isn't running, start it in the background and wait until it answers.
|
|
252
|
-
3. Prepare test data. Use test accounts and data only: from seed, fixture or example-config files, or create a new one through the app itself (for example sign up as demo+<timestamp>@example.com with a generated password). Never type the user's real credentials or personal data; if real credentials are unavoidable, ask the user to sign in themselves first.
|
|
253
|
-
4. Write a short shot list, 5 to 10 steps for a 30 to 90 second video: the starting screen, the main action, the result, an optional second state, and a clear final screen. Share it with the user in a line or two, then go ahead unless something is unclear.
|
|
254
|
-
5. Ask the user to click the Recordful icon in Chrome on the tab with the app. The first time only, they also turn on AI agents (Recordful popup → More → AI agents), and approve the pairing code you'll get back. Then call get_status, and note recorder.account.plan: links and transcripts need "pro".
|
|
255
|
-
6. navigate to the starting page and snapshot it. Make sure the starting state is clean (signed out for a sign-in demo, no leftover data or open dialogs).
|
|
256
|
-
7. start_recording, then follow the shot list with the page tools at a calm pace. Use wait_for so each result is visible before you move on. Call pause_recording whenever you need to think, and resume_recording right before the next action, so the video has no dead air.
|
|
257
|
-
8. If something goes wrong while recording (an error, the wrong page), pause, fix it, and resume. Stop and start over only if the mistake would confuse viewers.
|
|
258
|
-
9. stop_recording. Recordful opens its editor with the video. Tell the user it's ready and summarise what the video shows in one or two sentences.
|
|
35
|
+
export const recordFeaturePrompt = (feature, url) => `Record a product demo video of this feature with Recordful: ${feature}
|
|
36
|
+
|
|
37
|
+
1. Understand it as a user sees it. If you or the user just built it, read the changes (git diff, recent commits, routes, pages, components). List the screens and moments worth showing: the main path first, then at most one or two telling states (for example a validation error). Leave out internals.
|
|
38
|
+
2. Get the app running. ${url ? `It should be at ${url}.` : "If it's a local project, find how to run it (package.json scripts, README, Makefile, docker compose) and the URL it serves."} If it isn't running, start it in the background and wait until it answers.
|
|
39
|
+
3. Prepare test data. Use test accounts and data only: from seed, fixture or example-config files, or create a new one through the app itself (for example sign up as demo+<timestamp>@example.com with a generated password). Never type the user's real credentials or personal data; if real credentials are unavoidable, ask the user to sign in themselves first.
|
|
40
|
+
4. Write a short shot list, 5 to 10 steps for a 30 to 90 second video: the starting screen, the main action, the result, an optional second state, and a clear final screen. Share it with the user in a line or two, then go ahead unless something is unclear.
|
|
41
|
+
5. Ask the user to click the Recordful icon in Chrome on the tab with the app. The first time only, they also turn on AI agents (Recordful popup → More → AI agents), and approve the pairing code you'll get back. Then call get_status, and note recorder.account.plan: links and transcripts need "pro".
|
|
42
|
+
6. navigate to the starting page and snapshot it. Make sure the starting state is clean (signed out for a sign-in demo, no leftover data or open dialogs).
|
|
43
|
+
7. start_recording, then follow the shot list with the page tools at a calm pace. Use wait_for so each result is visible before you move on. Call pause_recording whenever you need to think, and resume_recording right before the next action, so the video has no dead air.
|
|
44
|
+
8. If something goes wrong while recording (an error, the wrong page), pause, fix it, and resume. Stop and start over only if the mistake would confuse viewers.
|
|
45
|
+
9. stop_recording. Recordful opens its editor with the video. Tell the user it's ready and summarise what the video shows in one or two sentences.
|
|
259
46
|
10. If the plan is "pro" and the user wants to share it or check what was said: upload_recording (a cloud recording is already uploading), then get_transcript. On any other plan, don't attempt these; say once that shareable links and transcripts come with Recordful Pro.`;
|
|
47
|
+
export const createMcpServer = (deps) => createRecordfulServer({
|
|
48
|
+
transport: localTransport(deps.bridge),
|
|
49
|
+
copy: { instructions: INSTRUCTIONS, recordFeaturePrompt },
|
|
50
|
+
timeouts: deps.config,
|
|
51
|
+
logger: deps.logger,
|
|
52
|
+
version: deps.version,
|
|
53
|
+
});
|
|
260
54
|
//# sourceMappingURL=createMcpServer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMcpServer.js","sourceRoot":"","sources":["../../src/mcp/createMcpServer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createMcpServer.js","sourceRoot":"","sources":["../../src/mcp/createMcpServer.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEzE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AASrD,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BpB,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAe,EAAE,GAAY,EAAU,EAAE,CAAC,+DAA+D,OAAO;;;0BAG1H,GAAG,CAAC,CAAC,CAAC,mBAAmB,GAAG,GAAG,CAAC,CAAC,CAAA,6HAA6H;;;;;;;;+QAQuF,CAAC;AAEhR,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAmB,EAAa,EAAE,CAChE,qBAAqB,CAAC;IACpB,SAAS,EAAE,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE;IACzD,QAAQ,EAAE,IAAI,CAAC,MAAM;IACrB,MAAM,EAAE,IAAI,CAAC,MAAM;IACnB,OAAO,EAAE,IAAI,CAAC,OAAO;CACtB,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const localTransport = (bridge) => ({
|
|
2
|
+
ready: async (timeoutMs) => {
|
|
3
|
+
await bridge.waitForSession(timeoutMs);
|
|
4
|
+
},
|
|
5
|
+
request: (method, params, timeoutMs) => bridge.request(method, params, timeoutMs),
|
|
6
|
+
status: async () => {
|
|
7
|
+
const { session, pairing } = await bridge.state();
|
|
8
|
+
const { mode, error } = bridge.connection;
|
|
9
|
+
return {
|
|
10
|
+
connected: session !== null,
|
|
11
|
+
detail: {
|
|
12
|
+
// owner: this process holds Recordful's connection; peer: it shares
|
|
13
|
+
// another recordful-mcp's (another AI app or the CLI started first).
|
|
14
|
+
mode,
|
|
15
|
+
error,
|
|
16
|
+
extensionConnected: session !== null,
|
|
17
|
+
session,
|
|
18
|
+
pairing: pairing ? { code: pairing.code, app: pairing.app, startedAt: pairing.startedAt } : null,
|
|
19
|
+
},
|
|
20
|
+
hint: pairing
|
|
21
|
+
? `Recordful is waiting for the user to approve this app. Ask them to check the code ${pairing.code} and click Allow.`
|
|
22
|
+
: "Ask the user to click the Recordful toolbar icon in Chrome on the tab to record. The first time only, they also turn on AI agents (Recordful popup → More → AI agents).",
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=localTransport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localTransport.js","sourceRoot":"","sources":["../../src/mcp/localTransport.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAc,EAAqB,EAAE,CAAC,CAAC;IACpE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;QACzB,MAAM,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC;IACjF,MAAM,EAAE,KAAK,IAAI,EAAE;QACjB,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QAClD,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC;QAC1C,OAAO;YACL,SAAS,EAAE,OAAO,KAAK,IAAI;YAC3B,MAAM,EAAE;gBACN,oEAAoE;gBACpE,qEAAqE;gBACrE,IAAI;gBACJ,KAAK;gBACL,kBAAkB,EAAE,OAAO,KAAK,IAAI;gBACpC,OAAO;gBACP,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI;aACjG;YACD,IAAI,EAAE,OAAO;gBACX,CAAC,CAAC,qFAAqF,OAAO,CAAC,IAAI,mBAAmB;gBACtH,CAAC,CAAC,yKAAyK;SAC9K,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|