@engenty/wizards-runtime 0.16.2 → 0.17.1
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.
- package/apps/runtime/dist/agents/studio-assistant.js +13 -6
- package/apps/runtime/dist/app.js +2 -0
- package/apps/runtime/dist/assistant/knows.js +15 -2
- package/apps/runtime/dist/broker/account.js +20 -1
- package/apps/runtime/dist/broker/call.js +131 -22
- package/apps/runtime/dist/broker/grant.js +25 -1
- package/apps/runtime/dist/broker/host.js +8 -2
- package/apps/runtime/dist/broker/index.js +5 -4
- package/apps/runtime/dist/broker/log.js +178 -24
- package/apps/runtime/dist/broker/over.js +38 -0
- package/apps/runtime/dist/broker/rights.js +192 -0
- package/apps/runtime/dist/broker/rwx.js +309 -53
- package/apps/runtime/dist/broker/send.js +109 -44
- package/apps/runtime/dist/bundles/fetch.js +119 -0
- package/apps/runtime/dist/bundles/index.js +621 -0
- package/apps/runtime/dist/bundles/read.js +607 -0
- package/apps/runtime/dist/connectors/external.js +532 -61
- package/apps/runtime/dist/connectors/person-sign-ins.js +1 -0
- package/apps/runtime/dist/connectors/reload.js +73 -0
- package/apps/runtime/dist/connectors/space-connections.js +118 -6
- package/apps/runtime/dist/db/migrations/tenant/0058_mcp_state_across_roles.sql +26 -0
- package/apps/runtime/dist/db/migrations/tenant/0059_space_connection_paused.sql +2 -0
- package/apps/runtime/dist/db/migrations/tenant/0060_space_bundle.sql +21 -0
- package/apps/runtime/dist/db/migrations/tenant/0061_space_connection_limits.sql +2 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0058_snapshot.json +6696 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0059_snapshot.json +6710 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0060_snapshot.json +6857 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0061_snapshot.json +6871 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +28 -0
- package/apps/runtime/dist/db/schema.js +81 -3
- package/apps/runtime/dist/docs/dev/broker.md +316 -50
- package/apps/runtime/dist/docs/dev/plugins/space.md +13 -2
- package/apps/runtime/dist/docs/user-guide/capabilities.md +172 -10
- package/apps/runtime/dist/docs/user-guide/connectors.md +57 -7
- package/apps/runtime/dist/docs/user-guide/protocol.md +44 -7
- package/apps/runtime/dist/docs/user-guide/test-and-share.md +1 -1
- package/apps/runtime/dist/docs/user-guide/together.md +4 -4
- package/apps/runtime/dist/elements/caller.js +2 -2
- package/apps/runtime/dist/elements/knowledge.js +16 -12
- package/apps/runtime/dist/engenty/connections-external/build-connector.js +23 -8
- package/apps/runtime/dist/engenty/connections-external/import-service.js +18 -9
- package/apps/runtime/dist/engenty/connections-external/importer/classify.js +12 -0
- package/apps/runtime/dist/engenty/connections-external/invoke/http-invoker.js +1 -0
- package/apps/runtime/dist/engenty/connections-external/net/guarded-fetch.js +6 -3
- package/apps/runtime/dist/engenty/connections-sdk/oauth2.js +2 -2
- package/apps/runtime/dist/engenty/shims/web-ingest.js +64 -0
- package/apps/runtime/dist/engine/resources.js +15 -6
- package/apps/runtime/dist/engine/runner.js +2 -1
- package/apps/runtime/dist/engine/steps.js +3 -2
- package/apps/runtime/dist/env.js +2 -0
- package/apps/runtime/dist/index.js +19 -2
- package/apps/runtime/dist/live/hub.js +17 -3
- package/apps/runtime/dist/live/origin.js +6 -4
- package/apps/runtime/dist/live/views.js +38 -7
- package/apps/runtime/dist/mcp/handler.js +2 -2
- package/apps/runtime/dist/mcp/seen.js +71 -51
- package/apps/runtime/dist/mcp/tools.js +5 -1
- package/apps/runtime/dist/models.js +18 -0
- package/apps/runtime/dist/prompts/mcp.md +1 -1
- package/apps/runtime/dist/prompts/tools.md +17 -1
- package/apps/runtime/dist/routes/api.js +2 -2
- package/apps/runtime/dist/routes/broker.js +59 -20
- package/apps/runtime/dist/routes/bundles.js +91 -0
- package/apps/runtime/dist/routes/connections.js +14 -3
- package/apps/runtime/dist/routes/live.js +4 -2
- package/apps/runtime/dist/routes/rules.js +53 -9
- package/apps/runtime/dist/routes/studio.js +36 -20
- package/apps/runtime/dist/services/api.js +4 -2
- package/apps/runtime/dist/services/cloud.js +2 -0
- package/apps/runtime/dist/services/draft-events.js +79 -6
- package/apps/runtime/dist/services/errors.js +1 -0
- package/apps/runtime/dist/services/files.js +2 -2
- package/apps/runtime/dist/services/knowledge.js +93 -27
- package/apps/runtime/dist/services/members-studio.js +22 -2
- package/apps/runtime/dist/services/skills.js +61 -5
- package/apps/runtime/dist/services/space-categories.js +83 -5
- package/apps/runtime/dist/services/space-index.js +173 -25
- package/apps/runtime/dist/services/space-origin.js +28 -11
- package/apps/runtime/dist/services/synced-spaces.js +5 -1
- package/apps/runtime/dist/services/wizards.js +48 -2
- package/apps/runtime/dist/services/work-ai.js +15 -5
- package/apps/runtime/dist/sharing/jobs.js +8 -2
- package/apps/runtime/dist/sync/hub.js +17 -3
- package/apps/runtime/dist/sync/records.js +6 -1
- package/apps/runtime/dist/texts.js +42 -5
- package/apps/runtime/dist/tools/connections.js +8 -0
- package/apps/runtime/dist/tools/connector.js +13 -1
- package/apps/runtime/dist/tools/index.js +21 -10
- package/apps/runtime/dist/tools/skills.js +11 -1
- package/apps/runtime/dist/tools/web-search.js +36 -0
- package/apps/web/dist/assets/{AboutDialog-BCcD8hKm.js → AboutDialog-mZCBU7KF.js} +1 -1
- package/apps/web/dist/assets/{BlockEditor-DgaUm2pR.js → BlockEditor-Dk0QwLSU.js} +1 -1
- package/apps/web/dist/assets/CapabilitiesPage-GkpgF-wZ.js +2 -0
- package/apps/web/dist/assets/{ChangelogDialog-B08elwyr.js → ChangelogDialog-BhyilZWA.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-BiyOk_SC.js → CodeEditor-DULYZbuE.js} +1 -1
- package/apps/web/dist/assets/EditorPage-D_mCdYdZ.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-DF_6TvZ0.js → FlowPreview-ykxZxWnk.js} +1 -1
- package/apps/web/dist/assets/{LangSwitch-Ba4OWLzJ.js → LangSwitch-iO54w9AP.js} +1 -1
- package/apps/web/dist/assets/{Marketplace-DqziLf66.js → Marketplace-C97fH7UC.js} +2 -2
- package/apps/web/dist/assets/{NewWizardChannels-CsIGp0nZ.js → NewWizardChannels-CsSV7sm2.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-CzQAkKMy.js → NewWizardPage-Ebgw-Vf_.js} +1 -1
- package/apps/web/dist/assets/{OnboardingPage-B9gr2OX5.js → OnboardingPage-BZlloT7v.js} +1 -1
- package/apps/web/dist/assets/PreviewPane-CJuqY5uA.js +7 -0
- package/apps/web/dist/assets/ProtocolSection-CPaDKVpZ.js +1 -0
- package/apps/web/dist/assets/{PublicRunner-BVs8-Vu3.js → PublicRunner-4Lf4SnwB.js} +1 -1
- package/apps/web/dist/assets/{ReadOnly--4CIJCDD.js → ReadOnly-CXQ41R9Q.js} +1 -1
- package/apps/web/dist/assets/SettingsPage-C-8BgK9O.js +2 -0
- package/apps/web/dist/assets/{SetupPage-9Zk-KUGA.js → SetupPage-4_K083Wl.js} +1 -1
- package/apps/web/dist/assets/{SharePage-D_Ab0gjr.js → SharePage-CQjgMcDI.js} +1 -1
- package/apps/web/dist/assets/{SkillEditor-DvtameHg.js → SkillEditor-DT5hQwbg.js} +1 -1
- package/apps/web/dist/assets/{Skills-Cf1Kl4Fy.js → Skills-D7V_9_xo.js} +1 -1
- package/apps/web/dist/assets/SpacePage-D3rYS1bA.js +2 -0
- package/apps/web/dist/assets/{UpdateCheck-DweZBVP6.js → UpdateCheck-DVgAJmy8.js} +2 -2
- package/apps/web/dist/assets/changelog-DzQCUSsx.js +1 -0
- package/apps/web/dist/assets/{code-editor-B1RbFTAZ.js → code-editor-5T7ilBjd.js} +2 -2
- package/apps/web/dist/assets/{host-CKS5U5Vg.js → host-CCijW1hj.js} +6 -6
- package/apps/web/dist/assets/i18n-DCPDesT-.js +55 -0
- package/apps/web/dist/assets/{index-Ckcn5vy7.js → index-C_iWl8iS.js} +3 -3
- package/apps/web/dist/assets/index-zcPlodHx.css +1 -0
- package/apps/web/dist/assets/minus-BpYkOkYw.js +1 -0
- package/apps/web/dist/assets/{read-aloud-Bq88XUHC.js → read-aloud-Qb719not.js} +1 -1
- package/apps/web/dist/assets/{runners-DvYVe9Dt.js → runners-BeZ84YH_.js} +1 -1
- package/apps/web/dist/assets/{session-D2bjiA3P.js → session-CEJRkSP5.js} +1 -1
- package/apps/web/dist/assets/{theme-CNJIC2be.js → theme-y_owNosi.js} +1 -1
- package/apps/web/dist/assets/{ui-Mplfhz_Z.js → ui-BacfkQ7Q.js} +1 -1
- package/apps/web/dist/assets/{useMutation-8QRM-z4M.js → useMutation-CgzFr4qH.js} +1 -1
- package/apps/web/dist/assets/{viewers-CEocUV_2.js → viewers-CkyHAjnk.js} +2 -2
- package/apps/web/dist/index.html +12 -12
- package/apps/web/dist/mcp/flow.html +2 -2
- package/node_modules/@engenty/wizards/dist/plugin/index.d.ts +7 -2
- package/node_modules/@engenty/wizards-shared/dist/bundles.d.ts +219 -0
- package/node_modules/@engenty/wizards-shared/dist/bundles.js +19 -0
- package/node_modules/@engenty/wizards-shared/dist/connectors.d.ts +117 -4
- package/node_modules/@engenty/wizards-shared/dist/connectors.js +14 -0
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +12 -0
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +12 -0
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +11 -0
- package/node_modules/@engenty/wizards-shared/dist/run.js +22 -0
- package/node_modules/@engenty/wizards-shared/dist/rwx.d.ts +84 -1
- package/node_modules/@engenty/wizards-shared/dist/rwx.js +69 -1
- package/node_modules/@engenty/wizards-shared/dist/skills.d.ts +20 -3
- package/node_modules/@engenty/wizards-shared/dist/skills.js +5 -2
- package/node_modules/@engenty/wizards-shared/dist/spaces.d.ts +3 -2
- package/node_modules/@engenty/wizards-shared/dist/spaces.js +12 -3
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/web/dist/assets/CapabilitiesPage-DuJJV1ll.js +0 -2
- package/apps/web/dist/assets/EditorPage-EMFTHEYD.js +0 -3
- package/apps/web/dist/assets/PreviewPane-DSOV3o-1.js +0 -7
- package/apps/web/dist/assets/SettingsPage-z2u8lSe2.js +0 -2
- package/apps/web/dist/assets/SpacePage-CyqVzX9b.js +0 -2
- package/apps/web/dist/assets/changelog-C85v9OWg.js +0 -1
- package/apps/web/dist/assets/connection-sign-in-CaVvh5GQ.js +0 -1
- package/apps/web/dist/assets/i18n-Bymk5Ev-.js +0 -55
- package/apps/web/dist/assets/index-w-3J3ZJ9.css +0 -1
|
@@ -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.
|
|
4
|
+
version: 0.17.0
|
|
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
|
|
@@ -49,6 +49,7 @@ interface Where {
|
|
|
49
49
|
spaceId?: string;
|
|
50
50
|
mode?: "test" | "live";
|
|
51
51
|
guest?: boolean; // a live run nobody signed in for
|
|
52
|
+
share?: boolean; // a share job: the one caller of a run that is done
|
|
52
53
|
}
|
|
53
54
|
```
|
|
54
55
|
|
|
@@ -69,6 +70,15 @@ whose id or summary says send, mail, message, post or notify, and not draft, upd
|
|
|
69
70
|
is a `send`. A caller may name the kind itself, as the mail tools, the share targets and
|
|
70
71
|
`http_request` do.
|
|
71
72
|
|
|
73
|
+
An admin’s word comes before that guess. `PATCH /spaces/:id/connectors/:connectorId/actions`
|
|
74
|
+
keeps, per action of an imported connector, a kind and for a `send` the input field that holds
|
|
75
|
+
the recipient (`action_kinds` on the stored record, `body.to` for a field inside an HTTP body).
|
|
76
|
+
`groupIn` (`classify.ts`) reads it first, so the connector’s action carries the admin’s group and
|
|
77
|
+
`kindOf` returns the admin’s kind everywhere: in `brokerCall`, in the run’s grant and in „Was
|
|
78
|
+
darf …?“. The named field reaches the broker as the action’s `recipientField`. Reloading the
|
|
79
|
+
actions keeps both. A changed kind is logged like a changed rule (`change_rules`), once for every
|
|
80
|
+
connection on that connector.
|
|
81
|
+
|
|
72
82
|
## Connections
|
|
73
83
|
|
|
74
84
|
`BrokerConnection` is one of two:
|
|
@@ -84,6 +94,76 @@ A space connection holds its `audience` (`admins`, `members` or `all`), its `rul
|
|
|
84
94
|
decides the audience. A fixed step is in the audience of whom its run is held for, and Goose for
|
|
85
95
|
an admin counts as an admin.
|
|
86
96
|
|
|
97
|
+
A space connection can pause: `paused_at` and `paused_by` on its row, set by
|
|
98
|
+
`pauseSpaceConnection` (`POST /connections/:id/pause` and `/resume`, admins only). While it pauses
|
|
99
|
+
the broker refuses every call through it. Nothing else changes: the sign-ins, the rules and the
|
|
100
|
+
audience stay.
|
|
101
|
+
|
|
102
|
+
A space connection can limit its calls: `calls_per_run` and `calls_per_day` on its row, both empty
|
|
103
|
+
on a new one, set with `PATCH /connections/:id` (admins only). See
|
|
104
|
+
[A connection’s limits](#a-connections-limits).
|
|
105
|
+
|
|
106
|
+
## A stop that holds
|
|
107
|
+
|
|
108
|
+
Two things are asked before anything else, on every call. Neither trusts what a step or a chat
|
|
109
|
+
turn read when it started.
|
|
110
|
+
|
|
111
|
+
**The run.** `runOver(where)` in `broker/over.ts` reads `run.status` for `where.runId`. A run that
|
|
112
|
+
is `cancelled`, `done` or `failed` calls nothing more, whatever the connection: a space
|
|
113
|
+
connection, a wizard’s own, a host, the server’s mail, a kept secret. All four paths ask it first
|
|
114
|
+
(`brokerCall`, `brokerHost`, `brokerSend`, `brokerSecret`), refuse with `run_ended` and log the
|
|
115
|
+
call with the rule `run.<status>`. There is no separate revoke: stopping a run (`cancel()` in
|
|
116
|
+
`engine/runner.ts`, `POST /api/runs/:id/cancel`, MCP `control_run`, “Stop run” in the Audit) is
|
|
117
|
+
the revoke. Three things to know:
|
|
118
|
+
|
|
119
|
+
- A call already under way finishes. The broker refuses the next call and does not take back what
|
|
120
|
+
has left.
|
|
121
|
+
- A share job is the one caller of a run that is done. `sharing/jobs.ts` sets `where.share`, and
|
|
122
|
+
the share agent’s step and the run’s browser carry it. With `share` a `done` run calls, a
|
|
123
|
+
`cancelled` or `failed` one does not.
|
|
124
|
+
- A run this tenant does not have is not refused here. The grant refuses it for a wizard’s own
|
|
125
|
+
connection and for a bound host (`not_in_grant`).
|
|
126
|
+
|
|
127
|
+
**The pause.** For a space connection `brokerCall` reads `paused_at` again on every call
|
|
128
|
+
(`stateOf` in `broker/account.ts`, which reads the limits with it) and puts it on the row before
|
|
129
|
+
`decide` sees it. So a step whose
|
|
130
|
+
tools hold the row from before the pause is refused at its next call, and so is a chat turn. A
|
|
131
|
+
connection that was removed since is refused the same way, as `not_connected`. The account is not
|
|
132
|
+
read and no token is renewed for a call that is refused here.
|
|
133
|
+
|
|
134
|
+
## A connection’s limits
|
|
135
|
+
|
|
136
|
+
A space connection takes at most `calls_per_run` calls from one run and `calls_per_day` calls a
|
|
137
|
+
day. Empty means no limit, and a new connection has both empty. They count for every caller: an
|
|
138
|
+
admin, a member, a guest, an AI step, a fixed step, Goose, a plugin’s own job. A wizard’s own
|
|
139
|
+
connection has none.
|
|
140
|
+
|
|
141
|
+
- **What counts.** A call the broker lets through to the service, whatever comes of it: one that
|
|
142
|
+
fails counts, and one still under way. A call that is refused, one that waits for an approval
|
|
143
|
+
and a changed rule count for nothing. `counted()` in `broker/log.ts` says so in one place, from
|
|
144
|
+
the lines of `broker_log`: there is no counter beside the log.
|
|
145
|
+
- **Per run** counts the lines of that connection with the call’s `run_id`. A call with no run (a
|
|
146
|
+
Work chat, Goose, a plugin’s job) is bound by the day only.
|
|
147
|
+
- **Per day** counts the connection’s lines since midnight UTC (`startOfToday`), runs, chats and
|
|
148
|
+
jobs together.
|
|
149
|
+
- **One write.** A call that would run takes its place first: `takePlace` writes the call’s line
|
|
150
|
+
with one `INSERT … SELECT … WHERE` whose condition is the count. Of two calls at once only one
|
|
151
|
+
gets the last place, in whichever process they run. The line has no `result` while the action
|
|
152
|
+
runs, and `closeLine` fills in `result`, `duration_ms` and `result_size` at its end. These are
|
|
153
|
+
the only rows of `broker_log` that are written twice. A connection without a limit keeps
|
|
154
|
+
writing its line once, at the end.
|
|
155
|
+
- **Read at the call.** The limits come from `stateOf` with the pause, so a changed limit binds a
|
|
156
|
+
step or a chat turn that read the row before.
|
|
157
|
+
- **Past a limit** the call is refused as `calls_per_run` or `calls_per_day`, with the rule
|
|
158
|
+
`limits.run` or `limits.day`, and the action does not run. Where the limits cannot be counted
|
|
159
|
+
(the database fails), `takePlace` throws and the call does not run either.
|
|
160
|
+
- **A guest’s mails keep their numbers.** `guestSendCheck` runs before, with `run_limit` and
|
|
161
|
+
`day_limit`. A connection’s limits come on top, under their own names.
|
|
162
|
+
|
|
163
|
+
`spaceConnectionViews` adds `callsPerRun`, `callsPerDay` and `callsToday` (`callsToday` in
|
|
164
|
+
`broker/log.ts`) to each view. A changed limit is logged with `logRuleChange`; its input is the one
|
|
165
|
+
field `limits` (`calls per run: none → 20`), which is how the Audit tells it from other changes.
|
|
166
|
+
|
|
87
167
|
## `decide`
|
|
88
168
|
|
|
89
169
|
`decide({ who, where, connection, actionId, kind, grant })` is pure: it reads nothing and runs
|
|
@@ -93,6 +173,8 @@ admins `admins: true`. The checks run in this order:
|
|
|
93
173
|
|
|
94
174
|
1. **The grant.** A wizard’s own connection in a run, outside the run’s grant: deny, rule `grant`.
|
|
95
175
|
2. **A space connection:**
|
|
176
|
+
- a connection that pauses: deny, rule and refusal `paused`, for every caller and before a
|
|
177
|
+
plugin’s own job;
|
|
96
178
|
- a plugin’s own job on a connection it set up, outside any run or chat: allow, `own_job`;
|
|
97
179
|
- a caller outside the audience: deny, `audience`;
|
|
98
180
|
- an action the connection is not for: deny, `actions`;
|
|
@@ -112,29 +194,36 @@ brokerCall({ who, where, connection, action: { id, kind? }, input, ctx?, handler
|
|
|
112
194
|
→ { ok: true, result, account } | { ok: false, refused, reason }
|
|
113
195
|
```
|
|
114
196
|
|
|
115
|
-

|
|
116
198
|
|
|
117
199
|
In order, it:
|
|
118
200
|
|
|
119
|
-
1.
|
|
201
|
+
1. refuses a call of a run that is over (`runOver`, above): `run_ended`;
|
|
202
|
+
2. reads a space connection’s pause and limits again and refuses a paused one (`paused`), and one
|
|
203
|
+
that was removed (`not_connected`);
|
|
204
|
+
3. reads the account. A sign-in that ran out and can’t be renewed is logged as `sign_in_failed`
|
|
120
205
|
and refused as `not_connected`;
|
|
121
|
-
|
|
206
|
+
4. checks the grant where one binds the call (`grantBinds`: a wizard’s own connection, in a run,
|
|
122
207
|
and not a share target’s connection);
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
208
|
+
5. refuses a missing account (`not_connected`) or an unknown action (`no_action`);
|
|
209
|
+
6. asks `decide`. A deny returns its refusal;
|
|
210
|
+
7. checks a guest’s send (`guestSendCheck`, below);
|
|
211
|
+
8. on an ask of the admins, runs only with `ctx.approved`. Otherwise it refuses with
|
|
127
212
|
`needs_approval`, and the caller holds the call (a Work chat in `chat_approval`, under the bell);
|
|
128
|
-
|
|
213
|
+
9. on an ask of the person, runs when `ctx.allowed` holds `<connection>:<action>` (“for the rest of
|
|
129
214
|
the run”) or `ctx.confirmed` is set and the call deletes nothing. Otherwise it calls `ctx.ask`.
|
|
130
215
|
With no one to ask it refuses with `nobody`, and on a no with `declined`;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
216
|
+
10. takes the call’s place under a space connection’s limits (`takePlace`, above). With none left
|
|
217
|
+
it refuses with `calls_per_run` or `calls_per_day`;
|
|
218
|
+
11. runs the action (the connector’s handler, or `handler`), marks the space connection used and
|
|
219
|
+
logs the call. An error the action throws is logged and thrown on. A 401 or a lost OAuth grant
|
|
220
|
+
is logged as `sign_in_failed`.
|
|
134
221
|
|
|
135
222
|
`brokerConnected(connection, who)` says whether and as whom a connection is signed in, without the
|
|
136
223
|
secret. `brokerSecret` reads a run’s kept secret that is no connection (the browser’s kept
|
|
137
|
-
sign-ins) through the same log.
|
|
224
|
+
sign-ins) through the same log. It answers `{ ok: true, result }`, or for a run that is over
|
|
225
|
+
`{ ok: false, refused: "run_ended" }`. Then its handler does not run, and the run’s browser opens
|
|
226
|
+
signed in nowhere.
|
|
138
227
|
|
|
139
228
|
### Refusals
|
|
140
229
|
|
|
@@ -151,9 +240,39 @@ has words for each:
|
|
|
151
240
|
| `nobody` | The rules say ask, and nobody can be asked |
|
|
152
241
|
| `needs_approval` | *Mit Freigabe* on a connection that signs in as the space: the call waits for an admin |
|
|
153
242
|
| `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
|
-
| `
|
|
156
|
-
| `
|
|
243
|
+
| `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 |
|
|
244
|
+
| `channel_not_fixed` | A guest’s post to a channel that the published step does not fix |
|
|
245
|
+
| `run_limit` | A guest’s run has sent its mails and posts (`GUEST_MAILS_PER_RUN`, 3) |
|
|
246
|
+
| `day_limit` | The wizard’s guests have sent today’s mails and posts (`wizard.dailyMailLimit`, 50 unless set) |
|
|
247
|
+
| `calls_per_run` | The run has made the calls the space connection takes from one run |
|
|
248
|
+
| `calls_per_day` | The space connection has taken today’s calls |
|
|
249
|
+
| `run_ended` | The call’s run was stopped, is done or failed. The rule says which: `run.cancelled`, `run.done`, `run.failed` |
|
|
250
|
+
| `paused` | An admin paused the space connection |
|
|
251
|
+
|
|
252
|
+
The model reads each refusal in words from `prompts/tools.md`, through `refusalNote`
|
|
253
|
+
(`tools/connector.ts`) and `connectionRefusalNote` (`tools/connections.ts`): `note.run_ended` and
|
|
254
|
+
`note.connector_paused` for these two, `note.connector_calls_per_run` and
|
|
255
|
+
`note.connector_calls_per_day` for a connection’s limits. A fixed step that a limit refuses fails
|
|
256
|
+
with a note of its own (`stepCallsPerRun`, `stepCallsPerDay`). A share job reaches a space
|
|
257
|
+
connection only through its agent’s tools, so it reads the model’s note. A plugin’s call throws
|
|
258
|
+
the broker’s reason.
|
|
259
|
+
|
|
260
|
+
A connection’s limits have refusals of their own, apart from `run_limit` and `day_limit`. Four
|
|
261
|
+
readers word a refusal (the Audit, a model, a fixed step, the Audit’s filter by result), and three
|
|
262
|
+
of them see the refusal alone, not the rule beside it. With one name for both, a model would be
|
|
263
|
+
told of mails where a connection’s calls ran out.
|
|
264
|
+
|
|
265
|
+
### A fixed step that would wait
|
|
266
|
+
|
|
267
|
+
„Mit Freigabe“ holds a call only in a Work chat. In a run nothing waits: a fixed step whose call
|
|
268
|
+
asks the space’s admins gets `needs_approval` and fails. `stepWarnings(spaceId, draft)` in
|
|
269
|
+
`services/wizards.ts` finds these steps before a run does. For each fixed step on a space
|
|
270
|
+
connection it asks `decide` as the step of an admin’s run, and warns where the answer is an ask of
|
|
271
|
+
the admins. It reads the rule as it is, so the warning is gone once the rule says *Erlaubt*. A
|
|
272
|
+
read, a rule on *Nie*, a paused connection and a wizard’s own connection never warn. The warnings
|
|
273
|
+
are `StepWarning[]` (shared) on the wizard’s state and on the answer of `PUT /wizards/:id/draft`,
|
|
274
|
+
beside `issues`. They are no issue: the draft saves and publishes. The editor words them in
|
|
275
|
+
`apps/web/src/studio/editor/step-warnings.ts`.
|
|
157
276
|
|
|
158
277
|
## The run’s grant
|
|
159
278
|
|
|
@@ -164,12 +283,18 @@ interface Grant {
|
|
|
164
283
|
connections: Record<string, string[]>; // action ids, or the kind "read"
|
|
165
284
|
hosts: string[]; // names, or "*.example.org"
|
|
166
285
|
tools: string[];
|
|
286
|
+
channels?: Record<string, FixedChannel>; // by step id: { connection, action, channel }
|
|
167
287
|
}
|
|
168
288
|
```
|
|
169
289
|
|
|
170
290
|
- A step’s `connections` add the actions its connection names, or `read` without a list.
|
|
171
291
|
- A fixed step’s `call` adds its one action on its connection.
|
|
172
292
|
- A step’s `hosts` add the hosts `http_request` may reach.
|
|
293
|
+
- A fixed step whose `call.input.channel` is a literal adds that channel under the step’s id.
|
|
294
|
+
A literal is a text with no `{{…}}` in it. A channel that comes from a field, a value or an
|
|
295
|
+
earlier step is a template and adds nothing. `connection` is the id the log uses: the space
|
|
296
|
+
connection’s where the wizard’s entry names one, else the entry’s own. A run that started
|
|
297
|
+
before this has no `channels`.
|
|
173
298
|
|
|
174
299
|
`createRun` (`engine/runner.ts`) computes the grant from the definition the run starts on: the
|
|
175
300
|
published one for a live run, the draft for a test run. It keeps the grant in `run.grant`, so an
|
|
@@ -182,10 +307,26 @@ once from the run’s definition and writes it. `inGrant` always lets `list_tool
|
|
|
182
307
|
- `brokerHost` (`broker/host.ts`) runs `http_request`. It logs the call as connection
|
|
183
308
|
`host:<name>`, action `http_request`, kind `send`. A guest’s run reaches only the hosts in its
|
|
184
309
|
grant. A member’s run reaches any public host, until the `broker` switch is on.
|
|
310
|
+
- `brokerHost` and `brokerSend` (the server’s own mail, `mail:server`) ask `runOver` first, like
|
|
311
|
+
`brokerCall`: a run that is over reaches no host and sends no mail.
|
|
185
312
|
- `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
|
|
187
|
-
|
|
188
|
-
|
|
313
|
+
kind `email` collected in the run, or to the space’s `mailDomains`. It holds a connection’s
|
|
314
|
+
send action as well as the email share target.
|
|
315
|
+
- A guest’s post to a channel is Slack’s `post_message` (`postsToChannel`), and its input names
|
|
316
|
+
the channel as `channel`. `guestPostCheck` is pure and allows it only when a fixed step posts
|
|
317
|
+
(`who.kind` is `step`) and `channelInGrant` finds that step, connection, action and channel in
|
|
318
|
+
the run’s grant. The grant comes from the published definition, so nothing the guest typed
|
|
319
|
+
decides it. Everything else is refused as `channel_not_fixed`: a templated channel, even
|
|
320
|
+
where it renders to the same id, and the guest’s own call from an AI step or the Slack share
|
|
321
|
+
target.
|
|
322
|
+
- `recipientsOf(input, field)` reads a send’s addresses from `to`, `cc`, `bcc`, `recipients` and
|
|
323
|
+
`recipient`, and from the field an admin named for the action (`recipientField`). The named
|
|
324
|
+
field comes on top of the others, never in their place: an address in `cc` still counts.
|
|
325
|
+
- Any other send that names no address is refused as `not_allowed_recipient`. That holds an
|
|
326
|
+
imported connector’s send until an admin names the field with the recipient.
|
|
327
|
+
- The limits count mails and posts together, per run and per wizard and day. They count what
|
|
328
|
+
`broker_log` holds as an `ok` send of a guest (`who_kind` `guest`) or of a fixed step in a
|
|
329
|
+
guest’s run (`who_kind` `step`), and no request to a host.
|
|
189
330
|
- `keptStepIds` (`broker/kept.ts`) names the steps of a guest’s run that read from a space
|
|
190
331
|
connection whose audience is not `all`. Their results stay in the space.
|
|
191
332
|
|
|
@@ -196,7 +337,27 @@ once from the run’s definition and writes it. `inGrant` always lets `list_tool
|
|
|
196
337
|
`input_summary`, `outcome`, `rule`, `reason`, `result`, `result_size`, `critical` and
|
|
197
338
|
`critical_kind`. `summarizeInput` keeps the input’s field names and sizes, one clipped value whose
|
|
198
339
|
field name doesn’t look like a secret, and a SHA-256 of the whole. No token, key, password or body
|
|
199
|
-
is ever written. A log that can’t be written never stops the call.
|
|
340
|
+
is ever written. A log that can’t be written never stops the call. The one exception is a call
|
|
341
|
+
through a space connection with a limit: its line is how it takes its place, so it is written
|
|
342
|
+
before the action runs and filled in after ([A connection’s limits](#a-connections-limits)).
|
|
343
|
+
|
|
344
|
+
Admins read the whole log of a space. A member reads their own lines, where the space’s Studio is
|
|
345
|
+
open to members (`services/members-studio.ts`). `ownLines(userId)` in `broker/log.ts` says which
|
|
346
|
+
those are:
|
|
347
|
+
|
|
348
|
+
- `who_kind` is `person` or `goose` and `who_id` is the member. An AI step calls as the person
|
|
349
|
+
its run is held for, so its lines are among them;
|
|
350
|
+
- `who_kind` is `step` and the line’s run is held for the member (`run.user_id`).
|
|
351
|
+
|
|
352
|
+
`logOfSpace` and `logLine` take the member as `own` and put `ownLines` into the query’s `where`.
|
|
353
|
+
So a page, a cursor, a filter and a search never count another person’s line, and
|
|
354
|
+
`GET /spaces/:id/broker/log/:line` answers 404 for one, as for a line that isn’t there. A line
|
|
355
|
+
the member wrote as an admin (`who_kind` `admin`, `change_rules` among them) is not theirs.
|
|
356
|
+
|
|
357
|
+
`routes/broker.ts` names a member’s lines with less than an admin’s: the only person is the
|
|
358
|
+
member, a space connection outside their audience has no name, connector or action name, and
|
|
359
|
+
`run` with its grant is there only for a run held for them. Everything else on the line is the
|
|
360
|
+
member’s own call: the input’s summary, the outcome, the rule, the reason and the critical mark.
|
|
200
361
|
|
|
201
362
|
`criticalOf(row)` in `broker/log.ts` is the one place that decides whether a row is critical:
|
|
202
363
|
|
|
@@ -205,10 +366,19 @@ is ever written. A log that can’t be written never stops the call.
|
|
|
205
366
|
| `refused_write` | A change, delete or send was refused |
|
|
206
367
|
| `outside_audience` | A guest’s call was refused by a connection’s audience |
|
|
207
368
|
| `host_not_in_grant` | `http_request` to a host the grant doesn’t include |
|
|
208
|
-
| `limit_reached` | `run_limit` or `day_limit` |
|
|
369
|
+
| `limit_reached` | `run_limit` or `day_limit`, each time. `calls_per_run` or `calls_per_day`, the first time in that run or on that day |
|
|
209
370
|
| `sign_in_failed` | A sign-in ran out, or the service refused it |
|
|
210
371
|
| `first_use` | A space connection’s first call that ran |
|
|
211
|
-
| `rule_changed` | An admin changed RWX rules, or a connection’s rules or
|
|
372
|
+
| `rule_changed` | An admin changed RWX rules, or a connection’s rules, audience, limits or way of signing in, or paused or resumed a connection (`logRuleChange`) |
|
|
373
|
+
|
|
374
|
+
A call that a paused connection refuses is not critical, whatever its kind. The admins paused it
|
|
375
|
+
themselves and heard of that, and the hourly mail about critical lines may go through that very
|
|
376
|
+
connection. A refused call of a run that is over follows the rule above: critical where it wanted
|
|
377
|
+
to change, delete or send.
|
|
378
|
+
|
|
379
|
+
A connection’s limit is heard of once per run or day: the first call it refuses is critical, the
|
|
380
|
+
ones after it are refused and logged (`limitHeard`). A model that tries again, and the hourly mail
|
|
381
|
+
going through that connection, add no further critical lines.
|
|
212
382
|
|
|
213
383
|
A critical row goes four ways:
|
|
214
384
|
|
|
@@ -230,36 +400,98 @@ registering. A new tool that calls a service registers there.
|
|
|
230
400
|
|
|
231
401
|
## RWX and the `broker` switch
|
|
232
402
|
|
|
233
|
-
`broker/rwx.ts` keeps one table of permissions per space (`rwx_rule`): a subject (
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
403
|
+
`broker/rwx.ts` keeps one table of permissions per space (`rwx_rule`): a subject, a resource (a
|
|
404
|
+
kind with an id, or `*` for all of the kind), and `r`, `w`, `x` each `allow`, `deny` or unset.
|
|
405
|
+
|
|
406
|
+
| Subject | Id | Who it is |
|
|
407
|
+
|---|---|---|
|
|
408
|
+
| `guest` | none | Someone at a shared link or a public page |
|
|
409
|
+
| `role` | `member`, `admin`, `owner`, `client` | Everyone with that role in the organization |
|
|
410
|
+
| `person` | The user’s id | One person |
|
|
411
|
+
| `goose` | The user’s id | Goose working for that person |
|
|
412
|
+
| `agent` | none | An AI working for a person: a Work chat, a client’s chat, Claude or Codex through MCP |
|
|
413
|
+
| `wizard` | The wizard’s id, or `*` | A run of that wizard |
|
|
414
|
+
| `plugin` | The plugin’s id | A plugin, beside whom it was called for |
|
|
237
415
|
|
|
238
416
|
- Unset means deny, and a deny wins over every allow.
|
|
417
|
+
- A rule on a page of Wissen holds for what lies in it: its deny closes the folder, its allow
|
|
418
|
+
opens it (`withFolders`). The document behind a page or a table is asked as well.
|
|
239
419
|
- Every space starts with a seed: owners and admins read, write and execute, members read and
|
|
240
|
-
write, guests read.
|
|
241
|
-
- Readers ask today for `document`, `table` and `page` (`ENFORCED`): the knowledge readers, and
|
|
242
|
-
search filters its hits by `r`. The other resource kinds wait for their reader.
|
|
420
|
+
write, guests read. It holds flags no reader asks yet, so a later reader starts from them.
|
|
243
421
|
|
|
244
422
|
All of this is behind the `broker` switch, on by default. With it off, `decide`, `readable` and
|
|
245
423
|
`assertRwx` in `rwx.ts` say yes to everything, the rules routes answer 404, and a member’s
|
|
246
424
|
`http_request` reaches any public host. On, the seed changes nothing until an admin
|
|
247
|
-
writes a deny.
|
|
425
|
+
writes a deny.
|
|
426
|
+
|
|
427
|
+
### What is asked
|
|
428
|
+
|
|
429
|
+
`RWX_ASKED` in `packages/shared/src/rwx.ts` is the one table of what a reader asks today: per
|
|
430
|
+
kind of resource and permission, the kinds of subject it is asked for. The runtime refuses a rule
|
|
431
|
+
outside it (`refusalOf`), and the studio offers nothing else.
|
|
432
|
+
|
|
433
|
+
| Resource | Perm | Asked for | By |
|
|
434
|
+
|---|---|---|---|
|
|
435
|
+
| `document` | `r` | every subject | Every reader of Knowledge; a plugin’s `files` and `readFile` |
|
|
436
|
+
| `page` | `r` | every subject | Every reader of Knowledge; a plugin’s `readPages` |
|
|
437
|
+
| `page` | `w` | `person`, `role`, `goose` | Goose’s `write_knowledge_page` |
|
|
438
|
+
| `table` | `r` | every subject but `plugin` | The readers of Knowledge and Daten, shared lists |
|
|
439
|
+
| `wizard` | `r`, `x` | `person`, `role`, `agent` | `wizard_list` and `wizard_run` in a Work chat and for outside clients; the client portal |
|
|
440
|
+
| `skill` | `r` | every subject but `plugin` | `skill_list`, `skill_load`, `skill_read` |
|
|
441
|
+
| `skill` | `x` | `guest`, `person`, `role`, `wizard`, `agent` | A skill’s scripts placed in a sandbox |
|
|
442
|
+
| `setup` | `w` | `person`, `role`, `goose` | Goose’s writes to the space’s setup |
|
|
443
|
+
| `mount` | `r` | every subject but `plugin` | `readableMounts` |
|
|
444
|
+
| `mount` | `w` | `person`, `role`, `agent` | A draft and „Veröffentlichen“ (`mounts/drafts.ts`) |
|
|
445
|
+
|
|
446
|
+
Nothing asks a rule on `connection`, `mail`, `host` or `sandbox`: a connection’s own audience and
|
|
447
|
+
rules decide (`broker/call.ts`), and a run’s grant decides hosts. Nothing asks `w` or `x` on a
|
|
448
|
+
document or a table, `x` on a page, `w` on a wizard or a skill, or `r` on the setup. What only
|
|
449
|
+
Goose asks (`w` on a page and on the setup) is not asked for the role `client`, who reaches no
|
|
450
|
+
studio.
|
|
451
|
+
|
|
452
|
+
Some of it is narrower than the kind suggests. `w` on a page and on the setup is asked where
|
|
453
|
+
Goose writes; a person changing them in the studio is not asked. `r` and `x` on a wizard are
|
|
454
|
+
asked for the AI’s tools and the client portal; a guest at a wizard’s link and a person starting
|
|
455
|
+
one in Work or the studio are not asked. A reader that starts asking adds its line to `RWX_ASKED`,
|
|
456
|
+
and `test/rwx-rules.test.ts` holds the table against `ENFORCED`.
|
|
457
|
+
|
|
458
|
+
### Who writes rules
|
|
459
|
+
|
|
460
|
+
| Writer | What it writes | `origin` in the list |
|
|
461
|
+
|---|---|---|
|
|
462
|
+
| The seed (`seedRwx`), and Rechte for a role | A role’s or the guests’ rule on `*` of an enforced kind | `start` |
|
|
463
|
+
| „Wer sieht diesen Ordner“ (`setFolderAudience`) | On a page of Wissen: the team or the guests closed, the clients let in | `folder` |
|
|
464
|
+
| A mount’s form (`mountRules`) | Every rule on a mount | `mount` |
|
|
465
|
+
| „Für Kund:innen sichtbar“ (`setOpenToClients`) | The clients’ read on a document, a table or a wizard | `clients` |
|
|
466
|
+
| Rechte (`addRule`, `changeRule`, `deleteRule`) | Every other rule | `rights` |
|
|
467
|
+
|
|
468
|
+
`originOf` in `broker/rights.ts` reads the origin off the rule, with no column for it. A place
|
|
469
|
+
that shows a rule also replaces it, so a rule in the folder dialog’s shape is the dialog’s whoever
|
|
470
|
+
wrote the row. The rules routes add, change and remove one rule at a time and never touch
|
|
471
|
+
another. They refuse a rule on a mount: its form reads the rules back as its switches and replaces
|
|
472
|
+
them all.
|
|
248
473
|
|
|
249
474
|
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.
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
plugin’s
|
|
256
|
-
|
|
257
|
-
|
|
475
|
+
run’s holder and wizard (`subjectsOf(ctx)`, `runHolder(run)`), Goose for its person. What a step
|
|
476
|
+
is told about Knowledge is counted the same way: how many pages, tables and files there are and
|
|
477
|
+
the categories with their values and ranges (`knowledgeBlock`), and what `space_list` counts,
|
|
478
|
+
hold only what the run’s holder and wizard may read.
|
|
479
|
+
|
|
480
|
+
A plugin reading the space’s pages and documents (`server.spaceData.readPages`, `.files`,
|
|
481
|
+
`.readFile`) reads as whom it serves, and as itself: a tool in a step or a Work chat as its
|
|
482
|
+
caller (`subjectsOfCaller`), an HTTP route as the person it answers, a job as the runtime itself.
|
|
483
|
+
Anything else reads as the plugin alone, which no seed allows: the lists come back empty and
|
|
484
|
+
`readFile` is refused. The runtime itself is the subject `SYSTEM`, set with
|
|
485
|
+
`readingAs([SYSTEM], …)` around a plugin’s job (`plugins/jobs.ts`) and nowhere else: no person,
|
|
486
|
+
guest or run stands behind a job. It may read, write and run everything; a deny for the plugin
|
|
487
|
+
beside it still wins. No rule can name it, no helper builds it from a request, `decideWith`
|
|
488
|
+
knows it only by identity, and
|
|
258
489
|
`test/rwx.test.ts` fails when a new file uses it. A call with no subject at all stays a no.
|
|
259
490
|
|
|
260
491
|
The `capabilities` switch is on by default. It shows the studio’s Capabilities place, opens
|
|
261
492
|
`/spaces/:id/discover` and makes the rule „Mitglieder dürfen ins Studio“ count. It does not turn
|
|
262
|
-
on RWX.
|
|
493
|
+
on RWX. The routes for connections, rules and the broker (`/connections`, `/rules`, `/broker/*`)
|
|
494
|
+
don’t read the switch: with it off they still answer, and only the studio’s pages for them hide.
|
|
263
495
|
|
|
264
496
|
## Routes
|
|
265
497
|
|
|
@@ -267,18 +499,48 @@ All under `/api/studio`, for a signed-in person of the organization.
|
|
|
267
499
|
|
|
268
500
|
| Route | What it does | Who |
|
|
269
501
|
|---|---|---|
|
|
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 |
|
|
502
|
+
| `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"`. `callsPerRun` and `callsPerDay` are its limits (null: none), `callsToday` the calls it took today | Everyone; a member sees the ones in their audience |
|
|
503
|
+
| `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 |
|
|
504
|
+
| `PATCH /connections/:id`, `DELETE /connections/:id` | Changes its name, `signIn`, audience, rules, limits (`callsPerRun`, `callsPerDay`: a whole number from 1, or null for none) 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 |
|
|
505
|
+
| `POST /connections/:id/pause`, `POST /connections/:id/resume` | Pauses the connection, or resumes it. The view carries `pausedAt` and `pausedByName`. Logged as a changed rule | Admins |
|
|
273
506
|
| `POST`, `DELETE /connections/:id/sign-in` | Signs the space in or out: `{ credentials }`, or `{ oauth: true }` for a sign-in page | Admins |
|
|
274
507
|
| `POST`, `DELETE /connections/:id/my-sign-in` | The person’s own sign-in, where each person signs in | Everyone in the audience |
|
|
275
508
|
| `GET /person/sign-ins` | The person’s connections across their spaces | The person |
|
|
276
|
-
| `GET /spaces/:id/rules
|
|
277
|
-
| `
|
|
278
|
-
| `
|
|
279
|
-
| `
|
|
280
|
-
| `GET /spaces/:id/
|
|
509
|
+
| `GET /spaces/:id/rules` | The RWX rules, each with its `origin` and the names of who and what it is about (`subjectName`, `resourceName`, `folder`) | Admins; 404 while `broker` is off |
|
|
510
|
+
| `POST /spaces/:id/rules` | Adds one rule: `subjectKind`, `subjectId`, `resourceKind`, `resourceId`, `r`, `w`, `x`. `400` with the reason for a rule no reader asks, one on a mount, one about a resource the space does not have, and a second rule about the same subject and resource | Admins; 404 while `broker` is off |
|
|
511
|
+
| `PATCH /spaces/:id/rules/:ruleId` | Sets the flags it names (`null` takes one away), and leaves the others. A flag set here is checked against `RWX_ASKED`; a rule left without a flag is refused | Admins; 404 while `broker` is off |
|
|
512
|
+
| `DELETE /spaces/:id/rules/:ruleId` | Removes one rule | Admins; 404 while `broker` is off |
|
|
513
|
+
| `GET /spaces/:id/rules/ask?who=&id=&for=&resource=&resourceId=&perm=` | „Was darf …?“ for content: `who` is `guest`, `person`, `goose`, `agent`, `wizard` (`for`: the person its run is held for, else a guest) or `plugin` (its own job); `resource` is `document`, `page`, `table`, `wizard`, `skill` or `setup`. Answers `{ ok, rule, reason }` by `decideWith`, as the readers decide. `400` for what no reader asks. Nothing is read, run or logged | Admins; 404 while `broker` is off |
|
|
514
|
+
| `GET /spaces/:id/rules/choices` | The people, wizards, plugins, documents, pages, tables and skills a rule can name | Admins; 404 while `broker` is off |
|
|
515
|
+
| `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 |
|
|
516
|
+
| `GET /spaces/:id/broker/log/:line` | One line, with the run’s grant and status. The Audit’s “Stop run” reads the status and calls `POST /api/runs/:id/cancel` | Admins. A member: their own line; 404 for another person’s |
|
|
517
|
+
| `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) |
|
|
518
|
+
| `GET /spaces/:id/broker/choices` | The people and the space’s connections with their actions, for the question | Admins (403 for a member) |
|
|
281
519
|
| `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 |
|
|
520
|
+
| `POST /spaces/:id/connectors/preview` | Reads an address before it is imported: `{ sourceUrl, sourceKind?, signIn? }`. Answers what is there (`mcp` or `openapi`), each action with its guessed kind and input fields, the sign-in the source describes, the id and tool prefix its host suggests, and `privateAddress` | Admins of a space that can be changed here |
|
|
521
|
+
| `POST /spaces/:id/connectors` | Imports a connector. For a pasted address `domain`, `id` and `toolPrefix` may be left out, `signIn` is the admin’s choice (`described`, `header` with a name, `none`) and `actionKinds` what single actions do | Admins |
|
|
522
|
+
| `POST /spaces/:id/connectors/:connectorId/refresh` | „Aktionen neu laden“: reads the source again, with the sign-in of a signed-in connection on that connector. The broker reads the sign-in, so it is logged as `list_tools` | Admins |
|
|
523
|
+
| `PATCH /spaces/:id/connectors/:connectorId/actions` | What single actions do: `{ actions: { <id>: { kind, recipientField? } \| null } }`; `null` takes one back to the guess | Admins |
|
|
524
|
+
|
|
525
|
+
### A connector from an address
|
|
526
|
+
|
|
527
|
+
A connector whose record has no `registry_surface_slug` came from a pasted address
|
|
528
|
+
(`connectors/external.ts`). Its view says `fromAddress`, the studio marks it „nicht geprüft“, and
|
|
529
|
+
a new connection on it defaults to the audience `admins`.
|
|
530
|
+
|
|
531
|
+
- **Sign-in.** An MCP server is asked for its tools without a sign-in. If it answers, the
|
|
532
|
+
connector needs none. If it answers 401, its own OAuth documents are read (`probeOAuth`: the
|
|
533
|
+
protected-resource document, then the authorization server’s metadata). Otherwise the import
|
|
534
|
+
takes the admin’s choice: a key in a header, stored as `api_key` with a header placement, or
|
|
535
|
+
none. An OpenAPI description says it in its security schemes. An import that can work out no
|
|
536
|
+
sign-in and got no choice refuses with a sentence that names the choices.
|
|
537
|
+
- **Private addresses.** `createGuardedFetch({ allowPrivate: true })` lets loopback and private
|
|
538
|
+
hosts pass and still refuses link-local ones. Only a connector from an address gets it, and only
|
|
539
|
+
on a runtime that is not managed (`reachesPrivate`). It is decided at every request and stored
|
|
540
|
+
nowhere, so the same record on a managed runtime stays behind the guard. On a managed runtime
|
|
541
|
+
the preview and the import refuse a private address with `connectorPrivateAddress`.
|
|
542
|
+
- **Token calls.** An imported connector’s code exchange, refresh and client registration go
|
|
543
|
+
through the same guarded fetch (`ConnectorOAuth2Config.fetchImpl`).
|
|
282
544
|
|
|
283
545
|
## Not built
|
|
284
546
|
|
|
@@ -287,11 +549,15 @@ All under `/api/studio`, for a signed-in person of the organization.
|
|
|
287
549
|
alone holds the sealing key don’t exist.
|
|
288
550
|
- **The company sign-in.** A third way to sign in, through the organization’s SSO (MCP
|
|
289
551
|
Enterprise-Managed Authorization), is not built.
|
|
290
|
-
- **Plans.**
|
|
552
|
+
- **Plans.** Each person signing in is the plan switch `personSignIn`, meant for the Pro and Team
|
|
553
|
+
plans. The Manage-App’s Free plan doesn’t name it `false` yet, so every plan has it.
|
|
291
554
|
- **The Manage-App’s side of the report.** The runtime posts to `POST /v1/broker/:tenant`, and the
|
|
292
555
|
Manage-App has no endpoint for it yet.
|
|
293
|
-
- **More of RWX.**
|
|
294
|
-
|
|
556
|
+
- **More of RWX.** Connections, mail, hosts and the sandbox have no reader that asks RWX, and
|
|
557
|
+
the runtime refuses a rule on them. A person changing a page, a table or the setup in the
|
|
558
|
+
studio, and a person or a guest starting a wizard, are not asked either. `space_search` still says how many items pass its
|
|
559
|
+
`where` (`filtered`) without asking who reads, and what a plugin makes of pages it read in a
|
|
560
|
+
job (the shop’s products) is the plugin’s own data: the rules don’t follow it.
|
|
295
561
|
- A webhook for critical rows, a choice per kind of what notifies, and one connection offered to
|
|
296
562
|
several spaces.
|
|
297
563
|
|
|
@@ -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
|