@engenty/wizards-runtime 0.16.1 → 0.17.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 (139) hide show
  1. package/apps/runtime/dist/agents/studio-assistant.js +13 -6
  2. package/apps/runtime/dist/assistant/knows.js +18 -3
  3. package/apps/runtime/dist/broker/call.js +16 -3
  4. package/apps/runtime/dist/broker/grant.js +25 -1
  5. package/apps/runtime/dist/broker/index.js +2 -2
  6. package/apps/runtime/dist/broker/log.js +30 -11
  7. package/apps/runtime/dist/broker/rwx.js +14 -2
  8. package/apps/runtime/dist/broker/send.js +84 -32
  9. package/apps/runtime/dist/connectors/space-connections.js +47 -2
  10. package/apps/runtime/dist/db/control-schema.js +7 -0
  11. package/apps/runtime/dist/db/migrations/control/0014_run_index_generation.sql +1 -0
  12. package/apps/runtime/dist/db/migrations/control/0015_run_index_wake.sql +3 -0
  13. package/apps/runtime/dist/db/migrations/control/meta/0014_snapshot.json +629 -0
  14. package/apps/runtime/dist/db/migrations/control/meta/0015_snapshot.json +650 -0
  15. package/apps/runtime/dist/db/migrations/control/meta/_journal.json +14 -0
  16. package/apps/runtime/dist/db/migrations/tenant/0056_run_claim_rev.sql +2 -0
  17. package/apps/runtime/dist/db/migrations/tenant/0057_run_wake_at.sql +1 -0
  18. package/apps/runtime/dist/db/migrations/tenant/meta/0056_snapshot.json +6520 -0
  19. package/apps/runtime/dist/db/migrations/tenant/meta/0057_snapshot.json +6527 -0
  20. package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +14 -0
  21. package/apps/runtime/dist/db/schema.js +17 -3
  22. package/apps/runtime/dist/docs/dev/broker.md +72 -26
  23. package/apps/runtime/dist/docs/dev/plugins/space.md +13 -2
  24. package/apps/runtime/dist/docs/user-guide/capabilities.md +51 -7
  25. package/apps/runtime/dist/docs/user-guide/connectors.md +6 -3
  26. package/apps/runtime/dist/docs/user-guide/protocol.md +30 -4
  27. package/apps/runtime/dist/docs/user-guide/together.md +4 -4
  28. package/apps/runtime/dist/elements/knowledge.js +17 -12
  29. package/apps/runtime/dist/engine/runner.js +344 -52
  30. package/apps/runtime/dist/engine/steps.js +3 -2
  31. package/apps/runtime/dist/env.js +18 -0
  32. package/apps/runtime/dist/index.js +8 -0
  33. package/apps/runtime/dist/live/hub.js +17 -3
  34. package/apps/runtime/dist/live/origin.js +6 -4
  35. package/apps/runtime/dist/live/views.js +38 -7
  36. package/apps/runtime/dist/models.js +18 -0
  37. package/apps/runtime/dist/mounts/mounts.js +3 -0
  38. package/apps/runtime/dist/plugins/runs.js +3 -0
  39. package/apps/runtime/dist/prompts/mcp.md +3 -0
  40. package/apps/runtime/dist/prompts/tools.md +1 -1
  41. package/apps/runtime/dist/routes/api.js +2 -2
  42. package/apps/runtime/dist/routes/broker.js +59 -20
  43. package/apps/runtime/dist/routes/live.js +4 -2
  44. package/apps/runtime/dist/routes/runs.js +17 -14
  45. package/apps/runtime/dist/routes/studio.js +13 -2
  46. package/apps/runtime/dist/services/api.js +5 -3
  47. package/apps/runtime/dist/services/errors.js +1 -0
  48. package/apps/runtime/dist/services/knowledge.js +95 -28
  49. package/apps/runtime/dist/services/manage-reports.js +2 -0
  50. package/apps/runtime/dist/services/members-studio.js +22 -2
  51. package/apps/runtime/dist/services/query-vectors.js +60 -0
  52. package/apps/runtime/dist/services/relevance.js +12 -0
  53. package/apps/runtime/dist/services/runs.js +16 -2
  54. package/apps/runtime/dist/services/space-categories.js +83 -5
  55. package/apps/runtime/dist/services/space-index.js +99 -27
  56. package/apps/runtime/dist/services/space-origin.js +28 -11
  57. package/apps/runtime/dist/services/work-ai.js +15 -5
  58. package/apps/runtime/dist/sharing/index.js +3 -0
  59. package/apps/runtime/dist/sharing/jobs.js +2 -0
  60. package/apps/runtime/dist/sync/hub.js +17 -3
  61. package/apps/runtime/dist/tenants/control.js +46 -14
  62. package/apps/runtime/dist/texts.js +6 -4
  63. package/apps/runtime/dist/tools/index.js +13 -7
  64. package/apps/runtime/dist/tools/web-search.js +36 -0
  65. package/apps/web/dist/assets/{AboutDialog-C9SnsGno.js → AboutDialog-B2Xmxyj4.js} +1 -1
  66. package/apps/web/dist/assets/{BlockEditor-CUYFH_CU.js → BlockEditor-D0HoUSih.js} +1 -1
  67. package/apps/web/dist/assets/CapabilitiesPage-C1th2cZE.js +2 -0
  68. package/apps/web/dist/assets/{ChangelogDialog-B28TK333.js → ChangelogDialog-BIrJbAKi.js} +1 -1
  69. package/apps/web/dist/assets/{CodeEditor-D-Y16fdk.js → CodeEditor-DUVcXI5P.js} +1 -1
  70. package/apps/web/dist/assets/EditorPage-56sIqEfF.js +3 -0
  71. package/apps/web/dist/assets/{FlowPreview-DXnk7m9P.js → FlowPreview-BIag8_Be.js} +1 -1
  72. package/apps/web/dist/assets/{LangSwitch-Dkd0FBIH.js → LangSwitch-CJ00IgaO.js} +1 -1
  73. package/apps/web/dist/assets/Marketplace-D7-ot9Dz.js +2 -0
  74. package/apps/web/dist/assets/{NewWizardChannels-B12l2_Jh.js → NewWizardChannels-DI3SQ4iS.js} +1 -1
  75. package/apps/web/dist/assets/NewWizardPage-CytheHxX.js +7 -0
  76. package/apps/web/dist/assets/OnboardingPage-_91Pa8Ad.js +1 -0
  77. package/apps/web/dist/assets/PreviewPane-BDsYm-_K.js +7 -0
  78. package/apps/web/dist/assets/ProtocolSection-D_zaxHEL.js +1 -0
  79. package/apps/web/dist/assets/PublicRunner-CEgXSk3r.js +1 -0
  80. package/apps/web/dist/assets/{ReadOnly-DwewuYi8.js → ReadOnly-CWf5x74a.js} +1 -1
  81. package/apps/web/dist/assets/SettingsPage-Dr8SDk-L.js +2 -0
  82. package/apps/web/dist/assets/SetupPage-B68n0l4I.js +1 -0
  83. package/apps/web/dist/assets/{SharePage-CZClatA_.js → SharePage-DfznN7ar.js} +1 -1
  84. package/apps/web/dist/assets/SkillEditor-BIcIczRc.js +1 -0
  85. package/apps/web/dist/assets/{Skills-Bv6XbKxc.js → Skills-CN4QE7Kx.js} +6 -6
  86. package/apps/web/dist/assets/SpacePage-DiVTwhnJ.js +2 -0
  87. package/apps/web/dist/assets/{UpdateCheck-CLPUsKVT.js → UpdateCheck-QhBI3rlQ.js} +2 -2
  88. package/apps/web/dist/assets/changelog-a_CuplMX.js +1 -0
  89. package/apps/web/dist/assets/{code-editor-Ca5EAxmd.js → code-editor-DkPo1C-L.js} +2 -2
  90. package/apps/web/dist/assets/{host-CJdLkzfY.js → host-D6H6Z9Jp.js} +18 -18
  91. package/apps/web/dist/assets/i18n-BaPKbQ1s.js +55 -0
  92. package/apps/web/dist/assets/{index-w-3J3ZJ9.css → index-CCUG6Vnh.css} +1 -1
  93. package/apps/web/dist/assets/{index-CmonJZHC.js → index-De0Wb42y.js} +4 -4
  94. package/apps/web/dist/assets/{read-aloud-Bfp9_bUY.js → read-aloud-CnFwDSGD.js} +1 -1
  95. package/apps/web/dist/assets/{runners-CUpBpSji.js → runners-0sTPbWzr.js} +1 -1
  96. package/apps/web/dist/assets/session-BMiUrqHg.js +2 -0
  97. package/apps/web/dist/assets/theme-CkNTe-_Z.js +12 -0
  98. package/apps/web/dist/assets/ui-DAk_vjrL.js +16 -0
  99. package/apps/web/dist/assets/{useMutation-1fV4Nnxq.js → useMutation-isHfB33W.js} +1 -1
  100. package/apps/web/dist/assets/{viewers-ChriFcRy.js → viewers-ijNZHJFG.js} +2 -2
  101. package/apps/web/dist/index.html +12 -12
  102. package/apps/web/dist/mcp/flow.html +66 -66
  103. package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +15 -4
  104. package/node_modules/@engenty/wizards/dist/plugin/thread.js +30 -0
  105. package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +13 -1
  106. package/node_modules/@engenty/wizards-shared/dist/connectors.js +8 -0
  107. package/node_modules/@engenty/wizards-shared/dist/definition.d.ts +168 -0
  108. package/node_modules/@engenty/wizards-shared/dist/definition.js +52 -0
  109. package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +18 -0
  110. package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +18 -0
  111. package/node_modules/@engenty/wizards-shared/dist/fit.d.ts +2 -0
  112. package/node_modules/@engenty/wizards-shared/dist/fit.js +4 -0
  113. package/node_modules/@engenty/wizards-shared/dist/knowledge.d.ts +5 -0
  114. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +11 -1
  115. package/node_modules/@engenty/wizards-shared/dist/run.js +14 -0
  116. package/node_modules/@engenty/wizards-shared/dist/runner-texts.d.ts +7 -1
  117. package/node_modules/@engenty/wizards-shared/dist/runner-texts.js +6 -0
  118. package/node_modules/@engenty/wizards-shared/dist/spaces.d.ts +3 -2
  119. package/node_modules/@engenty/wizards-shared/dist/spaces.js +12 -3
  120. package/package.json +1 -1
  121. package/plugin/.claude-plugin/plugin.json +1 -1
  122. package/plugin/plugin.json +1 -1
  123. package/apps/web/dist/assets/CapabilitiesPage-DvSSybt0.js +0 -2
  124. package/apps/web/dist/assets/EditorPage-Duu8swX6.js +0 -3
  125. package/apps/web/dist/assets/Marketplace-Cty40VwG.js +0 -2
  126. package/apps/web/dist/assets/NewWizardPage-B10K8vND.js +0 -7
  127. package/apps/web/dist/assets/OnboardingPage-D3SEpTmt.js +0 -1
  128. package/apps/web/dist/assets/PreviewPane-DhhQ06Ic.js +0 -7
  129. package/apps/web/dist/assets/PublicRunner-B8ncIxIP.js +0 -1
  130. package/apps/web/dist/assets/SettingsPage-C-gGIJLJ.js +0 -2
  131. package/apps/web/dist/assets/SetupPage-CdsrHW-w.js +0 -1
  132. package/apps/web/dist/assets/SkillEditor-BaEiqqXl.js +0 -1
  133. package/apps/web/dist/assets/SpacePage-CYhxcjj0.js +0 -2
  134. package/apps/web/dist/assets/changelog-y5oxYzPd.js +0 -1
  135. package/apps/web/dist/assets/connection-sign-in-DECedzrs.js +0 -1
  136. package/apps/web/dist/assets/i18n-BBzMbGoo.js +0 -55
  137. package/apps/web/dist/assets/session-CMQo8P-G.js +0 -2
  138. package/apps/web/dist/assets/theme-D6KUBJnh.js +0 -11
  139. package/apps/web/dist/assets/ui-BCfu5sia.js +0 -16
@@ -417,12 +417,17 @@ export interface PluginSpaceData {
417
417
  list(space: string): Promise<PluginSpaceItem[]>;
418
418
  /**
419
419
  * The space's own pages (not a wizard's), whoever wrote them, with their Markdown: for a
420
- * plugin that reads what the space knows. `parent`: only the pages under that page.
420
+ * plugin that reads what the space knows. `parent`: only the pages under that page. Only the
421
+ * pages its reader may read by the space's rules: whom the plugin was called for (a step's or
422
+ * a chat's person or guest, an HTTP route's person, the runtime itself in a job) and the plugin.
421
423
  */
422
424
  readPages(space: string, opts?: {
423
425
  parent?: string;
424
426
  }): Promise<PluginSpacePage[]>;
425
- /** The space's files of a kind (`document` when left out), newest first. */
427
+ /**
428
+ * The space's files of a kind (`document` when left out), newest first. Documents only as far
429
+ * as the reader may read them, as `readPages`.
430
+ */
426
431
  files(space: string, kind?: "logo" | "asset" | "document" | "pattern" | "picture"): Promise<PluginSpaceFile[]>;
427
432
  /** One file of the space with its bytes: a price list someone dropped into Knowledge. */
428
433
  readFile(space: string, fileId: string): Promise<PluginSpaceFile & {
@@ -1042,8 +1047,14 @@ export interface PluginRunField {
1042
1047
  /** Whether `when` holds on what is known now. */
1043
1048
  shown?: boolean;
1044
1049
  }
1045
- /** What a run waits for: a page, a review, or a question of a running step. */
1050
+ /** What a run waits for: a page, a review, a question of a running step, or a time. */
1046
1051
  export type PluginRunWaiting = {
1052
+ /** The step that waits. The run goes on by itself at `until`: tell the person, ask nothing. */
1053
+ wait: string;
1054
+ title: string;
1055
+ until: string | null;
1056
+ hint: string;
1057
+ } | {
1047
1058
  page: string;
1048
1059
  title: string;
1049
1060
  known: Record<string, unknown>;
@@ -1077,7 +1088,7 @@ export interface PluginRunReport {
1077
1088
  mode: "test" | "live";
1078
1089
  /** The wizard's language: what to say to the person in. */
1079
1090
  lang: "de" | "en";
1080
- status: "waiting_input" | "running" | "done" | "failed" | "cancelled";
1091
+ status: "waiting_input" | "sleeping" | "running" | "done" | "failed" | "cancelled";
1081
1092
  step: {
1082
1093
  id: string;
1083
1094
  type: string;
@@ -35,6 +35,8 @@ const texts = {
35
35
  screen: "Dieser Teil braucht einen Bildschirm. Danach geht es hier weiter.",
36
36
  open: "Öffnen",
37
37
  working: "{step} – das dauert einen Moment.",
38
+ sleeping: "Das geht am {date} von selbst weiter. Du musst nichts tun.",
39
+ sleepingSoon: "Das geht gleich von selbst weiter. Du musst nichts tun.",
38
40
  reviewAsk: "Passt das so?",
39
41
  reviewOk: "Passt",
40
42
  reviewRedo: "Neue Version",
@@ -70,6 +72,8 @@ const texts = {
70
72
  screen: "This part needs a screen. You carry on here afterwards.",
71
73
  open: "Open",
72
74
  working: "{step} – this takes a moment.",
75
+ sleeping: "This goes on by itself on {date}. You don’t need to do anything.",
76
+ sleepingSoon: "This goes on by itself in a moment. You don’t need to do anything.",
73
77
  reviewAsk: "Is this right?",
74
78
  reviewOk: "Looks good",
75
79
  reviewRedo: "New version",
@@ -88,6 +92,17 @@ function say(lang, key, vars = {}) {
88
92
  }
89
93
  return text;
90
94
  }
95
+ /** When a run goes on, as a person reads it; a chat knows no time zone, so it names the one it means. */
96
+ function dayAndTime(iso, lang) {
97
+ return new Intl.DateTimeFormat(lang, {
98
+ weekday: "long",
99
+ day: "numeric",
100
+ month: "long",
101
+ hour: "numeric",
102
+ minute: "2-digit",
103
+ timeZoneName: "short",
104
+ }).format(new Date(iso));
105
+ }
91
106
  const SKIP_WORDS = new Set(["weiter", "skip", "-", "überspringen", "keine", "none"]);
92
107
  const DONE_WORDS = new Set(["fertig", "done", "ok", "passt", "das wars", "that's it"]);
93
108
  const STOP_WORDS = new Set(["stop", "stopp", "abbrechen", "cancel", "abbruch", "ende"]);
@@ -323,6 +338,21 @@ export class ThreadDoor {
323
338
  this.o.watch(thread);
324
339
  return;
325
340
  }
341
+ if ("wait" in w) {
342
+ // Said once, or when the person writes: for days this thread has nothing else to say.
343
+ const key = `wait:${w.wait}`;
344
+ if (s.said !== key || msg) {
345
+ s.said = key;
346
+ await this.send(thread, {
347
+ kind: "text",
348
+ text: w.until
349
+ ? say(s.lang, "sleeping", { date: dayAndTime(w.until, s.lang) })
350
+ : say(s.lang, "sleepingSoon"),
351
+ });
352
+ }
353
+ this.o.watch(thread);
354
+ return;
355
+ }
326
356
  if ("page" in w) {
327
357
  await this.page(thread, w, msg);
328
358
  }
@@ -89,7 +89,7 @@ export type CriticalKind = (typeof CRITICAL_KINDS)[number];
89
89
  * Why the broker did not run a call (the runtime's broker/call.ts `Refusal`), as the log's
90
90
  * `result` and „Was darf …?“ name it. The Protokoll page has words for each one.
91
91
  */
92
- export declare const BROKER_REFUSALS: readonly ["not_connected", "no_action", "not_in_grant", "denied", "declined", "nobody", "needs_approval", "ai_step_writes", "not_allowed_recipient", "run_limit", "day_limit"];
92
+ export declare const BROKER_REFUSALS: readonly ["not_connected", "no_action", "not_in_grant", "denied", "declined", "nobody", "needs_approval", "ai_step_writes", "not_allowed_recipient", "channel_not_fixed", "run_limit", "day_limit"];
93
93
  export type BrokerRefusal = (typeof BROKER_REFUSALS)[number];
94
94
  /** A person of the organization, as Fähigkeiten › Protokoll names them and „Was darf …?“ offers them. */
95
95
  export interface ProtocolPerson {
@@ -205,6 +205,8 @@ export interface BrokerAnswer {
205
205
  reason: string;
206
206
  refused?: BrokerRefusal;
207
207
  admins?: true;
208
+ /** A guest's post from a fixed step: it runs only to the channel the published step fixes. */
209
+ fixedChannel?: true;
208
210
  }
209
211
  /** What an action does, as the rules see it. */
210
212
  export declare const CONNECTION_ACTION_KINDS: readonly ["read", "write", "destructive", "send"];
@@ -244,6 +246,8 @@ export interface SpaceConnectionView {
244
246
  actions: string[];
245
247
  /** The plugin that set it up, where one did. */
246
248
  plugin: string | null;
249
+ /** That plugin by name, as the runtime carries it; its id where it is not loaded. */
250
+ pluginName?: string | null;
247
251
  /** A `space` sign-in: the account as the provider names it; null until an admin signed in. */
248
252
  account: {
249
253
  label: string;
@@ -262,6 +266,14 @@ export interface SpaceConnectionView {
262
266
  /** A `person` sign-in: how many people signed in; never who. */
263
267
  signedIn: number;
264
268
  }
269
+ /**
270
+ * Whether guests reach a connection: it is for everyone and signs in as the space. Where each
271
+ * person signs in a guest has no sign-in of their own, whatever the audience says.
272
+ */
273
+ export declare function reachedByGuests(c: {
274
+ audience: ConnectionAudience;
275
+ signIn: ConnectionSignIn;
276
+ }): boolean;
265
277
  /** A field an `api_key` connector asks for when someone signs in. */
266
278
  export interface ConnectorKeyField {
267
279
  key: string;
@@ -30,6 +30,7 @@ export const BROKER_REFUSALS = [
30
30
  "needs_approval",
31
31
  "ai_step_writes",
32
32
  "not_allowed_recipient",
33
+ "channel_not_fixed",
33
34
  "run_limit",
34
35
  "day_limit",
35
36
  ];
@@ -50,3 +51,10 @@ export const CONNECTION_LIMITS = {
50
51
  /** Connections one space may hold. */
51
52
  perSpace: 200,
52
53
  };
54
+ /**
55
+ * Whether guests reach a connection: it is for everyone and signs in as the space. Where each
56
+ * person signs in a guest has no sign-in of their own, whatever the audience says.
57
+ */
58
+ export function reachedByGuests(c) {
59
+ return c.audience === "all" && c.signIn === "space";
60
+ }
@@ -1209,6 +1209,57 @@ export declare const resultStepSchema: z.ZodObject<{
1209
1209
  values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
1210
1210
  }, z.core.$strip>>>;
1211
1211
  }, z.core.$strip>;
1212
+ /** "90m", "6h", "2d": how long a `wait` lasts. */
1213
+ export declare const waitDurationSchema: z.ZodString;
1214
+ /** What a duration lasts, in milliseconds. */
1215
+ export declare function waitDurationMs(duration: string): number;
1216
+ /**
1217
+ * A step that waits and needs no process meanwhile: for a time, or until a date. `until` is an
1218
+ * ISO date or a template such as "{{deadline}}"; a date gone by waits for nothing.
1219
+ */
1220
+ export declare const waitStepSchema: z.ZodObject<{
1221
+ id: z.ZodString;
1222
+ title: z.ZodString;
1223
+ description: z.ZodOptional<z.ZodString>;
1224
+ next: z.ZodOptional<z.ZodArray<z.ZodObject<{
1225
+ when: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
1226
+ field: z.ZodString;
1227
+ op: z.ZodEnum<{
1228
+ contains: "contains";
1229
+ empty: "empty";
1230
+ equals: "equals";
1231
+ gt: "gt";
1232
+ in: "in";
1233
+ lt: "lt";
1234
+ notEmpty: "notEmpty";
1235
+ notEquals: "notEquals";
1236
+ }>;
1237
+ value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
1238
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
1239
+ field: z.ZodString;
1240
+ op: z.ZodEnum<{
1241
+ contains: "contains";
1242
+ empty: "empty";
1243
+ equals: "equals";
1244
+ gt: "gt";
1245
+ in: "in";
1246
+ lt: "lt";
1247
+ notEmpty: "notEmpty";
1248
+ notEquals: "notEquals";
1249
+ }>;
1250
+ value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
1251
+ }, z.core.$strip>>]>>;
1252
+ ask: z.ZodOptional<z.ZodString>;
1253
+ goto: z.ZodString;
1254
+ max: z.ZodOptional<z.ZodNumber>;
1255
+ }, z.core.$strip>>>;
1256
+ type: z.ZodLiteral<"wait">;
1257
+ for: z.ZodOptional<z.ZodString>;
1258
+ until: z.ZodOptional<z.ZodString>;
1259
+ }, z.core.$strip>;
1260
+ export type WaitStep = z.infer<typeof waitStepSchema>;
1261
+ /** What a finished wait hands on, as `steps.<wait>.<key>`. */
1262
+ export declare const WAIT_OUTPUT_KEYS: readonly string[];
1212
1263
  export declare const stepSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1213
1264
  id: z.ZodString;
1214
1265
  title: z.ZodString;
@@ -1868,6 +1919,45 @@ export declare const stepSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1868
1919
  show: z.ZodArray<z.ZodString>;
1869
1920
  edit: z.ZodOptional<z.ZodBoolean>;
1870
1921
  regenerate: z.ZodOptional<z.ZodBoolean>;
1922
+ }, z.core.$strip>, z.ZodObject<{
1923
+ id: z.ZodString;
1924
+ title: z.ZodString;
1925
+ description: z.ZodOptional<z.ZodString>;
1926
+ next: z.ZodOptional<z.ZodArray<z.ZodObject<{
1927
+ when: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
1928
+ field: z.ZodString;
1929
+ op: z.ZodEnum<{
1930
+ contains: "contains";
1931
+ empty: "empty";
1932
+ equals: "equals";
1933
+ gt: "gt";
1934
+ in: "in";
1935
+ lt: "lt";
1936
+ notEmpty: "notEmpty";
1937
+ notEquals: "notEquals";
1938
+ }>;
1939
+ value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
1940
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
1941
+ field: z.ZodString;
1942
+ op: z.ZodEnum<{
1943
+ contains: "contains";
1944
+ empty: "empty";
1945
+ equals: "equals";
1946
+ gt: "gt";
1947
+ in: "in";
1948
+ lt: "lt";
1949
+ notEmpty: "notEmpty";
1950
+ notEquals: "notEquals";
1951
+ }>;
1952
+ value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
1953
+ }, z.core.$strip>>]>>;
1954
+ ask: z.ZodOptional<z.ZodString>;
1955
+ goto: z.ZodString;
1956
+ max: z.ZodOptional<z.ZodNumber>;
1957
+ }, z.core.$strip>>>;
1958
+ type: z.ZodLiteral<"wait">;
1959
+ for: z.ZodOptional<z.ZodString>;
1960
+ until: z.ZodOptional<z.ZodString>;
1871
1961
  }, z.core.$strip>, z.ZodObject<{
1872
1962
  id: z.ZodString;
1873
1963
  title: z.ZodString;
@@ -2946,6 +3036,45 @@ export declare const currentWizardSchema: z.ZodObject<{
2946
3036
  show: z.ZodArray<z.ZodString>;
2947
3037
  edit: z.ZodOptional<z.ZodBoolean>;
2948
3038
  regenerate: z.ZodOptional<z.ZodBoolean>;
3039
+ }, z.core.$strip>, z.ZodObject<{
3040
+ id: z.ZodString;
3041
+ title: z.ZodString;
3042
+ description: z.ZodOptional<z.ZodString>;
3043
+ next: z.ZodOptional<z.ZodArray<z.ZodObject<{
3044
+ when: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
3045
+ field: z.ZodString;
3046
+ op: z.ZodEnum<{
3047
+ contains: "contains";
3048
+ empty: "empty";
3049
+ equals: "equals";
3050
+ gt: "gt";
3051
+ in: "in";
3052
+ lt: "lt";
3053
+ notEmpty: "notEmpty";
3054
+ notEquals: "notEquals";
3055
+ }>;
3056
+ value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
3057
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
3058
+ field: z.ZodString;
3059
+ op: z.ZodEnum<{
3060
+ contains: "contains";
3061
+ empty: "empty";
3062
+ equals: "equals";
3063
+ gt: "gt";
3064
+ in: "in";
3065
+ lt: "lt";
3066
+ notEmpty: "notEmpty";
3067
+ notEquals: "notEquals";
3068
+ }>;
3069
+ value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
3070
+ }, z.core.$strip>>]>>;
3071
+ ask: z.ZodOptional<z.ZodString>;
3072
+ goto: z.ZodString;
3073
+ max: z.ZodOptional<z.ZodNumber>;
3074
+ }, z.core.$strip>>>;
3075
+ type: z.ZodLiteral<"wait">;
3076
+ for: z.ZodOptional<z.ZodString>;
3077
+ until: z.ZodOptional<z.ZodString>;
2949
3078
  }, z.core.$strip>, z.ZodObject<{
2950
3079
  id: z.ZodString;
2951
3080
  title: z.ZodString;
@@ -3841,6 +3970,45 @@ export declare const wizardSchema: z.ZodPreprocess<z.ZodObject<{
3841
3970
  show: z.ZodArray<z.ZodString>;
3842
3971
  edit: z.ZodOptional<z.ZodBoolean>;
3843
3972
  regenerate: z.ZodOptional<z.ZodBoolean>;
3973
+ }, z.core.$strip>, z.ZodObject<{
3974
+ id: z.ZodString;
3975
+ title: z.ZodString;
3976
+ description: z.ZodOptional<z.ZodString>;
3977
+ next: z.ZodOptional<z.ZodArray<z.ZodObject<{
3978
+ when: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
3979
+ field: z.ZodString;
3980
+ op: z.ZodEnum<{
3981
+ contains: "contains";
3982
+ empty: "empty";
3983
+ equals: "equals";
3984
+ gt: "gt";
3985
+ in: "in";
3986
+ lt: "lt";
3987
+ notEmpty: "notEmpty";
3988
+ notEquals: "notEquals";
3989
+ }>;
3990
+ value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
3991
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
3992
+ field: z.ZodString;
3993
+ op: z.ZodEnum<{
3994
+ contains: "contains";
3995
+ empty: "empty";
3996
+ equals: "equals";
3997
+ gt: "gt";
3998
+ in: "in";
3999
+ lt: "lt";
4000
+ notEmpty: "notEmpty";
4001
+ notEquals: "notEquals";
4002
+ }>;
4003
+ value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString>]>>;
4004
+ }, z.core.$strip>>]>>;
4005
+ ask: z.ZodOptional<z.ZodString>;
4006
+ goto: z.ZodString;
4007
+ max: z.ZodOptional<z.ZodNumber>;
4008
+ }, z.core.$strip>>>;
4009
+ type: z.ZodLiteral<"wait">;
4010
+ for: z.ZodOptional<z.ZodString>;
4011
+ until: z.ZodOptional<z.ZodString>;
3844
4012
  }, z.core.$strip>, z.ZodObject<{
3845
4013
  id: z.ZodString;
3846
4014
  title: z.ZodString;
@@ -832,6 +832,28 @@ export const resultStepSchema = z.object({
832
832
  */
833
833
  share: z.array(shareOptionSchema).max(12).optional(),
834
834
  });
835
+ /** "90m", "6h", "2d": how long a `wait` lasts. */
836
+ export const waitDurationSchema = z
837
+ .string()
838
+ .regex(/^[1-9]\d{0,3}(m|h|d)$/, 'A duration like "90m", "6h" or "2d".');
839
+ const WAIT_UNIT_MS = { m: 60_000, h: 3_600_000, d: 86_400_000 };
840
+ /** What a duration lasts, in milliseconds. */
841
+ export function waitDurationMs(duration) {
842
+ const unit = duration.slice(-1);
843
+ return Number(duration.slice(0, -1)) * WAIT_UNIT_MS[unit];
844
+ }
845
+ /**
846
+ * A step that waits and needs no process meanwhile: for a time, or until a date. `until` is an
847
+ * ISO date or a template such as "{{deadline}}"; a date gone by waits for nothing.
848
+ */
849
+ export const waitStepSchema = z.object({
850
+ ...stepBase,
851
+ type: z.literal("wait"),
852
+ for: waitDurationSchema.optional(),
853
+ until: z.string().min(1).optional(),
854
+ });
855
+ /** What a finished wait hands on, as `steps.<wait>.<key>`. */
856
+ export const WAIT_OUTPUT_KEYS = ["waited"];
835
857
  export const stepSchema = z.discriminatedUnion("type", [
836
858
  pageStepSchema,
837
859
  agentStepSchema,
@@ -840,6 +862,7 @@ export const stepSchema = z.discriminatedUnion("type", [
840
862
  surfaceStepSchema,
841
863
  motionGraphicsStepSchema,
842
864
  reviewStepSchema,
865
+ waitStepSchema,
843
866
  resultStepSchema,
844
867
  ]);
845
868
  /**
@@ -1264,6 +1287,9 @@ export function validateWizard(def, files) {
1264
1287
  return false;
1265
1288
  }
1266
1289
  const source = def.steps.find((s) => s.id === from);
1290
+ if (source?.type === "wait") {
1291
+ return !probability && WAIT_OUTPUT_KEYS.includes(key);
1292
+ }
1267
1293
  return (source?.type === "agent" &&
1268
1294
  (!probability || isDecisionStep(source)) &&
1269
1295
  (outputKeys(source).includes(key) || (Boolean(source.each) && key === "rows" && !probability)));
@@ -1636,6 +1662,23 @@ export function validateWizard(def, files) {
1636
1662
  }
1637
1663
  }
1638
1664
  break;
1665
+ case "wait":
1666
+ if (Boolean(step.for) === Boolean(step.until)) {
1667
+ issues.push({
1668
+ stepId: step.id,
1669
+ message: 'A wait has "for" or "until": one of them.',
1670
+ });
1671
+ }
1672
+ if (step.until) {
1673
+ checkTemplate(step, step.until);
1674
+ if (!templateRefs(step.until).length && Number.isNaN(Date.parse(step.until))) {
1675
+ issues.push({
1676
+ stepId: step.id,
1677
+ message: `"until" is an ISO date or a template; "${step.until}" is neither.`,
1678
+ });
1679
+ }
1680
+ }
1681
+ break;
1639
1682
  case "review":
1640
1683
  for (const ref of step.show) {
1641
1684
  const list = listRef(ref);
@@ -1645,6 +1688,9 @@ export function validateWizard(def, files) {
1645
1688
  message: `Review shows unknown ${list ? "list" : "step"} "${ref}".`,
1646
1689
  });
1647
1690
  }
1691
+ else if (!list && def.steps.find((s) => s.id === ref)?.type === "wait") {
1692
+ issues.push({ stepId: step.id, message: `A wait has nothing to show: "${ref}".` });
1693
+ }
1648
1694
  else if (list && sharedLists.has(list)) {
1649
1695
  issues.push({ stepId: step.id, message: notShown(list) });
1650
1696
  }
@@ -1659,6 +1705,12 @@ export function validateWizard(def, files) {
1659
1705
  message: `Deliverable from unknown ${list ? "list" : "step"} "${d.from}".`,
1660
1706
  });
1661
1707
  }
1708
+ else if (!list && def.steps.find((s) => s.id === d.from)?.type === "wait") {
1709
+ issues.push({
1710
+ stepId: step.id,
1711
+ message: `A wait has nothing to hand over: "${d.from}".`,
1712
+ });
1713
+ }
1662
1714
  else if (list && sharedLists.has(list)) {
1663
1715
  issues.push({ stepId: step.id, message: notShown(list) });
1664
1716
  }
@@ -177,16 +177,34 @@ export declare const FEATURES: {
177
177
  readonly label: "Pictures in Wissen by what they show";
178
178
  readonly hint: "Pictures and PDF pages are embedded as pictures where the embedding model takes them (EmbeddingGemma 2), so a search finds a photo by what it shows (docs/plans/media-and-files.md).";
179
179
  };
180
+ readonly gatewaySearch: {
181
+ readonly kind: "release";
182
+ readonly default: false;
183
+ readonly label: "Web search through the gateway";
184
+ readonly hint: "web_search through the gateway's /v1/web/search for every model and client, in place of the model's own search. On once the gateway has its provider's key.";
185
+ };
180
186
  readonly dateien: {
181
187
  readonly kind: "release";
182
188
  readonly default: false;
183
189
  readonly label: "Dateien";
184
190
  readonly hint: "File trees another party owns, mounted in a space and indexed where they live: a folder on this computer first (docs/plans/media-and-files.md).";
185
191
  };
192
+ readonly durableRuns: {
193
+ readonly kind: "release";
194
+ readonly default: false;
195
+ readonly label: "Runs that wait for days";
196
+ readonly hint: "Wait steps: a run leaves every process and a clock wakes it. A deadline on automatic steps.";
197
+ };
186
198
  readonly ownKeys: {
187
199
  readonly kind: "plan";
188
200
  readonly default: true;
189
201
  readonly label: "Own API keys";
190
202
  readonly hint: "The organization puts its providers' keys into the cloud studio instead of running on credits.";
191
203
  };
204
+ readonly personSignIn: {
205
+ readonly kind: "plan";
206
+ readonly default: true;
207
+ readonly label: "Each person signs in to a connection";
208
+ readonly hint: "A space's connection may have each person sign in with their own account. Without it a connection signs in as the space.";
209
+ };
192
210
  };
@@ -169,16 +169,34 @@ export const FEATURES = {
169
169
  label: "Pictures in Wissen by what they show",
170
170
  hint: "Pictures and PDF pages are embedded as pictures where the embedding model takes them (EmbeddingGemma 2), so a search finds a photo by what it shows (docs/plans/media-and-files.md).",
171
171
  },
172
+ gatewaySearch: {
173
+ kind: "release",
174
+ default: false,
175
+ label: "Web search through the gateway",
176
+ hint: "web_search through the gateway's /v1/web/search for every model and client, in place of the model's own search. On once the gateway has its provider's key.",
177
+ },
172
178
  dateien: {
173
179
  kind: "release",
174
180
  default: false,
175
181
  label: "Dateien",
176
182
  hint: "File trees another party owns, mounted in a space and indexed where they live: a folder on this computer first (docs/plans/media-and-files.md).",
177
183
  },
184
+ durableRuns: {
185
+ kind: "release",
186
+ default: false,
187
+ label: "Runs that wait for days",
188
+ hint: "Wait steps: a run leaves every process and a clock wakes it. A deadline on automatic steps.",
189
+ },
178
190
  ownKeys: {
179
191
  kind: "plan",
180
192
  default: true,
181
193
  label: "Own API keys",
182
194
  hint: "The organization puts its providers' keys into the cloud studio instead of running on credits.",
183
195
  },
196
+ personSignIn: {
197
+ kind: "plan",
198
+ default: true,
199
+ label: "Each person signs in to a connection",
200
+ hint: "A space's connection may have each person sign in with their own account. Without it a connection signs in as the space.",
201
+ },
184
202
  };
@@ -14,6 +14,8 @@ export type Capability = (typeof CAPABILITY_IDS)[number];
14
14
  */
15
15
  /** Something a step wants beyond a text model, as a stable id every app can word. */
16
16
  export type Need = `tool:${ToolId}` | "connections" | `plugin:${string}` | `asset:${AssetKind}` | "motion-graphics"
17
+ /** A wait outlives the page: the standalone runner has no process that wakes it. */
18
+ | "wait"
17
19
  /** A widget runs in the runtime's widget host; the standalone runner has none yet. */
18
20
  | "widget" | "widget:video" | `field:${Extract<FieldKind, "audio" | "connection" | "slot" | "location" | "image" | "file">}`
19
21
  /** A file the person gives that a later thinking step reads: reading documents is the runtime's. */
@@ -162,6 +162,10 @@ export function needs(step, def) {
162
162
  add("lists", true);
163
163
  }
164
164
  break;
165
+ case "wait":
166
+ // Waiting needs a server that stays: the standalone runner has none.
167
+ add("wait", true);
168
+ break;
165
169
  case "review":
166
170
  if (step.show.some((ref) => listRef(ref))) {
167
171
  add("lists", true);
@@ -221,6 +221,11 @@ export interface KnowledgeSearch {
221
221
  * first: shown on request, in case it was wrong. Empty when nothing was checked.
222
222
  */
223
223
  hidden: KnowledgeHit[];
224
+ /**
225
+ * The query's vector did not come in time (the embedding model was busy, or loading): the words
226
+ * alone found these. Asked again, the search waits for it.
227
+ */
228
+ late: boolean;
224
229
  }
225
230
  /** A day as `YYYY-MM-DD` from what a person or a source wrote: ISO, `14.03.2026`, a timestamp. */
226
231
  export declare function dayOf(value: unknown): string | null;
@@ -4,7 +4,9 @@ import type { ConnectionView, ListDef, ListRow } from "./store.js";
4
4
  import type { Surface } from "./surface.js";
5
5
  import { type Gap, type Texts, type TextTable } from "./texts.js";
6
6
  import type { ThemeColours, ThemeEffect, ThemeShape } from "./theme.js";
7
- export type RunStatus = "waiting_input" | "running" | "done" | "failed" | "cancelled";
7
+ export type RunStatus = "waiting_input" | "sleeping" | "running" | "done" | "failed" | "cancelled";
8
+ /** A person can step back from these; `RunView.canBack` and `goBack` read this one list. */
9
+ export declare const CAN_GO_BACK: ReadonlySet<RunStatus>;
8
10
  export interface AssetRef {
9
11
  id: string;
10
12
  /** image | video | html | text | json */
@@ -272,6 +274,9 @@ declare const NOTES_EN: {
272
274
  readonly clientRefused: "This app may not start runs here.";
273
275
  readonly clientLimit: "This app has started a lot of runs just now. Try again later.";
274
276
  readonly runOver: "The run is over.";
277
+ readonly runSleeps: "The run is waiting. It goes on by itself.";
278
+ readonly waitsOff: "This wizard has a wait step, and those aren’t turned on here yet.";
279
+ readonly waitDateUnreadable: "“{date}” isn’t a date this step can wait for.";
275
280
  readonly runBusy: "The wizard is working right now.";
276
281
  readonly pageOutdated: "This page is out of date.";
277
282
  readonly noStepBefore: "There is no step before this one.";
@@ -391,6 +396,9 @@ declare const NOTES_EN: {
391
396
  readonly connectionEachPersonSignsIn: "Each person signs in to this connection themselves.";
392
397
  readonly connectionSignsInAsSpace: "This connection signs in as the space. Its admins sign it in.";
393
398
  readonly connectionNotForYou: "This connection is not open to you.";
399
+ readonly personSignInNotInPlan: "The {plan} plan doesn’t include each person signing in. A connection signs in as the space.";
400
+ readonly personSignInNotInOrganizationPlan: "Your organization’s plan doesn’t include each person signing in. A connection signs in as the space.";
401
+ readonly pluginConnectionSignsInAsSpace: "A plugin uses this connection. It signs in as the space.";
394
402
  readonly connectorSignsIn: "{name} is connected by signing in, not with keys.";
395
403
  readonly connectorTakesKeys: "{name} takes keys, not a sign-in.";
396
404
  readonly notFound: "This doesn’t exist or was deleted.";
@@ -645,6 +653,8 @@ export interface ShownStep {
645
653
  export interface RunView {
646
654
  id: string;
647
655
  status: RunStatus;
656
+ /** When a run that sleeps goes on; null otherwise. */
657
+ wakeAt: string | null;
648
658
  mode: "test" | "live";
649
659
  wizard: Pick<WizardDefinition, "title" | "description" | "avatar" | "costume" | "intro">;
650
660
  /** The language the wizard speaks, by its code: what is read aloud, and in which voice. */
@@ -1,6 +1,8 @@
1
1
  // SPDX-License-Identifier: FSL-1.1-MIT OR MIT
2
2
  import { isLang, } from "./definition.js";
3
3
  import { lineText, textOf } from "./texts.js";
4
+ /** A person can step back from these; `RunView.canBack` and `goBack` read this one list. */
5
+ export const CAN_GO_BACK = new Set(["waiting_input", "done", "failed"]);
4
6
  /**
5
7
  * What a step reports while it works, in words for each language: the runtime writes the English
6
8
  * line into the run's log, a runner shows it in the language the person reads. The runtime's
@@ -98,6 +100,9 @@ const NOTES_EN = {
98
100
  clientRefused: "This app may not start runs here.",
99
101
  clientLimit: "This app has started a lot of runs just now. Try again later.",
100
102
  runOver: "The run is over.",
103
+ runSleeps: "The run is waiting. It goes on by itself.",
104
+ waitsOff: "This wizard has a wait step, and those aren’t turned on here yet.",
105
+ waitDateUnreadable: "“{date}” isn’t a date this step can wait for.",
101
106
  runBusy: "The wizard is working right now.",
102
107
  pageOutdated: "This page is out of date.",
103
108
  noStepBefore: "There is no step before this one.",
@@ -217,6 +222,9 @@ const NOTES_EN = {
217
222
  connectionEachPersonSignsIn: "Each person signs in to this connection themselves.",
218
223
  connectionSignsInAsSpace: "This connection signs in as the space. Its admins sign it in.",
219
224
  connectionNotForYou: "This connection is not open to you.",
225
+ personSignInNotInPlan: "The {plan} plan doesn’t include each person signing in. A connection signs in as the space.",
226
+ personSignInNotInOrganizationPlan: "Your organization’s plan doesn’t include each person signing in. A connection signs in as the space.",
227
+ pluginConnectionSignsInAsSpace: "A plugin uses this connection. It signs in as the space.",
220
228
  connectorSignsIn: "{name} is connected by signing in, not with keys.",
221
229
  connectorTakesKeys: "{name} takes keys, not a sign-in.",
222
230
  notFound: "This doesn’t exist or was deleted.",
@@ -488,6 +496,9 @@ const NOTES_DE = {
488
496
  clientRefused: "Diese App darf hier keine Läufe starten.",
489
497
  clientLimit: "Diese App hat gerade viele Läufe gestartet. Versuch es später wieder.",
490
498
  runOver: "Der Lauf ist beendet.",
499
+ runSleeps: "Der Lauf wartet. Er geht von selbst weiter.",
500
+ waitsOff: "Dieser Wizard hat einen Warten-Schritt, und die sind hier noch nicht eingeschaltet.",
501
+ waitDateUnreadable: "„{date}“ ist kein Datum, auf das dieser Schritt warten kann.",
491
502
  runBusy: "Der Wizard arbeitet gerade.",
492
503
  pageOutdated: "Diese Seite ist nicht mehr aktuell.",
493
504
  noStepBefore: "Kein vorheriger Schritt.",
@@ -607,6 +618,9 @@ const NOTES_DE = {
607
618
  connectionEachPersonSignsIn: "Bei dieser Verbindung meldet sich jede Person selbst an.",
608
619
  connectionSignsInAsSpace: "Diese Verbindung meldet sich als Space an. Die Admins melden sie an.",
609
620
  connectionNotForYou: "Diese Verbindung steht dir nicht offen.",
621
+ personSignInNotInPlan: "Im Paket {plan} meldet sich nicht jede Person selbst an. Eine Verbindung meldet sich als Space an.",
622
+ personSignInNotInOrganizationPlan: "Im Paket deiner Organisation meldet sich nicht jede Person selbst an. Eine Verbindung meldet sich als Space an.",
623
+ pluginConnectionSignsInAsSpace: "Ein Plugin nutzt diese Verbindung. Sie meldet sich als Space an.",
610
624
  connectorSignsIn: "{name} wird per Anmeldung verbunden, nicht mit Keys.",
611
625
  connectorTakesKeys: "{name} nimmt Keys, keine Anmeldung.",
612
626
  notFound: "Das gibt es nicht oder nicht mehr.",