Open source CapCut alternative.
TypeScript
fix(site): give each ChatGPT command its own tool
David Lef1fd96fef03b
diff --git a/site/scripts/eval-chatgpt-workflow.ts b/site/scripts/eval-chatgpt-workflow.tsindex e9de1583..3ee2ed4a 100644--- a/site/scripts/eval-chatgpt-workflow.ts+++ b/site/scripts/eval-chatgpt-workflow.ts@@ -121,20 +121,19 @@ let projectId: string | null = null;const card = new AbortController();let hosting: Promise<void> | undefined;try {- // Instructions and catalog: what ChatGPT reads first.+ // Instructions and tools: what ChatGPT reads first.if (!SERVER_INSTRUCTIONS.includes("github.com/DonkeyCut/Donkey")) fail("server instructions do not link the repository");- const index = await call("list_commands");- const names = (index.view as unknown as { commands: { name: string }[] }).commands.map((c) => c.name);+ const names = (await client.listTools()).tools.map((t) => t.name);for (const need of ["set_aspect", "add_clip", "trim_clip", "add_title", "subtitles_generate", "set_framing"])- if (!names.includes(need)) fail(`list_commands misses ${need}`);- console.log(`catalog: ${names.length} commands`);+ if (!names.includes(need)) fail(`the tool list misses ${need}`);+ console.log(`catalog: ${names.length} tools`);const created = await call("create_project", { name: `chatgpt-workflow-${Date.now()}`, aspect: "16:9" });projectId = created.view.project?.id ?? fail("create_project returned no project");console.log(`created ${projectId}`);// An edit before the card is open is refused, and says so.- const closed = await client.callTool({ name: "edit_project", arguments: { projectId, commands: [{ name: "set_aspect", input: { aspect: "9:16" } }] } });+ const closed = await client.callTool({ name: "set_aspect", arguments: { projectId, aspect: "9:16" } });if (!closed.isError || !JSON.stringify(closed.content).includes("open_project")) fail(`an edit with no card open should ask for open_project: ${JSON.stringify(closed.content)}`);console.log("no card open: the edit asks for open_project");hosting = hostCard(projectId, card.signal).catch((e) => { if (!card.signal.aborted) console.error("card failed:", e); });@@ -150,52 +149,29 @@ try {if (!state || !Array.isArray(state.media) || state.media.length !== 1) fail(`inspect_project state has no media list: ${inspected.text.slice(0, 200)}`);console.log("inspected: state carries the footage");+ // Each command is its own tool and its own undo step.+ const edit = async (name: string, input: Record<string, unknown>) => {+ const result = await settle(await call(name, { projectId, ...input }), "get_job_status", name);+ if (result.view.results.some((r) => !r.ok)) fail(`${name} failed: ${result.text}`);+ return result;+ };const before = await doc(projectId);- const placed = await settle(- await call("edit_project", {- projectId,- label: "Vertical frame with the footage",- commands: [- { name: "set_aspect", input: { aspect: "9:16" } },- { name: "add_clip", input: { asset_id: asset.assetId } },- ],- }),- "get_job_status",- "edit"- );- if (placed.view.results.some((r) => !r.ok)) fail(`the first batch failed: ${placed.text}`);- const clipId = (placed.view.results[1].output as { id?: string })?.id ?? fail("add_clip returned no clip id");+ await edit("set_aspect", { aspect: "9:16" });+ const placed = await edit("add_clip", { asset_id: asset.assetId });+ const clipId = (placed.view.results[0].output as { id?: string })?.id ?? fail("add_clip returned no clip id");const after = await doc(projectId);if (after.aspect !== "9:16") fail(`aspect did not save: ${after.aspect}`);if (!(after.clips?.length === 1)) fail(`clip did not save: ${JSON.stringify(after.clips)}`);if (after.version <= before.version) fail("the edit did not bump the version");- // A batch stops at its first failure and reports how far it got.- const broken = await settle(- await call("edit_project", {- projectId,- commands: [{ name: "trim_clip", input: { clipId: "no-such-clip", out: 1 } }, { name: "set_background", input: { color: "#ff0000" } }],- }),- "get_job_status",- "broken edit"- );- if (broken.view.results.length !== 1 || broken.view.results[0].ok || broken.view.changed) fail(`a failed batch should stop and save nothing: ${broken.text}`);-- const finished = await settle(- await call("edit_project", {- projectId,- label: "Trim and title",- commands: [- { name: "trim_clip", input: { clipId, in: 0, out: Math.min(3, asset.duration) } },- { name: "add_title", input: { text: "MADE IN CHATGPT", start: 0, end: 2 } },- { name: "capture_frame", input: { t: 0.5 } },- ],- }),- "get_job_status",- "edit 2"- );- if (finished.view.results.some((r) => !r.ok)) fail(`second batch failed: ${finished.text}`);- if (finished.images < 1) fail("capture_frame returned no image block");+ // A failed command reports its error and saves nothing.+ const broken = await settle(await call("trim_clip", { projectId, clipId: "no-such-clip", out: 1 }), "get_job_status", "broken edit");+ if (broken.view.results[0]?.ok !== false || broken.view.changed) fail(`a failed command should save nothing: ${broken.text}`);++ await edit("trim_clip", { clipId, in: 0, out: Math.min(3, asset.duration) });+ await edit("add_title", { text: "MADE IN CHATGPT", start: 0, end: 2 });+ const frame = await settle(await call("capture_frame", { projectId, t: 0.5 }), "get_job_status", "capture");+ if (frame.images < 1) fail("capture_frame returned no image block");const titled = await doc(projectId);if (!(titled.overlays ?? []).some((o) => o.text === "MADE IN CHATGPT")) fail("the title did not save");if (!(titled.clips![0].out - titled.clips![0].in <= 3.001)) fail("the trim did not save");diff --git a/site/src/clients/chatgpt/server/catalog.test.ts b/site/src/clients/chatgpt/server/catalog.test.tsindex 9a3f69a6..25e8733c 100644--- a/site/src/clients/chatgpt/server/catalog.test.ts+++ b/site/src/clients/chatgpt/server/catalog.test.ts@@ -1,6 +1,7 @@import { expect, test } from "bun:test";import { AI_TOOLS, PROJECT_TOOLS } from "@/cut/server/ai/catalog";-import { COMMAND_NAMES, COMMANDS, READ_COMMANDS, SKILL_INDEX, readSkill, unknownCommandNames } from "./catalog";+import { COMMAND_NAMES, COMMANDS, READ_COMMANDS, SKILL_INDEX, readSkill, unknownCommandNames, unmappedCommands } from "./catalog";+import { SERVER_INSTRUCTIONS } from "./mcp";test("first-class history tools can queue their editor commands", () => {expect(COMMANDS.some((tool) => tool.name === "undo" || tool.name === "redo")).toBe(false);@@ -27,7 +28,7 @@ test("ChatGPT exposes file metadata as a read command", () => {test("ChatGPT guides and command descriptions refer to available tools", () => {const available = new Set([...COMMANDS.map((tool) => tool.name),- "undo", "redo", "render_preview", "list_skills", "read_skill",+ "undo", "redo", "render_preview", "list_projects", "list_skills", "read_skill",]);const unavailable = AI_TOOLS.filter((tool) => !available.has(tool.name));const guidance = [@@ -57,7 +58,19 @@ test("ChatGPT preserves the shared inspection schemas and teaches their use", ()expect(guide).toContain(name);}expect(READ_COMMANDS.has("note_source")).toBe(false);- expect(guide).toContain("edit_project with note_source");+ expect(guide).toContain("with note_source");expect(PROJECT_TOOLS.find((tool) => tool.name === "listen_audio")!.description).toContain("get_state");expect(COMMANDS.find((tool) => tool.name === "listen_audio")!.description).toContain("inspect_project");});++test("every exposed command declares its effect, so its tool carries honest annotations", () => {+ expect(unmappedCommands()).toEqual([]);+ expect(COMMAND_NAMES).not.toContain("list_projects");+});++test("nothing teaches the retired generic executor", () => {+ const text = [SERVER_INSTRUCTIONS, ...SKILL_INDEX.map((name) => readSkill(name)!), ...COMMANDS.map((tool) => tool.description)];+ for (const retired of ["edit_project", "list_commands", "describe_commands"]) {+ for (const t of text) expect(t).not.toContain(retired);+ }+});diff --git a/site/src/clients/chatgpt/server/catalog.ts b/site/src/clients/chatgpt/server/catalog.tsindex 24be7d2f..08e1adb0 100644--- a/site/src/clients/chatgpt/server/catalog.ts+++ b/site/src/clients/chatgpt/server/catalog.ts@@ -1,3 +1,4 @@+import type { ToolAnnotations } from "@modelcontextprotocol/server";import type { AiToolDef } from "@/cut/lib/aiToolDef";import { ADOPT_COMMAND } from "@/cut/lib/commandBatch";import { PROJECT_TOOLS } from "@/cut/server/ai/catalog";@@ -16,6 +17,7 @@ const HIDDEN = new Set(["redo","render_preview","import_url",+ "list_projects",// Page-local: the editor's clipboard and playback."copy_selection","paste_selection",@@ -54,51 +56,78 @@ export const COMMAND_NAMES = COMMANDS.map((tool) => tool.name);const KNOWN_COMMANDS = new Set([...COMMAND_NAMES, "get_state", "undo", "redo", ADOPT_COMMAND]);export const unknownCommandNames = (names: string[]): string[] => names.filter((name) => !KNOWN_COMMANDS.has(name));-/** Commands whose output matters and whose effect is on the caller's eyes:- * a read runs without saving the document. */-export const READ_COMMANDS = new Set([- "get_asset_info",- "watch_video",- "capture_frame",- "compare_to_source",- "sample_color",- "track_element",- "track_camera",- "suggest_font",- "listen_audio",- "detect_silence",- "detect_beats",- "measure_level",- "read_color_stats",- "stock_search",- "list_voices",- "credit_prices",- "library_list",- "read_folder",- "notes_list",- "read_note",- "read_project",- "list_projects",- "check_facts",-]);+/** What a command does, in the terms of OpenAI's tool annotations. A read+ * changes nothing; a search reaches the public web; session moves only the+ * editor's view (playhead, selection, open timeline, guides); add writes new+ * things alone; set overwrites a value, the same each time; change deletes,+ * overwrites or moves by an amount; share opens a public link. Undo does not+ * make a write additive. */+type Effect = "read" | "search" | "session" | "add" | "set" | "change" | "share";-/** The first sentence of a description, as the index shows it. */-function summary(description: string): string {- const first = description.replace(/\s+/g, " ").match(/^(.*?[.!?])(\s|$)/)?.[1] ?? description;- return first.length > 180 ? `${first.slice(0, 177)}…` : first;-}+const HINTS: Record<Effect, Required<Pick<ToolAnnotations, "readOnlyHint" | "destructiveHint" | "idempotentHint" | "openWorldHint">>> = {+ read: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },+ search: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },+ session: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },+ add: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },+ set: { readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: false },+ change: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false },+ share: { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true },+};-export function commandIndex(): { name: string; summary: string; reads?: true }[] {- return COMMANDS.map((tool) => ({- name: tool.name,- summary: summary(tool.description),- ...(READ_COMMANDS.has(tool.name) ? { reads: true as const } : {}),- }));-}+// Every exposed command's effect; a test holds this map to COMMANDS.+const EFFECTS: Record<string, Effect> = {+ get_asset_info: "read", find_media: "read", watch_video: "read", detect_silence: "read",+ find_filler: "read", measure_level: "read", detect_beats: "read", listen_audio: "read",+ compare_to_source: "read", sample_color: "read", track_element: "read", track_camera: "read",+ suggest_font: "read", find_highlights: "read", read_project: "read", capture_frame: "read",+ read_color_stats: "read", list_voices: "read", credit_prices: "read", stock_search: "read",+ read_note: "read", read_folder: "read", library_list: "read", notes_list: "read",+ check_facts: "search",+ seek: "session", select: "session", select_items: "session", switch_timeline: "session",+ set_guides: "session", wait_for_uploads: "session",+ note_source: "add", add_clip: "add", add_overlay_video: "add", add_title: "add",+ add_text_sequence: "add", freeze_frame: "add", group_items: "add", copy_from_timeline: "add",+ add_shape: "add", add_sticker: "add", create_sticker: "add", add_effect: "add",+ subtitles_add_track: "add", subtitles_translate_track: "add", voiceover_generate: "add",+ generate_music: "add", read_subtitles_aloud: "add", generate_image: "add", stock_add: "add",+ library_add: "add", template_add: "add", save_template: "add", copy_project_media: "add",+ replicate_project: "add",+ find_picture: "set", detect_cuts: "set", trim_clip: "set", place_clip: "set",+ set_clip_muted: "set", rename_item: "set", set_clip_hidden: "set", set_track_hidden: "set",+ set_track_muted: "set", set_magnet: "set", update_overlay_video: "set", update_overlay: "set",+ set_mask: "set", track_motion: "set", set_clip_keyframes: "set", update_audio: "set",+ set_clip_volume: "set", sync_audio: "set", set_split_edit: "set", set_clip_sound: "set",+ save_sound_preset: "set", set_framing: "set", set_clip_style: "set", set_clip_effects: "set",+ set_speed: "set", set_speed_curve: "set", set_color_grade: "set", set_color_preset: "set",+ set_color_curves: "set", set_color_wheels: "set", set_color_hsl: "set", set_color_lut: "set",+ copy_color_grade: "set", set_source_color: "set", save_color_grade: "set",+ apply_saved_grade: "set", match_color_grade: "set", set_camera_card: "set", set_removal: "set",+ set_removal_stroke: "set", set_removal_background: "set", set_overlay_animation: "set",+ set_overlay_keyframes: "set", set_group_camera: "set", set_transition: "set",+ set_transition_hidden: "set", set_animation: "set", set_caption_look: "set",+ set_caption_emphasis: "set", subtitles_set_view: "set", update_cue: "set", set_publish: "set",+ set_project_notes: "set", set_background: "set", set_aspect: "set", set_project_name: "set",+ set_project_color: "set", replace_item: "set", align_to_audio: "set", pack_lanes: "set",+ file_asset: "set", convert_media: "set", sync_lyrics: "set", subtitles_generate: "set",+ move_selection: "change", ungroup_items: "change", move_timeline_selection: "change",+ insert_item_row: "change", split_at: "change", move_clip: "change", reorder_track: "change",+ refine_speech_cuts: "change", delete_item: "change", remove_gap: "change", detach_audio: "change",+ remove_transition: "change", subtitles_remove_track: "change", delete_cue: "change",+ merge_cue: "change", captions_generate: "change", subtitles_from_visuals: "change",+ note_save: "change", library_organize: "change", media_organize: "change", delete_asset: "change",+ library_share: "share",+};++/** A command's annotations, from its effect. */+export const commandHints = (name: string) => HINTS[EFFECTS[name]];++/** Commands that change nothing: a read runs without saving the document. */+export const READ_COMMANDS = new Set(+ Object.keys(EFFECTS).filter((name) => HINTS[EFFECTS[name]].readOnlyHint),+);-export function describeCommands(names: string[]): { found: AiToolDef[]; unknown: string[] } {- const wanted = new Set(names);- const found = COMMANDS.filter((tool) => wanted.has(tool.name));- const known = new Set(found.map((tool) => tool.name));- return { found, unknown: names.filter((name) => !known.has(name)) };+/** Names with no effect, or effects with no command: a test keeps both empty. */+export function unmappedCommands(): string[] {+ const names = new Set(COMMAND_NAMES);+ return [...COMMAND_NAMES.filter((name) => !Object.hasOwn(EFFECTS, name)), ...Object.keys(EFFECTS).filter((name) => !names.has(name))];}diff --git a/site/src/clients/chatgpt/server/guidance.ts b/site/src/clients/chatgpt/server/guidance.tsindex e65fa52f..e97597c1 100644--- a/site/src/clients/chatgpt/server/guidance.ts+++ b/site/src/clients/chatgpt/server/guidance.ts@@ -30,7 +30,7 @@ const SKILLS: Record<string, string> = {ChatGPT plans the edit and interprets the footage with the user. Donkey Cut imports media, measures it, applies editing commands, and renders the result.Work on the connected account's cloud projects. Use list_projects or create_project, then open_project once. Keep that card throughout inspection, imports, edits, previews, undo and redo: reopening starts a fresh editor with empty history. The existing card shows edits immediately; render_preview and get_preview_status verify the saved preview. Recover a missing card with open_project and resume when ready. Local projects become accessible after the user saves them to cloud in Donkey Cut.Read inspect_project for current assets, selection, tracks, captions, notes and settings. An editor_state mentioned in these guides is that returned state. Times are seconds and ids come from tool results.-Call list_commands to discover commands and describe_commands for their inputs. Commands marked reads run through inspect_project with projectId and commands; commands that write run through edit_project. note_source writes observations and belongs in edit_project. Each edit batch is one undo step; the user's manual edits share that history. A batch stops at the first failure, so read its results before continuing.+Every editing operation is its own tool taking projectId. Each write is one undo step; the user's manual edits share that history. Read each result before continuing.The card offers the timeline, preview and inspector. ChatGPT provides the conversation and calls the media and caption commands. When a required asset is missing, ask the user for a file or link, or discuss suitable stock. Ask about creative choices when the answer materially changes the requested result.`,"timeline-editing": `# Timeline editing@@ -44,10 +44,10 @@ Transitions sit at cuts and retain their positions as edits move footage. Inspec"watching-and-cutting": `# Watching footage and cutting by contentInspect the project for asset ids, transcripts, trims, notes and existing coverage. ChatGPT interprets the returned frames and audio; Donkey Cut supplies measurements and timing. Watch footage before deciding cuts that depend on its content.watch_video returns timestamped contact sheets, sceneChanges and coverage. Stamps are source seconds. Continue from coveredTo when truncated. For a request about the whole source, cover it until unwatchedSeconds reaches zero. For long footage, sweep coarsely to learn its structure, then inspect relevant spans closely. A source map or a transcript alone does not establish visual coverage. Use detail read or original to read text and match typography; scan is for structure. Check unreadSeconds and unreadFrom when legible coverage matters.-After every watch, record what you observed through edit_project with note_source: source span, actions, cuts, and exact on-screen words. A further watch can be refused until those observations are recorded. Notes persist on the asset; returned contact sheets belong to this conversation. Read observed, recorded and unnoted to resume from existing evidence.+After every watch, record what you observed with note_source: source span, actions, cuts, and exact on-screen words. A further watch can be refused until those observations are recorded. Notes persist on the asset; returned contact sheets belong to this conversation. Read observed, recorded and unnoted to resume from existing evidence.listen_audio returns playable source audio. Use the transcript for words and listen for delivery, music and timing. Respect coveredTo; continue from unheardFrom until unheardSeconds reaches zero when judging a whole source. Record observations with note_source. A clip_id scopes listening to its source trim; from and to are source seconds.-Use signal measurements for editing decisions: detect_silence locates quiet spans; detect_beats returns a beat grid and timelineBeats for a clip; measure_level measures loudness, including integratedLufs and truePeakDbtp per clip and for the whole mix, and returns volumeToMatch against a target. read_color_stats measures exposure, tonal range and color before grading. compare_to_source checks the edit against a reference; capture_frame shows the composited picture. detect_cuts, sample_color and track_element measure a source's cuts, colours and moving elements as numbers, inside the picture box find_picture keeps for a recorded or letterboxed source. sample_color and track_element belong in inspect_project's commands array; detect_cuts keeps the box it finds on a source's first read, so it goes through edit_project.-find_filler identifies transcript fillers; find_highlights ranks transcript spans. Their results need the relevant visual or audio check before cutting. Use edit_project for these commands unless list_commands marks them reads. Caption creation is a separate edit requested by the user.+Use signal measurements for editing decisions: detect_silence locates quiet spans; detect_beats returns a beat grid and timelineBeats for a clip; measure_level measures loudness, including integratedLufs and truePeakDbtp per clip and for the whole mix, and returns volumeToMatch against a target. read_color_stats measures exposure, tonal range and color before grading. compare_to_source checks the edit against a reference; capture_frame shows the composited picture. detect_cuts, sample_color and track_element measure a source's cuts, colours and moving elements as numbers, inside the picture box find_picture keeps for a recorded or letterboxed source. detect_cuts keeps the box it finds on a source's first read.+find_filler identifies transcript fillers; find_highlights ranks transcript spans. Their results need the relevant visual or audio check before cutting. Caption creation is a separate edit requested by the user.Plan cuts around complete thoughts and measured pauses. Split and delete in batches, read the resulting ids, then place clips to close intended gaps. Leave room around speech boundaries and run refine_speech_cuts with the requested pace. Listen around adjusted edges, widen a clipped word's trim, and check the changed cut visually. Source seconds drive watches, listens and trims; timeline seconds drive placement and splits. Use the clip timing data to map between them.Report only the coverage you inspected and the changes tool results confirm. render_preview produces a playable saved revision for the user to review.`,@@ -57,23 +57,23 @@ The matte prepares in the editor. Read each clip's removal readiness and progresFor one exact instance among similar subjects, ask the user to use Custom, Brush and Erase in the Cutout inspector and press Apply. set_removal_stroke adds an outline, and set_removal_background fills behind the kept subject. A lower video track can carry independently editable scenery.`,"graphics": `# Titles, graphics and motion-Use add_title or add_text_sequence for words, add_shape for geometry, add_sticker for an imported image, and add_effect for a treatment over a time range. Read describe_commands for the current supported styles and parameters. set_background sets the project's background color. Use ids and fonts reported by inspect_project.+Use add_title or add_text_sequence for words, add_shape for geometry, add_sticker for an imported image, and add_effect for a treatment over a time range. Each tool's schema lists the supported styles and parameters. set_background sets the project's background color. Use ids and fonts reported by inspect_project.update_overlay changes text, position, size, color and other element fields, and accepts ids for changes shared by several elements. Layout coordinates are frame fractions. Keep text inside the project's reported safe zones and check legibility with capture_frame.set_overlay_keyframes and set_clip_keyframes animate poses at exact times. set_group_camera moves one camera over a group of elements, and blur and motion blur soften what the camera is not on. set_overlay_animation supplies entrances, exits, loops, word motion, a typing caret and a one-shot press at a chosen moment. set_mask clips a layer to a shape and can animate the reveal. track_motion keys a mask or a pose to a hand, a head or a person in the footage, frame by frame. set_clip_effects treats one clip alone, inside its mask. Read text-videos for timed text and text-creativity for design choices.Build composite effects as layers: add_overlay_video for copies of footage, masks for visible regions, shapes for bands, and text for labels. Match source trims so copied footage stays synchronized. Work out geometry and timing, build one representative piece, capture_frame to check it, then repeat and check the whole composition. create_sticker generates a new sticker and spends credits when the user requests it.`,"audio-and-subtitles": `# Audio and subtitlesListen to the relevant source with listen_audio. Use detect_silence for pauses, detect_beats for music timing, and measure_level for level matching. Its volumeToMatch result can drive set_clip_volume or update_audio; use a fraction for a music bed beneath speech. Read watching-and-cutting for coverage and source-time rules.-update_audio edits soundtrack timing, source trim, volume, fades and ducking. A clip's duck lowers other audio while it plays. set_clip_sound applies EQ, compression and limiting to one clip; add_effect treats a time range of the mix. sync_audio lines a separately recorded audio file up with a video's own sound and binds it, so every clip of the video plays the recording; it refuses when no alignment is clear. set_split_edit starts a clip's sound before its picture or carries it past the cut, for J- and L-cuts. describe_commands supplies the supported presets and settings.+update_audio edits soundtrack timing, source trim, volume, fades and ducking. A clip's duck lowers other audio while it plays. set_clip_sound applies EQ, compression and limiting to one clip; add_effect treats a time range of the mix. sync_audio lines a separately recorded audio file up with a video's own sound and binds it, so every clip of the video plays the recording; it refuses when no alignment is clear. set_split_edit starts a clip's sound before its picture or carries it past the cut, for J- and L-cuts. Each tool's schema lists the supported presets and settings.When captions are requested, subtitles_generate transcribes the cut; sync_lyrics aligns supplied words with the audio. subtitles_from_visuals writes descriptions of silent footage when the user wants them. captions_generate rewrites existing captions. These model-backed operations use the account's applicable allowance or credits.-Use update_cue, delete_cue and merge_cue for corrections. subtitles_add_track, subtitles_remove_track and subtitles_translate_track manage languages. set_caption_look controls appearance and words per cue; subtitles_set_view controls visibility. set_caption_emphasis sets one or two key words apart in a caption every few lines when the user asks for emphasis, and update_cue x/y gives one caption its own spot. Current choices come from describe_commands, and text-videos covers timed text layouts. align_to_audio measures timing against the mix.-For requested audio generation, list_voices supplies voice ids, voiceover_generate speaks a script, read_subtitles_aloud voices timed cues, and generate_music makes music. Generation spends credits. Read the result for asset ids and placement, then inspect and listen to verify it. These commands are available through edit_project while the editor card is open.`,+Use update_cue, delete_cue and merge_cue for corrections. subtitles_add_track, subtitles_remove_track and subtitles_translate_track manage languages. set_caption_look controls appearance and words per cue; subtitles_set_view controls visibility. set_caption_emphasis sets one or two key words apart in a caption every few lines when the user asks for emphasis, and update_cue x/y gives one caption its own spot. Each tool's schema lists the current choices, and text-videos covers timed text layouts. align_to_audio measures timing against the mix.+For requested audio generation, list_voices supplies voice ids, voiceover_generate speaks a script, read_subtitles_aloud voices timed cues, and generate_music makes music. Generation spends credits. Read the result for asset ids and placement, then inspect and listen to verify it. These tools work while the editor card is open.`,"ai-generation": `# Finding and creating mediaStart with the user's project assets, attached files and links. import_media imports ChatGPT attachments or URLs into the cloud project. Poll a returned job with get_job_status, then use the asset ids in the completed result. Ask for missing footage or a reference when it is needed to fulfill the request.stock_search finds existing footage, images and sounds; stock_add imports a chosen result. Inspect the media before placing it. ChatGPT can plan a sequence from the supplied footage and use add_clip with blocks to mark missing shots for the user.-Available generation commands include generate_image, voiceover_generate, generate_music and create_sticker. Use them when the user requests generated media; they spend account credits. Read describe_commands for current options. Inspect returned asset ids and placement, and place an unplaced asset with add_clip or add_overlay_video when the user asked for it in the cut.-Use the commands returned by list_commands. When a requested operation is unavailable, explain the limit and ask the user to supply the required media or complete that step in Donkey Cut.`,+Available generation commands include generate_image, voiceover_generate, generate_music and create_sticker. Use them when the user requests generated media; they spend account credits. Each tool's schema lists current options. Inspect returned asset ids and placement, and place an unplaced asset with add_clip or add_overlay_video when the user asked for it in the cut.+When a requested operation is unavailable, explain the limit and ask the user to supply the required media or complete that step in Donkey Cut.`,"media-and-library": `# Media and Libraryinspect_project reports the open project's media. import_media brings files and links into it. add_clip and add_overlay_video place assets, replace_item changes an item's source, and file_asset files created media into Media or copies it to the Library. media_organize manages this project's folders and renames its files. convert_media converts project assets; read its result and inspect the updated assets before claiming completion.diff --git a/site/src/clients/chatgpt/server/mcp.test.ts b/site/src/clients/chatgpt/server/mcp.test.tsindex 805e7f19..8586cc64 100644--- a/site/src/clients/chatgpt/server/mcp.test.ts+++ b/site/src/clients/chatgpt/server/mcp.test.ts@@ -7,7 +7,7 @@ import {} from "@/clients/chatgpt/server/mcp";import { WIDGET_URI } from "@/clients/chatgpt/contracts";import type { projectTools, ProjectResult } from "@/clients/chatgpt/server/projects";-import { unknownCommandNames } from "@/clients/chatgpt/server/catalog";+import { COMMAND_NAMES, unknownCommandNames } from "@/clients/chatgpt/server/catalog";const config = SETTINGS.chatgptApp.schema.parse({...SETTINGS.chatgptApp.default,@@ -86,15 +86,12 @@ describe("ChatGPT MCP protocol", () => {["account_status","create_project",- "describe_commands",- "edit_project","export_video","get_export_status","get_job_status","get_preview_status","import_media","inspect_project",- "list_commands","list_projects","list_skills","open_project",@@ -102,8 +99,30 @@ describe("ChatGPT MCP protocol", () => {"redo","render_preview","undo",- ],+ ...COMMAND_NAMES,+ ].sort(),);++ // OpenAI's review needs every hint set explicitly, a read never+ // destructive, and each operation its own tool with its own schema.+ for (const tool of tools) {+ const hints = tool.annotations!;+ for (const hint of ["readOnlyHint", "destructiveHint", "idempotentHint", "openWorldHint"] as const) {+ expect(typeof hints[hint]).toBe("boolean");+ }+ if (hints.readOnlyHint) {+ expect(hints.destructiveHint).toBe(false);+ }+ expect(tool.description!.length).toBeGreaterThan(0);+ expect(JSON.stringify(tool.inputSchema)).not.toMatch(/"commands"/);+ }+ for (const name of ["delete_item", "delete_asset", "set_color_grade", "undo", "redo"]) {+ expect(tools.find((tool) => tool.name === name)?.annotations?.destructiveHint).toBe(true);+ }+ expect(tools.find((tool) => tool.name === "check_facts")?.annotations).toMatchObject({ readOnlyHint: true, openWorldHint: true });+ expect(tools.find((tool) => tool.name === "library_share")?.annotations).toMatchObject({ openWorldHint: true, destructiveHint: true });+ expect(tools.find((tool) => tool.name === "add_title")?.annotations).toMatchObject({ readOnlyHint: false, destructiveHint: false });+ expect(tools.find((tool) => tool.name === "trim_clip")?.inputSchema.required).toContain("projectId");expect(tools.find((tool) => tool.name === "import_media")?._meta).toMatchObject({"openai/fileParams": ["files"],});@@ -112,11 +131,6 @@ describe("ChatGPT MCP protocol", () => {destructiveHint: false,openWorldHint: true,});- expect(tools.find((tool) => tool.name === "edit_project")?.annotations).toMatchObject({- readOnlyHint: false,- destructiveHint: true,- openWorldHint: false,- });expect(tools.find((tool) => tool.name === "render_preview")?.annotations,).toMatchObject({@@ -205,8 +219,8 @@ test("render scope requests a reconnect through the MCP authentication challengeexpect(result.isError).toBe(true);expect(JSON.stringify(result._meta)).toContain("insufficient_scope");const edit = await client.callTool({- name: "edit_project",- arguments: { projectId: "project", commands: [{ name: "set_aspect", input: { aspect: "9:16" } }] },+ name: "set_aspect",+ arguments: { projectId: "project", aspect: "9:16" },});expect(edit.isError).toBe(true);expect(JSON.stringify(edit._meta)).toContain("projects:write");@@ -356,29 +370,31 @@ test("2025-era clients still initialize and read tools and widget resources stat}});-test("edit results reach the model as text and structure, and captured frames become image blocks", async () => {+test("each command is its own tool: writes edit, reads inspect, and captured frames become image blocks", async () => {const frame = "data:image/jpeg;base64,/9j/4AAQ";const edited: ProjectResult = {...data,- view: {- ...data.view,- changed: true,- results: [- { name: "set_aspect", ok: true, output: { aspect: "9:16" } },- { name: "capture_frame", ok: true, output: { image: frame, at: 1.5 } },- ],- },+ view: { ...data.view, changed: true, results: [{ name: "set_aspect", ok: true, output: { aspect: "9:16" } }] },+ playback: null,+ };+ const captured: ProjectResult = {+ ...data,+ view: { ...data.view, results: [{ name: "capture_frame", ok: true, output: { image: frame, at: 1.5 } }] },playback: null,};- let received: unknown = null;+ const received: unknown[] = [];const server = createChatgptServer({ userId: "owner", scopes: ["projects:read", "projects:write"], grantId: "grant" },config,fakeProjects({- edit: async (_projectId, commands, label) => {- received = { commands, label };+ edit: async (projectId, commands) => {+ received.push({ edit: projectId, commands });return edited;},+ inspect: async (projectId, commands) => {+ received.push({ inspect: projectId, commands });+ return captured;+ },}),);const client = new Client({ name: "test", version: "1" });@@ -386,39 +402,26 @@ test("edit results reach the model as text and structure, and captured frames beawait server.connect(serverTransport);await client.connect(clientTransport);try {- const result = await client.callTool({- name: "edit_project",- arguments: {- projectId: "project",- label: "Vertical cut",- commands: [{ name: "set_aspect", input: { aspect: "9:16" } }, { name: "capture_frame" }],- },- });- expect(received).toEqual({- commands: [- { name: "set_aspect", input: { aspect: "9:16" } },- { name: "capture_frame", input: {} },- ],- label: "Vertical cut",- });- const content = result.content as { type: string; text?: string; data?: string; mimeType?: string }[];- expect(content[0].text).toContain("2 commands ran; the project was saved");+ const write = await client.callTool({ name: "set_aspect", arguments: { projectId: "project", aspect: "9:16" } });+ expect((write.content as { text: string }[])[0].text).toContain("1 command ran; the project was saved");++ const read = await client.callTool({ name: "capture_frame", arguments: { projectId: "project", t: 1.5 } });+ expect(received).toEqual([+ { edit: "project", commands: [{ name: "set_aspect", input: { aspect: "9:16" } }] },+ { inspect: "project", commands: [{ name: "capture_frame", input: { t: 1.5 } }] },+ ]);+ const content = read.content as { type: string; text?: string; data?: string; mimeType?: string }[];expect(content[0].text).not.toContain("base64");expect(content[1]).toMatchObject({ type: "image", mimeType: "image/jpeg", data: "/9j/4AAQ" });- expect(JSON.stringify(result.structuredContent)).not.toContain("base64");+ expect(JSON.stringify(read.structuredContent)).not.toContain("base64");- const index = await client.callTool({ name: "list_commands", arguments: {} });- const commands = (index.structuredContent as { commands: { name: string; reads?: true }[] }).commands;- expect(commands.some((c) => c.name === "set_aspect")).toBe(true);- expect(commands.find((c) => c.name === "watch_video")?.reads).toBe(true);- expect(commands.some((c) => c.name === "get_state" || c.name === "undo" || c.name === "import_url")).toBe(false);- // inspect_project's default read passes the batch guard while staying out of the listing.+ // A schema violation never reaches the project.+ const invalid = await client.callTool({ name: "set_aspect", arguments: { projectId: "project", nope: 1 } });+ expect(invalid.isError).toBe(true);+ expect(received).toHaveLength(2);+ // inspect_project's default read passes the batch guard.expect(unknownCommandNames(["get_state", "set_aspect", "nope"])).toEqual(["nope"]);- const described = await client.callTool({ name: "describe_commands", arguments: { names: ["trim_clip", "nope"] } });- expect(described.structuredContent).toMatchObject({ unknown: ["nope"] });- expect((described.structuredContent as { commands: { name: string; inputSchema: object }[] }).commands[0].name).toBe("trim_clip");-const skill = await client.callTool({ name: "read_skill", arguments: { name: "timeline-editing" } });expect((skill.content as { text: string }[])[0].text).toContain("# Timeline editing");diff --git a/site/src/clients/chatgpt/server/mcp.ts b/site/src/clients/chatgpt/server/mcp.tsindex 71d74c4c..faee3fef 100644--- a/site/src/clients/chatgpt/server/mcp.ts+++ b/site/src/clients/chatgpt/server/mcp.ts@@ -1,4 +1,4 @@-import { createMcpHandler, McpServer } from "@modelcontextprotocol/server";+import { createMcpHandler, fromJsonSchema, McpServer } from "@modelcontextprotocol/server";import { z } from "zod";import {checkInMemoryRateLimit,@@ -10,13 +10,11 @@ import {type ProjectView,} from "@/clients/chatgpt/contracts";import {- commandIndex,- COMMAND_NAMES,- describeCommands,+ commandHints,+ COMMANDS,readSkill,SKILL_INDEX,} from "@/clients/chatgpt/server/catalog";-import { MAX_COMMANDS_PER_BATCH } from "@/cut/server/cloud/commands";import { DOC_EXPORT_PRESETS } from "@/cut/lib/exportPresets";import { CUT_LOUDNESS, LOUDNESS_CHOICES, LOUDNESS_IDS } from "@/cut/lib/loudnessSettings";import { formatCredits } from "@/lib/credits/format-credits";@@ -54,6 +52,8 @@ const editAnnotations = {openWorldHint: false,idempotentHint: false,};+// Undo and redo overwrite the document with another revision of it.+const historyAnnotations = { ...editAnnotations, destructiveHint: true };export const REPOSITORY_URL = "https://github.com/DonkeyCut/Donkey";@@ -62,19 +62,38 @@ export const REPOSITORY_URL = "https://github.com/DonkeyCut/Donkey";export const SERVER_INSTRUCTIONS = [`Donkey Cut is an open-source video editor (Apache 2.0, ${REPOSITORY_URL}). Edit the connected account's cloud projects: import footage, inspect it, cut it, caption it, preview, undo, export.`,"Editing, previews and exports are free. Hosted AI (voiceover, music, images, caption rewriting, transcription past the monthly allowance) spends the account's credits. Imports and exports use the account's cloud storage.",- "You plan the edit with the user and interpret the footage; Donkey Cut supplies media inspection, signal measurements and editing commands. Use the user's assets and references. Ask for missing files, links or creative decisions when they are needed to fulfill the request. Use list_commands and describe_commands as the capability and input contract, and read_skill for guidance tailored to this ChatGPT client.",- "Workflow: list_projects or create_project → open_project → import_media → inspect_project → list_commands once, describe_commands for the ones you need → edit_project (batches, one undo step each) → render_preview → undo/redo → export_video.",+ "You plan the edit with the user and interpret the footage; Donkey Cut supplies media inspection, signal measurements and editing tools. Use the user's assets and references. Ask for missing files, links or creative decisions when they are needed to fulfill the request. Read read_skill for guidance tailored to this ChatGPT client.",+ "Workflow: list_projects or create_project → open_project → import_media → inspect_project → editing tools (one undo step each) → render_preview → undo/redo → export_video.","Keep the existing editor card for the whole editing session. Its undo history belongs to that card. Call open_project only to open a project initially, switch projects, or recover a missing card. After editing, the existing card shows the changes; use render_preview and get_preview_status to verify the saved preview. Reopening the project creates a fresh editor with empty history.",- "Every edit runs inside the Donkey Cut editor in the card, on the document the user is looking at: open_project puts that editor in the card, timeline and panels included, when the connection can edit, and edit_project, inspect_project, import_media, undo and redo answer that no card is open until it is. A read-only connection sees the current preview playing. Call render_preview only after an edit or when the card reports no current preview.",+ "Every edit runs inside the Donkey Cut editor in the card, on the document the user is looking at: open_project puts that editor in the card, timeline and panels included, when the connection can edit, and the editing and inspection tools, import_media, undo and redo answer that no card is open until it is. A read-only connection sees the current preview playing. Call render_preview only after an edit or when the card reports no current preview.","If the editor shows Reconnect, ask the user to click it to renew the embedded session and reload the editor in ChatGPT. If a tool reports no card open, ask the user to open the project card and keep it open, then resume when it is ready. When the catalog lacks an operation, explain the limit and ask for the required media or a user action in Donkey Cut.",- "Inspect before editing. Watch and listen to the relevant media before content-based cuts; use silence, beat, level and color measurements for timing and adjustments. Commands marked reads run through inspect_project; observations saved with note_source and other writes run through edit_project. Verify changes with the returned state, frames and audio, and give the user a preview to review. Claim only coverage and completed work confirmed by tool results.",- "Times are seconds; ids come from inspect_project. A batch stops at its first failed command. A tool that answers with a job still running is finished by get_job_status.",+ "Inspect before editing. Watch and listen to the relevant media before content-based cuts; use silence, beat, level and color measurements for timing and adjustments. Save observations with note_source. Verify changes with the returned state, frames and audio, and give the user a preview to review. Claim only coverage and completed work confirmed by tool results.",+ "Times are seconds; ids come from inspect_project. A tool that answers with a job still running is finished by get_job_status.",].join("\n");-const commandSchema = z.object({- name: z.string().min(1).max(64).describe(`A command from list_commands: one of ${COMMAND_NAMES.join(", ")}`),- input: z.record(z.string(), z.unknown()).optional().describe("The command's input, per describe_commands"),-});+/** An editor command as its own tool: the command's schema plus the project+ * it runs on. Validators compile once per process, outside any request. */+type CommandTool = { name: string; title: string; description: string; inputSchema: ReturnType<typeof fromJsonSchema<Record<string, unknown>>> };+let commandTools: CommandTool[] | null = null;++function listCommandTools(): CommandTool[] {+ commandTools ??= COMMANDS.map((command) => {+ const schema = command.inputSchema as { properties?: Record<string, unknown>; required?: string[] };+ return {+ name: command.name,+ title: command.name.charAt(0).toUpperCase() + command.name.slice(1).replaceAll("_", " "),+ description: command.description,+ inputSchema: fromJsonSchema<Record<string, unknown>>({+ ...schema,+ type: "object",+ properties: { projectId: { type: "string", minLength: 1, maxLength: 128, description: "The cloud project's id" }, ...schema.properties },+ required: ["projectId", ...(schema.required ?? [])],+ }),+ };+ });+ return commandTools;+}+/** A file ChatGPT attaches to a call (openai/fileParams). */const fileSchema = z.object({download_url: z.url(),@@ -131,7 +150,7 @@ export function createChatgptServer(t: ChatgptTranslator = ENGLISH,) {const server = new McpServer(- { name: "donkey-cut", title: "Donkey Cut", version: "1.1.0" },+ { name: "donkey-cut", title: "Donkey Cut", version: "1.2.0" },{ instructions: SERVER_INSTRUCTIONS },);const readMetadata = {@@ -277,7 +296,7 @@ export function createChatgptServer({title: "Import footage into a project",description:- "Bring footage into a cloud project: files the user attached to the chat (files), or links (urls) — TikTok, YouTube, Instagram, an X post, a web page, or a direct video/audio/image link. Every file lands as a project asset with an assetId for edit_project's add_clip. Free; the bytes use the account's cloud storage. A long download can outlast this call — then the answer carries a job to finish with get_job_status. audio_only keeps just the soundtrack of a link.",+ "Bring footage into a cloud project: files the user attached to the chat (files), or links (urls) — TikTok, YouTube, Instagram, an X post, a web page, or a direct video/audio/image link. Every file lands as a project asset with an assetId for add_clip. Free; the bytes use the account's cloud storage. A long download can outlast this call — then the answer carries a job to finish with get_job_status. audio_only keeps just the soundtrack of a link.",inputSchema: z.object({projectId: idSchema,files: z.array(fileSchema).max(10).optional().describe("Files attached in ChatGPT"),@@ -306,66 +325,20 @@ export function createChatgptServer({title: "Inspect a project",description:- "Read a project's full editor state — media assets with ids, durations, transcripts and notes; the video tracks with clip ids, trims and gaps; soundtrack, titles, captions, aspect. Call it before editing and after an edit_project you want to verify. Pass commands to run read-only inspection commands instead (watch_video for contact sheets of the footage, capture_frame for the composited picture at a time, detect_silence, listen_audio, detect_beats — list_commands marks them reads). Free.",- inputSchema: z.object({- projectId: idSchema,- commands: z.array(commandSchema).max(MAX_COMMANDS_PER_BATCH).optional(),- }),+ "Read a project's full editor state — media assets with ids, durations, transcripts and notes; the video tracks with clip ids, trims and gaps; soundtrack, titles, captions, aspect. Call it before editing and after an edit you want to verify. Free.",+ inputSchema: z.object({ projectId: idSchema }),outputSchema: viewSchema,annotations: readOnlyAnnotations,_meta: { ...readMetadata, ...status("inspectProject") },},- ({ projectId, commands }) => runTool(() => projects.inspect(projectId, commands?.map((c) => ({ name: c.name, input: c.input ?? {} })))),- );-- server.registerTool(- "list_commands",- {- title: "List editing commands",- description:- "The catalog of editing commands edit_project runs, one line each. Call it once per conversation, then describe_commands for the input schemas of the ones you will use.",- inputSchema: z.object({}),- outputSchema: z.object({ commands: z.array(z.object({ name: z.string(), summary: z.string(), reads: z.literal(true).optional() })) }),- annotations: readOnlyAnnotations,- _meta: { ...readMetadata, ...status("listCommands") },- },- () => {- const commands = commandIndex();- return {- content: [{ type: "text" as const, text: commands.map((c) => `${c.name}${c.reads ? " (read)" : ""}: ${c.summary}`).join("\n") }],- structuredContent: { commands },- };- },- );-- server.registerTool(- "describe_commands",- {- title: "Describe editing commands",- description: "Full descriptions and JSON input schemas for named commands from list_commands.",- inputSchema: z.object({ names: z.array(z.string().min(1).max(64)).min(1).max(20) }),- outputSchema: z.object({- commands: z.array(z.object({ name: z.string(), description: z.string(), inputSchema: z.record(z.string(), z.unknown()) })),- unknown: z.array(z.string()),- }),- annotations: readOnlyAnnotations,- _meta: { ...readMetadata, ...status("describeCommands") },- },- ({ names }) => {- const { found, unknown } = describeCommands(names);- const commands = found.map(({ name, description, inputSchema }) => ({ name, description, inputSchema }));- return {- content: [{ type: "text" as const, text: JSON.stringify({ commands, unknown }) }],- structuredContent: { commands, unknown },- };- },+ ({ projectId }) => runTool(() => projects.inspect(projectId)),);server.registerTool("list_skills",{title: "List editing guides",- description: "Guides for Donkey Cut in ChatGPT: the editor-card workflow, watching and listening, signal measurements, timeline editing, captions, transitions, graphics, audio and export. Read one with read_skill before working in an unfamiliar area. Available commands and inputs come from list_commands and describe_commands.",+ description: "Guides for Donkey Cut in ChatGPT: the editor-card workflow, watching and listening, signal measurements, timeline editing, captions, transitions, graphics, audio and export. Read one with read_skill before working in an unfamiliar area.",inputSchema: z.object({}),outputSchema: z.object({ skills: z.array(z.string()) }),annotations: readOnlyAnnotations,@@ -381,7 +354,7 @@ export function createChatgptServer("read_skill",{title: "Read an editing guide",- description: "Read a ChatGPT editing guide from list_skills. Commands marked reads run through inspect_project; commands that write run through edit_project.",+ description: "Read a ChatGPT editing guide from list_skills.",inputSchema: z.object({ name: z.string().min(1).max(64) }),outputSchema: z.object({ name: z.string(), guide: z.string() }),annotations: readOnlyAnnotations,@@ -394,33 +367,40 @@ export function createChatgptServer(},);- server.registerTool(- "edit_project",- {- title: "Edit a project",- description:- "Run editing commands on a cloud project, in order, as one undo step in the editor open in the card. Commands come from list_commands with inputs per describe_commands; ids and times come from inspect_project. The batch stops at the first command that fails and reports every outcome. label names the step for undo. Editing is free; commands that generate media (voiceover_generate, generate_music, generate_image, captions_generate) spend the account's credits.",- inputSchema: z.object({- projectId: idSchema,- commands: z.array(commandSchema).min(1).max(MAX_COMMANDS_PER_BATCH),- label: z.string().max(80).optional().describe("What this step does, e.g. \"Cut to 30s and add captions\""),- }),- outputSchema: viewSchema,- annotations: { ...editAnnotations, destructiveHint: true },- _meta: { ...editMetadata, ...status("editProject") },- },- ({ projectId, commands, label }) =>- editing(() => runTool(() => projects.edit(projectId, commands.map((c) => ({ name: c.name, input: c.input ?? {} })), label))),- );+ // Every editor command is its own tool, annotated by what it does. A read+ // runs without saving; a write is one undo step in the card's editor. The+ // project view they answer with goes undeclared: a copy of its schema per+ // command would double the tool listing.+ for (const command of listCommandTools()) {+ const hints = commandHints(command.name);+ const reads = hints.readOnlyHint;+ server.registerTool(+ command.name,+ {+ title: command.title,+ description: command.description,+ inputSchema: command.inputSchema,+ annotations: hints,+ _meta: reads ? { ...readMetadata, ...status("inspectProject") } : { ...editMetadata, ...status("editProject") },+ },+ ({ projectId, ...input }) => {+ const call = [{ name: command.name, input }];+ const id = String(projectId);+ return reads+ ? runTool(() => projects.inspect(id, call))+ : editing(() => runTool(() => projects.edit(id, call)));+ },+ );+ }server.registerTool("undo",{title: "Undo the last edit",- description: "Undo the last step in the editor open in the card, the same as ⌘Z there: edit_project batches, imports and the user's own edits share one history.",+ description: "Undo the last step in the editor open in the card, the same as ⌘Z there: ChatGPT's edits, imports and the user's own edits share one history.",inputSchema: z.object({ projectId: idSchema }),outputSchema: viewSchema,- annotations: editAnnotations,+ annotations: historyAnnotations,_meta: { ...editMetadata, ...status("undo") },},({ projectId }) => editing(() => runTool(() => projects.undo(projectId))),@@ -433,7 +413,7 @@ export function createChatgptServer(description: "Re-apply the step the last undo reverted, in the editor open in the card.",inputSchema: z.object({ projectId: idSchema }),outputSchema: viewSchema,- annotations: editAnnotations,+ annotations: historyAnnotations,_meta: { ...editMetadata, ...status("redo") },},({ projectId }) => editing(() => runTool(() => projects.redo(projectId))),@@ -476,7 +456,7 @@ export function createChatgptServer("get_job_status",{title: "Check a job",- description: "Finish a call that answered with a running job (an import, an edit batch, an export): read its progress and, once done, its results.",+ description: "Finish a call that answered with a running job (an import, an edit, an export): read its progress and, once done, its results.",inputSchema: z.object({ jobId: idSchema }),outputSchema: viewSchema,annotations: readOnlyAnnotations,diff --git a/site/src/clients/chatgpt/server/projects.ts b/site/src/clients/chatgpt/server/projects.tsindex ec3edfa3..0543512b 100644--- a/site/src/clients/chatgpt/server/projects.ts+++ b/site/src/clients/chatgpt/server/projects.ts@@ -362,7 +362,7 @@ export function projectTools(await getOwnedProject(projectId);const unknown = unknownCommandNames(commands.map((c) => c.name));if (unknown.length)- throw new ProjectToolError(`Unknown command${unknown.length > 1 ? "s" : ""}: ${unknown.join(", ")}. Call list_commands for the catalog.`);+ throw new ProjectToolError(`Unknown command${unknown.length > 1 ? "s" : ""}: ${unknown.join(", ")}.`);const queued = await queueCommands(identity.userId, projectId, { commands, ...opts });if (queued instanceof Response) return refusal(queued);const row = await waitForJob(identity.userId, queued.id, config.commandWaitMs, { editorClaimMs: config.editorClaimMs });@@ -463,7 +463,7 @@ export function projectTools(const calls = commands?.length ? commands : [{ name: "get_state", input: {} }];const writes = calls.filter((c) => c.name !== "get_state" && !READ_COMMANDS.has(c.name)).map((c) => c.name);if (writes.length)- throw new ProjectToolError(`inspect_project runs reads only; ${writes.join(", ")} edit the project — send them through edit_project.`);+ throw new ProjectToolError(`Inspection runs reads only; ${writes.join(", ")} edit the project.`);return runBatch(projectId, calls, { readOnly: true });},diff --git a/site/src/i18n/messages/.source-lock.json b/site/src/i18n/messages/.source-lock.jsonindex 4056411a..d0d19657 100644--- a/site/src/i18n/messages/.source-lock.json+++ b/site/src/i18n/messages/.source-lock.json@@ -268,10 +268,6 @@"status.importMedia.invoked": "159eb8c93661","status.inspectProject.invoking": "a6d446d35752","status.inspectProject.invoked": "aeacc708948b",- "status.listCommands.invoking": "031fb216ccee",- "status.listCommands.invoked": "190ee02994af",- "status.describeCommands.invoking": "23e248d1aae3",- "status.describeCommands.invoked": "aa5b8279487a","status.listSkills.invoking": "0d09acb4ecdd","status.listSkills.invoked": "7c792e75f376","status.readSkill.invoking": "33ec6a6d828b",@@ -3298,10 +3294,6 @@"status.importMedia.invoked": "159eb8c93661","status.inspectProject.invoking": "a6d446d35752","status.inspectProject.invoked": "aeacc708948b",- "status.listCommands.invoking": "031fb216ccee",- "status.listCommands.invoked": "190ee02994af",- "status.describeCommands.invoking": "23e248d1aae3",- "status.describeCommands.invoked": "aa5b8279487a","status.listSkills.invoking": "0d09acb4ecdd","status.listSkills.invoked": "7c792e75f376","status.readSkill.invoking": "33ec6a6d828b",@@ -6328,10 +6320,6 @@"status.importMedia.invoked": "159eb8c93661","status.inspectProject.invoking": "a6d446d35752","status.inspectProject.invoked": "aeacc708948b",- "status.listCommands.invoking": "031fb216ccee",- "status.listCommands.invoked": "190ee02994af",- "status.describeCommands.invoking": "23e248d1aae3",- "status.describeCommands.invoked": "aa5b8279487a","status.listSkills.invoking": "0d09acb4ecdd","status.listSkills.invoked": "7c792e75f376","status.readSkill.invoking": "33ec6a6d828b",@@ -9358,10 +9346,6 @@"status.importMedia.invoked": "159eb8c93661","status.inspectProject.invoking": "a6d446d35752","status.inspectProject.invoked": "aeacc708948b",- "status.listCommands.invoking": "031fb216ccee",- "status.listCommands.invoked": "190ee02994af",- "status.describeCommands.invoking": "23e248d1aae3",- "status.describeCommands.invoked": "aa5b8279487a","status.listSkills.invoking": "0d09acb4ecdd","status.listSkills.invoked": "7c792e75f376","status.readSkill.invoking": "33ec6a6d828b",@@ -12388,10 +12372,6 @@"status.importMedia.invoked": "159eb8c93661","status.inspectProject.invoking": "a6d446d35752","status.inspectProject.invoked": "aeacc708948b",- "status.listCommands.invoking": "031fb216ccee",- "status.listCommands.invoked": "190ee02994af",- "status.describeCommands.invoking": "23e248d1aae3",- "status.describeCommands.invoked": "aa5b8279487a","status.listSkills.invoking": "0d09acb4ecdd","status.listSkills.invoked": "7c792e75f376","status.readSkill.invoking": "33ec6a6d828b",@@ -15418,10 +15398,6 @@"status.importMedia.invoked": "159eb8c93661","status.inspectProject.invoking": "a6d446d35752","status.inspectProject.invoked": "aeacc708948b",- "status.listCommands.invoking": "031fb216ccee",- "status.listCommands.invoked": "190ee02994af",- "status.describeCommands.invoking": "23e248d1aae3",- "status.describeCommands.invoked": "aa5b8279487a","status.listSkills.invoking": "0d09acb4ecdd","status.listSkills.invoked": "7c792e75f376","status.readSkill.invoking": "33ec6a6d828b",@@ -18448,10 +18424,6 @@"status.importMedia.invoked": "159eb8c93661","status.inspectProject.invoking": "a6d446d35752","status.inspectProject.invoked": "aeacc708948b",- "status.listCommands.invoking": "031fb216ccee",- "status.listCommands.invoked": "190ee02994af",- "status.describeCommands.invoking": "23e248d1aae3",- "status.describeCommands.invoked": "aa5b8279487a","status.listSkills.invoking": "0d09acb4ecdd","status.listSkills.invoked": "7c792e75f376","status.readSkill.invoking": "33ec6a6d828b",diff --git a/site/src/i18n/messages/de/chatgpt.json b/site/src/i18n/messages/de/chatgpt.jsonindex cf7adfb7..7ba9d9db 100644--- a/site/src/i18n/messages/de/chatgpt.json+++ b/site/src/i18n/messages/de/chatgpt.json@@ -48,14 +48,6 @@"invoking": "Projekt wird gelesen","invoked": "Projekt gelesen"},- "listCommands": {- "invoking": "Befehle werden aufgelistet",- "invoked": "Befehle aufgelistet"- },- "describeCommands": {- "invoking": "Befehle werden beschrieben",- "invoked": "Befehle beschrieben"- },"listSkills": {"invoking": "Anleitungen werden aufgelistet","invoked": "Anleitungen aufgelistet"diff --git a/site/src/i18n/messages/en/chatgpt.json b/site/src/i18n/messages/en/chatgpt.jsonindex 5c17eadc..ef56fdd8 100644--- a/site/src/i18n/messages/en/chatgpt.json+++ b/site/src/i18n/messages/en/chatgpt.json@@ -39,8 +39,6 @@"createProject": { "invoking": "Creating the project", "invoked": "Project created" },"importMedia": { "invoking": "Importing footage", "invoked": "Footage imported" },"inspectProject": { "invoking": "Reading the project", "invoked": "Project read" },- "listCommands": { "invoking": "Listing commands", "invoked": "Commands listed" },- "describeCommands": { "invoking": "Describing commands", "invoked": "Commands described" },"listSkills": { "invoking": "Listing guides", "invoked": "Guides listed" },"readSkill": { "invoking": "Reading the guide", "invoked": "Guide read" },"editProject": { "invoking": "Editing the project", "invoked": "Project edited" },diff --git a/site/src/i18n/messages/es/chatgpt.json b/site/src/i18n/messages/es/chatgpt.jsonindex a7719d9b..bb98400f 100644--- a/site/src/i18n/messages/es/chatgpt.json+++ b/site/src/i18n/messages/es/chatgpt.json@@ -48,14 +48,6 @@"invoking": "Leyendo el proyecto","invoked": "Proyecto leído"},- "listCommands": {- "invoking": "Listando comandos",- "invoked": "Comandos listados"- },- "describeCommands": {- "invoking": "Describiendo comandos",- "invoked": "Comandos descritos"- },"listSkills": {"invoking": "Listando guías","invoked": "Guías listadas"diff --git a/site/src/i18n/messages/fr/chatgpt.json b/site/src/i18n/messages/fr/chatgpt.jsonindex 3d8eee79..76359fc8 100644--- a/site/src/i18n/messages/fr/chatgpt.json+++ b/site/src/i18n/messages/fr/chatgpt.json@@ -48,14 +48,6 @@"invoking": "Lecture du projet","invoked": "Projet lu"},- "listCommands": {- "invoking": "Création de la liste des commandes",- "invoked": "Commandes listées"- },- "describeCommands": {- "invoking": "Description des commandes",- "invoked": "Commandes décrites"- },"listSkills": {"invoking": "Création de la liste des guides","invoked": "Guides listés"diff --git a/site/src/i18n/messages/ja/chatgpt.json b/site/src/i18n/messages/ja/chatgpt.jsonindex 2b338622..f70f6dde 100644--- a/site/src/i18n/messages/ja/chatgpt.json+++ b/site/src/i18n/messages/ja/chatgpt.json@@ -48,14 +48,6 @@"invoking": "プロジェクトを読み込み中","invoked": "プロジェクトを読み込みました"},- "listCommands": {- "invoking": "コマンド一覧を取得中",- "invoked": "コマンド一覧を取得しました"- },- "describeCommands": {- "invoking": "コマンドの説明を取得中",- "invoked": "コマンドの説明を取得しました"- },"listSkills": {"invoking": "ガイド一覧を取得中","invoked": "ガイド一覧を取得しました"diff --git a/site/src/i18n/messages/ko/chatgpt.json b/site/src/i18n/messages/ko/chatgpt.jsonindex 60e5e64b..58af0898 100644--- a/site/src/i18n/messages/ko/chatgpt.json+++ b/site/src/i18n/messages/ko/chatgpt.json@@ -48,14 +48,6 @@"invoking": "프로젝트 읽는 중","invoked": "프로젝트 읽기 완료"},- "listCommands": {- "invoking": "명령어 목록 조회 중",- "invoked": "명령어 목록 조회 완료"- },- "describeCommands": {- "invoking": "명령어 설명 중",- "invoked": "명령어 설명 완료"- },"listSkills": {"invoking": "가이드 목록 조회 중","invoked": "가이드 목록 조회 완료"diff --git a/site/src/i18n/messages/pt-BR/chatgpt.json b/site/src/i18n/messages/pt-BR/chatgpt.jsonindex c043e134..869c4756 100644--- a/site/src/i18n/messages/pt-BR/chatgpt.json+++ b/site/src/i18n/messages/pt-BR/chatgpt.json@@ -48,14 +48,6 @@"invoking": "Lendo o projeto","invoked": "Projeto lido"},- "listCommands": {- "invoking": "Listando comandos",- "invoked": "Comandos listados"- },- "describeCommands": {- "invoking": "Descrevendo comandos",- "invoked": "Comandos descritos"- },"listSkills": {"invoking": "Listando guias","invoked": "Guias listados"diff --git a/site/src/i18n/messages/zh-CN/chatgpt.json b/site/src/i18n/messages/zh-CN/chatgpt.jsonindex 440ab6d2..3d56232c 100644--- a/site/src/i18n/messages/zh-CN/chatgpt.json+++ b/site/src/i18n/messages/zh-CN/chatgpt.json@@ -48,14 +48,6 @@"invoking": "正在读取项目","invoked": "项目已读取"},- "listCommands": {- "invoking": "正在列出命令",- "invoked": "命令已列出"- },- "describeCommands": {- "invoking": "正在描述命令",- "invoked": "命令已描述"- },"listSkills": {"invoking": "正在列出指南","invoked": "指南已列出"