@engenty/wizards-runtime 0.9.1 → 0.9.3

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 (91) hide show
  1. package/README.md +24 -13
  2. package/apps/runtime/dist/docs/dev/integration/openui.md +6 -2
  3. package/apps/runtime/dist/docs/dev/plugins/runners.md +1 -1
  4. package/apps/runtime/dist/docs/dev/wizard-format/index.md +4 -53
  5. package/apps/runtime/dist/docs/dev/wizard-format/meta.json +1 -0
  6. package/apps/runtime/dist/docs/dev/wizard-format/pages-and-fields.md +17 -0
  7. package/apps/runtime/dist/docs/dev/wizard-format/themes.md +220 -0
  8. package/apps/runtime/dist/docs/dev/wizard-format/wizard-file.md +2 -0
  9. package/apps/runtime/dist/docs/user/build-a-wizard.md +25 -19
  10. package/apps/runtime/dist/docs/user/run.md +15 -1
  11. package/apps/runtime/dist/docs/user/space.md +4 -0
  12. package/apps/runtime/dist/docs/user/test-and-share.md +9 -7
  13. package/apps/runtime/dist/engine/runner.js +7 -4
  14. package/apps/runtime/dist/files/upload-check.js +622 -0
  15. package/apps/runtime/dist/harness/terminal.js +14 -7
  16. package/apps/runtime/dist/index.js +2 -0
  17. package/apps/runtime/dist/no-webstorage.js +6 -0
  18. package/apps/runtime/dist/plugins/runs.js +8 -5
  19. package/apps/runtime/dist/routes/runs.js +48 -6
  20. package/apps/runtime/dist/routes/studio.js +11 -4
  21. package/apps/runtime/dist/services/brand.js +20 -0
  22. package/apps/runtime/dist/services/project-files.js +14 -6
  23. package/apps/runtime/dist/services/runners.js +12 -2
  24. package/apps/runtime/dist/services/runs.js +73 -1
  25. package/apps/runtime/dist/services/shipped-fonts.js +33 -0
  26. package/apps/web/dist/assets/AboutDialog-DsGqq2Es.js +1 -0
  27. package/apps/web/dist/assets/{ChangelogDialog-BsM9zGdh.js → ChangelogDialog-Hn7oDuyx.js} +1 -1
  28. package/apps/web/dist/assets/EditorPage-DsJqhoXy.js +4 -0
  29. package/apps/web/dist/assets/{FlowPreview-szPmsT2-.js → FlowPreview-DZ1XL_o1.js} +1 -1
  30. package/apps/web/dist/assets/{Harness-CXx-Js4U.js → Harness-BBpl_EUW.js} +2 -2
  31. package/apps/web/dist/assets/Marketplace-BF0Rx0VR.js +2 -0
  32. package/apps/web/dist/assets/NewWizardChannels-WaAOvmzw.js +1 -0
  33. package/apps/web/dist/assets/NewWizardPage-kpm-UyQC.js +7 -0
  34. package/apps/web/dist/assets/OnboardingPage-Birm-hM5.js +1 -0
  35. package/apps/web/dist/assets/ProjectPage-CqtpxOq5.js +1 -0
  36. package/apps/web/dist/assets/PublicRunner-CXTHGYHv.js +1 -0
  37. package/apps/web/dist/assets/{ReadOnly-BUyOPou5.js → ReadOnly-CcW91P4l.js} +1 -1
  38. package/apps/web/dist/assets/RunDrawer-ByvmBv6e.js +4 -0
  39. package/apps/web/dist/assets/{RunnerView-CufG6xDP.js → RunnerView-DcduYZly.js} +1 -1
  40. package/apps/web/dist/assets/SettingsPage-Q2CUb7kK.js +2 -0
  41. package/apps/web/dist/assets/SetupPage-C7mzUoiR.js +1 -0
  42. package/apps/web/dist/assets/SharePage-CC7V2TYJ.js +1 -0
  43. package/apps/web/dist/assets/changelog-7DN_qWR2.js +1 -0
  44. package/apps/web/dist/assets/coins-RUupcqZx.js +1 -0
  45. package/apps/web/dist/assets/esm-BdxDT9Km.js +7 -0
  46. package/apps/web/dist/assets/index-myC3mJie.css +1 -0
  47. package/apps/web/dist/assets/index-qnpoZzuw.js +14 -0
  48. package/apps/web/dist/assets/logo-CGNoptDg.js +1 -0
  49. package/apps/web/dist/assets/media-Cej-H610.js +1 -0
  50. package/apps/web/dist/assets/oss-credits-D7izqI_0.js +1 -0
  51. package/apps/web/dist/assets/{phone-CJVAobUx.js → phone-ChnpShTU.js} +1 -1
  52. package/apps/web/dist/assets/react-dom-hf6EcyAr.js +1 -0
  53. package/apps/web/dist/assets/session-DekDyd9S.js +2 -0
  54. package/apps/web/dist/assets/settings-menu-CLw_oucZ.js +1 -0
  55. package/apps/web/dist/assets/theme-DjpqxoRe.js +11 -0
  56. package/apps/web/dist/assets/ui-DRYauuxF.js +137 -0
  57. package/apps/web/dist/assets/{upload-Dz86uI5u.js → upload-0sFU9K8-.js} +1 -1
  58. package/apps/web/dist/assets/useMutation-1jFwXbI6.js +1 -0
  59. package/apps/web/dist/assets/volume-2-C51sO2X0.js +1 -0
  60. package/apps/web/dist/assets/{wrench-Dr5LakQv.js → wrench-DdT-nErU.js} +1 -1
  61. package/apps/web/dist/index.html +11 -3
  62. package/apps/web/dist/install.sh +43 -3
  63. package/apps/web/dist/mcp/flow.html +54 -54
  64. package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +12 -0
  65. package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +12 -0
  66. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +4 -0
  67. package/node_modules/@engenty/wizards-shared/dist/run.js +8 -0
  68. package/node_modules/@engenty/wizards-shared/dist/theme.d.ts +7 -0
  69. package/node_modules/@engenty/wizards-shared/dist/theme.js +11 -0
  70. package/package.json +17 -6
  71. package/plugin/.claude-plugin/plugin.json +1 -1
  72. package/plugin/plugin.json +1 -1
  73. package/apps/web/dist/assets/AboutDialog-DKfHXQUv.js +0 -1
  74. package/apps/web/dist/assets/EditorPage-CRcgupmQ.js +0 -4
  75. package/apps/web/dist/assets/NewWizardChannels-C6R1HV0I.js +0 -1
  76. package/apps/web/dist/assets/NewWizardPage-D6Z6DYeT.js +0 -7
  77. package/apps/web/dist/assets/OnboardingPage-DrN26Afr.js +0 -1
  78. package/apps/web/dist/assets/ProjectPage-CNyhwfgz.js +0 -1
  79. package/apps/web/dist/assets/PublicRunner-CREvMYW_.js +0 -1
  80. package/apps/web/dist/assets/RunDrawer-8iWXyXjL.js +0 -4
  81. package/apps/web/dist/assets/SettingsPage-B4M4DrMS.js +0 -2
  82. package/apps/web/dist/assets/SetupPage-D-Op38jE.js +0 -1
  83. package/apps/web/dist/assets/SharePage-BXYVZ3Fa.js +0 -1
  84. package/apps/web/dist/assets/changelog-KvwOYLcI.js +0 -1
  85. package/apps/web/dist/assets/esm-CetquljB.js +0 -7
  86. package/apps/web/dist/assets/index-C5Qmfm_0.css +0 -1
  87. package/apps/web/dist/assets/index-TJhB4-x8.js +0 -14
  88. package/apps/web/dist/assets/oss-credits-BvQGQEzd.js +0 -1
  89. package/apps/web/dist/assets/settings-menu-DjgZMuyV.js +0 -1
  90. package/apps/web/dist/assets/theme-BucH2rUv.js +0 -11
  91. package/apps/web/dist/assets/ui-LJgQlXbd.js +0 -137
@@ -1,6 +1,5 @@
1
1
  import { accessSync, chmodSync, constants } from "node:fs";
2
2
  import { createRequire } from "node:module";
3
- import { dirname, join } from "node:path";
4
3
  import { note } from "@engenty/wizards-shared/run";
5
4
  import { nanoid } from "nanoid";
6
5
  import { ServiceError } from "../services/errors.js";
@@ -10,11 +9,19 @@ const IDLE_MS = 20 * 60_000;
10
9
  /** An ended session is kept this long for a page to read its last lines. */
11
10
  const LINGER_MS = 5 * 60_000;
12
11
  const sessions = new Map();
13
- /** The prebuilt helper node-pty forks must be executable; an install that skips scripts leaves it without the bit. */
12
+ /**
13
+ * @lydell/node-pty: node-pty with its binaries built for every platform it supports (Linux too),
14
+ * one package per platform, so nothing compiles at install. On macOS it forks through a helper
15
+ * that must be executable; a copy that lost the bit gets it back.
16
+ */
17
+ const PTY = "@lydell/node-pty";
14
18
  function ensureHelper() {
19
+ if (process.platform !== "darwin") {
20
+ return;
21
+ }
15
22
  try {
16
- const entry = createRequire(import.meta.url).resolve("node-pty");
17
- const helper = join(dirname(entry), "..", "prebuilds", `${process.platform}-${process.arch}`, "spawn-helper");
23
+ const entry = createRequire(import.meta.url).resolve(PTY);
24
+ const helper = createRequire(entry).resolve(`${PTY}-${process.platform}-${process.arch}/spawn-helper`);
18
25
  try {
19
26
  accessSync(helper, constants.X_OK);
20
27
  }
@@ -23,16 +30,16 @@ function ensureHelper() {
23
30
  }
24
31
  }
25
32
  catch {
26
- // Not on this platform, or not ours to change: spawning tells.
33
+ // Not installed, or not ours to change: spawning tells.
27
34
  }
28
35
  }
29
36
  async function ptyModule() {
30
37
  try {
31
38
  ensureHelper();
32
- const mod = (await import("node-pty"));
39
+ const mod = (await import("@lydell/node-pty"));
33
40
  const spawn = mod.spawn ?? mod.default?.spawn;
34
41
  if (!spawn) {
35
- throw new Error("node-pty has no spawn");
42
+ throw new Error(`${PTY} has no spawn`);
36
43
  }
37
44
  return { spawn };
38
45
  }
@@ -1,3 +1,5 @@
1
+ // First: drops Node's `localStorage` before a dependency reads it (no-webstorage.ts).
2
+ import "./no-webstorage.js";
1
3
  import { serve } from "@hono/node-server";
2
4
  import { localEntryUrl, purgeSessions } from "./auth/index.js";
3
5
  import { startClientChecks } from "./clients.js";
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ // Node 25 and later define `localStorage` and warn once when code reads it without
3
+ // `--localstorage-file`. A module bundled in @turbodocx/html-to-docx reads it when it loads, so
4
+ // every start printed that warning. The runtime keeps nothing in browser storage: the global goes,
5
+ // as it is on Node 24. Imported first by index.ts, before anything that could read it.
6
+ delete globalThis.localStorage;
@@ -8,6 +8,7 @@ import { watchRun } from "../engine/events.js";
8
8
  import { fieldErrorsIn } from "../engine/input.js";
9
9
  import { cancel, createRun, goBack, NoCreditsError, RunInputError, retry, reviewStep, submitPage, } from "../engine/runner.js";
10
10
  import { saveAsset } from "../files/storage.js";
11
+ import { checkUpload } from "../files/upload-check.js";
11
12
  import { wizardUnavailable } from "../limits.js";
12
13
  import { transcribeAudio } from "../media/transcribe.js";
13
14
  import { errorText, ModelUnavailableError } from "../model-errors.js";
@@ -175,14 +176,16 @@ export function runsApiFor(pluginId) {
175
176
  async upload(runId, file) {
176
177
  await pluginRun(runId);
177
178
  // The type comes from the channel's sender: kept only when it is one a wizard takes.
178
- const mime = uploadMime(file.mime);
179
- const asset = await saveAsset({
180
- runId,
181
- kind: mime.startsWith("image/") ? "image" : "file",
182
- mime,
179
+ const checked = await checkUpload({
183
180
  name: file.name,
181
+ mime: uploadMime(file.mime),
184
182
  data: file.data instanceof Uint8Array ? file.data : new Uint8Array(file.data),
185
183
  });
184
+ const asset = await saveAsset({
185
+ runId,
186
+ kind: checked.mime.startsWith("image/") ? "image" : "file",
187
+ ...checked,
188
+ });
186
189
  return { assetId: asset.id };
187
190
  },
188
191
  async transcribe(runId, file) {
@@ -25,6 +25,7 @@ import { liveResources } from "../engine/resources.js";
25
25
  import { cancel, createRun, editOutput, goBack, NoCreditsError, projectIdOf, RunConflict, RunInputError, retry, reviewStep, runView, submitPage, talkAllowed, } from "../engine/runner.js";
26
26
  import { basePath, env } from "../env.js";
27
27
  import { loadAsset, saveAsset } from "../files/storage.js";
28
+ import { checkUpload } from "../files/upload-check.js";
28
29
  import { reverseGeocode } from "../geocode.js";
29
30
  import { allowed, hashIp, verifyTurnstile, wizardUnavailable } from "../limits.js";
30
31
  import { mintConversation } from "../media/conversation.js";
@@ -37,6 +38,7 @@ import { brandView } from "../services/brand.js";
37
38
  import { ServiceError } from "../services/errors.js";
38
39
  import { publicRunners, servePageRunner } from "../services/runners.js";
39
40
  import { sharedRun, shareImage, shareRun, shareView, unshareRun } from "../services/shares.js";
41
+ import { shippedFontCss, shippedFontFile } from "../services/shipped-fonts.js";
40
42
  import { isLangCode, storedTranslation, translateResult, translationFor, uiTexts, } from "../services/translations.js";
41
43
  import { isIconFile, wizardAvatarSvg, wizardIcon } from "../services/wizard-icon.js";
42
44
  import { shareOverview } from "../sharing/index.js";
@@ -482,11 +484,37 @@ export const publicRoutes = new Hono()
482
484
  return c.notFound();
483
485
  }
484
486
  return c.body(new Uint8Array(found.data), 200, {
485
- "content-type": found.row.mime,
487
+ "content-type": bareMime(found.row.mime) ?? "application/octet-stream",
486
488
  "cache-control": "public, max-age=86400",
489
+ "x-content-type-options": "nosniff",
487
490
  // An SVG logo is shown, never run.
488
491
  "content-security-policy": "sandbox",
489
492
  });
493
+ })
494
+ // The fonts the runner ships, for a theme shown in a host's own page: any origin may load them.
495
+ .get("/fonts/shipped/:sheet{[a-z0-9-]+\\.css}", async (c) => {
496
+ const css = await shippedFontCss(c.req.param("sheet").replace(/\.css$/, ""));
497
+ if (css === null) {
498
+ return c.notFound();
499
+ }
500
+ return c.body(css, 200, {
501
+ "content-type": "text/css; charset=utf-8",
502
+ "cache-control": "public, max-age=86400",
503
+ "access-control-allow-origin": "*",
504
+ });
505
+ })
506
+ .get("/fonts/shipped/files/:file", async (c) => {
507
+ const file = c.req.param("file");
508
+ const data = await shippedFontFile(file);
509
+ if (!data) {
510
+ return c.notFound();
511
+ }
512
+ return c.body(new Uint8Array(data), 200, {
513
+ "content-type": file.endsWith(".woff2") ? "font/woff2" : "font/woff",
514
+ "cache-control": "public, max-age=604800",
515
+ "access-control-allow-origin": "*",
516
+ "cross-origin-resource-policy": "cross-origin",
517
+ });
490
518
  })
491
519
  // A brand font's own file, while its space's brand names it: run pages, embeds and hosts'
492
520
  // frames load it from here, so any origin may.
@@ -502,8 +530,9 @@ export const publicRoutes = new Hono()
502
530
  return c.notFound();
503
531
  }
504
532
  return c.body(new Uint8Array(found.data), 200, {
505
- "content-type": found.row.mime,
533
+ "content-type": bareMime(found.row.mime) ?? "application/octet-stream",
506
534
  "cache-control": "public, max-age=86400",
535
+ "x-content-type-options": "nosniff",
507
536
  "access-control-allow-origin": "*",
508
537
  "cross-origin-resource-policy": "cross-origin",
509
538
  });
@@ -872,12 +901,25 @@ export const runRoutes = new Hono()
872
901
  if (!(file instanceof File) || file.size > limit) {
873
902
  return refuse(c, { code: "fileTooLarge", params: { mb: Math.round(limit / 1_000_000) } }, 400);
874
903
  }
904
+ let checked;
905
+ try {
906
+ checked = await checkUpload({
907
+ name: file.name,
908
+ mime,
909
+ data: new Uint8Array(await file.arrayBuffer()),
910
+ });
911
+ }
912
+ catch (err) {
913
+ const said = noteOf(err);
914
+ if (said) {
915
+ return refuse(c, said, 400);
916
+ }
917
+ throw err;
918
+ }
875
919
  const ref = await saveAsset({
876
920
  runId: run.id,
877
- kind: mime.startsWith("image/") ? "upload-image" : "upload",
878
- mime,
879
- name: file.name.slice(0, 120),
880
- data: new Uint8Array(await file.arrayBuffer()),
921
+ kind: checked.mime.startsWith("image/") ? "upload-image" : "upload",
922
+ ...checked,
881
923
  });
882
924
  return c.json(ref);
883
925
  })
@@ -43,7 +43,7 @@ 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
45
  import { addMessage, assistantLayout, currentChat, earlierChats, foldChat, newChat, openChat, readChat, turnHistory, } from "../services/assistant-chats.js";
46
- import { describeGradient } from "../services/brand.js";
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";
49
49
  import { deleteFile, listFiles, readFile, writeFile } from "../services/files.js";
@@ -56,7 +56,7 @@ import { addProjectFile, addProjectFileFromUrl, fileView, orderProjectFiles, pro
56
56
  import { documentText, queueIndex, searchKnowledge } from "../services/project-index.js";
57
57
  import { createProject, deleteProject, gradientSchema, listProjects, maskedServers, ownedProject, projectLimitOrNull, projectPatchSchema, updateProject, } from "../services/projects.js";
58
58
  import { runnersOf, wizardRunners } from "../services/runners.js";
59
- import { listResults, listRuns, startTestRun } from "../services/runs.js";
59
+ import { draftStepView, listResults, listRuns, startTestRun } from "../services/runs.js";
60
60
  import { addCategoryValue, categoryRow, categoryValue, deleteCategory, deleteCategoryValue, mergeCategoryValues, orderCategoryValues, putCategory, renameCategoryValue, setItemCategory, updateCategory, } from "../services/space-categories.js";
61
61
  import { addTableRow, createPage, createTable, deletePage, deleteTable, deleteTableRows, getPage, getTable, listSpaceData, orderSubPages, updatePage, updateTable, updateTableRow, } from "../services/space-data.js";
62
62
  import { deleteTheme, listThemes, saveTheme } from "../services/themes.js";
@@ -69,7 +69,7 @@ import { codeOf } from "../tenants/control.js";
69
69
  import { currentTenant } from "../tenants/tenant.js";
70
70
  import { serverText } from "../texts.js";
71
71
  import { applyUpdate, updateStatus } from "../update.js";
72
- import { byteRange } from "./delivery.js";
72
+ import { bareMime, byteRange } from "./delivery.js";
73
73
  import { notFoundAnswer, requestLang, say } from "./lang.js";
74
74
  /** The model sources a test call has worked on: the setup is done for those, not for the others. */
75
75
  async function testedSources() {
@@ -645,7 +645,7 @@ export const studio = new Hono()
645
645
  const project = await ownedProject(c.get("user").id, c.req.param("id"));
646
646
  const { row, data } = await projectFileContent(project.id, c.req.param("fileId"));
647
647
  const headers = {
648
- "content-type": row.mime,
648
+ "content-type": bareMime(row.mime) ?? "application/octet-stream",
649
649
  "cache-control": "private, max-age=3600",
650
650
  "x-content-type-options": "nosniff",
651
651
  // An uploaded SVG or HTML file is shown, never run. A PDF is left to the browser's own
@@ -1240,6 +1240,13 @@ export const studio = new Hono()
1240
1240
  })
1241
1241
  .post("/wizards/:id/test-runs", async (c) => c.json(await startTestRun(c.get("user").id, c.req.param("id"))))
1242
1242
  .get("/wizards/:id/runs", async (c) => c.json(await listRuns(c.get("user").id, c.req.param("id"))))
1243
+ // One step of the draft as a run shows it: the preview of the step chosen.
1244
+ .get("/wizards/:id/steps/:stepId/view", async (c) => c.json(await draftStepView(c.get("user").id, c.req.param("id"), c.req.param("stepId"), c.req.query("lang") ?? null)))
1245
+ // The looks of the themes the draft offers: what the test run's preview switches between.
1246
+ .get("/wizards/:id/looks", async (c) => {
1247
+ const w = await ownedWizard(c.get("user").id, c.req.param("id"));
1248
+ return c.json({ looks: await themeLooks(w.projectId, w.draft.themes) });
1249
+ })
1243
1250
  // --- workspace -------------------------------------------------------------
1244
1251
  .get("/wizards/:id/files", async (c) => c.json(await listFiles(c.get("user").id, c.req.param("id"))))
1245
1252
  .get("/wizards/:id/files/:path{.+}", async (c) => {
@@ -35,6 +35,26 @@ export async function brandView(projectId, chain, asked) {
35
35
  theme,
36
36
  };
37
37
  }
38
+ /**
39
+ * The looks of the themes a wizard offers, in its order: what the studio's preview switches
40
+ * between. A theme the space no longer has is left out.
41
+ */
42
+ export async function themeLooks(projectId, chain) {
43
+ const p = await db.query.project.findFirst({ where: eq(schema.project.id, projectId) });
44
+ const brand = runTheme(p?.brand ?? {});
45
+ return (chain ?? []).flatMap((id) => {
46
+ const theme = chosenTheme([id], p?.themes ?? []);
47
+ return theme
48
+ ? [
49
+ {
50
+ id,
51
+ name: typeof theme === "string" ? null : theme.name,
52
+ theme: themedLook(brand, theme),
53
+ },
54
+ ]
55
+ : [];
56
+ });
57
+ }
38
58
  const HEX = /^#[0-9a-f]{6}$/i;
39
59
  // Bounds are checked after the answer: not every model takes them in a schema.
40
60
  const gradientAnswer = z.object({
@@ -5,6 +5,7 @@ import { and, asc, count, eq, max } from "drizzle-orm";
5
5
  import { db, schema } from "../db/client.js";
6
6
  import { documentMime, UnreadableDocument } from "../documents/parse.js";
7
7
  import { loadAsset, removeAsset, replaceAsset, saveAsset } from "../files/storage.js";
8
+ import { checkUpload } from "../files/upload-check.js";
8
9
  import { embeddingModel, textModel } from "../models.js";
9
10
  import { spaceFileChanged } from "../plugins/events.js";
10
11
  import { dropLinks, putLink } from "../tenants/control.js";
@@ -76,18 +77,26 @@ function accepts(kind, mime) {
76
77
  }
77
78
  export async function addProjectFile(projectId, input) {
78
79
  await requireWritableProject(projectId);
79
- const mime = documentMime(input.name, input.mime) || "application/octet-stream";
80
- if (!accepts(input.kind, mime)) {
80
+ const declared = documentMime(input.name, input.mime) || "application/octet-stream";
81
+ if (!accepts(input.kind, declared)) {
81
82
  throw new ServiceError("invalid", input.kind === "logo"
82
83
  ? note("logoImagePngSvg")
83
84
  : input.kind === "pattern"
84
85
  ? note("patternImageSvgPng")
85
86
  : note("filesGoHere"));
86
87
  }
87
- const limit = projectFileLimit(input.kind, mime);
88
+ const limit = projectFileLimit(input.kind, declared);
88
89
  if (!input.data.byteLength || input.data.byteLength > limit) {
89
90
  throw new ServiceError("invalid", note("chooseFileUpTo", { mb: Math.round(limit / 1_000_000) }));
90
91
  }
92
+ // The bytes say what the file is; a picture is drawn again without its metadata.
93
+ const checked = await checkUpload({
94
+ name: input.name,
95
+ mime: declared,
96
+ data: input.data,
97
+ fallbackName: "datei",
98
+ });
99
+ const { mime, data, name } = checked;
91
100
  const scope = and(eq(schema.projectFile.projectId, projectId), eq(schema.projectFile.kind, input.kind));
92
101
  const [{ n, last }] = await db
93
102
  .select({ n: count(), last: max(schema.projectFile.position) })
@@ -96,12 +105,11 @@ export async function addProjectFile(projectId, input) {
96
105
  if (n >= PROJECT_LIMITS.files[input.kind]) {
97
106
  throw new ServiceError("refused", note("roomMostFiles", { count: PROJECT_LIMITS.files[input.kind] }));
98
107
  }
99
- const name = input.name.slice(0, 120) || "datei";
100
108
  const ref = await saveAsset({
101
109
  kind: input.kind === "logo" ? "logo" : "project",
102
110
  mime,
103
111
  name,
104
- data: input.data,
112
+ data,
105
113
  });
106
114
  const description = input.description?.trim().slice(0, 600) ?? "";
107
115
  const work = input.kind === "document" || (!description && SEEN_BY_MODEL.includes(mime));
@@ -113,7 +121,7 @@ export async function addProjectFile(projectId, input) {
113
121
  kind: input.kind,
114
122
  name,
115
123
  mime,
116
- size: input.data.byteLength,
124
+ size: data.byteLength,
117
125
  description,
118
126
  source: input.source ?? null,
119
127
  position: (last ?? -1) + 1,
@@ -2,6 +2,7 @@ import { textLang, wizardLang } from "@engenty/wizards-shared/definition";
2
2
  import { note } from "@engenty/wizards-shared/run";
3
3
  import { BUILT_IN_RUNNERS, CONVERSATION_RUNNERS, DEFAULT_RUNNER, DEFAULT_RUNNER_SETTINGS, runnerFit, } from "@engenty/wizards-shared/runners";
4
4
  import { env } from "../env.js";
5
+ import { feature, remoteFeatures } from "../features.js";
5
6
  import { conversationAccess, conversationAvailable } from "../models.js";
6
7
  import { pluginsOf } from "../plugins/registry.js";
7
8
  import { currentTenant } from "../tenants/tenant.js";
@@ -12,9 +13,18 @@ import { shareUrl } from "./wizards.js";
12
13
  * plugins add. Which of them a wizard offers is set per wizard (`wizard.runners`): the one its
13
14
  * link opens, and the ones switched on beside it.
14
15
  */
15
- /** The runners this tenant has, built-ins first. */
16
+ /** The built-in runners switched off for the tenant at hand: live voice and video call each have a switch. */
17
+ export async function switchedOffRunners() {
18
+ const remote = await remoteFeatures();
19
+ return new Set([
20
+ ...(feature("channelVoice", remote) ? [] : ["talk"]),
21
+ ...(feature("channelVideo", remote) ? [] : ["video"]),
22
+ ]);
23
+ }
24
+ /** The runners this tenant has, built-ins first; a built-in one switched off is not there. */
16
25
  export async function runnersOf(tenantId = currentTenant()) {
17
26
  const plugins = await pluginsOf(tenantId);
27
+ const off = await switchedOffRunners();
18
28
  const talk = (await conversationAvailable())
19
29
  ? null
20
30
  : await conversationAccess()
@@ -30,7 +40,7 @@ export async function runnersOf(tenantId = currentTenant()) {
30
40
  : null),
31
41
  }))));
32
42
  return [
33
- ...BUILT_IN_RUNNERS.map((r) => CONVERSATION_RUNNERS.includes(r.id) ? { ...r, problem: talk } : r),
43
+ ...BUILT_IN_RUNNERS.filter((r) => !off.has(r.id)).map((r) => CONVERSATION_RUNNERS.includes(r.id) ? { ...r, problem: talk } : r),
34
44
  ...ofPlugins,
35
45
  ];
36
46
  }
@@ -6,11 +6,13 @@ import { db, schema } from "../db/client.js";
6
6
  import { answerAsk } from "../engine/asks.js";
7
7
  import { emitEvent, recentEvents, watchRun } from "../engine/events.js";
8
8
  import { fieldErrorsIn } from "../engine/input.js";
9
- import { cancel, createRun, goBack, NoCreditsError, pageContext, RunConflict, RunInputError, retry, reviewStep, submitPage, } from "../engine/runner.js";
9
+ import { cancel, createRun, goBack, NoCreditsError, pageContext, RunConflict, RunInputError, retry, reviewStep, runView, submitPage, } from "../engine/runner.js";
10
10
  import { ModelUnavailableError, saidOf } from "../model-errors.js";
11
11
  import { signedUrl } from "../secrets/signing.js";
12
12
  import { currentTenant } from "../tenants/tenant.js";
13
+ import { brandView } from "./brand.js";
13
14
  import { notFound, ServiceError } from "./errors.js";
15
+ import { storedTranslation } from "./translations.js";
14
16
  import { ownedWizard, requireClean, shareUrl, studioUrl } from "./wizards.js";
15
17
  /** Test runs an MCP client started with answers: pages are filled and reviews accepted for it. */
16
18
  const autopilots = new Set();
@@ -429,6 +431,76 @@ export async function answerRunAsk(userId, runId, askId, answer) {
429
431
  throw new ServiceError("refused", { code: "askClosed" });
430
432
  }
431
433
  }
434
+ /**
435
+ * One step of the draft as a run shows it there, without a run: the studio's preview of the
436
+ * step chosen. Answers and outputs of the steps before it come from the wizard's latest
437
+ * finished test run, else its latest one. Nothing is stored and nothing runs: pages wait for
438
+ * input, steps that work show their working screen, the result shows as done. `lang`: in a
439
+ * language the wizard is kept in, else its own.
440
+ */
441
+ export async function draftStepView(userId, wizardId, stepId, lang) {
442
+ const w = await ownedWizard(userId, wizardId);
443
+ const def = w.draft;
444
+ const step = def.steps.find((s) => s.id === stepId);
445
+ if (!step) {
446
+ throw notFound();
447
+ }
448
+ // The latest finished test run has every answer and output; else the latest one at all.
449
+ const tests = and(eq(schema.run.wizardId, w.id), eq(schema.run.mode, "test"));
450
+ const latest = (await db.query.run.findFirst({
451
+ where: and(tests, eq(schema.run.status, "done")),
452
+ orderBy: desc(schema.run.createdAt),
453
+ })) ?? (await db.query.run.findFirst({ where: tests, orderBy: desc(schema.run.createdAt) }));
454
+ const before = new Set(def.steps.slice(0, def.steps.indexOf(step)).map((s) => s.id));
455
+ const state = {
456
+ values: latest?.state.values ?? {},
457
+ outputs: Object.fromEntries(Object.entries(latest?.state.outputs ?? {}).filter(([id]) => before.has(id))),
458
+ history: (latest?.state.history ?? []).filter((id) => before.has(id)),
459
+ notes: {},
460
+ };
461
+ const status = step.type === "page" || step.type === "review"
462
+ ? "waiting_input"
463
+ : step.type === "result"
464
+ ? "done"
465
+ : "running";
466
+ const now = new Date();
467
+ // That run lends its id too: the outputs' files are reached through it.
468
+ const run = {
469
+ ...(latest ?? {
470
+ id: `draft-${w.id}`,
471
+ wizardId: w.id,
472
+ tenantId: w.tenantId,
473
+ files: [],
474
+ version: null,
475
+ mode: "test",
476
+ runner: null,
477
+ visitorId: null,
478
+ userId,
479
+ ipHash: null,
480
+ origin: null,
481
+ client: null,
482
+ unattended: false,
483
+ deviceOffer: null,
484
+ costMicros: 0,
485
+ sharedAt: null,
486
+ expiresAt: null,
487
+ createdAt: now,
488
+ updatedAt: now,
489
+ }),
490
+ definition: def,
491
+ status,
492
+ cursor: step.id,
493
+ state,
494
+ lang: lang && lang !== wizardLang(def) && (await storedTranslation(w.id, lang)) ? lang : null,
495
+ error: null,
496
+ ask: null,
497
+ answer: null,
498
+ shareToken: null,
499
+ };
500
+ const view = await runView(run, await brandView(w.projectId, def.themes));
501
+ // What the latest run said while it worked, and when, is its own: nothing works here.
502
+ return { ...view, events: [] };
503
+ }
432
504
  export async function listRuns(userId, wizardId) {
433
505
  const w = await ownedWizard(userId, wizardId);
434
506
  const rows = await db.query.run.findMany({
@@ -0,0 +1,33 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { createRequire } from "node:module";
3
+ import { dirname, join } from "node:path";
4
+ import { SHIPPED_FONTS, shippedFontSlug } from "@engenty/wizards-shared/theme";
5
+ /**
6
+ * The fonts the runner ships (SHIPPED_FONTS), served for pages that are not the runtime's own: a
7
+ * host's OpenUI chat loads a theme's font from here. Each comes from its Fontsource package as
8
+ * the run page bundles it: a stylesheet with the weights the pages use, every subset by its
9
+ * unicode-range, and the files it names next to it.
10
+ */
11
+ const require = createRequire(import.meta.url);
12
+ const SLUGS = SHIPPED_FONTS.map(shippedFontSlug);
13
+ /** The weights the pages use (text 400–700); a font that has fewer comes in those it has. */
14
+ const WEIGHTS = [400, 500, 600, 700];
15
+ const FILE = /^[a-z0-9-]+-\d{3}-normal\.woff2?$/;
16
+ const packageDir = (slug) => dirname(require.resolve(`@fontsource/${slug}/package.json`));
17
+ /** The stylesheet of a shipped font by its slug; null for one that is not ours. */
18
+ export async function shippedFontCss(slug) {
19
+ if (!SLUGS.includes(slug)) {
20
+ return null;
21
+ }
22
+ const dir = packageDir(slug);
23
+ const sheets = await Promise.all(WEIGHTS.map((w) => readFile(join(dir, `${w}.css`), "utf8").catch(() => "")));
24
+ return sheets.join("\n");
25
+ }
26
+ /** One file a shipped font's stylesheet names; null for anything else. */
27
+ export async function shippedFontFile(file) {
28
+ // The longest slug first: one slug can start another's name.
29
+ const slug = FILE.test(file)
30
+ ? [...SLUGS].sort((a, b) => b.length - a.length).find((s) => file.startsWith(`${s}-`))
31
+ : undefined;
32
+ return slug ? await readFile(join(packageDir(slug), "files", file)).catch(() => null) : null;
33
+ }
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{Bt as r,Dr as i,Gt as a,Jt as o,Lt as s,Nr as c,Rt as l,Xt as u,nr as d,rn as f,zt as p}from"./ui-DRYauuxF.js";import{t as m}from"./preload-helper-CNEI7N0N.js";import{t as h}from"./logo-CGNoptDg.js";import{G as g,nt as _,tt as v}from"./index-qnpoZzuw.js";import{c as y,f as b}from"./settings-menu-CLw_oucZ.js";import{ReleaseNotes as x,loadReleases as S,releaseDate as C,releaseLabel as w}from"./ChangelogDialog-Hn7oDuyx.js";var T=e(t(),1),E=[{name:`engenty wizards`,description:`credit.engenty-wizards`,homepage:`https://github.com/engenty/wizards`,license:`FSL-1.1-MIT`},{name:`engenty`,description:`credit.engenty`,homepage:`https://github.com/engenty/engenty`,license:`FSL-1.1-MIT`}],D=[{name:`Mastra`,description:`credit.mastra`,homepage:`https://github.com/mastra-ai/mastra`,license:`Apache-2.0`},{name:`AI SDK`,description:`credit.ai-sdk`,homepage:`https://github.com/vercel/ai`,license:`Apache-2.0`},{name:`Model Context Protocol`,description:`credit.model-context-protocol`,homepage:`https://github.com/modelcontextprotocol/typescript-sdk`,license:`MIT`},{name:`Hono`,description:`credit.hono`,homepage:`https://github.com/honojs/hono`,license:`MIT`},{name:`Drizzle ORM`,description:`credit.drizzle-orm`,homepage:`https://github.com/drizzle-team/drizzle-orm`,license:`Apache-2.0`},{name:`libSQL`,description:`credit.libsql`,homepage:`https://github.com/tursodatabase/libsql`,license:`MIT`},{name:`Playwright`,description:`credit.playwright`,homepage:`https://github.com/microsoft/playwright`,license:`Apache-2.0`},{name:`React`,description:`credit.react`,homepage:`https://github.com/facebook/react`,license:`MIT`},{name:`Vite`,description:`credit.vite`,homepage:`https://github.com/vitejs/vite`,license:`MIT`},{name:`Tailwind CSS`,description:`credit.tailwind-css`,homepage:`https://github.com/tailwindlabs/tailwindcss`,license:`MIT`},{name:`React Flow`,description:`credit.react-flow`,homepage:`https://github.com/xyflow/xyflow`,license:`MIT`},{name:`TanStack Query`,description:`credit.tanstack-query`,homepage:`https://github.com/TanStack/query`,license:`MIT`},{name:`xterm.js`,description:`credit.xterm-js`,homepage:`https://github.com/xtermjs/xterm.js`,license:`MIT`},{name:`Lucide`,description:`credit.lucide`,homepage:`https://github.com/lucide-icons/lucide`,license:`ISC`},{name:`Geist & Geist Mono`,description:`credit.geist-geist-mono`,homepage:`https://github.com/vercel/geist-font`,license:`OFL-1.1`},{name:`Space Grotesk`,description:`credit.space-grotesk`,homepage:`https://github.com/floriankarsten/space-grotesk`,license:`OFL-1.1`},{name:`git-cliff`,description:`credit.git-cliff`,homepage:`https://github.com/orhun/git-cliff`,license:`MIT OR Apache-2.0`}],O=e(n(),1),k=(e,...t)=>t.some(t=>t?.toLowerCase().includes(e));function A({name:e,homepage:t,version:n,license:r,description:a}){return(0,O.jsxs)(`li`,{className:`py-2.5`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,children:[t?(0,O.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 font-medium text-[0.875rem] text-ink underline-offset-4 hover:underline`,children:[e,(0,O.jsx)(i,{"aria-hidden":!0,className:`size-3 text-ink-4`})]}):(0,O.jsx)(`span`,{className:`font-medium text-[0.875rem] text-ink`,children:e}),n?(0,O.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:n}):null,(0,O.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:r})]}),a?(0,O.jsx)(`p`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:a}):null]})}function j({title:e,hint:t,children:n}){return(0,O.jsxs)(`section`,{className:`mt-6`,children:[(0,O.jsx)(`h3`,{className:`border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:e}),t?(0,O.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3`,children:t}):null,n]})}function M({credits:e}){return(0,O.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:e.map(e=>(0,O.jsx)(A,{name:e.name,homepage:e.homepage,license:e.license,description:f(e.description)},e.name))})}function N({label:e,packages:t}){return(0,O.jsxs)(`div`,{className:`mt-4`,children:[(0,O.jsx)(`h4`,{className:`font-medium text-[0.75rem] text-ink-3 tracking-wide`,children:e}),(0,O.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:t.map(e=>(0,O.jsx)(A,{...e},e.name))})]})}function P({active:e}){let[t,n]=(0,T.useState)(null),[i,o]=(0,T.useState)(``);(0,T.useEffect)(()=>{if(!e||t)return;let r=!1;return m(()=>import(`./oss-credits-D7izqI_0.js`).then(e=>{r||n(e.default)}),[]),()=>{r=!0}},[e,t]),(0,T.useEffect)(()=>{e||o(``)},[e]);let s=i.trim().toLowerCase(),c=e=>s?e.filter(e=>k(s,e.name,e.license,f(e.description))):e,u=e=>s?e.filter(e=>k(s,e.name,e.license,e.version)):e,d=c(E),p=c(D),h=t?[{id:`shared`,label:f(`about.creditsShared`),packages:u(t.shared)},...t.groups.map(e=>({id:e.id,label:e.label,packages:u(e.packages)}))].filter(e=>e.packages.length>0):[],g=d.length===0&&p.length===0&&h.length===0;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`mb-4 text-[0.875rem] text-ink-3`,children:f(`about.creditsHint`)}),(0,O.jsx)(r,{type:`search`,value:i,placeholder:f(`about.search`),onChange:e=>o(e.target.value)}),d.length>0?(0,O.jsx)(j,{title:f(`about.creditsProduct`),children:(0,O.jsx)(M,{credits:d})}):null,p.length>0?(0,O.jsx)(j,{title:f(`about.creditsBuiltWith`),children:(0,O.jsx)(M,{credits:p})}):null,t===null?(0,O.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,O.jsx)(a,{})}):h.length>0?(0,O.jsx)(j,{title:f(`about.creditsDeps`),hint:s?void 0:f(`about.creditsDepsHint`),children:h.map(e=>(0,O.jsx)(N,{label:e.label,packages:e.packages},e.id))}):null,t!==null&&g?(0,O.jsx)(l,{children:f(`about.noMatches`)}):null]})}var F=[`new`,`earlier`,`credits`],I=e=>f(e===`new`?`about.tab.new`:e===`earlier`?`about.tab.earlier`:`about.credits`),L=e=>e===1?f(`about.change`):f(`about.changes`,{n:e});function R({me:e,active:t,initialTab:n=`new`}){let r=e?.mode===`local`,{data:i,latest:s}=v(r&&t),[l,d]=(0,T.useState)(null),[p,m]=(0,T.useState)(n);(0,T.useEffect)(()=>m(n),[n]);let E=b(F.indexOf(p)),D=i?.newer&&s?s:_;(0,T.useEffect)(()=>{if(!t)return;let e=!1;return d(null),S(D===`0.9.3`?void 0:D).then(t=>{e||d(t)}),()=>{e=!0}},[t,D]);let k=l?.find(e=>e.version===`v${D}`)??l?.[0]??null,A=l?.filter(e=>e!==k)??[],j=r?i?.kind??null:`cloud`;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`flex flex-col items-center pt-4 text-center`,children:[(0,O.jsx)(h,{size:96}),(0,O.jsxs)(`div`,{className:`mt-4 font-display font-semibold text-[1.5rem] tracking-tight`,children:[`engenty`,(0,O.jsx)(`span`,{className:`text-ember`,children:`.`}),(0,O.jsx)(`span`,{className:`ml-1.5 font-normal text-ink-3`,children:`wizards`})]}),(0,O.jsxs)(`div`,{className:`mt-1 text-[0.9375rem] text-ink-3 tabular-nums`,children:[f(`about.version`,{v:_}),j?` · ${f(`about.kind.${j}`)}`:``]})]}),r?(0,O.jsx)(`div`,{className:`mt-5`,children:(0,O.jsx)(g,{enabled:t})}):null,(0,O.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,O.jsx)(o,{value:p,onChange:m,options:F.map(e=>({id:e,label:I(e)})),label:f(`about.title`)})}),(0,O.jsxs)(`div`,{className:u(`mt-5`,y(E)),children:[p===`new`?l===null?(0,O.jsx)(`div`,{className:`flex justify-center py-6 text-ink-3`,children:(0,O.jsx)(a,{})}):k?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:[w(k),(0,O.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:C(k)})]}),(0,O.jsx)(`div`,{className:`mt-3`,children:(0,O.jsx)(x,{release:k})})]}):(0,O.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:f(`about.changelogEmpty`)}):null,p===`earlier`?(0,O.jsx)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:A.map(e=>(0,O.jsxs)(`details`,{className:`group/r py-2`,children:[(0,O.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-baseline gap-3 text-[0.875rem] [&::-webkit-details-marker]:hidden`,children:[(0,O.jsx)(c,{className:`size-3.5 shrink-0 self-center text-ink-4 transition group-open/r:rotate-90`}),(0,O.jsx)(`span`,{className:`font-medium text-ink tabular-nums`,children:w(e)}),(0,O.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:C(e)}),(0,O.jsx)(`span`,{className:`ml-auto text-[0.8125rem] text-ink-4`,children:L(e.commits.length)})]}),(0,O.jsx)(`div`,{className:`mt-2 pl-6`,children:(0,O.jsx)(x,{release:e})})]},e.version??`unreleased`))}):null,p===`credits`?(0,O.jsx)(P,{active:!0}):null]},p)]})}function z({open:e,onClose:t,me:n}){return(0,O.jsxs)(s,{open:e,onClose:t,wide:!0,height:`tall`,children:[(0,O.jsx)(`div`,{className:`-mt-2 -mr-2 sticky top-0 z-10 flex h-0 justify-end`,children:(0,O.jsx)(p,{label:f(`common.close`),onClick:t,children:(0,O.jsx)(d,{className:`size-4`})})}),(0,O.jsx)(R,{me:n,active:e})]})}export{z as AboutDialog,R as AboutPanel};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{Bt as r,Gt as i,Lt as a,Rt as o,Xt as s,rn as c}from"./ui-LJgQlXbd.js";import{t as l}from"./preload-helper-CNEI7N0N.js";var u=e(t(),1),d=e(n(),1);function f(e){switch(e.group){case`Added`:return{label:`NEW`,dot:`bg-moss`};case`Fixed`:return{label:`FIXED`,dot:`bg-amber`};case`Changed`:return{label:`CHANGED`,dot:`bg-cobalt`};case`Performance`:return{label:`PERFORMANCE`,dot:`bg-ember`};case`Deploy`:return{label:`DEPLOY`,dot:`bg-ink-4`};case`Docs`:return{label:`DOCS`,dot:`bg-ink-4`};default:return{label:`OTHER`,dot:`bg-ink-4`}}}var p=e=>e.version?e.version.replace(/^v/,``):c(`about.unreleased`),m=e=>e.timestamp?new Date(e.timestamp*1e3).toISOString().slice(0,10):``,h=e=>e.charAt(0).toUpperCase()+e.slice(1);function g(e,t){let n=t.trim().toLowerCase();if(!n)return e;let r=[];for(let t of e){if(`${p(t)} ${m(t)}`.toLowerCase().includes(n)){r.push(t);continue}let e=t.commits.filter(e=>`${f(e).label} ${e.scope??``} ${e.message}`.toLowerCase().includes(n));e.length>0&&r.push({...t,commits:e})}return r}async function _(e){if(e)try{let t=await fetch(`https://raw.githubusercontent.com/engenty/wizards/v${e}/apps/web/src/about/changelog.json`,{signal:AbortSignal.timeout(5e3)});if(t.ok)return await t.json()}catch{}return(await l(async()=>{let{default:e}=await import(`./changelog-KvwOYLcI.js`);return{default:e}},[])).default}function v({release:e}){return(0,d.jsx)(`ul`,{className:`flex flex-col gap-2`,children:e.commits.map(e=>{let t=f(e);return(0,d.jsxs)(`li`,{className:`flex items-start gap-2.5 text-[0.875rem]`,children:[(0,d.jsx)(`span`,{className:s(`mt-[7px] size-1.5 shrink-0 rounded-full`,t.dot)}),(0,d.jsxs)(`span`,{className:`min-w-0 text-ink-2`,children:[(0,d.jsxs)(`span`,{className:`font-semibold text-[0.75rem] text-ink tracking-wide`,children:[t.label,e.scope?` [${e.scope}]`:``]}),` `,h(e.message),e.breaking?(0,d.jsx)(`span`,{className:`ml-1.5 rounded-full bg-rose-tint px-1.5 py-0.5 font-medium text-[0.75rem] text-rose`,children:c(`about.breaking`)}):null]})]},e.id)})})}function y({open:e,onClose:t,version:n}){let[s,l]=(0,u.useState)(null),[f,h]=(0,u.useState)(``);(0,u.useEffect)(()=>{if(!e||s)return;let t=!1;return _(n).then(e=>{t||l(e)}),()=>{t=!0}},[e,s,n]),(0,u.useEffect)(()=>{e||h(``)},[e]);let y=s?g(s,f):[];return(0,d.jsxs)(a,{open:e,onClose:t,title:c(`about.changelog`),wide:!0,height:`tall`,children:[(0,d.jsx)(`p`,{className:`-mt-3 mb-4 text-[0.875rem] text-ink-3`,children:c(`about.changelogHint`)}),s===null?(0,d.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,d.jsx)(i,{})}):s.length===0?(0,d.jsx)(o,{children:c(`about.changelogEmpty`)}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(r,{type:`search`,value:f,placeholder:c(`about.search`),onChange:e=>h(e.target.value)}),y.length===0?(0,d.jsx)(o,{children:c(`about.noMatches`)}):null,y.map(e=>(0,d.jsxs)(`section`,{className:`mt-6`,children:[(0,d.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:[p(e),(0,d.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:m(e)})]}),(0,d.jsx)(`div`,{className:`mt-3`,children:(0,d.jsx)(v,{release:e})})]},e.version??`unreleased`))]})]})}export{y as ChangelogDialog,v as ReleaseNotes,_ as loadReleases,m as releaseDate,p as releaseLabel};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{Bt as r,Gt as i,Lt as a,Rt as o,Xt as s,rn as c}from"./ui-DRYauuxF.js";import{t as l}from"./preload-helper-CNEI7N0N.js";var u=e(t(),1),d=e(n(),1);function f(e){switch(e.group){case`Added`:return{label:`NEW`,dot:`bg-moss`};case`Fixed`:return{label:`FIXED`,dot:`bg-amber`};case`Changed`:return{label:`CHANGED`,dot:`bg-cobalt`};case`Performance`:return{label:`PERFORMANCE`,dot:`bg-ember`};case`Deploy`:return{label:`DEPLOY`,dot:`bg-ink-4`};case`Docs`:return{label:`DOCS`,dot:`bg-ink-4`};default:return{label:`OTHER`,dot:`bg-ink-4`}}}var p=e=>e.version?e.version.replace(/^v/,``):c(`about.unreleased`),m=e=>e.timestamp?new Date(e.timestamp*1e3).toISOString().slice(0,10):``,h=e=>e.charAt(0).toUpperCase()+e.slice(1);function g(e,t){let n=t.trim().toLowerCase();if(!n)return e;let r=[];for(let t of e){if(`${p(t)} ${m(t)}`.toLowerCase().includes(n)){r.push(t);continue}let e=t.commits.filter(e=>`${f(e).label} ${e.scope??``} ${e.message}`.toLowerCase().includes(n));e.length>0&&r.push({...t,commits:e})}return r}async function _(e){if(e)try{let t=await fetch(`https://raw.githubusercontent.com/engenty/wizards/v${e}/apps/web/src/about/changelog.json`,{signal:AbortSignal.timeout(5e3)});if(t.ok)return await t.json()}catch{}return(await l(async()=>{let{default:e}=await import(`./changelog-7DN_qWR2.js`);return{default:e}},[])).default}function v({release:e}){return(0,d.jsx)(`ul`,{className:`flex flex-col gap-2`,children:e.commits.map(e=>{let t=f(e);return(0,d.jsxs)(`li`,{className:`flex items-start gap-2.5 text-[0.875rem]`,children:[(0,d.jsx)(`span`,{className:s(`mt-[7px] size-1.5 shrink-0 rounded-full`,t.dot)}),(0,d.jsxs)(`span`,{className:`min-w-0 text-ink-2`,children:[(0,d.jsxs)(`span`,{className:`font-semibold text-[0.75rem] text-ink tracking-wide`,children:[t.label,e.scope?` [${e.scope}]`:``]}),` `,h(e.message),e.breaking?(0,d.jsx)(`span`,{className:`ml-1.5 rounded-full bg-rose-tint px-1.5 py-0.5 font-medium text-[0.75rem] text-rose`,children:c(`about.breaking`)}):null]})]},e.id)})})}function y({open:e,onClose:t,version:n}){let[s,l]=(0,u.useState)(null),[f,h]=(0,u.useState)(``);(0,u.useEffect)(()=>{if(!e||s)return;let t=!1;return _(n).then(e=>{t||l(e)}),()=>{t=!0}},[e,s,n]),(0,u.useEffect)(()=>{e||h(``)},[e]);let y=s?g(s,f):[];return(0,d.jsxs)(a,{open:e,onClose:t,title:c(`about.changelog`),wide:!0,height:`tall`,children:[(0,d.jsx)(`p`,{className:`-mt-3 mb-4 text-[0.875rem] text-ink-3`,children:c(`about.changelogHint`)}),s===null?(0,d.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,d.jsx)(i,{})}):s.length===0?(0,d.jsx)(o,{children:c(`about.changelogEmpty`)}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(r,{type:`search`,value:f,placeholder:c(`about.search`),onChange:e=>h(e.target.value)}),y.length===0?(0,d.jsx)(o,{children:c(`about.noMatches`)}):null,y.map(e=>(0,d.jsxs)(`section`,{className:`mt-6`,children:[(0,d.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:[p(e),(0,d.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:m(e)})]}),(0,d.jsx)(`div`,{className:`mt-3`,children:(0,d.jsx)(v,{release:e})})]},e.version??`unreleased`))]})]})}export{y as ChangelogDialog,v as ReleaseNotes,_ as loadReleases,m as releaseDate,p as releaseLabel};