@engenty/wizards-runtime 0.16.2 → 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 (95) hide show
  1. package/apps/runtime/dist/agents/studio-assistant.js +13 -6
  2. package/apps/runtime/dist/assistant/knows.js +15 -2
  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/docs/dev/broker.md +72 -26
  11. package/apps/runtime/dist/docs/dev/plugins/space.md +13 -2
  12. package/apps/runtime/dist/docs/user-guide/capabilities.md +51 -7
  13. package/apps/runtime/dist/docs/user-guide/connectors.md +6 -3
  14. package/apps/runtime/dist/docs/user-guide/protocol.md +30 -4
  15. package/apps/runtime/dist/docs/user-guide/together.md +4 -4
  16. package/apps/runtime/dist/elements/knowledge.js +16 -12
  17. package/apps/runtime/dist/engine/steps.js +3 -2
  18. package/apps/runtime/dist/index.js +8 -0
  19. package/apps/runtime/dist/live/hub.js +17 -3
  20. package/apps/runtime/dist/live/origin.js +6 -4
  21. package/apps/runtime/dist/live/views.js +38 -7
  22. package/apps/runtime/dist/models.js +18 -0
  23. package/apps/runtime/dist/prompts/tools.md +1 -1
  24. package/apps/runtime/dist/routes/api.js +2 -2
  25. package/apps/runtime/dist/routes/broker.js +59 -20
  26. package/apps/runtime/dist/routes/live.js +4 -2
  27. package/apps/runtime/dist/routes/studio.js +13 -2
  28. package/apps/runtime/dist/services/api.js +4 -2
  29. package/apps/runtime/dist/services/errors.js +1 -0
  30. package/apps/runtime/dist/services/knowledge.js +93 -27
  31. package/apps/runtime/dist/services/members-studio.js +22 -2
  32. package/apps/runtime/dist/services/space-categories.js +83 -5
  33. package/apps/runtime/dist/services/space-index.js +77 -21
  34. package/apps/runtime/dist/services/space-origin.js +28 -11
  35. package/apps/runtime/dist/services/work-ai.js +15 -5
  36. package/apps/runtime/dist/sharing/jobs.js +2 -0
  37. package/apps/runtime/dist/sync/hub.js +17 -3
  38. package/apps/runtime/dist/texts.js +6 -4
  39. package/apps/runtime/dist/tools/index.js +13 -7
  40. package/apps/runtime/dist/tools/web-search.js +36 -0
  41. package/apps/web/dist/assets/{AboutDialog-BCcD8hKm.js → AboutDialog-B2Xmxyj4.js} +1 -1
  42. package/apps/web/dist/assets/{BlockEditor-DgaUm2pR.js → BlockEditor-D0HoUSih.js} +1 -1
  43. package/apps/web/dist/assets/CapabilitiesPage-C1th2cZE.js +2 -0
  44. package/apps/web/dist/assets/{ChangelogDialog-B08elwyr.js → ChangelogDialog-BIrJbAKi.js} +1 -1
  45. package/apps/web/dist/assets/{CodeEditor-BiyOk_SC.js → CodeEditor-DUVcXI5P.js} +1 -1
  46. package/apps/web/dist/assets/{EditorPage-EMFTHEYD.js → EditorPage-56sIqEfF.js} +1 -1
  47. package/apps/web/dist/assets/{FlowPreview-DF_6TvZ0.js → FlowPreview-BIag8_Be.js} +1 -1
  48. package/apps/web/dist/assets/{LangSwitch-Ba4OWLzJ.js → LangSwitch-CJ00IgaO.js} +1 -1
  49. package/apps/web/dist/assets/{Marketplace-DqziLf66.js → Marketplace-D7-ot9Dz.js} +2 -2
  50. package/apps/web/dist/assets/{NewWizardChannels-CsIGp0nZ.js → NewWizardChannels-DI3SQ4iS.js} +1 -1
  51. package/apps/web/dist/assets/{NewWizardPage-CzQAkKMy.js → NewWizardPage-CytheHxX.js} +1 -1
  52. package/apps/web/dist/assets/{OnboardingPage-B9gr2OX5.js → OnboardingPage-_91Pa8Ad.js} +1 -1
  53. package/apps/web/dist/assets/{PreviewPane-DSOV3o-1.js → PreviewPane-BDsYm-_K.js} +2 -2
  54. package/apps/web/dist/assets/ProtocolSection-D_zaxHEL.js +1 -0
  55. package/apps/web/dist/assets/{PublicRunner-BVs8-Vu3.js → PublicRunner-CEgXSk3r.js} +1 -1
  56. package/apps/web/dist/assets/{ReadOnly--4CIJCDD.js → ReadOnly-CWf5x74a.js} +1 -1
  57. package/apps/web/dist/assets/SettingsPage-Dr8SDk-L.js +2 -0
  58. package/apps/web/dist/assets/{SetupPage-9Zk-KUGA.js → SetupPage-B68n0l4I.js} +1 -1
  59. package/apps/web/dist/assets/{SharePage-D_Ab0gjr.js → SharePage-DfznN7ar.js} +1 -1
  60. package/apps/web/dist/assets/{SkillEditor-DvtameHg.js → SkillEditor-BIcIczRc.js} +1 -1
  61. package/apps/web/dist/assets/{Skills-Cf1Kl4Fy.js → Skills-CN4QE7Kx.js} +1 -1
  62. package/apps/web/dist/assets/{SpacePage-CyqVzX9b.js → SpacePage-DiVTwhnJ.js} +2 -2
  63. package/apps/web/dist/assets/{UpdateCheck-DweZBVP6.js → UpdateCheck-QhBI3rlQ.js} +2 -2
  64. package/apps/web/dist/assets/changelog-a_CuplMX.js +1 -0
  65. package/apps/web/dist/assets/{code-editor-B1RbFTAZ.js → code-editor-DkPo1C-L.js} +2 -2
  66. package/apps/web/dist/assets/{host-CKS5U5Vg.js → host-D6H6Z9Jp.js} +6 -6
  67. package/apps/web/dist/assets/i18n-BaPKbQ1s.js +55 -0
  68. package/apps/web/dist/assets/{index-w-3J3ZJ9.css → index-CCUG6Vnh.css} +1 -1
  69. package/apps/web/dist/assets/{index-Ckcn5vy7.js → index-De0Wb42y.js} +3 -3
  70. package/apps/web/dist/assets/{read-aloud-Bq88XUHC.js → read-aloud-CnFwDSGD.js} +1 -1
  71. package/apps/web/dist/assets/{runners-DvYVe9Dt.js → runners-0sTPbWzr.js} +1 -1
  72. package/apps/web/dist/assets/{session-D2bjiA3P.js → session-BMiUrqHg.js} +1 -1
  73. package/apps/web/dist/assets/{theme-CNJIC2be.js → theme-CkNTe-_Z.js} +1 -1
  74. package/apps/web/dist/assets/{ui-Mplfhz_Z.js → ui-DAk_vjrL.js} +1 -1
  75. package/apps/web/dist/assets/{useMutation-8QRM-z4M.js → useMutation-isHfB33W.js} +1 -1
  76. package/apps/web/dist/assets/{viewers-CEocUV_2.js → viewers-ijNZHJFG.js} +2 -2
  77. package/apps/web/dist/index.html +12 -12
  78. package/apps/web/dist/mcp/flow.html +2 -2
  79. package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +7 -2
  80. package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +13 -1
  81. package/node_modules/@engenty/wizards-shared/dist/connectors.js +8 -0
  82. package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +12 -0
  83. package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +12 -0
  84. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +3 -0
  85. package/node_modules/@engenty/wizards-shared/dist/run.js +6 -0
  86. package/node_modules/@engenty/wizards-shared/dist/spaces.d.ts +3 -2
  87. package/node_modules/@engenty/wizards-shared/dist/spaces.js +12 -3
  88. package/package.json +1 -1
  89. package/plugin/.claude-plugin/plugin.json +1 -1
  90. package/plugin/plugin.json +1 -1
  91. package/apps/web/dist/assets/CapabilitiesPage-DuJJV1ll.js +0 -2
  92. package/apps/web/dist/assets/SettingsPage-z2u8lSe2.js +0 -2
  93. package/apps/web/dist/assets/changelog-C85v9OWg.js +0 -1
  94. package/apps/web/dist/assets/connection-sign-in-CaVvh5GQ.js +0 -1
  95. package/apps/web/dist/assets/i18n-Bymk5Ev-.js +0 -55
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: The broker
3
3
  description: The one path every connector call takes in engenty wizards – who calls, what decides, what a run may reach, what is logged and heard, the RWX rules and the routes the studio uses.
4
- version: 0.13.0
4
+ version: 0.16.2
5
5
  ---
6
6
 
7
7
  Every call a wizard step, a Work chat, Goose, a share target or a plugin makes to a connected
@@ -151,9 +151,10 @@ has words for each:
151
151
  | `nobody` | The rules say ask, and nobody can be asked |
152
152
  | `needs_approval` | *Mit Freigabe* on a connection that signs in as the space: the call waits for an admin |
153
153
  | `ai_step_writes` | An AI step wanted to change, delete or send as the space |
154
- | `not_allowed_recipient` | A guest’s send to an address that is neither the run’s own nor in the space’s mail domains |
155
- | `run_limit` | A guest’s run has sent its mails (`GUEST_MAILS_PER_RUN`, 3) |
156
- | `day_limit` | The wizard’s guests have sent today’s mails (`wizard.dailyMailLimit`, 50 unless set) |
154
+ | `not_allowed_recipient` | A guest’s send to an address that is neither the run’s own nor in the space’s mail domains, or a send that names no recipient |
155
+ | `channel_not_fixed` | A guest’s post to a channel that the published step does not fix |
156
+ | `run_limit` | A guest’s run has sent its mails and posts (`GUEST_MAILS_PER_RUN`, 3) |
157
+ | `day_limit` | The wizard’s guests have sent today’s mails and posts (`wizard.dailyMailLimit`, 50 unless set) |
157
158
 
158
159
  ## The run’s grant
159
160
 
@@ -164,12 +165,18 @@ interface Grant {
164
165
  connections: Record<string, string[]>; // action ids, or the kind "read"
165
166
  hosts: string[]; // names, or "*.example.org"
166
167
  tools: string[];
168
+ channels?: Record<string, FixedChannel>; // by step id: { connection, action, channel }
167
169
  }
168
170
  ```
169
171
 
170
172
  - A step’s `connections` add the actions its connection names, or `read` without a list.
171
173
  - A fixed step’s `call` adds its one action on its connection.
172
174
  - A step’s `hosts` add the hosts `http_request` may reach.
175
+ - A fixed step whose `call.input.channel` is a literal adds that channel under the step’s id.
176
+ A literal is a text with no `{{…}}` in it. A channel that comes from a field, a value or an
177
+ earlier step is a template and adds nothing. `connection` is the id the log uses: the space
178
+ connection’s where the wizard’s entry names one, else the entry’s own. A run that started
179
+ before this has no `channels`.
173
180
 
174
181
  `createRun` (`engine/runner.ts`) computes the grant from the definition the run starts on: the
175
182
  published one for a live run, the draft for a test run. It keeps the grant in `run.grant`, so an
@@ -183,9 +190,20 @@ once from the run’s definition and writes it. `inGrant` always lets `list_tool
183
190
  `host:<name>`, action `http_request`, kind `send`. A guest’s run reaches only the hosts in its
184
191
  grant. A member’s run reaches any public host, until the `broker` switch is on.
185
192
  - `guestSendCheck` (`broker/send.ts`) lets a guest’s send go only to an address a page field of
186
- kind `email` collected in the run, or to the space’s `mailDomains`, within the limits above.
187
- It holds a connection’s send action as well as the email share target. A send whose input
188
- names no address, such as a Slack post, is refused for a guest.
193
+ kind `email` collected in the run, or to the space’s `mailDomains`. It holds a connection’s
194
+ send action as well as the email share target.
195
+ - A guest’s post to a channel is Slack’s `post_message` (`postsToChannel`), and its input names
196
+ the channel as `channel`. `guestPostCheck` is pure and allows it only when a fixed step posts
197
+ (`who.kind` is `step`) and `channelInGrant` finds that step, connection, action and channel in
198
+ the run’s grant. The grant comes from the published definition, so nothing the guest typed
199
+ decides it. Everything else is refused as `channel_not_fixed`: a templated channel, even
200
+ where it renders to the same id, and the guest’s own call from an AI step or the Slack share
201
+ target.
202
+ - Any other send that names no address is refused as `not_allowed_recipient`. That holds an
203
+ imported connector’s send: nothing says which of its inputs names where it goes.
204
+ - The limits count mails and posts together, per run and per wizard and day. They count what
205
+ `broker_log` holds as an `ok` send of a guest (`who_kind` `guest`) or of a fixed step in a
206
+ guest’s run (`who_kind` `step`), and no request to a host.
189
207
  - `keptStepIds` (`broker/kept.ts`) names the steps of a guest’s run that read from a space
190
208
  connection whose audience is not `all`. Their results stay in the space.
191
209
 
@@ -198,6 +216,24 @@ once from the run’s definition and writes it. `inGrant` always lets `list_tool
198
216
  field name doesn’t look like a secret, and a SHA-256 of the whole. No token, key, password or body
199
217
  is ever written. A log that can’t be written never stops the call.
200
218
 
219
+ Admins read the whole log of a space. A member reads their own lines, where the space’s Studio is
220
+ open to members (`services/members-studio.ts`). `ownLines(userId)` in `broker/log.ts` says which
221
+ those are:
222
+
223
+ - `who_kind` is `person` or `goose` and `who_id` is the member. An AI step calls as the person
224
+ its run is held for, so its lines are among them;
225
+ - `who_kind` is `step` and the line’s run is held for the member (`run.user_id`).
226
+
227
+ `logOfSpace` and `logLine` take the member as `own` and put `ownLines` into the query’s `where`.
228
+ So a page, a cursor, a filter and a search never count another person’s line, and
229
+ `GET /spaces/:id/broker/log/:line` answers 404 for one, as for a line that isn’t there. A line
230
+ the member wrote as an admin (`who_kind` `admin`, `change_rules` among them) is not theirs.
231
+
232
+ `routes/broker.ts` names a member’s lines with less than an admin’s: the only person is the
233
+ member, a space connection outside their audience has no name, connector or action name, and
234
+ `run` with its grant is there only for a run held for them. Everything else on the line is the
235
+ member’s own call: the input’s summary, the outcome, the rule, the reason and the critical mark.
236
+
201
237
  `criticalOf(row)` in `broker/log.ts` is the one place that decides whether a row is critical:
202
238
 
203
239
  | `CRITICAL_KINDS` | When |
@@ -208,7 +244,7 @@ is ever written. A log that can’t be written never stops the call.
208
244
  | `limit_reached` | `run_limit` or `day_limit` |
209
245
  | `sign_in_failed` | A sign-in ran out, or the service refused it |
210
246
  | `first_use` | A space connection’s first call that ran |
211
- | `rule_changed` | An admin changed RWX rules, or a connection’s rules or audience (`logRuleChange`) |
247
+ | `rule_changed` | An admin changed RWX rules, or a connection’s rules, audience or way of signing in (`logRuleChange`) |
212
248
 
213
249
  A critical row goes four ways:
214
250
 
@@ -247,19 +283,26 @@ All of this is behind the `broker` switch, on by default. With it off, `decide`,
247
283
  writes a deny. No studio page draws the rules yet.
248
284
 
249
285
  Every reader takes its subjects from whoever it serves: the studio’s person (`whoOf(c)`), a
250
- run’s holder and wizard (`subjectsOf(ctx)`, `runHolder(run)`), Goose for its person. A plugin
251
- reading a document (`server.spaceData.readFile`) reads as whom it serves, and as itself: a tool
252
- in a step or a Work chat as its caller (`subjectsOfCaller`), an HTTP route as the person it
253
- answers, a job as the runtime itself. Anything else reads as the plugin alone, which no seed
254
- allows. The runtime itself is the subject `SYSTEM`, set with `readingAs([SYSTEM], …)` around a
255
- plugin’s job (`plugins/jobs.ts`) and nowhere else: no person, guest or run stands behind a job.
256
- It may read, write and run everything; a deny for the plugin beside it still wins. No rule can
257
- name it, no helper builds it from a request, `decideWith` knows it only by identity, and
286
+ run’s holder and wizard (`subjectsOf(ctx)`, `runHolder(run)`), Goose for its person. What a step
287
+ is told about Knowledge is counted the same way: how many pages, tables and files there are and
288
+ the categories with their values and ranges (`knowledgeBlock`), and what `space_list` counts,
289
+ hold only what the run’s holder and wizard may read.
290
+
291
+ A plugin reading the space’s pages and documents (`server.spaceData.readPages`, `.files`,
292
+ `.readFile`) reads as whom it serves, and as itself: a tool in a step or a Work chat as its
293
+ caller (`subjectsOfCaller`), an HTTP route as the person it answers, a job as the runtime itself.
294
+ Anything else reads as the plugin alone, which no seed allows: the lists come back empty and
295
+ `readFile` is refused. The runtime itself is the subject `SYSTEM`, set with
296
+ `readingAs([SYSTEM], …)` around a plugin’s job (`plugins/jobs.ts`) and nowhere else: no person,
297
+ guest or run stands behind a job. It may read, write and run everything; a deny for the plugin
298
+ beside it still wins. No rule can name it, no helper builds it from a request, `decideWith`
299
+ knows it only by identity, and
258
300
  `test/rwx.test.ts` fails when a new file uses it. A call with no subject at all stays a no.
259
301
 
260
302
  The `capabilities` switch is on by default. It shows the studio’s Capabilities place, opens
261
303
  `/spaces/:id/discover` and makes the rule „Mitglieder dürfen ins Studio“ count. It does not turn
262
- on RWX.
304
+ on RWX. The routes for connections, rules and the broker (`/connections`, `/rules`, `/broker/*`)
305
+ don’t read the switch: with it off they still answer, and only the studio’s pages for them hide.
263
306
 
264
307
  ## Routes
265
308
 
@@ -267,17 +310,17 @@ All under `/api/studio`, for a signed-in person of the organization.
267
310
 
268
311
  | Route | What it does | Who |
269
312
  |---|---|---|
270
- | `GET /spaces/:id/connections` | The space’s connections, each with who set it up | Everyone; a member sees the ones in their audience |
271
- | `POST /spaces/:id/connections` | Sets one up: connector, name, `signIn`, `audience` | Admins |
272
- | `PATCH /connections/:id`, `DELETE /connections/:id` | Changes its name, audience, rules or the actions it is for, or removes it | Admins |
313
+ | `GET /spaces/:id/connections` | The space’s connections, each with who set it up and, where a plugin holds it, the plugin (`plugin`, `pluginName`). `reachedByGuests` (shared) says which ones guests reach: `audience: "all"` and `signIn: "space"` | Everyone; a member sees the ones in their audience |
314
+ | `POST /spaces/:id/connections` | Sets one up: connector, name, `signIn`, `audience`. `signIn: "person"` answers `403 { code: "plan" }` where the plan’s switch `personSignIn` is off | Admins |
315
+ | `PATCH /connections/:id`, `DELETE /connections/:id` | Changes its name, `signIn`, audience, rules or the actions it is for, or removes it. A changed `signIn` forgets the sign-ins of the way it leaves; to `person` it answers `403 { code: "plan" }` without `personSignIn`, and `400` on a plugin’s connection | Admins |
273
316
  | `POST`, `DELETE /connections/:id/sign-in` | Signs the space in or out: `{ credentials }`, or `{ oauth: true }` for a sign-in page | Admins |
274
317
  | `POST`, `DELETE /connections/:id/my-sign-in` | The person’s own sign-in, where each person signs in | Everyone in the audience |
275
318
  | `GET /person/sign-ins` | The person’s connections across their spaces | The person |
276
319
  | `GET /spaces/:id/rules`, `PUT /spaces/:id/rules`, `DELETE /spaces/:id/rules/:ruleId` | The RWX rules, saved as a whole list | Admins; 404 while `broker` is off |
277
- | `GET /spaces/:id/broker/log` | The log, newest first. Filters: `connection`, `who`, `outcome`, `result`, `refused`, `critical`, `since`, `until`, `q`; `cursor` with the `next` of the page before, `limit` | Admins (403 for a member) |
278
- | `GET /spaces/:id/broker/log/:line` | One line, with the run’s grant | Admins |
279
- | `GET /spaces/:id/broker/ask?who=&for=&resource=&action=&in=` | „Was darf …?“: `decide`’s outcome, rule and reason. Nothing runs and nothing is logged | Admins |
280
- | `GET /spaces/:id/broker/choices` | The people and the space’s connections with their actions, for the question | Admins |
320
+ | `GET /spaces/:id/broker/log` | The log, newest first. Filters: `connection`, `who`, `outcome`, `result`, `refused`, `critical`, `since`, `until`, `q`; `cursor` with the `next` of the page before, `limit` | Admins: every line. A member: their own lines (`ownLines`); 403 where the space’s Studio is closed to members |
321
+ | `GET /spaces/:id/broker/log/:line` | One line, with the run’s grant | Admins. A member: their own line; 404 for another person’s |
322
+ | `GET /spaces/:id/broker/ask?who=&for=&resource=&action=&in=` | „Was darf …?“: `decide`’s outcome, rule and reason. A guest’s post to a channel is answered as the call is: a fixed step gets the connection’s rule and the condition in its reason, any other caller `deny` by `guest_send`. Nothing runs and nothing is logged | Admins (403 for a member) |
323
+ | `GET /spaces/:id/broker/choices` | The people and the space’s connections with their actions, for the question | Admins (403 for a member) |
281
324
  | `GET /spaces/:id/discover?q=` | Skills from skills.sh and connectors from integrations.sh, marked where the space has them | Everyone; 404 while `capabilities` is off |
282
325
 
283
326
  ## Not built
@@ -287,11 +330,14 @@ All under `/api/studio`, for a signed-in person of the organization.
287
330
  alone holds the sealing key don’t exist.
288
331
  - **The company sign-in.** A third way to sign in, through the organization’s SSO (MCP
289
332
  Enterprise-Managed Authorization), is not built.
290
- - **Plans.** Signing in as each person is not limited to the Team plan.
333
+ - **Plans.** Each person signing in is the plan switch `personSignIn`, meant for the Pro and Team
334
+ plans. The Manage-App’s Free plan doesn’t name it `false` yet, so every plan has it.
291
335
  - **The Manage-App’s side of the report.** The runtime posts to `POST /v1/broker/:tenant`, and the
292
336
  Manage-App has no endpoint for it yet.
293
337
  - **More of RWX.** No page in the studio draws the rules, and connections, mail, hosts and the
294
- sandbox have no reader that asks RWX.
338
+ sandbox have no reader that asks RWX. `space_search` still says how many items pass its
339
+ `where` (`filtered`) without asking who reads, and what a plugin makes of pages it read in a
340
+ job (the shop’s products) is the plugin’s own data: the rules don’t follow it.
295
341
  - A webhook for critical rows, a choice per kind of what notifies, and one connection offered to
296
342
  several spaces.
297
343
 
@@ -49,8 +49,8 @@ const doc = await server.spaceData.putDocument({ space, key, label, name, mime,
49
49
  | `putTable(input)` | A table: typed `columns`, `rows` (cells by column id, they replace the rows the key had), `format: "faq"` |
50
50
  | `putFile(input)` | A file that is not a page. It is found by its name, `description` and categories; `text` is what a step reads of it |
51
51
  | `putDocument(input)` | A file, read the way an upload is. Returns what it became: `items` (pages, tables), and `review` when it was hard to read or could not be read |
52
- | `readPages(space, { parent? })` | The space’s own pages, whoever wrote them, with their Markdown: `{ id, title, path, parentId, markdown, origin, originKey, updatedAt }` |
53
- | `files(space, kind?)`, `readFile(space, id)` | The space’s files of a kind (`document`, `logo`, `asset`, `pattern`, `picture`; `document` when none is named), newest first, and one file with its bytes, such as a price list someone dropped into Knowledge |
52
+ | `readPages(space, { parent? })` | The space’s own pages, whoever wrote them, with their Markdown: `{ id, title, path, parentId, markdown, origin, originKey, updatedAt }`. Only the pages [the reader](#what-a-plugin-reads) may read |
53
+ | `files(space, kind?)`, `readFile(space, id)` | The space’s files of a kind (`document`, `logo`, `asset`, `pattern`, `picture`; `document` when none is named), newest first, and one file with its bytes, such as a price list someone dropped into Knowledge. Documents only as far as [the reader](#what-a-plugin-reads) may read them |
54
54
  | `list(space)` | Everything the plugin wrote, by key, with its path and `state` |
55
55
  | `remove(space, key?)` | Takes out one key, or everything the plugin wrote in the space. Returns how many items it removed |
56
56
  | `summarize(space, category?, value?)` | Writes the “Overview” of one value, or of every value with three items or more. Each costs a model call. Returns how many it wrote |
@@ -60,6 +60,17 @@ const doc = await server.spaceData.putDocument({ space, key, label, name, mime,
60
60
  and changes nothing, and `remove` leaves it.
61
61
  - What a step reads of an item is its path: `pages/…`, `tables/…`, `files/…`.
62
62
 
63
+ ### What a plugin reads
64
+
65
+ `readPages`, `files` and `readFile` read for someone, and the space’s rules decide what
66
+ ([the broker](../broker.md#rwx-and-the-broker-switch)). A tool in a step or a Work chat reads as
67
+ the person or guest it was called for, an HTTP route as the person it answers, a job
68
+ (`server.every`) as the runtime itself, which may read everything. The plugin is asked beside
69
+ them: a rule that forbids the plugin a page, a folder or a document holds everywhere, in a job
70
+ too. A page or a document the reader may not read is missing from the lists, and `readFile`
71
+ refuses it with `forbidden`. Code that runs for nobody (a public route, a timer of the plugin’s
72
+ own) gets empty lists.
73
+
63
74
  ### Pictures of a page
64
75
 
65
76
  A page read from the web shows pictures from the web. A wizard can’t find them by what they show
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: Capabilities
3
3
  description: One place for what your wizards, Work chats and Goose may use – skills, the space’s connections to other services, the audit of every call, and a search for more.
4
- version: 0.13.0
4
+ version: 0.16.2
5
5
  ---
6
6
 
7
7
  **Capabilities** in the app bar, after Resources, holds what a space’s wizards, Work chats and
@@ -16,7 +16,7 @@ the list of sections stays beside the page.
16
16
  | **Overview** | The skills that count, the space’s connections and the built-in connectors nobody connected yet, on one page, with a search over them. Its second tab, **Discover**, searches skills.sh and integrations.sh | Everyone who uses the studio. Only admins set up a connector from Discover |
17
17
  | **Skills** | Instructions your wizards work by. See [Skills](./skills.md) | Everyone who uses the studio |
18
18
  | **Connectors** | The space’s connections to other services, the built-in connectors and the ones from the registry | Everyone who uses the studio. Members see the connections open to them |
19
- | **Audit** | Every call to a connection, allowed or not. See [Audit](./protocol.md) | The owner and the admins |
19
+ | **Audit** | Every call to a connection, allowed or not. See [Audit](./protocol.md) | The owner and the admins see every line. A member sees their own |
20
20
 
21
21
  The old addresses still work: `/skills` opens Capabilities › Skills, the connectors’ old address
22
22
  in the settings opens Capabilities › Connectors, and `/capabilities/discover` opens the Overview’s
@@ -25,7 +25,9 @@ Discover tab.
25
25
  ## Overview
26
26
 
27
27
  The Overview shows the skills that are always on or on demand, with the ones always on first, and
28
- the space’s connections, each with how it signs in and who may use it. “All” beside each part
28
+ the space’s connections, each with how it signs in and who may use it. A connection that guests
29
+ reach is marked “open to guests”, and admins see a note above the list that counts them (see
30
+ [Connections that guests reach](#connections-that-guests-reach)). “All” beside each part
29
31
  opens its section, and the menu shows how many skills and connections the space has. The search
30
32
  looks through both. The “Discover” tab, or a search for something the space doesn’t have, searches
31
33
  skills.sh and integrations.sh in place, with the same words. “Add” leads to a new skill, a new
@@ -53,16 +55,43 @@ leaves. Only the space’s admins set up a connection, change it or remove it.
53
55
  When an admin sets one up, they choose how it signs in and who may use it. On its page they then
54
56
  set what it may do.
55
57
 
56
- **How it signs in.** This can’t be changed later.
58
+ **How it signs in.**
57
59
 
58
60
  | Signs in | What it means |
59
61
  |---|---|
60
62
  | As the space | An admin signs in once, with an API key, an app token or a team account such as orders@. Everyone uses that account, also when nobody is watching. The AI only reads through it. Changes come from fixed steps or from an action a person confirms in a Work chat |
61
63
  | Each person signs in | Each person signs in once with their own account, on the connection’s page or in their menu. The connection then acts as that person, and asks them before it changes something |
62
64
 
65
+ An admin can change this later on the connection’s page. The change removes the sign-ins made
66
+ until then: every person’s when the connection becomes the space’s, the space’s when each person
67
+ signs in from then on. The page asks before it changes anything. A connection that a plugin uses
68
+ always signs in as the space.
69
+
70
+ In the cloud, your organization’s plan decides whether “Each person signs in” is available. Where
71
+ the plan doesn’t include it, the choice is greyed out with a sentence that says so, and a new
72
+ connection signs in as the space. A connection that already has each person sign in keeps working,
73
+ and people still sign in and out of it. You can change it to “As the space”, but not back. On your
74
+ computer there is no plan, so both ways are always available.
75
+
63
76
  **Who may use it.** Admins, Members or Everyone. Everyone includes guests who start a wizard from
64
77
  its link. A guest’s run never uses a connection that is only for members or admins.
65
78
 
79
+ ### Connections that guests reach
80
+
81
+ Guests reach a connection that is for Everyone and signs in as the space. The list marks each one
82
+ “open to guests”. Where each person signs in, a guest has no sign-in of their own, so guests don’t
83
+ reach it, whoever it is for.
84
+
85
+ Admins see a note above the list, on the Overview and under Connectors, as long as the space has
86
+ such a connection. It says how many there are and names each one. “Narrow to members” beside a
87
+ connection sets it to Members with one click, and nothing changes until you click. To open it
88
+ again, choose Everyone on the connection’s page. Members don’t see the note.
89
+
90
+ A connection that a plugin set up names the plugin, in the list and on its page. The appointment
91
+ planner, for example, books for guests through a calendar connection. The note says so before you
92
+ narrow it: once the connection is for members only, the plugin can’t reach it when a guest starts
93
+ a wizard. What the plugin does by itself, such as keeping a calendar in step, goes on.
94
+
66
95
  **What it may do.** One rule for each kind of action: Read, Change, Delete and Send. Each rule is
67
96
  Allowed, With approval or Never. A new connection reads freely, asks for approval before a change
68
97
  or a send, and never deletes.
@@ -73,6 +102,18 @@ With approval on a connection that signs in as the space asks the space’s admi
73
102
  under the bell in Work until one of them agrees. Where each person signs in, With approval asks
74
103
  that person.
75
104
 
105
+ **What a guest’s run may send.** A guest starts a wizard from its link, and nobody of your team
106
+ watches the run. So the rules above are not all that counts for it:
107
+
108
+ - It sends an email only to the address the guest gave in the wizard, or to an address in the
109
+ space’s own mail domains.
110
+ - It posts to Slack only from a fixed step, and only to the channel written into that step of the
111
+ published wizard. A channel taken from what the guest typed is refused.
112
+ - One run sends three emails and messages in all. A wizard’s guests send a set number per day.
113
+
114
+ Your members’ runs are not bound by this. The [Audit](./protocol.md) shows each refusal with its
115
+ reason.
116
+
76
117
  Members see the connections open to them, with their rules, and change nothing. Where each person
77
118
  signs in, they sign in right there. [Connectors](./connectors.md#connections-in-the-space) has the
78
119
  details, and how a wizard uses a connector of its own.
@@ -92,8 +133,11 @@ You set up no connection there. That stays with the space’s admins.
92
133
 
93
134
  The Audit shows every call your space’s wizards, Work chats and Goose made to a connection, one line
94
135
  each, whether it ran or not. Critical lines, such as a refused change, reach the admins under the
95
- bell in Work. **Who may do what?** tries a rule before anything runs. Only the owner and the admins
96
- see the Audit. [Audit](./protocol.md) explains each line, the filters and what counts as critical.
136
+ bell in Work. **Who may do what?** tries a rule before anything runs, for the owner and the admins.
137
+
138
+ The owner and the admins see every line. A member sees only their own: what they called, what
139
+ Goose called for them and what the fixed steps of their runs called. [Audit](./protocol.md)
140
+ explains each line, the filters, what counts as critical and what a member sees.
97
141
 
98
142
  ## Discover
99
143
 
@@ -113,7 +157,7 @@ space. There is no switch for one person.
113
157
  | Wizards | Build, test, publish and share | Build and test | Run them in Work |
114
158
  | Skills, knowledge, data | Add and change | Add and change | – |
115
159
  | Connections | Set up, choose how they sign in, set the rules and who may use them | Use the ones open to members. The rules are locked | Their Work chats use the ones open to them |
116
- | Audit | Yes | No | No |
160
+ | Audit | Every line, **Who may do what?** and the notifications | Their own lines | No |
117
161
  | Own sign-ins | In their menu | In their menu | In their menu |
118
162
 
119
163
  Approvals always go to the space’s admins, never to a member. On your computer you are the only
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: Connectors
3
3
  description: Services a wizard works in for the person who runs it – built in, from the registry or over MCP.
4
- version: 0.13.0
4
+ version: 0.16.2
5
5
  ---
6
6
 
7
7
  **[Capabilities](./capabilities.md) › Connectors** lists the services the space’s wizards, Work
@@ -96,10 +96,13 @@ registry. When you set one up, you choose how it signs in:
96
96
  | As the space | An admin signs the space in once, with an API key, an app token or a team account. Everyone uses that account, even when nobody is watching. On this kind of connection the AI only reads; writing happens in fixed steps or as an action someone confirms |
97
97
  | Each person signs in | Each person signs in once with their own account, here or in their menu › Connections. The connection then acts as that person, and asks them before it changes something |
98
98
 
99
- You can’t change how a connection signs in later. Set up a new one instead.
99
+ An admin can change how a connection signs in later, on its page. The sign-ins made until then go
100
+ with the change. In the cloud, your organization’s plan decides whether “Each person signs in” is
101
+ available. [Capabilities](./capabilities.md#connectors) has the details.
100
102
 
101
103
  **Who may use it.** Admins, Members or Everyone. Everyone includes guests who start a wizard from
102
- its link.
104
+ its link. Admins see above the list which connections guests reach, and narrow each to members
105
+ with one click ([Connections that guests reach](./capabilities.md#connections-that-guests-reach)).
103
106
 
104
107
  **What it may do.** One rule for each kind of action:
105
108
 
@@ -1,12 +1,15 @@
1
1
  ---
2
2
  title: Audit
3
- description: Every time a wizard, a chat or Goose used a connection of your space, allowed or not – what critical means, and how to try a rule before anything runs.
4
- version: 0.13.0
3
+ description: Every time a wizard, a chat or Goose used a connection of your space, allowed or not – what critical means, what a member sees, and how to try a rule before anything runs.
4
+ version: 0.16.2
5
5
  ---
6
6
 
7
7
  **[Capabilities](./capabilities.md) › Audit** shows every call your space’s wizards, Work chats and
8
8
  Goose made to a connection. Each call is one line, whether it ran or not.
9
- Only the owner and the admins of the organization see the audit. Members don’t find it in their menu.
9
+
10
+ The owner and the admins of the organization see every line. A member sees only their own lines,
11
+ in a space that lets members use the studio. [What a member sees](#what-a-member-sees) says which
12
+ lines those are.
10
13
 
11
14
  ## What a line says
12
15
 
@@ -36,7 +39,8 @@ the fields, their sizes and one short value that is no secret.
36
39
  Above the lines you choose:
37
40
 
38
41
  - **All**, **Refused**, **Critical** or **Waiting for approval**;
39
- - who called: guests, members, admins, Goose, plugins or fixed steps;
42
+ - who called: guests, members, admins, Goose, plugins or fixed steps. Only admins have this
43
+ filter, because a member’s lines are all their own;
40
44
  - one connection;
41
45
  - a time range, from the last hour to all time;
42
46
  - a search. It finds a person’s name, a connection’s, a wizard’s, an action, a reason and the
@@ -44,6 +48,25 @@ Above the lines you choose:
44
48
 
45
49
  The newest lines come first. “Load more” shows older ones.
46
50
 
51
+ ## What a member sees
52
+
53
+ As a member you see your own calls and nobody else’s:
54
+
55
+ - what you called yourself, in a Work chat or in an AI step of a run you started;
56
+ - what Goose called for you;
57
+ - what the fixed steps of your runs called.
58
+
59
+ Each of your lines opens like any other, with the input’s fields, the rule that decided and your
60
+ run’s grant. The filters and the search only ever count your own lines. A search for a colleague’s
61
+ name finds nothing.
62
+
63
+ Three things stay with the admins:
64
+
65
+ - the filter by who, **Who may do what?** and the notifications;
66
+ - the name of a connection that is not open to you. A call of yours that such a connection
67
+ refused shows without the connection’s name;
68
+ - what you called while you were an admin yourself. Those lines stay admins’ lines.
69
+
47
70
  ## Critical
48
71
 
49
72
  A line is critical when someone should hear of it:
@@ -56,6 +79,8 @@ A line is critical when someone should hear of it:
56
79
  - a connection was used for the first time;
57
80
  - someone changed a rule.
58
81
 
82
+ A member’s own lines show the mark too. Only the admins hear of them.
83
+
59
84
  The admins hear of a critical line at once, under the bell in Work. Where no admin was in the app,
60
85
  they get one email an hour with the critical lines since the last one. The bell icon beside the
61
86
  audit’s title, or **Settings › Notifications**, lets an admin turn the bell and the hourly email off
@@ -65,6 +90,7 @@ or on for the space.
65
90
 
66
91
  Rules are easier to understand when you can try them. **Who may do what?**, the button beside the
67
92
  audit’s title, answers a question before anything runs, for example “May Julia send an email in this space?”.
93
+ Only the owner and the admins have it.
68
94
 
69
95
  1. Choose **who**: a person of your organization, a guest, Goose, or a fixed step in a guest’s or
70
96
  a member’s run.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: Working together
3
3
  description: How the studio shows what others change while you work, merges it with what you type, shows who else is in a wizard, page or table, where an organization’s settings are, and who may use the studio.
4
- version: 0.13.0
4
+ version: 0.16.2
5
5
  ---
6
6
 
7
7
  The studio shows changes made elsewhere as they happen. You don’t reload anything. That holds
@@ -69,9 +69,9 @@ Admins decide for each space whether its members may use the studio: in the spac
69
69
 
70
70
  With it on, members build and test wizards in that space. They add and change skills, knowledge
71
71
  and data, and use the connections open to them. Admins still publish wizards and share them
72
- outside the space, set up connections and change their rules. Approvals go to the admins, and only
73
- they see the [Audit](./protocol.md). With it off, members work in Work and run the space’s wizards
74
- there.
72
+ outside the space, set up connections and change their rules. Approvals go to the admins. In the
73
+ [Audit](./protocol.md) admins see every line, and a member sees their own. With it off, members
74
+ work in Work and run the space’s wizards there.
75
75
 
76
76
  A new space starts with the studio closed to members. [Capabilities](./capabilities.md#who-sees-capabilities)
77
77
  has a table of what each role sees.
@@ -1,12 +1,12 @@
1
1
  import { createTool } from "@mastra/core/tools";
2
2
  import { and, eq, inArray } from "drizzle-orm";
3
3
  import { z } from "zod";
4
- import { assertRwx, decide } from "../broker/rwx.js";
4
+ import { assertRwx, decide, readableIds } from "../broker/rwx.js";
5
5
  import { db, schema } from "../db/client.js";
6
6
  import { openDraft, saveDraft } from "../mounts/drafts.js";
7
7
  import { fileByPath, mountFileText, usableMounts } from "../mounts/mounts.js";
8
8
  import { prompt } from "../prompts.js";
9
- import { filePaths, knowledgeCounts, listForStep, readPage, readTable, resolvePath, } from "../services/knowledge.js";
9
+ import { filePaths, knowledgeKinds, listForStep, readPage, readTable, resolvePath, } from "../services/knowledge.js";
10
10
  import { documentText, hasIndexEntries, searchKnowledge } from "../services/space-index.js";
11
11
  import { attempt, clip } from "../tools/shared.js";
12
12
  import { elementCall } from "./gate.js";
@@ -71,18 +71,18 @@ export async function knowledgeTools(caller) {
71
71
  const spaceId = caller.space.id;
72
72
  const who = caller.subjects;
73
73
  const spaces = await readsFrom(spaceId);
74
- const counts = { pages: 0, tables: 0, files: 0 };
74
+ const holds = { pages: false, tables: false, files: false };
75
75
  let entries = false;
76
76
  for (const space of spaces) {
77
- const of = await knowledgeCounts(space.id);
78
- counts.pages += of.pages;
79
- counts.tables += of.tables;
80
- counts.files += of.files;
77
+ const of = await knowledgeKinds(space.id);
78
+ holds.pages ||= of.pages;
79
+ holds.tables ||= of.tables;
80
+ holds.files ||= of.files;
81
81
  entries ||= await hasIndexEntries(space.id);
82
82
  }
83
83
  // The folders of Dateien the caller may use: searched, and read by their path.
84
84
  const mounted = (await usableMounts(spaceId, who)).length > 0;
85
- if (!(counts.pages || counts.tables || counts.files || entries || mounted)) {
85
+ if (!(holds.pages || holds.tables || holds.files || entries || mounted)) {
86
86
  return {};
87
87
  }
88
88
  const call = (action, input, run) => attempt(() => elementCall(caller, { action, perm: "r", input }, run));
@@ -142,7 +142,7 @@ export async function knowledgeTools(caller) {
142
142
  }),
143
143
  }),
144
144
  };
145
- if (counts.pages) {
145
+ if (holds.pages) {
146
146
  tools.page_read = createTool({
147
147
  id: "page_read",
148
148
  description: prompt("tools", "tool.page_read.knowledge"),
@@ -150,7 +150,7 @@ export async function knowledgeTools(caller) {
150
150
  execute: (input) => readKnowledgePage(caller, input),
151
151
  });
152
152
  }
153
- if (counts.tables) {
153
+ if (holds.tables) {
154
154
  tools.table_read = createTool({
155
155
  id: "table_read",
156
156
  description: prompt("tools", "tool.table_read"),
@@ -162,7 +162,7 @@ export async function knowledgeTools(caller) {
162
162
  }),
163
163
  });
164
164
  }
165
- if (counts.files || mounted) {
165
+ if (holds.files || mounted) {
166
166
  tools.space_document = createTool({
167
167
  id: "space_document",
168
168
  description: prompt("tools", "tool.space_document"),
@@ -182,7 +182,11 @@ export async function knowledgeTools(caller) {
182
182
  }).catch(() => spaceId);
183
183
  const found = await resolvePath(inSpace, wanted);
184
184
  if (found?.kind !== "file") {
185
- const there = [...(await filePaths(spaceId)).values()].slice(0, 40);
185
+ // The files the caller may read: one closed to them is not named.
186
+ const paths = await filePaths(spaceId);
187
+ const there = (await readableIds(spaceId, who, "document", [...paths.keys()]))
188
+ .slice(0, 40)
189
+ .map((id) => paths.get(id));
186
190
  throw new Error(`No file "${path}". There are: ${there.join(", ")}`);
187
191
  }
188
192
  const file = await db.query.spaceFile.findFirst({
@@ -6,6 +6,7 @@ import { mainLogo, ruleLines, runTheme } from "@engenty/wizards-shared/spaces";
6
6
  import { validateSurface, } from "@engenty/wizards-shared/surface";
7
7
  import { Agent } from "@mastra/core/agent";
8
8
  import { generateText, jsonSchema, Output, parsePartialJson } from "ai";
9
+ import { subjectsOf } from "../broker/rwx.js";
9
10
  import { extFor, loadAsset, loadAssetText } from "../files/storage.js";
10
11
  import { snapshotHtmlImages } from "../files/web-images.js";
11
12
  import { generateImageMedia, generateSpeechMedia, generateVideoMedia, } from "../media/generate.js";
@@ -519,8 +520,8 @@ export async function runAgentStep(step, ctx) {
519
520
  instructions ?? "",
520
521
  `Today is ${today(ctx)}.`,
521
522
  brandBlock(ctx),
522
- // Knowledge: what the space holds for its wizards, and how to find and read it.
523
- await knowledgeBlock(ctx.dataSpace.id),
523
+ // Knowledge: what the space holds for the run's holder and its wizard, and how to read it.
524
+ await knowledgeBlock(ctx.dataSpace.id, subjectsOf(ctx)),
524
525
  // Skills: always on whole, on demand by name and description (docs/plans/skills.md).
525
526
  skillsBlock(await skillsOf(ctx), {
526
527
  tools: takesTools(resolved),
@@ -121,6 +121,14 @@ if (env.serves.studio) {
121
121
  for (const id of await knownTenants()) {
122
122
  void withTenant(id, () => indexMissingAssets()).catch((err) => console.error(`[space-index ${id}]`, err));
123
123
  }
124
+ // The embedding model can change at any time on a Manage-App: vectors of another don't compare.
125
+ const { queueVectors } = await import("./services/space-index.js");
126
+ const vectors = async () => {
127
+ for (const id of await knownTenants()) {
128
+ await withTenant(id, () => queueVectors());
129
+ }
130
+ };
131
+ setInterval(() => void vectors().catch((err) => console.error("[space-index]", err)), 600_000).unref();
124
132
  }
125
133
  // Dateien: the folders of this computer mounted in a space, watched and listed again.
126
134
  if (env.serves.studio) {
@@ -18,7 +18,7 @@ const feeds = new Map();
18
18
  * Starts sending the tenant's changes after `since` (null: from now on). Answers `hello`, or
19
19
  * `reset` when the changes after `since` are no longer kept or `since` is of another database.
20
20
  */
21
- export async function subscribe(tenantId, since, send, views) {
21
+ export async function subscribe(tenantId, since, send, views, hears) {
22
22
  const { newest, gap } = await withTenant(tenantId, async () => {
23
23
  const newest = await newestSeq();
24
24
  if (since === null || since === newest) {
@@ -30,7 +30,7 @@ export async function subscribe(tenantId, since, send, views) {
30
30
  const oldest = await oldestSeq();
31
31
  return { newest, gap: oldest === null || oldest > since + 1 };
32
32
  });
33
- const sub = { since: since === null || gap ? newest : since, send, views };
33
+ const sub = { since: since === null || gap ? newest : since, send, views, hears };
34
34
  send(gap ? { event: "reset", seq: newest } : { event: "hello", seq: newest });
35
35
  let feed = feeds.get(tenantId);
36
36
  if (!feed) {
@@ -137,9 +137,23 @@ async function read(feed) {
137
137
  if (!mine.length) {
138
138
  continue;
139
139
  }
140
+ let heard = mine;
141
+ if (sub.hears) {
142
+ try {
143
+ heard = await sub.hears(mine);
144
+ }
145
+ catch (err) {
146
+ // Not known what this reader may hear: nothing is sent, and the next tick asks again.
147
+ console.error(`[live ${feed.id}] what a reader hears:`, err);
148
+ continue;
149
+ }
150
+ }
140
151
  const seq = mine[mine.length - 1].seq;
141
152
  sub.since = seq;
142
- sub.send({ event: "changes", seq, items: await withViews(dedupe(mine), sub.views, read) });
153
+ if (heard.length) {
154
+ const items = await withViews(dedupe(heard), sub.views, read);
155
+ sub.send({ event: "changes", seq, items });
156
+ }
143
157
  }
144
158
  }
145
159
  if (Date.now() - feed.prunedAt > PRUNE_EVERY_MS) {
@@ -32,10 +32,11 @@ export function pushedBy(tenant, install, seq) {
32
32
  }
33
33
  /**
34
34
  * The cloud's live call for one install: the spaces with changes, without what the install
35
- * pushed itself. `hear` gets hello, reset and changes; the answer stops it.
35
+ * pushed itself, and without what `hears` leaves out for its caller. `hear` gets hello, reset and
36
+ * changes; the answer stops it.
36
37
  */
37
- export async function followFor(tenantId, install, since, hear) {
38
- return subscribe(tenantId, since, (e) => {
38
+ export async function followFor(tenantId, install, since, hear, hears) {
39
+ const send = (e) => {
39
40
  if (e.event === "changes") {
40
41
  const spaces = new Set();
41
42
  for (const x of e.items) {
@@ -49,5 +50,6 @@ export async function followFor(tenantId, install, since, hear) {
49
50
  else if (e.event === "hello" || e.event === "reset") {
50
51
  hear(e);
51
52
  }
52
- });
53
+ };
54
+ return subscribe(tenantId, since, send, undefined, hears);
53
55
  }