@engenty/wizards-runtime 0.17.0 → 0.17.2

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 (149) hide show
  1. package/apps/runtime/dist/app.js +2 -0
  2. package/apps/runtime/dist/broker/account.js +20 -1
  3. package/apps/runtime/dist/broker/call.js +116 -20
  4. package/apps/runtime/dist/broker/host.js +8 -2
  5. package/apps/runtime/dist/broker/index.js +3 -2
  6. package/apps/runtime/dist/broker/log.js +149 -14
  7. package/apps/runtime/dist/broker/over.js +38 -0
  8. package/apps/runtime/dist/broker/rights.js +192 -0
  9. package/apps/runtime/dist/broker/rwx.js +295 -51
  10. package/apps/runtime/dist/broker/send.js +25 -12
  11. package/apps/runtime/dist/bundles/discover.js +133 -0
  12. package/apps/runtime/dist/bundles/fetch.js +119 -0
  13. package/apps/runtime/dist/bundles/index.js +621 -0
  14. package/apps/runtime/dist/bundles/read.js +607 -0
  15. package/apps/runtime/dist/connectors/external.js +540 -61
  16. package/apps/runtime/dist/connectors/person-sign-ins.js +1 -0
  17. package/apps/runtime/dist/connectors/reload.js +73 -0
  18. package/apps/runtime/dist/connectors/space-connections.js +73 -6
  19. package/apps/runtime/dist/db/migrations/tenant/0058_mcp_state_across_roles.sql +26 -0
  20. package/apps/runtime/dist/db/migrations/tenant/0059_space_connection_paused.sql +2 -0
  21. package/apps/runtime/dist/db/migrations/tenant/0060_space_bundle.sql +21 -0
  22. package/apps/runtime/dist/db/migrations/tenant/0061_space_connection_limits.sql +2 -0
  23. package/apps/runtime/dist/db/migrations/tenant/meta/0058_snapshot.json +6696 -0
  24. package/apps/runtime/dist/db/migrations/tenant/meta/0059_snapshot.json +6710 -0
  25. package/apps/runtime/dist/db/migrations/tenant/meta/0060_snapshot.json +6857 -0
  26. package/apps/runtime/dist/db/migrations/tenant/meta/0061_snapshot.json +6871 -0
  27. package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +28 -0
  28. package/apps/runtime/dist/db/schema.js +81 -3
  29. package/apps/runtime/dist/docs/dev/broker.md +312 -32
  30. package/apps/runtime/dist/docs/dev/skills.md +8 -1
  31. package/apps/runtime/dist/docs/user-guide/capabilities.md +127 -5
  32. package/apps/runtime/dist/docs/user-guide/connectors.md +103 -5
  33. package/apps/runtime/dist/docs/user-guide/protocol.md +15 -4
  34. package/apps/runtime/dist/docs/user-guide/skills.md +11 -1
  35. package/apps/runtime/dist/docs/user-guide/test-and-share.md +1 -1
  36. package/apps/runtime/dist/elements/caller.js +2 -2
  37. package/apps/runtime/dist/engenty/connections-external/build-connector.js +23 -8
  38. package/apps/runtime/dist/engenty/connections-external/import-service.js +18 -9
  39. package/apps/runtime/dist/engenty/connections-external/importer/classify.js +12 -0
  40. package/apps/runtime/dist/engenty/connections-external/invoke/http-invoker.js +1 -0
  41. package/apps/runtime/dist/engenty/connections-external/net/guarded-fetch.js +6 -3
  42. package/apps/runtime/dist/engenty/connections-sdk/oauth2.js +2 -2
  43. package/apps/runtime/dist/engenty/shims/web-ingest.js +64 -0
  44. package/apps/runtime/dist/engine/resources.js +15 -6
  45. package/apps/runtime/dist/engine/runner.js +2 -1
  46. package/apps/runtime/dist/env.js +2 -0
  47. package/apps/runtime/dist/index.js +11 -2
  48. package/apps/runtime/dist/mcp/handler.js +2 -2
  49. package/apps/runtime/dist/mcp/seen.js +71 -51
  50. package/apps/runtime/dist/mcp/tools.js +5 -1
  51. package/apps/runtime/dist/prompts/mcp.md +1 -1
  52. package/apps/runtime/dist/prompts/tools.md +16 -0
  53. package/apps/runtime/dist/routes/broker.js +1 -1
  54. package/apps/runtime/dist/routes/bundles.js +91 -0
  55. package/apps/runtime/dist/routes/connections.js +14 -3
  56. package/apps/runtime/dist/routes/discover.js +1 -0
  57. package/apps/runtime/dist/routes/rules.js +53 -9
  58. package/apps/runtime/dist/routes/studio.js +23 -18
  59. package/apps/runtime/dist/services/cloud.js +2 -0
  60. package/apps/runtime/dist/services/discover.js +9 -3
  61. package/apps/runtime/dist/services/draft-events.js +79 -6
  62. package/apps/runtime/dist/services/files.js +2 -2
  63. package/apps/runtime/dist/services/skills.js +61 -5
  64. package/apps/runtime/dist/services/space-index.js +113 -11
  65. package/apps/runtime/dist/services/synced-spaces.js +5 -1
  66. package/apps/runtime/dist/services/wizards.js +48 -2
  67. package/apps/runtime/dist/sharing/jobs.js +6 -2
  68. package/apps/runtime/dist/sync/records.js +6 -1
  69. package/apps/runtime/dist/texts.js +36 -1
  70. package/apps/runtime/dist/tools/connections.js +8 -0
  71. package/apps/runtime/dist/tools/connector.js +13 -1
  72. package/apps/runtime/dist/tools/index.js +8 -3
  73. package/apps/runtime/dist/tools/skills.js +11 -1
  74. package/apps/web/dist/assets/{AboutDialog-B2Xmxyj4.js → AboutDialog-NzB-GEj_.js} +1 -1
  75. package/apps/web/dist/assets/{BlockEditor-D0HoUSih.js → BlockEditor-HyDf8fOb.js} +1 -1
  76. package/apps/web/dist/assets/Bundle-B0Bhs0By.js +1 -0
  77. package/apps/web/dist/assets/CapabilitiesPage-CQSaMsWK.js +2 -0
  78. package/apps/web/dist/assets/{ChangelogDialog-BIrJbAKi.js → ChangelogDialog-Ngxuqubx.js} +1 -1
  79. package/apps/web/dist/assets/{CodeEditor-DUVcXI5P.js → CodeEditor-C2LBf4pS.js} +1 -1
  80. package/apps/web/dist/assets/EditorPage-Dysvvadu.js +3 -0
  81. package/apps/web/dist/assets/{FlowPreview-BIag8_Be.js → FlowPreview-CGfSaeYu.js} +1 -1
  82. package/apps/web/dist/assets/LangSwitch-B7UQlGh5.js +1 -0
  83. package/apps/web/dist/assets/Marketplace-BkIxd1PW.js +2 -0
  84. package/apps/web/dist/assets/{NewWizardChannels-DI3SQ4iS.js → NewWizardChannels-BWLaVFld.js} +1 -1
  85. package/apps/web/dist/assets/NewWizardPage-BpRd8tDF.js +7 -0
  86. package/apps/web/dist/assets/OnboardingPage-ScEcQcR0.js +1 -0
  87. package/apps/web/dist/assets/PreviewPane-CaC1FYxZ.js +7 -0
  88. package/apps/web/dist/assets/ProtocolSection-CILRCYLD.js +1 -0
  89. package/apps/web/dist/assets/PublicRunner-DHX431Pr.js +1 -0
  90. package/apps/web/dist/assets/{ReadOnly-CWf5x74a.js → ReadOnly-DqS1UDQs.js} +1 -1
  91. package/apps/web/dist/assets/SettingsPage-Dp2-rHXu.js +2 -0
  92. package/apps/web/dist/assets/SetupPage-mzMLQcD5.js +1 -0
  93. package/apps/web/dist/assets/SharePage-CBDgqEH7.js +1 -0
  94. package/apps/web/dist/assets/SkillEditor-Cf6FqkkU.js +1 -0
  95. package/apps/web/dist/assets/{Skills-CN4QE7Kx.js → Skills-DqV5Oqqu.js} +5 -5
  96. package/apps/web/dist/assets/SpacePage-C3SXe2hs.js +2 -0
  97. package/apps/web/dist/assets/{UpdateCheck-QhBI3rlQ.js → UpdateCheck-B51jMIhp.js} +2 -2
  98. package/apps/web/dist/assets/brand-CG35IRgr.js +2 -0
  99. package/apps/web/dist/assets/changelog-DN6sziTl.js +1 -0
  100. package/apps/web/dist/assets/{code-editor-DkPo1C-L.js → code-editor-Bsyy7cuT.js} +2 -2
  101. package/apps/web/dist/assets/{host-D6H6Z9Jp.js → host-DaDyLfqT.js} +16 -16
  102. package/apps/web/dist/assets/i18n-CyrHWeGk.js +55 -0
  103. package/apps/web/dist/assets/index-Db9JthZr.css +1 -0
  104. package/apps/web/dist/assets/index-LjwVRoki.js +10 -0
  105. package/apps/web/dist/assets/minus-BpYkOkYw.js +1 -0
  106. package/apps/web/dist/assets/plug-De3mHDFV.js +1 -0
  107. package/apps/web/dist/assets/{read-aloud-CnFwDSGD.js → read-aloud-DCTouK7J.js} +1 -1
  108. package/apps/web/dist/assets/{runners-0sTPbWzr.js → runners-DtiBHvG7.js} +1 -1
  109. package/apps/web/dist/assets/session-DKGZUy6h.js +1 -0
  110. package/apps/web/dist/assets/{theme-CkNTe-_Z.js → theme-Bcj8TXQr.js} +2 -2
  111. package/apps/web/dist/assets/{ui-DAk_vjrL.js → ui-C6vSmisV.js} +1 -1
  112. package/apps/web/dist/assets/{useMutation-isHfB33W.js → useMutation-B8hJ5Z6N.js} +1 -1
  113. package/apps/web/dist/assets/{viewers-ijNZHJFG.js → viewers-b9FdC42r.js} +2 -2
  114. package/apps/web/dist/assets/{volume-2-BqlBtCIJ.js → volume-2-B1roRk6x.js} +1 -1
  115. package/apps/web/dist/index.html +15 -13
  116. package/apps/web/dist/mcp/flow.html +2 -2
  117. package/node_modules/@engenty/wizards-shared/dist/bundles.d.ts +219 -0
  118. package/node_modules/@engenty/wizards-shared/dist/bundles.js +19 -0
  119. package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +105 -4
  120. package/node_modules/@engenty/wizards-shared/dist/connectors.js +6 -0
  121. package/node_modules/@engenty/wizards-shared/dist/discover.d.ts +28 -1
  122. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +8 -0
  123. package/node_modules/@engenty/wizards-shared/dist/run.js +16 -0
  124. package/node_modules/@engenty/wizards-shared/dist/rwx.d.ts +84 -1
  125. package/node_modules/@engenty/wizards-shared/dist/rwx.js +69 -1
  126. package/node_modules/@engenty/wizards-shared/dist/skills.d.ts +20 -3
  127. package/node_modules/@engenty/wizards-shared/dist/skills.js +5 -2
  128. package/package.json +1 -1
  129. package/plugin/.claude-plugin/plugin.json +1 -1
  130. package/plugin/plugin.json +1 -1
  131. package/apps/web/dist/assets/CapabilitiesPage-C1th2cZE.js +0 -2
  132. package/apps/web/dist/assets/EditorPage-56sIqEfF.js +0 -3
  133. package/apps/web/dist/assets/LangSwitch-CJ00IgaO.js +0 -1
  134. package/apps/web/dist/assets/Marketplace-D7-ot9Dz.js +0 -2
  135. package/apps/web/dist/assets/NewWizardPage-CytheHxX.js +0 -7
  136. package/apps/web/dist/assets/OnboardingPage-_91Pa8Ad.js +0 -1
  137. package/apps/web/dist/assets/PreviewPane-BDsYm-_K.js +0 -7
  138. package/apps/web/dist/assets/ProtocolSection-D_zaxHEL.js +0 -1
  139. package/apps/web/dist/assets/PublicRunner-CEgXSk3r.js +0 -1
  140. package/apps/web/dist/assets/SettingsPage-Dr8SDk-L.js +0 -2
  141. package/apps/web/dist/assets/SetupPage-B68n0l4I.js +0 -1
  142. package/apps/web/dist/assets/SharePage-DfznN7ar.js +0 -1
  143. package/apps/web/dist/assets/SkillEditor-BIcIczRc.js +0 -1
  144. package/apps/web/dist/assets/SpacePage-DiVTwhnJ.js +0 -2
  145. package/apps/web/dist/assets/changelog-a_CuplMX.js +0 -1
  146. package/apps/web/dist/assets/i18n-BaPKbQ1s.js +0 -55
  147. package/apps/web/dist/assets/index-CCUG6Vnh.css +0 -1
  148. package/apps/web/dist/assets/index-De0Wb42y.js +0 -10
  149. package/apps/web/dist/assets/session-BMiUrqHg.js +0 -2
@@ -5,6 +5,7 @@ import { and, asc, eq, gt, inArray, isNotNull, isNull, ne, notInArray, or, sql,
5
5
  import { brokerOn, forbidden, pageResources, readable, readsEverything, tableResources, } from "../broker/rwx.js";
6
6
  import { db, schema, withTenant } from "../db/client.js";
7
7
  import { createSearchChunks } from "../engenty/search-index/chunks.js";
8
+ import { env } from "../env.js";
8
9
  import { currentFeatures } from "../features.js";
9
10
  import { getBlob, putBlob } from "../files/blobs.js";
10
11
  import { jpegOf, MAX_PAGE_PICTURES, pdfPages } from "../files/pictures.js";
@@ -35,13 +36,18 @@ const QUICK_MS = 800;
35
36
  /** Any other search waits this long for it: the embedding model may be busy with the index. */
36
37
  const VECTOR_MS = 15_000;
37
38
  const vectorBytes = (v) => Buffer.from(new Float32Array(v).buffer);
38
- async function embed(texts) {
39
+ async function embed(texts, maxRetries) {
39
40
  const resolved = await embeddingModel();
40
41
  if (!resolved || !texts.length) {
41
42
  return null;
42
43
  }
43
44
  await searchesFirst();
44
- const result = await embedMany({ model: resolved.model, values: texts, maxParallelCalls: 4 });
45
+ const result = await embedMany({
46
+ model: resolved.model,
47
+ values: texts,
48
+ maxParallelCalls: 4,
49
+ maxRetries,
50
+ });
45
51
  return { vectors: result.embeddings.map((e) => Array.from(e)), model: resolved.ref };
46
52
  }
47
53
  export async function dropIndex(fileId) {
@@ -491,9 +497,22 @@ export async function flushIndex() {
491
497
  // make and embed, and the index of a page someone types in must not wait for it. A text's comes
492
498
  // with its unit, unless the model failed, none was set up then, or another one is now: on a
493
499
  // Manage-App's runtime the binding changes without a word to the runtime. Tenant after tenant,
494
- // units without a vector of the embedding model at hand.
500
+ // units without a vector of the embedding model at hand. Only one process of a runtime does the
501
+ // texts: two would embed, and book, every batch twice.
495
502
  const vectorsWaiting = new Set();
496
503
  let vectorsRunning = null;
504
+ /** After a round the model failed in: twice as long each time, up to the longest. */
505
+ const VECTORS_PAUSE_MS = 20 * 60_000;
506
+ const VECTORS_PAUSE_LONGEST_MS = 2 * 60 * 60_000;
507
+ let vectorsFailedRounds = 0;
508
+ let vectorsPausedUntil = 0;
509
+ /** No tenant's round until later: they all share the model, and a failing call holds it busy. */
510
+ function pauseVectors(what, err) {
511
+ const pause = Math.min(VECTORS_PAUSE_MS * 2 ** vectorsFailedRounds, VECTORS_PAUSE_LONGEST_MS);
512
+ vectorsFailedRounds++;
513
+ vectorsPausedUntil = Date.now() + pause;
514
+ console.error(`[space-index] embedding ${what} failed, again in ${pause / 60_000} min:`, err.message);
515
+ }
497
516
  /** Gives the units of the tenant at hand the vectors they lack, soon. */
498
517
  export function queueVectors() {
499
518
  vectorsWaiting.add(currentTenant());
@@ -515,8 +534,35 @@ export function queueVectors() {
515
534
  }
516
535
  /** Texts sent at once: a search's question waits behind them in a busy Ollama. */
517
536
  const TEXT_BATCH = 32;
537
+ /**
538
+ * And their characters. At 16,000 the gateway's Ollama on four cores took minutes over a call, and
539
+ * a search's question sent meanwhile took 45 s: it waits 15 s at most, then finds words only.
540
+ */
541
+ const TEXT_BATCH_CHARS = 4000;
542
+ /** Leaves the model free as long as `work` held it: the sweep takes half its time at most. */
543
+ async function leavingRoom(work) {
544
+ const started = Date.now();
545
+ try {
546
+ return await work();
547
+ }
548
+ finally {
549
+ await new Promise((rest) => setTimeout(rest, Date.now() - started));
550
+ }
551
+ }
552
+ /** As many of `units` as go in one call: one at least, however long. */
553
+ function textBatch(units) {
554
+ let chars = 0;
555
+ const batch = units.filter((u) => {
556
+ chars += u.text.length;
557
+ return chars <= TEXT_BATCH_CHARS;
558
+ });
559
+ return batch.length ? batch : units.slice(0, 1);
560
+ }
518
561
  /** The vectors of the text units that lack one of the model at hand. */
519
562
  async function embedTexts() {
563
+ if (!env.serves.vectors || Date.now() < vectorsPausedUntil) {
564
+ return;
565
+ }
520
566
  const resolved = await embeddingModel().catch(() => null);
521
567
  if (!resolved) {
522
568
  return;
@@ -524,21 +570,24 @@ async function embedTexts() {
524
570
  // Past a batch that failed: the next round tries it again.
525
571
  let after = 0;
526
572
  let inRow = 0;
573
+ let failure = null;
527
574
  const started = Date.now();
528
575
  let done = 0;
529
576
  for (;;) {
530
- const todo = await db
577
+ const units = await db
531
578
  .select({ id: schema.spaceChunk.id, text: schema.spaceChunk.text })
532
579
  .from(schema.spaceChunk)
533
580
  .where(and(isNull(schema.spaceChunk.kind), gt(schema.spaceChunk.id, after), or(isNull(schema.spaceChunk.model), ne(schema.spaceChunk.model, resolved.ref))))
534
581
  .orderBy(asc(schema.spaceChunk.id))
535
582
  .limit(TEXT_BATCH);
536
- if (!todo.length) {
583
+ if (!units.length) {
537
584
  break;
538
585
  }
586
+ const todo = textBatch(units);
539
587
  after = todo[todo.length - 1].id;
540
588
  try {
541
- const embedded = await embed(todo.map((u) => u.text));
589
+ // No retries: a call that timed out still holds the model, and the next round comes anyway.
590
+ const embedded = await leavingRoom(() => embed(todo.map((u) => u.text), 0));
542
591
  if (!embedded) {
543
592
  break;
544
593
  }
@@ -553,13 +602,20 @@ async function embedTexts() {
553
602
  inRow = 0;
554
603
  }
555
604
  catch (err) {
556
- // The model is not there or not working: the next round tries again.
605
+ // The model is not there or not working: a later round tries again.
606
+ failure = err;
557
607
  if (++inRow >= 3) {
558
- console.error("[space-index] embedding texts failed", err.message);
559
608
  break;
560
609
  }
561
610
  }
562
611
  }
612
+ if (failure) {
613
+ pauseVectors("texts", failure);
614
+ }
615
+ else if (done) {
616
+ vectorsFailedRounds = 0;
617
+ vectorsPausedUntil = 0;
618
+ }
563
619
  if (done) {
564
620
  console.log(`[space-index] embedded ${done} texts with ${resolved.ref} in ${Math.round((Date.now() - started) / 1000)} s`);
565
621
  }
@@ -575,6 +631,9 @@ async function picturesOf(hash, pdf) {
575
631
  : new Map([[0, await jpegOf(data)]]);
576
632
  }
577
633
  async function embedPictures() {
634
+ if (Date.now() < vectorsPausedUntil) {
635
+ return;
636
+ }
578
637
  const resolved = await embeddingModel().catch(() => null);
579
638
  const embedImage = resolved?.embedImage;
580
639
  if (!(resolved && embedImage)) {
@@ -612,7 +671,7 @@ async function embedPictures() {
612
671
  continue;
613
672
  }
614
673
  await searchesFirst();
615
- const vector = await embedImage(jpeg);
674
+ const vector = await leavingRoom(() => embedImage(jpeg));
616
675
  await db
617
676
  .update(schema.spaceChunk)
618
677
  .set({ embedding: vectorBytes(vector), model: resolved.ref })
@@ -626,6 +685,7 @@ async function embedPictures() {
626
685
  failed.add(fileId);
627
686
  // The model is not there or not working: the next start, or the next picture, tries again.
628
687
  if (++inRow >= 3) {
688
+ pauseVectors("pictures", err);
629
689
  break;
630
690
  }
631
691
  }
@@ -781,6 +841,47 @@ async function readableUnits(spaceId, who, units) {
781
841
  return Boolean(u.plugin);
782
842
  };
783
843
  }
844
+ /**
845
+ * How many of a filter's items `who` may read: a page or a file by its own rule, a table and its
846
+ * rows by the table's, a mounted file where they may use its mount. What a search says its
847
+ * `where` left, so the number never counts what its caller cannot see.
848
+ */
849
+ async function readableSize(spaceId, who, filter, mounts) {
850
+ if (!(await brokerOn())) {
851
+ return filter.size;
852
+ }
853
+ const rowsOf = new Map();
854
+ const rows = [...filter.rows];
855
+ for (let i = 0; i < rows.length; i += 500) {
856
+ for (const r of await db.query.spaceTableRow.findMany({
857
+ where: inArray(schema.spaceTableRow.id, rows.slice(i, i + 500)),
858
+ columns: { tableId: true },
859
+ })) {
860
+ rowsOf.set(r.tableId, (rowsOf.get(r.tableId) ?? 0) + 1);
861
+ }
862
+ }
863
+ const [pages, files, tables] = await Promise.all([
864
+ pageResources([...filter.pages]).then((r) => readable(spaceId, who, r)),
865
+ readable(spaceId, who, [...filter.files].map((id) => ({ kind: "document", id }))),
866
+ tableResources([...new Set([...filter.tables, ...rowsOf.keys()])]).then((r) => readable(spaceId, who, r)),
867
+ ]);
868
+ const usable = new Set(mounts.map((m) => m.id));
869
+ let mounted = 0;
870
+ const inMounts = [...filter.mounted];
871
+ for (let i = 0; usable.size && i < inMounts.length; i += 500) {
872
+ for (const f of await db.query.spaceMountFile.findMany({
873
+ where: inArray(schema.spaceMountFile.id, inMounts.slice(i, i + 500)),
874
+ columns: { mountId: true },
875
+ })) {
876
+ mounted += usable.has(f.mountId) ? 1 : 0;
877
+ }
878
+ }
879
+ return ([...filter.pages].filter((id) => pages.has(id)).length +
880
+ [...filter.files].filter((id) => files.has(id)).length +
881
+ [...filter.tables].filter((id) => tables.has(id)).length +
882
+ [...rowsOf].reduce((n, [table, count]) => n + (tables.has(table) ? count : 0), 0) +
883
+ mounted);
884
+ }
784
885
  /**
785
886
  * Searches Knowledge for `who`: items whose categories pass `where` and that they may read, then
786
887
  * the units the keywords, the trigrams and the vectors rank best, merged by rank (RRF), then the
@@ -836,6 +937,7 @@ export async function searchKnowledge(spaceId, query, opts = {}) {
836
937
  }
837
938
  // The mounts of Dateien the caller may use: their words and their vectors, beside Knowledge's.
838
939
  const mounts = await usableMounts(spaceId, opts.who ?? []);
940
+ const left = filter ? await readableSize(spaceId, opts.who ?? [], filter, mounts) : null;
839
941
  const mounted = filter ? [...filter.mounted] : null;
840
942
  if (mounts.length && !(mounted && !mounted.length)) {
841
943
  const inMounts = and(sql `u.mount_id IN (${sql.join(mounts.map((m) => sql `${m.id}`), sql `, `)})`, mounted && mounted.length <= IN_LIMIT
@@ -878,7 +980,7 @@ export async function searchKnowledge(spaceId, query, opts = {}) {
878
980
  hits: [],
879
981
  candidates: 0,
880
982
  checked: false,
881
- filtered: filter?.size ?? null,
983
+ filtered: left,
882
984
  hidden: [],
883
985
  late: embedded === undefined,
884
986
  };
@@ -943,7 +1045,7 @@ export async function searchKnowledge(spaceId, query, opts = {}) {
943
1045
  hits,
944
1046
  candidates: candidates.length,
945
1047
  checked: judged !== null,
946
- filtered: filter?.size ?? null,
1048
+ filtered: left,
947
1049
  hidden,
948
1050
  late: embedded === undefined,
949
1051
  };
@@ -69,6 +69,8 @@ export const syncWizardSchema = z.object({
69
69
  .default([]),
70
70
  shareEnabled: z.boolean().default(true),
71
71
  dailyRunLimit: z.number().int().min(1).max(10_000).optional(),
72
+ /** The mails and posts its guests' runs send per day; left out by an install from before it sent one. */
73
+ dailyMailLimit: z.number().int().min(0).max(10_000).optional(),
72
74
  /** The install's themes the wizard names; the cloud keeps them as the install has them. */
73
75
  themes: z.array(themeSchema).max(MAX_WIZARD_THEMES).default([]),
74
76
  });
@@ -76,6 +78,7 @@ export const syncSettingsSchema = z.object({
76
78
  shareEnabled: z.boolean().optional(),
77
79
  translate: z.boolean().optional(),
78
80
  dailyRunLimit: z.number().int().min(1).max(10_000).optional(),
81
+ dailyMailLimit: z.number().int().min(0).max(10_000).optional(),
79
82
  });
80
83
  export const checkSchema = z.object({
81
84
  definition: z.unknown(),
@@ -271,6 +274,7 @@ export async function syncWizard(rawSpaceId, rawWizardId, input) {
271
274
  draft,
272
275
  shareEnabled: input.shareEnabled,
273
276
  ...(input.dailyRunLimit ? { dailyRunLimit: input.dailyRunLimit } : {}),
277
+ ...(input.dailyMailLimit !== undefined ? { dailyMailLimit: input.dailyMailLimit } : {}),
274
278
  };
275
279
  if (!existing) {
276
280
  await requireWizardRoom(spaceId);
@@ -323,7 +327,7 @@ export async function syncWizard(rawSpaceId, rawWizardId, input) {
323
327
  // The public link lives in the control database, outside the transaction: set on every
324
328
  // sync, so one that failed to get there once is there after the next.
325
329
  await putLink(row.shareToken, "wizard", wizardId);
326
- emitDraftChanged({
330
+ await emitDraftChanged({
327
331
  wizardId,
328
332
  kind: "draft",
329
333
  revision: row.revision,
@@ -4,6 +4,7 @@ import { note } from "@engenty/wizards-shared/run";
4
4
  import { and, desc, eq, sql } from "drizzle-orm";
5
5
  import { nanoid } from "nanoid";
6
6
  import { applyOps, OpError } from "../authoring/ops.js";
7
+ import { decide, kindOf } from "../broker/index.js";
7
8
  import { listConnectors, resolveConnector } from "../connectors/external.js";
8
9
  import { listSpaceConnections } from "../connectors/space-connections.js";
9
10
  import { db, schema } from "../db/client.js";
@@ -233,6 +234,49 @@ async function spaceConnectionIssues(spaceId, draft) {
233
234
  }
234
235
  return issues;
235
236
  }
237
+ /**
238
+ * The fixed steps of a draft that fail in a run as the space's rules are now
239
+ * (docs/plans/capabilities-next.md, 2b): a `call` on a connection of the space whose rule for
240
+ * that kind of action is „Mit Freigabe“ asks the space's admins, and nothing in a run waits for
241
+ * them. The broker's own decision says so, read from the rule as it is: the warning is gone once
242
+ * the rule says „Erlaubt“, and a wizard's own connection or a read never has one. No issue: the
243
+ * wizard saves and publishes.
244
+ */
245
+ export async function stepWarnings(spaceId, draft) {
246
+ const fixed = draft.steps.filter((s) => s.type === "agent" && s.call && "connection" in s.call);
247
+ const ofSpace = new Map((draft.connections ?? []).flatMap((c) => c.spaceConnection ? [[c.id, c.spaceConnection]] : []));
248
+ if (!fixed.some((step) => ofSpace.has(step.call.connection))) {
249
+ return [];
250
+ }
251
+ const rows = await listSpaceConnections(spaceId);
252
+ const warnings = [];
253
+ for (const step of fixed) {
254
+ const row = rows.find((r) => r.id === ofSpace.get(step.call.connection));
255
+ const connector = row ? (await resolveConnector(spaceId, row.connectorId))?.connector : null;
256
+ const action = connector?.actions.find((a) => a.id === step.call.action);
257
+ if (!(row && connector && action)) {
258
+ continue;
259
+ }
260
+ const kind = kindOf(action.group);
261
+ // As the step of an admin's run: in every audience, so only the rule speaks.
262
+ const decision = decide({
263
+ who: { kind: "step", for: { kind: "admin" } },
264
+ where: {},
265
+ connection: { kind: "space_connection", row, connector },
266
+ actionId: action.id,
267
+ kind,
268
+ });
269
+ if (decision.outcome === "ask" && decision.admins) {
270
+ warnings.push({
271
+ stepId: step.id,
272
+ kind: "needs_approval",
273
+ connection: { id: row.id, name: row.name },
274
+ action: { id: action.id, kind },
275
+ });
276
+ }
277
+ }
278
+ return warnings;
279
+ }
236
280
  /** Everything wrong with a draft: its structure, its workspace files, its space's connectors and plugins. */
237
281
  export async function checkDraft(spaceId, draft, files) {
238
282
  return [
@@ -256,6 +300,8 @@ export async function wizardState(w) {
256
300
  draft: w.draft,
257
301
  files,
258
302
  issues: await checkDraft(w.spaceId, w.draft, files.map((f) => f.path)),
303
+ /** Steps that save and publish and fail in a run as the space's rules are now. */
304
+ warnings: await stepWarnings(w.spaceId, w.draft),
259
305
  dirty: !published ||
260
306
  JSON.stringify(published.definition) !== JSON.stringify(w.draft) ||
261
307
  !sameFiles(published.files, files),
@@ -402,7 +448,7 @@ export async function writeDraft(userId, wizardId, input, writer = { source: "st
402
448
  if (input.note) {
403
449
  await addMessage(w.id, { role: "assistant", content: input.note, changed: true }, writer);
404
450
  }
405
- emitDraftChanged({
451
+ await emitDraftChanged({
406
452
  wizardId: w.id,
407
453
  kind: "draft",
408
454
  revision: row.revision,
@@ -411,7 +457,7 @@ export async function writeDraft(userId, wizardId, input, writer = { source: "st
411
457
  note: input.note ?? null,
412
458
  touched: changedSteps(w.draft, draft),
413
459
  });
414
- return { revision: row.revision, issues, draft };
460
+ return { revision: row.revision, issues, warnings: await stepWarnings(w.spaceId, draft), draft };
415
461
  }
416
462
  export async function editWizard(userId, wizardId, input, writer) {
417
463
  const w = await writableWizard(userId, wizardId);
@@ -40,6 +40,9 @@ const heldBy = (run, def, spaceId) => ({ kind: "store_secret", def, scope: scope
40
40
  function contextOf(run, spaceId, entry, who, job) {
41
41
  const connection = entry.target.connection?.() ?? null;
42
42
  const signal = job?.signal ?? new AbortController().signal;
43
+ // The run is done and the person sends its result on: the one call the broker takes of a run
44
+ // that is done (broker/over.ts).
45
+ const where = { ...whereOfRun(run, holderOf(run), spaceId), share: true };
43
46
  const emit = (message) => job ? addJobEvent(run.id, job.id, sayIn(who.lang, message)) : Promise.resolve();
44
47
  const ask = (question) => !job || run.unattended
45
48
  ? Promise.resolve(null)
@@ -60,7 +63,7 @@ function contextOf(run, spaceId, entry, who, job) {
60
63
  // The person filled the form and sent it: a write is theirs, nothing asks again.
61
64
  const out = await brokerCall({
62
65
  who: whoOf(holderOf(run)),
63
- where: whereOfRun(run, holderOf(run), spaceId),
66
+ where,
64
67
  connection: heldBy(run, connection, spaceId),
65
68
  action,
66
69
  input,
@@ -77,7 +80,7 @@ function contextOf(run, spaceId, entry, who, job) {
77
80
  sendFromServer: async (recipients, input, handler) => {
78
81
  const out = await brokerSend({
79
82
  who: whoOf(holderOf(run)),
80
- where: whereOfRun(run, holderOf(run), spaceId),
83
+ where,
81
84
  recipients,
82
85
  input,
83
86
  handler,
@@ -90,6 +93,7 @@ function contextOf(run, spaceId, entry, who, job) {
90
93
  link: async () => (publicOrigin() ? (await shareRun(run)).url : null),
91
94
  step: async () => makeContext(run, await loadSpace(run), structuredClone(run.state), signal, {
92
95
  stepId: SHARE_STEP,
96
+ share: true,
93
97
  emit: (_type, message) => emit(typeof message === "string" ? message : noteText(message, who.lang)),
94
98
  ask,
95
99
  }),
@@ -151,6 +151,7 @@ const wizard = {
151
151
  draft: w.draft,
152
152
  shareEnabled: w.shareEnabled,
153
153
  dailyRunLimit: w.dailyRunLimit,
154
+ dailyMailLimit: w.dailyMailLimit,
154
155
  starter: w.starter,
155
156
  starterRevision: w.starterRevision,
156
157
  runners: w.runners,
@@ -176,6 +177,10 @@ const wizard = {
176
177
  draft,
177
178
  shareEnabled: bool(r.shareEnabled, true),
178
179
  ...(num(r.dailyRunLimit) ? { dailyRunLimit: num(r.dailyRunLimit) } : {}),
180
+ // None is a number too: guests' runs send nothing.
181
+ ...(num(r.dailyMailLimit) !== null
182
+ ? { dailyMailLimit: Math.max(0, Math.round(num(r.dailyMailLimit))) }
183
+ : {}),
179
184
  starter: str(r.starter),
180
185
  starterRevision: num(r.starterRevision),
181
186
  runners: (r.runners ?? null),
@@ -213,7 +218,7 @@ const wizard = {
213
218
  where: eq(schema.wizard.id, id),
214
219
  columns: { revision: true },
215
220
  });
216
- emitDraftChanged({
221
+ await emitDraftChanged({
217
222
  wizardId: id,
218
223
  kind: "draft",
219
224
  revision: row?.revision ?? 0,
@@ -235,6 +235,24 @@ const EN = {
235
235
  connectorsRegistryDown: "integrations.sh did not answer. Try again in a moment.",
236
236
  skillsRegistryMissing: "skills.sh has no skill at {ref}.",
237
237
  skillUpdateChanged: "skills.sh changed the skill again since you looked. Look at the changes once more.",
238
+ // A Connector that brings skills: a plugin for Claude Code or Cursor (bundles/).
239
+ skillOfBundleReadOnly: "A skill that came with a connector stays as it is. Copy it as your own skill to change it.",
240
+ skillOfBundleStays: "This skill came with a connector. Switch it off, or remove the connector with everything it brought.",
241
+ bundleNotARepository: "This is no address of a repository on GitHub. It looks like https://github.com/owner/name.",
242
+ bundleRepoNotFound: "GitHub has no public repository {repo}, or not this branch of it.",
243
+ bundleRepoDown: "GitHub did not answer. Try again in a moment.",
244
+ bundleTooLarge: "This is too large. A repository or a zip may have {mb} MB and 50,000 files.",
245
+ bundleUploadKind: "Upload a plugin as a .zip or a .plugin file.",
246
+ bundleManifestUnreadable: "{file} in the plugin is not valid JSON.",
247
+ bundleNoFolder: "The plugin has no folder “{path}”.",
248
+ bundleNoPlugin: "Nothing here is a plugin for Claude Code or Cursor. A plugin has a manifest, an MCP file or a skills folder.",
249
+ bundleChoose: "This repository holds several plugins. Choose one of them.",
250
+ bundleNothingToTake: "This plugin brings nothing a space takes: no MCP server over http and no skill.",
251
+ bundleAlreadyThere: "The space has “{name}” from here already. Update it on its connector’s page.",
252
+ bundleChanged: "The plugin changed since you looked. Check it once more.",
253
+ bundleServerUnknown: "The plugin names no server “{key}”.",
254
+ bundleServerFailed: "The server “{key}” could not be imported. Leave it out or correct it, then try again: {detail}",
255
+ bundleUploadAgain: "This one came from a file. Upload the new file to update it.",
238
256
  };
239
257
  const DE = {
240
258
  criticalMailSubject: {
@@ -247,7 +265,7 @@ const DE = {
247
265
  "criticalKind.refused_write": "Abgelehnt: ein Schreiben, Löschen oder Senden",
248
266
  "criticalKind.outside_audience": "Ein Gast hat eine Verbindung erreicht, die nicht für Gäste ist",
249
267
  "criticalKind.host_not_in_grant": "Eine Anfrage an einen Host, den der Lauf nicht erreichen darf",
250
- "criticalKind.limit_reached": "Ein Limit ist erreicht",
268
+ "criticalKind.limit_reached": "Eine Grenze ist erreicht",
251
269
  "criticalKind.sign_in_failed": "Eine Anmeldung ist abgelaufen oder wurde abgelehnt",
252
270
  "criticalKind.first_use": "Eine Verbindung wurde zum ersten Mal verwendet",
253
271
  "criticalKind.rule_changed": "Eine Regel wurde geändert",
@@ -459,6 +477,23 @@ const DE = {
459
477
  connectorsRegistryDown: "integrations.sh antwortet nicht. Versuch es gleich noch einmal.",
460
478
  skillsRegistryMissing: "Auf skills.sh gibt es keinen Skill unter {ref}.",
461
479
  skillUpdateChanged: "skills.sh hat den Skill seitdem wieder geändert. Sieh dir die Änderungen noch einmal an.",
480
+ skillOfBundleReadOnly: "Ein Skill, der mit einem Connector kam, bleibt, wie er ist. Kopiere ihn als eigenen Skill, um ihn zu ändern.",
481
+ skillOfBundleStays: "Dieser Skill kam mit einem Connector. Schalte ihn aus oder entferne den Connector mit allem, was er mitgebracht hat.",
482
+ bundleNotARepository: "Das ist keine Adresse eines Repositorys auf GitHub. Sie sieht so aus: https://github.com/owner/name.",
483
+ bundleRepoNotFound: "GitHub hat kein öffentliches Repository {repo}, oder nicht diesen Branch davon.",
484
+ bundleRepoDown: "GitHub antwortet nicht. Versuch es gleich noch einmal.",
485
+ bundleTooLarge: "Das ist zu groß. Ein Repository oder ein Zip darf {mb} MB und 50.000 Dateien haben.",
486
+ bundleUploadKind: "Lade ein Plugin als .zip oder .plugin hoch.",
487
+ bundleManifestUnreadable: "{file} im Plugin ist kein gültiges JSON.",
488
+ bundleNoFolder: "Das Plugin hat keinen Ordner „{path}“.",
489
+ bundleNoPlugin: "Hier liegt kein Plugin für Claude Code oder Cursor. Ein Plugin hat ein Manifest, eine MCP-Datei oder einen Ordner mit Skills.",
490
+ bundleChoose: "In diesem Repository liegen mehrere Plugins. Wähle eines davon.",
491
+ bundleNothingToTake: "Dieses Plugin bringt nichts mit, was ein Space übernimmt: keinen MCP-Server über http und keinen Skill.",
492
+ bundleAlreadyThere: "Der Space hat „{name}“ von hier schon. Aktualisiere es auf der Seite seines Connectors.",
493
+ bundleChanged: "Das Plugin hat sich geändert, seit du es angesehen hast. Prüfe es noch einmal.",
494
+ bundleServerUnknown: "Das Plugin nennt keinen Server „{key}“.",
495
+ bundleServerFailed: "Der Server „{key}“ ließ sich nicht importieren. Lass ihn weg oder korrigiere ihn und versuch es dann noch einmal: {detail}",
496
+ bundleUploadAgain: "Das kam aus einer Datei. Lade die neue Datei hoch, um es zu aktualisieren.",
462
497
  };
463
498
  export const SERVER_TEXTS = { en: EN, de: DE };
464
499
  /** A line of the server's table in a language; English where the language lacks it. */
@@ -52,6 +52,14 @@ export function connectionRefusalNote(refused, service) {
52
52
  return prompt("tools", "note.connector_declined");
53
53
  case "needs_approval":
54
54
  return prompt("tools", "note.connector_needs_approval", { service });
55
+ case "paused":
56
+ return prompt("tools", "note.connector_paused", { service });
57
+ case "calls_per_run":
58
+ return prompt("tools", "note.connector_calls_per_run", { service });
59
+ case "calls_per_day":
60
+ return prompt("tools", "note.connector_calls_per_day", { service });
61
+ case "run_ended":
62
+ return prompt("tools", "note.run_ended");
55
63
  default:
56
64
  return prompt("tools", "note.connector_refused", { service });
57
65
  }
@@ -113,6 +113,14 @@ function refusalNote(refused, service) {
113
113
  return prompt("tools", "note.connector_needs_approval", { service });
114
114
  case "ai_step_writes":
115
115
  return prompt("tools", "note.connector_ai_step_writes", { service });
116
+ case "paused":
117
+ return prompt("tools", "note.connector_paused", { service });
118
+ case "calls_per_run":
119
+ return prompt("tools", "note.connector_calls_per_run", { service });
120
+ case "calls_per_day":
121
+ return prompt("tools", "note.connector_calls_per_day", { service });
122
+ case "run_ended":
123
+ return prompt("tools", "note.run_ended");
116
124
  default:
117
125
  return prompt("tools", "note.connector_refused", { service });
118
126
  }
@@ -195,7 +203,11 @@ export async function callConnection(call, input, ctx) {
195
203
  if (!out.ok) {
196
204
  throw new StepError(out.refused === "declined" || out.refused === "nobody"
197
205
  ? note("stepCallNotAllowed", { service })
198
- : note("stepCallRefused", { service, action: action.id, reason: out.reason }));
206
+ : out.refused === "calls_per_run"
207
+ ? note("stepCallsPerRun", { service })
208
+ : out.refused === "calls_per_day"
209
+ ? note("stepCallsPerDay", { service })
210
+ : note("stepCallRefused", { service, action: action.id, reason: out.reason }));
199
211
  }
200
212
  return out.result;
201
213
  }
@@ -159,9 +159,14 @@ export async function buildStepTools(step, ctx, resolved, uploads) {
159
159
  return { status: res.status, body: clip(await res.text(), 8000) };
160
160
  },
161
161
  });
162
- return out.ok
163
- ? out.result
164
- : { error: prompt("tools", "note.host_not_in_grant", { host: safe.hostname }) };
162
+ if (out.ok) {
163
+ return out.result;
164
+ }
165
+ return {
166
+ error: out.refused === "run_ended"
167
+ ? prompt("tools", "note.run_ended")
168
+ : prompt("tools", "note.host_not_in_grant", { host: safe.hostname }),
169
+ };
165
170
  },
166
171
  });
167
172
  }
@@ -6,7 +6,7 @@ import { elementCall, mayDo } from "../elements/gate.js";
6
6
  import { ELEMENT_SPECS } from "../elements/specs.js";
7
7
  import { getBlob } from "../files/blobs.js";
8
8
  import { prompt } from "../prompts.js";
9
- import { activeSkills } from "../services/skills.js";
9
+ import { activeSkills, skillConnectors } from "../services/skills.js";
10
10
  import { attempt, clip } from "./shared.js";
11
11
  const found = new WeakMap();
12
12
  /** The space's skills that count, asked once per step. */
@@ -157,11 +157,21 @@ export function skillToolsOf(skills, caller) {
157
157
  const placed = await place(k);
158
158
  // In the sandbox, the files for its scripts are there too.
159
159
  const files = placed?.folder ? [...k.files, ...k.blobFiles] : k.files;
160
+ // A plugin brought it together with a connector: the step hears which one.
161
+ const connectors = await skillConnectors(k);
160
162
  return {
161
163
  name: k.name,
162
164
  instructions: clip(k.body, 60_000),
163
165
  files: files.map((f) => f.path).sort(),
164
166
  ...placed,
167
+ ...(connectors.length
168
+ ? {
169
+ connector: prompt("tools", "note.skill_connector", {
170
+ names: connectors.map((c) => c.name).join(", "),
171
+ prefixes: connectors.map((c) => `${c.toolPrefix}_`).join(", "),
172
+ }),
173
+ }
174
+ : {}),
165
175
  };
166
176
  });
167
177
  }),
@@ -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{Yn as r,an as i,hn as a,in as o,nn as s,pn as c,rn as l,un as u}from"./ui-DAk_vjrL.js";import{t as d}from"./preload-helper-DpV6A1kQ.js";import{c as f,n as p}from"./marked.esm-DQ7XA7AC.js";import{t as m}from"./logo-BpnjXTRy.js";import{s as h}from"./i18n-BaPKbQ1s.js";import{g,h as _,m as v,t as y,u as b}from"./UpdateCheck-QhBI3rlQ.js";import{ReleaseNotes as x,loadReleases as S,releaseDate as C,releaseLabel as w}from"./ChangelogDialog-BIrJbAKi.js";var T=e(t(),1),E=[{name:`engenty wizards`,description:`credit.engenty-wizards`,homepage:`https://github.com/engenty/wizards`,license:`FSL-1.1-MIT`},{name:`engenty`,description:`credit.engenty`,homepage:`https://github.com/engenty/engenty`,license:`FSL-1.1-MIT`}],D=[{name:`Mastra`,description:`credit.mastra`,homepage:`https://github.com/mastra-ai/mastra`,license:`Apache-2.0`},{name:`AI SDK`,description:`credit.ai-sdk`,homepage:`https://github.com/vercel/ai`,license:`Apache-2.0`},{name:`Model Context Protocol`,description:`credit.model-context-protocol`,homepage:`https://github.com/modelcontextprotocol/typescript-sdk`,license:`MIT`},{name:`Hono`,description:`credit.hono`,homepage:`https://github.com/honojs/hono`,license:`MIT`},{name:`Drizzle ORM`,description:`credit.drizzle-orm`,homepage:`https://github.com/drizzle-team/drizzle-orm`,license:`Apache-2.0`},{name:`libSQL`,description:`credit.libsql`,homepage:`https://github.com/tursodatabase/libsql`,license:`MIT`},{name:`Playwright`,description:`credit.playwright`,homepage:`https://github.com/microsoft/playwright`,license:`Apache-2.0`},{name:`React`,description:`credit.react`,homepage:`https://github.com/facebook/react`,license:`MIT`},{name:`Vite`,description:`credit.vite`,homepage:`https://github.com/vitejs/vite`,license:`MIT`},{name:`Tailwind CSS`,description:`credit.tailwind-css`,homepage:`https://github.com/tailwindlabs/tailwindcss`,license:`MIT`},{name:`React Flow`,description:`credit.react-flow`,homepage:`https://github.com/xyflow/xyflow`,license:`MIT`},{name:`TanStack Query`,description:`credit.tanstack-query`,homepage:`https://github.com/TanStack/query`,license:`MIT`},{name:`xterm.js`,description:`credit.xterm-js`,homepage:`https://github.com/xtermjs/xterm.js`,license:`MIT`},{name:`Lucide`,description:`credit.lucide`,homepage:`https://github.com/lucide-icons/lucide`,license:`ISC`},{name:`Geist & Geist Mono`,description:`credit.geist-geist-mono`,homepage:`https://github.com/vercel/geist-font`,license:`OFL-1.1`},{name:`Space Grotesk`,description:`credit.space-grotesk`,homepage:`https://github.com/floriankarsten/space-grotesk`,license:`OFL-1.1`},{name:`git-cliff`,description:`credit.git-cliff`,homepage:`https://github.com/orhun/git-cliff`,license:`MIT OR Apache-2.0`}],O=e(n(),1),k=(e,...t)=>t.some(t=>t?.toLowerCase().includes(e));function A({name:e,homepage:t,version:n,license:r,description:i}){return(0,O.jsxs)(`li`,{className:`py-2.5`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,children:[t?(0,O.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 font-medium text-[0.875rem] text-ink underline-offset-4 hover:underline`,children:[e,(0,O.jsx)(f,{"aria-hidden":!0,className:`size-3 text-ink-4`})]}):(0,O.jsx)(`span`,{className:`font-medium text-[0.875rem] text-ink`,children:e}),n?(0,O.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:n}):null,(0,O.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:r})]}),i?(0,O.jsx)(`p`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:i}):null]})}function j({title:e,hint:t,children:n}){return(0,O.jsxs)(`section`,{className:`mt-6`,children:[(0,O.jsx)(`h3`,{className:`border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:e}),t?(0,O.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3`,children:t}):null,n]})}function M({credits:e}){return(0,O.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:e.map(e=>(0,O.jsx)(A,{name:e.name,homepage:e.homepage,license:e.license,description:h(e.description)},e.name))})}function N({label:e,packages:t}){return(0,O.jsxs)(`div`,{className:`mt-4`,children:[(0,O.jsx)(`h4`,{className:`font-medium text-[0.75rem] text-ink-3 tracking-wide`,children:e}),(0,O.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:t.map(e=>(0,O.jsx)(A,{...e},e.name))})]})}function P({active:e}){let[t,n]=(0,T.useState)(null),[r,a]=(0,T.useState)(``);(0,T.useEffect)(()=>{if(!e||t)return;let r=!1;return d(()=>import(`./oss-credits-BrwV0a4F.js`).then(e=>{r||n(e.default)}),[]),()=>{r=!0}},[e,t]),(0,T.useEffect)(()=>{e||a(``)},[e]);let o=r.trim().toLowerCase(),s=e=>o?e.filter(e=>k(o,e.name,e.license,h(e.description))):e,c=e=>o?e.filter(e=>k(o,e.name,e.license,e.version)):e,f=s(E),p=s(D),m=t?[{id:`shared`,label:h(`about.creditsShared`),packages:c(t.shared)},...t.groups.map(e=>({id:e.id,label:e.label,packages:c(e.packages)}))].filter(e=>e.packages.length>0):[],g=f.length===0&&p.length===0&&m.length===0;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`mb-4 text-[0.875rem] text-ink-3`,children:h(`about.creditsHint`)}),(0,O.jsx)(i,{type:`search`,value:r,placeholder:h(`about.search`),onChange:e=>a(e.target.value)}),f.length>0?(0,O.jsx)(j,{title:h(`about.creditsProduct`),children:(0,O.jsx)(M,{credits:f})}):null,p.length>0?(0,O.jsx)(j,{title:h(`about.creditsBuiltWith`),children:(0,O.jsx)(M,{credits:p})}):null,t===null?(0,O.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,O.jsx)(u,{})}):m.length>0?(0,O.jsx)(j,{title:h(`about.creditsDeps`),hint:o?void 0:h(`about.creditsDepsHint`),children:m.map(e=>(0,O.jsx)(N,{label:e.label,packages:e.packages},e.id))}):null,t!==null&&g?(0,O.jsx)(l,{children:h(`about.noMatches`)}):null]})}var F=[`new`,`earlier`,`credits`],I=e=>h(e===`new`?`about.tab.new`:e===`earlier`?`about.tab.earlier`:`about.credits`),L=e=>e===1?h(`about.change`):h(`about.changes`,{n:e});function R({me:e,active:t,initialTab:n=`new`}){let i=e?.mode===`local`,{data:o,latest:s}=_(i&&t),[l,d]=(0,T.useState)(null),[f,p]=(0,T.useState)(n);(0,T.useEffect)(()=>p(n),[n]);let E=v(F.indexOf(f)),D=o?.newer&&s?s:g;(0,T.useEffect)(()=>{if(!t)return;let e=!1;return d(null),S(D===`0.17.0`?void 0:D).then(t=>{e||d(t)}),()=>{e=!0}},[t,D]);let k=l?.find(e=>e.version===`v${D}`)??l?.[0]??null,A=l?.filter(e=>e!==k)??[],j=i?o?.kind??null:`cloud`;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`flex flex-col items-center pt-4 text-center`,children:[(0,O.jsx)(m,{size:96}),(0,O.jsxs)(`div`,{className:`mt-4 font-display font-semibold text-[1.5rem] tracking-tight`,children:[`engenty`,(0,O.jsx)(`span`,{className:`text-ember`,children:`.`}),(0,O.jsx)(`span`,{className:`ml-1.5 font-normal text-ink-3`,children:`wizards`})]}),(0,O.jsxs)(`div`,{className:`mt-1 text-[0.9375rem] text-ink-3 tabular-nums`,children:[h(`about.version`,{v:g}),j?` · ${h(`about.kind.${j}`)}`:``]})]}),i?(0,O.jsx)(`div`,{className:`mt-5`,children:(0,O.jsx)(y,{enabled:t})}):null,(0,O.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,O.jsx)(c,{value:f,onChange:p,options:F.map(e=>({id:e,label:I(e)})),label:h(`about.title`)})}),(0,O.jsxs)(`div`,{className:a(`mt-5`,b(E)),children:[f===`new`?l===null?(0,O.jsx)(`div`,{className:`flex justify-center py-6 text-ink-3`,children:(0,O.jsx)(u,{})}):k?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:[w(k),(0,O.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:C(k)})]}),(0,O.jsx)(`div`,{className:`mt-3`,children:(0,O.jsx)(x,{release:k})})]}):(0,O.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:h(`about.changelogEmpty`)}):null,f===`earlier`?(0,O.jsx)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:A.map(e=>(0,O.jsxs)(`details`,{className:`group/r py-2`,children:[(0,O.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-baseline gap-3 text-[0.875rem] [&::-webkit-details-marker]:hidden`,children:[(0,O.jsx)(r,{className:`size-3.5 shrink-0 self-center text-ink-4 transition group-open/r:rotate-90`}),(0,O.jsx)(`span`,{className:`font-medium text-ink tabular-nums`,children:w(e)}),(0,O.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:C(e)}),(0,O.jsx)(`span`,{className:`ml-auto text-[0.8125rem] text-ink-4`,children:L(e.commits.length)})]}),(0,O.jsx)(`div`,{className:`mt-2 pl-6`,children:(0,O.jsx)(x,{release:e})})]},e.version??`unreleased`))}):null,f===`credits`?(0,O.jsx)(P,{active:!0}):null]},f)]})}function z({open:e,onClose:t,me:n}){return(0,O.jsxs)(s,{open:e,onClose:t,wide:!0,height:`tall`,children:[(0,O.jsx)(`div`,{className:`-mt-2 -mr-2 sticky top-0 z-10 flex h-0 justify-end`,children:(0,O.jsx)(o,{label:h(`common.close`),onClick:t,children:(0,O.jsx)(p,{className:`size-4`})})}),(0,O.jsx)(R,{me:n,active:e})]})}export{z as AboutDialog,R as AboutPanel};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{Yn as r,an as i,hn as a,in as o,nn as s,pn as c,rn as l,un as u}from"./ui-C6vSmisV.js";import{t as d}from"./preload-helper-DpV6A1kQ.js";import{c as f,n as p}from"./marked.esm-DQ7XA7AC.js";import{t as m}from"./logo-BpnjXTRy.js";import{s as h}from"./i18n-CyrHWeGk.js";import{g,h as _,m as v,t as y,u as b}from"./UpdateCheck-B51jMIhp.js";import{ReleaseNotes as x,loadReleases as S,releaseDate as C,releaseLabel as w}from"./ChangelogDialog-Ngxuqubx.js";var T=e(t(),1),E=[{name:`engenty wizards`,description:`credit.engenty-wizards`,homepage:`https://github.com/engenty/wizards`,license:`FSL-1.1-MIT`},{name:`engenty`,description:`credit.engenty`,homepage:`https://github.com/engenty/engenty`,license:`FSL-1.1-MIT`}],D=[{name:`Mastra`,description:`credit.mastra`,homepage:`https://github.com/mastra-ai/mastra`,license:`Apache-2.0`},{name:`AI SDK`,description:`credit.ai-sdk`,homepage:`https://github.com/vercel/ai`,license:`Apache-2.0`},{name:`Model Context Protocol`,description:`credit.model-context-protocol`,homepage:`https://github.com/modelcontextprotocol/typescript-sdk`,license:`MIT`},{name:`Hono`,description:`credit.hono`,homepage:`https://github.com/honojs/hono`,license:`MIT`},{name:`Drizzle ORM`,description:`credit.drizzle-orm`,homepage:`https://github.com/drizzle-team/drizzle-orm`,license:`Apache-2.0`},{name:`libSQL`,description:`credit.libsql`,homepage:`https://github.com/tursodatabase/libsql`,license:`MIT`},{name:`Playwright`,description:`credit.playwright`,homepage:`https://github.com/microsoft/playwright`,license:`Apache-2.0`},{name:`React`,description:`credit.react`,homepage:`https://github.com/facebook/react`,license:`MIT`},{name:`Vite`,description:`credit.vite`,homepage:`https://github.com/vitejs/vite`,license:`MIT`},{name:`Tailwind CSS`,description:`credit.tailwind-css`,homepage:`https://github.com/tailwindlabs/tailwindcss`,license:`MIT`},{name:`React Flow`,description:`credit.react-flow`,homepage:`https://github.com/xyflow/xyflow`,license:`MIT`},{name:`TanStack Query`,description:`credit.tanstack-query`,homepage:`https://github.com/TanStack/query`,license:`MIT`},{name:`xterm.js`,description:`credit.xterm-js`,homepage:`https://github.com/xtermjs/xterm.js`,license:`MIT`},{name:`Lucide`,description:`credit.lucide`,homepage:`https://github.com/lucide-icons/lucide`,license:`ISC`},{name:`Geist & Geist Mono`,description:`credit.geist-geist-mono`,homepage:`https://github.com/vercel/geist-font`,license:`OFL-1.1`},{name:`Space Grotesk`,description:`credit.space-grotesk`,homepage:`https://github.com/floriankarsten/space-grotesk`,license:`OFL-1.1`},{name:`git-cliff`,description:`credit.git-cliff`,homepage:`https://github.com/orhun/git-cliff`,license:`MIT OR Apache-2.0`}],O=e(n(),1),k=(e,...t)=>t.some(t=>t?.toLowerCase().includes(e));function A({name:e,homepage:t,version:n,license:r,description:i}){return(0,O.jsxs)(`li`,{className:`py-2.5`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,children:[t?(0,O.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 font-medium text-[0.875rem] text-ink underline-offset-4 hover:underline`,children:[e,(0,O.jsx)(f,{"aria-hidden":!0,className:`size-3 text-ink-4`})]}):(0,O.jsx)(`span`,{className:`font-medium text-[0.875rem] text-ink`,children:e}),n?(0,O.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:n}):null,(0,O.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:r})]}),i?(0,O.jsx)(`p`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:i}):null]})}function j({title:e,hint:t,children:n}){return(0,O.jsxs)(`section`,{className:`mt-6`,children:[(0,O.jsx)(`h3`,{className:`border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:e}),t?(0,O.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3`,children:t}):null,n]})}function M({credits:e}){return(0,O.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:e.map(e=>(0,O.jsx)(A,{name:e.name,homepage:e.homepage,license:e.license,description:h(e.description)},e.name))})}function N({label:e,packages:t}){return(0,O.jsxs)(`div`,{className:`mt-4`,children:[(0,O.jsx)(`h4`,{className:`font-medium text-[0.75rem] text-ink-3 tracking-wide`,children:e}),(0,O.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:t.map(e=>(0,O.jsx)(A,{...e},e.name))})]})}function P({active:e}){let[t,n]=(0,T.useState)(null),[r,a]=(0,T.useState)(``);(0,T.useEffect)(()=>{if(!e||t)return;let r=!1;return d(()=>import(`./oss-credits-BrwV0a4F.js`).then(e=>{r||n(e.default)}),[]),()=>{r=!0}},[e,t]),(0,T.useEffect)(()=>{e||a(``)},[e]);let o=r.trim().toLowerCase(),s=e=>o?e.filter(e=>k(o,e.name,e.license,h(e.description))):e,c=e=>o?e.filter(e=>k(o,e.name,e.license,e.version)):e,f=s(E),p=s(D),m=t?[{id:`shared`,label:h(`about.creditsShared`),packages:c(t.shared)},...t.groups.map(e=>({id:e.id,label:e.label,packages:c(e.packages)}))].filter(e=>e.packages.length>0):[],g=f.length===0&&p.length===0&&m.length===0;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`mb-4 text-[0.875rem] text-ink-3`,children:h(`about.creditsHint`)}),(0,O.jsx)(i,{type:`search`,value:r,placeholder:h(`about.search`),onChange:e=>a(e.target.value)}),f.length>0?(0,O.jsx)(j,{title:h(`about.creditsProduct`),children:(0,O.jsx)(M,{credits:f})}):null,p.length>0?(0,O.jsx)(j,{title:h(`about.creditsBuiltWith`),children:(0,O.jsx)(M,{credits:p})}):null,t===null?(0,O.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,O.jsx)(u,{})}):m.length>0?(0,O.jsx)(j,{title:h(`about.creditsDeps`),hint:o?void 0:h(`about.creditsDepsHint`),children:m.map(e=>(0,O.jsx)(N,{label:e.label,packages:e.packages},e.id))}):null,t!==null&&g?(0,O.jsx)(l,{children:h(`about.noMatches`)}):null]})}var F=[`new`,`earlier`,`credits`],I=e=>h(e===`new`?`about.tab.new`:e===`earlier`?`about.tab.earlier`:`about.credits`),L=e=>e===1?h(`about.change`):h(`about.changes`,{n:e});function R({me:e,active:t,initialTab:n=`new`}){let i=e?.mode===`local`,{data:o,latest:s}=_(i&&t),[l,d]=(0,T.useState)(null),[f,p]=(0,T.useState)(n);(0,T.useEffect)(()=>p(n),[n]);let E=v(F.indexOf(f)),D=o?.newer&&s?s:g;(0,T.useEffect)(()=>{if(!t)return;let e=!1;return d(null),S(D===`0.17.2`?void 0:D).then(t=>{e||d(t)}),()=>{e=!0}},[t,D]);let k=l?.find(e=>e.version===`v${D}`)??l?.[0]??null,A=l?.filter(e=>e!==k)??[],j=i?o?.kind??null:`cloud`;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`flex flex-col items-center pt-4 text-center`,children:[(0,O.jsx)(m,{size:96}),(0,O.jsxs)(`div`,{className:`mt-4 font-display font-semibold text-[1.5rem] tracking-tight`,children:[`engenty`,(0,O.jsx)(`span`,{className:`text-ember`,children:`.`}),(0,O.jsx)(`span`,{className:`ml-1.5 font-normal text-ink-3`,children:`wizards`})]}),(0,O.jsxs)(`div`,{className:`mt-1 text-[0.9375rem] text-ink-3 tabular-nums`,children:[h(`about.version`,{v:g}),j?` · ${h(`about.kind.${j}`)}`:``]})]}),i?(0,O.jsx)(`div`,{className:`mt-5`,children:(0,O.jsx)(y,{enabled:t})}):null,(0,O.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,O.jsx)(c,{value:f,onChange:p,options:F.map(e=>({id:e,label:I(e)})),label:h(`about.title`)})}),(0,O.jsxs)(`div`,{className:a(`mt-5`,b(E)),children:[f===`new`?l===null?(0,O.jsx)(`div`,{className:`flex justify-center py-6 text-ink-3`,children:(0,O.jsx)(u,{})}):k?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:[w(k),(0,O.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:C(k)})]}),(0,O.jsx)(`div`,{className:`mt-3`,children:(0,O.jsx)(x,{release:k})})]}):(0,O.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:h(`about.changelogEmpty`)}):null,f===`earlier`?(0,O.jsx)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:A.map(e=>(0,O.jsxs)(`details`,{className:`group/r py-2`,children:[(0,O.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-baseline gap-3 text-[0.875rem] [&::-webkit-details-marker]:hidden`,children:[(0,O.jsx)(r,{className:`size-3.5 shrink-0 self-center text-ink-4 transition group-open/r:rotate-90`}),(0,O.jsx)(`span`,{className:`font-medium text-ink tabular-nums`,children:w(e)}),(0,O.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:C(e)}),(0,O.jsx)(`span`,{className:`ml-auto text-[0.8125rem] text-ink-4`,children:L(e.commits.length)})]}),(0,O.jsx)(`div`,{className:`mt-2 pl-6`,children:(0,O.jsx)(x,{release:e})})]},e.version??`unreleased`))}):null,f===`credits`?(0,O.jsx)(P,{active:!0}):null]},f)]})}function z({open:e,onClose:t,me:n}){return(0,O.jsxs)(s,{open:e,onClose:t,wide:!0,height:`tall`,children:[(0,O.jsx)(`div`,{className:`-mt-2 -mr-2 sticky top-0 z-10 flex h-0 justify-end`,children:(0,O.jsx)(o,{label:h(`common.close`),onClick:t,children:(0,O.jsx)(p,{className:`size-4`})})}),(0,O.jsx)(R,{me:n,active:e})]})}export{z as AboutDialog,R as AboutPanel};