@engenty/wizards-runtime 0.17.0 → 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/app.js +2 -0
- package/apps/runtime/dist/broker/account.js +20 -1
- package/apps/runtime/dist/broker/call.js +116 -20
- package/apps/runtime/dist/broker/host.js +8 -2
- package/apps/runtime/dist/broker/index.js +3 -2
- package/apps/runtime/dist/broker/log.js +149 -14
- 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 +295 -51
- package/apps/runtime/dist/broker/send.js +25 -12
- 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 +73 -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 +251 -31
- package/apps/runtime/dist/docs/user-guide/capabilities.md +123 -5
- package/apps/runtime/dist/docs/user-guide/connectors.md +52 -5
- package/apps/runtime/dist/docs/user-guide/protocol.md +15 -4
- package/apps/runtime/dist/docs/user-guide/test-and-share.md +1 -1
- package/apps/runtime/dist/elements/caller.js +2 -2
- 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/env.js +2 -0
- package/apps/runtime/dist/index.js +11 -2
- 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/prompts/mcp.md +1 -1
- package/apps/runtime/dist/prompts/tools.md +16 -0
- package/apps/runtime/dist/routes/broker.js +1 -1
- package/apps/runtime/dist/routes/bundles.js +91 -0
- package/apps/runtime/dist/routes/connections.js +14 -3
- package/apps/runtime/dist/routes/rules.js +53 -9
- package/apps/runtime/dist/routes/studio.js +23 -18
- package/apps/runtime/dist/services/cloud.js +2 -0
- package/apps/runtime/dist/services/draft-events.js +79 -6
- package/apps/runtime/dist/services/files.js +2 -2
- package/apps/runtime/dist/services/skills.js +61 -5
- package/apps/runtime/dist/services/space-index.js +102 -10
- package/apps/runtime/dist/services/synced-spaces.js +5 -1
- package/apps/runtime/dist/services/wizards.js +48 -2
- package/apps/runtime/dist/sharing/jobs.js +6 -2
- package/apps/runtime/dist/sync/records.js +6 -1
- package/apps/runtime/dist/texts.js +36 -1
- 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 +8 -3
- package/apps/runtime/dist/tools/skills.js +11 -1
- package/apps/web/dist/assets/{AboutDialog-B2Xmxyj4.js → AboutDialog-mZCBU7KF.js} +1 -1
- package/apps/web/dist/assets/{BlockEditor-D0HoUSih.js → BlockEditor-Dk0QwLSU.js} +1 -1
- package/apps/web/dist/assets/CapabilitiesPage-GkpgF-wZ.js +2 -0
- package/apps/web/dist/assets/{ChangelogDialog-BIrJbAKi.js → ChangelogDialog-BhyilZWA.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-DUVcXI5P.js → CodeEditor-DULYZbuE.js} +1 -1
- package/apps/web/dist/assets/EditorPage-D_mCdYdZ.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-BIag8_Be.js → FlowPreview-ykxZxWnk.js} +1 -1
- package/apps/web/dist/assets/{LangSwitch-CJ00IgaO.js → LangSwitch-iO54w9AP.js} +1 -1
- package/apps/web/dist/assets/{Marketplace-D7-ot9Dz.js → Marketplace-C97fH7UC.js} +2 -2
- package/apps/web/dist/assets/{NewWizardChannels-DI3SQ4iS.js → NewWizardChannels-CsSV7sm2.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-CytheHxX.js → NewWizardPage-Ebgw-Vf_.js} +1 -1
- package/apps/web/dist/assets/{OnboardingPage-_91Pa8Ad.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-CEgXSk3r.js → PublicRunner-4Lf4SnwB.js} +1 -1
- package/apps/web/dist/assets/{ReadOnly-CWf5x74a.js → ReadOnly-CXQ41R9Q.js} +1 -1
- package/apps/web/dist/assets/{SettingsPage-Dr8SDk-L.js → SettingsPage-C-8BgK9O.js} +2 -2
- package/apps/web/dist/assets/{SetupPage-B68n0l4I.js → SetupPage-4_K083Wl.js} +1 -1
- package/apps/web/dist/assets/{SharePage-DfznN7ar.js → SharePage-CQjgMcDI.js} +1 -1
- package/apps/web/dist/assets/{SkillEditor-BIcIczRc.js → SkillEditor-DT5hQwbg.js} +1 -1
- package/apps/web/dist/assets/{Skills-CN4QE7Kx.js → Skills-D7V_9_xo.js} +1 -1
- package/apps/web/dist/assets/SpacePage-D3rYS1bA.js +2 -0
- package/apps/web/dist/assets/{UpdateCheck-QhBI3rlQ.js → UpdateCheck-DVgAJmy8.js} +2 -2
- package/apps/web/dist/assets/changelog-DzQCUSsx.js +1 -0
- package/apps/web/dist/assets/{code-editor-DkPo1C-L.js → code-editor-5T7ilBjd.js} +2 -2
- package/apps/web/dist/assets/{host-D6H6Z9Jp.js → host-CCijW1hj.js} +6 -6
- package/apps/web/dist/assets/i18n-DCPDesT-.js +55 -0
- package/apps/web/dist/assets/{index-De0Wb42y.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-CnFwDSGD.js → read-aloud-Qb719not.js} +1 -1
- package/apps/web/dist/assets/{runners-0sTPbWzr.js → runners-BeZ84YH_.js} +1 -1
- package/apps/web/dist/assets/{session-BMiUrqHg.js → session-CEJRkSP5.js} +1 -1
- package/apps/web/dist/assets/{theme-CkNTe-_Z.js → theme-y_owNosi.js} +1 -1
- package/apps/web/dist/assets/{ui-DAk_vjrL.js → ui-BacfkQ7Q.js} +1 -1
- package/apps/web/dist/assets/{useMutation-isHfB33W.js → useMutation-CgzFr4qH.js} +1 -1
- package/apps/web/dist/assets/{viewers-ijNZHJFG.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-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 +105 -4
- package/node_modules/@engenty/wizards-shared/dist/connectors.js +6 -0
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +8 -0
- package/node_modules/@engenty/wizards-shared/dist/run.js +16 -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/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/web/dist/assets/CapabilitiesPage-C1th2cZE.js +0 -2
- package/apps/web/dist/assets/EditorPage-56sIqEfF.js +0 -3
- package/apps/web/dist/assets/PreviewPane-BDsYm-_K.js +0 -7
- package/apps/web/dist/assets/ProtocolSection-D_zaxHEL.js +0 -1
- package/apps/web/dist/assets/SpacePage-DiVTwhnJ.js +0 -2
- package/apps/web/dist/assets/changelog-a_CuplMX.js +0 -1
- package/apps/web/dist/assets/i18n-BaPKbQ1s.js +0 -55
- package/apps/web/dist/assets/index-CCUG6Vnh.css +0 -1
|
@@ -407,6 +407,34 @@
|
|
|
407
407
|
"when": 1793874431733,
|
|
408
408
|
"tag": "0057_run_wake_at",
|
|
409
409
|
"breakpoints": true
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"idx": 58,
|
|
413
|
+
"version": "6",
|
|
414
|
+
"when": 1793920546957,
|
|
415
|
+
"tag": "0058_mcp_state_across_roles",
|
|
416
|
+
"breakpoints": true
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"idx": 59,
|
|
420
|
+
"version": "6",
|
|
421
|
+
"when": 1793921853823,
|
|
422
|
+
"tag": "0059_space_connection_paused",
|
|
423
|
+
"breakpoints": true
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
"idx": 60,
|
|
427
|
+
"version": "6",
|
|
428
|
+
"when": 1793945012498,
|
|
429
|
+
"tag": "0060_space_bundle",
|
|
430
|
+
"breakpoints": true
|
|
431
|
+
},
|
|
432
|
+
{
|
|
433
|
+
"idx": 61,
|
|
434
|
+
"version": "6",
|
|
435
|
+
"when": 1793946574442,
|
|
436
|
+
"tag": "0061_space_connection_limits",
|
|
437
|
+
"breakpoints": true
|
|
410
438
|
}
|
|
411
439
|
]
|
|
412
440
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BUNDLE_FORMATS, } from "@engenty/wizards-shared/bundles";
|
|
1
2
|
import { CONNECTION_AUDIENCES, CONNECTION_SIGN_INS, } from "@engenty/wizards-shared/connectors";
|
|
2
3
|
import { upgradeDefinition } from "@engenty/wizards-shared/definition";
|
|
3
4
|
import { RWX_FLAGS, RWX_RESOURCE_KINDS, RWX_SUBJECT_KINDS } from "@engenty/wizards-shared/rwx";
|
|
@@ -271,6 +272,34 @@ export const runEvent = sqliteTable("run_event", {
|
|
|
271
272
|
* A call the runner put to the run's device, open until the device answers or the runner stops
|
|
272
273
|
* waiting: the stream (any web process) carries it to the phone, and the answer comes back here.
|
|
273
274
|
*/
|
|
275
|
+
/** What an AI client did with the MCP server, by app id: the test on "Integrate" (mcp/seen.ts). */
|
|
276
|
+
export const mcpAppSeen = sqliteTable("mcp_app_seen", {
|
|
277
|
+
app: text("app").primaryKey(),
|
|
278
|
+
at: integer("at").notNull(),
|
|
279
|
+
toolAt: integer("tool_at"),
|
|
280
|
+
widgetAt: integer("widget_at"),
|
|
281
|
+
});
|
|
282
|
+
/** An app's tool calls the model policy allowed or refused, per person ("": no name known). */
|
|
283
|
+
export const mcpAppCheck = sqliteTable("mcp_app_check", {
|
|
284
|
+
app: text("app").notNull(),
|
|
285
|
+
person: text("person").notNull(),
|
|
286
|
+
kind: text("kind").notNull(),
|
|
287
|
+
allowed: integer("allowed").notNull().default(0),
|
|
288
|
+
refused: integer("refused").notNull().default(0),
|
|
289
|
+
at: integer("at").notNull(),
|
|
290
|
+
}, (t) => [primaryKey({ columns: [t.app, t.person] })]);
|
|
291
|
+
/** A change to a wizard's draft or files, for the studio's open tabs in any process (services/draft-events.ts). */
|
|
292
|
+
export const draftChange = sqliteTable("draft_change", {
|
|
293
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
294
|
+
wizardId: text("wizard_id")
|
|
295
|
+
.notNull()
|
|
296
|
+
.references(() => wizard.id, { onDelete: "cascade" }),
|
|
297
|
+
change: text("change", { mode: "json" }).$type().notNull(),
|
|
298
|
+
createdAt: createdAt(),
|
|
299
|
+
}, (t) => [
|
|
300
|
+
index("draft_change_wizard").on(t.wizardId, t.id),
|
|
301
|
+
index("draft_change_at").on(t.createdAt),
|
|
302
|
+
]);
|
|
274
303
|
export const deviceCall = sqliteTable("device_call", {
|
|
275
304
|
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
276
305
|
runId: text("run_id")
|
|
@@ -330,9 +359,40 @@ export const spaceConnector = sqliteTable("space_connector", {
|
|
|
330
359
|
.references(() => space.id, { onDelete: "cascade" }),
|
|
331
360
|
id: text("id").notNull(),
|
|
332
361
|
record: text("record", { mode: "json" }).$type().notNull(),
|
|
362
|
+
/** The `space_bundle` it came with, where a plugin brought it together with skills. */
|
|
363
|
+
bundleId: text("bundle_id"),
|
|
333
364
|
createdAt: createdAt(),
|
|
334
365
|
updatedAt: updatedAt(),
|
|
335
366
|
}, (t) => [primaryKey({ columns: [t.spaceId, t.id] })]);
|
|
367
|
+
/**
|
|
368
|
+
* What came together (docs/plans/capabilities-next.md, piece 4): a plugin for Claude Code or
|
|
369
|
+
* Cursor, taken into a space from a repository on GitHub or an uploaded zip. Its MCP servers over
|
|
370
|
+
* http are `space_connector` rows, its skills `space_skill` rows, and a connection set up on one
|
|
371
|
+
* of its connectors carries the id too. `space_connection.plugin` is something else: an engenty
|
|
372
|
+
* plugin that set a connection up.
|
|
373
|
+
*/
|
|
374
|
+
export const spaceBundle = sqliteTable("space_bundle", {
|
|
375
|
+
id: text("id").primaryKey(),
|
|
376
|
+
tenantId: text("tenant_id").notNull(),
|
|
377
|
+
spaceId: text("space_id")
|
|
378
|
+
.notNull()
|
|
379
|
+
.references(() => space.id, { onDelete: "cascade" }),
|
|
380
|
+
/** The plugin's name, as its manifest says it. */
|
|
381
|
+
name: text("name").notNull(),
|
|
382
|
+
version: text("version"),
|
|
383
|
+
description: text("description"),
|
|
384
|
+
/** Whose manifest was read. */
|
|
385
|
+
format: text("format", { enum: BUNDLE_FORMATS }).notNull(),
|
|
386
|
+
/** Where it came from: a repository, a branch or tag and a folder, or a file's name. */
|
|
387
|
+
origin: text("origin", { mode: "json" }).$type().notNull(),
|
|
388
|
+
/** Of what was taken: „Aktualisieren“ is offered where the origin's differs. */
|
|
389
|
+
hash: text("hash").notNull(),
|
|
390
|
+
/** What the plugin holds and the space does not take: commands, agents, hooks, other servers. */
|
|
391
|
+
leftOut: text("left_out", { mode: "json" }).$type().notNull().default([]),
|
|
392
|
+
addedBy: text("added_by"),
|
|
393
|
+
createdAt: createdAt(),
|
|
394
|
+
updatedAt: updatedAt(),
|
|
395
|
+
}, (t) => [index("space_bundle_space").on(t.spaceId)]);
|
|
336
396
|
/**
|
|
337
397
|
* What a space holds for all its wizards: logos, assets (images, graphics, videos) and
|
|
338
398
|
* documents. Its bytes are a blob, by `hash` (files/blobs.ts): the same bytes in Marke and in
|
|
@@ -864,9 +924,14 @@ export const spaceSkill = sqliteTable("space_skill", {
|
|
|
864
924
|
/** Its scripts run in the sandbox of a step that has one: switched on by a person, never by default. */
|
|
865
925
|
runScripts: integer("run_scripts", { mode: "boolean" }).notNull().default(false),
|
|
866
926
|
source: text("source", { enum: SKILL_SOURCES }).notNull().default("own"),
|
|
867
|
-
/**
|
|
927
|
+
/**
|
|
928
|
+
* skills.sh: `owner/repo/skill`, and the hash of what it had when added. A plugin's skill:
|
|
929
|
+
* its folder in the plugin, and the hash of what the plugin had.
|
|
930
|
+
*/
|
|
868
931
|
origin: text("origin"),
|
|
869
932
|
originHash: text("origin_hash"),
|
|
933
|
+
/** The `space_bundle` it came with: such a skill is read only and goes with its bundle. */
|
|
934
|
+
bundleId: text("bundle_id"),
|
|
870
935
|
createdAt: createdAt(),
|
|
871
936
|
updatedAt: updatedAt(),
|
|
872
937
|
}, (t) => [uniqueIndex("space_skill_name").on(t.spaceId, t.name)]);
|
|
@@ -1101,6 +1166,8 @@ export const spaceConnection = sqliteTable("space_connection", {
|
|
|
1101
1166
|
connectorId: text("connector_id").notNull(),
|
|
1102
1167
|
/** The plugin that set it up through `server.connections`, where one did. */
|
|
1103
1168
|
plugin: text("plugin"),
|
|
1169
|
+
/** The `space_bundle` its connector came with: removing the bundle takes the connection too. */
|
|
1170
|
+
bundleId: text("bundle_id"),
|
|
1104
1171
|
/** What people call it: „Vertrieb“, „Bestellungen“. */
|
|
1105
1172
|
name: text("name").notNull(),
|
|
1106
1173
|
/** A `space` sign-in: the account as the provider names it; null until signed in. */
|
|
@@ -1116,6 +1183,14 @@ export const spaceConnection = sqliteTable("space_connection", {
|
|
|
1116
1183
|
setUpAt: integer("set_up_at", { mode: "timestamp_ms" }).notNull().default(now),
|
|
1117
1184
|
updatedAt: updatedAt(),
|
|
1118
1185
|
lastUsedAt: integer("last_used_at", { mode: "timestamp_ms" }),
|
|
1186
|
+
/** Since when it pauses: the broker refuses every call through it until an admin resumes it. */
|
|
1187
|
+
pausedAt: integer("paused_at", { mode: "timestamp_ms" }),
|
|
1188
|
+
/** The admin who paused it. */
|
|
1189
|
+
pausedBy: text("paused_by"),
|
|
1190
|
+
/** How many calls one run makes through it at most, whoever calls (broker/call.ts). Null: no limit. */
|
|
1191
|
+
callsPerRun: integer("calls_per_run"),
|
|
1192
|
+
/** How many calls it takes per day (UTC), runs, chats and plugins together. Null: no limit. */
|
|
1193
|
+
callsPerDay: integer("calls_per_day"),
|
|
1119
1194
|
}, (t) => [index("space_connection_space").on(t.spaceId)]);
|
|
1120
1195
|
/** A person's own sign-in to a connection in which each person signs in. `secret` is sealed. */
|
|
1121
1196
|
export const spaceConnectionSignIn = sqliteTable("space_connection_sign_in", {
|
|
@@ -1131,7 +1206,10 @@ export const spaceConnectionSignIn = sqliteTable("space_connection_sign_in", {
|
|
|
1131
1206
|
}, (t) => [primaryKey({ columns: [t.connectionId, t.userId] })]);
|
|
1132
1207
|
/**
|
|
1133
1208
|
* Every call that reaches outside through the broker (`broker/call.ts`): who called, where, which
|
|
1134
|
-
* connection and action, what was decided and how it went.
|
|
1209
|
+
* connection and action, what was decided and how it went. A secret never goes in. Rows are only
|
|
1210
|
+
* added, with one exception: a call through a connection of the space that has a limit writes its
|
|
1211
|
+
* row when it starts, which is how it takes its place under the limit, and its end fills in
|
|
1212
|
+
* `result`, `duration_ms` and `result_size` (broker/log.ts, `takePlace`).
|
|
1135
1213
|
*/
|
|
1136
1214
|
export const brokerLog = sqliteTable("broker_log", {
|
|
1137
1215
|
id: text("id").primaryKey(),
|
|
@@ -1159,7 +1237,7 @@ export const brokerLog = sqliteTable("broker_log", {
|
|
|
1159
1237
|
/** Which rule decided (broker/call.ts `decide`): `grant`, `audience`, `rules.write`, `policy`, …; null where none did. */
|
|
1160
1238
|
rule: text("rule"),
|
|
1161
1239
|
reason: text("reason"),
|
|
1162
|
-
/** ok, declined, nobody, not_connected, or the error's class. */
|
|
1240
|
+
/** ok, declined, nobody, not_connected, or the error's class; null while a call that took a place under a limit runs. */
|
|
1163
1241
|
result: text("result"),
|
|
1164
1242
|
resultSize: integer("result_size"),
|
|
1165
1243
|
critical: integer("critical", { mode: "boolean" }).notNull().default(false),
|
|
@@ -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
|
|
|
@@ -155,6 +244,35 @@ has words for each:
|
|
|
155
244
|
| `channel_not_fixed` | A guest’s post to a channel that the published step does not fix |
|
|
156
245
|
| `run_limit` | A guest’s run has sent its mails and posts (`GUEST_MAILS_PER_RUN`, 3) |
|
|
157
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`.
|
|
158
276
|
|
|
159
277
|
## The run’s grant
|
|
160
278
|
|
|
@@ -189,6 +307,8 @@ once from the run’s definition and writes it. `inGrant` always lets `list_tool
|
|
|
189
307
|
- `brokerHost` (`broker/host.ts`) runs `http_request`. It logs the call as connection
|
|
190
308
|
`host:<name>`, action `http_request`, kind `send`. A guest’s run reaches only the hosts in its
|
|
191
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.
|
|
192
312
|
- `guestSendCheck` (`broker/send.ts`) lets a guest’s send go only to an address a page field of
|
|
193
313
|
kind `email` collected in the run, or to the space’s `mailDomains`. It holds a connection’s
|
|
194
314
|
send action as well as the email share target.
|
|
@@ -199,8 +319,11 @@ once from the run’s definition and writes it. `inGrant` always lets `list_tool
|
|
|
199
319
|
decides it. Everything else is refused as `channel_not_fixed`: a templated channel, even
|
|
200
320
|
where it renders to the same id, and the guest’s own call from an AI step or the Slack share
|
|
201
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.
|
|
202
325
|
- Any other send that names no address is refused as `not_allowed_recipient`. That holds an
|
|
203
|
-
imported connector’s send
|
|
326
|
+
imported connector’s send until an admin names the field with the recipient.
|
|
204
327
|
- The limits count mails and posts together, per run and per wizard and day. They count what
|
|
205
328
|
`broker_log` holds as an `ok` send of a guest (`who_kind` `guest`) or of a fixed step in a
|
|
206
329
|
guest’s run (`who_kind` `step`), and no request to a host.
|
|
@@ -214,7 +337,9 @@ once from the run’s definition and writes it. `inGrant` always lets `list_tool
|
|
|
214
337
|
`input_summary`, `outcome`, `rule`, `reason`, `result`, `result_size`, `critical` and
|
|
215
338
|
`critical_kind`. `summarizeInput` keeps the input’s field names and sizes, one clipped value whose
|
|
216
339
|
field name doesn’t look like a secret, and a SHA-256 of the whole. No token, key, password or body
|
|
217
|
-
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)).
|
|
218
343
|
|
|
219
344
|
Admins read the whole log of a space. A member reads their own lines, where the space’s Studio is
|
|
220
345
|
open to members (`services/members-studio.ts`). `ownLines(userId)` in `broker/log.ts` says which
|
|
@@ -241,10 +366,19 @@ member’s own call: the input’s summary, the outcome, the rule, the reason an
|
|
|
241
366
|
| `refused_write` | A change, delete or send was refused |
|
|
242
367
|
| `outside_audience` | A guest’s call was refused by a connection’s audience |
|
|
243
368
|
| `host_not_in_grant` | `http_request` to a host the grant doesn’t include |
|
|
244
|
-
| `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 |
|
|
245
370
|
| `sign_in_failed` | A sign-in ran out, or the service refused it |
|
|
246
371
|
| `first_use` | A space connection’s first call that ran |
|
|
247
|
-
| `rule_changed` | An admin changed RWX rules, or a connection’s rules, audience or way of signing in (`logRuleChange`) |
|
|
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.
|
|
248
382
|
|
|
249
383
|
A critical row goes four ways:
|
|
250
384
|
|
|
@@ -266,21 +400,76 @@ registering. A new tool that calls a service registers there.
|
|
|
266
400
|
|
|
267
401
|
## RWX and the `broker` switch
|
|
268
402
|
|
|
269
|
-
`broker/rwx.ts` keeps one table of permissions per space (`rwx_rule`): a subject (
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
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 |
|
|
273
415
|
|
|
274
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.
|
|
275
419
|
- Every space starts with a seed: owners and admins read, write and execute, members read and
|
|
276
|
-
write, guests read.
|
|
277
|
-
- Readers ask today for `document`, `table` and `page` (`ENFORCED`): the knowledge readers, and
|
|
278
|
-
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.
|
|
279
421
|
|
|
280
422
|
All of this is behind the `broker` switch, on by default. With it off, `decide`, `readable` and
|
|
281
423
|
`assertRwx` in `rwx.ts` say yes to everything, the rules routes answer 404, and a member’s
|
|
282
424
|
`http_request` reaches any public host. On, the seed changes nothing until an admin
|
|
283
|
-
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.
|
|
284
473
|
|
|
285
474
|
Every reader takes its subjects from whoever it serves: the studio’s person (`whoOf(c)`), a
|
|
286
475
|
run’s holder and wizard (`subjectsOf(ctx)`, `runHolder(run)`), Goose for its person. What a step
|
|
@@ -310,18 +499,48 @@ All under `/api/studio`, for a signed-in person of the organization.
|
|
|
310
499
|
|
|
311
500
|
| Route | What it does | Who |
|
|
312
501
|
|---|---|---|
|
|
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 |
|
|
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 |
|
|
314
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 |
|
|
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 |
|
|
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 |
|
|
316
506
|
| `POST`, `DELETE /connections/:id/sign-in` | Signs the space in or out: `{ credentials }`, or `{ oauth: true }` for a sign-in page | Admins |
|
|
317
507
|
| `POST`, `DELETE /connections/:id/my-sign-in` | The person’s own sign-in, where each person signs in | Everyone in the audience |
|
|
318
508
|
| `GET /person/sign-ins` | The person’s connections across their spaces | The person |
|
|
319
|
-
| `GET /spaces/:id/rules
|
|
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 |
|
|
320
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 |
|
|
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 |
|
|
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 |
|
|
322
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) |
|
|
323
518
|
| `GET /spaces/:id/broker/choices` | The people and the space’s connections with their actions, for the question | Admins (403 for a member) |
|
|
324
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`).
|
|
325
544
|
|
|
326
545
|
## Not built
|
|
327
546
|
|
|
@@ -334,8 +553,9 @@ All under `/api/studio`, for a signed-in person of the organization.
|
|
|
334
553
|
plans. The Manage-App’s Free plan doesn’t name it `false` yet, so every plan has it.
|
|
335
554
|
- **The Manage-App’s side of the report.** The runtime posts to `POST /v1/broker/:tenant`, and the
|
|
336
555
|
Manage-App has no endpoint for it yet.
|
|
337
|
-
- **More of RWX.**
|
|
338
|
-
|
|
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
|
|
339
559
|
`where` (`filtered`) without asking who reads, and what a plugin makes of pages it read in a
|
|
340
560
|
job (the shop’s products) is the plugin’s own data: the rules don’t follow it.
|
|
341
561
|
- A webhook for critical rows, a choice per kind of what notifies, and one connection offered to
|