@engenty/wizards-runtime 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/apps/runtime/dist/agents/architect.js +4 -4
  2. package/apps/runtime/dist/agents/studio-assistant.js +2 -31
  3. package/apps/runtime/dist/app.js +4 -4
  4. package/apps/runtime/dist/assistant/knows.js +2 -2
  5. package/apps/runtime/dist/auth/index.js +1 -1
  6. package/apps/runtime/dist/authoring/example.js +1 -1
  7. package/apps/runtime/dist/authoring/guide.js +35 -6
  8. package/apps/runtime/dist/broker/account.js +85 -16
  9. package/apps/runtime/dist/broker/call.js +137 -37
  10. package/apps/runtime/dist/broker/log.js +19 -5
  11. package/apps/runtime/dist/broker/rwx.js +12 -9
  12. package/apps/runtime/dist/connectors/index.js +52 -11
  13. package/apps/runtime/dist/connectors/person-connections.js +279 -0
  14. package/apps/runtime/dist/connectors/person-sign-ins.js +74 -3
  15. package/apps/runtime/dist/connectors/same-service.js +14 -0
  16. package/apps/runtime/dist/connectors/space-choice.js +116 -0
  17. package/apps/runtime/dist/connectors/space-connections.js +40 -2
  18. package/apps/runtime/dist/db/client.js +8 -0
  19. package/apps/runtime/dist/db/kept-accounts.js +88 -0
  20. package/apps/runtime/dist/db/migrations/tenant/0075_person_connection.sql +25 -0
  21. package/apps/runtime/dist/db/migrations/tenant/0076_clients_in_spaces.sql +28 -0
  22. package/apps/runtime/dist/db/migrations/tenant/0077_client_spaces_at_root.sql +21 -0
  23. package/apps/runtime/dist/db/migrations/tenant/meta/0075_snapshot.json +7859 -0
  24. package/apps/runtime/dist/db/migrations/tenant/meta/0076_snapshot.json +7859 -0
  25. package/apps/runtime/dist/db/migrations/tenant/meta/0077_snapshot.json +7859 -0
  26. package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +21 -0
  27. package/apps/runtime/dist/db/schema.js +67 -16
  28. package/apps/runtime/dist/docs/dev/api.md +8 -8
  29. package/apps/runtime/dist/docs/dev/wizard-format/index.md +3 -1
  30. package/apps/runtime/dist/elements/caller.js +1 -1
  31. package/apps/runtime/dist/elements/knowledge.js +5 -5
  32. package/apps/runtime/dist/elements/wizards.js +7 -11
  33. package/apps/runtime/dist/engine/notices.js +13 -1
  34. package/apps/runtime/dist/engine/requirements.js +116 -3
  35. package/apps/runtime/dist/engine/run-needs.js +58 -0
  36. package/apps/runtime/dist/engine/runner.js +229 -23
  37. package/apps/runtime/dist/engine/starts.js +9 -0
  38. package/apps/runtime/dist/engine/types.js +5 -1
  39. package/apps/runtime/dist/harness/claude.js +3 -1
  40. package/apps/runtime/dist/manage.js +1 -1
  41. package/apps/runtime/dist/mcp/tools.js +3 -3
  42. package/apps/runtime/dist/plugins/runs.js +2 -1
  43. package/apps/runtime/dist/prompts/architect.md +3 -3
  44. package/apps/runtime/dist/prompts/authoring.md +17 -6
  45. package/apps/runtime/dist/prompts/goose.md +0 -5
  46. package/apps/runtime/dist/routes/api.js +9 -4
  47. package/apps/runtime/dist/routes/client-contract.js +2 -2
  48. package/apps/runtime/dist/routes/client-spaces.js +1 -16
  49. package/apps/runtime/dist/routes/connections.js +6 -1
  50. package/apps/runtime/dist/routes/marketplace.js +27 -7
  51. package/apps/runtime/dist/routes/plugins.js +1 -1
  52. package/apps/runtime/dist/routes/runs.js +157 -11
  53. package/apps/runtime/dist/routes/studio.js +42 -5
  54. package/apps/runtime/dist/services/client-portal.js +58 -49
  55. package/apps/runtime/dist/services/client-spaces.js +57 -125
  56. package/apps/runtime/dist/services/links.js +3 -3
  57. package/apps/runtime/dist/services/marketplace.js +6 -2
  58. package/apps/runtime/dist/services/members-studio.js +1 -1
  59. package/apps/runtime/dist/services/query-vectors.js +1 -1
  60. package/apps/runtime/dist/services/runs.js +19 -20
  61. package/apps/runtime/dist/services/space-parent.js +4 -11
  62. package/apps/runtime/dist/services/spaces.js +56 -47
  63. package/apps/runtime/dist/services/work-ai.js +3 -3
  64. package/apps/runtime/dist/services/work-chats.js +14 -6
  65. package/apps/runtime/dist/sharing/state.js +7 -3
  66. package/apps/runtime/dist/store/index.js +28 -8
  67. package/apps/runtime/dist/store/shared-lists.js +2 -2
  68. package/apps/runtime/dist/sync/hub.js +9 -5
  69. package/apps/runtime/dist/tools/connector.js +4 -2
  70. package/apps/web/dist/assets/{AboutDialog-BxT7chz8.js → AboutDialog-QWzpEK8M.js} +1 -1
  71. package/apps/web/dist/assets/{BlockEditor-BX8ZxxIc.js → BlockEditor-C44bI_ih.js} +1 -1
  72. package/apps/web/dist/assets/{Bundle-Dkpi5E6W.js → Bundle-DZyQ1FP7.js} +1 -1
  73. package/apps/web/dist/assets/CapabilitiesPage-DAr0-gN1.js +2 -0
  74. package/apps/web/dist/assets/{ChangelogDialog-j-vHLy-V.js → ChangelogDialog-CdHqJV2P.js} +1 -1
  75. package/apps/web/dist/assets/{CodeEditor-CfM2A-yS.js → CodeEditor-BRufUwu0.js} +1 -1
  76. package/apps/web/dist/assets/ConnectorsSection-BO6jHrYU.js +1 -0
  77. package/apps/web/dist/assets/EditorPage-Bx-fKnsY.js +3 -0
  78. package/apps/web/dist/assets/{FlowPreview-E0kuvM5n.js → FlowPreview-aj58c-gH.js} +1 -1
  79. package/apps/web/dist/assets/{LangSwitch-DhQmCtyY.js → LangSwitch-BNkytlus.js} +1 -1
  80. package/apps/web/dist/assets/Marketplace-D3hdvrkz.js +2 -0
  81. package/apps/web/dist/assets/NewWizardChannels-fveQcQlY.js +1 -0
  82. package/apps/web/dist/assets/NewWizardPage-BTX1g2t1.js +7 -0
  83. package/apps/web/dist/assets/OnboardingPage-DwF6KdQy.js +1 -0
  84. package/apps/web/dist/assets/ProtocolSection-YnJcMN9E.js +1 -0
  85. package/apps/web/dist/assets/PublicRunner-Bp4DxTrD.js +1 -0
  86. package/apps/web/dist/assets/{ReadOnly-CkToYpY5.js → ReadOnly-C6qmTD35.js} +1 -1
  87. package/apps/web/dist/assets/{Results-C9qxCpUQ.js → Results-BNuuBiwU.js} +1 -1
  88. package/apps/web/dist/assets/{RunDrawer-BRXH71U8.js → RunDrawer-CMgN-XTB.js} +1 -1
  89. package/apps/web/dist/assets/SettingsPage-CuUB26YJ.js +2 -0
  90. package/apps/web/dist/assets/SetupPage-llGzMVeH.js +1 -0
  91. package/apps/web/dist/assets/{SharePage-Boj1R928.js → SharePage-CgQp_PT6.js} +1 -1
  92. package/apps/web/dist/assets/SkillEditor-ARx8QPGp.js +1 -0
  93. package/apps/web/dist/assets/Skills-frfXXEcF.js +9 -0
  94. package/apps/web/dist/assets/SpacePage-Dv6ocsc_.js +2 -0
  95. package/apps/web/dist/assets/StudioHome-B0bZRm1L.js +1 -0
  96. package/apps/web/dist/assets/TableEditor-CfzTLmJF.js +7 -0
  97. package/apps/web/dist/assets/{UpdateCheck-DFor0F9T.js → UpdateCheck-D3QhfI5c.js} +2 -2
  98. package/apps/web/dist/assets/{brand-Ij-I_Lms.js → brand-DKuVyYhH.js} +1 -1
  99. package/apps/web/dist/assets/changelog-Db3nvWao.js +1 -0
  100. package/apps/web/dist/assets/{code-editor-BVgSljQq.js → code-editor-BLwDuQLI.js} +2 -2
  101. package/apps/web/dist/assets/host-C-AAp8Bz.js +69 -0
  102. package/apps/web/dist/assets/i18n-Dyi0kvaA.js +55 -0
  103. package/apps/web/dist/assets/index-CduFlFCp.css +1 -0
  104. package/apps/web/dist/assets/index-CtE0rJEL.js +102 -0
  105. package/apps/web/dist/assets/{read-aloud-pd-PWi_5.js → read-aloud-DGS8mWgC.js} +1 -1
  106. package/apps/web/dist/assets/session-EIDP3Wzc.js +1 -0
  107. package/apps/web/dist/assets/theme-B46aPLtX.js +14 -0
  108. package/apps/web/dist/assets/ui-DSgksc1H.js +16 -0
  109. package/apps/web/dist/assets/{useMutation-CUZC19i3.js → useMutation-fT44ij_b.js} +1 -1
  110. package/apps/web/dist/assets/{viewers-D-8HZrcq.js → viewers-DvA5VsXw.js} +2 -2
  111. package/apps/web/dist/index.html +18 -13
  112. package/apps/web/dist/mcp/flow.html +62 -62
  113. package/node_modules/@engenty/wizards-shared/dist/catalog-prompt.js +2 -2
  114. package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +67 -0
  115. package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +10324 -7
  116. package/node_modules/@engenty/wizards-shared/dist/definition.js +32 -6
  117. package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +17 -23
  118. package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +17 -23
  119. package/node_modules/@engenty/wizards-shared/dist/json-schema.js +3 -3
  120. package/node_modules/@engenty/wizards-shared/dist/marketplace-search.js +7 -1
  121. package/node_modules/@engenty/wizards-shared/dist/marketplace.d.ts +9 -2
  122. package/node_modules/@engenty/wizards-shared/dist/page-data.d.ts +72 -0
  123. package/node_modules/@engenty/wizards-shared/dist/page-data.js +5 -0
  124. package/node_modules/@engenty/wizards-shared/dist/page-look.d.ts +17 -0
  125. package/node_modules/@engenty/wizards-shared/dist/page-look.js +118 -0
  126. package/node_modules/@engenty/wizards-shared/dist/page-styles.d.ts +6 -0
  127. package/node_modules/@engenty/wizards-shared/dist/page-styles.js +98 -0
  128. package/node_modules/@engenty/wizards-shared/dist/page-texts.d.ts +36 -0
  129. package/node_modules/@engenty/wizards-shared/dist/page-texts.js +119 -0
  130. package/node_modules/@engenty/wizards-shared/dist/requires.js +2 -0
  131. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +56 -1
  132. package/node_modules/@engenty/wizards-shared/dist/run.js +25 -0
  133. package/node_modules/@engenty/wizards-shared/dist/runner-texts.d.ts +27 -1
  134. package/node_modules/@engenty/wizards-shared/dist/runner-texts.js +26 -0
  135. package/node_modules/@engenty/wizards-shared/dist/store.d.ts +24 -1
  136. package/node_modules/@engenty/wizards-shared/dist/transition.d.ts +2 -1
  137. package/node_modules/@engenty/wizards-shared/dist/transition.js +10 -2
  138. package/node_modules/@engenty/wizards-shared/dist/wizard-text.js +1 -1
  139. package/package.json +1 -1
  140. package/plugin/.claude-plugin/plugin.json +1 -1
  141. package/plugin/plugin.json +1 -1
  142. package/apps/web/dist/assets/CapabilitiesPage-CfSb23wy.js +0 -2
  143. package/apps/web/dist/assets/ConnectorsSection-fRBZYfZu.js +0 -1
  144. package/apps/web/dist/assets/EditorPage-CrFyN_Qn.js +0 -3
  145. package/apps/web/dist/assets/Marketplace-BdkNOARm.js +0 -2
  146. package/apps/web/dist/assets/NewWizardChannels-BATgI9GR.js +0 -1
  147. package/apps/web/dist/assets/NewWizardPage-B5V5ScKh.js +0 -7
  148. package/apps/web/dist/assets/OnboardingPage-DWpDqlCi.js +0 -1
  149. package/apps/web/dist/assets/PreviewPane-Br2w92Wh.js +0 -7
  150. package/apps/web/dist/assets/ProtocolSection-DMCojdZu.js +0 -1
  151. package/apps/web/dist/assets/PublicRunner-Cjhfeqi3.js +0 -1
  152. package/apps/web/dist/assets/SettingsPage-Dobd7tAA.js +0 -2
  153. package/apps/web/dist/assets/SetupPage-BkMjwBlV.js +0 -1
  154. package/apps/web/dist/assets/SkillEditor-DtVRUYqS.js +0 -1
  155. package/apps/web/dist/assets/Skills-DK1Pv-Xh.js +0 -9
  156. package/apps/web/dist/assets/SpacePage-CjgBRkkw.js +0 -2
  157. package/apps/web/dist/assets/StudioHome-B5HcJJ4Q.js +0 -1
  158. package/apps/web/dist/assets/changelog-n9RARUzp.js +0 -1
  159. package/apps/web/dist/assets/host-BELYIPMT.js +0 -69
  160. package/apps/web/dist/assets/i18n-DPqdH1PJ.js +0 -55
  161. package/apps/web/dist/assets/index-CVZlO0z3.css +0 -1
  162. package/apps/web/dist/assets/index-wJZVaKLg.js +0 -10
  163. package/apps/web/dist/assets/runners-D9DHhaD9.js +0 -1
  164. package/apps/web/dist/assets/session-Mt-n8MI0.js +0 -1
  165. package/apps/web/dist/assets/theme-BQhQx_UL.js +0 -14
  166. package/apps/web/dist/assets/ui-D4qQLcbs.js +0 -16
@@ -14,7 +14,7 @@ import { currentTenant } from "../tenants/tenant.js";
14
14
  import { serverText } from "../texts.js";
15
15
  import { currentRole, mayBuild, requireAdmin, requireBuild, requireWritable } from "./access.js";
16
16
  import { notFound, ServiceError } from "./errors.js";
17
- import { forgetWizardLinks, removeClientSpaceRuns } from "./links.js";
17
+ import { forgetWizardLinks, removeRunsIn } from "./links.js";
18
18
  import { pushPages } from "./pages.js";
19
19
  import { removeSpaceFiles } from "./space-files.js";
20
20
  const sectionId = z.string().regex(/^[A-Za-z0-9_-]{1,40}$/);
@@ -212,9 +212,8 @@ export async function ownedSpace(userId, spaceId) {
212
212
  if (!p) {
213
213
  throw notFound();
214
214
  }
215
- // A client of the organization reaches only the client spaces they are in
216
- // (docs/plans/client-spaces.md); every other space is not there for them.
217
- // With `orgSpaces` any space may have clients: being in it decides (docs/plans/org-spaces.md).
215
+ // One of a client's people reaches only the client spaces they are in
216
+ // (docs/plans/org-spaces.md); every other space is not there for them.
218
217
  if (currentRole() === "client" && !(await inSpace(userId, p.id))) {
219
218
  throw notFound();
220
219
  }
@@ -225,17 +224,17 @@ export async function ownedSpace(userId, spaceId) {
225
224
  }
226
225
  return p;
227
226
  }
227
+ /**
228
+ * Whether the space is kept from the person: someone else's Mein Space, or a space shared with
229
+ * its members only that they are not in. A space not made yet is not kept from anyone.
230
+ */
231
+ export async function keptFrom(userId, spaceId) {
232
+ const p = await db.query.space.findFirst({ where: eq(schema.space.id, spaceId) });
233
+ return Boolean(p && ((await othersPersonal(userId, p)) || (await hiddenFrom(userId, p))));
234
+ }
228
235
  /** Whether the space is shared with its members only and the person is not one of them. */
229
236
  async function hiddenFrom(userId, p) {
230
- return p.kind === "space" && p.access === "members" && !(await inSpace(userId, p.id));
231
- }
232
- /** The spaces with Kund:innen in them: they do not count against the plan's number. */
233
- async function spacesWithClients() {
234
- const rows = await db
235
- .selectDistinct({ spaceId: schema.spaceMember.spaceId })
236
- .from(schema.spaceMember)
237
- .where(and(eq(schema.spaceMember.tenantId, currentTenant()), eq(schema.spaceMember.role, "client")));
238
- return new Set(rows.map((r) => r.spaceId));
237
+ return p.kind !== "personal" && p.access === "members" && !(await inSpace(userId, p.id));
239
238
  }
240
239
  /** The organization's brand, Info and themes, as a space that takes them keeps them. */
241
240
  function brandOf(root) {
@@ -298,7 +297,7 @@ async function ensureSpace(lang = "en") {
298
297
  */
299
298
  export async function defaultSpace(userId) {
300
299
  if (currentRole() === "client") {
301
- const [first] = await clientSpacesOf(userId);
300
+ const [first] = await spacesOfClient(userId);
302
301
  if (!first) {
303
302
  throw notFound();
304
303
  }
@@ -333,13 +332,13 @@ export async function rootSpace() {
333
332
  }
334
333
  /**
335
334
  * Puts the spaces that stand beside the root under it, once: a space made before the switch,
336
- * or before the root was the root. Client spaces keep their parent.
335
+ * or before the root was the root.
337
336
  */
338
337
  async function underRoot(root) {
339
338
  await db
340
339
  .update(schema.space)
341
340
  .set({ parentId: root.id, updatedAt: new Date() })
342
- .where(and(madeHere(), isNull(schema.space.parentId), ne(schema.space.id, root.id), inArray(schema.space.kind, ["space", "personal"])));
341
+ .where(and(madeHere(), isNull(schema.space.parentId), ne(schema.space.id, root.id)));
343
342
  }
344
343
  /** How many people an organization has, kept a minute: the Manage-App is asked at most that often. */
345
344
  const peopleCount = new Map();
@@ -412,16 +411,13 @@ export async function personalSpace(userId, root) {
412
411
  }
413
412
  /**
414
413
  * What a listed space is, for an outside client (docs/plans/org-spaces.md): the organization's
415
- * own space, the person's Mein Space, a space shared with Kund:innen, or a space.
414
+ * own space, the person's Mein Space, a client space, or a team space.
416
415
  */
417
416
  export function spaceIs(p) {
418
417
  if (p.root) {
419
418
  return "organization";
420
419
  }
421
- if (p.kind === "personal") {
422
- return "personal";
423
- }
424
- return p.kind === "client" || (p.clients ?? 0) > 0 ? "client" : "space";
420
+ return p.kind === "personal" ? "personal" : p.kind === "client" ? "client" : "space";
425
421
  }
426
422
  /** Whether a space holds nothing yet: no wizard, no page, no chat. */
427
423
  async function emptySpace(spaceId) {
@@ -491,8 +487,9 @@ async function othersPersonal(userId, p) {
491
487
  }
492
488
  /**
493
489
  * The spaces as the studio shows them with `orgSpaces` on: the root first, then the person's
494
- * Mein Space, then the spaces under the root, oldest first, up to the plan's number. Each says
495
- * whether it is the root or the person's own and how many Kund:innen are in it.
490
+ * Mein Space, then the team spaces and the client spaces under the root, oldest first, the team
491
+ * spaces up to the plan's number. Each says whether it is the root or the person's own and how
492
+ * many of a client's people are in it.
496
493
  */
497
494
  async function listOrgSpaces(userId, build) {
498
495
  const root = build ? await rootSpace() : undefined;
@@ -502,13 +499,14 @@ async function listOrgSpaces(userId, build) {
502
499
  const personal = root && (await personalSpacesOn()) ? await personalSpace(userId, root) : null;
503
500
  const limit = await spaceLimit();
504
501
  const all = await db.query.space.findMany({
505
- where: and(build ? eq(schema.space.tenantId, currentTenant()) : synced(), eq(schema.space.kind, "space"), ...(root ? [ne(schema.space.id, root.id)] : [])),
502
+ where: and(build ? eq(schema.space.tenantId, currentTenant()) : synced(), inArray(schema.space.kind, ["space", "client"]), ...(root ? [ne(schema.space.id, root.id)] : [])),
506
503
  orderBy: [schema.space.createdAt],
507
504
  });
508
- // The oldest up to the plan's number, the root among them; spaces with Kund:innen do not count.
509
- const withClients = await spacesWithClients();
505
+ // The oldest team spaces up to the plan's number, the root among them; client spaces do not
506
+ // count, and are there while clients are on.
507
+ const clientsOn = (await currentFeatures()).clientSpaces === true;
510
508
  let room = Number.isFinite(limit) ? Math.max(0, limit - (root ? 1 : 0)) : all.length;
511
- const counted = all.filter((p) => withClients.has(p.id) || room-- > 0);
509
+ const counted = all.filter((p) => (p.kind === "client" ? clientsOn : room-- > 0));
512
510
  const theirs = new Set((await db
513
511
  .select({ spaceId: schema.spaceMember.spaceId })
514
512
  .from(schema.spaceMember)
@@ -540,9 +538,9 @@ async function listOrgSpaces(userId, build) {
540
538
  * its number. One that does not: only what its local install synced — possibly nothing yet.
541
539
  */
542
540
  export async function listSpaces(userId, lang) {
543
- // A client sees the client spaces they are in, nothing else (docs/plans/client-spaces.md).
541
+ // A client sees their client spaces, nothing else (docs/plans/org-spaces.md).
544
542
  if (currentRole() === "client") {
545
- return clientSpacesOf(userId);
543
+ return spacesOfClient(userId);
546
544
  }
547
545
  const build = await mayBuild();
548
546
  if (build) {
@@ -569,42 +567,53 @@ export async function listSpaces(userId, lang) {
569
567
  wizardCount: counts.find((x) => x.spaceId === p.id)?.n ?? 0,
570
568
  }));
571
569
  }
572
- /** The client spaces a client is in, as the space list shows them. */
573
- async function clientSpacesOf(userId) {
570
+ /** The client spaces one of a client's people is in, as the space list shows them. */
571
+ async function spacesOfClient(userId) {
574
572
  const rows = await db
575
573
  .select({ space: schema.space })
576
574
  .from(schema.spaceMember)
577
575
  .innerJoin(schema.space, eq(schema.space.id, schema.spaceMember.spaceId))
578
- .where(and(eq(schema.spaceMember.userId, userId), eq(schema.spaceMember.role, "client"), eq(schema.space.tenantId, currentTenant())));
576
+ .where(and(eq(schema.spaceMember.userId, userId), eq(schema.spaceMember.role, "client"), eq(schema.space.tenantId, currentTenant()), eq(schema.space.kind, "client")));
579
577
  return rows.map((r) => ({ ...r.space, wizardCount: 0 }));
580
578
  }
581
- export async function createSpace(userId, name, access = "all") {
579
+ export async function createSpace(userId, name, access = "all", kind = "space") {
582
580
  await requireBuild();
583
581
  await requireAdmin();
584
- // Client spaces, Mein Space and spaces with Kund:innen do not count as spaces of the plan.
585
- const withClients = await spacesWithClients();
586
- const n = (await db.query.space.findMany({
587
- columns: { id: true },
588
- where: and(eq(schema.space.tenantId, currentTenant()), eq(schema.space.kind, "space")),
589
- })).filter((p) => !withClients.has(p.id)).length;
582
+ // A client space (docs/plans/org-spaces.md): with clients on, beside the team spaces under the
583
+ // root, seen by the whole team. It does not count as a space of the plan, as Mein Space does not.
584
+ const features = await currentFeatures();
585
+ const client = kind === "client";
586
+ if (client && !(features.clientSpaces === true && features.orgSpaces === true)) {
587
+ throw notFound();
588
+ }
589
+ const n = client
590
+ ? 0
591
+ : (await db.query.space.findMany({
592
+ columns: { id: true },
593
+ where: and(eq(schema.space.tenantId, currentTenant()), eq(schema.space.kind, "space")),
594
+ })).length;
590
595
  const limit = await spaceLimit();
591
- if (n >= limit) {
596
+ if (!client && n >= limit) {
592
597
  throw new ServiceError("refused", limit === 1 ? note("onlyOneSpaceAllowed") : note("mostSpaces", { count: limit }));
593
598
  }
594
599
  const id = nanoid(12);
595
600
  // With `orgSpaces` a new space sits under the organization's own and reads it.
596
601
  // It starts with the organization's brand and Info, and shared with whom the dialog said.
597
602
  const root = (await orgSpacesOn()) ? await rootSpace() : undefined;
603
+ if (client && !root) {
604
+ throw notFound();
605
+ }
598
606
  await db.transaction(async (tx) => {
599
607
  await tx.insert(schema.space).values({
600
608
  id,
601
609
  tenantId: currentTenant(),
602
610
  name,
611
+ kind,
603
612
  ...(root ? { ...brandOf(root), brandFrom: "root" } : { brand: {} }),
604
613
  parentId: root?.id ?? null,
605
- access: root ? access : "all",
614
+ access: root && !client ? access : "all",
606
615
  });
607
- if (root && access === "members") {
616
+ if (root && !client && access === "members") {
608
617
  await tx.insert(schema.spaceMember).values({
609
618
  id: nanoid(12),
610
619
  tenantId: currentTenant(),
@@ -630,7 +639,7 @@ export async function updateSpace(userId, spaceId, patch) {
630
639
  }
631
640
  const page = patch.page ? await checkedPage(p, patch.page) : undefined;
632
641
  // Who sees it and whose brand it shows are a space's under the root, never the root's own.
633
- const under = Boolean(p.parentId) && p.kind !== "client" && (await orgSpacesOn());
642
+ const under = Boolean(p.parentId) && (await orgSpacesOn());
634
643
  if ((patch.access || patch.brandFrom) && !under) {
635
644
  throw new ServiceError("invalid", note("spaceChoiceNotHere"));
636
645
  }
@@ -885,13 +894,13 @@ export async function deleteSpace(userId, spaceId) {
885
894
  }
886
895
  await removeSpace(spaceId);
887
896
  }
888
- /** Takes a space away with its wizards' links and its files, and its client spaces first. */
897
+ /** Takes a space away with its wizards' links, its runs and its files, and the spaces under it first. */
889
898
  export async function removeSpace(spaceId) {
890
- const clients = await db
899
+ const under = await db
891
900
  .select({ id: schema.space.id })
892
901
  .from(schema.space)
893
902
  .where(and(eq(schema.space.parentId, spaceId), eq(schema.space.tenantId, currentTenant())));
894
- for (const c of clients) {
903
+ for (const c of under) {
895
904
  await removeSpace(c.id);
896
905
  }
897
906
  const wizards = await db
@@ -901,7 +910,7 @@ export async function removeSpace(spaceId) {
901
910
  for (const w of wizards) {
902
911
  await forgetWizardLinks(w.id);
903
912
  }
904
- await removeClientSpaceRuns(spaceId);
913
+ await removeRunsIn(spaceId);
905
914
  await removeSpaceFiles(spaceId);
906
915
  await db
907
916
  .delete(schema.space)
@@ -122,9 +122,9 @@ export const showView = () => createTool({
122
122
  const searches = (resolved) => resolved.vendor === "anthropic" || resolved.gateway;
123
123
  /**
124
124
  * A client's turn (docs/plans/client-portal.md, phase 1): the client space's Knowledge with what
125
- * the firm opened to clients, the wizards opened to them (a run lands in the client space) and
126
- * views. No skills, sandbox, connections, plugins or web: nothing that reaches past the client
127
- * space or spends on the firm's sign-ins.
125
+ * the organization's root opened to clients, the wizards opened to them (a run lands in the client
126
+ * space) and views. No skills, sandbox, connections, plugins or web: nothing that reaches past the
127
+ * client space or spends on the firm's sign-ins.
128
128
  */
129
129
  async function clientTools(space, userId, signal, chatId) {
130
130
  const caller = personCaller({ space, userId, role: "client", signal, chatId });
@@ -553,11 +553,12 @@ function beginRun(chat, watcher, reply) {
553
553
  wake(run);
554
554
  }
555
555
  watcher.waiting.clear();
556
- void db
556
+ // Kept, so the turn's end clears it only once it is written.
557
+ const answering = db
557
558
  .update(schema.chat)
558
559
  .set({ answeringSince: new Date() })
559
560
  .where(eq(schema.chat.id, chat.id))
560
- .catch((err) => console.error("[work-chats] answering:", err));
561
+ .then(() => undefined, (err) => console.error("[work-chats] answering:", err));
561
562
  let feed;
562
563
  const chunks = new ReadableStream({
563
564
  start(controller) {
@@ -593,7 +594,9 @@ function beginRun(chat, watcher, reply) {
593
594
  if (watcher.run === run) {
594
595
  watcher.run = null;
595
596
  }
596
- await afterTurn(chat, reply(), steps.list).catch((err) => console.error("[work-chats] after the turn:", err));
597
+ await answering;
598
+ // A turn that began meanwhile still answers.
599
+ await afterTurn(chat, reply(), steps.list, !watcher.run).catch((err) => console.error("[work-chats] after the turn:", err));
597
600
  if (!watcher.next.length && !watcher.run) {
598
601
  watcher.idle = setTimeout(watcher.stop, IDLE_MS);
599
602
  }
@@ -734,9 +737,14 @@ export async function followTurn(user, id) {
734
737
  const watcher = await watchers.get(chat.id);
735
738
  return watcher?.run && !watcher.run.done ? followRun(chat.id, false) : null;
736
739
  }
737
- /** What a finished turn leaves: its text as the chat's last message, a client's steps stored. */
738
- async function afterTurn(chat, reply, steps) {
739
- await db.update(schema.chat).set({ answeringSince: null }).where(eq(schema.chat.id, chat.id));
740
+ /**
741
+ * What a finished turn leaves: its text as the chat's last message, a client's steps stored, and,
742
+ * with `answered`, a chat that no longer answers.
743
+ */
744
+ async function afterTurn(chat, reply, steps, answered) {
745
+ if (answered) {
746
+ await db.update(schema.chat).set({ answeringSince: null }).where(eq(schema.chat.id, chat.id));
747
+ }
740
748
  if (steps.length) {
741
749
  const { memory } = await workMastra();
742
750
  const { messages } = await memory.recall({
@@ -38,11 +38,15 @@ async function settled(row) {
38
38
  return row;
39
39
  }
40
40
  const error = serverText(row.request.lang ?? "en", "shareInterrupted");
41
- await db
41
+ const ended = await db
42
42
  .update(schema.shareJob)
43
43
  .set({ status: "failed", error, updatedAt: new Date() })
44
- .where(eq(schema.shareJob.id, row.id));
45
- return { ...row, status: "failed", error };
44
+ .where(and(eq(schema.shareJob.id, row.id), eq(schema.shareJob.status, "running")))
45
+ .returning();
46
+ // Ended meanwhile: it stays as it ended.
47
+ return (ended[0] ??
48
+ (await db.query.shareJob.findFirst({ where: eq(schema.shareJob.id, row.id) })) ??
49
+ row);
46
50
  }
47
51
  export async function createJob(input) {
48
52
  const [row] = await db
@@ -3,6 +3,7 @@ import { firstRowAt, newCells, patchCells, rowKey, STORE_LIMITS, } from "@engent
3
3
  import { cleanPath, mimeForPath } from "@engenty/wizards-shared/workspace";
4
4
  import { and, asc, eq, inArray, like, lt, notLike, sql } from "drizzle-orm";
5
5
  import { nanoid } from "nanoid";
6
+ import { chosenAccounts, forget } from "../connectors/person-connections.js";
6
7
  import { db, schema } from "../db/client.js";
7
8
  import { env } from "../env.js";
8
9
  import { getBlob, putBlob } from "../files/blobs.js";
@@ -11,6 +12,8 @@ import { dropHolderData } from "./data.js";
11
12
  import { StoreError } from "./errors.js";
12
13
  import { deleteSharedRows, saveSharedRows, sharedRows } from "./shared-lists.js";
13
14
  export { StoreError };
15
+ /** How a channel's person is the run's visitor (plugins/runs.ts): `p:` and a hash of who they are. */
16
+ export const CHANNEL_VISITOR = "p:";
14
17
  /** The person a run belongs to: the signed-in admin, else the visitor of the shared link. */
15
18
  export function holderOf(run) {
16
19
  if (run.userId) {
@@ -23,8 +26,16 @@ export function scopeOf(run) {
23
26
  wizardId: run.wizardId,
24
27
  holder: holderOf(run),
25
28
  ...(run.clientSpaceId ? { clientSpaceId: run.clientSpaceId } : {}),
29
+ ...(unwatched(run) ? { unwatched: true } : {}),
26
30
  };
27
31
  }
32
+ /** A run a start began with no person, or one a channel's person runs. */
33
+ function unwatched(run) {
34
+ if (run.userId) {
35
+ return false;
36
+ }
37
+ return run.visitorId ? run.visitorId.startsWith(CHANNEL_VISITOR) : Boolean(run.startedBy);
38
+ }
28
39
  /** Marks the store as in use; stores nobody came back to are cleaned up. */
29
40
  export async function touchStore(scope) {
30
41
  await db
@@ -298,22 +309,31 @@ export async function deleteSecret(scope, slot) {
298
309
  .delete(schema.storeSecret)
299
310
  .where(and(ownSecrets(scope), eq(schema.storeSecret.slot, slot)));
300
311
  }
312
+ /**
313
+ * What the wizard keeps for the person besides lists and files: its kept secrets, and the
314
+ * accounts it uses (`connection_choice`) under the slot `connection:<need>`.
315
+ */
301
316
  export async function listSecrets(scope) {
302
317
  const rows = await db.query.storeSecret.findMany({ where: ownSecrets(scope) });
303
- return rows.map((r) => ({
304
- slot: r.slot,
305
- provider: r.provider,
306
- label: r.label,
307
- createdAt: r.createdAt.toISOString(),
308
- }));
318
+ return [
319
+ ...rows.map((r) => ({
320
+ slot: r.slot,
321
+ provider: r.provider,
322
+ label: r.label,
323
+ createdAt: r.createdAt.toISOString(),
324
+ })),
325
+ ...(await chosenAccounts(scope.wizardId, scope.holder)),
326
+ ];
309
327
  }
310
328
  // --- everything --------------------------------------------------------------
311
329
  /**
312
- * Deletes everything the wizard keeps for this person, their database too. Blobs stay: other
313
- * files may share them.
330
+ * Deletes everything the wizard keeps for this person, their database too, and forgets the
331
+ * accounts it uses: an account no other wizard uses goes with it. Blobs stay: other files may
332
+ * share them.
314
333
  */
315
334
  export async function clearStore(scope) {
316
335
  await dropHolderData(scope);
336
+ await forget(scope.wizardId, scope.holder);
317
337
  await db
318
338
  .delete(schema.storeRow)
319
339
  .where(and(eq(schema.storeRow.wizardId, scope.wizardId), eq(schema.storeRow.holder, scope.holder)));
@@ -7,8 +7,8 @@ import { StoreError } from "./errors.js";
7
7
  const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
8
8
  /**
9
9
  * The table a shared list is kept in: made the first time, following the list as it changes. A
10
- * run of a client space keeps it in the client space (docs/plans/client-portal.md): the firm's
11
- * clients never share a list.
10
+ * run that carries a space keeps it in that space (docs/plans/org-spaces.md): two spaces never
11
+ * share a list.
12
12
  */
13
13
  export async function sharedTable(scope, def) {
14
14
  const { wizardId } = scope;
@@ -6,7 +6,7 @@ import { managed, tenantInfo } from "../manage.js";
6
6
  import { currentRole, isAdminRole, MEMBERS_EDIT_ONLY, mayBuild } from "../services/access.js";
7
7
  import { ServiceError } from "../services/errors.js";
8
8
  import { studioSpaces } from "../services/members-studio.js";
9
- import { placeArrivingSpace, spaceLimit } from "../services/spaces.js";
9
+ import { keptFrom, placeArrivingSpace, spaceLimit } from "../services/spaces.js";
10
10
  import { publishWizard, rotateShareLink, shareUrl } from "../services/wizards.js";
11
11
  import { codeOf } from "../tenants/control.js";
12
12
  import { currentTenant } from "../tenants/tenant.js";
@@ -30,15 +30,19 @@ function requireSchema(theirs) {
30
30
  /**
31
31
  * The organization as an install meets it: its schema, its number of spaces, its spaces. The
32
32
  * install of a member meets the spaces whose Studio is open to members; the others refuse its
33
- * pulls and pushes (services/members-studio.ts), so they are not offered to it.
33
+ * pulls and pushes (services/members-studio.ts), so they are not offered to it. Someone else's
34
+ * Mein Space and a space for its members only are not offered to anyone outside them.
34
35
  */
35
- export async function syncOverview() {
36
+ export async function syncOverview(userId) {
36
37
  const open = await studioSpaces();
37
- const spaces = (await db.query.space.findMany({
38
+ const all = (await db.query.space.findMany({
38
39
  where: eq(schema.space.tenantId, currentTenant()),
39
- columns: { id: true, name: true, origin: true },
40
+ columns: { id: true, name: true, origin: true, kind: true },
40
41
  orderBy: [schema.space.createdAt],
41
42
  })).filter((s) => !open || open.has(s.id));
43
+ const kept = await Promise.all(all.map((s) => keptFrom(userId, s.id)));
44
+ // Client spaces stay out of the sync (docs/plans/org-spaces.md).
45
+ const spaces = all.filter((s, i) => !kept[i] && s.kind !== "client");
42
46
  const info = managed ? await tenantInfo(currentTenant()).catch(() => null) : null;
43
47
  const limit = await spaceLimit();
44
48
  return {
@@ -217,7 +217,7 @@ export async function callConnection(call, input, ctx) {
217
217
  service,
218
218
  action: action.id,
219
219
  reason: err.message.slice(0, 200),
220
- }));
220
+ }), connection.id);
221
221
  }
222
222
  throw err;
223
223
  });
@@ -232,7 +232,9 @@ export async function callConnection(call, input, ctx) {
232
232
  : out.refused === "calls_per_day"
233
233
  ? note("stepCallsPerDay", { service })
234
234
  : note("stepCallRefused", { service, action: action.id, reason: out.reason });
235
- throw out.refused === "not_connected" ? new SignInNeeded(service, said) : new StepError(said);
235
+ throw out.refused === "not_connected"
236
+ ? new SignInNeeded(service, said, connection.id)
237
+ : new StepError(said);
236
238
  }
237
239
  return out.result;
238
240
  }
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Qn as t,an as n,cn as r,gn as i,on as a,pn as o,sn as s,vn as c}from"./ui-D4qQLcbs.js";import{c as l,n as u}from"./marked.esm-BfGIZK7F.js";import{n as d,t as f}from"./jsx-runtime-C3cWAN_r.js";import{t as p}from"./logo-xL-sneZz.js";import{s as m}from"./i18n-DPqdH1PJ.js";import{g as h,h as g,m as _,t as v,u as y}from"./UpdateCheck-DFor0F9T.js";import{ReleaseNotes as b,loadReleases as x,releaseDate as S,releaseLabel as C}from"./ChangelogDialog-j-vHLy-V.js";import{t as w}from"./preload-helper-Cj7BV335.js";var T=e(d(),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(f(),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)(l,{"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:m(e.description)},e.name))})}function N({label:e,packages:t}){return(0,O.jsxs)(`div`,{className:`mt-4`,children:[(0,O.jsx)(`h4`,{className:`font-medium text-[0.75rem] text-ink-3 tracking-wide`,children:e}),(0,O.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:t.map(e=>(0,O.jsx)(A,{...e},e.name))})]})}function P({active:e}){let[t,n]=(0,T.useState)(null),[i,s]=(0,T.useState)(``);(0,T.useEffect)(()=>{if(!e||t)return;let r=!1;return w(()=>import(`./oss-credits-B8LDQxiG.js`).then(e=>{r||n(e.default)}),[]),()=>{r=!0}},[e,t]),(0,T.useEffect)(()=>{e||s(``)},[e]);let c=i.trim().toLowerCase(),l=e=>c?e.filter(e=>k(c,e.name,e.license,m(e.description))):e,u=e=>c?e.filter(e=>k(c,e.name,e.license,e.version)):e,d=l(E),f=l(D),p=t?[{id:`shared`,label:m(`about.creditsShared`),packages:u(t.shared)},...t.groups.map(e=>({id:e.id,label:e.label,packages:u(e.packages)}))].filter(e=>e.packages.length>0):[],h=d.length===0&&f.length===0&&p.length===0;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`mb-4 text-[0.875rem] text-ink-3`,children:m(`about.creditsHint`)}),(0,O.jsx)(r,{type:`search`,value:i,placeholder:m(`about.search`),onChange:e=>s(e.target.value)}),d.length>0?(0,O.jsx)(j,{title:m(`about.creditsProduct`),children:(0,O.jsx)(M,{credits:d})}):null,f.length>0?(0,O.jsx)(j,{title:m(`about.creditsBuiltWith`),children:(0,O.jsx)(M,{credits:f})}):null,t===null?(0,O.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,O.jsx)(o,{})}):p.length>0?(0,O.jsx)(j,{title:m(`about.creditsDeps`),hint:c?void 0:m(`about.creditsDepsHint`),children:p.map(e=>(0,O.jsx)(N,{label:e.label,packages:e.packages},e.id))}):null,t!==null&&h?(0,O.jsx)(a,{children:m(`about.noMatches`)}):null]})}var F=[`new`,`earlier`,`credits`],I=e=>m(e===`new`?`about.tab.new`:e===`earlier`?`about.tab.earlier`:`about.credits`),L=e=>e===1?m(`about.change`):m(`about.changes`,{n:e});function R({me:e,active:n,initialTab:r=`new`}){let a=e?.mode===`local`,{data:s,latest:l}=g(a&&n),[u,d]=(0,T.useState)(null),[f,w]=(0,T.useState)(r);(0,T.useEffect)(()=>w(r),[r]);let E=_(F.indexOf(f)),D=s?.newer&&l?l:h;(0,T.useEffect)(()=>{if(!n)return;let e=!1;return d(null),x(D===`0.19.0`?void 0:D).then(t=>{e||d(t)}),()=>{e=!0}},[n,D]);let k=u?.find(e=>e.version===`v${D}`)??u?.[0]??null,A=u?.filter(e=>e!==k)??[],j=a?s?.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)(p,{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:[m(`about.version`,{v:h}),j?` · ${m(`about.kind.${j}`)}`:``]})]}),a?(0,O.jsx)(`div`,{className:`mt-5`,children:(0,O.jsx)(v,{enabled:n})}):null,(0,O.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,O.jsx)(i,{value:f,onChange:w,options:F.map(e=>({id:e,label:I(e)})),label:m(`about.title`)})}),(0,O.jsxs)(`div`,{className:c(`mt-5`,y(E)),children:[f===`new`?u===null?(0,O.jsx)(`div`,{className:`flex justify-center py-6 text-ink-3`,children:(0,O.jsx)(o,{})}):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:[C(k),(0,O.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:S(k)})]}),(0,O.jsx)(`div`,{className:`mt-3`,children:(0,O.jsx)(b,{release:k})})]}):(0,O.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:m(`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)(t,{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:C(e)}),(0,O.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:S(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)(b,{release:e})})]},e.version??`unreleased`))}):null,f===`credits`?(0,O.jsx)(P,{active:!0}):null]},f)]})}function z({open:e,onClose:t,me:r}){return(0,O.jsxs)(n,{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)(s,{label:m(`common.close`),onClick:t,children:(0,O.jsx)(u,{className:`size-4`})})}),(0,O.jsx)(R,{me:r,active:e})]})}export{z as AboutDialog,R as AboutPanel};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{cn as t,dn as n,gn as r,ln as i,tr as a,un as o,xn as s,yn as c}from"./ui-DSgksc1H.js";import{c as l,n as u}from"./marked.esm-BfGIZK7F.js";import{n as d,t as f}from"./jsx-runtime-C3cWAN_r.js";import{t as p}from"./logo-xL-sneZz.js";import{s as m}from"./i18n-Dyi0kvaA.js";import{g as h,h as g,m as _,t as v,u as y}from"./UpdateCheck-D3QhfI5c.js";import{ReleaseNotes as b,loadReleases as x,releaseDate as S,releaseLabel as C}from"./ChangelogDialog-CdHqJV2P.js";import{t as w}from"./preload-helper-Cj7BV335.js";var T=e(d(),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(f(),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)(l,{"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:m(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,a]=(0,T.useState)(null),[o,s]=(0,T.useState)(``);(0,T.useEffect)(()=>{if(!e||t)return;let n=!1;return w(()=>import(`./oss-credits-B8LDQxiG.js`).then(e=>{n||a(e.default)}),[]),()=>{n=!0}},[e,t]),(0,T.useEffect)(()=>{e||s(``)},[e]);let c=o.trim().toLowerCase(),l=e=>c?e.filter(e=>k(c,e.name,e.license,m(e.description))):e,u=e=>c?e.filter(e=>k(c,e.name,e.license,e.version)):e,d=l(E),f=l(D),p=t?[{id:`shared`,label:m(`about.creditsShared`),packages:u(t.shared)},...t.groups.map(e=>({id:e.id,label:e.label,packages:u(e.packages)}))].filter(e=>e.packages.length>0):[],h=d.length===0&&f.length===0&&p.length===0;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`mb-4 text-[0.875rem] text-ink-3`,children:m(`about.creditsHint`)}),(0,O.jsx)(n,{type:`search`,value:o,placeholder:m(`about.search`),onChange:e=>s(e.target.value)}),d.length>0?(0,O.jsx)(j,{title:m(`about.creditsProduct`),children:(0,O.jsx)(M,{credits:d})}):null,f.length>0?(0,O.jsx)(j,{title:m(`about.creditsBuiltWith`),children:(0,O.jsx)(M,{credits:f})}):null,t===null?(0,O.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,O.jsx)(r,{})}):p.length>0?(0,O.jsx)(j,{title:m(`about.creditsDeps`),hint:c?void 0:m(`about.creditsDepsHint`),children:p.map(e=>(0,O.jsx)(N,{label:e.label,packages:e.packages},e.id))}):null,t!==null&&h?(0,O.jsx)(i,{children:m(`about.noMatches`)}):null]})}var F=[`new`,`earlier`,`credits`],I=e=>m(e===`new`?`about.tab.new`:e===`earlier`?`about.tab.earlier`:`about.credits`),L=e=>e===1?m(`about.change`):m(`about.changes`,{n:e});function R({me:e,active:t,initialTab:n=`new`}){let i=e?.mode===`local`,{data:o,latest:l}=g(i&&t),[u,d]=(0,T.useState)(null),[f,w]=(0,T.useState)(n);(0,T.useEffect)(()=>w(n),[n]);let E=_(F.indexOf(f)),D=o?.newer&&l?l:h;(0,T.useEffect)(()=>{if(!t)return;let e=!1;return d(null),x(D===`0.20.0`?void 0:D).then(t=>{e||d(t)}),()=>{e=!0}},[t,D]);let k=u?.find(e=>e.version===`v${D}`)??u?.[0]??null,A=u?.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)(p,{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:[m(`about.version`,{v:h}),j?` · ${m(`about.kind.${j}`)}`:``]})]}),i?(0,O.jsx)(`div`,{className:`mt-5`,children:(0,O.jsx)(v,{enabled:t})}):null,(0,O.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,O.jsx)(c,{value:f,onChange:w,options:F.map(e=>({id:e,label:I(e)})),label:m(`about.title`)})}),(0,O.jsxs)(`div`,{className:s(`mt-5`,y(E)),children:[f===`new`?u===null?(0,O.jsx)(`div`,{className:`flex justify-center py-6 text-ink-3`,children:(0,O.jsx)(r,{})}):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:[C(k),(0,O.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:S(k)})]}),(0,O.jsx)(`div`,{className:`mt-3`,children:(0,O.jsx)(b,{release:k})})]}):(0,O.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:m(`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)(a,{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:C(e)}),(0,O.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:S(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)(b,{release:e})})]},e.version??`unreleased`))}):null,f===`credits`?(0,O.jsx)(P,{active:!0}):null]},f)]})}function z({open:e,onClose:n,me:r}){return(0,O.jsxs)(t,{open:e,onClose:n,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:m(`common.close`),onClick:n,children:(0,O.jsx)(u,{className:`size-4`})})}),(0,O.jsx)(R,{me:r,active:e})]})}export{z as AboutDialog,R as AboutPanel};