wizards 0.2.55 → 0.2.57

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 (123) hide show
  1. package/README.md +2 -2
  2. package/apps/runtime/dist/cli/autostart.js +1 -1
  3. package/apps/runtime/dist/cli/machine.js +5 -48
  4. package/apps/runtime/dist/cli/report.js +1 -1
  5. package/apps/runtime/dist/db/control-schema.js +13 -0
  6. package/apps/runtime/dist/db/migrations/control/0008_runner.sql +8 -0
  7. package/apps/runtime/dist/db/migrations/control/meta/0008_snapshot.json +505 -0
  8. package/apps/runtime/dist/db/migrations/control/meta/_journal.json +7 -0
  9. package/apps/runtime/dist/db/migrations/tenant/0014_run_answer.sql +2 -0
  10. package/apps/runtime/dist/db/migrations/tenant/meta/0014_snapshot.json +3154 -0
  11. package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +7 -0
  12. package/apps/runtime/dist/db/schema.js +4 -0
  13. package/apps/runtime/dist/docs/dev/index.md +4 -4
  14. package/apps/runtime/dist/docs/dev/plugins/connections.md +4 -3
  15. package/apps/runtime/dist/docs/dev/plugins/events.md +1 -0
  16. package/apps/runtime/dist/docs/dev/plugins/examples.md +10 -9
  17. package/apps/runtime/dist/docs/dev/plugins/index.md +4 -3
  18. package/apps/runtime/dist/docs/dev/plugins/layout.md +2 -1
  19. package/apps/runtime/dist/docs/dev/plugins/meta.json +0 -1
  20. package/apps/runtime/dist/docs/dev/plugins/quick-start.md +4 -3
  21. package/apps/runtime/dist/docs/dev/plugins/reference.md +36 -14
  22. package/apps/runtime/dist/docs/dev/plugins/reloading.md +5 -5
  23. package/apps/runtime/dist/docs/dev/plugins/routes.md +30 -6
  24. package/apps/runtime/dist/docs/dev/plugins/runners.md +15 -10
  25. package/apps/runtime/dist/docs/dev/plugins/server.md +16 -7
  26. package/apps/runtime/dist/docs/dev/plugins/shipping.md +4 -26
  27. package/apps/runtime/dist/docs/dev/plugins/space.md +66 -53
  28. package/apps/runtime/dist/docs/dev/plugins/starters.md +10 -7
  29. package/apps/runtime/dist/docs/dev/plugins/studio.md +33 -12
  30. package/apps/runtime/dist/docs/dev/plugins/styling.md +19 -9
  31. package/apps/runtime/dist/docs/dev/plugins/tables.md +6 -4
  32. package/apps/runtime/dist/docs/dev/plugins/tools.md +22 -12
  33. package/apps/runtime/dist/docs/dev/wizard-format.md +3 -2
  34. package/apps/runtime/dist/docs/user/ai-apps.md +3 -1
  35. package/apps/runtime/dist/docs/user/assistant.md +5 -3
  36. package/apps/runtime/dist/docs/user/build-a-wizard.md +14 -2
  37. package/apps/runtime/dist/docs/user/command-line.md +16 -14
  38. package/apps/runtime/dist/docs/user/connectors.md +17 -12
  39. package/apps/runtime/dist/docs/user/data.md +14 -9
  40. package/apps/runtime/dist/docs/user/first-start.md +13 -6
  41. package/apps/runtime/dist/docs/user/index.md +2 -1
  42. package/apps/runtime/dist/docs/user/install.md +19 -11
  43. package/apps/runtime/dist/docs/user/models.md +44 -22
  44. package/apps/runtime/dist/docs/user/plugins.md +9 -4
  45. package/apps/runtime/dist/docs/user/run.md +14 -9
  46. package/apps/runtime/dist/docs/user/server.md +7 -5
  47. package/apps/runtime/dist/docs/user/space.md +15 -8
  48. package/apps/runtime/dist/docs/user/steps.md +33 -13
  49. package/apps/runtime/dist/docs/user/test-and-share.md +41 -25
  50. package/apps/runtime/dist/docs/user/troubleshooting.md +15 -7
  51. package/apps/runtime/dist/docs/user/wordpress.md +59 -49
  52. package/apps/runtime/dist/engine/asks.js +53 -33
  53. package/apps/runtime/dist/engine/events.js +45 -1
  54. package/apps/runtime/dist/engine/owner.js +32 -0
  55. package/apps/runtime/dist/engine/runner.js +131 -97
  56. package/apps/runtime/dist/env.js +25 -3
  57. package/apps/runtime/dist/harness/apple.js +36 -21
  58. package/apps/runtime/dist/harness/claude.js +1 -1
  59. package/apps/runtime/dist/harness/model.js +2 -2
  60. package/apps/runtime/dist/index.js +13 -2
  61. package/apps/runtime/dist/limits.js +7 -4
  62. package/apps/runtime/dist/media/conversation.js +6 -5
  63. package/apps/runtime/dist/model-errors.js +22 -1
  64. package/apps/runtime/dist/models.js +30 -7
  65. package/apps/runtime/dist/plugins/pro-keys.js +1 -1
  66. package/apps/runtime/dist/plugins/pro-state.js +1 -1
  67. package/apps/runtime/dist/plugins/pro.js +1 -1
  68. package/apps/runtime/dist/plugins/runs.js +20 -15
  69. package/apps/runtime/dist/render/browser-path.js +54 -0
  70. package/apps/runtime/dist/routes/runs.js +67 -38
  71. package/apps/runtime/dist/routes/studio.js +7 -3
  72. package/apps/runtime/dist/services/api.js +3 -1
  73. package/apps/runtime/dist/services/package-file.js +8 -8
  74. package/apps/runtime/dist/services/runs.js +7 -8
  75. package/apps/runtime/dist/tenants/control.js +85 -7
  76. package/apps/runtime/dist/update.js +1 -1
  77. package/apps/web/dist/assets/AboutDialog-DEZCEQlN.js +1 -0
  78. package/apps/web/dist/assets/{ChangelogDialog-BLmJABe4.js → ChangelogDialog-CgnnJj4G.js} +1 -1
  79. package/apps/web/dist/assets/{ChatView-YAiOT6mt.js → ChatView-BnnKdwk4.js} +1 -1
  80. package/apps/web/dist/assets/{EditorPage-C0zMXwlF.js → EditorPage-CeDWjq4z.js} +2 -2
  81. package/apps/web/dist/assets/{FlowPreview-B4lbmeha.js → FlowPreview-Du028FI3.js} +1 -1
  82. package/apps/web/dist/assets/{Harness-_riwRD-c.js → Harness-CEPy4MEp.js} +1 -1
  83. package/apps/web/dist/assets/{Marketplace-B0Nki6J6.js → Marketplace-ms58DQJ9.js} +2 -2
  84. package/apps/web/dist/assets/{NewWizardPage-DkvGgROv.js → NewWizardPage-CEQSNXeZ.js} +1 -1
  85. package/apps/web/dist/assets/{ProjectPage-CFRIPset.js → ProjectPage-CXDpKoK2.js} +1 -1
  86. package/apps/web/dist/assets/{PublicRunner-QJuQB7ff.js → PublicRunner-DMmtmzBX.js} +1 -1
  87. package/apps/web/dist/assets/{ReadOnly-DiOfNtVr.js → ReadOnly-zQecD9OB.js} +1 -1
  88. package/apps/web/dist/assets/{RunDrawer-LjUX3yIv.js → RunDrawer-BIojYB0g.js} +1 -1
  89. package/apps/web/dist/assets/{RunnerView-DkJVfUeG.js → RunnerView-D8OGEoMl.js} +1 -1
  90. package/apps/web/dist/assets/SettingsPage-BlMZL4_d.js +1 -0
  91. package/apps/web/dist/assets/SetupPage-Doz9T3kv.js +1 -0
  92. package/apps/web/dist/assets/{SharePage-CCimr8XT.js → SharePage-DOJXdsyi.js} +1 -1
  93. package/apps/web/dist/assets/{brand-CwLcF9JR.js → brand-DIKyySmf.js} +1 -1
  94. package/apps/web/dist/assets/changelog-B1jhC7Fv.js +1 -0
  95. package/apps/web/dist/assets/{circle-alert-BEDKtkJy.js → circle-alert-B9b9Vb9k.js} +1 -1
  96. package/apps/web/dist/assets/{esm-BCwno33N.js → esm-D6fM9MdG.js} +1 -1
  97. package/apps/web/dist/assets/{index-Dq-Wj6Yo.js → index-nfRuCdVt.js} +4 -4
  98. package/apps/web/dist/assets/{lock-Ce2ofIWG.js → lock-BNvsUKTg.js} +1 -1
  99. package/apps/web/dist/assets/session-CSbo-pmx.js +1 -0
  100. package/apps/web/dist/assets/{settings-menu-DX0JnPBR.js → settings-menu-BGfn4LJE.js} +1 -1
  101. package/apps/web/dist/assets/{ui-mkL5nF_f.js → ui-FW7ypPI6.js} +1 -1
  102. package/apps/web/dist/assets/{upload-BfrqabpO.js → upload-MQ_24gSb.js} +1 -1
  103. package/apps/web/dist/assets/{volume-2-C3GeMqc-.js → volume-2-B1mj20eS.js} +1 -1
  104. package/apps/web/dist/index.html +6 -6
  105. package/apps/web/dist/install.sh +2 -2
  106. package/apps/web/dist/mcp/flow.html +1 -1
  107. package/modules/calls/dist/client.css +1 -1
  108. package/modules/sms/dist/client.css +1 -1
  109. package/modules/whatsapp/dist/client.css +1 -1
  110. package/node_modules/@engenty-wizards/shared/dist/definition.js +1 -0
  111. package/node_modules/@engenty-wizards/shared/dist/engenty/data-tables/columns.js +1 -0
  112. package/node_modules/@engenty-wizards/shared/dist/fit.js +1 -0
  113. package/node_modules/@engenty-wizards/shared/dist/run.d.ts +152 -2
  114. package/node_modules/@engenty-wizards/shared/dist/run.js +135 -1
  115. package/node_modules/@engenty-wizards/shared/dist/store.js +1 -0
  116. package/node_modules/@engenty-wizards/shared/dist/surface.js +1 -0
  117. package/package.json +2 -2
  118. package/apps/runtime/dist/docs/dev/plugins/pro-modules.md +0 -59
  119. package/apps/web/dist/assets/AboutDialog-BelD7JCn.js +0 -1
  120. package/apps/web/dist/assets/SettingsPage-BKZ1KLfP.js +0 -1
  121. package/apps/web/dist/assets/SetupPage-Rqlo16Lk.js +0 -1
  122. package/apps/web/dist/assets/changelog-Bg5ZBu5p.js +0 -1
  123. package/apps/web/dist/assets/session-BuVghS-e.js +0 -1
@@ -1,5 +1,6 @@
1
1
  import { FORMATS, LIST_FORMATS, TEXT_CLASSES } from "@engenty-wizards/shared/definition";
2
2
  import { TableColumnValueError } from "@engenty-wizards/shared/engenty/data-tables";
3
+ import { noteText } from "@engenty-wizards/shared/run";
3
4
  import { getConnInfo } from "@hono/node-server/conninfo";
4
5
  import { and, eq } from "drizzle-orm";
5
6
  import { Hono } from "hono";
@@ -14,17 +15,18 @@ import { finishPluginOAuth, pluginStateTenant } from "../connectors/plugin-conne
14
15
  import { db, schema, withTenant } from "../db/client.js";
15
16
  import { answerAsk, pendingAsk } from "../engine/asks.js";
16
17
  import { answerDevice, offerDevice } from "../engine/device.js";
17
- import { emitEvent, signalChanged, subscribe } from "../engine/events.js";
18
+ import { emitEvent, signalChanged, watchRun } from "../engine/events.js";
19
+ import { fromOwner } from "../engine/owner.js";
18
20
  import { pushAvailable, setPushDevice } from "../engine/push.js";
19
21
  import { liveResources } from "../engine/resources.js";
20
- import { cancel, createRun, goBack, NoCreditsError, projectIdOf, RunConflict, RunInputError, retry, reviewStep, runView, submitPage, } from "../engine/runner.js";
22
+ import { cancel, createRun, goBack, NoCreditsError, projectIdOf, RunConflict, RunInputError, retry, reviewStep, runView, submitPage, talkAllowed, } from "../engine/runner.js";
21
23
  import { basePath, env } from "../env.js";
22
24
  import { loadAsset, saveAsset } from "../files/storage.js";
23
25
  import { reverseGeocode } from "../geocode.js";
24
26
  import { allowed, hashIp, verifyTurnstile, wizardUnavailable } from "../limits.js";
25
27
  import { mintConversation } from "../media/conversation.js";
26
28
  import { transcribeAudio } from "../media/transcribe.js";
27
- import { ModelUnavailableError } from "../model-errors.js";
29
+ import { errorText, ModelUnavailableError, noteOf } from "../model-errors.js";
28
30
  import { listDownload, renderDownload, stepHtml } from "../render/downloads.js";
29
31
  import { HTML_RESPONSE_CSP } from "../render/guard.js";
30
32
  import { runTicketValid, verifySignedUrl } from "../secrets/signing.js";
@@ -51,6 +53,19 @@ export function clientIp(c) {
51
53
  return null;
52
54
  }
53
55
  }
56
+ /**
57
+ * The language a visitor's request asks for: what the runner around it speaks, the browser's
58
+ * first language (apps/web: `navigator.language`) — German for "de…", else English; German
59
+ * without one, as the runner starts.
60
+ */
61
+ function requestLang(c) {
62
+ const asked = c.req.header("accept-language")?.trim().toLowerCase();
63
+ return !asked || asked.startsWith("de") ? "de" : "en";
64
+ }
65
+ /** A refusal the visitor reads, in the language their request asks for. */
66
+ function refuse(c, note, status) {
67
+ return c.json({ error: noteText(note, requestLang(c)) }, status);
68
+ }
54
69
  /**
55
70
  * The mobile app's own requests (a run's view, downloads) name the visitor in a header: iOS
56
71
  * merges a Cookie header the app sets with its own cookie store (`wz_vid=a,wz_vid=a`). The header
@@ -125,10 +140,10 @@ async function viewOf(run) {
125
140
  }
126
141
  function commandError(c, err) {
127
142
  if (err instanceof RunInputError) {
128
- return c.json({ error: err.message, fields: err.errors }, 422);
143
+ return c.json({ error: errorText(err, requestLang(c)), fields: err.errors }, 422);
129
144
  }
130
145
  if (err instanceof RunConflict) {
131
- return c.json({ error: err.message }, 409);
146
+ return c.json({ error: errorText(err, requestLang(c)) }, 409);
132
147
  }
133
148
  throw err;
134
149
  }
@@ -143,7 +158,7 @@ function tenantFrom(find) {
143
158
  return c.json({ error: "not found" }, 404);
144
159
  }
145
160
  if ((await tenantStatus(tenant)) === "suspended") {
146
- return c.json({ error: "Dieser Wizard ist gerade nicht verfügbar." }, 403);
161
+ return refuse(c, { code: "wizardUnavailable" }, 403);
147
162
  }
148
163
  return withTenant(tenant, next);
149
164
  };
@@ -227,7 +242,7 @@ export const publicRoutes = new Hono()
227
242
  brand: await brandView(w.projectId),
228
243
  turnstileSiteKey: env.turnstile.siteKey || null,
229
244
  available: !reason,
230
- unavailableReason: reason,
245
+ unavailableReason: reason && noteText(reason, requestLang(c)),
231
246
  runners: await publicRunners(w, def),
232
247
  };
233
248
  return c.json(body);
@@ -241,7 +256,7 @@ export const publicRoutes = new Hono()
241
256
  }
242
257
  const reason = await wizardUnavailable(w);
243
258
  if (reason) {
244
- return c.json({ error: reason }, 403);
259
+ return refuse(c, reason, 403);
245
260
  }
246
261
  const body = z
247
262
  .object({
@@ -253,14 +268,12 @@ export const publicRoutes = new Hono()
253
268
  .parse(await c.req.json().catch(() => ({})));
254
269
  const ip = clientIp(c);
255
270
  if (!(await verifyTurnstile(body.turnstileToken, ip))) {
256
- return c.json({ error: "Bitte bestätige kurz, dass du ein Mensch bist." }, 403);
271
+ return refuse(c, { code: "confirmHuman" }, 403);
257
272
  }
258
273
  const vid = visitorId(c, true, body.embedded);
259
274
  const ipHash = hashIp(ip);
260
275
  if (await visitorOverLimit(vid, ipHash)) {
261
- return c.json({
262
- error: "Du hast gerade viele Durchläufe gestartet. Bitte versuche es in einer Stunde wieder.",
263
- }, 429);
276
+ return refuse(c, { code: "tooManyRuns" }, 429);
264
277
  }
265
278
  const version = await db.query.wizardVersion.findFirst({
266
279
  where: and(eq(schema.wizardVersion.wizardId, w.id), eq(schema.wizardVersion.version, w.publishedVersion)),
@@ -280,7 +293,7 @@ export const publicRoutes = new Hono()
280
293
  }
281
294
  catch (err) {
282
295
  if (err instanceof NoCreditsError || err instanceof ModelUnavailableError) {
283
- return c.json({ error: "Dieser Wizard ist gerade nicht verfügbar." }, 403);
296
+ return refuse(c, { code: "wizardUnavailable" }, 403);
284
297
  }
285
298
  throw err;
286
299
  }
@@ -391,8 +404,8 @@ export const runRoutes = new Hono()
391
404
  await stream.writeSSE({ event: "view", data: JSON.stringify(await viewOf(run)) });
392
405
  }
393
406
  };
394
- const unsubscribe = subscribe(id, (signal) => {
395
- if (signal.device) {
407
+ const unsubscribe = watchRun(id, (signal) => {
408
+ if (signal?.device) {
396
409
  // The runtime asks the phone around the runner to think: not a change of the run.
397
410
  if (!closed) {
398
411
  void stream.writeSSE({ event: "device", data: JSON.stringify(signal.device) });
@@ -526,10 +539,13 @@ export const runRoutes = new Hono()
526
539
  return c.json({ error: "not found" }, 404);
527
540
  }
528
541
  if (run.status === "done" || run.status === "cancelled" || run.status === "failed") {
529
- return c.json({ error: "Der Durchlauf ist beendet." }, 409);
542
+ return refuse(c, { code: "runOver" }, 409);
543
+ }
544
+ if (!(await talkAllowed(run))) {
545
+ return refuse(c, { code: "talkOff" }, 403);
530
546
  }
531
547
  if (!allowed(`talk:${run.id}`, 20, 3600_000)) {
532
- return c.json({ error: "Bitte später noch einmal." }, 429);
548
+ return refuse(c, { code: "tryLater" }, 429);
533
549
  }
534
550
  try {
535
551
  const view = await viewOf(run);
@@ -537,10 +553,10 @@ export const runRoutes = new Hono()
537
553
  }
538
554
  catch (err) {
539
555
  if (err instanceof ModelUnavailableError) {
540
- return c.json({ error: err.message }, 403);
556
+ return c.json({ error: errorText(err, requestLang(c)) }, 403);
541
557
  }
542
558
  console.error("[talk]", err);
543
- return c.json({ error: err.message }, 502);
559
+ return c.json({ error: errorText(err, requestLang(c)) }, 502);
544
560
  }
545
561
  })
546
562
  // What the person says into the chat's composer, written down — where the browser cannot do it itself.
@@ -550,14 +566,14 @@ export const runRoutes = new Hono()
550
566
  return c.json({ error: "not found" }, 404);
551
567
  }
552
568
  if (run.status === "done" || run.status === "cancelled" || run.status === "failed") {
553
- return c.json({ error: "Der Durchlauf ist beendet." }, 409);
569
+ return refuse(c, { code: "runOver" }, 409);
554
570
  }
555
571
  if (!allowed(`transcribe:${run.id}`, 60, 3600_000)) {
556
- return c.json({ error: "Bitte später noch einmal." }, 429);
572
+ return refuse(c, { code: "tryLater" }, 429);
557
573
  }
558
574
  const file = (await c.req.formData()).get("file");
559
575
  if (!(file instanceof File) || !file.size || file.size > 10_000_000) {
560
- return c.json({ error: "Bitte eine Aufnahme bis 10 MB." }, 400);
576
+ return refuse(c, { code: "recordingTooLarge" }, 400);
561
577
  }
562
578
  try {
563
579
  const { text } = await transcribeAudio({
@@ -569,7 +585,11 @@ export const runRoutes = new Hono()
569
585
  }
570
586
  catch (err) {
571
587
  if (err instanceof ModelUnavailableError) {
572
- return c.json({ error: err.message }, 403);
588
+ return c.json({ error: errorText(err, requestLang(c)) }, 403);
589
+ }
590
+ // Apple Intelligence on this Mac says why in a note (harness/apple.ts).
591
+ if (noteOf(err)) {
592
+ return c.json({ error: errorText(err, requestLang(c)) }, 502);
573
593
  }
574
594
  throw err;
575
595
  }
@@ -585,7 +605,7 @@ export const runRoutes = new Hono()
585
605
  const mime = file instanceof File ? file.type.split(";")[0].trim().toLowerCase() : "";
586
606
  const limit = uploadLimit(mime);
587
607
  if (!(file instanceof File) || file.size > limit) {
588
- return c.json({ error: `Bitte eine Datei bis ${Math.round(limit / 1_000_000)} MB wählen.` }, 400);
608
+ return refuse(c, { code: "fileTooLarge", params: { mb: Math.round(limit / 1_000_000) } }, 400);
589
609
  }
590
610
  const ref = await saveAsset({
591
611
  runId: run.id,
@@ -642,8 +662,8 @@ export const runRoutes = new Hono()
642
662
  z.object({ type: z.literal("skip") }),
643
663
  ])
644
664
  .parse(await c.req.json());
645
- if (!answerAsk(run.id, c.req.param("askId"), answer)) {
646
- return c.json({ error: "Diese Frage ist nicht mehr offen." }, 409);
665
+ if (!(await answerAsk(run.id, c.req.param("askId"), answer))) {
666
+ return refuse(c, { code: "askClosed" }, 409);
647
667
  }
648
668
  return c.json({ ok: true });
649
669
  })
@@ -652,7 +672,8 @@ export const runRoutes = new Hono()
652
672
  const run = await accessibleRun(c, c.req.param("id"));
653
673
  const resources = run?.status === "running" ? liveResources(run.id) : null;
654
674
  if (!resources?.openPage()) {
655
- return c.json({ error: "not found" }, 404);
675
+ // The run may work in another process: its runner answers.
676
+ return (run && (await fromOwner(c, run.id))) || c.json({ error: "not found" }, 404);
656
677
  }
657
678
  return c.json({ seat: resources.seatHolder() });
658
679
  })
@@ -662,7 +683,7 @@ export const runRoutes = new Hono()
662
683
  const run = await accessibleRun(c, c.req.param("id"));
663
684
  const resources = run?.status === "running" ? liveResources(run.id) : null;
664
685
  if (!(run && resources?.openPage())) {
665
- return c.json({ error: "Der Wizard hat gerade keinen Browser offen." }, 409);
686
+ return (run && (await fromOwner(c, run.id))) || refuse(c, { code: "noBrowser" }, 409);
666
687
  }
667
688
  const { to } = z.object({ to: z.enum(["person", "agent"]) }).parse(await c.req.json());
668
689
  if (resources.seatHolder() !== to) {
@@ -680,7 +701,7 @@ export const runRoutes = new Hono()
680
701
  const run = await accessibleRun(c, c.req.param("id"));
681
702
  const resources = run?.status === "running" ? liveResources(run.id) : null;
682
703
  if (!resources?.openPage()) {
683
- return c.notFound();
704
+ return (run && (await fromOwner(c, run.id))) || c.notFound();
684
705
  }
685
706
  const boundary = "frame";
686
707
  const encoder = new TextEncoder();
@@ -749,10 +770,17 @@ export const runRoutes = new Hono()
749
770
  .post("/:id/browser/act", async (c) => {
750
771
  const run = await accessibleRun(c, c.req.param("id"));
751
772
  const resources = run ? liveResources(run.id) : null;
752
- const theirs = run && (pendingAsk(run.id) || resources?.seatHolder() === "person");
773
+ if (run?.status === "running" && !resources) {
774
+ // The run works in another process: its runner answers.
775
+ const answered = await fromOwner(c, run.id);
776
+ if (answered) {
777
+ return answered;
778
+ }
779
+ }
780
+ const theirs = run && ((await pendingAsk(run.id)) || resources?.seatHolder() === "person");
753
781
  const page = theirs ? resources?.openPage() : null;
754
782
  if (!(run && resources && page)) {
755
- return c.json({ error: "Der Wizard wartet gerade nicht auf dich." }, 409);
783
+ return refuse(c, { code: "notWaiting" }, 409);
756
784
  }
757
785
  resources.touchSeat();
758
786
  const act = z
@@ -794,7 +822,7 @@ export const runRoutes = new Hono()
794
822
  await page.waitForLoadState("domcontentloaded", { timeout: 3000 }).catch(() => undefined);
795
823
  }
796
824
  catch {
797
- return c.json({ error: "Das hat auf der Seite nicht geklappt." }, 422);
825
+ return refuse(c, { code: "pageActFailed" }, 422);
798
826
  }
799
827
  return c.json({ ok: true });
800
828
  })
@@ -1039,9 +1067,9 @@ export const connectCallback = new Hono().get("/callback", async (c) => {
1039
1067
  const ticket = c.req.query("ticket");
1040
1068
  const state = c.req.query("state");
1041
1069
  let ok = false;
1042
- let message = c.req.query("error") === "exchange_failed"
1043
- ? "Verbinden hat nicht geklappt. Bitte noch einmal versuchen."
1044
- : "Verbinden wurde abgebrochen.";
1070
+ let said = c.req.query("error") === "exchange_failed"
1071
+ ? { code: "connectFailed" }
1072
+ : { code: "connectCancelled" };
1045
1073
  // A plugin's sign-in (server.connections) names its tenant; a wizard's names its run.
1046
1074
  const pluginTenant = state ? pluginStateTenant(state) : null;
1047
1075
  const tenant = state ? (pluginTenant ?? (await tenantOfRun(oauthStateRun(state) ?? ""))) : null;
@@ -1056,13 +1084,14 @@ export const connectCallback = new Hono().get("/callback", async (c) => {
1056
1084
  signalChanged(done.runId);
1057
1085
  }
1058
1086
  ok = true;
1059
- message = "Verbunden. Du kannst dieses Fenster schließen.";
1087
+ said = { code: "connected" };
1060
1088
  }
1061
1089
  catch (err) {
1062
1090
  console.error("[connect]", err);
1063
- message = "Verbinden hat nicht geklappt. Bitte noch einmal versuchen.";
1091
+ said = { code: "connectFailed" };
1064
1092
  }
1065
1093
  }
1094
+ const message = noteText(said, requestLang(c));
1066
1095
  return c.html(`<!doctype html><meta charset="utf-8"><title>engenty wizards</title>
1067
1096
  <body style="font:16px system-ui;display:grid;place-items:center;height:100vh;margin:0;color:#333">
1068
1097
  <p>${message}</p>
@@ -1141,7 +1170,7 @@ export const shareRoutes = new Hono()
1141
1170
  .get("/:token", async (c) => {
1142
1171
  const run = await sharedRun(c.req.param("token"));
1143
1172
  if (!run) {
1144
- return c.json({ error: "Dieser Link ist abgelaufen oder wurde zurückgezogen." }, 404);
1173
+ return refuse(c, { code: "linkGone" }, 404);
1145
1174
  }
1146
1175
  return c.json(await shareView(run));
1147
1176
  })
@@ -64,13 +64,17 @@ async function testedSources() {
64
64
  const tested = await readSetting("setup-done");
65
65
  return Array.isArray(tested) ? tested : [];
66
66
  }
67
- /** The chosen source has passed a test call and can still answer: its client is there and signed in. */
67
+ /**
68
+ * The chosen source has passed a test call and can still answer: its client is there and signed
69
+ * in. Where Apple Intelligence thinks the short classes, the test ran there; a client behind High
70
+ * and Highest is no condition then.
71
+ */
68
72
  async function setupDone() {
69
- const source = localModelSettings().source;
73
+ const { source, bindings } = localModelSettings();
70
74
  if (!(await testedSources()).includes(source)) {
71
75
  return false;
72
76
  }
73
- const client = harness(source);
77
+ const client = bindings.standard.startsWith("apple:") ? null : harness(source);
74
78
  if (client) {
75
79
  const status = await detectHarness(client.id);
76
80
  return Boolean(status?.version) && status?.auth !== "none";
@@ -1,5 +1,7 @@
1
+ import { wizardLang } from "@engenty-wizards/shared/definition";
1
2
  import { standaloneEntry } from "@engenty-wizards/shared/fit";
2
3
  import { pluginsOf } from "@engenty-wizards/shared/marketplace";
4
+ import { noteText } from "@engenty-wizards/shared/run";
3
5
  import { and, count, desc, eq, gte, inArray, isNotNull, or, sql } from "drizzle-orm";
4
6
  import { MICROS_PER_CREDIT } from "../credits/credits.js";
5
7
  import { db, schema } from "../db/client.js";
@@ -98,7 +100,7 @@ export async function apiWizards(userId, spaceId) {
98
100
  ? `${env.appUrl}/api/public/wizards/${w.shareToken}/icons/icon-192.png`
99
101
  : null,
100
102
  available: Boolean(live) && !reason,
101
- unavailableReason: reason,
103
+ unavailableReason: reason && noteText(reason, wizardLang(def)),
102
104
  dailyRunLimit: w.dailyRunLimit,
103
105
  /** The plugins its steps call: a wizard that books needs `appointments`. */
104
106
  plugins: pluginsOf(def),
@@ -12,7 +12,7 @@ export function json(data) {
12
12
  return JSON.parse(strFromU8(data));
13
13
  }
14
14
  catch {
15
- throw invalid("Das ist kein Wizard-Paket: wizard.json ist kein gültiges JSON.");
15
+ throw invalid("This is not a wizard package: wizard.json is not valid JSON.");
16
16
  }
17
17
  }
18
18
  /** A manifest, or a bare definition: a wizard without workspace is fully told by its JSON. */
@@ -22,7 +22,7 @@ export function readManifest(raw) {
22
22
  }
23
23
  const parsed = manifestSchema.safeParse(raw);
24
24
  if (!parsed.success) {
25
- throw invalid("Dieses Wizard-Paket stammt aus einer neueren Version oder ist beschädigt.");
25
+ throw invalid("This wizard package comes from a newer version, or it is damaged.");
26
26
  }
27
27
  return parsed.data;
28
28
  }
@@ -45,24 +45,24 @@ export function readPackage(data) {
45
45
  total += file.originalSize;
46
46
  count += 1;
47
47
  if (file.originalSize > WORKSPACE_LIMITS.fileBytes) {
48
- throw invalid(`${file.name} ist größer als 5 MB.`);
48
+ throw invalid(`${file.name} is larger than 5 MB.`);
49
49
  }
50
50
  if (count > WORKSPACE_LIMITS.files + 1 || total > PACKAGE_MAX_BYTES) {
51
- throw invalid("Das Paket ist größer als ein Workspace sein darf (200 Dateien, 25 MB).");
51
+ throw invalid("The package is larger than a workspace may be (200 files, 25 MB).");
52
52
  }
53
53
  return true;
54
54
  },
55
55
  });
56
56
  }
57
57
  catch (err) {
58
- throw err instanceof ServiceError ? err : invalid("Das Paket lässt sich nicht entpacken.");
58
+ throw err instanceof ServiceError ? err : invalid("The package cannot be unpacked.");
59
59
  }
60
60
  // A package unpacked and zipped again often sits in a folder of its own.
61
61
  const manifestPath = Object.keys(entries)
62
62
  .filter((name) => name === PACKAGE_MANIFEST || name.endsWith(`/${PACKAGE_MANIFEST}`))
63
63
  .sort((a, b) => a.length - b.length)[0];
64
64
  if (manifestPath === undefined) {
65
- throw invalid("Das ist kein Wizard-Paket: wizard.json fehlt.");
65
+ throw invalid("This is not a wizard package: wizard.json is missing.");
66
66
  }
67
67
  const root = manifestPath.slice(0, -PACKAGE_MANIFEST.length);
68
68
  const files = Object.entries(entries)
@@ -70,12 +70,12 @@ export function readPackage(data) {
70
70
  .map(([name, content]) => {
71
71
  const path = cleanPath(name.slice(root.length + PACKAGE_FILES.length));
72
72
  if (!path) {
73
- throw invalid(`"${name}" ist kein gültiger Dateipfad.`);
73
+ throw invalid(`"${name}" is not a valid file path.`);
74
74
  }
75
75
  return { path, data: content };
76
76
  });
77
77
  if (files.reduce((n, f) => n + f.data.byteLength, 0) > WORKSPACE_LIMITS.totalBytes) {
78
- throw invalid("Der Workspace im Paket ist größer als 25 MB.");
78
+ throw invalid("The workspace in the package is larger than 25 MB.");
79
79
  }
80
80
  return { manifest: readManifest(json(entries[manifestPath])), files };
81
81
  }
@@ -2,8 +2,8 @@ import { FIELD_WAYS, formatsFor, isDecidedField, shownFields, slotText, wizardLa
2
2
  import { and, count, desc, eq, gte, inArray, max, or, sql } from "drizzle-orm";
3
3
  import { canSpend, MICROS_PER_CREDIT } from "../credits/credits.js";
4
4
  import { db, schema } from "../db/client.js";
5
- import { answerAsk, unattended } from "../engine/asks.js";
6
- import { emitEvent, recentEvents, subscribe } from "../engine/events.js";
5
+ import { answerAsk } from "../engine/asks.js";
6
+ import { emitEvent, recentEvents, watchRun } from "../engine/events.js";
7
7
  import { cancel, createRun, goBack, NoCreditsError, pageContext, RunConflict, RunInputError, retry, reviewStep, submitPage, } from "../engine/runner.js";
8
8
  import { ModelUnavailableError } from "../model-errors.js";
9
9
  import { signedUrl } from "../secrets/signing.js";
@@ -25,6 +25,7 @@ export async function startTestRun(userId, wizardId, autopilot) {
25
25
  version: null,
26
26
  mode: "test",
27
27
  userId,
28
+ unattended: Boolean(autopilot),
28
29
  }).catch((err) => {
29
30
  throw err instanceof ModelUnavailableError ? new ServiceError("refused", err.message) : err;
30
31
  });
@@ -35,12 +36,10 @@ export async function startTestRun(userId, wizardId, autopilot) {
35
36
  }
36
37
  function fly(runId, answers, acceptReviews) {
37
38
  autopilots.add(runId);
38
- unattended.add(runId);
39
39
  let busy = false;
40
40
  let again = false;
41
41
  const land = () => {
42
42
  autopilots.delete(runId);
43
- unattended.delete(runId);
44
43
  unsubscribe();
45
44
  clearTimeout(timeout);
46
45
  };
@@ -89,7 +88,7 @@ function fly(runId, answers, acceptReviews) {
89
88
  busy = false;
90
89
  }
91
90
  };
92
- const unsubscribe = subscribe(runId, () => {
91
+ const unsubscribe = watchRun(runId, () => {
93
92
  void step();
94
93
  });
95
94
  const timeout = setTimeout(land, 30 * 60_000);
@@ -131,7 +130,7 @@ export async function waitRun(load, seconds) {
131
130
  let run = await load();
132
131
  while (moving(run) && Date.now() < deadline) {
133
132
  await new Promise((resolve) => {
134
- const unsubscribe = subscribe(run.id, () => {
133
+ const unsubscribe = watchRun(run.id, () => {
135
134
  unsubscribe();
136
135
  clearTimeout(timer);
137
136
  resolve();
@@ -150,7 +149,7 @@ async function waitWhileMoving(userId, runId, seconds, only) {
150
149
  let run = await ownedRun(userId, runId, only);
151
150
  while (moving(run) && Date.now() < deadline) {
152
151
  await new Promise((resolve) => {
153
- const unsubscribe = subscribe(runId, () => {
152
+ const unsubscribe = watchRun(runId, () => {
154
153
  unsubscribe();
155
154
  clearTimeout(timer);
156
155
  resolve();
@@ -422,7 +421,7 @@ export async function controlRun(userId, runId, action) {
422
421
  /** Answers what a running step asks: allow a change in a connected account, or skip it. */
423
422
  export async function answerRunAsk(userId, runId, askId, answer) {
424
423
  await ownedRun(userId, runId);
425
- if (!answerAsk(runId, askId, answer === "allow" ? { type: "done" } : { type: "skip" })) {
424
+ if (!(await answerAsk(runId, askId, answer === "allow" ? { type: "done" } : { type: "skip" }))) {
426
425
  throw new ServiceError("refused", "This question is no longer open.");
427
426
  }
428
427
  }
@@ -1,4 +1,4 @@
1
- import { and, count, eq, gte, inArray, or } from "drizzle-orm";
1
+ import { and, count, eq, gte, inArray, isNull, lt, or, sql } from "drizzle-orm";
2
2
  import { control, controlDb } from "../db/client.js";
3
3
  import { env } from "../env.js";
4
4
  import { currentTenant } from "./tenant.js";
@@ -108,16 +108,94 @@ export async function dropRuns(runIds) {
108
108
  .where(inArray(control.runIndex.runId, runIds.slice(i, i + 200)));
109
109
  }
110
110
  }
111
- /** Marks a run as working, so a restart finds it again. */
112
- export async function markRunActive(runId, active) {
113
- await controlDb.update(control.runIndex).set({ active }).where(eq(control.runIndex.runId, runId));
111
+ // --- the queue: which runner works on which run ---------------------------------
112
+ // `active` = the run wants a runner. `owner` = the one driving it, `seen` = its last heartbeat.
113
+ /** An owner silent this long has lost the run: another runner takes it. */
114
+ export const RUNNER_STALE_MS = 30_000;
115
+ /** Puts a run in line for a runner (again): active, owned by nobody. */
116
+ export async function wakeRun(runId) {
117
+ await controlDb
118
+ .update(control.runIndex)
119
+ .set({ active: true, owner: null, seen: null })
120
+ .where(eq(control.runIndex.runId, runId));
121
+ }
122
+ /** The run is done with runners for now: a page, a review or the end. */
123
+ export async function restRun(runId) {
124
+ await controlDb
125
+ .update(control.runIndex)
126
+ .set({ active: false, owner: null, seen: null })
127
+ .where(eq(control.runIndex.runId, runId));
128
+ }
129
+ /**
130
+ * Takes a run for this runner, in one statement: only while nobody (alive) holds it and the
131
+ * tenant's owned runs stay under its limit. False: someone else has it, or the tenant is at its
132
+ * limit — the run stays in line.
133
+ */
134
+ export async function claimRun(runId, tenantId, limit) {
135
+ const now = Date.now();
136
+ const stale = now - RUNNER_STALE_MS;
137
+ const result = await controlDb.run(sql `
138
+ UPDATE run_index SET owner = ${env.runner.id}, seen = ${now}
139
+ WHERE run_id = ${runId} AND active = 1
140
+ AND (owner IS NULL OR seen IS NULL OR seen < ${stale})
141
+ AND (SELECT count(*) FROM run_index
142
+ WHERE tenant_id = ${tenantId} AND owner IS NOT NULL AND seen >= ${stale}
143
+ AND run_id != ${runId}) < ${limit}`);
144
+ return result.rowsAffected > 0;
145
+ }
146
+ /** This runner still works on these runs. */
147
+ export async function heartbeatRuns(runIds) {
148
+ if (runIds.length) {
149
+ await controlDb
150
+ .update(control.runIndex)
151
+ .set({ seen: new Date() })
152
+ .where(and(eq(control.runIndex.owner, env.runner.id), inArray(control.runIndex.runId, runIds)));
153
+ }
114
154
  }
115
- /** The runs that were working when the process stopped, with their tenants. */
116
- export async function activeRuns() {
155
+ /** A runner that stops hands its runs back to the line; another takes them at once. */
156
+ export async function disownRuns() {
157
+ await controlDb
158
+ .update(control.runIndex)
159
+ .set({ owner: null, seen: null })
160
+ .where(eq(control.runIndex.owner, env.runner.id));
161
+ }
162
+ /** The runs in line: unowned, or whose owner fell silent. */
163
+ export async function waitingRuns() {
164
+ const stale = new Date(Date.now() - RUNNER_STALE_MS);
117
165
  return controlDb
118
166
  .select({ runId: control.runIndex.runId, tenantId: control.runIndex.tenantId })
119
167
  .from(control.runIndex)
120
- .where(eq(control.runIndex.active, true));
168
+ .where(and(eq(control.runIndex.active, true), or(isNull(control.runIndex.owner), isNull(control.runIndex.seen), lt(control.runIndex.seen, stale))))
169
+ .orderBy(control.runIndex.createdAt);
170
+ }
171
+ /** Where the runner holding a run is reached; null when none holds it or it named no address. */
172
+ export async function ownerUrl(runId) {
173
+ const row = await controlDb.query.runIndex.findFirst({
174
+ where: eq(control.runIndex.runId, runId),
175
+ });
176
+ if (!row?.owner || !row.seen || row.seen.getTime() < Date.now() - RUNNER_STALE_MS) {
177
+ return null;
178
+ }
179
+ const who = await controlDb.query.runner.findFirst({ where: eq(control.runner.id, row.owner) });
180
+ return who?.url || null;
181
+ }
182
+ /** This process reports as a runner: its address, and that it is alive. */
183
+ export async function registerRunner() {
184
+ const now = new Date();
185
+ await controlDb
186
+ .insert(control.runner)
187
+ .values({ id: env.runner.id, url: env.runner.url || null, seen: now })
188
+ .onConflictDoUpdate({
189
+ target: control.runner.id,
190
+ set: { url: env.runner.url || null, seen: now },
191
+ });
192
+ // Runners gone for a day are forgotten.
193
+ await controlDb
194
+ .delete(control.runner)
195
+ .where(lt(control.runner.seen, new Date(now.getTime() - 86_400_000)));
196
+ }
197
+ export async function forgetRunner() {
198
+ await controlDb.delete(control.runner).where(eq(control.runner.id, env.runner.id));
121
199
  }
122
200
  /** A visitor's runs are counted across every wizard of every tenant. */
123
201
  export async function visitorOverLimit(visitorId, ipHash) {
@@ -3,7 +3,7 @@ import { mkdirSync, openSync } from "node:fs";
3
3
  import { join } from "node:path";
4
4
  import { installedByScript, isCheckout, layout, packageRoot, packageVersion } from "./cli/home.js";
5
5
  const RELEASES_URL = process.env.ENGENTY_WIZARDS_RELEASES_URL?.trim() ||
6
- "https://api.github.com/repos/engenty/engenty-wizards/releases/latest";
6
+ "https://api.github.com/repos/engenty/wizards/releases/latest";
7
7
  /** How long an answer from GitHub holds, found or not, before the runtime asks again. */
8
8
  const CHECK_EVERY_MS = 60 * 60_000;
9
9
  /**
@@ -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,Gt as o,Mt as s,Tt as c,Wt as l,Yt as u,_t as d,ct as f,lt as p,mt as m,ot as h,rt as g,st as _,xt as v,yt as y}from"./ui-FW7ypPI6.js";import{$ as b,v as x}from"./index-nfRuCdVt.js";import{c as S,f as C}from"./settings-menu-BGfn4LJE.js";import{ReleaseNotes as w,loadReleases as T,releaseDate as E,releaseLabel as D}from"./ChangelogDialog-CgnnJj4G.js";var O=e(t(),1),k=[{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`}],A=[{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`}],j=e(n(),1),M=(e,...t)=>t.some(t=>t?.toLowerCase().includes(e));function N({name:e,homepage:t,version:n,license:r,description:i}){return(0,j.jsxs)(`li`,{className:`py-2.5`,children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,children:[t?(0,j.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,j.jsx)(l,{"aria-hidden":!0,className:`size-3 text-ink-4`})]}):(0,j.jsx)(`span`,{className:`font-medium text-[0.875rem] text-ink`,children:e}),n?(0,j.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:n}):null,(0,j.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:r})]}),i?(0,j.jsx)(`p`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:i}):null]})}function P({title:e,hint:t,children:n}){return(0,j.jsxs)(`section`,{className:`mt-6`,children:[(0,j.jsx)(`h3`,{className:`border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:e}),t?(0,j.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3`,children:t}):null,n]})}function F({credits:e}){return(0,j.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:e.map(e=>(0,j.jsx)(N,{name:e.name,homepage:e.homepage,license:e.license,description:e.description[v]},e.name))})}function I({label:e,packages:t}){return(0,j.jsxs)(`div`,{className:`mt-4`,children:[(0,j.jsx)(`h4`,{className:`font-medium text-[0.75rem] text-ink-3 tracking-wide`,children:e}),(0,j.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:t.map(e=>(0,j.jsx)(N,{...e},e.name))})]})}function L({active:e}){let[t,n]=(0,O.useState)(null),[r,o]=(0,O.useState)(``);(0,O.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,O.useEffect)(()=>{e||o(``)},[e]);let s=r.trim().toLowerCase(),c=e=>s?e.filter(e=>M(s,e.name,e.license,e.description.de,e.description.en)):e,l=e=>s?e.filter(e=>M(s,e.name,e.license,e.version)):e,u=c(k),d=c(A),f=t?[{id:`shared`,label:a(`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):[],h=u.length===0&&d.length===0&&f.length===0;return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`p`,{className:`mb-4 text-[0.875rem] text-ink-3`,children:a(`about.creditsHint`)}),(0,j.jsx)(p,{type:`search`,value:r,placeholder:a(`about.search`),onChange:e=>o(e.target.value)}),u.length>0?(0,j.jsx)(P,{title:a(`about.creditsProduct`),children:(0,j.jsx)(F,{credits:u})}):null,d.length>0?(0,j.jsx)(P,{title:a(`about.creditsBuiltWith`),children:(0,j.jsx)(F,{credits:d})}):null,t===null?(0,j.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,j.jsx)(m,{})}):f.length>0?(0,j.jsx)(P,{title:a(`about.creditsDeps`),hint:s?void 0:a(`about.creditsDepsHint`),children:f.map(e=>(0,j.jsx)(I,{label:e.label,packages:e.packages},e.id))}):null,t!==null&&h?(0,j.jsx)(_,{children:a(`about.noMatches`)}):null]})}var R=[`new`,`earlier`,`credits`],z=e=>a(e===`new`?`about.tab.new`:e===`earlier`?`about.tab.earlier`:`about.credits`),B=e=>e===1?a(`about.change`):a(`about.changes`,{n:e});function V({open:e,onClose:t,me:n}){let i=n?.mode===`local`,{status:p,data:_,latest:v,check:k,apply:A,busy:M,progress:N}=x(i&&e),[P,F]=(0,O.useState)(null),[I,V]=(0,O.useState)(`new`),H=C(R.indexOf(I)),U=_?.newer&&v?v:b;(0,O.useEffect)(()=>{if(!e)return;let t=!1;return F(null),T(U===`0.2.57`?void 0:U).then(e=>{t||F(e)}),()=>{t=!0}},[e,U]);let W=P?.find(e=>e.version===`v${U}`)??P?.[0]??null,G=P?.filter(e=>e!==W)??[],K=i?_?.kind??null:`cloud`,q=_?.checkedAt?new Date(_.checkedAt).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`}):null;return(0,j.jsxs)(h,{open:e,onClose:t,wide:!0,height:`tall`,children:[(0,j.jsx)(`div`,{className:`-mt-2 -mr-2 sticky top-0 z-10 flex h-0 justify-end`,children:(0,j.jsx)(f,{label:a(`common.close`),onClick:t,children:(0,j.jsx)(c,{className:`size-4`})})}),(0,j.jsxs)(`div`,{className:`flex flex-col items-center pt-4 text-center`,children:[(0,j.jsx)(r,{size:96}),(0,j.jsxs)(`div`,{className:`mt-4 font-display font-semibold text-[1.5rem] tracking-tight`,children:[`engenty`,(0,j.jsx)(`span`,{className:`text-ember`,children:`.`}),(0,j.jsx)(`span`,{className:`ml-1.5 font-normal text-ink-3`,children:`wizards`})]}),(0,j.jsxs)(`div`,{className:`mt-1 text-[0.9375rem] text-ink-3 tabular-nums`,children:[a(`about.version`,{v:b}),K?` · ${a(`about.kind.${K}`)}`:``]})]}),i?(0,j.jsxs)(`div`,{className:`mt-5 flex flex-col items-center gap-3 text-center text-[0.875rem] text-ink-2`,children:[p.isPending||k.isPending?(0,j.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,j.jsx)(m,{className:`size-4 text-ember-strong`}),a(`about.update.checking`)]}):N?(0,j.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[M?(0,j.jsx)(m,{className:`size-4 text-ember-strong`}):null,N]}):_?.newer&&v?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2.5 font-medium text-ink`,children:[(0,j.jsx)(o,{className:`size-4 shrink-0 text-ember-strong`}),a(`about.update.available`,{v})]}),_.canApply?null:(0,j.jsx)(`p`,{className:`text-ink-3`,children:a(`about.update.manual`)})]}):_?.enabled?_.latest===null?(0,j.jsx)(`p`,{children:a(`about.update.unknown`)}):(0,j.jsxs)(`p`,{children:[a(`about.update.upToDate`),q?(0,j.jsxs)(`span`,{className:`text-ink-4`,children:[` `,`· `,a(`about.update.checkedAt`,{when:q})]}):null]}):(0,j.jsx)(`p`,{children:a(`about.update.off`)}),M||p.isPending?null:(0,j.jsxs)(`div`,{className:`flex flex-wrap justify-center gap-2`,children:[_?.newer&&_.canApply&&_.applying!==`running`?(0,j.jsxs)(g,{size:`sm`,disabled:A.isPending,onClick:()=>A.mutate(),children:[(0,j.jsx)(o,{className:`size-4`}),` `,a(`about.update.install`)]}):null,_?.newer&&_.url?(0,j.jsxs)(g,{size:`sm`,variant:`secondary`,onClick:()=>window.open(_.url??``,`_blank`),children:[a(`about.update.release`),` `,(0,j.jsx)(l,{className:`size-4`})]}):null,_?.enabled===!1?null:(0,j.jsxs)(g,{size:`sm`,variant:`secondary`,disabled:k.isPending,onClick:()=>k.mutate(),children:[(0,j.jsx)(s,{className:y(`size-4`,k.isPending&&`animate-spin`)}),` `,a(`about.update.check`)]})]})]}):null,(0,j.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,j.jsx)(d,{value:I,onChange:V,options:R.map(e=>({id:e,label:z(e)})),label:a(`about.title`)})}),(0,j.jsxs)(`div`,{className:y(`mt-5`,S(H)),children:[I===`new`?P===null?(0,j.jsx)(`div`,{className:`flex justify-center py-6 text-ink-3`,children:(0,j.jsx)(m,{})}):W?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:[D(W),(0,j.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:E(W)})]}),(0,j.jsx)(`div`,{className:`mt-3`,children:(0,j.jsx)(w,{release:W})})]}):(0,j.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:a(`about.changelogEmpty`)}):null,I===`earlier`?(0,j.jsx)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:G.map(e=>(0,j.jsxs)(`details`,{className:`group/r py-2`,children:[(0,j.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-baseline gap-3 text-[0.875rem] [&::-webkit-details-marker]:hidden`,children:[(0,j.jsx)(u,{className:`size-3.5 shrink-0 self-center text-ink-4 transition group-open/r:rotate-90`}),(0,j.jsx)(`span`,{className:`font-medium text-ink tabular-nums`,children:D(e)}),(0,j.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:E(e)}),(0,j.jsx)(`span`,{className:`ml-auto text-[0.8125rem] text-ink-4`,children:B(e.commits.length)})]}),(0,j.jsx)(`div`,{className:`mt-2 pl-6`,children:(0,j.jsx)(w,{release:e})})]},e.version??`unreleased`))}):null,I===`credits`?(0,j.jsx)(L,{active:!0}):null]},I)]})}export{V 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-mkL5nF_f.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-Bg5ZBu5p.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{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-B1jhC7Fv.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};