@engenty/wizards-runtime 0.9.6 → 0.9.8
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 +5 -3
- package/apps/runtime/dist/agents/chat-clients.js +299 -0
- package/apps/runtime/dist/agents/company.js +111 -0
- package/apps/runtime/dist/agents/studio-assistant.js +8 -4
- package/apps/runtime/dist/agents/subscription.js +163 -134
- package/apps/runtime/dist/agents/website.js +571 -53
- package/apps/runtime/dist/app.js +6 -3
- package/apps/runtime/dist/assistant/knows.js +5 -5
- package/apps/runtime/dist/assistant/primer.js +4 -4
- package/apps/runtime/dist/auth/account.js +12 -12
- package/apps/runtime/dist/auth/keys.js +18 -8
- package/apps/runtime/dist/authoring/example.js +2 -2
- package/apps/runtime/dist/authoring/guide.js +11 -11
- package/apps/runtime/dist/cli/account.js +20 -18
- package/apps/runtime/dist/cli/features.js +3 -3
- package/apps/runtime/dist/cli/ui.js +6 -0
- package/apps/runtime/dist/credits/estimate.js +5 -5
- package/apps/runtime/dist/db/adopt.js +4 -3
- package/apps/runtime/dist/db/migrations/control/0011_model_classes.sql +11 -0
- package/apps/runtime/dist/db/migrations/control/meta/0011_snapshot.json +600 -0
- package/apps/runtime/dist/db/migrations/control/meta/_journal.json +7 -0
- package/apps/runtime/dist/db/migrations/tenant/0021_model_classes.sql +41 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0021_snapshot.json +3475 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +7 -0
- package/apps/runtime/dist/db/schema.js +1 -1
- package/apps/runtime/dist/docs/dev/plugins/index.md +1 -1
- package/apps/runtime/dist/docs/dev/plugins/quick-start.md +2 -2
- package/apps/runtime/dist/docs/dev/plugins/server.md +4 -4
- package/apps/runtime/dist/docs/dev/plugins/studio.md +1 -1
- package/apps/runtime/dist/docs/dev/wizard-format/agent-steps.md +9 -5
- package/apps/runtime/dist/docs/dev/wizard-format/film-steps.md +2 -2
- package/apps/runtime/dist/docs/dev/wizard-format/index.md +14 -8
- package/apps/runtime/dist/docs/user-guide/ai-apps.md +1 -1
- package/apps/runtime/dist/docs/user-guide/command-line.md +1 -1
- package/apps/runtime/dist/docs/user-guide/create-account.md +6 -6
- package/apps/runtime/dist/docs/user-guide/first-start.md +1 -1
- package/apps/runtime/dist/docs/user-guide/index.md +5 -5
- package/apps/runtime/dist/docs/user-guide/models.md +35 -20
- package/apps/runtime/dist/docs/user-guide/space.md +1 -1
- package/apps/runtime/dist/docs/user-guide/steps.md +6 -6
- package/apps/runtime/dist/documents/parse.js +1 -1
- package/apps/runtime/dist/engine/requirements.js +11 -11
- package/apps/runtime/dist/engine/steps.js +4 -4
- package/apps/runtime/dist/env.js +4 -4
- package/apps/runtime/dist/features.js +4 -4
- package/apps/runtime/dist/film/step.js +1 -1
- package/apps/runtime/dist/harness/antigravity.js +3 -3
- package/apps/runtime/dist/harness/apple.js +1 -1
- package/apps/runtime/dist/harness/claude.js +2 -2
- package/apps/runtime/dist/harness/codex.js +3 -3
- package/apps/runtime/dist/harness/cursor.js +5 -1
- package/apps/runtime/dist/manage.js +4 -4
- package/apps/runtime/dist/mcp/auth.js +1 -1
- package/apps/runtime/dist/mcp/tools.js +6 -3
- package/apps/runtime/dist/models.js +139 -15
- package/apps/runtime/dist/plugins/loader.js +1 -1
- package/apps/runtime/dist/routes/lang.js +13 -4
- package/apps/runtime/dist/routes/runs.js +1 -1
- package/apps/runtime/dist/routes/studio.js +81 -41
- package/apps/runtime/dist/services/access.js +3 -3
- package/apps/runtime/dist/services/architect.js +4 -2
- package/apps/runtime/dist/services/assistant-chats.js +11 -2
- package/apps/runtime/dist/services/brand.js +1 -1
- package/apps/runtime/dist/services/knowledge-model.js +1 -1
- package/apps/runtime/dist/services/marketplace.js +3 -1
- package/apps/runtime/dist/services/onboarding.js +268 -48
- package/apps/runtime/dist/services/pages.js +17 -15
- package/apps/runtime/dist/services/project-files.js +1 -1
- package/apps/runtime/dist/services/translations.js +2 -2
- package/apps/runtime/dist/services/wizards.js +4 -4
- package/apps/runtime/dist/sharing/agent.js +1 -1
- package/apps/runtime/dist/texts.js +54 -8
- package/apps/web/dist/assets/{AboutDialog-CZr1JFvY.js → AboutDialog-B_Ixp_Tb.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-0pKHVdhu.js → ChangelogDialog-BpEIbAZ8.js} +1 -1
- package/apps/web/dist/assets/EditorPage-CKHY4hn4.js +4 -0
- package/apps/web/dist/assets/{FlowPreview-BZZvY5U9.js → FlowPreview-APXdRflR.js} +1 -1
- package/apps/web/dist/assets/{Harness-DPRw6BmX.js → Harness-BsGXMlLg.js} +2 -2
- package/apps/web/dist/assets/Marketplace-Dr-Qnb-F.js +2 -0
- package/apps/web/dist/assets/{NewWizardChannels-K5vfNzaC.js → NewWizardChannels-0JrRdUFd.js} +1 -1
- package/apps/web/dist/assets/NewWizardPage-9igFL5O8.js +7 -0
- package/apps/web/dist/assets/OnboardingPage-BcK9FUnU.js +1 -0
- package/apps/web/dist/assets/PreviewPane-X4LBqA0D.js +4 -0
- package/apps/web/dist/assets/ProjectPage-CG0i-KhR.js +1 -0
- package/apps/web/dist/assets/{PublicRunner-_N7DyvWj.js → PublicRunner-CZR1ziQ4.js} +1 -1
- package/apps/web/dist/assets/{ReadOnly-CQ8lWsnZ.js → ReadOnly-BraZbEG_.js} +1 -1
- package/apps/web/dist/assets/SettingsPage-Bw4tdoV7.js +2 -0
- package/apps/web/dist/assets/SetupPage-CvkE2aKx.js +1 -0
- package/apps/web/dist/assets/{SharePage-BXkykFJC.js → SharePage-Dk7zC5Zo.js} +1 -1
- package/apps/web/dist/assets/changelog-DDXnAaHm.js +1 -0
- package/apps/web/dist/assets/{coins-Bo9_D-7S.js → coins-391m1e4_.js} +1 -1
- package/apps/web/dist/assets/index-BTUtot4r.js +14 -0
- package/apps/web/dist/assets/index-DcUL6teA.css +1 -0
- package/apps/web/dist/assets/{phone-BPybLMSm.js → phone-DvgrtyNO.js} +1 -1
- package/apps/web/dist/assets/{runners-53tvGeez.js → runners-4OBelIgF.js} +1 -1
- package/apps/web/dist/assets/{session-DvW7auj-.js → session-DvnGHbDz.js} +1 -1
- package/apps/web/dist/assets/{settings-menu-tSPDYTfT.js → settings-menu-xK9A-gaP.js} +1 -1
- package/apps/web/dist/assets/theme-D3yDT4QT.js +11 -0
- package/apps/web/dist/assets/ui-BVQk2DtW.js +137 -0
- package/apps/web/dist/assets/{upload-Ct_-rz05.js → upload-BgXbzG6C.js} +1 -1
- package/apps/web/dist/assets/{useMutation-DM9Anfo-.js → useMutation-DkwSQWoD.js} +1 -1
- package/apps/web/dist/assets/{volume-2-CHuzf68z.js → volume-2-DHGoe3Cg.js} +1 -1
- package/apps/web/dist/assets/{wrench-BAgonupx.js → wrench-Cf_aE3O0.js} +1 -1
- package/apps/web/dist/index.html +8 -8
- package/apps/web/dist/mcp/flow.html +56 -56
- package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +2 -2
- package/node_modules/@engenty/wizards/dist/plugin/studio.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/assistant.d.ts +6 -0
- package/node_modules/@engenty/wizards-shared/dist/assistant.js +2 -0
- package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +876 -18
- package/node_modules/@engenty/wizards-shared/dist/definition.js +61 -11
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +5 -5
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +5 -5
- package/node_modules/@engenty/wizards-shared/dist/features.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/features.js +1 -1
- package/node_modules/@engenty/wizards-shared/dist/json-schema.js +3 -3
- package/node_modules/@engenty/wizards-shared/dist/projects.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/projects.js +2 -2
- package/node_modules/@engenty/wizards-shared/dist/providers.d.ts +38 -1
- package/node_modules/@engenty/wizards-shared/dist/providers.js +65 -13
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +2 -2
- package/node_modules/@engenty/wizards-shared/dist/run.js +4 -4
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/web/dist/assets/EditorPage-_qnWDno2.js +0 -4
- package/apps/web/dist/assets/Marketplace-BwbLRU2n.js +0 -2
- package/apps/web/dist/assets/NewWizardPage-zYwDoQTe.js +0 -7
- package/apps/web/dist/assets/OnboardingPage-jFgWaWJV.js +0 -1
- package/apps/web/dist/assets/PreviewPane-D5Kn9Ila.js +0 -4
- package/apps/web/dist/assets/ProjectPage-CyeEBVGi.js +0 -1
- package/apps/web/dist/assets/SettingsPage-haivwaZK.js +0 -2
- package/apps/web/dist/assets/SetupPage-Dy8KeG7z.js +0 -1
- package/apps/web/dist/assets/changelog-XRs8voQT.js +0 -1
- package/apps/web/dist/assets/index-CXA_do-X.js +0 -14
- package/apps/web/dist/assets/index-DG0i3S-z.css +0 -1
- package/apps/web/dist/assets/theme-CWGl7LyL.js +0 -11
- package/apps/web/dist/assets/ui-Bk08zclS.js +0 -137
package/apps/runtime/dist/app.js
CHANGED
|
@@ -23,7 +23,7 @@ import { PLUGIN_NAME, pluginArchive, pluginMarketplace } from "./plugin.js";
|
|
|
23
23
|
import { apiRoutes } from "./routes/api.js";
|
|
24
24
|
import { browserReport, localDebugRoutes } from "./routes/debug.js";
|
|
25
25
|
import { internalRoutes } from "./routes/internal.js";
|
|
26
|
-
import { notFoundAnswer, requestLang, say } from "./routes/lang.js";
|
|
26
|
+
import { notFoundAnswer, requestLang, say, spelledFor } from "./routes/lang.js";
|
|
27
27
|
import { marketplaceGuest, marketplaceStudio } from "./routes/marketplace.js";
|
|
28
28
|
import { publicPluginRoutes } from "./routes/plugin-public.js";
|
|
29
29
|
import { pluginRoutes } from "./routes/plugins.js";
|
|
@@ -41,7 +41,8 @@ const app = new Hono();
|
|
|
41
41
|
const { serves } = env;
|
|
42
42
|
app.onError((err, c) => {
|
|
43
43
|
if (err instanceof ServiceError) {
|
|
44
|
-
|
|
44
|
+
const body = err.toJSON(requestLang(c));
|
|
45
|
+
return c.json({ ...body, error: spelledFor(c, body.error) }, err.status);
|
|
45
46
|
}
|
|
46
47
|
if (err instanceof ZodError) {
|
|
47
48
|
return c.json({ error: say(c, "invalidInput"), issues: err.issues }, 400);
|
|
@@ -338,7 +339,9 @@ if (existsSync(webDir)) {
|
|
|
338
339
|
app.all("/w/:token/:runner", (c, next) => pluginRunnerPage(c, next));
|
|
339
340
|
}
|
|
340
341
|
app.get("*", async (c) => {
|
|
341
|
-
|
|
342
|
+
// A build's file that is not there (a page loaded before a deploy asks for the old build's)
|
|
343
|
+
// is a 404, never the start page: the app then sees the failed import and loads anew.
|
|
344
|
+
if (!PAGES.test(c.req.path) || c.req.path.startsWith("/studio/assets/")) {
|
|
342
345
|
return c.text("Not found", 404);
|
|
343
346
|
}
|
|
344
347
|
const html = await readFile(join(webDir, "index.html"), "utf8");
|
|
@@ -144,7 +144,7 @@ export function knowsTools(ctx) {
|
|
|
144
144
|
}),
|
|
145
145
|
plans: createTool({
|
|
146
146
|
id: "plans",
|
|
147
|
-
description: "The plans
|
|
147
|
+
description: "The plans organizations can be on (Free, Pro, Team): price a month, monthly credits, limits, and the credit packages to buy on top. Live from the account service.",
|
|
148
148
|
inputSchema: z.object({}),
|
|
149
149
|
execute: () => attempt(async () => {
|
|
150
150
|
ctx.doing(serverText(ctx.lang, "doingPlans"));
|
|
@@ -154,7 +154,7 @@ export function knowsTools(ctx) {
|
|
|
154
154
|
}),
|
|
155
155
|
account: createTool({
|
|
156
156
|
id: "account",
|
|
157
|
-
description: "The person, their
|
|
157
|
+
description: "The person, their organization, their role, the organization's plan, the credit balance and credits that end on a date.",
|
|
158
158
|
inputSchema: z.object({}),
|
|
159
159
|
execute: () => attempt(async () => {
|
|
160
160
|
ctx.doing(serverText(ctx.lang, "doingAccount"));
|
|
@@ -162,7 +162,7 @@ export function knowsTools(ctx) {
|
|
|
162
162
|
const info = await tenantInfo(user.tenantId, true);
|
|
163
163
|
return {
|
|
164
164
|
person: { name: user.name, email: user.email, role: user.role },
|
|
165
|
-
|
|
165
|
+
organization: { name: info.name, plan: info.plan?.name ?? null, status: info.status },
|
|
166
166
|
balanceCredits: Math.floor(info.balanceCredits),
|
|
167
167
|
limits: info.limits,
|
|
168
168
|
billingPage: `${env.manage.url}/billing`,
|
|
@@ -182,7 +182,7 @@ export function knowsTools(ctx) {
|
|
|
182
182
|
return {
|
|
183
183
|
linked: true,
|
|
184
184
|
person: overview.user,
|
|
185
|
-
|
|
185
|
+
organization: { name: overview.tenant.name, role: overview.tenant.role },
|
|
186
186
|
plan: overview.tenant.plan?.name ?? null,
|
|
187
187
|
balanceCredits: Math.floor(overview.tenant.balanceCredits),
|
|
188
188
|
expiring: overview.tenant.expiring ?? [],
|
|
@@ -192,7 +192,7 @@ export function knowsTools(ctx) {
|
|
|
192
192
|
}),
|
|
193
193
|
usage: createTool({
|
|
194
194
|
id: "usage",
|
|
195
|
-
description: "Credits the
|
|
195
|
+
description: "Credits the organization used per month (the last three), and the runs and wizards that cost the most.",
|
|
196
196
|
inputSchema: z.object({}),
|
|
197
197
|
execute: () => attempt(async () => {
|
|
198
198
|
ctx.doing(serverText(ctx.lang, "doingUsage"));
|
|
@@ -10,8 +10,8 @@ Words
|
|
|
10
10
|
- Studio: where wizards are built. Home lists the space's wizards; the editor (/edit/<id>) has its own chat (the architect) that builds and changes the wizard, a preview of each step as people see it with the steps in a row above it, and beside it the flow as a diagram and the editor of the step chosen.
|
|
11
11
|
- Wizard: a flow of steps a person walks through on a link. Step kinds: a page (fields to fill in), an AI step (an agent with tools: web search, reading files, writing documents, images, video, pages, other services), a review, and the result.
|
|
12
12
|
- Run: one person going through a wizard once. Results lists every run that reached its result.
|
|
13
|
-
- Space: what all wizards of
|
|
14
|
-
- Model class: the kind of model a step needs (Classifier, Standard, High
|
|
13
|
+
- Space: what all wizards of an organization know. Its page has four parts: Info & brand (title, about, logos, colours, assets, facts), Knowledge (pages, tables and files the AI steps look things up in, kept apart by typed categories), Data (tables and pages the wizards keep) and Results (finished runs).
|
|
14
|
+
- Model class: the kind of model a step needs (Classifier, Low, Standard, High for text; Image, Video, Speech, Audio). Which model serves a class is a setting (Settings › Models), not part of the wizard.
|
|
15
15
|
|
|
16
16
|
Thinking: an installed AI client on the person's subscription (Claude Code, Codex, Antigravity, Cursor Agent), own API keys (OpenAI, Anthropic, Google, fal.ai, ElevenLabs, Replicate, Vercel AI Gateway), a local model (Ollama), or engenty credits from an account. Settings › Models shows which way serves each class and what is missing.
|
|
17
17
|
|
|
@@ -21,6 +21,6 @@ AI apps: the install is an MCP server; Claude Desktop, Cursor, Codex and others
|
|
|
21
21
|
|
|
22
22
|
Plugins add pages to the studio (a Shop, a Termin-Planer), settings sections, sections of the space page, tools for AI steps and for this assistant, and channels. Settings › Plugins lists what is installed.
|
|
23
23
|
|
|
24
|
-
Account and plans: an account is optional on a local install; it brings credits, cloud publishing, sync and Pro modules. In the cloud,
|
|
24
|
+
Account and plans: an account is optional on a local install; it brings credits, cloud publishing, sync and Pro modules. In the cloud, organizations are on a plan (Free, Pro, Team) with monthly credits; credits can be topped up on the account's billing page. Plans, prices and the balance come from the account (tools: plans, account, usage), never from memory.
|
|
25
25
|
|
|
26
|
-
Studio addresses: / (home), /new (a new wizard), /edit/<id> (the editor), /space/info, /space/knowledge, /space/data, /space/results, /settings/account, /settings/
|
|
26
|
+
Studio addresses: / (home), /new (a new wizard), /edit/<id> (the editor), /space/info, /space/knowledge, /space/data, /space/results, /settings/account, /settings/organization (cloud), /settings/connectors, /settings/models, /settings/integrate (AI apps), /settings/plugins, and the pages plugins add.`;
|
|
@@ -12,8 +12,8 @@ import { deleteSetting, readSetting, writeSetting } from "../settings.js";
|
|
|
12
12
|
export const CLIENT = { id: "wizards-desktop" };
|
|
13
13
|
const REFRESH = "account.refresh";
|
|
14
14
|
export const SCOPE = "openid profile email offline_access wizards:read wizards:write wizards:publish";
|
|
15
|
-
/** The
|
|
16
|
-
const
|
|
15
|
+
/** The organization of the linked account as the Manage-App last named it, for lines that must not wait on it. */
|
|
16
|
+
const ORGANIZATION = "account.organization";
|
|
17
17
|
/** Loopback redirect on the port this server listens on (RFC 8252). */
|
|
18
18
|
function redirectUri() {
|
|
19
19
|
return `http://127.0.0.1:${env.port}/api/auth/callback`;
|
|
@@ -134,20 +134,20 @@ export async function unlink() {
|
|
|
134
134
|
cached = null;
|
|
135
135
|
await vaultDelete(REFRESH);
|
|
136
136
|
await deleteSetting("account");
|
|
137
|
-
await deleteSetting(
|
|
137
|
+
await deleteSetting(ORGANIZATION);
|
|
138
138
|
}
|
|
139
|
-
/** The
|
|
140
|
-
export function
|
|
141
|
-
return readSetting(
|
|
139
|
+
/** The organization as the Manage-App last named it: `wizards status` and the menu show it without a round trip. */
|
|
140
|
+
export function knownOrganization() {
|
|
141
|
+
return readSetting(ORGANIZATION);
|
|
142
142
|
}
|
|
143
|
-
let
|
|
144
|
-
async function
|
|
143
|
+
let rememberedOrganization = null;
|
|
144
|
+
async function rememberOrganization(tenant) {
|
|
145
145
|
const same = `${tenant.id}\n${tenant.name}\n${tenant.balanceCredits}`;
|
|
146
|
-
if (same ===
|
|
146
|
+
if (same === rememberedOrganization) {
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
await writeSetting(
|
|
149
|
+
rememberedOrganization = same;
|
|
150
|
+
await writeSetting(ORGANIZATION, {
|
|
151
151
|
tenantId: tenant.id,
|
|
152
152
|
name: tenant.name,
|
|
153
153
|
balanceCredits: tenant.balanceCredits,
|
|
@@ -169,7 +169,7 @@ export async function accountOverview() {
|
|
|
169
169
|
}
|
|
170
170
|
const overview = (await res.json());
|
|
171
171
|
if (overview?.tenant) {
|
|
172
|
-
await
|
|
172
|
+
await rememberOrganization(overview.tenant).catch(() => undefined);
|
|
173
173
|
}
|
|
174
174
|
return overview;
|
|
175
175
|
}
|
|
@@ -8,13 +8,22 @@ import { readSetting, writeSetting } from "../settings.js";
|
|
|
8
8
|
*/
|
|
9
9
|
export const API_KEY_PREFIX = "wz_";
|
|
10
10
|
const hashOf = (key) => createHash("sha256").update(key).digest("hex");
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Keys that live only as long as this process: the studio chat's own client signs in with one,
|
|
13
|
+
* named for that client ("Codex (Abo)"), so the changes it makes say who made them.
|
|
14
|
+
*/
|
|
15
|
+
const internal = new Map();
|
|
16
|
+
export function internalKey(client) {
|
|
17
|
+
const name = `${client} (Abo)`;
|
|
18
|
+
for (const [key, known] of internal) {
|
|
19
|
+
if (known === name) {
|
|
20
|
+
return key;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const key = `${API_KEY_PREFIX}${randomBytes(24).toString("base64url")}`;
|
|
24
|
+
internal.set(key, name);
|
|
25
|
+
return key;
|
|
16
26
|
}
|
|
17
|
-
const INTERNAL_CLIENT = "Claude (Abo)";
|
|
18
27
|
async function all() {
|
|
19
28
|
return (await readSetting("apiKeys")) ?? [];
|
|
20
29
|
}
|
|
@@ -38,8 +47,9 @@ export async function deleteLocalKey(id) {
|
|
|
38
47
|
await writeSetting("apiKeys", (await all()).filter((k) => k.id !== id));
|
|
39
48
|
}
|
|
40
49
|
export async function verifyLocalKey(key) {
|
|
41
|
-
|
|
42
|
-
|
|
50
|
+
const own = internal.get(key);
|
|
51
|
+
if (own) {
|
|
52
|
+
return { id: "internal", name: own };
|
|
43
53
|
}
|
|
44
54
|
const keys = await all();
|
|
45
55
|
const found = keys.find((k) => k.hash === hashOf(key));
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* the guide's own, not a marketplace entry, so the guide never depends on the marketplace.
|
|
4
4
|
*/
|
|
5
5
|
export const EXAMPLE_WIZARD = {
|
|
6
|
-
version:
|
|
6
|
+
version: 2,
|
|
7
7
|
title: "X post with an image",
|
|
8
8
|
description: "Turns a topic into a finished post with an image.",
|
|
9
9
|
avatar: "flame",
|
|
@@ -40,7 +40,7 @@ export const EXAMPLE_WIZARD = {
|
|
|
40
40
|
instructions: "Write a post for X (Twitter) on the topic: {{topic}}. Tone: {{tone}}. At most 270 characters including the link, and at most two hashtags. If a link is given ({{link}}), put it at the end. A strong first sentence. Output only the post.",
|
|
41
41
|
tools: [],
|
|
42
42
|
output: { format: "text" },
|
|
43
|
-
model: "
|
|
43
|
+
model: "low",
|
|
44
44
|
},
|
|
45
45
|
{
|
|
46
46
|
id: "visual",
|
|
@@ -8,7 +8,7 @@ import { EXAMPLE_WIZARD } from "./example.js";
|
|
|
8
8
|
*/
|
|
9
9
|
export const SCHEMA_DOC = `
|
|
10
10
|
type Wizard = {
|
|
11
|
-
version:
|
|
11
|
+
version: 2 // always write it: the class names below are those of version 2
|
|
12
12
|
title: string // short, what the end user gets ("Rechnung erstellen")
|
|
13
13
|
description: string // one sentence
|
|
14
14
|
avatar: "round"|"drop"|"dome"|"flame"|"oval"|"bean"|"pebble"|"sprout"|"tower"|"wedge" // the engenty mascot shown to end users
|
|
@@ -164,8 +164,8 @@ type AgentStep = {
|
|
|
164
164
|
// one table, steps.<id>.rows: the entry's columns plus the step's output fields, a row per entry.
|
|
165
165
|
// a table with columns gives rows as objects with exactly those keys — what widgets read
|
|
166
166
|
// "yesno" answers the question in its description with true/false; "choice" picks one of its options
|
|
167
|
-
model?: "classifier"|"
|
|
168
|
-
effort?: "low"|"medium"|"high"
|
|
167
|
+
model?: "classifier"|"low"|"standard"|"high" // the kind of model, see "Models"; default "standard"
|
|
168
|
+
effort?: "low"|"medium"|"high" // how hard it should think; leave out unless it matters
|
|
169
169
|
working?: string // shown while it runs ("Recherchiert im Web …")
|
|
170
170
|
}
|
|
171
171
|
// Every agent step also has, without listing them: list_read / list_write (the wizard's lists), files_list,
|
|
@@ -287,7 +287,7 @@ type FilmStep = {
|
|
|
287
287
|
from?: string // "steps.<filmStepId>": start from that earlier film's code and lay it out for this format —
|
|
288
288
|
// the second format of a film in minutes; made from scratch when that step did not run
|
|
289
289
|
seconds?: number // about how long
|
|
290
|
-
model?: "
|
|
290
|
+
model?: "low" | "standard" // the model class; default "low"
|
|
291
291
|
effort?: Effort
|
|
292
292
|
working?: string
|
|
293
293
|
}
|
|
@@ -349,7 +349,7 @@ How good wizards look:
|
|
|
349
349
|
correct or regenerate. A result people can simply make again needs no review before it.
|
|
350
350
|
- Money/totals: use an "items" field with vat — the runner computes totals; documents must use {{items}} verbatim. Never let a model compute totals.
|
|
351
351
|
- Facts from the web need an agent step with web_search + web_fetch BEFORE writing; documents then cite those notes.
|
|
352
|
-
- 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 "
|
|
352
|
+
- 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
353
|
- Writing into other systems (CRM, database, spreadsheet, website): an agent step with the matching mcp server, 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
354
|
- 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
355
|
${sandboxGuideLine()}
|
|
@@ -368,8 +368,8 @@ ${sandboxGuideLine()}
|
|
|
368
368
|
- Going through documents one by one (receipts against payments): never one model step per document. One step reads them in batches (scan_documents takes 30 at once) and writes rows into a list with "check"; the review shows that list split-screen — the person answers each row beside its file, without any model call.
|
|
369
369
|
- Video that convinces is built in stages, each with its own review: idea and script (agent, json with a table of shots) → one still per shot (generate image with "each", starting from the person's product photo) → one clip per still (generate video with "each" and referenceImage = the stills step) → a voice-over (generate voice) → a film widget (video: true) that cuts clips, captions, voice and a closing card with the call to action. The starters "facebook-video-ad" and "property-film" carry such a widget (film/film.js) to copy. Offer a cheaper path without clips: the film animates the stills.
|
|
370
370
|
- Motion-graphics films (explainers, product spots, shorts) are a "film" step after the preparation, each with a review:
|
|
371
|
-
research and script (agent,
|
|
372
|
-
word timings itself) → film (inputs: the voice, pictures, the script). The look comes from a style kit in the workspace (kit), so the film step stays on "
|
|
371
|
+
research and script (agent, standard) → the voice-over (one generate voice step for the whole script; the film step finds the
|
|
372
|
+
word timings itself) → film (inputs: the voice, pictures, the script). The look comes from a style kit in the workspace (kit), so the film step stays on "low".
|
|
373
373
|
- Prices come from a file the admin keeps in the workspace (a CSV price list): the agent step looks them up with read_workspace_file and proposes positions as a table; the next page shows them in an "items" field with "prefill" for the person to correct; the runner computes the totals.
|
|
374
374
|
- AI media is marked for you (EU AI Act, Art. 50): images, clips, voice-overs and films carry the marking in their file metadata, and the pages lay the EU's "AI" label over them. Never ask an image step to draw such a label into the picture. A film is different — it leaves the page as a video file, so its widget shows the EU label in the picture: wizard.ai tells a widget whether the run's media in its data is "generated" or "edited" (film/film.js draws the matching icon).
|
|
375
375
|
- Every step a person sees later (review/result) must come from an earlier step id.
|
|
@@ -455,11 +455,11 @@ ${connectorsLine(connectors)}${pluginToolsLine(pluginTools)}
|
|
|
455
455
|
Models: a step names the KIND of model it needs, never a model. Pick the cheapest class that does the job:
|
|
456
456
|
- "classifier": routing, yes/no, picking from options, pulling a few values out of text.
|
|
457
457
|
A DECISION is a "classifier" step with no tools whose json output has only "yesno", "choice" and "score" fields: it is answered in one fast, very cheap call. A branch can also read how sure it is: "steps.<id>.<field>.p" is the probability of its answer (a number 0–1; 1 or 0 where no decision model is set up), e.g. { field: "steps.check.urgent.p", op: "gt", value: 0.8 }. Write the question into each field's description, give the step everything it must judge in its instructions via {{templates}}, and branch on the answer with "next" (e.g. { when: { field: "steps.check.refund", op: "equals", value: true }, goto: "refund" }).
|
|
458
|
-
- "
|
|
459
|
-
- "
|
|
460
|
-
- "
|
|
458
|
+
- "low": short copy, calling an API, reformatting, simple summaries.
|
|
459
|
+
- "standard": research with tools, long documents, reasoning over many sources (the default).
|
|
460
|
+
- "high": hard reasoning or writing code; rare in a run, several times the cost of "standard".
|
|
461
461
|
"effort" ("low" | "medium" | "high") tells the model how hard to think where it can be told; leave it out unless a step is clearly trivial ("low") or clearly hard ("high").
|
|
462
|
-
A generate step for a document or dashboard takes the same "model" (default "
|
|
462
|
+
A generate step for a document or dashboard takes the same "model" (default "standard"). Image and video steps use the image and video class; which model serves a class is set by the platform, not in the wizard.
|
|
463
463
|
|
|
464
464
|
Editing:
|
|
465
465
|
- Every write returns the new "revision" and the validator's "issues". Pass the revision you last saw as "baseRevision"; on revision_conflict re-read with get_wizard and apply your change again.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as p from "@clack/prompts";
|
|
2
|
-
import { accountOverview,
|
|
2
|
+
import { accountOverview, knownOrganization, linkedAccount, unlink, } from "../auth/account.js";
|
|
3
3
|
import { DeviceSignInError, requestDeviceCode, waitForDeviceSignIn } from "../auth/device.js";
|
|
4
4
|
import { migrateControlDb } from "../db/client.js";
|
|
5
5
|
import { env } from "../env.js";
|
|
6
6
|
import { featuresFile, fileFeatures, writeFeature } from "../features.js";
|
|
7
7
|
import { readInstallNote, writeInstallNote } from "./home.js";
|
|
8
8
|
import { openBrowser, runningRuntime, settings } from "./start.js";
|
|
9
|
-
import { bold, busy, cmd, cyan, dim, tilde } from "./ui.js";
|
|
9
|
+
import { bold, busy, cmd, cyan, dim, spelled, tilde } from "./ui.js";
|
|
10
10
|
/**
|
|
11
11
|
* The account of this install, from the terminal. `wizards account` says where it stands,
|
|
12
12
|
* `sign-in` runs the device flow (auth/device.ts), `sign-out` ends the link the way the
|
|
@@ -19,7 +19,7 @@ import { bold, busy, cmd, cyan, dim, tilde } from "./ui.js";
|
|
|
19
19
|
* runtime is). A runtime that runs reads the account from the settings as it goes; what it
|
|
20
20
|
* holds from its start is brought in line by a restart, which is offered.
|
|
21
21
|
*/
|
|
22
|
-
export const INTRO = "Your
|
|
22
|
+
export const INTRO = "Your organization, its space and your wizards live in the account. This computer joins the space.";
|
|
23
23
|
let prepared = null;
|
|
24
24
|
/** The control database as the runtime keeps it: a fresh install has none until something opens it. */
|
|
25
25
|
function ready() {
|
|
@@ -56,16 +56,18 @@ export async function accountState() {
|
|
|
56
56
|
if (!account) {
|
|
57
57
|
return { kind: "none" };
|
|
58
58
|
}
|
|
59
|
-
return { kind: "linked", account,
|
|
59
|
+
return { kind: "linked", account, organization: await knownOrganization() };
|
|
60
60
|
}
|
|
61
|
-
/** "Matthias ·
|
|
62
|
-
export function described(account,
|
|
61
|
+
/** "Matthias · organization Platzer Fenster & Türen · 120 credits", as far as it is known. */
|
|
62
|
+
export function described(account, organization, credits = true) {
|
|
63
63
|
const parts = [account.name || account.email];
|
|
64
|
-
if (
|
|
65
|
-
// "Team Anna" and "New
|
|
66
|
-
parts.push(/\
|
|
64
|
+
if (organization) {
|
|
65
|
+
// "Team Anna" and "New organization" say it themselves: not "organization Team Anna".
|
|
66
|
+
parts.push(/\b(team|organi[sz]ation)\b/i.test(organization.name)
|
|
67
|
+
? organization.name
|
|
68
|
+
: `${spelled("organization")} ${organization.name}`);
|
|
67
69
|
if (credits) {
|
|
68
|
-
parts.push(`${
|
|
70
|
+
parts.push(`${organization.balanceCredits} credits`);
|
|
69
71
|
}
|
|
70
72
|
}
|
|
71
73
|
return parts.join(" · ");
|
|
@@ -78,7 +80,7 @@ export function describeAccount(state) {
|
|
|
78
80
|
case "none":
|
|
79
81
|
return "not signed in";
|
|
80
82
|
default:
|
|
81
|
-
return described(state.account, state.
|
|
83
|
+
return described(state.account, state.organization, false);
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
86
|
/** The account's site, as people know it: engenty.ai for account.engenty.ai. */
|
|
@@ -95,10 +97,10 @@ async function status() {
|
|
|
95
97
|
return 0;
|
|
96
98
|
}
|
|
97
99
|
const overview = await accountOverview();
|
|
98
|
-
const
|
|
99
|
-
console.log(`Signed in as ${described(state.account,
|
|
100
|
+
const organization = overview?.tenant ?? state.organization;
|
|
101
|
+
console.log(`Signed in as ${described(state.account, organization)} · ${host()}${overview
|
|
100
102
|
? ""
|
|
101
|
-
: dim(` (${host()} didn’t respond${
|
|
103
|
+
: dim(` (${host()} didn’t respond${organization ? ", so this is from last time" : ""})`)}`);
|
|
102
104
|
return 0;
|
|
103
105
|
}
|
|
104
106
|
/** A code as people read it off a screen: ABCD-EFGH. */
|
|
@@ -230,12 +232,12 @@ async function signIn(paths, interactive) {
|
|
|
230
232
|
if (linked && isLocalOnly()) {
|
|
231
233
|
// Set up with --local by an older version, which kept the link: it only needs switching on.
|
|
232
234
|
joinedAccount(paths);
|
|
233
|
-
p.log.success(`Signed in as ${described(linked, await
|
|
235
|
+
p.log.success(`Signed in as ${described(linked, await knownOrganization(), false)} again.`);
|
|
234
236
|
await pickUp(paths, interactive, SIGNED_IN);
|
|
235
237
|
return 0;
|
|
236
238
|
}
|
|
237
239
|
if (linked) {
|
|
238
|
-
p.log.info(`Already signed in as ${described(linked, await
|
|
240
|
+
p.log.info(`Already signed in as ${described(linked, await knownOrganization(), false)}. ${dim(`To switch accounts, run ${cmd("account sign-out")} first.`)}`);
|
|
239
241
|
return 0;
|
|
240
242
|
}
|
|
241
243
|
const account = await deviceSignIn(interactive);
|
|
@@ -354,10 +356,10 @@ export async function accountStep(paths, options, interactive) {
|
|
|
354
356
|
}
|
|
355
357
|
if (state.kind === "linked") {
|
|
356
358
|
const overview = await accountOverview();
|
|
357
|
-
p.log.success(`Signed in as ${described(state.account, overview?.tenant ?? state.
|
|
359
|
+
p.log.success(`Signed in as ${described(state.account, overview?.tenant ?? state.organization)}.`);
|
|
358
360
|
return;
|
|
359
361
|
}
|
|
360
|
-
p.note(INTRO, "Your engenty account");
|
|
362
|
+
p.note(spelled(INTRO), "Your engenty account");
|
|
361
363
|
if (!interactive) {
|
|
362
364
|
p.log.info(dim(`To sign in later: ${cmd("account sign-in")}`));
|
|
363
365
|
return;
|
|
@@ -3,7 +3,7 @@ import { declaredFeatures, featuresFile, fileFeatures, writeFeature } from "../f
|
|
|
3
3
|
import { discoverPlugins } from "../plugins/discovery.js";
|
|
4
4
|
import { pluginDirs } from "../plugins/loader.js";
|
|
5
5
|
import { proModulesDir } from "../plugins/pro-state.js";
|
|
6
|
-
import { cmd, tilde } from "./ui.js";
|
|
6
|
+
import { cmd, spelled, tilde } from "./ui.js";
|
|
7
7
|
/**
|
|
8
8
|
* `wizards features` — the feature switches of this install, from its `.features` file. Not in
|
|
9
9
|
* the help: for whoever works on a part before it is on for everyone.
|
|
@@ -29,9 +29,9 @@ export function featuresCommand(args) {
|
|
|
29
29
|
const source = n in fromFile ? "file" : n in fromEnv ? "FEATURES" : "default";
|
|
30
30
|
const d = declared[n];
|
|
31
31
|
const kind = d ? d.kind : "?";
|
|
32
|
-
console.log(`${all[n] ? "on " : "off"} ${n.padEnd(28)} ${kind.padEnd(8)} ${source.padEnd(9)} ${d?.label ?? ""}`);
|
|
32
|
+
console.log(`${all[n] ? "on " : "off"} ${n.padEnd(28)} ${kind.padEnd(8)} ${source.padEnd(9)} ${spelled(d?.label ?? "")}`);
|
|
33
33
|
}
|
|
34
|
-
console.log(`\nFile: ${tilde(file)}\nWhile engenty wizards runs, account and
|
|
34
|
+
console.log(spelled(`\nFile: ${tilde(file)}\nWhile engenty wizards runs, account and organization switches apply on top of these.`));
|
|
35
35
|
return 0;
|
|
36
36
|
}
|
|
37
37
|
if (!FEATURE_NAME.test(name)) {
|
|
@@ -2,6 +2,7 @@ import { homedir } from "node:os";
|
|
|
2
2
|
import { emitKeypressEvents } from "node:readline";
|
|
3
3
|
import { styleText } from "node:util";
|
|
4
4
|
import * as p from "@clack/prompts";
|
|
5
|
+
import { britishEnglish, britishSpelling } from "@engenty/wizards-shared/definition";
|
|
5
6
|
import { command } from "./home.js";
|
|
6
7
|
const colours = Boolean(process.stdout.isTTY) && !process.env.NO_COLOR;
|
|
7
8
|
/** The name on engenty's orange. */
|
|
@@ -9,6 +10,11 @@ export const badge = (text) => colours ? `\x1b[48;2;224;83;27m\x1b[97m\x1b[1m ${
|
|
|
9
10
|
export const dim = (text) => styleText("dim", text);
|
|
10
11
|
export const bold = (text) => styleText("bold", text);
|
|
11
12
|
export const cyan = (text) => styleText("cyan", text);
|
|
13
|
+
/** English as this shell's reader spells it: British where its locale is en_GB. */
|
|
14
|
+
export function spelled(text) {
|
|
15
|
+
const locale = process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG || "";
|
|
16
|
+
return britishEnglish([locale]) ? britishSpelling(text) : text;
|
|
17
|
+
}
|
|
12
18
|
export const ok = styleText("green", "✓");
|
|
13
19
|
export const no = styleText("yellow", "–");
|
|
14
20
|
export const bad = styleText("red", "✗");
|
|
@@ -51,7 +51,7 @@ function stepFormula(step, catalog) {
|
|
|
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.
|
|
54
|
-
let credits = textCredits(cls(step.model ?? "
|
|
54
|
+
let credits = textCredits(cls(step.model ?? "standard"), shape) * (step.each ? 3 : 1);
|
|
55
55
|
if (step.tools.includes("web_search")) {
|
|
56
56
|
credits += 4 * catalog.webSearchCredits;
|
|
57
57
|
}
|
|
@@ -62,20 +62,20 @@ function stepFormula(step, catalog) {
|
|
|
62
62
|
credits += textCredits(cls("classifier"), TOKENS.structure);
|
|
63
63
|
}
|
|
64
64
|
if (step.output.surface === true) {
|
|
65
|
-
credits += textCredits(cls("
|
|
65
|
+
credits += textCredits(cls("low"), TOKENS.structure);
|
|
66
66
|
}
|
|
67
67
|
return credits;
|
|
68
68
|
}
|
|
69
69
|
if (step.type === "generate") {
|
|
70
70
|
if (step.asset === "image") {
|
|
71
|
-
return (
|
|
71
|
+
return (catalog.classes.image?.creditsPerImage ?? 0) + textCredits(cls("low"), TOKENS.prompt);
|
|
72
72
|
}
|
|
73
73
|
if (step.asset === "video") {
|
|
74
74
|
const seconds = Math.min(Math.max(Math.round(step.options?.duration ?? 8), 4), 10);
|
|
75
75
|
return (seconds * (catalog.classes.video?.creditsPerSecond ?? 0) +
|
|
76
|
-
textCredits(cls("
|
|
76
|
+
textCredits(cls("low"), TOKENS.prompt));
|
|
77
77
|
}
|
|
78
|
-
return textCredits(cls(step.model ?? "
|
|
78
|
+
return textCredits(cls(step.model ?? "standard"), TOKENS.document);
|
|
79
79
|
}
|
|
80
80
|
return 0;
|
|
81
81
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import { cp } from "node:fs/promises";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
+
import { upgradeDefinition } from "@engenty/wizards-shared/definition";
|
|
4
5
|
import { createClient } from "@libsql/client";
|
|
5
6
|
import { env } from "../env.js";
|
|
6
7
|
import { readSetting, writeSetting } from "../settings.js";
|
|
@@ -26,14 +27,14 @@ const TABLES = [
|
|
|
26
27
|
"store_file",
|
|
27
28
|
"store_secret",
|
|
28
29
|
];
|
|
29
|
-
const CLASS_OF = { fast: "
|
|
30
|
-
/** Steps named a model speed before they named a model class. */
|
|
30
|
+
const CLASS_OF = { fast: "low", smart: "standard" };
|
|
31
|
+
/** Steps named a model speed before they named a model class; then classes of version 1. */
|
|
31
32
|
function withClasses(json) {
|
|
32
33
|
if (typeof json !== "string") {
|
|
33
34
|
return json;
|
|
34
35
|
}
|
|
35
36
|
try {
|
|
36
|
-
const def = JSON.parse(json);
|
|
37
|
+
const def = upgradeDefinition(JSON.parse(json));
|
|
37
38
|
for (const step of def.steps ?? []) {
|
|
38
39
|
if (step.model && CLASS_OF[step.model]) {
|
|
39
40
|
step.model = CLASS_OF[step.model];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
-- Definition version 2: the bindings of the text classes standard, high and highest of version 1
|
|
2
|
+
-- belong to low, standard and high now. json_patch leaves out a class that had no binding.
|
|
3
|
+
UPDATE `setting` SET `value` = json_set(`value`, '$.bindings', json_patch(
|
|
4
|
+
json_remove(json_extract(`value`, '$.bindings'), '$.standard', '$.high', '$.highest'),
|
|
5
|
+
json_object(
|
|
6
|
+
'low', json_extract(`value`, '$.bindings.standard'),
|
|
7
|
+
'standard', json_extract(`value`, '$.bindings.high'),
|
|
8
|
+
'high', json_extract(`value`, '$.bindings.highest')
|
|
9
|
+
)))
|
|
10
|
+
WHERE (`key` = 'models' OR `key` LIKE 'models:%')
|
|
11
|
+
AND json_valid(`value`) AND json_type(`value`, '$.bindings') = 'object';
|