@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.
Files changed (137) hide show
  1. package/apps/runtime/dist/agents/architect.js +5 -3
  2. package/apps/runtime/dist/agents/chat-clients.js +299 -0
  3. package/apps/runtime/dist/agents/company.js +111 -0
  4. package/apps/runtime/dist/agents/studio-assistant.js +8 -4
  5. package/apps/runtime/dist/agents/subscription.js +163 -134
  6. package/apps/runtime/dist/agents/website.js +571 -53
  7. package/apps/runtime/dist/app.js +6 -3
  8. package/apps/runtime/dist/assistant/knows.js +5 -5
  9. package/apps/runtime/dist/assistant/primer.js +4 -4
  10. package/apps/runtime/dist/auth/account.js +12 -12
  11. package/apps/runtime/dist/auth/keys.js +18 -8
  12. package/apps/runtime/dist/authoring/example.js +2 -2
  13. package/apps/runtime/dist/authoring/guide.js +11 -11
  14. package/apps/runtime/dist/cli/account.js +20 -18
  15. package/apps/runtime/dist/cli/features.js +3 -3
  16. package/apps/runtime/dist/cli/ui.js +6 -0
  17. package/apps/runtime/dist/credits/estimate.js +5 -5
  18. package/apps/runtime/dist/db/adopt.js +4 -3
  19. package/apps/runtime/dist/db/migrations/control/0011_model_classes.sql +11 -0
  20. package/apps/runtime/dist/db/migrations/control/meta/0011_snapshot.json +600 -0
  21. package/apps/runtime/dist/db/migrations/control/meta/_journal.json +7 -0
  22. package/apps/runtime/dist/db/migrations/tenant/0021_model_classes.sql +41 -0
  23. package/apps/runtime/dist/db/migrations/tenant/meta/0021_snapshot.json +3475 -0
  24. package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +7 -0
  25. package/apps/runtime/dist/db/schema.js +1 -1
  26. package/apps/runtime/dist/docs/dev/plugins/index.md +1 -1
  27. package/apps/runtime/dist/docs/dev/plugins/quick-start.md +2 -2
  28. package/apps/runtime/dist/docs/dev/plugins/server.md +4 -4
  29. package/apps/runtime/dist/docs/dev/plugins/studio.md +1 -1
  30. package/apps/runtime/dist/docs/dev/wizard-format/agent-steps.md +9 -5
  31. package/apps/runtime/dist/docs/dev/wizard-format/film-steps.md +2 -2
  32. package/apps/runtime/dist/docs/dev/wizard-format/index.md +14 -8
  33. package/apps/runtime/dist/docs/user-guide/ai-apps.md +1 -1
  34. package/apps/runtime/dist/docs/user-guide/command-line.md +1 -1
  35. package/apps/runtime/dist/docs/user-guide/create-account.md +6 -6
  36. package/apps/runtime/dist/docs/user-guide/first-start.md +1 -1
  37. package/apps/runtime/dist/docs/user-guide/index.md +5 -5
  38. package/apps/runtime/dist/docs/user-guide/models.md +35 -20
  39. package/apps/runtime/dist/docs/user-guide/space.md +1 -1
  40. package/apps/runtime/dist/docs/user-guide/steps.md +6 -6
  41. package/apps/runtime/dist/documents/parse.js +1 -1
  42. package/apps/runtime/dist/engine/requirements.js +11 -11
  43. package/apps/runtime/dist/engine/steps.js +4 -4
  44. package/apps/runtime/dist/env.js +4 -4
  45. package/apps/runtime/dist/features.js +4 -4
  46. package/apps/runtime/dist/film/step.js +1 -1
  47. package/apps/runtime/dist/harness/antigravity.js +3 -3
  48. package/apps/runtime/dist/harness/apple.js +1 -1
  49. package/apps/runtime/dist/harness/claude.js +2 -2
  50. package/apps/runtime/dist/harness/codex.js +3 -3
  51. package/apps/runtime/dist/harness/cursor.js +5 -1
  52. package/apps/runtime/dist/manage.js +4 -4
  53. package/apps/runtime/dist/mcp/auth.js +1 -1
  54. package/apps/runtime/dist/mcp/tools.js +6 -3
  55. package/apps/runtime/dist/models.js +139 -15
  56. package/apps/runtime/dist/plugins/loader.js +1 -1
  57. package/apps/runtime/dist/routes/lang.js +13 -4
  58. package/apps/runtime/dist/routes/runs.js +1 -1
  59. package/apps/runtime/dist/routes/studio.js +81 -41
  60. package/apps/runtime/dist/services/access.js +3 -3
  61. package/apps/runtime/dist/services/architect.js +4 -2
  62. package/apps/runtime/dist/services/assistant-chats.js +11 -2
  63. package/apps/runtime/dist/services/brand.js +1 -1
  64. package/apps/runtime/dist/services/knowledge-model.js +1 -1
  65. package/apps/runtime/dist/services/marketplace.js +3 -1
  66. package/apps/runtime/dist/services/onboarding.js +268 -48
  67. package/apps/runtime/dist/services/pages.js +17 -15
  68. package/apps/runtime/dist/services/project-files.js +1 -1
  69. package/apps/runtime/dist/services/translations.js +2 -2
  70. package/apps/runtime/dist/services/wizards.js +4 -4
  71. package/apps/runtime/dist/sharing/agent.js +1 -1
  72. package/apps/runtime/dist/texts.js +54 -8
  73. package/apps/web/dist/assets/{AboutDialog-CZr1JFvY.js → AboutDialog-B_Ixp_Tb.js} +1 -1
  74. package/apps/web/dist/assets/{ChangelogDialog-0pKHVdhu.js → ChangelogDialog-BpEIbAZ8.js} +1 -1
  75. package/apps/web/dist/assets/EditorPage-CKHY4hn4.js +4 -0
  76. package/apps/web/dist/assets/{FlowPreview-BZZvY5U9.js → FlowPreview-APXdRflR.js} +1 -1
  77. package/apps/web/dist/assets/{Harness-DPRw6BmX.js → Harness-BsGXMlLg.js} +2 -2
  78. package/apps/web/dist/assets/Marketplace-Dr-Qnb-F.js +2 -0
  79. package/apps/web/dist/assets/{NewWizardChannels-K5vfNzaC.js → NewWizardChannels-0JrRdUFd.js} +1 -1
  80. package/apps/web/dist/assets/NewWizardPage-9igFL5O8.js +7 -0
  81. package/apps/web/dist/assets/OnboardingPage-BcK9FUnU.js +1 -0
  82. package/apps/web/dist/assets/PreviewPane-X4LBqA0D.js +4 -0
  83. package/apps/web/dist/assets/ProjectPage-CG0i-KhR.js +1 -0
  84. package/apps/web/dist/assets/{PublicRunner-_N7DyvWj.js → PublicRunner-CZR1ziQ4.js} +1 -1
  85. package/apps/web/dist/assets/{ReadOnly-CQ8lWsnZ.js → ReadOnly-BraZbEG_.js} +1 -1
  86. package/apps/web/dist/assets/SettingsPage-Bw4tdoV7.js +2 -0
  87. package/apps/web/dist/assets/SetupPage-CvkE2aKx.js +1 -0
  88. package/apps/web/dist/assets/{SharePage-BXkykFJC.js → SharePage-Dk7zC5Zo.js} +1 -1
  89. package/apps/web/dist/assets/changelog-DDXnAaHm.js +1 -0
  90. package/apps/web/dist/assets/{coins-Bo9_D-7S.js → coins-391m1e4_.js} +1 -1
  91. package/apps/web/dist/assets/index-BTUtot4r.js +14 -0
  92. package/apps/web/dist/assets/index-DcUL6teA.css +1 -0
  93. package/apps/web/dist/assets/{phone-BPybLMSm.js → phone-DvgrtyNO.js} +1 -1
  94. package/apps/web/dist/assets/{runners-53tvGeez.js → runners-4OBelIgF.js} +1 -1
  95. package/apps/web/dist/assets/{session-DvW7auj-.js → session-DvnGHbDz.js} +1 -1
  96. package/apps/web/dist/assets/{settings-menu-tSPDYTfT.js → settings-menu-xK9A-gaP.js} +1 -1
  97. package/apps/web/dist/assets/theme-D3yDT4QT.js +11 -0
  98. package/apps/web/dist/assets/ui-BVQk2DtW.js +137 -0
  99. package/apps/web/dist/assets/{upload-Ct_-rz05.js → upload-BgXbzG6C.js} +1 -1
  100. package/apps/web/dist/assets/{useMutation-DM9Anfo-.js → useMutation-DkwSQWoD.js} +1 -1
  101. package/apps/web/dist/assets/{volume-2-CHuzf68z.js → volume-2-DHGoe3Cg.js} +1 -1
  102. package/apps/web/dist/assets/{wrench-BAgonupx.js → wrench-Cf_aE3O0.js} +1 -1
  103. package/apps/web/dist/index.html +8 -8
  104. package/apps/web/dist/mcp/flow.html +56 -56
  105. package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +2 -2
  106. package/node_modules/@engenty/wizards/dist/plugin/studio.d.ts +1 -1
  107. package/node_modules/@engenty/wizards-shared/dist/assistant.d.ts +6 -0
  108. package/node_modules/@engenty/wizards-shared/dist/assistant.js +2 -0
  109. package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +876 -18
  110. package/node_modules/@engenty/wizards-shared/dist/definition.js +61 -11
  111. package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +5 -5
  112. package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +5 -5
  113. package/node_modules/@engenty/wizards-shared/dist/features.d.ts +1 -1
  114. package/node_modules/@engenty/wizards-shared/dist/features.js +1 -1
  115. package/node_modules/@engenty/wizards-shared/dist/json-schema.js +3 -3
  116. package/node_modules/@engenty/wizards-shared/dist/projects.d.ts +1 -1
  117. package/node_modules/@engenty/wizards-shared/dist/projects.js +2 -2
  118. package/node_modules/@engenty/wizards-shared/dist/providers.d.ts +38 -1
  119. package/node_modules/@engenty/wizards-shared/dist/providers.js +65 -13
  120. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +2 -2
  121. package/node_modules/@engenty/wizards-shared/dist/run.js +4 -4
  122. package/package.json +1 -1
  123. package/plugin/.claude-plugin/plugin.json +1 -1
  124. package/plugin/plugin.json +1 -1
  125. package/apps/web/dist/assets/EditorPage-_qnWDno2.js +0 -4
  126. package/apps/web/dist/assets/Marketplace-BwbLRU2n.js +0 -2
  127. package/apps/web/dist/assets/NewWizardPage-zYwDoQTe.js +0 -7
  128. package/apps/web/dist/assets/OnboardingPage-jFgWaWJV.js +0 -1
  129. package/apps/web/dist/assets/PreviewPane-D5Kn9Ila.js +0 -4
  130. package/apps/web/dist/assets/ProjectPage-CyeEBVGi.js +0 -1
  131. package/apps/web/dist/assets/SettingsPage-haivwaZK.js +0 -2
  132. package/apps/web/dist/assets/SetupPage-Dy8KeG7z.js +0 -1
  133. package/apps/web/dist/assets/changelog-XRs8voQT.js +0 -1
  134. package/apps/web/dist/assets/index-CXA_do-X.js +0 -14
  135. package/apps/web/dist/assets/index-DG0i3S-z.css +0 -1
  136. package/apps/web/dist/assets/theme-CWGl7LyL.js +0 -11
  137. package/apps/web/dist/assets/ui-Bk08zclS.js +0 -137
@@ -1,10 +1,10 @@
1
1
  import { mkdirSync } from "node:fs";
2
2
  import { join } from "node:path";
3
- import { ASSISTANT_LAYOUTS, ASSISTANT_PAGE_BYTES, assistantSignalSchema, assistantTurnSchema, } from "@engenty/wizards-shared/assistant";
3
+ import { ASSISTANT_LAYOUTS, ASSISTANT_PAGE_BYTES, ASSISTANT_WIDTH, assistantSignalSchema, assistantTurnSchema, } from "@engenty/wizards-shared/assistant";
4
4
  import { LANGS, MODEL_CLASSES, TEXT_CLASSES, wizardLang, } from "@engenty/wizards-shared/definition";
5
5
  import { CATEGORY_TYPES, whereSchema } from "@engenty/wizards-shared/knowledge";
6
6
  import { PROJECT_FILE_KINDS } from "@engenty/wizards-shared/projects";
7
- import { isCreditsRef } from "@engenty/wizards-shared/providers";
7
+ import { CLASS_NAMES, isCreditsRef, modelLabel } from "@engenty/wizards-shared/providers";
8
8
  import { note } from "@engenty/wizards-shared/run";
9
9
  import { wizardTexts } from "@engenty/wizards-shared/translation";
10
10
  import { PACKAGE_EXTENSION, PACKAGE_MAX_BYTES, PACKAGE_MIME, } from "@engenty/wizards-shared/wizard-package";
@@ -14,7 +14,7 @@ import { streamSSE } from "hono/streaming";
14
14
  import { nanoid } from "nanoid";
15
15
  import { z } from "zod";
16
16
  import { runStudioAssistant, signalText } from "../agents/studio-assistant.js";
17
- import { chatEngine, setChatEngine, subscriptionClients } from "../agents/subscription.js";
17
+ import { chatEngine, chatWays, setChatEngine, subscriptionClients, } from "../agents/subscription.js";
18
18
  import { scanColors, scanFonts, scanImages, scanLogos } from "../agents/website.js";
19
19
  import { answerBrowser, awaitBrowser } from "../assistant/browser.js";
20
20
  import { endRun, signalRun, startRun, takeSignals } from "../assistant/runs.js";
@@ -32,17 +32,17 @@ import { appleStatus } from "../harness/apple.js";
32
32
  import { freshAuth, loginEnv } from "../harness/env.js";
33
33
  import { detectHarness, detectHarnesses, HARNESS_IDS, harness, installSpec, } from "../harness/index.js";
34
34
  import { closeTerminal, openTerminal, resizeTerminal, subscribeTerminal, writeTerminal, } from "../harness/terminal.js";
35
- import { installMail, managed, renameTenant, saveTeamProfile, tenantInfo, tenantMembers, userInfo, } from "../manage.js";
35
+ import { installMail, managed, renameTenant, saveOrganizationProfile, tenantInfo, tenantMembers, userInfo, } from "../manage.js";
36
36
  import { seenApps } from "../mcp/seen.js";
37
37
  import { generateImageMedia, generateSpeechMedia, generateVideoMedia } from "../media/generate.js";
38
38
  import { transcribeAudio } from "../media/transcribe.js";
39
39
  import { errorText, saidOf } from "../model-errors.js";
40
- import { checkKey, classProblem, classWays, embeddingModel, hasTextModel, LOCAL_KEYS, localModelSettings, ModelUnavailableError, modelSettings, saveLocalModels, saveModels, setUpKey, setUpOllama, storedKey, textModel, } from "../models.js";
40
+ import { blockedBinding, CHAT_WAYS, checkKey, classProblem, classWays, embeddingModel, hasTextModel, LOCAL_KEYS, localModelSettings, ModelUnavailableError, modelSettings, saveLocalModels, saveModels, setUpKey, setUpOllama, storedKey, textModel, } from "../models.js";
41
41
  import { refreshPro } from "../plugins/pro.js";
42
42
  import { HTML_RESPONSE_CSP } from "../render/guard.js";
43
43
  import { isAdminRole, mayBuild, mayCreate, projectWritable, requireAdmin, requireWritable, } from "../services/access.js";
44
44
  import { architectTurn } from "../services/architect.js";
45
- import { addMessage, assistantLayout, currentChat, earlierChats, foldChat, newChat, openChat, readChat, turnHistory, } from "../services/assistant-chats.js";
45
+ import { addMessage, assistantLayout, assistantWidth, currentChat, earlierChats, foldChat, newChat, openChat, readChat, turnHistory, } from "../services/assistant-chats.js";
46
46
  import { describeGradient, themeLooks } from "../services/brand.js";
47
47
  import { checkForCloud, cloudLinked, cloudSpaces, cloudState, forgetCloud, publishAndSync, pushSharing, removeFromCloud, replaceCloudSpaces, rotateInCloud, syncToCloud, } from "../services/cloud.js";
48
48
  import { notFound, ServiceError } from "../services/errors.js";
@@ -64,7 +64,7 @@ import { deleteTheme, listThemes, saveTheme } from "../services/themes.js";
64
64
  import { deleteTranslation, editTranslation, isLangCode, publishedDefinition, translationsOf, } from "../services/translations.js";
65
65
  import { draftWidgetPreview } from "../services/widgets.js";
66
66
  import { createWizard, deleteWizard, draftChanges, duplicateWizard, listWizards, ownedWizard, rotateShareLink, updateWizardSettings, wizardMessages, wizardState, writableWizard, writeDraft, } from "../services/wizards.js";
67
- import { readSetting, writeSetting } from "../settings.js";
67
+ import { deleteSetting, readSetting, writeSetting } from "../settings.js";
68
68
  import { projectShareTargets, sharePreview } from "../sharing/index.js";
69
69
  import { codeOf } from "../tenants/control.js";
70
70
  import { currentTenant } from "../tenants/tenant.js";
@@ -85,15 +85,15 @@ async function markTested(source) {
85
85
  }
86
86
  /**
87
87
  * The chosen source has passed a test call and can still answer: its client is there and signed
88
- * in. Where Apple Intelligence thinks the short classes, the test ran there; a client behind High
89
- * and Highest is no condition then.
88
+ * in. Where Apple Intelligence thinks the short classes, the test ran there; a client behind
89
+ * Standard and High is no condition then.
90
90
  */
91
91
  async function setupDone() {
92
92
  const { source, bindings } = localModelSettings();
93
93
  if (!(await testedSources()).includes(source)) {
94
94
  return false;
95
95
  }
96
- const client = bindings.standard.startsWith("apple:") ? null : harness(source);
96
+ const client = bindings.low.startsWith("apple:") ? null : harness(source);
97
97
  if (client) {
98
98
  const status = await detectHarness(client.id);
99
99
  return Boolean(status?.version) && status?.auth !== "none";
@@ -107,7 +107,7 @@ const modelsInput = z.object({
107
107
  creditFallback: z.boolean().optional(),
108
108
  keys: z.partialRecord(z.enum(LOCAL_KEYS), z.string().max(400)).optional(),
109
109
  });
110
- /** Alone the person changes everything; in a team its owner and admins. */
110
+ /** Alone the person changes everything; in an organization its owner and admins. */
111
111
  function mayChangeModels(user) {
112
112
  return !managed || user.role === "owner" || user.role === "admin";
113
113
  }
@@ -235,14 +235,14 @@ export const studio = new Hono()
235
235
  tenant: {
236
236
  id: user.tenantId,
237
237
  role: user.role,
238
- /** The plan the team is on; null alone, or where the Manage-App names none. */
238
+ /** The plan the organization is on; null alone, or where the Manage-App names none. */
239
239
  plan: info?.plan ?? null,
240
- /** The team's address for its public page (`acme.wizards.page`); null alone, or behind its switch. */
240
+ /** The organization's address for its public page (`acme.wizards.page`); null alone, or behind its switch. */
241
241
  pagesHost: feature("pages", { ...info?.features, ...person?.features })
242
242
  ? (info?.pagesHost ?? null)
243
243
  : null,
244
244
  },
245
- /** The feature switches: the code's defaults, what the Manage-App says of the team and the person, this install's file. */
245
+ /** The feature switches: the code's defaults, what the Manage-App says of the organization and the person, this install's file. */
246
246
  features: features(managed ? { ...info?.features, ...person?.features } : overview?.tenant.features),
247
247
  /** The studio assistant's developer mode may be switched on: ASSISTANT_DEV here, the platform's admins when managed. */
248
248
  assistantDev: await assistantDevFor(user),
@@ -255,8 +255,8 @@ export const studio = new Hono()
255
255
  ? {
256
256
  name: linked.name,
257
257
  email: linked.email,
258
- /** The team the account's space belongs to, as the Manage-App names it. */
259
- team: overview?.tenant.name ?? null,
258
+ /** The organization the account's space belongs to, as the Manage-App names it. */
259
+ organization: overview?.tenant.name ?? null,
260
260
  credits: overview?.tenant.balanceCredits ?? null,
261
261
  /** What of the credits ends on a date, the nearest first. */
262
262
  expiring: overview?.tenant.expiring ?? [],
@@ -274,10 +274,12 @@ export const studio = new Hono()
274
274
  subscriptions: managed ? [] : await subscriptionClients(),
275
275
  /** A runtime that runs alone keeps its setup in front until a test call has worked on the chosen source and the way is still open. */
276
276
  setupDone: managed ? true : await setupDone(),
277
- /** The cloud studio's first visit: the short wizard that names the team and fills the space (services/onboarding.ts). */
277
+ /** The cloud studio's first visit: the short wizard that names the organization and fills the space (services/onboarding.ts). */
278
278
  onboarding: await needsOnboarding(user),
279
- /** What answers the studio chat: a model of class `highest`, or the admin's own subscription. */
279
+ /** What answers the studio's chats (Goose, the editor's chat): the text classes, a subscription, a key or the credits. */
280
280
  chatEngine: managed ? "models" : await chatEngine(await hasTextModel()),
281
+ /** The ways that can answer the studio's chats now. */
282
+ chatWays: managed ? ["models"] : await chatWays(await hasTextModel()),
281
283
  aiReady: (await hasTextModel()) || (!managed && (await subscriptionClients()).length > 0),
282
284
  mcpUrl: `${env.appUrl}/api/mcp`,
283
285
  /**
@@ -294,8 +296,8 @@ export const studio = new Hono()
294
296
  },
295
297
  });
296
298
  })
297
- // The team as the Manage-App keeps it: its people, who is invited, the places the plan gives.
298
- .get("/team", async (c) => {
299
+ // The organization as the Manage-App keeps it: its people, who is invited, the places the plan gives.
300
+ .get("/organization", async (c) => {
299
301
  if (!managed) {
300
302
  return c.json({
301
303
  error: say(c, "onlyAvailableCloud"),
@@ -303,16 +305,16 @@ export const studio = new Hono()
303
305
  }, 404);
304
306
  }
305
307
  const user = c.get("user");
306
- const [info, team] = await Promise.all([
308
+ const [info, organization] = await Promise.all([
307
309
  tenantInfo(user.tenantId).catch(() => null),
308
310
  tenantMembers(currentTenant()),
309
311
  ]);
310
312
  return c.json({
311
- ...team,
313
+ ...organization,
312
314
  plan: info?.plan ?? null,
313
315
  /** Where members are invited and roles changed: the account pages of the Manage-App. */
314
316
  manageUrl: env.manage.url,
315
- /** Whether this person manages the team there. */
317
+ /** Whether this person manages the organization there. */
316
318
  canManage: isAdminRole(user.role),
317
319
  });
318
320
  })
@@ -347,11 +349,36 @@ export const studio = new Hono()
347
349
  .post("/assistant/chat/new", async (c) => c.json(await newChat(c.get("user"))))
348
350
  .get("/assistant/chats", async (c) => c.json({ chats: await earlierChats(c.get("user")) }))
349
351
  .get("/assistant/chats/:id", async (c) => c.json(await readChat(c.get("user"), c.req.param("id"))))
350
- .get("/assistant/layout", async (c) => c.json({ layout: await assistantLayout(c.get("user")) }))
352
+ // Where the assistant stands, and the sidebar's width (null: the default); a PUT sends either.
353
+ .get("/assistant/layout", async (c) => c.json({
354
+ layout: await assistantLayout(c.get("user")),
355
+ width: await assistantWidth(c.get("user")),
356
+ }))
351
357
  .put("/assistant/layout", async (c) => {
352
- const { layout } = z.object({ layout: z.enum(ASSISTANT_LAYOUTS) }).parse(await c.req.json());
353
- await writeSetting(`assistant-layout:${c.get("user").tenantId}:${c.get("user").id}`, layout);
354
- return c.json({ layout });
358
+ const user = c.get("user");
359
+ const body = z
360
+ .object({
361
+ layout: z.enum(ASSISTANT_LAYOUTS).optional(),
362
+ width: z
363
+ .number()
364
+ .int()
365
+ .min(ASSISTANT_WIDTH.min)
366
+ .max(ASSISTANT_WIDTH.max)
367
+ .nullable()
368
+ .optional(),
369
+ })
370
+ .refine((b) => b.layout !== undefined || b.width !== undefined)
371
+ .parse(await c.req.json());
372
+ if (body.layout) {
373
+ await writeSetting(`assistant-layout:${user.tenantId}:${user.id}`, body.layout);
374
+ }
375
+ if (body.width === null) {
376
+ await deleteSetting(`assistant-width:${user.tenantId}:${user.id}`);
377
+ }
378
+ else if (body.width !== undefined) {
379
+ await writeSetting(`assistant-width:${user.tenantId}:${user.id}`, body.width);
380
+ }
381
+ return c.json({ layout: await assistantLayout(user), width: await assistantWidth(user) });
355
382
  })
356
383
  // Live chat reads answers aloud with the speech model where one is set up; else the browser's voices.
357
384
  .get("/assistant/voice", async (c) => c.json({ way: (await classWays()).speech.kind }))
@@ -532,7 +559,7 @@ export const studio = new Hono()
532
559
  await updateProject(c.get("user").id, c.req.param("id"), patch);
533
560
  return c.json({ ok: true });
534
561
  })
535
- // The team's public page as Manage will draw it, for the preview beside the page's fields.
562
+ // The organization's public page as Manage will draw it, for the preview beside the page's fields.
536
563
  .get("/projects/:id/page", async (c) => {
537
564
  await ownedProject(c.get("user").id, c.req.param("id"));
538
565
  return c.json(await pagePreview());
@@ -1328,12 +1355,12 @@ export const studio = new Hono()
1328
1355
  return c.json(localModelSettings());
1329
1356
  })
1330
1357
  // --- models: where each class runs, own API keys, the credits behind them -----------------
1331
- // Alone for this machine; on a Manage-App's runtime for the team, whose admins change it.
1358
+ // Alone for this machine; on a Manage-App's runtime for the organization, whose admins change it.
1332
1359
  .get("/models", async (c) => c.json(await modelSettings(requestLang(c))))
1333
1360
  .put("/models", async (c) => {
1334
1361
  if (!mayChangeModels(c.get("user"))) {
1335
1362
  return c.json({
1336
- error: say(c, "onlyTeamAdminsChange"),
1363
+ error: say(c, "onlyOrganizationAdminsChange"),
1337
1364
  code: "forbidden",
1338
1365
  }, 403);
1339
1366
  }
@@ -1348,7 +1375,7 @@ export const studio = new Hono()
1348
1375
  code: "not_local",
1349
1376
  }, 400);
1350
1377
  }
1351
- // Own keys and bindings to a provider's model are a feature of the team's plan.
1378
+ // Own keys and bindings to a provider's model are a feature of the organization's plan.
1352
1379
  // When the Manage-App can't say what the plan holds, own keys wait: nothing is taken unchecked.
1353
1380
  const own = Object.values(input.keys ?? {}).some((key) => key?.trim()) ||
1354
1381
  Object.values(input.bindings ?? {}).some((ref) => ref && !isCreditsRef(ref));
@@ -1367,11 +1394,22 @@ export const studio = new Hono()
1367
1394
  return c.json({
1368
1395
  error: info.plan?.name
1369
1396
  ? say(c, "ownKeysNotInPlan", { plan: info.plan.name })
1370
- : say(c, "ownKeysNotInTeamPlan"),
1397
+ : say(c, "ownKeysNotInOrganizationPlan"),
1371
1398
  code: "plan",
1372
1399
  }, 403);
1373
1400
  }
1374
1401
  }
1402
+ const blocked = input.bindings ? blockedBinding(input.bindings) : null;
1403
+ if (blocked) {
1404
+ return c.json({
1405
+ error: say(c, "modelLacksForClass", {
1406
+ model: modelLabel(blocked.ref),
1407
+ cls: CLASS_NAMES[blocked.cls],
1408
+ needs: blocked.needs.map((n) => say(c, `need.${n}`)).join(", "),
1409
+ }),
1410
+ code: "model_lacks",
1411
+ }, 400);
1412
+ }
1375
1413
  await saveModels(input);
1376
1414
  return c.json(await modelSettings(requestLang(c)));
1377
1415
  })
@@ -1395,7 +1433,7 @@ export const studio = new Hono()
1395
1433
  .post("/models/test", async (c) => {
1396
1434
  if (!mayChangeModels(c.get("user"))) {
1397
1435
  return c.json({
1398
- error: say(c, "onlyTeamAdminsTest"),
1436
+ error: say(c, "onlyOrganizationAdminsTest"),
1399
1437
  code: "forbidden",
1400
1438
  }, 403);
1401
1439
  }
@@ -1568,14 +1606,14 @@ export const studio = new Hono()
1568
1606
  if (managed) {
1569
1607
  return c.notFound();
1570
1608
  }
1571
- const { engine } = z.object({ engine: z.enum(["models", "claude"]) }).parse(await c.req.json());
1609
+ const { engine } = z.object({ engine: z.enum(CHAT_WAYS) }).parse(await c.req.json());
1572
1610
  await setChatEngine(engine);
1573
1611
  return c.json({ ok: true });
1574
1612
  })
1575
1613
  // The address the system browser opens: the account's sign-in, or — for someone without an
1576
1614
  // account — its sign-up page with the invitation code, which then goes on to the sign-in.
1577
- // --- the first visit of a cloud studio: who the team is, its website, first documents -----
1578
- .put("/team", async (c) => {
1615
+ // --- the first visit of a cloud studio: who the organization is, its website, first documents -----
1616
+ .put("/organization", async (c) => {
1579
1617
  if (!managed) {
1580
1618
  return c.json({
1581
1619
  error: say(c, "onlyAvailableCloud"),
@@ -1587,8 +1625,8 @@ export const studio = new Hono()
1587
1625
  const info = await renameTenant(c.get("user").tenantId, name);
1588
1626
  return c.json({ name: info.name });
1589
1627
  })
1590
- // What the team uses engenty for, and the questions that fit: kept at the Manage-App.
1591
- .put("/team/profile", async (c) => {
1628
+ // What the organization uses engenty for, and the questions that fit: kept at the Manage-App.
1629
+ .put("/organization/profile", async (c) => {
1592
1630
  if (!managed) {
1593
1631
  return c.json({
1594
1632
  error: say(c, "onlyAvailableCloud"),
@@ -1610,7 +1648,7 @@ export const studio = new Hono()
1610
1648
  })
1611
1649
  .parse(await c.req.json());
1612
1650
  const user = c.get("user");
1613
- await saveTeamProfile(user.tenantId, user.id, requestLang(c) === "de" ? "de" : "en", profile);
1651
+ await saveOrganizationProfile(user.tenantId, user.id, requestLang(c) === "de" ? "de" : "en", profile);
1614
1652
  return c.json({ ok: true });
1615
1653
  })
1616
1654
  .post("/onboarding/done", async (c) => {
@@ -1626,8 +1664,10 @@ export const studio = new Hono()
1626
1664
  .post("/projects/:id/website", async (c) => {
1627
1665
  const user = c.get("user");
1628
1666
  const project = await ownedProject(user.id, c.req.param("id"));
1629
- const { url } = z.object({ url: z.string().trim().min(3).max(400) }).parse(await c.req.json());
1630
- return c.json(await applyWebsite(user.id, project.id, url));
1667
+ const { url, lang } = z
1668
+ .object({ url: z.string().trim().min(3).max(400), lang: z.enum(LANGS).optional() })
1669
+ .parse(await c.req.json());
1670
+ return c.json(await applyWebsite(user.id, project.id, url, lang ?? requestLang(c)));
1631
1671
  })
1632
1672
  // The install command and the first steps, mailed to the signed-in person by the Manage-App.
1633
1673
  .post("/install-mail", async (c) => {
@@ -19,7 +19,7 @@ export function asSync(fn) {
19
19
  }
20
20
  const syncing = () => sync.getStore() === true;
21
21
  // --- roles -----------------------------------------------------------------------------
22
- // In a team, an owner or admin makes and deletes (wizards, spaces, connectors); a member edits
22
+ // In an organization, an owner or admin makes and deletes (wizards, spaces, connectors); a member edits
23
23
  // the wizards there are. A runtime that runs alone has one person, who does everything.
24
24
  const actor = new AsyncLocalStorage();
25
25
  /** Runs a request as the person's role in the tenant; set once per entry, like the tenant. */
@@ -31,8 +31,8 @@ export function currentRole() {
31
31
  return actor.getStore() ?? "owner";
32
32
  }
33
33
  export const isAdminRole = (role) => role === "owner" || role === "admin";
34
- export const MEMBERS_EDIT_ONLY = note("onlyTeamAdmins");
35
- /** Refuses a member: making and deleting is for the owner and the admins of the team. */
34
+ export const MEMBERS_EDIT_ONLY = note("onlyOrganizationAdmins");
35
+ /** Refuses a member: making and deleting is for the owner and the admins of the organization. */
36
36
  export async function requireAdmin() {
37
37
  if (syncing() || !managed || isAdminRole(currentRole())) {
38
38
  return;
@@ -41,11 +41,12 @@ lang, io) {
41
41
  const images = await attachedImages(userId, w.id, message);
42
42
  const userMessageId = await addMessage(w.id, { role: "user", content: message });
43
43
  try {
44
- // A runtime that runs alone can answer the chat on the admin's own Claude subscription.
44
+ // A runtime that runs alone can answer the chat on the admin's own subscription or key.
45
45
  const engine = managed ? "models" : await chatEngine(await hasTextModel());
46
- const result = engine === "claude"
46
+ const result = engine === "claude" || engine === "codex" || engine === "cursor"
47
47
  ? {
48
48
  ...(await subscriptionTurn({
49
+ client: engine,
49
50
  wizardId: w.id,
50
51
  message,
51
52
  signal: io.signal,
@@ -59,6 +60,7 @@ lang, io) {
59
60
  unfinished: false,
60
61
  }
61
62
  : await runArchitect({
63
+ way: engine,
62
64
  userId,
63
65
  wizardId: w.id,
64
66
  message,
@@ -1,4 +1,4 @@
1
- import { ASSISTANT_LAYOUTS } from "@engenty/wizards-shared/assistant";
1
+ import { ASSISTANT_LAYOUTS, ASSISTANT_WIDTH, } from "@engenty/wizards-shared/assistant";
2
2
  import { note } from "@engenty/wizards-shared/run";
3
3
  import { generateText } from "ai";
4
4
  import { and, asc, desc, eq, isNotNull, isNull, sql } from "drizzle-orm";
@@ -122,7 +122,7 @@ const SUMMARY_RULES = [
122
122
  async function summarise(messages, before) {
123
123
  const firstAsk = messages.find((m) => m.role === "user")?.content ?? "";
124
124
  try {
125
- const model = await textModel("standard");
125
+ const model = await textModel("low");
126
126
  const result = await generateText({
127
127
  model: model.model,
128
128
  maxOutputTokens: 900,
@@ -309,3 +309,12 @@ export async function assistantLayout(user) {
309
309
  ? stored
310
310
  : "bottom";
311
311
  }
312
+ /** The sidebar's width the person set with its handle; null: the default. */
313
+ export async function assistantWidth(user) {
314
+ const stored = await readSetting(`assistant-width:${user.tenantId}:${user.id}`);
315
+ return typeof stored === "number" &&
316
+ stored >= ASSISTANT_WIDTH.min &&
317
+ stored <= ASSISTANT_WIDTH.max
318
+ ? stored
319
+ : null;
320
+ }
@@ -68,7 +68,7 @@ const gradientAnswer = z.object({
68
68
  * angle and colour stops, in the brand's colours where the words name them.
69
69
  */
70
70
  export async function describeGradient(brand, text, current) {
71
- const model = await textModel("standard");
71
+ const model = await textModel("low");
72
72
  const result = await generateText({
73
73
  model: model.model,
74
74
  maxOutputTokens: 800,
@@ -511,7 +511,7 @@ export async function writeSummary(valueId) {
511
511
  if (!items.length) {
512
512
  throw new ServiceError("invalid", note("nothingFiledUnderValue"));
513
513
  }
514
- const model = await textModel("standard");
514
+ const model = await textModel("low");
515
515
  const result = await generateText({
516
516
  model: model.model,
517
517
  maxOutputTokens: 2000,
@@ -37,6 +37,8 @@ async function call(path, init) {
37
37
  try {
38
38
  const res = await fetch(`${env.marketplace.url}/api/v1${path}`, {
39
39
  ...init,
40
+ // Wizards in this version of the definition; a caller without it gets version 1.
41
+ headers: { ...init?.headers, "x-wizards-definition": String(DEFINITION_VERSION) },
40
42
  signal: AbortSignal.timeout(TIMEOUT_MS),
41
43
  });
42
44
  if (!res.ok) {
@@ -335,9 +337,9 @@ function listPrices() {
335
337
  webSearchCredits: WEB_SEARCH_COST_USD * CREDITS_PER_USD,
336
338
  classes: {
337
339
  classifier: text(m.classifier),
340
+ low: text(m.low),
338
341
  standard: text(m.standard),
339
342
  high: text(m.high),
340
- highest: text(m.highest),
341
343
  image: {
342
344
  model: m.image,
343
345
  kind: "image",