@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.
- package/apps/runtime/dist/agents/architect.js +40 -55
- package/apps/runtime/dist/agents/chat-clients.js +3 -0
- package/apps/runtime/dist/agents/company.js +4 -12
- package/apps/runtime/dist/agents/studio-assistant.js +82 -74
- package/apps/runtime/dist/agents/subscription.js +27 -17
- package/apps/runtime/dist/assistant/knows.js +19 -19
- package/apps/runtime/dist/auth/account.js +51 -12
- package/apps/runtime/dist/auth/index.js +15 -2
- package/apps/runtime/dist/authoring/guide.js +20 -447
- package/apps/runtime/dist/browser/fast/run.js +18 -12
- package/apps/runtime/dist/cli/account.js +127 -10
- package/apps/runtime/dist/cli/main.js +4 -2
- package/apps/runtime/dist/connectors/mail.js +4 -3
- package/apps/runtime/dist/data/chat-models.json +116 -0
- package/apps/runtime/dist/docs/user-guide/models.md +15 -5
- package/apps/runtime/dist/documents/parse.js +5 -14
- package/apps/runtime/dist/engine/decide.js +2 -1
- package/apps/runtime/dist/engine/runner.js +4 -3
- package/apps/runtime/dist/engine/steps.js +82 -91
- package/apps/runtime/dist/engine/template.js +2 -3
- package/apps/runtime/dist/env.js +5 -0
- package/apps/runtime/dist/harness/antigravity.js +2 -2
- package/apps/runtime/dist/harness/apple.js +4 -6
- package/apps/runtime/dist/harness/codex.js +5 -6
- package/apps/runtime/dist/harness/prompt.js +8 -8
- package/apps/runtime/dist/mcp/handler.js +5 -7
- package/apps/runtime/dist/mcp/tools.js +33 -54
- package/apps/runtime/dist/media/conversation.js +18 -23
- package/apps/runtime/dist/media/generate.js +18 -3
- package/apps/runtime/dist/media/transcribe.js +5 -4
- package/apps/runtime/dist/models.js +8 -9
- package/apps/runtime/dist/motion-graphics/project.js +19 -53
- package/apps/runtime/dist/motion-graphics/sounds.js +2 -1
- package/apps/runtime/dist/motion-graphics/step.js +31 -16
- package/apps/runtime/dist/prompts/README.md +48 -0
- package/apps/runtime/dist/prompts/architect.md +89 -0
- package/apps/runtime/dist/prompts/authoring.md +503 -0
- package/apps/runtime/dist/prompts/goose.md +229 -0
- package/apps/runtime/dist/prompts/mcp.md +156 -0
- package/apps/runtime/dist/prompts/safety.md +23 -0
- package/apps/runtime/dist/prompts/services.md +151 -0
- package/apps/runtime/dist/prompts/step.md +334 -0
- package/apps/runtime/dist/prompts/tools.md +330 -0
- package/apps/runtime/dist/prompts/voice.md +53 -0
- package/apps/runtime/dist/prompts.js +50 -0
- package/apps/runtime/dist/routes/studio.js +58 -7
- package/apps/runtime/dist/safety.js +45 -0
- package/apps/runtime/dist/sandbox/index.js +8 -3
- package/apps/runtime/dist/services/architect.js +5 -4
- package/apps/runtime/dist/services/assistant-chats.js +5 -8
- package/apps/runtime/dist/services/brand.js +2 -7
- package/apps/runtime/dist/services/chat-models.js +58 -0
- package/apps/runtime/dist/services/cloud.js +8 -4
- package/apps/runtime/dist/services/knowledge-model.js +17 -8
- package/apps/runtime/dist/services/knowledge.js +5 -9
- package/apps/runtime/dist/services/project-files.js +3 -8
- package/apps/runtime/dist/services/relevance.js +4 -3
- package/apps/runtime/dist/services/runs.js +6 -7
- package/apps/runtime/dist/services/site.js +2 -2
- package/apps/runtime/dist/services/translations.js +17 -10
- package/apps/runtime/dist/services/wizards.js +8 -0
- package/apps/runtime/dist/sync/client.js +116 -1
- package/apps/runtime/dist/tools/browser.js +36 -33
- package/apps/runtime/dist/tools/code.js +20 -6
- package/apps/runtime/dist/tools/connector.js +23 -9
- package/apps/runtime/dist/tools/index.js +14 -11
- package/apps/runtime/dist/tools/mail.js +5 -5
- package/apps/runtime/dist/tools/net-guard.js +4 -4
- package/apps/runtime/dist/tools/pages.js +3 -2
- package/apps/runtime/dist/tools/project.js +7 -8
- package/apps/runtime/dist/tools/store.js +14 -10
- package/apps/web/dist/assets/{AboutDialog-B525L37O.js → AboutDialog-J9rRhJTJ.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-gInSm1Xe.js → ChangelogDialog-D9bBSuLQ.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-C0TmdCrb.js → CodeEditor-CiRJjYpm.js} +1 -1
- package/apps/web/dist/assets/{EditorPage-7t3vhZi6.js → EditorPage-ChLV09jO.js} +1 -1
- package/apps/web/dist/assets/{FlowPreview-BBN-APkG.js → FlowPreview-QRnLE4JM.js} +1 -1
- package/apps/web/dist/assets/{Harness-fAoC908y.js → Harness-dM1CDgnx.js} +1 -1
- package/apps/web/dist/assets/Marketplace-8rU-MhWj.js +2 -0
- package/apps/web/dist/assets/{NewWizardChannels-X32lBGMf.js → NewWizardChannels--JqgVT-t.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-DMoqDhsh.js → NewWizardPage-CNv5UuBn.js} +1 -1
- package/apps/web/dist/assets/{OnboardingPage-BjZy-bhI.js → OnboardingPage-CDuhfBEI.js} +1 -1
- package/apps/web/dist/assets/{PreviewPane-Bt-ForJG.js → PreviewPane-BsMrHW8b.js} +2 -2
- package/apps/web/dist/assets/{ProjectPage-B5a-nod-.js → ProjectPage-CoVMEoB1.js} +1 -1
- package/apps/web/dist/assets/{PublicRunner-Cq_XzX54.js → PublicRunner-Ckte5NnM.js} +1 -1
- package/apps/web/dist/assets/{ReadOnly-DX3beZJz.js → ReadOnly-Ch-ss9Mh.js} +1 -1
- package/apps/web/dist/assets/SettingsPage-CGp6G_fp.js +2 -0
- package/apps/web/dist/assets/{SetupPage-BI9bgEkI.js → SetupPage-DgFT_646.js} +1 -1
- package/apps/web/dist/assets/{SharePage-Ch-1oLBs.js → SharePage-CEcFKE3b.js} +1 -1
- package/apps/web/dist/assets/changelog-DMhLfQmS.js +1 -0
- package/apps/web/dist/assets/i18n-AXoEWXfv.js +55 -0
- package/apps/web/dist/assets/index-BYZBN0xx.css +1 -0
- package/apps/web/dist/assets/index-Dx7qMiM3.js +34 -0
- package/apps/web/dist/assets/{oss-credits-CZT1KRIp.js → oss-credits-Da4KrYmP.js} +1 -1
- package/apps/web/dist/assets/{phone-DxC6eM6O.js → phone-De-HF0g7.js} +1 -1
- package/apps/web/dist/assets/{runners-SQHfvvNQ.js → runners-UIPj9xyX.js} +1 -1
- package/apps/web/dist/assets/{session-4CTNIlai.js → session-DUxZmhqy.js} +1 -1
- package/apps/web/dist/assets/{settings-menu-B0af5EBE.js → settings-menu-Bo1yXMGF.js} +1 -1
- package/apps/web/dist/assets/{theme-mtamawa_.js → theme-CSuPPxre.js} +1 -1
- package/apps/web/dist/assets/ui-CBDsXUoA.js +83 -0
- package/apps/web/dist/assets/{upload-DXJQU2lL.js → upload-CZgdEF60.js} +1 -1
- package/apps/web/dist/assets/{useMutation-DwRYrG3V.js → useMutation-ZHWqRSPd.js} +1 -1
- package/apps/web/dist/assets/{volume-2-CYbbBiXP.js → volume-2-c641MxaU.js} +1 -1
- package/apps/web/dist/assets/{wrench-D8lG2BH7.js → wrench-DCEAyYuR.js} +1 -1
- package/apps/web/dist/index.html +8 -9
- package/apps/web/dist/mcp/flow.html +87 -87
- package/node_modules/@engenty/wizards-shared/dist/assistant.d.ts +1 -0
- package/node_modules/@engenty/wizards-shared/dist/assistant.js +2 -0
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +6 -0
- package/node_modules/@engenty/wizards-shared/dist/run.js +12 -0
- package/node_modules/@engenty/wizards-shared/dist/surface.d.ts +0 -2
- package/node_modules/@engenty/wizards-shared/dist/surface.js +0 -29
- package/node_modules/@engenty/wizards-shared/dist/sync.d.ts +5 -0
- package/package.json +2 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/runtime/dist/assistant/primer.js +0 -26
- package/apps/web/dist/assets/Marketplace-CotMMcJ-.js +0 -2
- package/apps/web/dist/assets/SettingsPage-DPuwA3QL.js +0 -2
- package/apps/web/dist/assets/changelog-BlJc9UFS.js +0 -1
- package/apps/web/dist/assets/coins-D_yN56kT.js +0 -1
- package/apps/web/dist/assets/i18n-Dy3fTQM3.js +0 -55
- package/apps/web/dist/assets/index-Dt1Ps3ge.js +0 -34
- package/apps/web/dist/assets/index-rX7eCvWh.css +0 -1
- package/apps/web/dist/assets/ui-CL8v8Goa.js +0 -83
|
@@ -5,6 +5,7 @@ import { wizardOpSchema } from "../authoring/ops.js";
|
|
|
5
5
|
import { importFromRegistry, listConnectors, searchRegistry } from "../connectors/external.js";
|
|
6
6
|
import { RunConflict } from "../engine/runner.js";
|
|
7
7
|
import { pluginToolsOf } from "../plugins/registry.js";
|
|
8
|
+
import { prompt } from "../prompts.js";
|
|
8
9
|
import { publishAndSync, pushSharing } from "../services/cloud.js";
|
|
9
10
|
import { ServiceError } from "../services/errors.js";
|
|
10
11
|
import { deleteFile, listFiles, readFileText, writeFile } from "../services/files.js";
|
|
@@ -67,7 +68,7 @@ function annotationsOf(config) {
|
|
|
67
68
|
/** What a client tells its person when people edit the wizard it just changed. */
|
|
68
69
|
function presentNote(people) {
|
|
69
70
|
const who = people.map(([name, where]) => (where ? `${name} (${where})` : name)).join(", ");
|
|
70
|
-
return
|
|
71
|
+
return prompt("mcp", "note.present", { who, verb: people.length > 1 ? "are" : "is" });
|
|
71
72
|
}
|
|
72
73
|
export function registerTools(server, who) {
|
|
73
74
|
const writer = { source: "mcp", client: who.client };
|
|
@@ -162,7 +163,7 @@ export function registerTools(server, who) {
|
|
|
162
163
|
// --- read ------------------------------------------------------------------
|
|
163
164
|
tool("get_authoring_guide", "wizards:read", {
|
|
164
165
|
title: "Authoring guide",
|
|
165
|
-
description: "
|
|
166
|
+
description: prompt("mcp", "tool.get_authoring_guide"),
|
|
166
167
|
input: z.object({
|
|
167
168
|
projectId: z.string().optional().describe("Defaults to the person's first project."),
|
|
168
169
|
}),
|
|
@@ -176,13 +177,13 @@ export function registerTools(server, who) {
|
|
|
176
177
|
// --- connectors ------------------------------------------------------------
|
|
177
178
|
tool("find_connectors", "wizards:read", {
|
|
178
179
|
title: "Find connectors",
|
|
179
|
-
description: "
|
|
180
|
+
description: prompt("mcp", "tool.find_connectors"),
|
|
180
181
|
input: z.object({ query: z.string().min(1).max(200) }),
|
|
181
182
|
readOnly: true,
|
|
182
183
|
}, async ({ query }) => ({ services: await searchRegistry(query) }));
|
|
183
184
|
tool("list_connectors", "wizards:read", {
|
|
184
185
|
title: "List connectors",
|
|
185
|
-
description: "
|
|
186
|
+
description: prompt("mcp", "tool.list_connectors"),
|
|
186
187
|
input: z.object({ projectId: z.string().optional() }),
|
|
187
188
|
readOnly: true,
|
|
188
189
|
}, async ({ projectId }) => {
|
|
@@ -193,7 +194,7 @@ export function registerTools(server, who) {
|
|
|
193
194
|
});
|
|
194
195
|
tool("import_connector", "wizards:write", {
|
|
195
196
|
title: "Import connector",
|
|
196
|
-
description: "
|
|
197
|
+
description: prompt("mcp", "tool.import_connector"),
|
|
197
198
|
input: z.object({
|
|
198
199
|
projectId: z.string().optional(),
|
|
199
200
|
domain: z.string().describe("A domain from find_connectors, e.g. notion.com"),
|
|
@@ -207,7 +208,7 @@ export function registerTools(server, who) {
|
|
|
207
208
|
});
|
|
208
209
|
tool("list_starters", "wizards:read", {
|
|
209
210
|
title: "List starters",
|
|
210
|
-
description: "
|
|
211
|
+
description: prompt("mcp", "tool.list_starters"),
|
|
211
212
|
input: z.object({ query: z.string().max(200).optional() }),
|
|
212
213
|
readOnly: true,
|
|
213
214
|
}, async ({ query }) => (await searchMarketplace({ q: query ?? "", lang: "de", limit: 30 })).entries
|
|
@@ -225,7 +226,7 @@ export function registerTools(server, who) {
|
|
|
225
226
|
})));
|
|
226
227
|
tool("get_starter", "wizards:read", {
|
|
227
228
|
title: "Get starter",
|
|
228
|
-
description: "
|
|
229
|
+
description: prompt("mcp", "tool.get_starter"),
|
|
229
230
|
input: z.object({ starterId: z.string() }),
|
|
230
231
|
readOnly: true,
|
|
231
232
|
}, async ({ starterId }) => {
|
|
@@ -237,7 +238,7 @@ export function registerTools(server, who) {
|
|
|
237
238
|
});
|
|
238
239
|
tool("list_projects", "wizards:read", {
|
|
239
240
|
title: "List projects",
|
|
240
|
-
description: "
|
|
241
|
+
description: prompt("mcp", "tool.list_projects"),
|
|
241
242
|
input: z.object({}),
|
|
242
243
|
readOnly: true,
|
|
243
244
|
}, async () => (await listProjects(who.userId)).map((p) => ({
|
|
@@ -248,7 +249,7 @@ export function registerTools(server, who) {
|
|
|
248
249
|
})));
|
|
249
250
|
tool("list_wizards", "wizards:read", {
|
|
250
251
|
title: "List wizards",
|
|
251
|
-
description: "
|
|
252
|
+
description: prompt("mcp", "tool.list_wizards"),
|
|
252
253
|
input: z.object({ projectId: z.string().optional() }),
|
|
253
254
|
readOnly: true,
|
|
254
255
|
}, async ({ projectId }) => {
|
|
@@ -270,7 +271,7 @@ export function registerTools(server, who) {
|
|
|
270
271
|
});
|
|
271
272
|
tool("get_wizard", "wizards:read", {
|
|
272
273
|
title: "Get wizard",
|
|
273
|
-
description: "
|
|
274
|
+
description: prompt("mcp", "tool.get_wizard"),
|
|
274
275
|
input: z.object({ wizardId: z.string() }),
|
|
275
276
|
readOnly: true,
|
|
276
277
|
}, async ({ wizardId }) => {
|
|
@@ -291,7 +292,7 @@ export function registerTools(server, who) {
|
|
|
291
292
|
});
|
|
292
293
|
tool("validate_wizard", "wizards:read", {
|
|
293
294
|
title: "Validate wizard",
|
|
294
|
-
description: "
|
|
295
|
+
description: prompt("mcp", "tool.validate_wizard"),
|
|
295
296
|
input: z.object({ definition }),
|
|
296
297
|
readOnly: true,
|
|
297
298
|
}, async (args) => {
|
|
@@ -309,7 +310,7 @@ export function registerTools(server, who) {
|
|
|
309
310
|
// --- write -----------------------------------------------------------------
|
|
310
311
|
tool("create_wizard", "wizards:write", {
|
|
311
312
|
title: "Create wizard",
|
|
312
|
-
description: "
|
|
313
|
+
description: prompt("mcp", "tool.create_wizard"),
|
|
313
314
|
input: z.object({
|
|
314
315
|
projectId: z.string().optional().describe("Defaults to the person's first project."),
|
|
315
316
|
definition: definition.optional(),
|
|
@@ -327,14 +328,7 @@ export function registerTools(server, who) {
|
|
|
327
328
|
});
|
|
328
329
|
tool("edit_wizard", "wizards:write", {
|
|
329
330
|
title: "Edit wizard",
|
|
330
|
-
description:
|
|
331
|
-
- set_meta {title?, description?, avatar?, costume? (null takes it off), intro? (null removes), themes? (theme ids in order; null removes)}
|
|
332
|
-
- set_theme {theme}: a theme of the space (see "type Theme"), made or replaced, worn first by this wizard
|
|
333
|
-
- set_lists {lists} / set_connections {connections}: replace the wizard's lists or connections as a whole
|
|
334
|
-
- upsert_step {step (complete), before?|after?}: replaces the step with that id, else inserts it (default: before the final result step)
|
|
335
|
-
- remove_step {stepId}
|
|
336
|
-
- move_step {stepId, before|after}
|
|
337
|
-
Returns the new revision and the issues.`,
|
|
331
|
+
description: prompt("mcp", "tool.edit_wizard"),
|
|
338
332
|
input: z.object({
|
|
339
333
|
wizardId: z.string(),
|
|
340
334
|
baseRevision,
|
|
@@ -348,7 +342,7 @@ Returns the new revision and the issues.`,
|
|
|
348
342
|
});
|
|
349
343
|
tool("replace_wizard", "wizards:write", {
|
|
350
344
|
title: "Replace wizard",
|
|
351
|
-
description: "
|
|
345
|
+
description: prompt("mcp", "tool.replace_wizard"),
|
|
352
346
|
input: z.object({ wizardId: z.string(), baseRevision, definition, note }),
|
|
353
347
|
destructive: true,
|
|
354
348
|
}, async ({ wizardId, ...input }) => {
|
|
@@ -358,14 +352,14 @@ Returns the new revision and the issues.`,
|
|
|
358
352
|
// --- publish ---------------------------------------------------------------
|
|
359
353
|
tool("publish_wizard", "wizards:publish", {
|
|
360
354
|
title: "Publish wizard",
|
|
361
|
-
description: "
|
|
355
|
+
description: prompt("mcp", "tool.publish_wizard"),
|
|
362
356
|
input: z.object({ wizardId: z.string() }),
|
|
363
357
|
destructive: true,
|
|
364
358
|
openWorld: true,
|
|
365
359
|
}, async ({ wizardId }) => publishAndSync(who.userId, wizardId));
|
|
366
360
|
tool("set_sharing", "wizards:publish", {
|
|
367
361
|
title: "Set sharing",
|
|
368
|
-
description: "
|
|
362
|
+
description: prompt("mcp", "tool.set_sharing"),
|
|
369
363
|
input: z.object({
|
|
370
364
|
wizardId: z.string(),
|
|
371
365
|
enabled: z.boolean().optional(),
|
|
@@ -388,7 +382,7 @@ Returns the new revision and the issues.`,
|
|
|
388
382
|
// --- test runs ---------------------------------------------------------------
|
|
389
383
|
appTool("start_test_run", "runs:test", {
|
|
390
384
|
title: "Start test run",
|
|
391
|
-
description: "
|
|
385
|
+
description: prompt("mcp", "tool.start_test_run"),
|
|
392
386
|
input: z.object({
|
|
393
387
|
wizardId: z.string(),
|
|
394
388
|
answers: z
|
|
@@ -408,7 +402,7 @@ Returns the new revision and the issues.`,
|
|
|
408
402
|
});
|
|
409
403
|
tool("get_test_run", "runs:test", {
|
|
410
404
|
title: "Get test run",
|
|
411
|
-
description: "
|
|
405
|
+
description: prompt("mcp", "tool.get_test_run"),
|
|
412
406
|
input: z.object({
|
|
413
407
|
runId: z.string(),
|
|
414
408
|
waitSeconds: z
|
|
@@ -424,7 +418,7 @@ Returns the new revision and the issues.`,
|
|
|
424
418
|
// --- using wizards: the flow, and runs of the published version -------------
|
|
425
419
|
appTool("show_wizard", "wizards:read", {
|
|
426
420
|
title: "Show wizard",
|
|
427
|
-
description: "
|
|
421
|
+
description: prompt("mcp", "tool.show_wizard"),
|
|
428
422
|
input: z.object({
|
|
429
423
|
wizardId: z.string(),
|
|
430
424
|
version: z.enum(["published", "draft"]).optional().describe("Default: published, if any."),
|
|
@@ -452,20 +446,11 @@ Returns the new revision and the issues.`,
|
|
|
452
446
|
});
|
|
453
447
|
appTool("run_wizard", "runs:test", {
|
|
454
448
|
title: "Run wizard",
|
|
455
|
-
description:
|
|
456
|
-
Start it right away — no show_wizard first: the widget shows the wizard's pages and the person can answer there. What the person already said goes to the first page with answer_page, using the field ids in waitingFor. Then follow waitingFor:
|
|
457
|
-
- page: ask the person for the fields with inChat=true, in order, answer_page; fields with inChat=false (files, recordings, signatures) need the run page at browserUrl. A field with a when is asked only while its condition holds on the answers so far (shown says so for what is known now); fields the wizard decided against are not listed
|
|
458
|
-
- review: show the outputs, then review_step
|
|
459
|
-
- ask: answer_ask (allow/skip a change in a connected account) or the run page for a sign-in
|
|
460
|
-
While status is running, get_run with waitSeconds. Hosts with MCP Apps also show the run as a widget the person can answer in.`,
|
|
449
|
+
description: prompt("mcp", "tool.run_wizard"),
|
|
461
450
|
input: z.object({
|
|
462
451
|
wizardId: z.string(),
|
|
463
452
|
answers: z.record(z.string(), z.unknown()).default({}),
|
|
464
|
-
theme: z
|
|
465
|
-
.string()
|
|
466
|
-
.max(80)
|
|
467
|
-
.optional()
|
|
468
|
-
.describe("The widget's look: the id of a theme the wizard names (its definition's themes), brand or default. Left out: host, this app's own look. Only when the person asks for the wizard's look."),
|
|
453
|
+
theme: z.string().max(80).optional().describe(prompt("mcp", "param.run_wizard.theme")),
|
|
469
454
|
}),
|
|
470
455
|
openWorld: true,
|
|
471
456
|
}, async ({ wizardId, answers, theme }) => {
|
|
@@ -485,13 +470,13 @@ While status is running, get_run with waitSeconds. Hosts with MCP Apps also show
|
|
|
485
470
|
.describe("Wait up to this long while the run is still working.");
|
|
486
471
|
tool("get_run", "runs:test", {
|
|
487
472
|
title: "Get run",
|
|
488
|
-
description: "
|
|
473
|
+
description: prompt("mcp", "tool.get_run"),
|
|
489
474
|
input: z.object({ runId: z.string(), waitSeconds }),
|
|
490
475
|
readOnly: true,
|
|
491
476
|
}, async ({ runId, waitSeconds }) => runReport(who.userId, runId, waitSeconds));
|
|
492
477
|
tool("answer_page", "runs:test", {
|
|
493
478
|
title: "Answer page",
|
|
494
|
-
description: "
|
|
479
|
+
description: prompt("mcp", "tool.answer_page"),
|
|
495
480
|
input: z.object({
|
|
496
481
|
runId: z.string(),
|
|
497
482
|
stepId: z.string().describe("waitingFor.page"),
|
|
@@ -505,7 +490,7 @@ While status is running, get_run with waitSeconds. Hosts with MCP Apps also show
|
|
|
505
490
|
});
|
|
506
491
|
tool("review_step", "runs:test", {
|
|
507
492
|
title: "Review step",
|
|
508
|
-
description: "
|
|
493
|
+
description: prompt("mcp", "tool.review_step"),
|
|
509
494
|
input: z.object({
|
|
510
495
|
runId: z.string(),
|
|
511
496
|
stepId: z.string().describe("waitingFor.review"),
|
|
@@ -529,7 +514,7 @@ While status is running, get_run with waitSeconds. Hosts with MCP Apps also show
|
|
|
529
514
|
});
|
|
530
515
|
tool("answer_ask", "runs:test", {
|
|
531
516
|
title: "Answer confirmation",
|
|
532
|
-
description: "
|
|
517
|
+
description: prompt("mcp", "tool.answer_ask"),
|
|
533
518
|
input: z.object({
|
|
534
519
|
runId: z.string(),
|
|
535
520
|
askId: z.string(),
|
|
@@ -544,7 +529,7 @@ While status is running, get_run with waitSeconds. Hosts with MCP Apps also show
|
|
|
544
529
|
});
|
|
545
530
|
tool("control_run", "runs:test", {
|
|
546
531
|
title: "Control run",
|
|
547
|
-
description: "
|
|
532
|
+
description: prompt("mcp", "tool.control_run"),
|
|
548
533
|
input: z.object({ runId: z.string(), action: z.enum(["back", "retry", "cancel"]) }),
|
|
549
534
|
destructive: true,
|
|
550
535
|
openWorld: true,
|
|
@@ -555,19 +540,19 @@ While status is running, get_run with waitSeconds. Hosts with MCP Apps also show
|
|
|
555
540
|
// --- workspace (widget code, libraries, reference data) --------------------
|
|
556
541
|
tool("list_files", "wizards:read", {
|
|
557
542
|
title: "List workspace files",
|
|
558
|
-
description: "
|
|
543
|
+
description: prompt("mcp", "tool.list_files"),
|
|
559
544
|
input: z.object({ wizardId: z.string() }),
|
|
560
545
|
readOnly: true,
|
|
561
546
|
}, async ({ wizardId }) => (await listFiles(who.userId, wizardId)).map(({ path, mime, size }) => ({ path, mime, size })));
|
|
562
547
|
tool("read_file", "wizards:read", {
|
|
563
548
|
title: "Read workspace file",
|
|
564
|
-
description: "
|
|
549
|
+
description: prompt("mcp", "tool.read_file"),
|
|
565
550
|
input: z.object({ wizardId: z.string(), path: z.string() }),
|
|
566
551
|
readOnly: true,
|
|
567
552
|
}, async ({ wizardId, path }) => readFileText(who.userId, wizardId, path));
|
|
568
553
|
tool("write_file", "wizards:write", {
|
|
569
554
|
title: "Write workspace file",
|
|
570
|
-
description: "
|
|
555
|
+
description: prompt("mcp", "tool.write_file"),
|
|
571
556
|
input: z.object({
|
|
572
557
|
wizardId: z.string(),
|
|
573
558
|
path: z.string().describe('Relative path, e.g. "weather/index.html" or "lib/d3.min.js".'),
|
|
@@ -584,7 +569,7 @@ While status is running, get_run with waitSeconds. Hosts with MCP Apps also show
|
|
|
584
569
|
});
|
|
585
570
|
tool("delete_file", "wizards:write", {
|
|
586
571
|
title: "Delete workspace file",
|
|
587
|
-
description: "
|
|
572
|
+
description: prompt("mcp", "tool.delete_file"),
|
|
588
573
|
input: z.object({ wizardId: z.string(), path: z.string() }),
|
|
589
574
|
destructive: true,
|
|
590
575
|
}, async ({ wizardId, path }) => {
|
|
@@ -602,7 +587,7 @@ While status is running, get_run with waitSeconds. Hosts with MCP Apps also show
|
|
|
602
587
|
});
|
|
603
588
|
server.registerTool("check_widget", {
|
|
604
589
|
title: "Check widget",
|
|
605
|
-
description: "
|
|
590
|
+
description: prompt("mcp", "tool.check_widget"),
|
|
606
591
|
inputSchema: input,
|
|
607
592
|
annotations: annotationsOf({ readOnly: true }),
|
|
608
593
|
}, (async ({ wizardId, stepId, data }) => {
|
|
@@ -640,13 +625,7 @@ export function registerPrompts(server) {
|
|
|
640
625
|
role: "user",
|
|
641
626
|
content: {
|
|
642
627
|
type: "text",
|
|
643
|
-
text:
|
|
644
|
-
|
|
645
|
-
1. Call get_authoring_guide and follow its rules.
|
|
646
|
-
2. Pick the closest starter (list_starters, get_starter) as an example.
|
|
647
|
-
3. create_wizard with a short note; fix every issue with edit_wizard.
|
|
648
|
-
4. start_test_run with realistic answers, then get_test_run with waitSeconds until it is done; fix what looks wrong.
|
|
649
|
-
5. Give me the studioUrl and a short summary. Publish only if I ask.`,
|
|
628
|
+
text: prompt("mcp", "prompt.design_wizard", { description }),
|
|
650
629
|
},
|
|
651
630
|
},
|
|
652
631
|
],
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { langNameEn } from "@engenty/wizards-shared/definition";
|
|
2
2
|
import { NotedError } from "../model-errors.js";
|
|
3
3
|
import { conversationAccess } from "../models.js";
|
|
4
|
+
import { prompt } from "../prompts.js";
|
|
5
|
+
import { contentPolicy } from "../safety.js";
|
|
4
6
|
/**
|
|
5
7
|
* A live conversation with a wizard: the browser talks to a realtime speech model directly
|
|
6
8
|
* (audio both ways over WebRTC); this runtime only mints the short-lived secret the browser
|
|
@@ -18,13 +20,13 @@ export const CONVERSATION_TOOLS = [
|
|
|
18
20
|
{
|
|
19
21
|
type: "function",
|
|
20
22
|
name: "get_state",
|
|
21
|
-
description: "
|
|
23
|
+
description: prompt("voice", "tool.get_state"),
|
|
22
24
|
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
23
25
|
},
|
|
24
26
|
{
|
|
25
27
|
type: "function",
|
|
26
28
|
name: "set_field",
|
|
27
|
-
description: "
|
|
29
|
+
description: prompt("voice", "tool.set_field"),
|
|
28
30
|
parameters: {
|
|
29
31
|
type: "object",
|
|
30
32
|
properties: {
|
|
@@ -40,19 +42,19 @@ export const CONVERSATION_TOOLS = [
|
|
|
40
42
|
{
|
|
41
43
|
type: "function",
|
|
42
44
|
name: "submit_page",
|
|
43
|
-
description: "
|
|
45
|
+
description: prompt("voice", "tool.submit_page"),
|
|
44
46
|
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
45
47
|
},
|
|
46
48
|
{
|
|
47
49
|
type: "function",
|
|
48
50
|
name: "accept_review",
|
|
49
|
-
description: "
|
|
51
|
+
description: prompt("voice", "tool.accept_review"),
|
|
50
52
|
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
51
53
|
},
|
|
52
54
|
{
|
|
53
55
|
type: "function",
|
|
54
56
|
name: "regenerate",
|
|
55
|
-
description: "
|
|
57
|
+
description: prompt("voice", "tool.regenerate"),
|
|
56
58
|
parameters: {
|
|
57
59
|
type: "object",
|
|
58
60
|
properties: {
|
|
@@ -66,7 +68,7 @@ export const CONVERSATION_TOOLS = [
|
|
|
66
68
|
{
|
|
67
69
|
type: "function",
|
|
68
70
|
name: "answer_ask",
|
|
69
|
-
description: "
|
|
71
|
+
description: prompt("voice", "tool.answer_ask"),
|
|
70
72
|
parameters: {
|
|
71
73
|
type: "object",
|
|
72
74
|
properties: { allow: { type: "boolean" } },
|
|
@@ -77,13 +79,13 @@ export const CONVERSATION_TOOLS = [
|
|
|
77
79
|
{
|
|
78
80
|
type: "function",
|
|
79
81
|
name: "look",
|
|
80
|
-
description: "
|
|
82
|
+
description: prompt("voice", "tool.look"),
|
|
81
83
|
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
82
84
|
},
|
|
83
85
|
{
|
|
84
86
|
type: "function",
|
|
85
87
|
name: "take_photo",
|
|
86
|
-
description: "
|
|
88
|
+
description: prompt("voice", "tool.take_photo"),
|
|
87
89
|
parameters: {
|
|
88
90
|
type: "object",
|
|
89
91
|
properties: { field: { type: "string", description: "The id of the image field." } },
|
|
@@ -94,28 +96,21 @@ export const CONVERSATION_TOOLS = [
|
|
|
94
96
|
{
|
|
95
97
|
type: "function",
|
|
96
98
|
name: "go_back",
|
|
97
|
-
description: "
|
|
99
|
+
description: prompt("voice", "tool.go_back"),
|
|
98
100
|
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
99
101
|
},
|
|
100
102
|
];
|
|
101
103
|
/** The rules the model speaks by: written in English, it speaks the wizard's language. */
|
|
102
104
|
export function conversationInstructions(view) {
|
|
103
|
-
const about = [
|
|
105
|
+
const about = [
|
|
106
|
+
prompt("voice", "persona", { title: view.wizard.title }),
|
|
107
|
+
view.wizard.description,
|
|
108
|
+
view.wizard.intro,
|
|
109
|
+
]
|
|
104
110
|
.filter(Boolean)
|
|
105
111
|
.join(" ");
|
|
106
|
-
const rules =
|
|
107
|
-
|
|
108
|
-
`Speak ${langNameEn(view.lang)} (${view.lang}), short and friendly, as on the phone. One sentence, then the next question.`,
|
|
109
|
-
"Ask one field at a time, in the order of the state. After each answer call set_field. When every field you can fill by voice is answered, call submit_page.",
|
|
110
|
-
"For a choice, name the options (at most four at a time) and pass exactly one of them on.",
|
|
111
|
-
"Read e-mail addresses, links and numbers back before passing them on.",
|
|
112
|
-
"A field that needs the screen (a photo, a file, a signature, a connection) is filled there by the person: say so in one sentence and wait for the next state.",
|
|
113
|
-
"While the wizard works, say in one sentence what it is doing and wait. Never make anything up.",
|
|
114
|
-
"At a review, sum the text up in a few words and ask whether it fits. Then accept_review, or regenerate with what the person wants changed.",
|
|
115
|
-
"At the end, say what was made and that it is on the screen.",
|
|
116
|
-
"With the camera on you can see what the person shows with look, and put a photo into a photo field with take_photo; ask for a photo field like this: 'Hold it to the camera, I will take the picture.' With the camera off, ask the person to switch it on, or leave the field to the screen.",
|
|
117
|
-
];
|
|
118
|
-
return `${about}\n\n${rules.join("\n")}`;
|
|
112
|
+
const rules = prompt("voice", "rules", { lang_name: langNameEn(view.lang), lang: view.lang });
|
|
113
|
+
return `${about}\n\n${rules}\n\n${contentPolicy()}`;
|
|
119
114
|
}
|
|
120
115
|
/** Mints the secret a browser opens a session with; a failure carries a note for the run's language. */
|
|
121
116
|
export async function mintConversation(view) {
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { experimental_generateVideo, generateImage, generateSpeech, generateText } from "ai";
|
|
2
2
|
import { extFor } from "../files/storage.js";
|
|
3
3
|
import { imageCostUsd, imageModel, isHarnessVendor, speechCostUsd, speechModel, textModel, videoCostUsd, videoModel, } from "../models.js";
|
|
4
|
+
import { prompt } from "../prompts.js";
|
|
5
|
+
import { checkContent } from "../safety.js";
|
|
4
6
|
import { capVideo, toMp3 } from "./ffmpeg.js";
|
|
5
7
|
import { speechTags } from "./marking.js";
|
|
6
8
|
/** One image. Gemini image models answer through chat with an image file; the rest through generateImage. */
|
|
7
9
|
export async function generateImageMedia(input) {
|
|
8
|
-
const {
|
|
10
|
+
const { reference, abortSignal } = input;
|
|
9
11
|
const aspect = (input.aspectRatio ?? "1:1");
|
|
10
12
|
const image = await imageModel(input.call);
|
|
13
|
+
await checkContent({ kind: "image", text: input.prompt, call: input.call, signal: abortSignal });
|
|
11
14
|
// The gateway books its own calls; a client's images are part of the person's subscription.
|
|
12
15
|
const costUsd = image.metered || isHarnessVendor(image.vendor) ? 0 : imageCostUsd(image.ref);
|
|
13
16
|
if (image.chat) {
|
|
14
17
|
const chat = await textModel("image", input.call);
|
|
15
|
-
const text = `${prompt}\n\
|
|
18
|
+
const text = `${input.prompt}\n\n${prompt("step", "image.aspect", { aspect })}`;
|
|
16
19
|
const result = await generateText({
|
|
17
20
|
model: chat.model,
|
|
18
21
|
abortSignal,
|
|
@@ -46,7 +49,7 @@ export async function generateImageMedia(input) {
|
|
|
46
49
|
model: image.model,
|
|
47
50
|
n: 1,
|
|
48
51
|
abortSignal,
|
|
49
|
-
prompt: reference ? { images: [reference.bytes], text: prompt } : prompt,
|
|
52
|
+
prompt: reference ? { images: [reference.bytes], text: input.prompt } : input.prompt,
|
|
50
53
|
aspectRatio: aspect,
|
|
51
54
|
});
|
|
52
55
|
const img = result.image ?? result.images?.[0];
|
|
@@ -78,6 +81,12 @@ export async function generateVideoMedia(input) {
|
|
|
78
81
|
const aspect = (input.aspectRatio === "1:1" ? "16:9" : (input.aspectRatio ?? "16:9"));
|
|
79
82
|
const resolution = input.resolution ?? "720p";
|
|
80
83
|
const videoClass = await videoModel(input.call);
|
|
84
|
+
await checkContent({
|
|
85
|
+
kind: "video",
|
|
86
|
+
text: input.prompt,
|
|
87
|
+
call: input.call,
|
|
88
|
+
signal: input.abortSignal,
|
|
89
|
+
});
|
|
81
90
|
const result = await experimental_generateVideo({
|
|
82
91
|
model: videoClass.model,
|
|
83
92
|
prompt: input.reference ? { image: input.reference.bytes, text: input.prompt } : input.prompt,
|
|
@@ -100,6 +109,12 @@ export async function generateVideoMedia(input) {
|
|
|
100
109
|
/** A text read aloud, as MP3 where ffmpeg is at hand (else as the model gave it). */
|
|
101
110
|
export async function generateSpeechMedia(input) {
|
|
102
111
|
const speech = await speechModel(input.call);
|
|
112
|
+
await checkContent({
|
|
113
|
+
kind: "speech",
|
|
114
|
+
text: input.style ? `${input.text}\n\nStyle: ${input.style}` : input.text,
|
|
115
|
+
call: input.call,
|
|
116
|
+
signal: input.abortSignal,
|
|
117
|
+
});
|
|
103
118
|
const result = await generateSpeech({
|
|
104
119
|
model: speech.model,
|
|
105
120
|
text: input.text,
|
|
@@ -3,6 +3,7 @@ import { join } from "node:path";
|
|
|
3
3
|
import { SPEECH_LOCALES } from "@engenty/wizards-shared/definition";
|
|
4
4
|
import { generateText, experimental_transcribe as transcribe } from "ai";
|
|
5
5
|
import { costOf, listenerModel, transcriptionCostUsd } from "../models.js";
|
|
6
|
+
import { prompt } from "../prompts.js";
|
|
6
7
|
import { ffmpeg, hasFfmpeg, probeMedia, withTempDir } from "./ffmpeg.js";
|
|
7
8
|
/** Browsers name a recording "audio/webm;codecs=opus"; models want the bare type. */
|
|
8
9
|
function bareType(mediaType) {
|
|
@@ -33,12 +34,12 @@ export async function transcribeAudio(input) {
|
|
|
33
34
|
const result = await generateText({
|
|
34
35
|
model: listener.resolved.model,
|
|
35
36
|
abortSignal: input.abortSignal,
|
|
36
|
-
system: "
|
|
37
|
+
system: prompt("services", "transcribe.voice_note"),
|
|
37
38
|
messages: [
|
|
38
39
|
{
|
|
39
40
|
role: "user",
|
|
40
41
|
content: [
|
|
41
|
-
{ type: "text", text: "
|
|
42
|
+
{ type: "text", text: prompt("services", "transcribe.voice_note.user") },
|
|
42
43
|
{ type: "file", data: input.bytes, mediaType: bareType(input.mediaType) },
|
|
43
44
|
],
|
|
44
45
|
},
|
|
@@ -172,12 +173,12 @@ export async function listenPieces(input) {
|
|
|
172
173
|
const result = await generateText({
|
|
173
174
|
model: listener.resolved.model,
|
|
174
175
|
abortSignal: input.abortSignal,
|
|
175
|
-
system:
|
|
176
|
+
system: prompt("services", "transcribe.piece"),
|
|
176
177
|
messages: [
|
|
177
178
|
{
|
|
178
179
|
role: "user",
|
|
179
180
|
content: [
|
|
180
|
-
{ type: "text", text: "
|
|
181
|
+
{ type: "text", text: prompt("services", "transcribe.piece.user") },
|
|
181
182
|
{ type: "file", data: audio, mediaType: "audio/mpeg" },
|
|
182
183
|
],
|
|
183
184
|
},
|
|
@@ -21,6 +21,7 @@ import { hasFfmpeg } from "./media/ffmpeg.js";
|
|
|
21
21
|
import { ModelUnavailableError, saidOf } from "./model-errors.js";
|
|
22
22
|
import { seal, unseal } from "./secrets/crypto.js";
|
|
23
23
|
import { vaultDelete, vaultGet, vaultSet } from "./secrets/vault.js";
|
|
24
|
+
import { chatModelId } from "./services/chat-models.js";
|
|
24
25
|
import { readSetting, writeSetting } from "./settings.js";
|
|
25
26
|
import { currentTenant, currentTenantOrNull } from "./tenants/tenant.js";
|
|
26
27
|
import { serverText } from "./texts.js";
|
|
@@ -442,11 +443,11 @@ async function ownTextModel(cls, meta) {
|
|
|
442
443
|
return { model, ref: route.ref, vendor: vendorOf(route.ref), gateway, metered: false };
|
|
443
444
|
}
|
|
444
445
|
/**
|
|
445
|
-
* What answers the studio's chats, Goose and the editor's chat:
|
|
446
|
-
*
|
|
446
|
+
* What answers the studio's chats, Goose and the editor's chat: an installed client on its
|
|
447
|
+
* subscription, one provider's own key, or the credits. The chat has its own models, apart from
|
|
448
|
+
* the classes the wizards' steps run on (services/chat-models.ts).
|
|
447
449
|
*/
|
|
448
450
|
export const CHAT_WAYS = [
|
|
449
|
-
"models",
|
|
450
451
|
"claude",
|
|
451
452
|
"codex",
|
|
452
453
|
"cursor",
|
|
@@ -457,10 +458,7 @@ export const CHAT_WAYS = [
|
|
|
457
458
|
"account",
|
|
458
459
|
];
|
|
459
460
|
/** Whether a way can answer now: the client signed in, the key there, the account linked. */
|
|
460
|
-
export async function chatWayReady(way
|
|
461
|
-
if (way === "models") {
|
|
462
|
-
return textModelReady;
|
|
463
|
-
}
|
|
461
|
+
export async function chatWayReady(way) {
|
|
464
462
|
if (managed) {
|
|
465
463
|
return false;
|
|
466
464
|
}
|
|
@@ -482,13 +480,14 @@ export async function chatModel(way, cls) {
|
|
|
482
480
|
if (way === "models") {
|
|
483
481
|
return textModel(cls);
|
|
484
482
|
}
|
|
483
|
+
const effort = cls === "high" ? "extra" : "normal";
|
|
485
484
|
const cfg = await config();
|
|
486
485
|
const client = harness(way);
|
|
487
486
|
if (client) {
|
|
488
487
|
if (!(await detectHarness(client.id))?.version) {
|
|
489
488
|
throw new ModelUnavailableError(notInstalled(client));
|
|
490
489
|
}
|
|
491
|
-
const alias = client.classes[cls];
|
|
490
|
+
const alias = (await chatModelId(way, effort)) ?? client.classes[cls];
|
|
492
491
|
return {
|
|
493
492
|
model: client.model(alias),
|
|
494
493
|
ref: `${client.id}/${alias}`,
|
|
@@ -504,7 +503,7 @@ export async function chatModel(way, cls) {
|
|
|
504
503
|
}
|
|
505
504
|
return viaCredits({ kind: "credits", access, model: null }, cls, {}, (gateway, id) => gateway(id));
|
|
506
505
|
}
|
|
507
|
-
const ref = providerInfo(way)?.text?.[cls];
|
|
506
|
+
const ref = (await chatModelId(way, effort)) ?? providerInfo(way)?.text?.[cls];
|
|
508
507
|
if (!ref) {
|
|
509
508
|
throw new ModelUnavailableError(note("noModelFor", { makes: note("makesText") }));
|
|
510
509
|
}
|