wizards 0.2.60 → 0.3.0

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 (56) hide show
  1. package/apps/runtime/dist/app.js +130 -86
  2. package/apps/runtime/dist/cli/home.js +14 -5
  3. package/apps/runtime/dist/engine/runner.js +1 -1
  4. package/apps/runtime/dist/env.js +23 -6
  5. package/apps/runtime/dist/index.js +3 -3
  6. package/apps/runtime/dist/link-preview.js +3 -3
  7. package/apps/runtime/dist/mcp/flow-app.js +5 -2
  8. package/apps/runtime/dist/plugins/public.js +1 -1
  9. package/apps/runtime/dist/routes/api.js +1 -1
  10. package/apps/runtime/dist/routes/runs.js +5 -2
  11. package/apps/runtime/dist/services/api.js +2 -2
  12. package/apps/runtime/dist/services/runners.js +1 -1
  13. package/apps/runtime/dist/services/shares.js +2 -2
  14. package/apps/runtime/dist/services/wizards.js +1 -1
  15. package/apps/web/dist/assets/AboutDialog-BFiGdmjy.js +1 -0
  16. package/apps/web/dist/assets/{ChangelogDialog-D8BjIzmG.js → ChangelogDialog-mO9JA9bB.js} +1 -1
  17. package/apps/web/dist/assets/ChatView-CFVUdqM_.js +10 -0
  18. package/apps/web/dist/assets/EditorPage-B4aUQtEc.js +3 -0
  19. package/apps/web/dist/assets/{FlowPreview-DbwvacRX.js → FlowPreview-DiMUQ8D_.js} +1 -1
  20. package/apps/web/dist/assets/{Harness-B-6EbJ89.js → Harness-BlDLA9yJ.js} +2 -2
  21. package/apps/web/dist/assets/{Marketplace-C3xWcJYM.js → Marketplace-B106ajue.js} +2 -2
  22. package/apps/web/dist/assets/{NewWizardPage-wt1p9J46.js → NewWizardPage-C-SNK8E7.js} +1 -1
  23. package/apps/web/dist/assets/ProjectPage-boHstEXl.js +2 -0
  24. package/apps/web/dist/assets/PublicRunner--bNcMLvU.js +1 -0
  25. package/apps/web/dist/assets/{ReadOnly-zQecD9OB.js → ReadOnly-Bxbgr2n2.js} +1 -1
  26. package/apps/web/dist/assets/RunDrawer-CPmVJVIw.js +4 -0
  27. package/apps/web/dist/assets/{RunnerView-B1GivAFs.js → RunnerView-Bx9Oiap4.js} +1 -1
  28. package/apps/web/dist/assets/SettingsPage-Cz1ajdv7.js +1 -0
  29. package/apps/web/dist/assets/SetupPage-BURAiwgJ.js +1 -0
  30. package/apps/web/dist/assets/SharePage-WxVGWQGH.js +1 -0
  31. package/apps/web/dist/assets/{brand-DIKyySmf.js → brand-cgisQRwA.js} +1 -1
  32. package/apps/web/dist/assets/changelog-CJ5JQKkS.js +1 -0
  33. package/apps/web/dist/assets/{circle-alert-B9b9Vb9k.js → circle-alert-R2GwpaDI.js} +1 -1
  34. package/apps/web/dist/assets/{esm-BW4CnGD3.js → esm-CCAlUl7O.js} +1 -1
  35. package/apps/web/dist/assets/{index-DVnigS8k.css → index-BBpolc_L.css} +1 -1
  36. package/apps/web/dist/assets/index-rU86dlvl.js +11 -0
  37. package/apps/web/dist/assets/{lock-BNvsUKTg.js → lock-BqMtfg3I.js} +1 -1
  38. package/apps/web/dist/assets/{session-CSbo-pmx.js → session-Dej-L4l9.js} +1 -1
  39. package/apps/web/dist/assets/{settings-menu-CFwH7wPe.js → settings-menu-CxLCpfSv.js} +1 -1
  40. package/apps/web/dist/assets/{ui-FW7ypPI6.js → ui-aWLrX8hF.js} +3 -3
  41. package/apps/web/dist/assets/{upload-MQ_24gSb.js → upload-CNYeHI5s.js} +1 -1
  42. package/apps/web/dist/assets/{volume-2-B1mj20eS.js → volume-2-B7cfghgd.js} +1 -1
  43. package/apps/web/dist/index.html +7 -7
  44. package/apps/web/dist/mcp/flow.html +2 -2
  45. package/package.json +1 -1
  46. package/apps/web/dist/assets/AboutDialog-DovVDLnd.js +0 -1
  47. package/apps/web/dist/assets/ChatView-NuMTv2_v.js +0 -10
  48. package/apps/web/dist/assets/EditorPage-BLFioERj.js +0 -3
  49. package/apps/web/dist/assets/ProjectPage-CYFOoHOp.js +0 -2
  50. package/apps/web/dist/assets/PublicRunner-CkoPSvsY.js +0 -1
  51. package/apps/web/dist/assets/RunDrawer-Bx27qRq3.js +0 -4
  52. package/apps/web/dist/assets/SettingsPage-Bo0liCas.js +0 -1
  53. package/apps/web/dist/assets/SetupPage-DyoGmTbA.js +0 -1
  54. package/apps/web/dist/assets/SharePage-CtXGMzrQ.js +0 -1
  55. package/apps/web/dist/assets/changelog-sHZ4ve7D.js +0 -1
  56. package/apps/web/dist/assets/index-cEhTXa2U.js +0 -11
@@ -35,6 +35,9 @@ import { ServiceError } from "./services/errors.js";
35
35
  import { servePageRunner } from "./services/runners.js";
36
36
  import { tenantOfLink, tenantStatus } from "./tenants/control.js";
37
37
  const app = new Hono();
38
+ // Which halves this process serves (RUNTIME_ROLE): the studio's routes, the doors' routes, or
39
+ // both. What both need — health, config, the runs' API, the connect callback — is always there.
40
+ const { serves } = env;
38
41
  app.onError((err, c) => {
39
42
  if (err instanceof ServiceError) {
40
43
  return c.json(err.toJSON(), err.status);
@@ -130,76 +133,89 @@ app.post("/api/log", bodyLimit({ maxSize: 8 * 1024 }), async (c) => {
130
133
  }
131
134
  return c.json({ ok: true });
132
135
  });
133
- app.route("/api", authRoutes);
136
+ if (serves.studio) {
137
+ app.route("/api", authRoutes);
138
+ }
134
139
  app.get("/api/config", (c) => c.json({
135
140
  mode: managed ? "managed" : "local",
136
141
  devLogin: !managed && env.devLogin,
137
142
  /** The product's own site, for a runtime that runs alone. */
138
143
  site: managed ? null : env.local.cloudUrl,
144
+ /** Where the wizards' pages are: the studio makes their links with it. */
145
+ publicUrl: env.publicUrl,
139
146
  /** The feature switches before anyone is signed in: the code's, the environment's, the file's. */
140
147
  features: features(),
141
148
  }));
142
- // OAuth discovery for MCP clients (RFC 9728): the Manage-App is the authorization server.
143
- app.get("/.well-known/oauth-protected-resource/*", async (c) => {
144
- if (!managed) {
145
- return c.notFound();
146
- }
147
- const d = await discovery();
148
- return c.json({
149
- resource: MCP_RESOURCE,
150
- authorization_servers: [d.issuer],
151
- scopes_supported: SCOPES,
152
- bearer_methods_supported: ["header"],
149
+ if (serves.studio) {
150
+ // OAuth discovery for MCP clients (RFC 9728): the Manage-App is the authorization server.
151
+ app.get("/.well-known/oauth-protected-resource/*", async (c) => {
152
+ if (!managed) {
153
+ return c.notFound();
154
+ }
155
+ const d = await discovery();
156
+ return c.json({
157
+ resource: MCP_RESOURCE,
158
+ authorization_servers: [d.issuer],
159
+ scopes_supported: SCOPES,
160
+ bearer_methods_supported: ["header"],
161
+ });
153
162
  });
154
- });
155
- // The mobile app opens this runtime's wizard and result links (Universal Links, App Links).
156
- app.get("/.well-known/apple-app-site-association", (c) => {
157
- if (!env.mobile.iosAppIds.length) {
158
- return c.notFound();
159
- }
160
- const paths = [`${basePath}/w/*`, `${basePath}/s/*`];
161
- return c.json({
162
- applinks: {
163
- details: [
164
- {
165
- appIDs: env.mobile.iosAppIds,
166
- components: paths.map((path) => ({ "/": path })),
167
- },
168
- ],
169
- },
163
+ }
164
+ if (serves.doors) {
165
+ // The mobile app opens this runtime's wizard and result links (Universal Links, App Links).
166
+ app.get("/.well-known/apple-app-site-association", (c) => {
167
+ if (!env.mobile.iosAppIds.length) {
168
+ return c.notFound();
169
+ }
170
+ const paths = [`${basePath}/w/*`, `${basePath}/s/*`];
171
+ return c.json({
172
+ applinks: {
173
+ details: [
174
+ {
175
+ appIDs: env.mobile.iosAppIds,
176
+ components: paths.map((path) => ({ "/": path })),
177
+ },
178
+ ],
179
+ },
180
+ });
170
181
  });
171
- });
172
- app.get("/.well-known/assetlinks.json", (c) => {
173
- if (!env.mobile.androidCertSha256.length) {
174
- return c.notFound();
175
- }
176
- return c.json([
177
- {
178
- relation: ["delegate_permission/common.handle_all_urls"],
179
- target: {
180
- namespace: "android_app",
181
- package_name: env.mobile.androidPackage,
182
- sha256_cert_fingerprints: env.mobile.androidCertSha256,
182
+ app.get("/.well-known/assetlinks.json", (c) => {
183
+ if (!env.mobile.androidCertSha256.length) {
184
+ return c.notFound();
185
+ }
186
+ return c.json([
187
+ {
188
+ relation: ["delegate_permission/common.handle_all_urls"],
189
+ target: {
190
+ namespace: "android_app",
191
+ package_name: env.mobile.androidPackage,
192
+ sha256_cert_fingerprints: env.mobile.androidCertSha256,
193
+ },
183
194
  },
184
- },
185
- ]);
186
- });
187
- /** Studio requests act as the signed-in person, inside that person's tenant. */
188
- app.use("/api/studio/*", async (c, next) => {
189
- const user = await principalOf(c);
190
- if (!user) {
191
- return c.json({ error: "unauthorized" }, 401);
192
- }
193
- if ((await tenantStatus(user.tenantId)) === "suspended") {
194
- return c.json({ error: "Dieses Konto ist gesperrt.", code: "suspended" }, 403);
195
- }
196
- c.set("user", user);
197
- return withTenant(user.tenantId, () => asRole(user.role, next));
198
- });
199
- const mcp = mcpHandler();
200
- app.on(["GET", "POST", "DELETE"], "/api/mcp", (c) => mcp(c.req.raw));
201
- // The tools of one model call, for the installed Claude Code while it answers that call.
202
- app.on(["GET", "POST", "DELETE"], "/api/mcp/bridge/:token", (c) => bridgeRequest(c.req.param("token"), c.req.raw));
195
+ ]);
196
+ });
197
+ }
198
+ if (serves.studio) {
199
+ /** Studio requests act as the signed-in person, inside that person's tenant. */
200
+ app.use("/api/studio/*", async (c, next) => {
201
+ const user = await principalOf(c);
202
+ if (!user) {
203
+ return c.json({ error: "unauthorized" }, 401);
204
+ }
205
+ if ((await tenantStatus(user.tenantId)) === "suspended") {
206
+ return c.json({ error: "Dieses Konto ist gesperrt.", code: "suspended" }, 403);
207
+ }
208
+ c.set("user", user);
209
+ return withTenant(user.tenantId, () => asRole(user.role, next));
210
+ });
211
+ const mcp = mcpHandler();
212
+ app.on(["GET", "POST", "DELETE"], "/api/mcp", (c) => mcp(c.req.raw));
213
+ }
214
+ if (serves.runner) {
215
+ // The tools of one model call, for the installed Claude Code while it answers that call: the
216
+ // call runs in this process, so its bridge is here.
217
+ app.on(["GET", "POST", "DELETE"], "/api/mcp/bridge/:token", (c) => bridgeRequest(c.req.param("token"), c.req.raw));
218
+ }
203
219
  // What visitors send is read before anyone is known: a body is taken only up to a size. A page's
204
220
  // answers are text; an upload is a photo, a recording or a clip from a phone (routes/delivery.ts).
205
221
  const tooLarge = (max) => bodyLimit({
@@ -208,27 +224,35 @@ const tooLarge = (max) => bodyLimit({
208
224
  });
209
225
  const answers = tooLarge(4 * 1024 * 1024);
210
226
  const upload = tooLarge(48 * 1024 * 1024);
211
- app.use("/api/public/*", answers);
212
- app.use("/api/shares/*", answers);
227
+ // The runs' API serves both halves: a maker's test run in the studio, a visitor's run on a
228
+ // wizard's page, the widget an AI app shows. Who may see a run is decided per request.
213
229
  app.use("/api/runs/*", (c, next) => /\/uploads$/.test(c.req.path) ? upload(c, next) : answers(c, next));
214
- app.route("/api/studio/wizards", wizardStream);
215
- app.route("/api/studio/marketplace", marketplaceStudio);
216
- app.route("/api/studio/plugins", pluginRoutes);
217
- app.route("/api/studio", studio);
218
- app.route("/api/v1", apiRoutes);
230
+ if (serves.studio) {
231
+ app.route("/api/studio/wizards", wizardStream);
232
+ app.route("/api/studio/marketplace", marketplaceStudio);
233
+ app.route("/api/studio/plugins", pluginRoutes);
234
+ app.route("/api/studio", studio);
235
+ app.route("/api/v1", apiRoutes);
236
+ app.route("/api/local/debug", localDebugRoutes);
237
+ }
219
238
  app.route("/api/internal", internalRoutes);
220
- app.route("/api/local/debug", localDebugRoutes);
221
- app.route("/api/public/plugins", publicPluginRoutes);
222
- app.route("/api/public", publicRoutes);
239
+ if (serves.doors) {
240
+ app.use("/api/public/*", answers);
241
+ app.use("/api/shares/*", answers);
242
+ app.route("/api/public/plugins", publicPluginRoutes);
243
+ app.route("/api/public", publicRoutes);
244
+ app.route("/api/shares", shareRoutes);
245
+ }
223
246
  app.route("/api/runs", runRoutes);
224
- app.route("/api/shares", shareRoutes);
225
247
  app.route("/api/connect", connectCallback);
226
- // The Claude Code plugin of this deployment: `claude plugin marketplace add <APP_URL>/api/claude-plugin/marketplace.json`.
227
- app.get("/api/claude-plugin/marketplace.json", async (c) => c.json(await pluginMarketplace()));
228
- app.get(`/api/claude-plugin/${PLUGIN_NAME}.zip`, async (c) => {
229
- const { zip } = await pluginArchive();
230
- return c.body(new Uint8Array(zip), 200, { "content-type": "application/zip" });
231
- });
248
+ if (serves.studio) {
249
+ // The Claude Code plugin of this deployment: `claude plugin marketplace add <APP_URL>/api/claude-plugin/marketplace.json`.
250
+ app.get("/api/claude-plugin/marketplace.json", async (c) => c.json(await pluginMarketplace()));
251
+ app.get(`/api/claude-plugin/${PLUGIN_NAME}.zip`, async (c) => {
252
+ const { zip } = await pluginArchive();
253
+ return c.body(new Uint8Array(zip), 200, { "content-type": "application/zip" });
254
+ });
255
+ }
232
256
  app.all("/api/*", (c) => c.json({ error: "not found" }, 404));
233
257
  /**
234
258
  * `/w/<token>/<runner>`: a plugin's page runner, where the tenant has it and the wizard offers
@@ -238,11 +262,13 @@ async function pluginRunnerPage(c, next) {
238
262
  const token = c.req.param("token") ?? "";
239
263
  const runnerId = c.req.param("runner") ?? "";
240
264
  if (!RUNNER_ID.test(runnerId) || BUILT_IN_RUNNERS.some((r) => r.id === runnerId)) {
241
- return next();
265
+ await next();
266
+ return;
242
267
  }
243
268
  const tenant = await tenantOfLink(token, "wizard").catch(() => null);
244
269
  if (!tenant) {
245
- return next();
270
+ await next();
271
+ return;
246
272
  }
247
273
  const served = await withTenant(tenant, async () => {
248
274
  const w = await db.query.wizard.findFirst({ where: eq(schema.wizard.shareToken, token) });
@@ -256,7 +282,10 @@ async function pluginRunnerPage(c, next) {
256
282
  const rest = c.req.path.slice(c.req.path.indexOf(head) + head.length);
257
283
  return version ? servePageRunner(w, version.definition, runnerId, rest, c.req.raw) : null;
258
284
  });
259
- return served ?? next();
285
+ if (served) {
286
+ return served;
287
+ }
288
+ await next();
260
289
  }
261
290
  /** Link cards for `/w/<token>`, `/w/<token>/chat` and `/s/<token>`; the token names the tenant. */
262
291
  async function previewFor(path) {
@@ -269,19 +298,34 @@ async function previewFor(path) {
269
298
  * pages are `/w/<token>` and `/s/<token>`. Of the root only what others fetch there is served:
270
299
  * the installer, the embed script for websites, and the service worker of public wizards. The
271
300
  * rest of the root belongs to others (the landing page); a runtime alone sends `/` to the studio.
301
+ * The app's files are served by both halves: a wizard's page loads its scripts from `/studio`
302
+ * too. Which pages a half answers follows its role.
272
303
  */
273
304
  const webDir = resolve(dirname(fileURLToPath(import.meta.url)), "../../web/dist");
274
- const ROOT_FILES = ["/install.sh", "/embed.js", "/sw.js"];
275
- const PAGES = /^\/(studio(\/|$)|w\/|s\/)/;
305
+ const STUDIO_FILES = ["/install.sh"];
306
+ const DOORS_FILES = ["/embed.js", "/sw.js"];
307
+ const PAGES = new RegExp(`^/(${[...(serves.studio ? ["studio(/|$)"] : []), ...(serves.doors ? ["w/", "s/"] : [])].join("|")})`);
276
308
  if (existsSync(webDir)) {
277
- for (const file of ROOT_FILES) {
309
+ for (const file of serves.studio ? STUDIO_FILES : []) {
278
310
  app.get(file, serveStatic({ root: webDir }));
279
311
  }
312
+ for (const file of serves.doors ? DOORS_FILES : []) {
313
+ app.get(file, serveStatic({ root: webDir }));
314
+ }
315
+ if (!serves.studio) {
316
+ // The doors serve the app's files below `/studio`, not its start page.
317
+ app.get("/studio", (c) => c.text("Not found", 404));
318
+ app.get("/studio/", (c) => c.text("Not found", 404));
319
+ }
280
320
  app.use("/studio/*", serveStatic({ root: webDir, rewriteRequestPath: (path) => path.slice("/studio".length) }));
281
- app.get("/", (c) => c.redirect(`${basePath}/studio/`));
282
- // A plugin's page runner lives at the wizard's address: `/w/<token>/<runner>`, before the app's page.
283
- app.all("/w/:token/:runner/*", (c, next) => pluginRunnerPage(c, next));
284
- app.all("/w/:token/:runner", (c, next) => pluginRunnerPage(c, next));
321
+ if (serves.studio) {
322
+ app.get("/", (c) => c.redirect(`${basePath}/studio/`));
323
+ }
324
+ if (serves.doors) {
325
+ // A plugin's page runner lives at the wizard's address: `/w/<token>/<runner>`, before the app's page.
326
+ app.all("/w/:token/:runner/*", (c, next) => pluginRunnerPage(c, next));
327
+ app.all("/w/:token/:runner", (c, next) => pluginRunnerPage(c, next));
328
+ }
285
329
  app.get("*", async (c) => {
286
330
  if (!PAGES.test(c.req.path)) {
287
331
  return c.text("Not found", 404);
@@ -26,13 +26,22 @@ export function layout(home = wizardsHome()) {
26
26
  }
27
27
  /** The folder this code was installed to: it holds `apps/`, `plugin/` and package.json. */
28
28
  export const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../../../..");
29
+ let running;
30
+ /**
31
+ * The version this process runs, read once: an update replaces package.json under a runtime that
32
+ * still runs the old code, and the studio reloads only when another version answers.
33
+ */
29
34
  export function packageVersion() {
30
- try {
31
- return JSON.parse(readFileSync(join(packageRoot, "package.json"), "utf8")).version ?? "0.0.0";
32
- }
33
- catch {
34
- return "0.0.0";
35
+ if (running === undefined) {
36
+ try {
37
+ running =
38
+ JSON.parse(readFileSync(join(packageRoot, "package.json"), "utf8")).version ?? "0.0.0";
39
+ }
40
+ catch {
41
+ running = "0.0.0";
42
+ }
35
43
  }
44
+ return running ?? "0.0.0";
36
45
  }
37
46
  /** How this copy got here: by install.sh into the home folder, or by npm/npx or a checkout. */
38
47
  export function installedByScript(paths = layout()) {
@@ -887,7 +887,7 @@ export async function runView(run, brand) {
887
887
  ? await connectionViews(def.connections ?? [], scopeOf(run), await projectIdOf(run))
888
888
  : [],
889
889
  keeps: Boolean(def.lists?.length || def.connections?.length),
890
- shareUrl: run.shareToken ? `${env.appUrl}/s/${run.shareToken}` : null,
890
+ shareUrl: run.shareToken ? `${env.publicUrl}/s/${run.shareToken}` : null,
891
891
  expiresAt: run.expiresAt?.toISOString() ?? null,
892
892
  };
893
893
  }
@@ -93,13 +93,16 @@ const port = num("API_PORT", 24368);
93
93
  /** From source the Vite dev server on :5181 serves the pages; built, this server does. */
94
94
  const fromSource = import.meta.url.endsWith(".ts");
95
95
  const sandboxImage = str("SANDBOX_IMAGE", "engenty-sandbox:latest");
96
+ const ROLES = ["studio", "doors", "web", "runner", "all"];
96
97
  function role() {
97
98
  const given = str("RUNTIME_ROLE", "all");
98
- if (given !== "web" && given !== "runner" && given !== "all") {
99
- throw new Error(`RUNTIME_ROLE must be web, runner or all, not "${given}"`);
99
+ if (!ROLES.includes(given)) {
100
+ throw new Error(`RUNTIME_ROLE must be one of ${ROLES.join(", ")}, not "${given}"`);
100
101
  }
101
102
  return given;
102
103
  }
104
+ /** The origin people open, e.g. https://wizards.localhost — auth callbacks and links use it. */
105
+ const appUrl = str("APP_URL", fromSource ? "http://localhost:5181" : `http://localhost:${port}`).replace(/\/$/, "");
103
106
  export const env = {
104
107
  production: process.env.NODE_ENV === "production",
105
108
  /** Running from source: Vite serves the pages, this server only `/api`. */
@@ -108,18 +111,32 @@ export const env = {
108
111
  /** Listen address; a runtime that runs alone stays on the loopback interface. */
109
112
  host: str("API_HOST", manageUrl ? "0.0.0.0" : "127.0.0.1"),
110
113
  /**
111
- * What this process does: `web` serves the studio and the API and wakes runs, `runner` takes
112
- * the runs that wait and drives them, `all` does both (a runtime that runs alone).
114
+ * What this process does. `studio`: the makers' half (authoring, publishing, sign-in, MCP, the
115
+ * studio's pages). `doors`: the customers' half (wizard pages, their API, shared results, the
116
+ * plugins' public routes). `web`: both halves. `runner`: takes the runs that wait and drives
117
+ * them (it serves the routes too, for what the web hands it). `all`: everything in one process
118
+ * (a runtime that runs alone). docs/plans/runner-process.md.
113
119
  */
114
120
  role: role(),
121
+ /** Which parts this process serves, from its role. */
122
+ serves: {
123
+ studio: ["studio", "web", "runner", "all"].includes(role()),
124
+ doors: ["doors", "web", "runner", "all"].includes(role()),
125
+ runner: ["runner", "all"].includes(role()),
126
+ },
115
127
  runner: {
116
128
  /** This runner's name in the control database; a new one each start. */
117
129
  id: `${hostname()}-${randomBytes(3).toString("hex")}`,
118
130
  /** Where the web reaches this runner (the browser's screen of a run it holds). */
119
131
  url: str("RUNNER_URL").replace(/\/$/, ""),
120
132
  },
121
- /** The origin people open, e.g. https://wizards.localhost — auth callbacks and links use it. */
122
- appUrl: str("APP_URL", fromSource ? "http://localhost:5181" : `http://localhost:${port}`).replace(/\/$/, ""),
133
+ appUrl,
134
+ /**
135
+ * Where the wizards' pages live (`/w/<token>`, `/s/<token>`, the embed script): the doors'
136
+ * origin, when they are served apart from the studio. Links to a wizard, a result or a public
137
+ * file carry it. Default: APP_URL, the same origin.
138
+ */
139
+ publicUrl: str("PUBLIC_URL", appUrl).replace(/\/$/, ""),
123
140
  /** More host names this server answers under, besides APP_URL's and the loopback names. */
124
141
  allowedHosts: list("ALLOWED_HOSTS"),
125
142
  dataDir,
@@ -56,7 +56,7 @@ function withoutBasePath(request) {
56
56
  const server = serve({ fetch: withoutBasePath, port: env.port, hostname: env.host }, (info) => {
57
57
  console.log(`engenty wizards on :${info.port} — ${env.appUrl}`);
58
58
  const entry = localEntryUrl();
59
- if (entry && !env.local.accessKey) {
59
+ if (entry && !env.local.accessKey && env.serves.studio) {
60
60
  console.log(`Open the studio: ${entry}`);
61
61
  }
62
62
  if (!managed) {
@@ -70,7 +70,7 @@ const server = serve({ fetch: withoutBasePath, port: env.port, hostname: env.hos
70
70
  }
71
71
  });
72
72
  // A runner takes the runs in line, those a stopped process left behind first (RUNTIME_ROLE).
73
- if (env.role !== "web") {
73
+ if (env.serves.runner) {
74
74
  await registerRunner();
75
75
  setInterval(() => void registerRunner().catch(() => undefined), 10_000).unref();
76
76
  startRunner();
@@ -94,7 +94,7 @@ if (!managed) {
94
94
  async function shutdown(code = 0) {
95
95
  clearRunning(env.dataDir);
96
96
  server.close();
97
- if (env.role !== "web") {
97
+ if (env.serves.runner) {
98
98
  // The runs go back in line for another runner; their steps start afresh there.
99
99
  await stopRunner();
100
100
  await forgetRunner().catch(() => undefined);
@@ -35,8 +35,8 @@ export async function linkPreview(path) {
35
35
  return tags({
36
36
  title: view.title === view.wizard.title ? view.title : `${view.title} · ${view.wizard.title}`,
37
37
  description: view.message ?? view.wizard.description,
38
- url: `${env.appUrl}/s/${share[1]}`,
39
- image: `${env.appUrl}/api/shares/${share[1]}/image`,
38
+ url: `${env.publicUrl}/s/${share[1]}`,
39
+ image: `${env.publicUrl}/api/shares/${share[1]}/image`,
40
40
  });
41
41
  }
42
42
  const wizard = path.match(/^\/w\/([A-Za-z0-9_-]+)(\/chat)?\/?$/);
@@ -52,7 +52,7 @@ export async function linkPreview(path) {
52
52
  ? tags({
53
53
  title: v.definition.title,
54
54
  description: v.definition.description,
55
- url: `${env.appUrl}/w/${wizard[1]}${wizard[2] ?? ""}`,
55
+ url: `${env.publicUrl}/w/${wizard[1]}${wizard[2] ?? ""}`,
56
56
  })
57
57
  : null;
58
58
  }
@@ -30,7 +30,8 @@ const FLOW_APP_HTML = readWidget();
30
30
  */
31
31
  export const FLOW_APP_URI = `ui://engenty-wizards/flow-${createHash("sha256").update(FLOW_APP_HTML).digest("hex").slice(0, 10)}.html`;
32
32
  export function registerFlowApp(server) {
33
- const origin = new URL(env.appUrl).origin;
33
+ // The widget reaches the run on the doors: their origin.
34
+ const origin = new URL(env.publicUrl).origin;
34
35
  registerAppResource(server, "Wizard flow", FLOW_APP_URI, {
35
36
  description: "A wizard as a diagram, and a run on it.",
36
37
  mimeType: RESOURCE_MIME_TYPE,
@@ -79,7 +80,9 @@ export async function flowView(userId, wizardId, options = {}) {
79
80
  },
80
81
  definition,
81
82
  run: options.run,
82
- runtime: options.run ? { base: env.appUrl, ticket: runTicket(options.run.runId) } : undefined,
83
+ runtime: options.run
84
+ ? { base: env.publicUrl, ticket: runTicket(options.run.runId) }
85
+ : undefined,
83
86
  };
84
87
  }
85
88
  /** A tool's `_meta` that opens the widget with the tool's result. */
@@ -20,7 +20,7 @@ export async function publicUrlOf(plugin, path) {
20
20
  row = (await controlDb.query.pluginAddress.findFirst({ where }));
21
21
  }
22
22
  const rest = path.startsWith("/") ? path : `/${path}`;
23
- return `${env.appUrl}/api/public/plugins/${plugin}/${row.ref}${rest === "/" ? "" : rest}`;
23
+ return `${env.publicUrl}/api/public/plugins/${plugin}/${row.ref}${rest === "/" ? "" : rest}`;
24
24
  }
25
25
  /** The tenant a plugin's public address belongs to. */
26
26
  export async function tenantOfAddress(plugin, ref) {
@@ -139,7 +139,7 @@ export const apiRoutes = new Hono()
139
139
  client: who.client,
140
140
  urls: {
141
141
  app: env.appUrl,
142
- embed: `${env.appUrl}/embed.js`,
142
+ embed: `${env.publicUrl}/embed.js`,
143
143
  studio: `${env.appUrl}/studio`,
144
144
  newWizard: `${env.appUrl}/studio/new`,
145
145
  space: `${env.appUrl}/studio/space`,
@@ -216,7 +216,7 @@ export const publicRoutes = new Hono()
216
216
  codeMissed(ip);
217
217
  return c.json({ error: "not found" }, 404);
218
218
  }
219
- return c.json({ token: found.token, url: `${env.appUrl}/w/${found.token}` });
219
+ return c.json({ token: found.token, url: `${env.publicUrl}/w/${found.token}` });
220
220
  })
221
221
  .use("/wizards/:token", wizardLink)
222
222
  .use("/wizards/:token/*", wizardLink)
@@ -1103,7 +1103,10 @@ export const connectCallback = new Hono().get("/callback", async (c) => {
1103
1103
  <body style="font:16px system-ui;display:grid;place-items:center;height:100vh;margin:0;color:#333">
1104
1104
  <p>${message}</p>
1105
1105
  <script>
1106
- try { window.opener && window.opener.postMessage({ type: "wizards:connected", ok: ${ok} }, ${JSON.stringify(env.appUrl)}); } catch (e) {}
1106
+ // The opener is the studio or a wizard's page: each origin gets the word, the wrong one drops it.
1107
+ for (const origin of ${JSON.stringify([...new Set([env.appUrl, env.publicUrl])])}) {
1108
+ try { window.opener && window.opener.postMessage({ type: "wizards:connected", ok: ${ok} }, origin); } catch (e) {}
1109
+ }
1107
1110
  setTimeout(function () { window.close(); }, ${ok ? 300 : 4000});
1108
1111
  </script>`);
1109
1112
  });
@@ -54,7 +54,7 @@ export async function apiSpaceDetails(userId, spaceId) {
54
54
  about: p.brand.about ?? "",
55
55
  colors: p.brand.colors ?? [],
56
56
  facts: p.facts.map(({ label, value }) => ({ label, value })),
57
- logoUrl: logo ? `${env.appUrl}/api/public/logos/${logo}` : null,
57
+ logoUrl: logo ? `${env.publicUrl}/api/public/logos/${logo}` : null,
58
58
  knowledge: await knowledgeCounts(p.id),
59
59
  writable: await projectWritable(p),
60
60
  studioUrl: `${env.appUrl}/studio/space`,
@@ -97,7 +97,7 @@ export async function apiWizards(userId, spaceId) {
97
97
  shareUrl: live ? shareUrl(w.shareToken) : null,
98
98
  shareEnabled: w.shareEnabled,
99
99
  iconUrl: live
100
- ? `${env.appUrl}/api/public/wizards/${w.shareToken}/icons/icon-192.png`
100
+ ? `${env.publicUrl}/api/public/wizards/${w.shareToken}/icons/icon-192.png`
101
101
  : null,
102
102
  available: Boolean(live) && !reason,
103
103
  unavailableReason: reason && noteText(reason, wizardLang(def)),
@@ -82,7 +82,7 @@ export function runnerUrl(w, runner, settings) {
82
82
  }
83
83
  if (runner.plugin && env.fromSource) {
84
84
  // From source Vite serves /w/*: a plugin's page is reached on this server's own address.
85
- return `${env.appUrl}/api/public/wizards/${w.shareToken}/runners/${runner.id}`;
85
+ return `${env.publicUrl}/api/public/wizards/${w.shareToken}/runners/${runner.id}`;
86
86
  }
87
87
  return runner.id === settings.default
88
88
  ? shareUrl(w.shareToken)
@@ -8,7 +8,7 @@ import { htmlToPng } from "../render/convert.js";
8
8
  import { dropLinks, dropRuns, putLink } from "../tenants/control.js";
9
9
  import { brandView } from "./brand.js";
10
10
  import { ServiceError } from "./errors.js";
11
- export const shareUrlFor = (token) => `${env.appUrl}/s/${token}`;
11
+ export const shareUrlFor = (token) => `${env.publicUrl}/s/${token}`;
12
12
  /** Shares a finished run. Idempotent: the same run keeps the same link. */
13
13
  export async function shareRun(run) {
14
14
  if (run.status !== "done") {
@@ -71,7 +71,7 @@ export async function shareView(run) {
71
71
  shown,
72
72
  createdAt: run.createdAt.toISOString(),
73
73
  expiresAt: run.expiresAt?.toISOString() ?? null,
74
- wizardUrl: w?.shareEnabled && w.publishedVersion !== null ? `${env.appUrl}/w/${w.shareToken}` : null,
74
+ wizardUrl: w?.shareEnabled && w.publishedVersion !== null ? `${env.publicUrl}/w/${w.shareToken}` : null,
75
75
  };
76
76
  }
77
77
  /**
@@ -32,7 +32,7 @@ const BLANK = {
32
32
  ],
33
33
  };
34
34
  export const studioUrl = (wizardId) => `${env.appUrl}/studio/edit/${wizardId}`;
35
- export const shareUrl = (token) => `${env.appUrl}/w/${token}`;
35
+ export const shareUrl = (token) => `${env.publicUrl}/w/${token}`;
36
36
  const newShareToken = () => nanoid(14);
37
37
  export async function ownedWizard(_userId, wizardId) {
38
38
  const w = await db.query.wizard.findFirst({
@@ -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{t as r}from"./logo-C4V2_3Ar.js";import{t as i}from"./preload-helper-CNEI7N0N.js";import{Ct as a,Dt as o,Kt as s,Tt as c,Zt as l,ct as u,dt as d,gt as f,lt as p,ut as m,xt as h,yt as g}from"./ui-aWLrX8hF.js";import{H as _,U as v,et as y}from"./index-rU86dlvl.js";import{c as b,f as x}from"./settings-menu-CxLCpfSv.js";import{ReleaseNotes as S,loadReleases as C,releaseDate as w,releaseLabel as T}from"./ChangelogDialog-mO9JA9bB.js";var E=e(t(),1),D=[{name:`engenty wizards`,description:{de:`KI-Wizards aus einer Beschreibung, mit einem Link geteilt.`,en:`AI wizards built from a description, shared with a link.`},homepage:`https://github.com/engenty/wizards`,license:`FSL-1.1-MIT`},{name:`engenty`,description:{de:`Konnektoren, Datentabellen, Suche und die Engenties stammen aus dem engenty-Framework.`,en:`Connectors, data tables, search and the engenties come from the engenty framework.`},homepage:`https://github.com/engenty/engenty`,license:`FSL-1.1-MIT`}],O=[{name:`Mastra`,description:{de:`Agent-Framework hinter den KI-Schritten.`,en:`Agent framework behind the AI steps.`},homepage:`https://github.com/mastra-ai/mastra`,license:`Apache-2.0`},{name:`AI SDK`,description:{de:`Modell-Aufrufe für Text, Bild, Video und Sprache.`,en:`Model calls for text, image, video and speech.`},homepage:`https://github.com/vercel/ai`,license:`Apache-2.0`},{name:`Model Context Protocol`,description:{de:`MCP-Server zum Bauen von Wizards, MCP-Client für Werkzeuge der Schritte.`,en:`MCP server for building wizards, MCP client for the steps' tools.`},homepage:`https://github.com/modelcontextprotocol/typescript-sdk`,license:`MIT`},{name:`Hono`,description:{de:`HTTP-API der Runtime.`,en:`The runtime's HTTP API.`},homepage:`https://github.com/honojs/hono`,license:`MIT`},{name:`Drizzle ORM`,description:{de:`Schema und Migrationen der Datenbanken.`,en:`Schema and migrations of the databases.`},homepage:`https://github.com/drizzle-team/drizzle-orm`,license:`Apache-2.0`},{name:`libSQL`,description:{de:`Eine Datenbank je Mandant, lokal als Datei oder bei Turso.`,en:`One database per tenant, a local file or at Turso.`},homepage:`https://github.com/tursodatabase/libsql`,license:`MIT`},{name:`Playwright`,description:{de:`Browser-Schritte sowie PDF- und PNG-Export.`,en:`Browser steps and the PDF and PNG export.`},homepage:`https://github.com/microsoft/playwright`,license:`Apache-2.0`},{name:`agentOS`,description:{de:`Sandbox für Code-Schritte ohne Docker.`,en:`Sandbox for code steps without Docker.`},homepage:`https://github.com/rivet-dev/agentos`,license:`Apache-2.0`},{name:`React`,description:{de:`UI-Bibliothek der Web-App.`,en:`UI library of the web app.`},homepage:`https://github.com/facebook/react`,license:`MIT`},{name:`Vite`,description:{de:`Build-Werkzeug der Web-App.`,en:`Build tool of the web app.`},homepage:`https://github.com/vitejs/vite`,license:`MIT`},{name:`Tailwind CSS`,description:{de:`Styling der Oberfläche.`,en:`Styling of the interface.`},homepage:`https://github.com/tailwindlabs/tailwindcss`,license:`MIT`},{name:`React Flow`,description:{de:`Das Diagramm der Schritte im Editor.`,en:`The diagram of steps in the editor.`},homepage:`https://github.com/xyflow/xyflow`,license:`MIT`},{name:`TanStack Query`,description:{de:`Server-Daten in der Web-App.`,en:`Server data in the web app.`},homepage:`https://github.com/TanStack/query`,license:`MIT`},{name:`xterm.js`,description:{de:`Das Terminal auf der Seite, in dem sich KI-Clients anmelden.`,en:`The terminal on the page where AI clients sign in.`},homepage:`https://github.com/xtermjs/xterm.js`,license:`MIT`},{name:`Lucide`,description:{de:`Icons.`,en:`Icons.`},homepage:`https://github.com/lucide-icons/lucide`,license:`ISC`},{name:`Geist & Geist Mono`,description:{de:`Schrift der Oberfläche.`,en:`Typeface of the interface.`},homepage:`https://github.com/vercel/geist-font`,license:`OFL-1.1`},{name:`Space Grotesk`,description:{de:`Schrift der Überschriften.`,en:`Typeface of the headings.`},homepage:`https://github.com/floriankarsten/space-grotesk`,license:`OFL-1.1`},{name:`git-cliff`,description:{de:`Erzeugt den Changelog aus den Commits.`,en:`Generates the changelog from the commits.`},homepage:`https://github.com/orhun/git-cliff`,license:`MIT OR Apache-2.0`}],k=e(n(),1),A=(e,...t)=>t.some(t=>t?.toLowerCase().includes(e));function j({name:e,homepage:t,version:n,license:r,description:i}){return(0,k.jsxs)(`li`,{className:`py-2.5`,children:[(0,k.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,children:[t?(0,k.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,k.jsx)(s,{"aria-hidden":!0,className:`size-3 text-ink-4`})]}):(0,k.jsx)(`span`,{className:`font-medium text-[0.875rem] text-ink`,children:e}),n?(0,k.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:n}):null,(0,k.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:r})]}),i?(0,k.jsx)(`p`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:i}):null]})}function M({title:e,hint:t,children:n}){return(0,k.jsxs)(`section`,{className:`mt-6`,children:[(0,k.jsx)(`h3`,{className:`border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:e}),t?(0,k.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3`,children:t}):null,n]})}function N({credits:e}){return(0,k.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:e.map(e=>(0,k.jsx)(j,{name:e.name,homepage:e.homepage,license:e.license,description:e.description[a]},e.name))})}function P({label:e,packages:t}){return(0,k.jsxs)(`div`,{className:`mt-4`,children:[(0,k.jsx)(`h4`,{className:`font-medium text-[0.75rem] text-ink-3 tracking-wide`,children:e}),(0,k.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:t.map(e=>(0,k.jsx)(j,{...e},e.name))})]})}function F({active:e}){let[t,n]=(0,E.useState)(null),[r,a]=(0,E.useState)(``);(0,E.useEffect)(()=>{if(!e||t)return;let r=!1;return i(()=>import(`./oss-credits-BQQX0kvk.js`).then(e=>{r||n(e.default)}),[]),()=>{r=!0}},[e,t]),(0,E.useEffect)(()=>{e||a(``)},[e]);let o=r.trim().toLowerCase(),s=e=>o?e.filter(e=>A(o,e.name,e.license,e.description.de,e.description.en)):e,l=e=>o?e.filter(e=>A(o,e.name,e.license,e.version)):e,u=s(D),m=s(O),h=t?[{id:`shared`,label:c(`about.creditsShared`),packages:l(t.shared)},...t.groups.map(e=>({id:e.id,label:e.label,packages:l(e.packages)}))].filter(e=>e.packages.length>0):[],g=u.length===0&&m.length===0&&h.length===0;return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`p`,{className:`mb-4 text-[0.875rem] text-ink-3`,children:c(`about.creditsHint`)}),(0,k.jsx)(d,{type:`search`,value:r,placeholder:c(`about.search`),onChange:e=>a(e.target.value)}),u.length>0?(0,k.jsx)(M,{title:c(`about.creditsProduct`),children:(0,k.jsx)(N,{credits:u})}):null,m.length>0?(0,k.jsx)(M,{title:c(`about.creditsBuiltWith`),children:(0,k.jsx)(N,{credits:m})}):null,t===null?(0,k.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,k.jsx)(f,{})}):h.length>0?(0,k.jsx)(M,{title:c(`about.creditsDeps`),hint:o?void 0:c(`about.creditsDepsHint`),children:h.map(e=>(0,k.jsx)(P,{label:e.label,packages:e.packages},e.id))}):null,t!==null&&g?(0,k.jsx)(p,{children:c(`about.noMatches`)}):null]})}var I=[`new`,`earlier`,`credits`],L=e=>c(e===`new`?`about.tab.new`:e===`earlier`?`about.tab.earlier`:`about.credits`),R=e=>e===1?c(`about.change`):c(`about.changes`,{n:e});function z({open:e,onClose:t,me:n}){let i=n?.mode===`local`,{data:a,latest:s}=v(i&&e),[d,p]=(0,E.useState)(null),[D,O]=(0,E.useState)(`new`),A=x(I.indexOf(D)),j=a?.newer&&s?s:y;(0,E.useEffect)(()=>{if(!e)return;let t=!1;return p(null),C(j===`0.3.0`?void 0:j).then(e=>{t||p(e)}),()=>{t=!0}},[e,j]);let M=d?.find(e=>e.version===`v${j}`)??d?.[0]??null,N=d?.filter(e=>e!==M)??[],P=i?a?.kind??null:`cloud`;return(0,k.jsxs)(u,{open:e,onClose:t,wide:!0,height:`tall`,children:[(0,k.jsx)(`div`,{className:`-mt-2 -mr-2 sticky top-0 z-10 flex h-0 justify-end`,children:(0,k.jsx)(m,{label:c(`common.close`),onClick:t,children:(0,k.jsx)(o,{className:`size-4`})})}),(0,k.jsxs)(`div`,{className:`flex flex-col items-center pt-4 text-center`,children:[(0,k.jsx)(r,{size:96}),(0,k.jsxs)(`div`,{className:`mt-4 font-display font-semibold text-[1.5rem] tracking-tight`,children:[`engenty`,(0,k.jsx)(`span`,{className:`text-ember`,children:`.`}),(0,k.jsx)(`span`,{className:`ml-1.5 font-normal text-ink-3`,children:`wizards`})]}),(0,k.jsxs)(`div`,{className:`mt-1 text-[0.9375rem] text-ink-3 tabular-nums`,children:[c(`about.version`,{v:y}),P?` · ${c(`about.kind.${P}`)}`:``]})]}),i?(0,k.jsx)(`div`,{className:`mt-5`,children:(0,k.jsx)(_,{enabled:e})}):null,(0,k.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,k.jsx)(g,{value:D,onChange:O,options:I.map(e=>({id:e,label:L(e)})),label:c(`about.title`)})}),(0,k.jsxs)(`div`,{className:h(`mt-5`,b(A)),children:[D===`new`?d===null?(0,k.jsx)(`div`,{className:`flex justify-center py-6 text-ink-3`,children:(0,k.jsx)(f,{})}):M?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:[T(M),(0,k.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:w(M)})]}),(0,k.jsx)(`div`,{className:`mt-3`,children:(0,k.jsx)(S,{release:M})})]}):(0,k.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:c(`about.changelogEmpty`)}):null,D===`earlier`?(0,k.jsx)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:N.map(e=>(0,k.jsxs)(`details`,{className:`group/r py-2`,children:[(0,k.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-baseline gap-3 text-[0.875rem] [&::-webkit-details-marker]:hidden`,children:[(0,k.jsx)(l,{className:`size-3.5 shrink-0 self-center text-ink-4 transition group-open/r:rotate-90`}),(0,k.jsx)(`span`,{className:`font-medium text-ink tabular-nums`,children:T(e)}),(0,k.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:w(e)}),(0,k.jsx)(`span`,{className:`ml-auto text-[0.8125rem] text-ink-4`,children:R(e.commits.length)})]}),(0,k.jsx)(`div`,{className:`mt-2 pl-6`,children:(0,k.jsx)(S,{release:e})})]},e.version??`unreleased`))}):null,D===`credits`?(0,k.jsx)(F,{active:!0}):null]},D)]})}export{z as AboutDialog};
@@ -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{t as r}from"./preload-helper-CNEI7N0N.js";import{Ct as i,lt as a,mt as o,ot as s,st as c,yt as l}from"./ui-FW7ypPI6.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/,``):i(`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/engenty-wizards/v${e}/apps/web/src/about/changelog.json`,{signal:AbortSignal.timeout(5e3)});if(t.ok)return await t.json()}catch{}return(await r(async()=>{let{default:e}=await import(`./changelog-sHZ4ve7D.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:l(`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:i(`about.breaking`)}):null]})]},e.id)})})}function y({open:e,onClose:t,version:n}){let[r,l]=(0,u.useState)(null),[f,h]=(0,u.useState)(``);(0,u.useEffect)(()=>{if(!e||r)return;let t=!1;return _(n).then(e=>{t||l(e)}),()=>{t=!0}},[e,r,n]),(0,u.useEffect)(()=>{e||h(``)},[e]);let y=r?g(r,f):[];return(0,d.jsxs)(s,{open:e,onClose:t,title:i(`about.changelog`),wide:!0,height:`tall`,children:[(0,d.jsx)(`p`,{className:`-mt-3 mb-4 text-[0.875rem] text-ink-3`,children:i(`about.changelogHint`)}),r===null?(0,d.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,d.jsx)(o,{})}):r.length===0?(0,d.jsx)(c,{children:i(`about.changelogEmpty`)}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(a,{type:`search`,value:f,placeholder:i(`about.search`),onChange:e=>h(e.target.value)}),y.length===0?(0,d.jsx)(c,{children:i(`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{t as r}from"./preload-helper-CNEI7N0N.js";import{Tt as i,ct as a,dt as o,gt as s,lt as c,xt as l}from"./ui-aWLrX8hF.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/,``):i(`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/engenty-wizards/v${e}/apps/web/src/about/changelog.json`,{signal:AbortSignal.timeout(5e3)});if(t.ok)return await t.json()}catch{}return(await r(async()=>{let{default:e}=await import(`./changelog-CJ5JQKkS.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:l(`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:i(`about.breaking`)}):null]})]},e.id)})})}function y({open:e,onClose:t,version:n}){let[r,l]=(0,u.useState)(null),[f,h]=(0,u.useState)(``);(0,u.useEffect)(()=>{if(!e||r)return;let t=!1;return _(n).then(e=>{t||l(e)}),()=>{t=!0}},[e,r,n]),(0,u.useEffect)(()=>{e||h(``)},[e]);let y=r?g(r,f):[];return(0,d.jsxs)(a,{open:e,onClose:t,title:i(`about.changelog`),wide:!0,height:`tall`,children:[(0,d.jsx)(`p`,{className:`-mt-3 mb-4 text-[0.875rem] text-ink-3`,children:i(`about.changelogHint`)}),r===null?(0,d.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,d.jsx)(s,{})}):r.length===0?(0,d.jsx)(c,{children:i(`about.changelogEmpty`)}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(o,{type:`search`,value:f,placeholder:i(`about.search`),onChange:e=>h(e.target.value)}),y.length===0?(0,d.jsx)(c,{children:i(`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};