@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
@@ -3,20 +3,22 @@ import { createHash } from "node:crypto";
3
3
  import { marginOf, } from "@engenty/wizards-shared/decision";
4
4
  import { allFields, branchValues, cardsFromData, conditionMatches, dataRef, followRules, formatsFor, formNeeds, isDataStep, isDecidedField, LIST_FORMATS, listRef, MAX_SHOWN_FIELDS, optionsFromData, outputOf, RUN_DONE_SIGNAL, sectionOf, sectionsOf, signalMissing, textLang, waitDurationMs, whenCalc, whenNames, whenValue, wizardLang, } from "@engenty/wizards-shared/definition";
5
5
  import { agentsMismatch, requiresOf, withRequires } from "@engenty/wizards-shared/requires";
6
- import { CAN_GO_BACK, isNoteTime, note, saidText, } from "@engenty/wizards-shared/run";
6
+ import { CAN_GO_BACK, isNoteTime, note, RUN_ENDED, saidText, } from "@engenty/wizards-shared/run";
7
7
  import { CONVERSATION_RUNNERS, DEFAULT_RUNNER_SETTINGS } from "@engenty/wizards-shared/runners";
8
8
  import { fitData } from "@engenty/wizards-shared/shape";
9
9
  import { FlowRefused, transition, } from "@engenty/wizards-shared/transition";
10
10
  import { machineTranslated, translateDefinition } from "@engenty/wizards-shared/translation";
11
11
  import { wizardAgentsUsed } from "@engenty/wizards-shared/wizard-code";
12
- import { and, eq, lt, sql } from "drizzle-orm";
12
+ import { and, eq, lt, notInArray, sql } from "drizzle-orm";
13
13
  import { nanoid } from "nanoid";
14
14
  import { currentImpersonator } from "../auth/impersonation.js";
15
15
  import { effectsOn, enterVisit } from "../broker/effect.js";
16
- import { grantNote, grantOf, kindOf } from "../broker/index.js";
16
+ import { grantNote, grantOf, inAudience, kindOf } from "../broker/index.js";
17
17
  import { runHolder, subjectsOf } from "../broker/rwx.js";
18
18
  import { resolveConnector } from "../connectors/external.js";
19
- import { connectionViews } from "../connectors/index.js";
19
+ import { candidates, connectionViews, connectorOptions } from "../connectors/index.js";
20
+ import { runConnectionsOn } from "../connectors/person-connections.js";
21
+ import { spaceConnectionOf, spaceConnectorFor } from "../connectors/space-connections.js";
20
22
  import { addLocalCost, canSpend, releaseRun, reserveForRun, syncRunCost, } from "../credits/credits.js";
21
23
  import { estimateRun } from "../credits/estimate.js";
22
24
  import { db, schema, withTenant } from "../db/client.js";
@@ -33,7 +35,7 @@ import { prompt } from "../prompts.js";
33
35
  import { ContentBlockedError, checkGuestInput, checkGuestText, guestChecksOn, guestRun, } from "../safety.js";
34
36
  import { sandboxDataHost } from "../sandbox/data.js";
35
37
  import { peerTicket } from "../secrets/signing.js";
36
- import { nameOf } from "../services/access.js";
38
+ import { isAdminRole, nameOf } from "../services/access.js";
37
39
  import { snapshotFile } from "../services/files.js";
38
40
  import { reportRun } from "../services/manage-reports.js";
39
41
  import { switchedOffRunners } from "../services/runners.js";
@@ -59,8 +61,9 @@ import { readFormInput } from "./input.js";
59
61
  import { withMailText } from "./mail-watch.js";
60
62
  import { noticeFor, noticesFor, noticeWrites, } from "./notices.js";
61
63
  import { pushRun } from "./push.js";
62
- import { blockingMessage, closedChoices, maskedNote, missingModelsSaid, openValue, stepsWithoutModel, tierRefusalSaid, } from "./requirements.js";
64
+ import { blockingMessage, closedChoices, maskedNote, missingConnectionsSaid, missingModelsSaid, openValue, stepsWithoutModel, tierRefusalSaid, } from "./requirements.js";
63
65
  import { liveResources, releaseResources, resourcesFor } from "./resources.js";
66
+ import { needsAhead, needsOfStep, unconnected } from "./run-needs.js";
64
67
  import { dropWait, findSignal, registerWait, runScope, SPACE_SCOPE, sendSignal, } from "./signals.js";
65
68
  import { startedRunEnded, startOf } from "./starts.js";
66
69
  import { outputSchema, runAutomaticStep } from "./steps.js";
@@ -148,7 +151,7 @@ export async function loadSpace(run) {
148
151
  }
149
152
  return p;
150
153
  }
151
- /** Where a run's data is: the client space it was started in, else its wizard's space. */
154
+ /** Where a run's data is: the space it carries, else its wizard's space. */
152
155
  async function dataSpaceOf(run, space) {
153
156
  if (!run.clientSpaceId) {
154
157
  return { id: space.id, name: space.name };
@@ -158,7 +161,7 @@ async function dataSpaceOf(run, space) {
158
161
  where: eq(schema.space.id, run.clientSpaceId),
159
162
  });
160
163
  if (!client) {
161
- throw new Error("client space missing");
164
+ throw new Error("space missing");
162
165
  }
163
166
  return client;
164
167
  }
@@ -239,12 +242,15 @@ async function moveHeld(runId, patch) {
239
242
  /**
240
243
  * Writes the run. Inside its drive the write needs the drive's claim; with `seen`, a person's write
241
244
  * needs the `rev` it read, and a wait's write the status it came from: a cancel wins over either. A
242
- * step may start or answer other runs: only its own run's claim counts.
245
+ * step may start or answer other runs: only its own run's claim counts. With `"open"` the write
246
+ * holds only on a run that has not ended, and says with `false` that it found none.
243
247
  */
244
248
  async function updateRun(runId, patch, seen, by) {
245
249
  const holder = driving.getStore();
246
250
  const held = holder?.runId === runId ? holder : undefined;
247
- const where = and(eq(schema.run.id, runId), held ? eq(schema.run.claim, held.generation) : undefined, seen && ("rev" in seen ? eq(schema.run.rev, seen.rev) : eq(schema.run.status, seen.status)));
251
+ const where = and(eq(schema.run.id, runId), held ? eq(schema.run.claim, held.generation) : undefined, seen === "open"
252
+ ? notInArray(schema.run.status, [...RUN_ENDED])
253
+ : seen && ("rev" in seen ? eq(schema.run.rev, seen.rev) : eq(schema.run.status, seen.status)));
248
254
  const write = db
249
255
  .update(schema.run)
250
256
  .set({
@@ -264,6 +270,9 @@ async function updateRun(runId, patch, seen, by) {
264
270
  if (held) {
265
271
  throw new LostClaim();
266
272
  }
273
+ if (seen === "open") {
274
+ return false;
275
+ }
267
276
  if (seen) {
268
277
  throw new RunConflict({ code: "runBusy" });
269
278
  }
@@ -290,6 +299,7 @@ async function updateRun(runId, patch, seen, by) {
290
299
  reportRun(runId, patch.status);
291
300
  }
292
301
  signalChanged(runId);
302
+ return true;
293
303
  }
294
304
  /**
295
305
  * A run's end, as a signal keyed by its id: another run can wait for it. `data.status` says how it
@@ -421,8 +431,12 @@ export async function createRun(input) {
421
431
  if (noData) {
422
432
  throw new ModelUnavailableError(noData);
423
433
  }
424
- // A step every run passes through needs a model this runtime cannot serve: refuse before anything is held.
425
- const blocked = blockingMessage(await missingModelsSaid(input.definition));
434
+ // A step every run passes through needs a model this runtime cannot serve, or a connection none
435
+ // of whose connectors connects here: refuse before anything is held.
436
+ const blocked = blockingMessage([
437
+ ...(await missingModelsSaid(input.definition)),
438
+ ...(await missingConnectionsSaid(input.definition, await spaceIdOf(input))),
439
+ ]);
426
440
  if (blocked) {
427
441
  throw new ModelUnavailableError(blocked);
428
442
  }
@@ -437,8 +451,8 @@ export async function createRun(input) {
437
451
  }
438
452
  // What the run may reach outside, from the definition it starts on: fixed here, never widened.
439
453
  const grant = grantOf(input.definition);
440
- // Without an account nobody can come back for a result later: it is kept a week. A run of a
441
- // client space is the client's, kept with it.
454
+ // Without an account nobody can come back for a result later: it is kept a week. A run that
455
+ // carries its space is kept with that space.
442
456
  const expiresAt = input.mode === "live" && !input.clientSpaceId
443
457
  ? new Date(Date.now() + env.limits.resultTtlDays * 24 * 60 * 60 * 1000)
444
458
  : null;
@@ -677,7 +691,8 @@ async function driveClaimed(runId, tenant, generation, abort) {
677
691
  await withTenant(tenant, async () => {
678
692
  const run = await loadRun(runId);
679
693
  const lang = run ? textLang(wizardLang(run.definition)) : "en";
680
- await updateRun(runId, { status: "failed", error: saidText(friendly(err), lang) });
694
+ // A run that ended meanwhile, a cancel among them, stays as it ended.
695
+ await updateRun(runId, { status: "failed", error: saidText(friendly(err), lang) }, "open");
681
696
  }).catch((e) => console.error(`[run ${runId}] marking it failed:`, e));
682
697
  }))
683
698
  .finally(async () => {
@@ -870,7 +885,9 @@ export async function makeContext(run, space, state, signal, own = {}) {
870
885
  emit: own.emit ?? ((type, message, asset) => emitEvent(run.id, run.cursor, type, message, asset)),
871
886
  call: { runId: run.id, stepId },
872
887
  ...(own.share ? { share: true } : {}),
873
- saveState: () => updateRun(run.id, { state }),
888
+ saveState: async () => {
889
+ await updateRun(run.id, { state });
890
+ },
874
891
  chargeUsd: (usd) => addLocalCost(run.id, stepId, usd),
875
892
  saveAsset: (input) => saveAsset({
876
893
  ...input,
@@ -1574,9 +1591,7 @@ async function failSaid(err) {
1574
1591
  * isn't looking. A crash before the run sleeps tells again, and that notice replaces this one.
1575
1592
  */
1576
1593
  async function tellPerson(run, stepId, pause) {
1577
- const said = pause.kind === "sign_in"
1578
- ? note("stepWaitsSignIn", { service: pause.service })
1579
- : note("stepWaitsCredits");
1594
+ const said = pause.kind === "sign_in" ? await signInSaid(run, pause) : note("stepWaitsCredits");
1580
1595
  await emitEvent(run.id, stepId, "error", said);
1581
1596
  try {
1582
1597
  const notice = await noticeFor(run, "needs_you", {
@@ -1603,9 +1618,85 @@ async function waitForPerson(run, at, failure, seen) {
1603
1618
  seen,
1604
1619
  err: failure.class === "credits"
1605
1620
  ? new NoCreditsError()
1606
- : new NotedError(note("stepWaitsSignIn", { service: failure.service })),
1621
+ : new NotedError(await signInSaid(run, failure)),
1622
+ });
1623
+ }
1624
+ /**
1625
+ * A step uses a need the run has no account for (none, or several and none chosen): the run waits
1626
+ * for the person to connect or choose one, as long as it takes. Their card says so; it goes on at
1627
+ * once after (`signedIn`).
1628
+ */
1629
+ async function waitForAccount(run, step, need) {
1630
+ const spaceId = await spaceIdOf(run);
1631
+ const service = need.title ?? (await candidates(need, spaceId))[0]?.name ?? need.id;
1632
+ const pause = { kind: "sign_in", service, connection: need.id };
1633
+ const state = structuredClone(run.state);
1634
+ // Woken before anything was connected, it waits again and says nothing new.
1635
+ const told = state.retries?.step === step.id && state.retries.told === "sign_in";
1636
+ state.pause = pause;
1637
+ state.retries = {
1638
+ ...(state.retries?.step === step.id
1639
+ ? state.retries
1640
+ : { step: step.id, count: 0, since: new Date().toISOString() }),
1641
+ told: "sign_in",
1642
+ };
1643
+ await updateRun(run.id, { status: "sleeping", state, wakeAt: null }, { status: "running" });
1644
+ if (!told) {
1645
+ await tellPerson(run, step.id, pause);
1646
+ void pushRun(run.id, "waiting");
1647
+ }
1648
+ }
1649
+ /**
1650
+ * The wizard's need a sign-in is for, where the run has no account to use for it: the connect
1651
+ * card's (`RunView.connect`), not a new sign-in's. With `runConnections` off, never.
1652
+ */
1653
+ async function unconnectedNeed(run, connectionId) {
1654
+ const need = run.definition.connections?.find((c) => c.id === connectionId);
1655
+ if (!(need && (await runConnectionsOn()))) {
1656
+ return null;
1657
+ }
1658
+ return (await unconnected(scopeOf(run), await spaceIdOf(run), [need])).length ? need : null;
1659
+ }
1660
+ /** The connection of the space behind the wizard's connection a sign-in is for, if it is one. */
1661
+ async function spaceRowOf(run, connectionId) {
1662
+ const named = run.definition.connections?.find((c) => c.id === connectionId)?.spaceConnection;
1663
+ return named ? spaceConnectionOf(await spaceIdOf(run), named) : null;
1664
+ }
1665
+ /** What a run that waits for a sign-in says: one that signs in as the space is an admin's to fix. */
1666
+ async function signInSaid(run, pause) {
1667
+ if (await unconnectedNeed(run, pause.connection)) {
1668
+ return note("stepWaitsConnect", { service: pause.service });
1669
+ }
1670
+ const row = await spaceRowOf(run, pause.connection);
1671
+ return note(row?.signIn === "space" ? "stepWaitsAdminSignIn" : "stepWaitsSignIn", {
1672
+ service: pause.service,
1607
1673
  });
1608
1674
  }
1675
+ /**
1676
+ * The person signed in: a run that waits for a sign-in to one of the wizard's connections looks
1677
+ * again now, not at its next look. Still not signed in, the step waits again and says nothing new.
1678
+ */
1679
+ export async function signedIn(runId) {
1680
+ const run = await loadRun(runId);
1681
+ const pause = run?.status === "sleeping" ? run.state.pause : undefined;
1682
+ if (!(run && pause?.kind === "sign_in" && pause.connection)) {
1683
+ return;
1684
+ }
1685
+ const now = new Date();
1686
+ try {
1687
+ await updateRun(run.id, { wakeAt: now }, { rev: run.rev });
1688
+ }
1689
+ catch (err) {
1690
+ // It moved on meanwhile: it no longer waits for this.
1691
+ if (err instanceof RunConflict) {
1692
+ return;
1693
+ }
1694
+ throw err;
1695
+ }
1696
+ await setWake(run.id, now);
1697
+ await wakeDue(now);
1698
+ kick(run.id);
1699
+ }
1609
1700
  /**
1610
1701
  * The error as the flow sorts it. A retry starts the step from the top, so one that may have done
1611
1702
  * something out there is not started again by itself, or the mail goes out twice: a person can still
@@ -1619,7 +1710,11 @@ function flowFailure(err, failure, acted) {
1619
1710
  return { class: "credits" };
1620
1711
  case "sign_in":
1621
1712
  if (err instanceof SignInNeeded) {
1622
- return { class: "sign_in", service: err.service };
1713
+ return {
1714
+ class: "sign_in",
1715
+ service: err.service,
1716
+ ...(err.connection ? { connection: err.connection } : {}),
1717
+ };
1623
1718
  }
1624
1719
  return acted ? { class: "final" } : { class: "sign_in", service: "" };
1625
1720
  default:
@@ -1839,6 +1934,14 @@ async function drive(runId, signal) {
1839
1934
  void pushRun(runId, "waiting");
1840
1935
  return;
1841
1936
  }
1937
+ // A need of this step with no account to use: the person connects or chooses one first.
1938
+ if (await runConnectionsOn()) {
1939
+ const [missing] = await unconnected(scopeOf(run), await spaceIdOf(run), needsOfStep(def, step));
1940
+ if (missing) {
1941
+ await waitForAccount(run, step, missing);
1942
+ return;
1943
+ }
1944
+ }
1842
1945
  // An answer moved the run on without holding again (`answerGoesOn`): it holds before it spends.
1843
1946
  if (run.state.holdLater) {
1844
1947
  const refused = await holdAgain(run).catch((err) => {
@@ -2310,7 +2413,10 @@ export async function retry(runId) {
2310
2413
  }
2311
2414
  export async function cancel(runId) {
2312
2415
  active.get(runId)?.abort();
2313
- await updateRun(runId, { status: "cancelled", wakeAt: null });
2416
+ // A run that is over already stays as it ended.
2417
+ if (!(await updateRun(runId, { status: "cancelled", wakeAt: null }, "open"))) {
2418
+ return;
2419
+ }
2314
2420
  // After the row: a crash in between gives a wake that finds the run over, never a lost cancel.
2315
2421
  await setWake(runId, null);
2316
2422
  }
@@ -2457,11 +2563,109 @@ export async function talkAllowed(run) {
2457
2563
  const { enabled } = w?.runners ?? DEFAULT_RUNNER_SETTINGS;
2458
2564
  return enabled.some((id) => CONVERSATION_RUNNERS.includes(id) && !off.has(id));
2459
2565
  }
2566
+ /** The viewer is the person whose run it is. */
2567
+ export const ownsRun = (run, viewer) => Boolean(viewer.local ||
2568
+ viewer.link ||
2569
+ (viewer.userId && viewer.userId === run.userId) ||
2570
+ (viewer.visitorId && viewer.visitorId === run.visitorId));
2571
+ /**
2572
+ * What a run that waits for a sign-in to one of the wizard's connections offers the viewer. A
2573
+ * connection that signs in as the space is an admin's to sign in again. The card is for the
2574
+ * person whose run it is: the wizard's own account, or their own sign-in to a connection of the
2575
+ * space where each person signs in, if it is open to them. A guest never gets that one.
2576
+ */
2577
+ async function signInOf(run, def, viewer) {
2578
+ const pause = run.status === "sleeping" ? run.state.pause : undefined;
2579
+ const connection = pause?.kind === "sign_in" ? def.connections?.find((c) => c.id === pause.connection) : undefined;
2580
+ if (!connection) {
2581
+ return null;
2582
+ }
2583
+ const row = await spaceRowOf(run, connection.id);
2584
+ if (connection.spaceConnection && !row) {
2585
+ return null;
2586
+ }
2587
+ if (row?.signIn === "space") {
2588
+ return { admin: true };
2589
+ }
2590
+ if (!(viewer && ownsRun(run, viewer))) {
2591
+ return null;
2592
+ }
2593
+ const spaceId = await spaceIdOf(run);
2594
+ const lang = textLang(wizardLang(def));
2595
+ // No account to use for it at all: the connect card of `RunView.connect` asks.
2596
+ if (!row && (await unconnectedNeed(run, connection.id))) {
2597
+ return null;
2598
+ }
2599
+ if (!row) {
2600
+ const [view] = await connectionViews([connection], scopeOf(run), spaceId, lang);
2601
+ // An account the step met and could not use is no account: the card connects anew.
2602
+ return { connection: { ...view, account: null } };
2603
+ }
2604
+ const who = {
2605
+ kind: viewer.role && isAdminRole(viewer.role) ? "admin" : "person",
2606
+ id: viewer.userId ?? "",
2607
+ };
2608
+ if (!(run.userId && viewer.userId === run.userId && inAudience(row.audience, who))) {
2609
+ return null;
2610
+ }
2611
+ return {
2612
+ connection: {
2613
+ id: connection.id,
2614
+ kind: connection.kind ?? null,
2615
+ connector: row.connectorId,
2616
+ title: connection.title ?? row.name,
2617
+ description: connection.description ?? null,
2618
+ account: null,
2619
+ candidates: [],
2620
+ connectors: await connectorOptions({ id: connection.id, connector: row.connectorId }, spaceId, lang),
2621
+ },
2622
+ };
2623
+ }
2624
+ /**
2625
+ * What the run asks the viewer to connect or choose before it goes on (`RunView.connect`), for
2626
+ * the person whose run it is: at its start (nothing passed yet) the needs of the steps every run
2627
+ * passes, and the need of the step it waits at. A need used on a branch only asks when the run
2628
+ * gets there. With `runConnections` off, nothing: a page field connects, as before.
2629
+ */
2630
+ async function connectOf(run, def, viewer) {
2631
+ if (!(viewer && ownsRun(run, viewer) && def.connections?.length)) {
2632
+ return [];
2633
+ }
2634
+ if (!(await runConnectionsOn())) {
2635
+ return [];
2636
+ }
2637
+ const pause = run.status === "sleeping" ? run.state.pause : undefined;
2638
+ const waits = pause?.kind === "sign_in" ? def.connections.filter((c) => c.id === pause.connection) : [];
2639
+ const starting = !run.state.history.length && (run.status === "waiting_input" || waits.length > 0);
2640
+ const ahead = starting ? needsAhead(def, def.steps[0].id, run.state.values) : [];
2641
+ const needs = [...new Set([...waits, ...ahead])];
2642
+ const spaceId = await spaceIdOf(run);
2643
+ const scope = scopeOf(run);
2644
+ const missing = await unconnected(scope, spaceId, needs);
2645
+ if (!missing.length) {
2646
+ return [];
2647
+ }
2648
+ // An admin of the space whose run it is may connect for the space; a guest never.
2649
+ const admin = Boolean(viewer.userId && viewer.userId === run.userId && viewer.role && isAdminRole(viewer.role));
2650
+ const home = run.clientSpaceId ?? spaceId;
2651
+ const views = await connectionViews(missing, scope, spaceId, textLang(wizardLang(def)));
2652
+ return Promise.all(views.map(async (view) => {
2653
+ const forSpace = [];
2654
+ for (const c of admin ? view.connectors : []) {
2655
+ if (await spaceConnectorFor(home, c.id)) {
2656
+ forSpace.push(c.id);
2657
+ }
2658
+ }
2659
+ return { ...view, forSpace };
2660
+ }));
2661
+ }
2460
2662
  /**
2461
2663
  * The run as the viewer sees it. `hide`: steps whose output stays in the space (broker/kept.ts):
2462
2664
  * shown with no output and `kept`, left out of `outputs`; empty for a member, or a member's run.
2665
+ * `viewer`: who looks, for what only they can do here (the connect card while the run waits for
2666
+ * their sign-in).
2463
2667
  */
2464
- export async function runView(run, brand, hide = new Set()) {
2668
+ export async function runView(run, brand, hide = new Set(), viewer) {
2465
2669
  // In the viewer's language every text of the view is the translation; ids and values stay.
2466
2670
  const memory = run.lang ? await storedTranslation(run.wizardId, run.lang) : null;
2467
2671
  const translated = memory ? translateDefinition(run.definition, memory) : null;
@@ -2523,6 +2727,8 @@ export async function runView(run, brand, hide = new Set()) {
2523
2727
  ? (run.wakeAt?.toISOString() ?? null)
2524
2728
  : null,
2525
2729
  pause: run.status === "sleeping" ? (run.state.pause ?? null) : null,
2730
+ signIn: await signInOf(run, def, viewer),
2731
+ connect: await connectOf(run, def, viewer),
2526
2732
  waitsFor: run.status === "waiting_signal" && step?.type === "wait"
2527
2733
  ? waitKeyText(run, step) || null
2528
2734
  : null,
@@ -2,6 +2,7 @@ import { textLang, wizardLang } from "@engenty/wizards-shared/definition";
2
2
  import { saidText } from "@engenty/wizards-shared/run";
3
3
  import { dueOccurrence, fillOf, occurrenceKey, START_FAILURES_TO_PAUSE, } from "@engenty/wizards-shared/starts";
4
4
  import { and, eq, isNull, ne, notInArray, or, sql } from "drizzle-orm";
5
+ import { unwatchedScope } from "../connectors/person-connections.js";
5
6
  import { control, controlDb, db, schema, withTenant } from "../db/client.js";
6
7
  import { env } from "../env.js";
7
8
  import { currentFeatures } from "../features.js";
@@ -9,6 +10,7 @@ import { wizardUnavailable } from "../limits.js";
9
10
  import { noteOf } from "../model-errors.js";
10
11
  import { publishedVersion } from "../services/wizards.js";
11
12
  import { addNotice } from "./notices.js";
13
+ import { blockingMessage, unwatchedConnectionsSaid } from "./requirements.js";
12
14
  import { createRun, OccurrenceTaken } from "./runner.js";
13
15
  /**
14
16
  * Starts: what begins a run without a person. Schedules are looked at once a minute by every
@@ -79,6 +81,13 @@ export async function startFrom(w, start, event, options = {}) {
79
81
  if (!version) {
80
82
  throw new StartRefused(saidText({ code: "wizardUnavailable" }, textLang(wizardLang(w.draft))));
81
83
  }
84
+ // A start nobody owns runs with nobody there: it uses the space's choice for each need.
85
+ const unwatched = start.owner
86
+ ? null
87
+ : blockingMessage(await unwatchedConnectionsSaid(version.definition, unwatchedScope(w.id), w.spaceId));
88
+ if (unwatched) {
89
+ throw new StartRefused(saidText(unwatched, textLang(wizardLang(w.draft))));
90
+ }
82
91
  const runId = await createRun({
83
92
  wizardId: w.id,
84
93
  definition: version.definition,
@@ -5,8 +5,12 @@ export class StepError extends NotedError {
5
5
  /** A fixed step's connection isn't signed in, or the service turned the sign-in down. */
6
6
  export class SignInNeeded extends StepError {
7
7
  service;
8
- constructor(service, said) {
8
+ connection;
9
+ constructor(service, said,
10
+ /** The wizard's connection, by its id in `connections`, the sign-in is for. */
11
+ connection) {
9
12
  super(said);
10
13
  this.service = service;
14
+ this.connection = connection;
11
15
  }
12
16
  }
@@ -91,7 +91,9 @@ class ClaudeCodeModel extends HarnessModel {
91
91
  args.push("--effort", call.effort);
92
92
  }
93
93
  if (call.schema) {
94
- args.push("--json-schema", JSON.stringify(call.schema));
94
+ // The CLI checks the schema with no dialects loaded: one that names its own is refused.
95
+ const { $schema: _dialect, ...schema } = call.schema;
96
+ args.push("--json-schema", JSON.stringify(schema));
95
97
  }
96
98
  if (call.bridgeUrl) {
97
99
  args.push("--mcp-config", JSON.stringify({ mcpServers: { step: { type: "http", url: call.bridgeUrl } } }));
@@ -37,7 +37,7 @@ function toClaims(payload) {
37
37
  if (typeof p.sub !== "string" || typeof p.tenant !== "string") {
38
38
  return null;
39
39
  }
40
- // A role this runtime does not know gets the least: a client's (docs/plans/client-spaces.md).
40
+ // A role this runtime does not know gets the least: a client's (docs/plans/org-spaces.md).
41
41
  const role = p.role === "owner" || p.role === "admin" || p.role === "member" || p.role === "client"
42
42
  ? p.role
43
43
  : "client";
@@ -1,7 +1,7 @@
1
1
  import { signalNameSchema } from "@engenty/wizards-shared/definition";
2
2
  import { describeStart, startInputSchema } from "@engenty/wizards-shared/starts";
3
3
  import { z } from "zod";
4
- import { authoringGuide } from "../authoring/guide.js";
4
+ import { authoringGuide, guideMail } from "../authoring/guide.js";
5
5
  import { wizardOpSchema } from "../authoring/ops.js";
6
6
  import { importFromRegistry, listConnectors, searchRegistry } from "../connectors/external.js";
7
7
  import { guideSpaceConnections } from "../connectors/space-connections.js";
@@ -101,7 +101,7 @@ function presentNote(people) {
101
101
  }
102
102
  export function registerTools(server, who) {
103
103
  // A client of the organization authors nothing: only the elements of their client spaces
104
- // (mcp/elements.ts, docs/plans/client-spaces.md).
104
+ // (mcp/elements.ts, docs/plans/org-spaces.md).
105
105
  if (who.role === "client") {
106
106
  return;
107
107
  }
@@ -216,7 +216,7 @@ export function registerTools(server, who) {
216
216
  readOnly: true,
217
217
  }, async ({ spaceId }) => {
218
218
  const space = await studioSpace(spaceId);
219
- return authoringGuide(await listConnectors(space.id), await pluginToolsOf(who.tenantId), await guideSpaceConnections(space.id), await currentFeatures());
219
+ return authoringGuide(await listConnectors(space.id), await guideMail(), await pluginToolsOf(who.tenantId), await guideSpaceConnections(space.id), await currentFeatures());
220
220
  });
221
221
  // --- connectors ------------------------------------------------------------
222
222
  tool("find_connectors", "wizards:read", {
@@ -19,6 +19,7 @@ import { notFound, ServiceError } from "../services/errors.js";
19
19
  import { runnerSettingsOf, runnersOf } from "../services/runners.js";
20
20
  import { pluginAnswerableRun, pluginRun, refusedInput, runReportOf, waitRun, } from "../services/runs.js";
21
21
  import { shareUrl } from "../services/wizards.js";
22
+ import { CHANNEL_VISITOR } from "../store/index.js";
22
23
  import { visitorOverLimit } from "../tenants/control.js";
23
24
  import { currentTenant } from "../tenants/tenant.js";
24
25
  /**
@@ -29,7 +30,7 @@ import { currentTenant } from "../tenants/tenant.js";
29
30
  */
30
31
  /** A person of a door as the run's visitor: a hash, never the number or the account itself. */
31
32
  function visitorOf(person) {
32
- return `p:${createHash("sha256").update(`${person.channel}:${person.id}`).digest("hex").slice(0, 32)}`;
33
+ return `${CHANNEL_VISITOR}${createHash("sha256").update(`${person.channel}:${person.id}`).digest("hex").slice(0, 32)}`;
33
34
  }
34
35
  export function runsApiFor(pluginId) {
35
36
  return {
@@ -16,11 +16,11 @@ You design wizards for "engenty wizards": a page-by-page flow an end user walks
16
16
 
17
17
  You talk to the ADMIN who builds the wizard, in the studio's chat panel next to a diagram of the wizard. Answer in the admin's language, briefly and warmly. Never mention JSON, ids, schemas, files, templates or tool names to them — talk about pages, questions, steps, the widget and results.
18
18
 
19
- When the admin's message names no wizard yet — a greeting, "test", "hi", a question what this can do — do not build one from those words. Build a showcase instead: a short wizard on a subject anyone gets (a weekend trip, a party invitation, a small shop's offer) that shows the range — a page of questions, an AI step that researches or writes, an image, and a finished document or view. Then say in one or two sentences that it is an example to try with Test and change freely, and ask what they would like to build.
19
+ When the admin's message names no wizard yet — a greeting, "test", "hi", a question what this can do — do not build one from those words. Build a showcase instead: a short wizard on a subject anyone gets (a weekend trip, a party invitation, a small shop's offer), shaped as you would shape it for a real wish on that subject. Then say in one or two sentences that it is an example to try with Test and change freely, and ask what they would like to build.
20
20
 
21
21
  A message that starts with "New step" (in the admin's language) comes from the studio's step panel or diagram: add exactly that one step in the place it names – of the kind in brackets, or the kind that fits best when none is named – and build it completely: a page's fields, an AI step's instructions and output, a view's components and data, a widget with its HTML and sample.json. Read what it needs from the steps before it, and leave the other steps as they are unless the new step needs a change there. With "Only if:" or "AI decides:" (in the admin's language) the new step is a branch that only some runs take: put it right after the step before it, and give that step a rule to the new step (a "when" condition written from the admin's words against the data known there, or an "ask" statement for AI decides) plus an "otherwise" rule (only "goto") to the step every other run went to before; the new step then goes on to that same step as the next in the list. Keep that step's other rules.
22
22
 
23
- Finish with one to three sentences: what you built or changed, and at most one suggestion of what to try next. If they only asked a question, just answer it.
23
+ Write to the admin once, when you are done, in one to three sentences: what you built or changed, and at most one suggestion of what to try next. While you work, the studio shows each step you take, so write nothing before that. If they only asked a question, just answer it.
24
24
 
25
25
  <!-- Technical: engineering owns everything below. -->
26
26
 
@@ -66,7 +66,7 @@ ${surfaces}
66
66
 
67
67
  ${space_tools}
68
68
 
69
- Example of a complete wizard:
69
+ Example of the format: one complete wizard, one shape of many (shape each wizard by its own wish):
70
70
  ```json
71
71
  ${example}
72
72
  ```
@@ -25,6 +25,7 @@ How good wizards look:
25
25
  never a table of things for a person — a table only for figures compared across columns (prices, dates).
26
26
  - A page whose fields depend on an earlier answer uses "when" on its fields, never one copy of the page per answer and a branch to each copy. Choices that depend on what an earlier step found use "optionsFrom", never one page per possible result.
27
27
  - Few pages, 1–5 fields each, one theme per page. Only ask what the result really needs; prefer selects with sensible defaults.
28
+ - Every step earns its place. A model step is for what needs judgement or language: reading, judging, researching, writing. What the person typed is saved, sent and shown without one, and fixed rules are worked out without one: sums, savings, a quiz score against known answers, a reference number. One line of it is a calc on a page or in a view (a Metric with { "calc": … }); more is a code step where the guide describes them. A wizard whose result is worked out from the answers needs no model step at all. An image goes in only where the result needs a picture.
28
29
  - Put a review step before anything expensive (video) and before anything written elsewhere (mail, CRM), so people can
29
30
  correct or regenerate. A result people can simply make again needs no review before it.
30
31
  - Money/totals: use an "items" field with vat — the runner computes totals; documents must use {{items}} verbatim. Never let a model compute totals.
@@ -36,10 +37,10 @@ How good wizards look:
36
37
  ${sandbox}
37
38
  - Remembering between runs ("merke dir", "führe eine Liste"): declare a list and let an agent step save into it with list_write; a later run reads it as {{lists.id}} or list_read. Give it a key column so known rows are updated, not duplicated. Never make the person re-upload last time's result.
38
39
  - More than a list holds (several related tables, what was already seen, counts over time, a cache): the wizard's own database, "data" with a schema file "data/schema.sql". Agent steps get data_query and data_exec; a tool step with "data" runs one fixed statement. Sign-ups and anything every run collects go in a "shared" database, written by a tool step: in a guest's run an agent step reaches the person's own database only.
39
- - Collecting from everyone who runs the wizard (requests, leads, sign-ups, feedback): a list with "shared": true, saved with list_write. It is the admin's, under Space → Data; never show one person's rows to another. Longer text for every run (a running summary, a log): the "pages" tool.
40
+ - Collecting from everyone who runs the wizard (requests, leads, sign-ups, applications, feedback): a list with "shared": true, saved with list_write. It is the admin's, under Space → Data; never show one person's rows to another. What a step works out for the admin (a score, an assessment) goes into that row too, or it reaches nobody. Longer text for every run (a running summary, a log): the "pages" tool.
40
41
  - The person's mail: one connection of kind "mail", a page field of kind "connection" early in the wizard, and the agent step lists it in "connections". Do not ask for the provider or the address in other fields — the connect field does that.
41
42
  - Working in a service for the person (read their Notion, create an issue, look up a customer): import the service as a connector, declare a connection with "connector", put a page field of kind "connection" before the step, and list the connection in the step's "connections". Prefer a connector over the browser whenever the service has one.
42
- - Working in the space's own account (its CRM, its calendar, its mailbox — set up by the admins, listed below as connections of the space): declare a connection with "spaceConnection", no connect field. AI steps READ there; every WRITE (create, update, send, delete) is a tool step: "call" with the connection, the action and fixed input fields from the run's values — the AI never writes as the space, and the person running is never asked for it. Example: an agent step reads the request and extracts the fields; then { "type": "tool", "call": { "connection": "crm", "action": "create_contact", "input": { "email": "{{email}}", "note": "{{steps.read.summary}}" } } }.
43
+ - Working in the space's own account (its CRM, its calendar, its mailbox — set up by the admins, listed below as connections of the space): declare a connection with "spaceConnection", no connect field. AI steps READ there; every WRITE (create, update, send, delete) is a tool step: "call" with the connection, the action and fixed input fields from the run's values — the AI never writes as the space, and the person running is never asked for it. The business's own account is never a connection the person running signs in to. Where the wish writes into such an account and the space has no connection for it yet, build the rest, leave the write out, and tell the admin to connect the service to the space first; then the write is one tool step. Example: an agent step reads the request and extracts the fields; then { "type": "tool", "call": { "connection": "crm", "action": "create_contact", "input": { "email": "{{email}}", "note": "{{steps.read.summary}}" } } }.
43
44
  - Logins on websites: never ask for passwords in page fields. An agent step with the browser tool asks the person at the moment it meets the login (browser_request_credentials); write that into its instructions, and that it must go on without the site when the person skips.
44
45
  - Most people open a wizard on their phone. Keep pages short, and let the phone do the typing: photos with an "image" field (multiple) instead of descriptions, the place with a "location" field instead of an address form, what happened as an "audio" field instead of a long textarea (keep an optional textarea beside it), a sign-off as a "signature" field, a serial or ticket number as a "text" field with scan. Typical: damage report, handover protocol, site inspection, delivery note.
45
46
  - How it runs: the first message may name the channels ("Läuft als: …" / "Runs as: …"); they are set already, never ask about them. A call, an SMS or WhatsApp asks by voice or text only: where one of them is named, keep each answer to text, a choice, a number or a date, and leave photos, files, signatures and maps to pages that only the browser shows (a call hands over a link by SMS).
@@ -56,7 +57,7 @@ ${sandbox}
56
57
  - Prices come from a file the admin keeps in the workspace (a CSV price list): the agent step looks them up with read_workspace_file and proposes positions as a table; the next page shows them in an "items" field with "prefill" for the person to correct; the runner computes the totals.
57
58
  - AI media is marked for you (EU AI Act, Art. 50): images, clips, voice-overs and videos carry the marking in their file metadata, and the pages lay the EU's "AI" label over them. Never ask an image step to draw such a label into the picture. A video is different — it leaves the page as a video file, so its widget shows the EU label in the picture: wizard.ai tells a widget whether the run's media in its data is "generated" or "edited" (video/video.js draws the matching icon).
58
59
  - Every step a person sees later (review/result) must come from an earlier step id.
59
- - Write all wizard texts in the admin's language.
60
+ - Write all wizard texts in the admin's language. In German, name people plainly ("Kunden", "Bewerber"), without ":innen" or "*innen".
60
61
 
61
62
  <!-- Technical: engineering owns everything below. -->
62
63
 
@@ -143,7 +144,7 @@ type List = {
143
144
 
144
145
  type Connection =
145
146
  | { id, kind: "mail", title?, description? }
146
- // the person picks how to connect (Gmail, Outlook, or any mailbox over IMAP); steps only ever READ it
147
+ // the person picks how to connect, from the mail connectors listed below that connect here; steps only ever READ it
147
148
  | { id, spaceConnection: spaceConnectionId, actions?: actionId[], title?, description? }
148
149
  // a connection of the SPACE (listed below), set up by its admins, who chose how it signs in, who may use it and
149
150
  // what each kind of action may do; the wizard holds no account and "policy" has no say. Where it signs in as
@@ -705,8 +706,18 @@ Connectors a wizard of this space can use (built in, or imported from the integr
705
706
  ${connectors}
706
707
 
707
708
  <!-- section: line.connectors.not_set_up -->
708
- <!-- After a connector's name, behind " — ", when people cannot connect an account on this server. -->
709
- NOT SET UP on this server: tell the admin before you build on it
709
+ <!-- After a connector's name, behind " — ", when people cannot connect an account on this server; line.connectors.settings may follow. -->
710
+ CAN'T CONNECT on this server yet: don't build on it, and don't name it as a way to connect
711
+
712
+ <!-- section: line.connectors.settings -->
713
+ <!-- After line.connectors.not_set_up where the settings are known; settings: the environment variables, comma-separated. -->
714
+ (the server's owner sets ${settings})
715
+
716
+ <!-- section: line.connectors.mail -->
717
+ <!-- connectors: one "- name" line per connector behind kind "mail", with line.connectors.not_set_up where it can't connect. -->
718
+ A connection of kind "mail" connects a mailbox here with these connectors; the person picks one:
719
+ ${connectors}
720
+ Name only connectors that connect here: a title, label or description that says Gmail where only IMAP connects promises what the page can't do. Where the wish names a service that can't connect here yet (a mail provider above, or a connector marked CAN'T CONNECT), build with what connects, and tell the person in your reply that this service can't connect here yet and what the server's owner sets for it.
710
721
 
711
722
  <!-- section: line.connectors.no_actions -->
712
723
  actions appear once an account is connected
@@ -109,11 +109,6 @@ Skills of the space (Sources → Skills): instructions its wizards follow, alway
109
109
  <!-- section: turn.skills_empty -->
110
110
  The person talks to you from Skills, which is empty: skills are instructions the wizards follow. They are written, uploaded or added from skills.sh on that page.
111
111
 
112
- <!-- "missing": what the studio lacks, a list the code makes. -->
113
-
114
- <!-- section: turn.off -->
115
- Not in this studio (no tools for it; never offer it): ${missing}.
116
-
117
112
  <!-- What the person wrote while a turn was running, before its next step; "messages" joined by a blank line. -->
118
113
 
119
114
  <!-- section: signal -->