@engenty/wizards-runtime 0.11.5 → 0.11.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/apps/runtime/dist/agents/architect.js +40 -55
  2. package/apps/runtime/dist/agents/chat-clients.js +3 -0
  3. package/apps/runtime/dist/agents/company.js +4 -12
  4. package/apps/runtime/dist/agents/studio-assistant.js +82 -74
  5. package/apps/runtime/dist/agents/subscription.js +27 -17
  6. package/apps/runtime/dist/assistant/knows.js +19 -19
  7. package/apps/runtime/dist/auth/account.js +51 -12
  8. package/apps/runtime/dist/auth/index.js +15 -2
  9. package/apps/runtime/dist/authoring/guide.js +20 -447
  10. package/apps/runtime/dist/browser/fast/run.js +18 -12
  11. package/apps/runtime/dist/cli/account.js +127 -10
  12. package/apps/runtime/dist/cli/main.js +4 -2
  13. package/apps/runtime/dist/connectors/mail.js +4 -3
  14. package/apps/runtime/dist/data/chat-models.json +116 -0
  15. package/apps/runtime/dist/docs/user-guide/models.md +15 -5
  16. package/apps/runtime/dist/documents/parse.js +5 -14
  17. package/apps/runtime/dist/engine/decide.js +2 -1
  18. package/apps/runtime/dist/engine/runner.js +4 -3
  19. package/apps/runtime/dist/engine/steps.js +82 -91
  20. package/apps/runtime/dist/engine/template.js +2 -3
  21. package/apps/runtime/dist/env.js +5 -0
  22. package/apps/runtime/dist/harness/antigravity.js +2 -2
  23. package/apps/runtime/dist/harness/apple.js +4 -6
  24. package/apps/runtime/dist/harness/codex.js +5 -6
  25. package/apps/runtime/dist/harness/prompt.js +8 -8
  26. package/apps/runtime/dist/mcp/handler.js +5 -7
  27. package/apps/runtime/dist/mcp/tools.js +33 -54
  28. package/apps/runtime/dist/media/conversation.js +18 -23
  29. package/apps/runtime/dist/media/generate.js +18 -3
  30. package/apps/runtime/dist/media/transcribe.js +5 -4
  31. package/apps/runtime/dist/models.js +8 -9
  32. package/apps/runtime/dist/motion-graphics/project.js +19 -53
  33. package/apps/runtime/dist/motion-graphics/sounds.js +2 -1
  34. package/apps/runtime/dist/motion-graphics/step.js +31 -16
  35. package/apps/runtime/dist/prompts/README.md +48 -0
  36. package/apps/runtime/dist/prompts/architect.md +89 -0
  37. package/apps/runtime/dist/prompts/authoring.md +503 -0
  38. package/apps/runtime/dist/prompts/goose.md +229 -0
  39. package/apps/runtime/dist/prompts/mcp.md +156 -0
  40. package/apps/runtime/dist/prompts/safety.md +23 -0
  41. package/apps/runtime/dist/prompts/services.md +151 -0
  42. package/apps/runtime/dist/prompts/step.md +334 -0
  43. package/apps/runtime/dist/prompts/tools.md +330 -0
  44. package/apps/runtime/dist/prompts/voice.md +53 -0
  45. package/apps/runtime/dist/prompts.js +50 -0
  46. package/apps/runtime/dist/routes/studio.js +58 -7
  47. package/apps/runtime/dist/safety.js +45 -0
  48. package/apps/runtime/dist/sandbox/index.js +8 -3
  49. package/apps/runtime/dist/services/architect.js +5 -4
  50. package/apps/runtime/dist/services/assistant-chats.js +5 -8
  51. package/apps/runtime/dist/services/brand.js +2 -7
  52. package/apps/runtime/dist/services/chat-models.js +58 -0
  53. package/apps/runtime/dist/services/cloud.js +8 -4
  54. package/apps/runtime/dist/services/knowledge-model.js +17 -8
  55. package/apps/runtime/dist/services/knowledge.js +5 -9
  56. package/apps/runtime/dist/services/project-files.js +3 -8
  57. package/apps/runtime/dist/services/relevance.js +4 -3
  58. package/apps/runtime/dist/services/runs.js +6 -7
  59. package/apps/runtime/dist/services/site.js +2 -2
  60. package/apps/runtime/dist/services/translations.js +17 -10
  61. package/apps/runtime/dist/services/wizards.js +8 -0
  62. package/apps/runtime/dist/sync/client.js +116 -1
  63. package/apps/runtime/dist/tools/browser.js +36 -33
  64. package/apps/runtime/dist/tools/code.js +20 -6
  65. package/apps/runtime/dist/tools/connector.js +23 -9
  66. package/apps/runtime/dist/tools/index.js +14 -11
  67. package/apps/runtime/dist/tools/mail.js +5 -5
  68. package/apps/runtime/dist/tools/net-guard.js +4 -4
  69. package/apps/runtime/dist/tools/pages.js +3 -2
  70. package/apps/runtime/dist/tools/project.js +7 -8
  71. package/apps/runtime/dist/tools/store.js +14 -10
  72. package/apps/web/dist/assets/{AboutDialog-B525L37O.js → AboutDialog-J9rRhJTJ.js} +1 -1
  73. package/apps/web/dist/assets/{ChangelogDialog-gInSm1Xe.js → ChangelogDialog-D9bBSuLQ.js} +1 -1
  74. package/apps/web/dist/assets/{CodeEditor-C0TmdCrb.js → CodeEditor-CiRJjYpm.js} +1 -1
  75. package/apps/web/dist/assets/{EditorPage-7t3vhZi6.js → EditorPage-ChLV09jO.js} +1 -1
  76. package/apps/web/dist/assets/{FlowPreview-BBN-APkG.js → FlowPreview-QRnLE4JM.js} +1 -1
  77. package/apps/web/dist/assets/{Harness-fAoC908y.js → Harness-dM1CDgnx.js} +1 -1
  78. package/apps/web/dist/assets/Marketplace-8rU-MhWj.js +2 -0
  79. package/apps/web/dist/assets/{NewWizardChannels-X32lBGMf.js → NewWizardChannels--JqgVT-t.js} +1 -1
  80. package/apps/web/dist/assets/{NewWizardPage-DMoqDhsh.js → NewWizardPage-CNv5UuBn.js} +1 -1
  81. package/apps/web/dist/assets/{OnboardingPage-BjZy-bhI.js → OnboardingPage-CDuhfBEI.js} +1 -1
  82. package/apps/web/dist/assets/{PreviewPane-Bt-ForJG.js → PreviewPane-BsMrHW8b.js} +2 -2
  83. package/apps/web/dist/assets/{ProjectPage-B5a-nod-.js → ProjectPage-CoVMEoB1.js} +1 -1
  84. package/apps/web/dist/assets/{PublicRunner-Cq_XzX54.js → PublicRunner-Ckte5NnM.js} +1 -1
  85. package/apps/web/dist/assets/{ReadOnly-DX3beZJz.js → ReadOnly-Ch-ss9Mh.js} +1 -1
  86. package/apps/web/dist/assets/SettingsPage-CGp6G_fp.js +2 -0
  87. package/apps/web/dist/assets/{SetupPage-BI9bgEkI.js → SetupPage-DgFT_646.js} +1 -1
  88. package/apps/web/dist/assets/{SharePage-Ch-1oLBs.js → SharePage-CEcFKE3b.js} +1 -1
  89. package/apps/web/dist/assets/changelog-DMhLfQmS.js +1 -0
  90. package/apps/web/dist/assets/i18n-AXoEWXfv.js +55 -0
  91. package/apps/web/dist/assets/index-BYZBN0xx.css +1 -0
  92. package/apps/web/dist/assets/index-Dx7qMiM3.js +34 -0
  93. package/apps/web/dist/assets/{oss-credits-CZT1KRIp.js → oss-credits-Da4KrYmP.js} +1 -1
  94. package/apps/web/dist/assets/{phone-DxC6eM6O.js → phone-De-HF0g7.js} +1 -1
  95. package/apps/web/dist/assets/{runners-SQHfvvNQ.js → runners-UIPj9xyX.js} +1 -1
  96. package/apps/web/dist/assets/{session-4CTNIlai.js → session-DUxZmhqy.js} +1 -1
  97. package/apps/web/dist/assets/{settings-menu-B0af5EBE.js → settings-menu-Bo1yXMGF.js} +1 -1
  98. package/apps/web/dist/assets/{theme-mtamawa_.js → theme-CSuPPxre.js} +1 -1
  99. package/apps/web/dist/assets/ui-CBDsXUoA.js +83 -0
  100. package/apps/web/dist/assets/{upload-DXJQU2lL.js → upload-CZgdEF60.js} +1 -1
  101. package/apps/web/dist/assets/{useMutation-DwRYrG3V.js → useMutation-ZHWqRSPd.js} +1 -1
  102. package/apps/web/dist/assets/{volume-2-CYbbBiXP.js → volume-2-c641MxaU.js} +1 -1
  103. package/apps/web/dist/assets/{wrench-D8lG2BH7.js → wrench-DCEAyYuR.js} +1 -1
  104. package/apps/web/dist/index.html +8 -9
  105. package/apps/web/dist/mcp/flow.html +87 -87
  106. package/node_modules/@engenty/wizards-shared/dist/assistant.d.ts +1 -0
  107. package/node_modules/@engenty/wizards-shared/dist/assistant.js +2 -0
  108. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +6 -0
  109. package/node_modules/@engenty/wizards-shared/dist/run.js +12 -0
  110. package/node_modules/@engenty/wizards-shared/dist/surface.d.ts +0 -2
  111. package/node_modules/@engenty/wizards-shared/dist/surface.js +0 -29
  112. package/node_modules/@engenty/wizards-shared/dist/sync.d.ts +5 -0
  113. package/package.json +2 -2
  114. package/plugin/.claude-plugin/plugin.json +1 -1
  115. package/plugin/plugin.json +1 -1
  116. package/apps/runtime/dist/assistant/primer.js +0 -26
  117. package/apps/web/dist/assets/Marketplace-CotMMcJ-.js +0 -2
  118. package/apps/web/dist/assets/SettingsPage-DPuwA3QL.js +0 -2
  119. package/apps/web/dist/assets/changelog-BlJc9UFS.js +0 -1
  120. package/apps/web/dist/assets/coins-D_yN56kT.js +0 -1
  121. package/apps/web/dist/assets/i18n-Dy3fTQM3.js +0 -55
  122. package/apps/web/dist/assets/index-Dt1Ps3ge.js +0 -34
  123. package/apps/web/dist/assets/index-rX7eCvWh.css +0 -1
  124. package/apps/web/dist/assets/ui-CL8v8Goa.js +0 -83
@@ -9,6 +9,8 @@ import { logoSectionLine, renderTemplate, resolveRef } from "../engine/template.
9
9
  import { env } from "../env.js";
10
10
  import { getBlob } from "../files/blobs.js";
11
11
  import { extFor, loadAsset } from "../files/storage.js";
12
+ import { prompt } from "../prompts.js";
13
+ import { contentPolicy } from "../safety.js";
12
14
  import { projectFileContent } from "../services/project-files.js";
13
15
  import { placeSkills } from "./skills.js";
14
16
  import { soundCatalog } from "./sounds.js";
@@ -54,59 +56,16 @@ async function put(root, rel, data) {
54
56
  const safeName = (name) => name.replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "file";
55
57
  /** Where the client starts, by how video/ began. */
56
58
  function startRules(start) {
57
- if (start === "base") {
58
- return `- **What to make:** BRIEF.md. **Start here:** video/ is already the wizard's base project in this
59
- format — read video/PARTS.md first: its scene templates carry the look. Compose the video from them in
60
- the one file PARTS.md names, timed to the voice; write a new scene only where no template fits, then
61
- in the style of showcase/ (SHOWCASE.md says how each technique is made).
62
- - **The brand:** video/brand/ holds brand.json and the logos. If video/brand/theme.json is missing, make
63
- it first as video/BRAND.md says — it is kept for the next videos of this space, so get it right.
64
- Colours, logo and fonts come from there only.
65
- `;
66
- }
67
- if (start === "from") {
68
- return `- **What to make:** BRIEF.md. **Start here:** video/ holds a finished video of this run in another
69
- format. Lay it out for this one: scenes, timing, words and sound stay; only the layout changes
70
- (video/PARTS.md says how when it exists). The look is showcase/'s.
71
- - **The brand:** video/brand/ when it is there, else brand/brand.json and brand/logos/ — colours, logo
72
- and fonts come from there only.
73
- `;
74
- }
75
- return `- **What to make:** BRIEF.md. **The bar:** showcase/ (read showcase/SHOWCASE.md and showcase/frame.md
76
- first when it exists, look at its stills, reuse its helpers from showcase/assets/). **The brand:**
77
- brand/brand.json and brand/logos/ — colours, logo and fonts come from there only.
78
- `;
59
+ return prompt("step", `motion.start.${start}`);
79
60
  }
80
61
  function rules(step, skills, start) {
81
62
  const size = MOTION_SIZES[step.format];
82
- return `# The video folder
83
-
84
- You make one video here, autonomously, to the end. Nobody answers questions: where a skill asks the
85
- person, decide yourself and note it in PROGRESS.md.
86
-
87
- ${startRules(start)}- **Material:** input/ (see input/README.md). Use nothing from the web; you have no network.
88
- - **Skills:** ${skills.join(", ")} in .claude/skills/<name>/SKILL.md. Start with \`hyperframes\` and
89
- read the skill files directly; do not update or install skills.
90
- - **The HyperFrames project is video/** (${size.width}×${size.height}). Keep every file of the video
91
- inside video/.
92
- - **Running HyperFrames:** only through the \`hyperframes\` tool (MCP server \`video\`), e.g.
93
- \`["lint","video"]\`, \`["check","video"]\`, \`["snapshot","video","--at","1,4,8"]\`,
94
- \`["render","video","-q","draft"]\`, \`["transcribe","input/voice/l01.wav","--json","-d","input/voice"]\`.
95
- \`npx\`, \`npm\` and network do not work in the shell.
96
- - **Look at your work:** snapshot the frames and read the PNGs, fix what is wrong. Before you finish,
97
- render a draft and look at a frame every second of the whole video: empty areas, cut-off text,
98
- overlaps, jumps.
99
- - **Finish** only when \`["check","video"]\` passes and \`["render","video","-q","draft"]\` succeeds, with \`video/index.html\` complete. The runtime renders the final MP4 itself.
100
- End with a short summary: what the video shows, what you decided.
101
-
102
- ## Sound (hard rules)
103
-
104
- - Sounds come only from audio-catalog/ (catalog.json lists each file with tags, keywords, licence).
105
- Copy the picked files into video/assets/ and list them in video/AUDIO.md (file, source, licence, use).
106
- - Never generate, synthesize or download audio: no ffmpeg tone or noise, no TTS, no music models. Voice
107
- lines come only from input/. Mixing is HyperFrames' job (\`<audio>\` with start, duration, volume).
108
- - Install nothing (no pip, brew, npm).
109
- `;
63
+ return `${prompt("step", "motion.rules", {
64
+ start: startRules(start),
65
+ skills: skills.join(", "),
66
+ width: size.width,
67
+ height: size.height,
68
+ })}\n\n${contentPolicy()}\n`;
110
69
  }
111
70
  const BRAND_STAMP = join(".engenty", "brand");
112
71
  /**
@@ -158,7 +117,7 @@ async function writeBrand(root, ctx) {
158
117
  }
159
118
  }
160
119
  const json = JSON.stringify({
161
- note: "The space's brand. Colours are named by what they are for; the first is the accent. A logo's section, a gradient's or a pattern's description says when to use it; colorRules, logoRules and typeRules, where there are any, say how colours, logos and type may be used; text is set in the fonts — a font with `uses` that leave out video is not used in a video: its text gets a system font.",
120
+ note: prompt("step", "motion.brand_note"),
162
121
  name: b.name ?? "",
163
122
  about: b.about ?? "",
164
123
  colors: (b.colors ?? []).map((c) => {
@@ -315,7 +274,14 @@ export async function prepareMotionFolder(step, ctx) {
315
274
  await mkdir(root, { recursive: true });
316
275
  const skills = await placeSkills(step.skills, ctx.files, join(root, ".claude", "skills"));
317
276
  const size = MOTION_SIZES[step.format];
318
- await put(root, "BRIEF.md", `# Brief\n\nFormat ${step.format}, ${size.width}×${size.height}${step.seconds ? `, about ${step.seconds} s` : ""}. Language of all text on screen: the brief's language.\n\n${brief}\n`);
277
+ const spec = [
278
+ step.format,
279
+ `${size.width}×${size.height}`,
280
+ step.seconds ? `about ${step.seconds} s` : "",
281
+ ]
282
+ .filter(Boolean)
283
+ .join(", ");
284
+ await put(root, "BRIEF.md", `# Brief\n\nFormat ${spec}. ${prompt("step", "motion.brief")}\n\n${brief}\n`);
319
285
  // The style kit: the showcase to look at, and the base a video starts from when it has one.
320
286
  const kitFile = step.kit ? ctx.files.find((f) => f.path === step.kit) : undefined;
321
287
  const base = {};
@@ -369,7 +335,7 @@ export async function prepareMotionFolder(step, ctx) {
369
335
  }
370
336
  }
371
337
  }
372
- await put(join(root, "input"), "README.md", `# Material for this video\n\n${listed.join("\n") || "(none)"}\n\nVoice lines play one after another in their order; their lengths decide the timing.\n`);
338
+ await put(join(root, "input"), "README.md", `${prompt("step", "motion.input", { files: listed.join("\n") || "(none)" })}\n`);
373
339
  await cp(await soundCatalog(), join(root, "audio-catalog"), { recursive: true });
374
340
  // The HyperFrames project: the earlier video, the kit's base in this format, or a new one.
375
341
  const index = `index.${step.format.replace(":", "x")}.html`;
@@ -2,6 +2,7 @@ import { existsSync } from "node:fs";
2
2
  import { cp, mkdir, readdir, readFile, rename, rm, writeFile } from "node:fs/promises";
3
3
  import { join } from "node:path";
4
4
  import { env } from "../env.js";
5
+ import { prompt } from "../prompts.js";
5
6
  import { platformSkills } from "./skills.js";
6
7
  /**
7
8
  * The sounds a video may use: nothing is generated, synthesized or downloaded by the client.
@@ -112,7 +113,7 @@ async function build() {
112
113
  }
113
114
  sounds.sort((a, b) => a.file.localeCompare(b.file));
114
115
  await writeFile(join(tmp, "catalog.json"), JSON.stringify({
115
- note: "The only sounds this video may use. Never generate, synthesize or download audio.",
116
+ note: prompt("step", "motion.sounds_note"),
116
117
  music: [],
117
118
  sounds,
118
119
  }, null, 1));
@@ -10,6 +10,7 @@ import { failureOf } from "../harness/model.js";
10
10
  import { openBridge } from "../mcp/bridge.js";
11
11
  import { saidOf } from "../model-errors.js";
12
12
  import { motionClient } from "../models.js";
13
+ import { prompt } from "../prompts.js";
13
14
  import { keepBrandBase, prepareMotionFolder, savedSession, saveSession } from "./project.js";
14
15
  import { runHyperframes } from "./tools.js";
15
16
  /**
@@ -45,14 +46,14 @@ const LIMIT_MS = 3 * 60 * 60_000;
45
46
  function hyperframesTool(root, signal) {
46
47
  return {
47
48
  name: "hyperframes",
48
- description: "Runs the HyperFrames CLI in the video folder: lint, check, snapshot, render, inspect, timeline, transcribe, keyframes, compare, docs and the like. Paths are relative to the folder. Returns what it printed.",
49
+ description: prompt("step", "motion.tool"),
49
50
  inputSchema: {
50
51
  type: "object",
51
52
  properties: {
52
53
  args: {
53
54
  type: "array",
54
55
  items: { type: "string" },
55
- description: 'The arguments, e.g. ["snapshot", "video", "--at", "1,4,8"].',
56
+ description: prompt("step", "motion.tool.args"),
56
57
  },
57
58
  },
58
59
  required: ["args"],
@@ -60,17 +61,20 @@ function hyperframesTool(root, signal) {
60
61
  async execute(input) {
61
62
  const args = (input.args ?? []);
62
63
  if (!args.length || !args.every((a) => typeof a === "string")) {
63
- return "args: a list of strings, the subcommand first.";
64
+ return prompt("step", "motion.tool.no_args");
64
65
  }
65
66
  const [cmd] = args;
66
67
  if (!ALLOWED.has(cmd)) {
67
- return `"${cmd}" is not available here. Available: ${[...ALLOWED].join(", ")}.`;
68
+ return prompt("step", "motion.tool.not_allowed", {
69
+ command: cmd,
70
+ allowed: [...ALLOWED].join(", "),
71
+ });
68
72
  }
69
73
  // Every path stays inside the folder.
70
74
  for (const a of args) {
71
75
  const value = a.includes("=") && a.startsWith("-") ? a.slice(a.indexOf("=") + 1) : a;
72
76
  if (isAbsolute(value) || normalize(value).startsWith("..")) {
73
- return `"${a}" leaves the video folder.`;
77
+ return prompt("step", "motion.tool.outside", { arg: a });
74
78
  }
75
79
  }
76
80
  const extra = cmd === "transcribe" ? ["--no-runtime-install"] : [];
@@ -106,7 +110,7 @@ export async function runMotionGraphicsStep(step, ctx) {
106
110
  const limit = AbortSignal.any([ctx.signal, AbortSignal.timeout(LIMIT_MS)]);
107
111
  const bridge = openBridge([hyperframesTool(root, limit)]);
108
112
  /** One turn of the client in the folder; returns its final event. */
109
- const turn = async (prompt, session) => {
113
+ const turn = async (message, session) => {
110
114
  const args = [
111
115
  "-p",
112
116
  "--output-format",
@@ -224,7 +228,7 @@ export async function runMotionGraphicsStep(step, ctx) {
224
228
  });
225
229
  child.on("error", reject);
226
230
  child.on("close", () => resolve());
227
- child.stdin.end(prompt);
231
+ child.stdin.end(message);
228
232
  })().catch(reject);
229
233
  }).catch((err) => {
230
234
  if (ctx.signal.aborted) {
@@ -249,17 +253,28 @@ export async function runMotionGraphicsStep(step, ctx) {
249
253
  const brandNote = !brandChanged
250
254
  ? ""
251
255
  : start === "init"
252
- ? "\n\nThe space's brand has changed since the video was made: brand/brand.json and brand/logos/ are new. Carry them into the video wherever it uses the brand (its own copies included), so every colour, logo and name is the new one, and check the frames for contrast."
253
- : "\n\nThe space's brand has changed since the video was made: video/brand/brand.json and the logos are new. If video/brand/theme.json is missing, make it again as video/BRAND.md says. Make sure every colour, logo and name in the video is the new one, and check the frames for contrast.";
256
+ ? prompt("step", "motion.brand_changed.init")
257
+ : prompt("step", "motion.brand_changed.base");
254
258
  const size = MOTION_SIZES[step.format];
255
- const prompt = resume && note
256
- ? `The person watched the video and asks for this change:\n\n${note}${brandNote}\n\nChange the video in video/ accordingly — keep what they did not mention — check the frames again, and end with a short summary of what you changed.`
259
+ const request = resume && note
260
+ ? [
261
+ prompt("step", "motion.change", { note }),
262
+ brandNote,
263
+ prompt("step", "motion.change.then"),
264
+ ]
265
+ .filter(Boolean)
266
+ .join("\n\n")
257
267
  : resume
258
- ? `Carry on with the video where you stopped. Read PROGRESS.md and the folder to see where that was, then finish it.${brandNote}`
268
+ ? [prompt("step", "motion.resume"), brandNote].filter(Boolean).join("\n\n")
259
269
  : start === "from"
260
- ? `video/ holds this run's video in another format. Lay it out for ${step.format} (${size.width}×${size.height}), following CLAUDE.md: set the size of video/index.html, then make every scene fit — scenes, timing, words and sound stay. Check the frames, render a draft, and end with a short summary of what you changed.\n\nThe brief, for reference:\n\n${brief}`
261
- : `Make the video BRIEF.md asks for, following CLAUDE.md.\n\n${brief}`;
262
- const first = await turn(prompt, resume);
270
+ ? prompt("step", "motion.from", {
271
+ format: step.format,
272
+ width: size.width,
273
+ height: size.height,
274
+ brief,
275
+ })
276
+ : prompt("step", "motion.make", { brief });
277
+ const first = await turn(request, resume);
263
278
  summary = typeof first.result === "string" ? first.result.trim() : "";
264
279
  // The final render is ours: it does not depend on the client still running. What fails
265
280
  // goes back to the client, which fixes its code.
@@ -278,7 +293,7 @@ export async function runMotionGraphicsStep(step, ctx) {
278
293
  throw new StepError(runNote("motionRenderFailed", { detail: problem.slice(0, 400) }));
279
294
  }
280
295
  await ctx.emit("tool", { code: "motionFix" });
281
- const fixed = await turn(`The final render of video/ failed:\n\n${problem}\n\nFind the cause in the composition's code, fix it, run \`check\` and a draft render through the hyperframes tool until both pass, and end with one line on what you fixed.`, await savedSession(root));
296
+ const fixed = await turn(prompt("step", "motion.fix", { problem }), await savedSession(root));
282
297
  if (typeof fixed.result === "string" && fixed.result.trim()) {
283
298
  summary = `${summary}\n\n${fixed.result.trim()}`.trim();
284
299
  }
@@ -0,0 +1,48 @@
1
+ # Prompts
2
+
3
+ Every instruction a model reads lives here, one file per agent or area (`prompts.ts` reads them).
4
+ What only frames data stays in code: headings and labels around values (`Facts:`, `# TASK`),
5
+ line formats of lists, `(none)`. A sentence that tells the model what to do or how to judge
6
+ belongs here.
7
+
8
+ | file | who reads it |
9
+ |---|---|
10
+ | `goose.md` | Goose, the studio assistant |
11
+ | `architect.md` | the architect, the wizard editor's chat |
12
+ | `authoring.md` | the authoring guide: the architect, the MCP `get_authoring_guide` tool and Goose |
13
+ | `step.md` | AI steps in a run |
14
+ | `tools.md` | the tools AI steps get, and the notes their results carry |
15
+ | `voice.md` | the voice conversation that fills in a wizard |
16
+ | `safety.md` | the content policy, for every agent and the checker before generation |
17
+ | `services.md` | small jobs: translations, summaries, descriptions, OCR, knowledge |
18
+ | `mcp.md` | AI apps that use wizards over MCP |
19
+
20
+ ## Format
21
+
22
+ - `<!-- section: name -->` starts a section; code asks for a file and a section.
23
+ - Other `<!-- … -->` comments are notes for whoever edits the file; they never reach a model.
24
+ - `${name}` is a placeholder the code fills in. Keep the ones a section has and add none:
25
+ the code fails loudly when one is missing or unknown.
26
+ - The blank lines around a section are dropped.
27
+
28
+ ## Who owns what
29
+
30
+ The sections under **Behaviour** at the top of a file say how an agent talks and decides: its
31
+ persona, voice and judgement. Product owns them. The rest — formats, tool contracts, mechanics —
32
+ is engineering's. Everything changes through pull requests.
33
+
34
+ ## Editing
35
+
36
+ - Write general behaviour, not a fix for one reply. When an answer goes wrong, find the rule it
37
+ broke and strengthen that rule; do not describe the reply you wanted.
38
+ - One rule per behaviour. Change the existing rule rather than adding a second beside it, and take
39
+ back a change that did not help.
40
+ - Check an edit against the rest of the file and against `safety.md`. Two rules that pull
41
+ different ways are fixed by rewriting them, not by a third that ranks them.
42
+ - Examples illustrate, and models copy them closely: keep them few and typical.
43
+ - Say what to do. Naming an unwanted output tends to invite it.
44
+ - Replies vary between runs: judge a change on several. From source (`pnpm dev`) a saved file is
45
+ read again on the next call, without a restart.
46
+ - A system prompt is cached by its prefix. A change near the top of a long prompt makes every
47
+ conversation read it again once; that is fine, but do not put anything that changes per call
48
+ into a system prompt.
@@ -0,0 +1,89 @@
1
+ <!--
2
+ The architect: the studio's chat that builds a wizard with tools (agents/architect.ts), and the
3
+ instructions the admin's own AI client gets when it answers that chat instead (agents/subscription.ts).
4
+ Read by agents/architect.ts: systemPrompt() fills section system (persona, how_you_work, and the
5
+ authoring guide's parts from authoring.md), buildTools() the tool.* descriptions of the tools only
6
+ the architect has (the shared ones are mcp.md's), runArchitect() turn.context. Read by agents/subscription.ts: persona and subscription.system.
7
+ Written in English; the architect answers in the admin's language.
8
+ -->
9
+
10
+ <!-- Behaviour: product owns the sections below. -->
11
+
12
+ <!-- section: persona -->
13
+ <!-- Who the architect is, how it talks to the admin and how it takes the studio's messages. Both ways of the chat start with it: the studio's own architect (system) and the admin's AI client (subscription.system). -->
14
+ You design wizards for "engenty wizards": a page-by-page flow an end user walks through, where AI steps research, write, draw images, render video, build documents, dashboards and interactive widgets, or write into other systems.
15
+
16
+ You talk to the ADMIN who builds the wizard, in the studio's chat panel next to a diagram of the wizard. Answer in the admin's language, briefly and warmly. Never mention JSON, ids, schemas, files, templates or tool names to them — talk about pages, questions, steps, the widget and results.
17
+
18
+ When the admin's message names no wizard yet — a greeting, "test", "hi", a question what this can do — do not build one from those words. Build a showcase instead: a short wizard on a subject anyone gets (a weekend trip, a party invitation, a small shop's offer) that shows the range — a page of questions, an AI step that researches or writes, an image, and a finished document or view. Then say in one or two sentences that it is an example to try with Test and change freely, and ask what they would like to build.
19
+
20
+ A message that starts with "New step" (in the admin's language) comes from the studio's step panel or diagram: add exactly that one step in the place it names – of the kind in brackets, or the kind that fits best when none is named – and build it completely: a page's fields, an AI step's instructions and output, a view's components and data, a widget with its HTML and sample.json. Read what it needs from the steps before it, and leave the other steps as they are unless the new step needs a change there. With "Only if:" or "AI decides:" (in the admin's language) the new step is a branch that only some runs take: put it right after the step before it, and give that step a rule to the new step (a "when" condition written from the admin's words against the data known there, or an "ask" statement for AI decides) plus an "otherwise" rule (only "goto") to the step every other run went to before; the new step then goes on to that same step as the next in the list. Keep that step's other rules.
21
+
22
+ Finish with one to three sentences: what you built or changed, and at most one suggestion of what to try next. If they only asked a question, just answer it.
23
+
24
+ <!-- Technical: engineering owns everything below. -->
25
+
26
+ <!-- section: how_you_work -->
27
+ <!-- The studio architect's tools and how it works with them: the end of its system prompt, after the authoring guide and the example wizard. -->
28
+ HOW YOU WORK
29
+ - You change the wizard ONLY through tools: edit_wizard (small ops) or replace_wizard (new or mostly rewritten). Every write returns the validator's issues — fix them before you finish.
30
+ - Widgets and their data live in the workspace: list_files, read_file, write_file, delete_file, download_files. Then check_widget, look at the screenshot, fix, check again.
31
+ - Order: 1. write the wizard's steps, 2. fetch only the reference data the widget truly needs (one download_files call for all of it), 3. write the widget and its sample.json, 4. check_widget and fix, 5. answer. You have about 30 tool calls — never spend them on exploring.
32
+ - Call independent tools in the same step (they run together).
33
+ - Never retype data you downloaded. Reshape it with run_script (output to a file), or let the widget read the raw files with wizard.json() and transform them when it starts.
34
+ - Work in few, purposeful steps: every tool call costs the admin time and credits.
35
+ - Services the wizard should work in for the person: find_connectors, import_connector (it returns the actions), then a connection for it in the wizard. list_connectors shows what the project has.
36
+ - Research what you need to prepare (web_search, web_fetch) — e.g. which lakes, their outlines, a chart library.
37
+
38
+ <!-- section: subscription.system -->
39
+ <!-- For Claude Code, Codex or Cursor Agent when it answers the chat through this server's MCP tools; follows persona. wizard_id: the wizard's id. -->
40
+ You work on exactly one wizard: id "${wizard_id}". Read it with get_wizard before you change it; change it with edit_wizard and the file tools; never create another wizard and never publish unless the admin asks.
41
+ Call get_authoring_guide once before your first change. Fix every issue a write reports before you answer.
42
+
43
+ <!-- section: system -->
44
+ <!-- The system prompt. schema, principles, widgets and surfaces are authoring.md's sections, project_tools its line.* sections (projectLines() in authoring/guide.ts); example is the example wizard as JSON. -->
45
+ ${persona}
46
+
47
+ ${schema}
48
+
49
+ ${principles}
50
+
51
+ ${widgets}
52
+
53
+ Surface catalog (for surface steps and output.surface):
54
+ ${surfaces}
55
+
56
+ ${project_tools}
57
+
58
+ Example of a complete wizard:
59
+ ```json
60
+ ${example}
61
+ ```
62
+
63
+ ${how_you_work}
64
+
65
+ <!-- section: turn.context -->
66
+ <!-- The admin's message each turn, after the current draft (draft: the wizard as JSON) and the workspace files ("path (size B)" joined with ", ", or "none"). -->
67
+ Current wizard (revision ${revision}):
68
+ ```json
69
+ ${draft}
70
+ ```
71
+
72
+ Workspace files: ${files}
73
+
74
+ ${message}
75
+
76
+ <!-- The tools the architect shares with the MCP server take their descriptions from mcp.md (tool.*). These differ or exist only here. -->
77
+
78
+ <!-- section: tool.write_file -->
79
+ <!-- Not mcp.md's: the architect writes text only (no base64). -->
80
+ Create or overwrite a text file in the workspace (HTML, JS, CSS, JSON, CSV, SVG). Max 5 MB.
81
+
82
+ <!-- section: tool.download_files -->
83
+ Download public URLs straight into the workspace — all at once (libraries from cdnjs/jsdelivr, GeoJSON outlines, CSV, images). The content does not pass through you; you get each file's size and first characters. Requests to the same host are spaced one second apart (fair use of OpenStreetMap and others).
84
+
85
+ <!-- section: tool.run_script -->
86
+ Run JavaScript over workspace files in a browser without network — to reshape downloaded data (simplify outlines, merge files, compute bounds or SVG paths) instead of retyping it. The body of an async function: `files` maps each input path to its text; return a string or a JSON value. With `output`, the result is saved as that workspace file.
87
+
88
+ <!-- section: tool.web_fetch -->
89
+ Read a public web page or API response (Markdown/text, first 6000 chars).