@engenty/wizards-runtime 0.11.4 → 0.11.6
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 +6 -7
- package/apps/runtime/dist/agents/chat-clients.js +3 -0
- package/apps/runtime/dist/agents/studio-assistant.js +26 -7
- package/apps/runtime/dist/agents/subscription.js +24 -11
- package/apps/runtime/dist/assistant/knows.js +1 -1
- package/apps/runtime/dist/auth/index.js +15 -2
- package/apps/runtime/dist/authoring/guide.js +2 -8
- package/apps/runtime/dist/credits/estimate.js +1 -1
- package/apps/runtime/dist/data/chat-models.json +116 -0
- package/apps/runtime/dist/db/migrations/tenant/0025_drop_mcp_servers.sql +1 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0025_snapshot.json +3959 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +7 -0
- package/apps/runtime/dist/db/schema.js +0 -4
- package/apps/runtime/dist/docs/dev/plugins/events.md +2 -2
- package/apps/runtime/dist/docs/dev/wizard-format/agent-steps.md +1 -2
- package/apps/runtime/dist/docs/dev/wizard-format/wizard-file.md +6 -8
- package/apps/runtime/dist/docs/user-guide/cloud-sync.md +2 -2
- package/apps/runtime/dist/docs/user-guide/connectors.md +1 -10
- package/apps/runtime/dist/docs/user-guide/models.md +15 -5
- package/apps/runtime/dist/docs/user-guide/steps.md +2 -3
- package/apps/runtime/dist/engine/steps.js +126 -131
- package/apps/runtime/dist/env.js +5 -0
- package/apps/runtime/dist/live/views.js +1 -3
- package/apps/runtime/dist/mcp/tools.js +1 -1
- package/apps/runtime/dist/models.js +8 -9
- package/apps/runtime/dist/routes/studio.js +39 -6
- package/apps/runtime/dist/services/architect.js +5 -5
- package/apps/runtime/dist/services/chat-models.js +58 -0
- package/apps/runtime/dist/services/package-file.js +0 -1
- package/apps/runtime/dist/services/package.js +0 -10
- package/apps/runtime/dist/services/projects.js +1 -31
- package/apps/runtime/dist/services/spaces.js +5 -23
- package/apps/runtime/dist/services/wizards.js +8 -0
- package/apps/runtime/dist/sync/records.js +0 -9
- package/apps/runtime/dist/tools/index.js +0 -28
- package/apps/web/dist/assets/{AboutDialog-B7ThTqw4.js → AboutDialog-30Mc1_N_.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-DBpXTjxr.js → ChangelogDialog-Vjxg6JV8.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-BTcAUlGY.js → CodeEditor-CmMRfVhS.js} +1 -1
- package/apps/web/dist/assets/EditorPage-Di5KB-Ei.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-Sjnlj0OO.js → FlowPreview-BkcO3iCf.js} +1 -1
- package/apps/web/dist/assets/{Harness-BKl73EG5.js → Harness-D_Hr80Fo.js} +1 -1
- package/apps/web/dist/assets/Marketplace-BxFBMUsi.js +2 -0
- package/apps/web/dist/assets/{NewWizardChannels-DarxdQRt.js → NewWizardChannels-BIzOtfc8.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-BCoPZjp5.js → NewWizardPage-BenzMrPD.js} +1 -1
- package/apps/web/dist/assets/{OnboardingPage-qV_YA_mZ.js → OnboardingPage-DuckyzQr.js} +1 -1
- package/apps/web/dist/assets/{PreviewPane-B5_GY6Cv.js → PreviewPane-D9hmriSm.js} +2 -2
- package/apps/web/dist/assets/{ProjectPage-Bcc81_KO.js → ProjectPage-A8Z8cS1E.js} +1 -1
- package/apps/web/dist/assets/{PublicRunner-hlxaESAv.js → PublicRunner-QPvlEAxx.js} +1 -1
- package/apps/web/dist/assets/{ReadOnly-BUnTzhA3.js → ReadOnly-DFn32cvo.js} +1 -1
- package/apps/web/dist/assets/SettingsPage-ByP15ndy.js +2 -0
- package/apps/web/dist/assets/{SetupPage-DAgnVxDA.js → SetupPage-WNHH74hu.js} +1 -1
- package/apps/web/dist/assets/{SharePage-aKBNZDby.js → SharePage-Bw4TRWtv.js} +1 -1
- package/apps/web/dist/assets/changelog-Dr9tAFY9.js +1 -0
- package/apps/web/dist/assets/{coins-C8RAtYAu.js → coins-DTH3SKgZ.js} +1 -1
- package/apps/web/dist/assets/i18n-CLxuuhp_.js +55 -0
- package/apps/web/dist/assets/index-Bha72INy.css +1 -0
- package/apps/web/dist/assets/index-HhslPV6N.js +34 -0
- package/apps/web/dist/assets/oss-credits-CZT1KRIp.js +1 -0
- package/apps/web/dist/assets/{phone-DTuPPVhC.js → phone-DymZ7rLO.js} +1 -1
- package/apps/web/dist/assets/{runners-BcK_yEKU.js → runners-UfKeoOe4.js} +1 -1
- package/apps/web/dist/assets/{session-C7ciCzbV.js → session-COf_im0l.js} +1 -1
- package/apps/web/dist/assets/{settings-menu-b7am2SP5.js → settings-menu-mtOjI15L.js} +1 -1
- package/apps/web/dist/assets/{theme-BOAjs_xb.js → theme-DWoTWDAG.js} +1 -1
- package/apps/web/dist/assets/{ui-DKK_O65k.js → ui-D_0Xdrjh.js} +2 -2
- package/apps/web/dist/assets/{upload-Cbcw8l_0.js → upload-BizIzwxa.js} +1 -1
- package/apps/web/dist/assets/{useMutation-D8Bpwvs1.js → useMutation-BJfRETsQ.js} +1 -1
- package/apps/web/dist/assets/{volume-2-CgRP_A7r.js → volume-2-BGkyA8T9.js} +1 -1
- package/apps/web/dist/assets/{wrench-me5bf7bd.js → wrench-Be5zav03.js} +1 -1
- package/apps/web/dist/index.html +9 -9
- package/apps/web/dist/mcp/flow.html +3 -3
- 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/definition.d.ts +0 -4
- package/node_modules/@engenty/wizards-shared/dist/definition.js +0 -3
- package/node_modules/@engenty/wizards-shared/dist/fit.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/fit.js +0 -4
- package/node_modules/@engenty/wizards-shared/dist/marketplace.js +2 -2
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +1 -2
- package/node_modules/@engenty/wizards-shared/dist/run.js +2 -4
- package/node_modules/@engenty/wizards-shared/dist/wizard-package.d.ts +0 -4
- package/node_modules/@engenty/wizards-shared/dist/wizard-package.js +0 -5
- package/package.json +1 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/web/dist/assets/EditorPage-B_cFXR-B.js +0 -3
- package/apps/web/dist/assets/Marketplace-BNu-Hjzu.js +0 -2
- package/apps/web/dist/assets/SettingsPage-BoA-ykQU.js +0 -2
- package/apps/web/dist/assets/changelog-DwJOKc4z.js +0 -1
- package/apps/web/dist/assets/i18n-Bq6dt_qv.js +0 -55
- package/apps/web/dist/assets/index-BdwA-8jc.js +0 -34
- package/apps/web/dist/assets/index-DQc1EITf.css +0 -1
- package/apps/web/dist/assets/oss-credits-C6bPkfSE.js +0 -1
|
@@ -5,7 +5,7 @@ import { isTextMime } from "@engenty/wizards-shared/workspace";
|
|
|
5
5
|
import { Agent } from "@mastra/core/agent";
|
|
6
6
|
import { createTool } from "@mastra/core/tools";
|
|
7
7
|
import { z } from "zod";
|
|
8
|
-
import { connectorsLine, exampleWizard,
|
|
8
|
+
import { connectorsLine, exampleWizard, PRINCIPLES, pluginToolsLine, SCHEMA_DOC, WIDGET_GUIDE, } from "../authoring/guide.js";
|
|
9
9
|
import { wizardOpSchema } from "../authoring/ops.js";
|
|
10
10
|
import { importFromRegistry, listConnectors, searchRegistry } from "../connectors/external.js";
|
|
11
11
|
import { agentModel, attachTools, chatModel, costOf, gatewayTools, totalUsage, } from "../models.js";
|
|
@@ -21,7 +21,7 @@ import { attempt as attemptTool, imageOutput } from "../tools/shared.js";
|
|
|
21
21
|
import { runScript } from "../widgets/script.js";
|
|
22
22
|
import { thoughtLine } from "./thought.js";
|
|
23
23
|
const MAX_STEPS = 45;
|
|
24
|
-
function systemPrompt(
|
|
24
|
+
function systemPrompt(connectors, pluginTools) {
|
|
25
25
|
return `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.
|
|
26
26
|
|
|
27
27
|
You talk to the ADMIN who builds the wizard. Answer in the admin's language, briefly and warmly. Never mention JSON, ids, schemas, files or templates to them — talk about pages, questions, steps, the widget and results.
|
|
@@ -33,8 +33,6 @@ ${WIDGET_GUIDE}
|
|
|
33
33
|
Surface catalog (for surface steps and output.surface):
|
|
34
34
|
${SURFACE_GUIDE}
|
|
35
35
|
|
|
36
|
-
${mcpServersLine(mcp)}
|
|
37
|
-
|
|
38
36
|
${connectorsLine(connectors)}${pluginToolsLine(pluginTools)}
|
|
39
37
|
|
|
40
38
|
Example of a complete wizard:
|
|
@@ -322,8 +320,9 @@ export async function runArchitect(input) {
|
|
|
322
320
|
const w = await ownedWizard(input.userId, input.wizardId);
|
|
323
321
|
const files = await listFiles(input.userId, input.wizardId);
|
|
324
322
|
let changed = false;
|
|
325
|
-
// Building a wizard is the hardest job here: widgets are code
|
|
326
|
-
|
|
323
|
+
// Building a wizard is the hardest job here: widgets are code, so the editor chat starts on
|
|
324
|
+
// extra effort.
|
|
325
|
+
const resolved = await chatModel(input.way, input.extra === false ? "standard" : "high");
|
|
327
326
|
const tools = buildTools(input, resolved, () => {
|
|
328
327
|
changed = true;
|
|
329
328
|
});
|
|
@@ -334,7 +333,7 @@ export async function runArchitect(input) {
|
|
|
334
333
|
// The system prompt is long and identical on every turn: cache it.
|
|
335
334
|
instructions: {
|
|
336
335
|
role: "system",
|
|
337
|
-
content: systemPrompt(input.
|
|
336
|
+
content: systemPrompt(input.connectors, await pluginToolsOf(currentTenant())),
|
|
338
337
|
providerOptions: { anthropic: { cacheControl: { type: "ephemeral" } } },
|
|
339
338
|
},
|
|
340
339
|
model: agentModel(resolved),
|
|
@@ -40,6 +40,7 @@ const claude = {
|
|
|
40
40
|
"",
|
|
41
41
|
"--append-system-prompt",
|
|
42
42
|
call.system,
|
|
43
|
+
...(call.model ? ["--model", call.model] : []),
|
|
43
44
|
...(call.session ? ["--resume", call.session] : []),
|
|
44
45
|
],
|
|
45
46
|
stdin: (call) => `${JSON.stringify({
|
|
@@ -134,6 +135,7 @@ const codex = {
|
|
|
134
135
|
const options = [
|
|
135
136
|
"--json",
|
|
136
137
|
"--skip-git-repo-check",
|
|
138
|
+
...(call.model ? ["-m", call.model] : []),
|
|
137
139
|
// Only this server's tools: none of the person's own MCP servers start.
|
|
138
140
|
"--ignore-user-config",
|
|
139
141
|
"-c",
|
|
@@ -220,6 +222,7 @@ const cursor = {
|
|
|
220
222
|
"--workspace",
|
|
221
223
|
call.dir,
|
|
222
224
|
"--approve-mcps",
|
|
225
|
+
...(call.model && call.model !== "auto" ? ["--model", call.model] : []),
|
|
223
226
|
...(call.session ? ["--resume", call.session] : []),
|
|
224
227
|
],
|
|
225
228
|
stdin: (call) => call.message,
|
|
@@ -8,7 +8,7 @@ import { knowsTools } from "../assistant/knows.js";
|
|
|
8
8
|
import { PRIMER } from "../assistant/primer.js";
|
|
9
9
|
import { currentFeatures } from "../features.js";
|
|
10
10
|
import { managed } from "../manage.js";
|
|
11
|
-
import { agentModel, attachTools, chatModel, contextWindowOf, costOf, gatewayTools,
|
|
11
|
+
import { agentModel, attachTools, chatModel, contextWindowOf, costOf, gatewayTools, totalUsage, usageOf, } from "../models.js";
|
|
12
12
|
import { knowledgeCounts } from "../services/knowledge.js";
|
|
13
13
|
import { addProjectFileFromUrl, projectFileContent, projectFiles, updateProjectFile, } from "../services/project-files.js";
|
|
14
14
|
import { documentText } from "../services/project-index.js";
|
|
@@ -18,7 +18,7 @@ import { currentTenant } from "../tenants/tenant.js";
|
|
|
18
18
|
import { serverText } from "../texts.js";
|
|
19
19
|
import { assistantPageOf, assistantToolsOf } from "../tools/plugin.js";
|
|
20
20
|
import { attempt as attemptTool, imageOutput } from "../tools/shared.js";
|
|
21
|
-
import {
|
|
21
|
+
import { chatTurnWay } from "./subscription.js";
|
|
22
22
|
import { readWebsite } from "./website.js";
|
|
23
23
|
/** How a message written meanwhile reaches the model. */
|
|
24
24
|
export function signalText(taken) {
|
|
@@ -680,8 +680,8 @@ export async function runStudioAssistant(input) {
|
|
|
680
680
|
// this grew during it.
|
|
681
681
|
let changes = 0;
|
|
682
682
|
// The way the settings chose for the studio's chats: on a client, its tools reach it over MCP.
|
|
683
|
-
const way =
|
|
684
|
-
const resolved = await chatModel(way, "standard");
|
|
683
|
+
const way = await chatTurnWay(managed);
|
|
684
|
+
const resolved = await chatModel(way, input.extra ? "high" : "standard");
|
|
685
685
|
const wrote = () => {
|
|
686
686
|
changes++;
|
|
687
687
|
input.onChanged?.();
|
|
@@ -698,9 +698,7 @@ export async function runStudioAssistant(input) {
|
|
|
698
698
|
const tools = {
|
|
699
699
|
...knowsTools({
|
|
700
700
|
user: input.user,
|
|
701
|
-
project: project
|
|
702
|
-
? { id: project.id, name: project.name, mcpServers: project.mcpServers }
|
|
703
|
-
: null,
|
|
701
|
+
project: project ? { id: project.id, name: project.name } : null,
|
|
704
702
|
lang: input.lang,
|
|
705
703
|
chatId: input.chat.id,
|
|
706
704
|
doing: (label) => input.onActivity?.(label),
|
|
@@ -711,6 +709,27 @@ export async function runStudioAssistant(input) {
|
|
|
711
709
|
}),
|
|
712
710
|
...(space ? spaceTools(input, space, wrote, brandOn) : {}),
|
|
713
711
|
};
|
|
712
|
+
// On everyday effort the chat can offer extra effort for work that asks for more: a card with
|
|
713
|
+
// a button, while it goes on answering.
|
|
714
|
+
if (!input.extra) {
|
|
715
|
+
tools.suggest_extra_effort = createTool({
|
|
716
|
+
id: "suggest_extra_effort",
|
|
717
|
+
description: "Offers the person extra effort (a more capable model) with a button under your answer. Call it once, before you start, when the work is demanding: building or changing a wizard with many steps, writing a widget (code), a long or intricate flow, hard analysis. Never for everyday questions or small changes. Say nothing about the button yourself and go on with your answer.",
|
|
718
|
+
inputSchema: z.object({
|
|
719
|
+
reason: z
|
|
720
|
+
.string()
|
|
721
|
+
.min(3)
|
|
722
|
+
.max(160)
|
|
723
|
+
.describe("Why this work needs more, in the person's language, one short sentence."),
|
|
724
|
+
}),
|
|
725
|
+
execute: async ({ reason }) => {
|
|
726
|
+
const card = { plugin: "", tool: "extraEffort", data: { reason } };
|
|
727
|
+
cards.push(card);
|
|
728
|
+
input.onCard?.(card);
|
|
729
|
+
return { shown: true };
|
|
730
|
+
},
|
|
731
|
+
});
|
|
732
|
+
}
|
|
714
733
|
// What the tenant's plugins let the assistant do besides: a source of knowledge, say.
|
|
715
734
|
if (space) {
|
|
716
735
|
Object.assign(tools, await assistantToolsOf({
|
|
@@ -4,11 +4,14 @@ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node
|
|
|
4
4
|
import { homedir } from "node:os";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
6
6
|
import { createInterface } from "node:readline";
|
|
7
|
+
import { note } from "@engenty/wizards-shared/run";
|
|
7
8
|
import { internalKey } from "../auth/keys.js";
|
|
8
9
|
import { env } from "../env.js";
|
|
9
10
|
import { resolveEnv } from "../harness/env.js";
|
|
10
11
|
import { detectHarness, harness, signedOut } from "../harness/index.js";
|
|
11
|
-
import {
|
|
12
|
+
import { ModelUnavailableError } from "../model-errors.js";
|
|
13
|
+
import { CHAT_WAYS, chatWayReady, localModelSettings, } from "../models.js";
|
|
14
|
+
import { chatModelId } from "../services/chat-models.js";
|
|
12
15
|
import { ServiceError } from "../services/errors.js";
|
|
13
16
|
import { deleteSetting, readSetting, writeSetting } from "../settings.js";
|
|
14
17
|
import { serverText } from "../texts.js";
|
|
@@ -120,6 +123,7 @@ export async function subscriptionTurn(input) {
|
|
|
120
123
|
mcpUrl: mcpUrl(),
|
|
121
124
|
dir,
|
|
122
125
|
mcpConfigFile: input.client === "claude" ? mcpConfig() : undefined,
|
|
126
|
+
model: (await chatModelId(input.client, input.extra === false ? "normal" : "extra")) ?? undefined,
|
|
123
127
|
images,
|
|
124
128
|
};
|
|
125
129
|
const h = harness(input.client);
|
|
@@ -210,26 +214,35 @@ export async function subscriptionTurn(input) {
|
|
|
210
214
|
}
|
|
211
215
|
}
|
|
212
216
|
/** The ways that can answer the studio's chats now, in the order the settings offer them. */
|
|
213
|
-
export async function chatWays(
|
|
214
|
-
const ready = await Promise.all(CHAT_WAYS.map((w) => chatWayReady(w
|
|
217
|
+
export async function chatWays() {
|
|
218
|
+
const ready = await Promise.all(CHAT_WAYS.map((w) => chatWayReady(w)));
|
|
215
219
|
return CHAT_WAYS.filter((_, i) => ready[i]);
|
|
216
220
|
}
|
|
217
221
|
/**
|
|
218
222
|
* What answers the studio's chats, Goose and the editor's chat, on a runtime that runs alone: the
|
|
219
|
-
* way chosen while it can answer, else
|
|
223
|
+
* way chosen while it can answer, else Claude Code where it is the source of models, else the
|
|
224
|
+
* first way that is ready. Null where none is: the chat then says what to set up.
|
|
220
225
|
*/
|
|
221
|
-
export async function chatEngine(
|
|
226
|
+
export async function chatEngine() {
|
|
222
227
|
const chosen = await readSetting("chat-engine");
|
|
223
|
-
if (chosen && CHAT_WAYS.includes(chosen) && (await chatWayReady(chosen
|
|
228
|
+
if (chosen && CHAT_WAYS.includes(chosen) && (await chatWayReady(chosen))) {
|
|
224
229
|
return chosen;
|
|
225
230
|
}
|
|
226
|
-
|
|
227
|
-
// Nothing chosen: where Claude Code is the source of models, it answers the chat too.
|
|
228
|
-
if (claude && localModelSettings().source === "claude") {
|
|
231
|
+
if (localModelSettings().source === "claude" && (await chatWayReady("claude"))) {
|
|
229
232
|
return "claude";
|
|
230
233
|
}
|
|
231
|
-
|
|
232
|
-
|
|
234
|
+
return (await chatWays())[0] ?? null;
|
|
235
|
+
}
|
|
236
|
+
/** The way a turn runs on: a cloud runtime's own classes, else `chatEngine`, or a refusal naming what to set up. */
|
|
237
|
+
export async function chatTurnWay(managed) {
|
|
238
|
+
if (managed) {
|
|
239
|
+
return "models";
|
|
240
|
+
}
|
|
241
|
+
const way = await chatEngine();
|
|
242
|
+
if (!way) {
|
|
243
|
+
throw new ModelUnavailableError(note("chatNoWay"));
|
|
244
|
+
}
|
|
245
|
+
return way;
|
|
233
246
|
}
|
|
234
247
|
export function setChatEngine(way) {
|
|
235
248
|
return writeSetting("chat-engine", way);
|
|
@@ -68,7 +68,7 @@ export function knowsTools(ctx) {
|
|
|
68
68
|
inputSchema: z.object({ from: z.number().int().min(0).optional() }),
|
|
69
69
|
execute: ({ from }) => attempt(async () => {
|
|
70
70
|
ctx.doing(serverText(ctx.lang, "doingAuthoringGuide"));
|
|
71
|
-
const guide = authoringGuide(ctx.project
|
|
71
|
+
const guide = authoringGuide(ctx.project ? await listConnectors(ctx.project.id) : [], await pluginToolsOf(user.tenantId));
|
|
72
72
|
const start = Math.min(from ?? 0, guide.length);
|
|
73
73
|
return {
|
|
74
74
|
text: guide.slice(start, start + 14_000),
|
|
@@ -74,6 +74,8 @@ const WISH_MAX = 600;
|
|
|
74
74
|
const STATE_COOKIE = "wz_oauth";
|
|
75
75
|
const SESSION_DAYS = 30;
|
|
76
76
|
const SCOPE = "openid profile email offline_access wizards:read wizards:write wizards:publish runs:test";
|
|
77
|
+
/** Marks the state of a sign-in started again (nanoid never makes a dot). */
|
|
78
|
+
const AGAIN = "again.";
|
|
77
79
|
// The desktop app shows a server in its window but signs in through the system browser
|
|
78
80
|
// (Google refuses embedded views). The finished session travels back as a one-time code in an
|
|
79
81
|
// `engenty-wizards://` link; it only counts in the window that asked for it, which holds the
|
|
@@ -272,7 +274,8 @@ export const authRoutes = new Hono()
|
|
|
272
274
|
const ticket = unseal(c.req.query("desktop") ?? "");
|
|
273
275
|
const state = {
|
|
274
276
|
verifier,
|
|
275
|
-
|
|
277
|
+
// A second try after a sign-in whose state stayed in another browser: marked, so it runs once.
|
|
278
|
+
nonce: c.req.query("again") === "1" ? `${AGAIN}${nanoid(16)}` : nanoid(16),
|
|
276
279
|
returnTo: safeReturn(c.req.query("return")),
|
|
277
280
|
exp: Date.now() + 15 * 60_000,
|
|
278
281
|
...(ticket && ticket.exp > Date.now() ? { desktop: ticket.desktop } : {}),
|
|
@@ -331,9 +334,19 @@ export const authRoutes = new Hono()
|
|
|
331
334
|
}
|
|
332
335
|
const state = unseal(getCookie(c, STATE_COOKIE) ?? "");
|
|
333
336
|
deleteCookie(c, STATE_COOKIE, { path: `${basePath}/api/auth` });
|
|
334
|
-
if (!code
|
|
337
|
+
if (!code) {
|
|
335
338
|
return c.redirect(`${home}?signin=failed`);
|
|
336
339
|
}
|
|
340
|
+
if (!state || state.exp < Date.now() || state.nonce !== rawState) {
|
|
341
|
+
// The sign-in began in another browser (the e-mail link opened on the phone): its state is
|
|
342
|
+
// there. The account is signed in here now, so a sign-in started here goes through without
|
|
343
|
+
// a page. Once: a second miss is a failure.
|
|
344
|
+
if (rawState.startsWith(AGAIN)) {
|
|
345
|
+
return c.redirect(`${home}?signin=failed`);
|
|
346
|
+
}
|
|
347
|
+
const again = new URLSearchParams({ again: "1", return: home });
|
|
348
|
+
return c.redirect(`${basePath}/api/auth/login?${again}`);
|
|
349
|
+
}
|
|
337
350
|
try {
|
|
338
351
|
const tokens = await tokenRequest({
|
|
339
352
|
grant_type: "authorization_code",
|
|
@@ -153,7 +153,6 @@ type AgentStep = {
|
|
|
153
153
|
// data (free appointment times) — it answers in a second instead of half a minute.
|
|
154
154
|
// String inputs are templates; a filled-in whole number or true/false is passed as one.
|
|
155
155
|
tools: ("web_search"|"web_fetch"|"browser"|"sandbox"|"image"|"http"|"pages"|"code")[]
|
|
156
|
-
mcp?: string[] // ids of the project's MCP servers this step may use
|
|
157
156
|
connections?: string[] // ids of wizard connections this step may read (mail → mail_search, mail_read, mail_save)
|
|
158
157
|
output: { format: "text"|"markdown"|"json", fields?: { id, kind: "text"|"number"|"list"|"table"|"yesno"|"choice"|"score", description, columns?: string[], options?: string[] }[], schema?: Schema, surface?: SurfaceComponent[] | true }
|
|
159
158
|
// "score" answers its description on the scale in options, lowest first ("low", "medium", "high")
|
|
@@ -350,7 +349,7 @@ How good wizards look:
|
|
|
350
349
|
- Money/totals: use an "items" field with vat — the runner computes totals; documents must use {{items}} verbatim. Never let a model compute totals.
|
|
351
350
|
- Facts from the web need an agent step with web_search + web_fetch BEFORE writing; documents then cite those notes.
|
|
352
351
|
- Live data with a free public JSON API (weather and wind: api.open-meteo.com; sunrise/sunset is in it too) → an agent step with the http tool and model "low" that calls the API and returns json. Far cheaper and more exact than web research; use web research only when no API exists.
|
|
353
|
-
- Writing into other systems (CRM, database, spreadsheet, website): an agent step with the matching
|
|
352
|
+
- Writing into other systems (CRM, database, spreadsheet, website): an agent step with the matching connector, http, or browser tool, preceded by a review step. Such a step hands over an earlier step's output as a file by naming it "result:<stepId>.<format>" — to browser_upload, or as "file:result:<stepId>.<format>" where a connector action takes "*_base64".
|
|
354
353
|
- Sending the finished result on (mail it, file it in a cloud folder, post it on social media or a website, put it into an ads account): do not build a step for it. Put the targets into the result step's "share": the person sees the result first and sends it with one button. Build an agent step only when the wizard must write somewhere without being asked.
|
|
355
354
|
${sandboxGuideLine()}
|
|
356
355
|
- Remembering between runs ("merke dir", "führe eine Liste"): declare a list and let an agent step save into it with list_write; a later run reads it as {{lists.id}} or list_read. Give it a key column so known rows are updated, not duplicated. Never make the person re-upload last time's result.
|
|
@@ -431,14 +430,11 @@ export function pluginToolsLine(tools) {
|
|
|
431
430
|
const lines = tools.map((t) => `- ${t.id} — ${t.description}`);
|
|
432
431
|
return `\n\nTools of this app's plugins. An agent step lists one in "tools" by its full id, next to the built-in ones; a wizard that uses one runs only where that plugin is installed:\n${lines.join("\n")}`;
|
|
433
432
|
}
|
|
434
|
-
export function mcpServersLine(mcp) {
|
|
435
|
-
return `Project MCP servers available to agent steps: ${mcp.length ? mcp.map((m) => `${m.id} (${m.name})`).join(", ") : "none — if the admin wants to write into an external system that needs one, build the step with http or browser, and tell them they can connect a server in the project settings"}.`;
|
|
436
|
-
}
|
|
437
433
|
export function exampleWizard() {
|
|
438
434
|
return JSON.stringify(EXAMPLE_WIZARD, null, 2);
|
|
439
435
|
}
|
|
440
436
|
/** The guide an MCP client reads before it writes a wizard. */
|
|
441
|
-
export function authoringGuide(
|
|
437
|
+
export function authoringGuide(connectors = [], pluginTools = []) {
|
|
442
438
|
return `engenty wizards: a wizard is a page-by-page flow an end user walks through on a shared link. Pages ask questions; AI steps research, write, draw images, render video, build documents and dashboards, or write into other systems. You author the wizard as JSON; the person who asked you is the ADMIN, the people who later open the link are END USERS.
|
|
443
439
|
|
|
444
440
|
${SCHEMA_DOC}
|
|
@@ -448,8 +444,6 @@ ${WIDGET_GUIDE}
|
|
|
448
444
|
Surface catalog (for surface steps and output.surface):
|
|
449
445
|
${SURFACE_GUIDE}
|
|
450
446
|
|
|
451
|
-
${mcpServersLine(mcp)}
|
|
452
|
-
|
|
453
447
|
${connectorsLine(connectors)}${pluginToolsLine(pluginTools)}
|
|
454
448
|
|
|
455
449
|
Models: a step names the KIND of model it needs, never a model. Pick the cheapest class that does the job:
|
|
@@ -47,7 +47,7 @@ function stepFormula(step, catalog) {
|
|
|
47
47
|
}
|
|
48
48
|
const shape = step.tools.includes("browser")
|
|
49
49
|
? TOKENS.browser
|
|
50
|
-
: step.tools.length || step.
|
|
50
|
+
: step.tools.length || step.connections?.length
|
|
51
51
|
? TOKENS.tools
|
|
52
52
|
: TOKENS.plain;
|
|
53
53
|
// A step with `each` runs once per entry; until it has run, three stand in.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"updated": "2026-10-22",
|
|
4
|
+
"ways": {
|
|
5
|
+
"claude": {
|
|
6
|
+
"normal": "sonnet",
|
|
7
|
+
"extra": "opus",
|
|
8
|
+
"models": [
|
|
9
|
+
{
|
|
10
|
+
"id": "sonnet",
|
|
11
|
+
"label": "Sonnet"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"id": "opus",
|
|
15
|
+
"label": "Opus"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"id": "haiku",
|
|
19
|
+
"label": "Haiku"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"codex": {
|
|
24
|
+
"normal": "gpt-6.1-sol",
|
|
25
|
+
"extra": "gpt-6-astra",
|
|
26
|
+
"models": [
|
|
27
|
+
{
|
|
28
|
+
"id": "gpt-6.1-sol",
|
|
29
|
+
"label": "GPT-6.1 Sol"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"id": "gpt-6-astra",
|
|
33
|
+
"label": "GPT-6 Astra"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"id": "gpt-6-luna",
|
|
37
|
+
"label": "GPT-6 Luna"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"cursor": {
|
|
42
|
+
"normal": "auto",
|
|
43
|
+
"extra": "auto",
|
|
44
|
+
"models": [
|
|
45
|
+
{
|
|
46
|
+
"id": "auto",
|
|
47
|
+
"label": "Auto"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"openai": {
|
|
52
|
+
"normal": "openai:gpt-5.5",
|
|
53
|
+
"extra": "openai:gpt-5.5",
|
|
54
|
+
"models": [
|
|
55
|
+
{
|
|
56
|
+
"id": "openai:gpt-5.5",
|
|
57
|
+
"label": "GPT-5.5"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"id": "openai:gpt-5.4-mini",
|
|
61
|
+
"label": "GPT-5.4 mini"
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
"anthropic": {
|
|
66
|
+
"normal": "anthropic:claude-sonnet-5-5",
|
|
67
|
+
"extra": "anthropic:claude-opus-5-5",
|
|
68
|
+
"models": [
|
|
69
|
+
{
|
|
70
|
+
"id": "anthropic:claude-sonnet-5-5",
|
|
71
|
+
"label": "Claude Sonnet 5.5"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"id": "anthropic:claude-opus-5-5",
|
|
75
|
+
"label": "Claude Opus 5.5"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id": "anthropic:claude-haiku-4-5",
|
|
79
|
+
"label": "Claude Haiku 4.5"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
"google": {
|
|
84
|
+
"normal": "google:gemini-flash-latest",
|
|
85
|
+
"extra": "google:gemini-pro-latest",
|
|
86
|
+
"models": [
|
|
87
|
+
{
|
|
88
|
+
"id": "google:gemini-pro-latest",
|
|
89
|
+
"label": "Gemini Pro"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"id": "google:gemini-flash-latest",
|
|
93
|
+
"label": "Gemini Flash"
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
"gateway": {
|
|
98
|
+
"normal": "deepseek/deepseek-v4.1-flash",
|
|
99
|
+
"extra": "moonshotai/kimi-k3",
|
|
100
|
+
"models": [
|
|
101
|
+
{
|
|
102
|
+
"id": "moonshotai/kimi-k3",
|
|
103
|
+
"label": "Kimi K3"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"id": "deepseek/deepseek-v4.1-flash",
|
|
107
|
+
"label": "DeepSeek V4.1 Flash"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"id": "zai/glm-5.3",
|
|
111
|
+
"label": "GLM 5.3"
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `project` DROP COLUMN `mcp_servers`;
|