@engenty/wizards-runtime 0.9.2 → 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 (73) hide show
  1. package/apps/runtime/dist/docs/dev/integration/openui.md +6 -2
  2. package/apps/runtime/dist/docs/user/build-a-wizard.md +25 -19
  3. package/apps/runtime/dist/docs/user/test-and-share.md +9 -7
  4. package/apps/runtime/dist/engine/runner.js +7 -4
  5. package/apps/runtime/dist/routes/runs.js +26 -0
  6. package/apps/runtime/dist/routes/studio.js +9 -2
  7. package/apps/runtime/dist/services/brand.js +20 -0
  8. package/apps/runtime/dist/services/runners.js +12 -2
  9. package/apps/runtime/dist/services/runs.js +73 -1
  10. package/apps/runtime/dist/services/shipped-fonts.js +33 -0
  11. package/apps/web/dist/assets/AboutDialog-DsGqq2Es.js +1 -0
  12. package/apps/web/dist/assets/{ChangelogDialog-ClkjHGE_.js → ChangelogDialog-Hn7oDuyx.js} +1 -1
  13. package/apps/web/dist/assets/EditorPage-DsJqhoXy.js +4 -0
  14. package/apps/web/dist/assets/{FlowPreview-DZRkWedM.js → FlowPreview-DZ1XL_o1.js} +1 -1
  15. package/apps/web/dist/assets/{Harness-FiDeF3LX.js → Harness-BBpl_EUW.js} +2 -2
  16. package/apps/web/dist/assets/Marketplace-BF0Rx0VR.js +2 -0
  17. package/apps/web/dist/assets/NewWizardChannels-WaAOvmzw.js +1 -0
  18. package/apps/web/dist/assets/NewWizardPage-kpm-UyQC.js +7 -0
  19. package/apps/web/dist/assets/OnboardingPage-Birm-hM5.js +1 -0
  20. package/apps/web/dist/assets/ProjectPage-CqtpxOq5.js +1 -0
  21. package/apps/web/dist/assets/PublicRunner-CXTHGYHv.js +1 -0
  22. package/apps/web/dist/assets/{ReadOnly-I-Lm7a8y.js → ReadOnly-CcW91P4l.js} +1 -1
  23. package/apps/web/dist/assets/RunDrawer-ByvmBv6e.js +4 -0
  24. package/apps/web/dist/assets/{RunnerView-DeDApA-9.js → RunnerView-DcduYZly.js} +1 -1
  25. package/apps/web/dist/assets/SettingsPage-Q2CUb7kK.js +2 -0
  26. package/apps/web/dist/assets/SetupPage-C7mzUoiR.js +1 -0
  27. package/apps/web/dist/assets/SharePage-CC7V2TYJ.js +1 -0
  28. package/apps/web/dist/assets/changelog-7DN_qWR2.js +1 -0
  29. package/apps/web/dist/assets/coins-RUupcqZx.js +1 -0
  30. package/apps/web/dist/assets/esm-BdxDT9Km.js +7 -0
  31. package/apps/web/dist/assets/index-myC3mJie.css +1 -0
  32. package/apps/web/dist/assets/index-qnpoZzuw.js +14 -0
  33. package/apps/web/dist/assets/logo-CGNoptDg.js +1 -0
  34. package/apps/web/dist/assets/media-Cej-H610.js +1 -0
  35. package/apps/web/dist/assets/oss-credits-D7izqI_0.js +1 -0
  36. package/apps/web/dist/assets/{phone-BprN_SDS.js → phone-ChnpShTU.js} +1 -1
  37. package/apps/web/dist/assets/react-dom-hf6EcyAr.js +1 -0
  38. package/apps/web/dist/assets/session-DekDyd9S.js +2 -0
  39. package/apps/web/dist/assets/settings-menu-CLw_oucZ.js +1 -0
  40. package/apps/web/dist/assets/theme-DjpqxoRe.js +11 -0
  41. package/apps/web/dist/assets/ui-DRYauuxF.js +137 -0
  42. package/apps/web/dist/assets/{upload-Cvztyjuj.js → upload-0sFU9K8-.js} +1 -1
  43. package/apps/web/dist/assets/useMutation-1jFwXbI6.js +1 -0
  44. package/apps/web/dist/assets/volume-2-C51sO2X0.js +1 -0
  45. package/apps/web/dist/assets/{wrench-CWT9IGKq.js → wrench-DdT-nErU.js} +1 -1
  46. package/apps/web/dist/index.html +11 -3
  47. package/apps/web/dist/mcp/flow.html +54 -54
  48. package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +12 -0
  49. package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +12 -0
  50. package/node_modules/@engenty/wizards-shared/dist/theme.d.ts +7 -0
  51. package/node_modules/@engenty/wizards-shared/dist/theme.js +11 -0
  52. package/package.json +16 -3
  53. package/plugin/.claude-plugin/plugin.json +1 -1
  54. package/plugin/plugin.json +1 -1
  55. package/apps/web/dist/assets/AboutDialog-BUdEn9X_.js +0 -1
  56. package/apps/web/dist/assets/EditorPage-j5HjqTMV.js +0 -4
  57. package/apps/web/dist/assets/NewWizardChannels-DeJP5h5I.js +0 -1
  58. package/apps/web/dist/assets/NewWizardPage-CIS3qNUz.js +0 -7
  59. package/apps/web/dist/assets/OnboardingPage-CoTYSubc.js +0 -1
  60. package/apps/web/dist/assets/ProjectPage-XVhe87S4.js +0 -1
  61. package/apps/web/dist/assets/PublicRunner-Bc-3e7UU.js +0 -1
  62. package/apps/web/dist/assets/RunDrawer-DXqyxTsm.js +0 -4
  63. package/apps/web/dist/assets/SettingsPage-ChpDzJVn.js +0 -2
  64. package/apps/web/dist/assets/SetupPage-E5JoQMBM.js +0 -1
  65. package/apps/web/dist/assets/SharePage-DW1b2g9t.js +0 -1
  66. package/apps/web/dist/assets/changelog-DuSV2HiU.js +0 -1
  67. package/apps/web/dist/assets/esm-yMT-rSPa.js +0 -7
  68. package/apps/web/dist/assets/index-D9oqYYa8.css +0 -1
  69. package/apps/web/dist/assets/index-DfHH4icT.js +0 -14
  70. package/apps/web/dist/assets/oss-credits-6A3pxilr.js +0 -1
  71. package/apps/web/dist/assets/settings-menu-CVl54phq.js +0 -1
  72. package/apps/web/dist/assets/theme-DZZXa238.js +0 -11
  73. package/apps/web/dist/assets/ui-kIzOrA_W.js +0 -137
@@ -166,8 +166,10 @@ The component reads the theme once per wizard (`GET /api/public/wizards/:token?t
166
166
  | `data-headings` | `normal` or `uppercase` |
167
167
  | `data-effects` | The effects drawn: `glow`, `pattern-dots`, `pattern-grid` |
168
168
 
169
- - **Fonts.** A shipped font or the brand’s font comes as its family name only. Your page loads
170
- it, for example from its own `@font-face`. Until then the fallback shows.
169
+ - **Fonts.** The component loads the theme’s fonts, as the wizard’s own page does. A brand font
170
+ comes from where its space keeps it. A font the runner ships comes from the runtime
171
+ (`/api/public/fonts/shipped/<name>.css`). Where a brand font does not load, the shipped font of
172
+ its kind shows, and until a font has loaded, the fallback shows.
171
173
  - **Effects.** The card draws `glow` and `pattern` itself, inside its own box (`CARD_EFFECTS`).
172
174
  The others of the library (corners, particles, figures, fog) need the whole page and stay on
173
175
  the wizard’s own page and in a frame. The theme’s values carry them all, so your page can draw
@@ -180,6 +182,7 @@ The component reads the theme once per wizard (`GET /api/public/wizards/:token?t
180
182
 
181
183
  `wizardLook(look, { mode, effects })` is the same step on its own: it turns a theme’s values
182
184
  (`RunTheme`) into the props for the runner’s element, for a host that draws runs itself.
185
+ `loadLookFonts(look, runtime)` loads the theme’s fonts from the runtime at `runtime`.
183
186
 
184
187
  ### Who runs, who pays
185
188
 
@@ -219,6 +222,7 @@ things.
219
222
  | | `Wizard` | The drawing component |
220
223
  | | `useWizardRun(runId, prefill)` | One run, live, for a host that draws runs itself |
221
224
  | | `wizardLook(look, options)`, `CARD_EFFECTS` | A theme’s values as props for `.engenty-runner`, and the effects the card draws |
225
+ | | `loadLookFonts(look, runtime)` | Loads a theme’s fonts: the brand’s from their source, the shipped ones from the runtime |
222
226
  | `@engenty/wizards/openui/styles.css` | | The runner’s styles, scoped to the wizard |
223
227
 
224
228
  `@openuidev/react-lang`, `react`, `react-dom` and `zod` are peer dependencies: the chat brings
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: Build a wizard
3
3
  description: Describe what the wizard should do, or start from a template. Then change it in the chat or step by step.
4
- version: 0.9.0
4
+ version: 0.9.2
5
5
  ---
6
6
 
7
7
  ## Start one
@@ -26,8 +26,8 @@ You can change everything afterwards in the chat.
26
26
 
27
27
  - **How it runs.** “Runs as” above the text field says how people will reach the wizard: as a
28
28
  “Step-by-step wizard” unless you choose otherwise. The + beside it asks “How should it run?”
29
- and lists the other channels this studio offers, for example “Chat”, “Live voice” or “Video
30
- call”. One channel always stays on. The assistant builds the wizard for what you chose.
29
+ and lists the other channels this studio offers, for example “Chat”. One channel always stays
30
+ on. The assistant builds the wizard for what you chose.
31
31
  - **Files.** Attach examples, price lists or screenshots with the + in the text field, or paste
32
32
  or drop them there. They go into the wizard’s files, and the assistant looks at them.
33
33
  - **Dictation.** The microphone button lets you speak instead of type.
@@ -47,29 +47,36 @@ You can change everything afterwards in the chat.
47
47
 
48
48
  ## The editor
49
49
 
50
+ The chat stands on the left, the wizard as people see it in the middle, and on a wide window a
51
+ column on the right.
52
+
50
53
  | Part | What it is for |
51
54
  |---|---|
52
- | The diagram, left | The steps as a flow with their branches. Click a step to open it |
53
- | Chat | Say what should change. The assistant edits the flow and tells you what it did |
54
- | Steps | One step at a time: its texts, fields, tools and model class. Move it up or down, or delete it |
55
+ | Chat, left | Say what should change. The assistant edits the wizard and tells you what it did |
56
+ | Preview | The wizard as people see it: the step you chose, filled with the answers of the latest test run, or the test run itself. Its bar holds “Test”, the wizard’s themes, light or dark pages, its languages, and a desk or a phone |
57
+ | The row of steps | Under the preview’s bar: the settings (the gear) first, the steps in their order, the result (the flag) last. The arrows, or ← and → on the keyboard, move from one to the next |
58
+ | The column, right | “Settings”, “Flow” (the diagram with its branches), “Edit” (the step you chose) and “Result”. The button at the end of the preview’s bar shows or hides it |
55
59
  | Files | Files the wizard uses on every run, like widget code, libraries or price lists. Upload your own or let the assistant write them |
56
60
  | Memory | What the wizard knows across all its runs: the notes that AI steps with the “Pages” tool read and add to, and the tables of its shared lists |
57
61
  | Runs | The test runs and live runs of this wizard |
58
62
 
59
- On a phone or a narrow window the panels sit in a sheet over the bottom of the diagram. Drag its handle to make it taller, or tap
60
- it to fold it away.
63
+ On a smaller window “Flow” is a tab beside “Preview”, and “Preview” and “Edit” switch the main
64
+ area between showing the step and editing it. On a phone the chat sits in a sheet over the
65
+ bottom: folded it keeps the text field, drag its handle to open it.
61
66
 
62
- A click on the wizard’s name in the top bar opens its own settings: its title, description and
63
- greeting, its avatar, and the language it speaks to people in. With “Automatic, from its texts”
64
- the wizard speaks the language its texts are written in.
67
+ The gear in the row of steps, or a click on the wizard’s name in the top bar, opens its own
68
+ settings: its title, description and greeting, its avatar, and the language it speaks to people
69
+ in. With “Automatic, from its texts” the wizard speaks the language its texts are written in.
65
70
 
66
71
  Under “Look” the wizard wears a theme: a look kept in the space, which other wizards of the space
67
- can wear too. Folded, the section shows a small preview of the wizard’s page; a click on it opens
68
- the settings. The first change makes a theme named after the wizard.
72
+ can wear too. Folded, the section shows the theme, a small preview of the wizard’s page and a
73
+ line on what the look is; “Adjust” opens the settings. The first change makes a theme named after
74
+ the wizard.
69
75
 
70
76
  | Setting | What it does |
71
77
  |---|---|
72
- | Theme | Which theme the wizard wears: one of the space’s, the space’s brand, or a neutral look without a brand. It sits above the preview |
78
+ | Theme | Which theme the wizard wears: one of the space’s, the space’s brand, or a neutral look without a brand. It sits above the preview, folded or open |
79
+ | Costume | What the wizard’s engenty wears, on its pages and in the theme’s figures |
73
80
  | Pages | Dark first, light first, dark only or light only. With only one, everyone sees those pages and the theme switch is hidden |
74
81
  | Colours | Accent, ground and text for dark and for light pages, as small swatches. A dashed one takes the brand’s colour. A click opens the brand’s colours, a colour of your own, and “As in the brand” |
75
82
  | Font for headings, Font for text | The brand’s font, or one of the fonts engenty wizards ships, from Inter to the spooky Creepster |
@@ -79,8 +86,7 @@ the settings. The first change makes a theme named after the wizard.
79
86
  A theme two wizards wear changes for both. The section says which other wizards wear it and
80
87
  offers a copy for this wizard only. A wizard file carries the themes its wizard wears.
81
88
 
82
- The test run beside the diagram wears the wizard’s theme, with its effects. The studio around it
83
- keeps its own look.
89
+ The preview wears the wizard’s theme, with its effects. The studio around it keeps its own look.
84
90
 
85
91
  The assistant sets the look too. Ask it, for example: “Make it dark and spooky for Halloween.”
86
92
 
@@ -97,10 +103,10 @@ whoever manages the team can delete a wizard. The same menu is on the wizard’s
97
103
 
98
104
  ### Step by step
99
105
 
100
- Open a step from the diagram or under “Steps”. What you can set depends on its type: see
101
- [Steps](./steps.md).
106
+ Open a step from the row of steps or the diagram; a second click on a step in the diagram opens
107
+ its editor. What you can set depends on its type: see [Steps](./steps.md).
102
108
 
103
- “Add step” on a step in the diagram, or under “Steps”, puts a new step after it. Say what it
109
+ “Add step” on a step in the diagram, or in a step’s editor, puts a new step after it. Say what it
104
110
  should do and choose its kind, or leave it to “AI chooses”. Then say when it runs: “Always”,
105
111
  “Only if…” a condition holds, or when “AI decides…”. “Create” lets the assistant build the step
106
112
  in the chat. “Insert empty” adds a blank step of the kind you choose, for you to fill in.
@@ -1,13 +1,14 @@
1
1
  ---
2
2
  title: Test and share
3
3
  description: Try the wizard, publish it, and hand out its link or put it on a website.
4
- version: 0.9.0
4
+ version: 0.9.2
5
5
  ---
6
6
 
7
7
  ## Test
8
8
 
9
- “Test” in the editor starts a run of the draft, just as a person would see it. Test runs are
10
- listed under “Runs”. A test spends what a real run spends: your model’s usage, or credits. A test
9
+ “Test” in the preview’s bar starts a run of the draft, just as a person would see it, in the
10
+ preview. “Test run” at the start of the row of steps comes back to it after you looked at a step.
11
+ Test runs are listed under “Runs”. A test spends what a real run spends: your model’s usage, or credits. A test
11
12
  run reads the wizard’s memory, but it writes into a copy of its own, which goes with the run.
12
13
 
13
14
  Where runs spend credits, each AI step shows an estimate. At first it is a formula. After five
@@ -67,10 +68,11 @@ One visitor can start 6 runs an hour.
67
68
 
68
69
  ### Channels
69
70
 
70
- A wizard can run page by page, as a chat, as a live conversation on top of the chat, or as a
71
- video call on a stage with the chat beside it. In a conversation or a call, the person talks,
72
- and the wizard talks back and sees the camera. For now, both need an OpenAI API key under
73
- Models. A plugin can add further ways, such as a kiosk page or a messenger.
71
+ A wizard can run page by page or as a chat. Where this studio offers them, it can also run as a
72
+ live conversation on top of the chat, or as a video call on a stage with the chat beside it. In
73
+ a conversation or a call, the person talks, and the wizard talks back and sees the camera. For
74
+ now, both need an OpenAI API key under Models. A plugin can add further ways, such as a kiosk
75
+ page or a messenger.
74
76
 
75
77
  A wizard you start on the “New wizard” page runs step by step unless you choose more under “How
76
78
  should it run?”. A wizard without its own choice, such as one from a template or an import, has
@@ -19,6 +19,7 @@ import { conversationAvailable, freeTierRefusal, freeTierText, ModelUnavailableE
19
19
  import { runEnded } from "../plugins/events.js";
20
20
  import { projectFiles } from "../services/project-files.js";
21
21
  import { projectProfile } from "../services/projects.js";
22
+ import { switchedOffRunners } from "../services/runners.js";
22
23
  import { storedTranslation } from "../services/translations.js";
23
24
  import { latestShareJob } from "../sharing/state.js";
24
25
  import { listRows, listSecrets, scopeOf } from "../store/index.js";
@@ -864,11 +865,13 @@ function prefillOf(step, run, closed) {
864
865
  return out;
865
866
  }
866
867
  /**
867
- * Whether a run may hold a live conversation: a speech model is set up, and the wizard has live
868
- * voice or video switched on. Its owner's test run always may.
868
+ * Whether a run may hold a live conversation: live voice or video call is switched on for the
869
+ * tenant, a speech model is set up, and the wizard has one of them on. Its owner's test run
870
+ * always may, where one of them is switched on.
869
871
  */
870
872
  export async function talkAllowed(run) {
871
- if (!(await conversationAvailable())) {
873
+ const off = await switchedOffRunners();
874
+ if (CONVERSATION_RUNNERS.every((id) => off.has(id)) || !(await conversationAvailable())) {
872
875
  return false;
873
876
  }
874
877
  if (run.mode === "test") {
@@ -876,7 +879,7 @@ export async function talkAllowed(run) {
876
879
  }
877
880
  const w = await db.query.wizard.findFirst({ where: eq(schema.wizard.id, run.wizardId) });
878
881
  const { enabled } = w?.runners ?? DEFAULT_RUNNER_SETTINGS;
879
- return enabled.some((id) => CONVERSATION_RUNNERS.includes(id));
882
+ return enabled.some((id) => CONVERSATION_RUNNERS.includes(id) && !off.has(id));
880
883
  }
881
884
  export async function runView(run, brand) {
882
885
  // In the viewer's language every text of the view is the translation; ids and values stay.
@@ -38,6 +38,7 @@ import { brandView } from "../services/brand.js";
38
38
  import { ServiceError } from "../services/errors.js";
39
39
  import { publicRunners, servePageRunner } from "../services/runners.js";
40
40
  import { sharedRun, shareImage, shareRun, shareView, unshareRun } from "../services/shares.js";
41
+ import { shippedFontCss, shippedFontFile } from "../services/shipped-fonts.js";
41
42
  import { isLangCode, storedTranslation, translateResult, translationFor, uiTexts, } from "../services/translations.js";
42
43
  import { isIconFile, wizardAvatarSvg, wizardIcon } from "../services/wizard-icon.js";
43
44
  import { shareOverview } from "../sharing/index.js";
@@ -489,6 +490,31 @@ export const publicRoutes = new Hono()
489
490
  // An SVG logo is shown, never run.
490
491
  "content-security-policy": "sandbox",
491
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
+ });
492
518
  })
493
519
  // A brand font's own file, while its space's brand names it: run pages, embeds and hosts'
494
520
  // frames load it from here, so any origin may.
@@ -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";
@@ -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({
@@ -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-kIzOrA_W.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-DuSV2HiU.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};