@capybara-hq/kernel 0.1.0-rc.76 → 0.1.0-rc.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/bootstrap.json +6 -6
  2. package/dist/admin/outbox-dead.service.js +4 -1
  3. package/dist/agents/admin-agents.js +2 -0
  4. package/dist/agents/agent-lookup.js +4 -0
  5. package/dist/agents/agent-profile.service.js +3 -0
  6. package/dist/agents/agents.service.js +7 -0
  7. package/dist/agents/org-templates.js +1 -0
  8. package/dist/agents/pending-connector-requests.js +6 -0
  9. package/dist/agents/pending-connectors.service.js +2 -0
  10. package/dist/agents/readiness.service.d.ts +9 -3
  11. package/dist/agents/readiness.service.js +3 -3
  12. package/dist/agents/templates.js +1 -0
  13. package/dist/background/finish.js +3 -0
  14. package/dist/background/stop.js +2 -0
  15. package/dist/background/store.js +44 -0
  16. package/dist/background/tasks.service.js +3 -2
  17. package/dist/background/wake-rules.js +1 -0
  18. package/dist/catalog/admin-catalog.controller.d.ts +6 -0
  19. package/dist/catalog/admin-catalog.controller.js +13 -0
  20. package/dist/catalog/catalog-content.d.ts +6 -0
  21. package/dist/catalog/catalog-content.js +1 -0
  22. package/dist/catalog/catalog-items.js +4 -0
  23. package/dist/catalog/catalog-scope.service.js +4 -1
  24. package/dist/catalog/component-promotion.js +2 -0
  25. package/dist/catalog/component-scope.controller.d.ts +9 -15
  26. package/dist/catalog/component-scope.controller.js +14 -9
  27. package/dist/catalog/component-scope.service.js +5 -0
  28. package/dist/catalog/component-state.js +2 -0
  29. package/dist/catalog/marketplaces.service.d.ts +6 -1
  30. package/dist/catalog/marketplaces.service.js +8 -3
  31. package/dist/catalog/org-catalog.controller.d.ts +9 -0
  32. package/dist/catalog/org-catalog.controller.js +18 -0
  33. package/dist/catalog/org-catalog.schemas.d.ts +2 -4
  34. package/dist/catalog/org-catalog.schemas.js +2 -3
  35. package/dist/catalog/org-catalog.service.d.ts +10 -1
  36. package/dist/catalog/org-catalog.service.js +34 -23
  37. package/dist/catalog/org-extension-switch.d.ts +3 -10
  38. package/dist/catalog/org-extension-switch.js +14 -60
  39. package/dist/catalog/org-extension.controller.d.ts +6 -7
  40. package/dist/catalog/org-extension.controller.js +4 -4
  41. package/dist/catalog/org-extension.schemas.d.ts +1 -2
  42. package/dist/catalog/org-extension.schemas.js +1 -3
  43. package/dist/catalog/owned-items.js +10 -1
  44. package/dist/catalog/ownership.js +2 -0
  45. package/dist/catalog/plugin-import.js +8 -0
  46. package/dist/catalog/plugin-install.d.ts +1 -4
  47. package/dist/catalog/plugin-install.js +11 -12
  48. package/dist/catalog/plugin-upgrade.js +4 -1
  49. package/dist/catalog/request-rules.js +6 -0
  50. package/dist/catalog/requests.service.js +4 -0
  51. package/dist/catalog/scope-orgs.js +1 -0
  52. package/dist/catalog/scope-sync.d.ts +8 -5
  53. package/dist/catalog/scope-sync.js +21 -23
  54. package/dist/catalog/unshare.js +3 -0
  55. package/dist/channels/connections.service.js +1 -0
  56. package/dist/channels/inbound.js +1 -0
  57. package/dist/channels/jobs.js +1 -0
  58. package/dist/channels/outbound.js +6 -0
  59. package/dist/channels/supervisor.js +1 -0
  60. package/dist/channels/threads.js +1 -0
  61. package/dist/client/client-reports.service.js +1 -0
  62. package/dist/config/fields.js +20 -4
  63. package/dist/conversations/access.js +1 -0
  64. package/dist/conversations/attachments.service.js +16 -4
  65. package/dist/conversations/conversations.service.js +17 -3
  66. package/dist/conversations/event-log.js +2 -0
  67. package/dist/conversations/events.d.ts +1 -0
  68. package/dist/conversations/events.js +3 -1
  69. package/dist/conversations/files.js +3 -2
  70. package/dist/conversations/permission-profiles.service.js +1 -0
  71. package/dist/conversations/prompt-suggestions.js +2 -0
  72. package/dist/conversations/queue.js +8 -0
  73. package/dist/conversations/queue.service.js +6 -2
  74. package/dist/conversations/source.js +2 -0
  75. package/dist/conversations/titles.js +10 -2
  76. package/dist/conversations/tree.js +6 -0
  77. package/dist/db/kernel-schema.d.ts +3 -1
  78. package/dist/devices/conversation-devices.js +3 -0
  79. package/dist/devices/device-projects.service.js +2 -0
  80. package/dist/devices/devices.service.js +5 -0
  81. package/dist/devices/legacy-cleanup.job.js +5 -2
  82. package/dist/dial-in/handlers.js +2 -0
  83. package/dist/dial-in/machines.js +11 -2
  84. package/dist/dial-in/targets.d.ts +0 -2
  85. package/dist/dial-in/targets.js +0 -10
  86. package/dist/errors.d.ts +0 -1
  87. package/dist/errors.js +0 -1
  88. package/dist/evals/budget.js +14 -1
  89. package/dist/evals/run-replay.js +4 -0
  90. package/dist/evals/runs.service.js +13 -7
  91. package/dist/evals/sets.service.js +23 -8
  92. package/dist/evals/trajectory.service.d.ts +1 -1
  93. package/dist/evals/trajectory.service.js +1 -0
  94. package/dist/evals/worker.js +5 -1
  95. package/dist/extensions/admin-ops.js +1 -0
  96. package/dist/extensions/admin-view.js +3 -1
  97. package/dist/extensions/bootstrap-packages.d.ts +12 -1
  98. package/dist/extensions/bootstrap-packages.js +49 -9
  99. package/dist/extensions/bootstrap.d.ts +36 -4
  100. package/dist/extensions/bootstrap.js +103 -16
  101. package/dist/extensions/config-json-schema.d.ts +2 -2
  102. package/dist/extensions/config-json-schema.js +1 -3
  103. package/dist/extensions/deployment-config.d.ts +5 -3
  104. package/dist/extensions/deployment-config.js +3 -3
  105. package/dist/extensions/effective-config.d.ts +8 -7
  106. package/dist/extensions/effective-config.js +8 -7
  107. package/dist/extensions/enabled.js +1 -0
  108. package/dist/extensions/host.d.ts +4 -3
  109. package/dist/extensions/host.js +11 -12
  110. package/dist/extensions/instance.d.ts +1 -1
  111. package/dist/extensions/instance.js +17 -2
  112. package/dist/extensions/org-config.d.ts +35 -97
  113. package/dist/extensions/org-config.js +48 -315
  114. package/dist/extensions/org-levels.d.ts +22 -9
  115. package/dist/extensions/org-levels.js +100 -20
  116. package/dist/extensions/org-overrides.d.ts +14 -15
  117. package/dist/extensions/org-overrides.js +20 -20
  118. package/dist/extensions/package.js +1 -1
  119. package/dist/extensions/permission-set.d.ts +1 -3
  120. package/dist/extensions/permission-set.js +3 -7
  121. package/dist/extensions/permission-view.d.ts +3 -1
  122. package/dist/extensions/permission-view.js +5 -4
  123. package/dist/extensions/plugin-icons.d.ts +72 -1
  124. package/dist/extensions/plugin-icons.js +194 -2
  125. package/dist/extensions/point-defaults.d.ts +17 -18
  126. package/dist/extensions/point-defaults.js +25 -28
  127. package/dist/identity/accounts.js +6 -0
  128. package/dist/identity/api-tokens.js +8 -0
  129. package/dist/infra/outbox/outbox.dispatcher.js +4 -1
  130. package/dist/infra/outbox/outbox.service.js +2 -0
  131. package/dist/orgs/directory-sync.d.ts +9 -6
  132. package/dist/orgs/directory-sync.js +15 -12
  133. package/dist/orgs/invitations.service.js +2 -0
  134. package/dist/orgs/members.service.js +2 -0
  135. package/dist/orgs/offboarding.js +2 -0
  136. package/dist/packages/npm.d.ts +9 -1
  137. package/dist/packages/npm.js +37 -5
  138. package/dist/platform/exclusions.js +20 -0
  139. package/dist/platform/ops/admin-items.ops.js +1 -0
  140. package/dist/platform/ops/agents.ops.js +1 -0
  141. package/dist/platform/ops/extensions.ops.d.ts +6 -8
  142. package/dist/platform/ops/extensions.ops.js +18 -97
  143. package/dist/platform/ops/org-plugins.ops.d.ts +3 -6
  144. package/dist/platform/ops/org-plugins.ops.js +14 -65
  145. package/dist/platform/ops/outbox.ops.js +1 -0
  146. package/dist/platform/ops/person-inputs.d.ts +0 -4
  147. package/dist/platform/ops/person-inputs.js +0 -8
  148. package/dist/platform/ops/plugins.ops.d.ts +4 -1
  149. package/dist/platform/ops/plugins.ops.js +27 -34
  150. package/dist/platform/person-fields.d.ts +1 -1
  151. package/dist/platform/person-fields.js +1 -1
  152. package/dist/platform/sealed-reveals.js +2 -0
  153. package/dist/push/recipients.js +9 -2
  154. package/dist/runtime/permission-context.service.js +1 -0
  155. package/dist/runtime/plugin-context.service.js +1 -0
  156. package/dist/runtime/project/knowledge.service.js +1 -0
  157. package/dist/runtime/run-context.service.js +1 -0
  158. package/dist/runtime/run-deletion.js +4 -0
  159. package/dist/runtime/run-execution.js +2 -0
  160. package/dist/runtime/run-finish.js +3 -0
  161. package/dist/runtime/run-jobs.js +3 -0
  162. package/dist/runtime/run-orphan-check.job.js +7 -0
  163. package/dist/runtime/run-queue.js +21 -2
  164. package/dist/runtime/run-worker.js +5 -0
  165. package/dist/runtime/step-log.js +1 -0
  166. package/dist/runtime/subagents/child.js +2 -0
  167. package/dist/runtime/subagents/deliveries.js +3 -0
  168. package/dist/runtime/subagents/dispatch.js +5 -1
  169. package/dist/runtime/subagents/messages.js +2 -0
  170. package/dist/runtime/subagents/org-agents.d.ts +1 -1
  171. package/dist/runtime/subagents/org-agents.js +2 -1
  172. package/dist/runtime/usage-report-jobs.js +1 -0
  173. package/dist/runtime/usage-report.js +3 -0
  174. package/dist/runtime/waits.js +5 -0
  175. package/dist/sandbox/cloud-permission-snapshot.js +9 -3
  176. package/dist/sandbox/device-reports.js +3 -0
  177. package/dist/sandbox/legacy-retirement.js +5 -1
  178. package/dist/sandbox/managed-device-context.js +1 -0
  179. package/dist/sandbox/modes.d.ts +5 -2
  180. package/dist/sandbox/modes.js +8 -4
  181. package/dist/sandbox/network-grants.js +2 -0
  182. package/dist/sandbox/operation-intents.js +58 -0
  183. package/dist/sandbox/operation-reconcile.job.js +2 -0
  184. package/dist/sandbox/permission-authority-lock.js +12 -6
  185. package/dist/sandbox/permission-call-grants.js +6 -0
  186. package/dist/sandbox/permission-ceiling-writes.js +5 -0
  187. package/dist/sandbox/permission-config-publication.js +5 -0
  188. package/dist/sandbox/permission-instance-writes.js +4 -0
  189. package/dist/sandbox/permission-runtime-reports.js +10 -1
  190. package/dist/sandbox/permission-transitions.js +3 -0
  191. package/dist/sandbox/review/review.service.js +8 -5
  192. package/dist/sandbox/sandbox.service.d.ts +14 -0
  193. package/dist/sandbox/sandbox.service.js +195 -29
  194. package/dist/sandbox/unreachable.js +4 -1
  195. package/dist/schedules/fire.js +9 -3
  196. package/dist/schedules/pause.js +2 -0
  197. package/dist/schedules/run-tracker.js +16 -1
  198. package/dist/schedules/scheduled-tasks.service.js +4 -2
  199. package/dist/schedules/store.js +8 -0
  200. package/dist/schedules/unattended.js +4 -0
  201. package/dist/setup/setup-checks.service.d.ts +1 -10
  202. package/dist/setup/setup-checks.service.js +19 -29
  203. package/dist/shares/share-open.service.js +1 -0
  204. package/dist/shares/shares.service.js +2 -0
  205. package/dist/skills/agent-skills.service.d.ts +1 -1
  206. package/dist/skills/agent-skills.service.js +13 -2
  207. package/dist/skills/catalog.js +3 -0
  208. package/dist/skills/changes.service.js +10 -2
  209. package/dist/skills/conversation-catalog.js +1 -0
  210. package/dist/skills/skills.service.js +4 -0
  211. package/dist/tools/approvals.service.js +40 -0
  212. package/dist/tools/builtins/schedules.js +11 -6
  213. package/dist/tools/builtins/skill-load.d.ts +10 -9
  214. package/dist/tools/builtins/skill-load.js +15 -19
  215. package/dist/tools/builtins/web/fetch.js +1 -1
  216. package/dist/tools/builtins/web/search.js +1 -1
  217. package/dist/tools/connector-account-policies.js +3 -0
  218. package/dist/tools/connectors.controller.d.ts +20 -8
  219. package/dist/tools/connectors.controller.js +30 -12
  220. package/dist/tools/connectors.service.d.ts +8 -0
  221. package/dist/tools/connectors.service.js +21 -1
  222. package/dist/tools/drift.js +5 -0
  223. package/dist/tools/git-push-policy.js +3 -0
  224. package/dist/tools/oauth/flow.js +1 -0
  225. package/dist/tools/outputs.js +2 -0
  226. package/dist/tools/permission-approval-jobs.js +3 -0
  227. package/dist/tools/pipeline.js +2 -0
  228. package/dist/tools/policy.js +3 -0
  229. package/dist/tools/questions.service.js +13 -0
  230. package/package.json +3 -3
@@ -31,14 +31,13 @@ export type OrgExtensionItem = OrgExtensionView & {
31
31
  };
32
32
  /**
33
33
  * What a member sees of an extension: its state and the points it provides (names only, what the
34
- * 扩展 page sorts by), never the org config, the secrets' state, the config schema, the
35
- * permission list, the suggested appearance (members cannot apply it) or the client build (part of
36
- * the permission review).
34
+ * Extensions page sorts by), never the permission list, the suggested appearance (members cannot
35
+ * apply it) or the client build (part of the permission review).
37
36
  */
38
- export type OrgExtensionMemberItem = Omit<OrgExtensionItem, "config" | "secrets" | "orgConfigSchema" | "permissions" | "suggestedAppearance" | "client">;
37
+ export type OrgExtensionMemberItem = Omit<OrgExtensionItem, "permissions" | "suggestedAppearance" | "client">;
39
38
  /**
40
- * Org-level extension enablement and config (`/api/v1/orgs/:orgId/extensions`); responses echo only
41
- * non-secret config and whether each secret is set.
39
+ * Org-level extension enablement (`/api/v1/orgs/:orgId/extensions`); an org's config of an
40
+ * extension is its copy of the overridable deployment fields (the overrides routes below).
42
41
  */
43
42
  export declare class OrgExtensionConfigsController {
44
43
  private readonly configs;
@@ -56,7 +55,7 @@ export declare class OrgExtensionConfigsController {
56
55
  extensions: OrgExtensionItem[] | OrgExtensionMemberItem[];
57
56
  }>;
58
57
  /**
59
- * Writes enablement and / or config; see {@link OrgExtensionSwitch.put} for how `enabled` follows
58
+ * Writes enablement; see {@link OrgExtensionSwitch.put} for how `enabled` follows
60
59
  * the extension's plugin (off answers `{ preview, confirm }` until `confirm` carries the hash).
61
60
  */
62
61
  put(principal: Principal, org: OrgContext, extension: string, body: z.infer<typeof PutBody>): Promise<{
@@ -38,8 +38,8 @@ class OrgOverridesPutBody extends createZodDto(OverridesPut, "OrgOverridesPutBod
38
38
  class OrgOverridesTakeBody extends createZodDto(OverridesTake, "OrgOverridesTakeBody") {
39
39
  }
40
40
  /**
41
- * Org-level extension enablement and config (`/api/v1/orgs/:orgId/extensions`); responses echo only
42
- * non-secret config and whether each secret is set.
41
+ * Org-level extension enablement (`/api/v1/orgs/:orgId/extensions`); an org's config of an
42
+ * extension is its copy of the overridable deployment fields (the overrides routes below).
43
43
  */
44
44
  let OrgExtensionConfigsController = class OrgExtensionConfigsController {
45
45
  configs;
@@ -81,11 +81,11 @@ let OrgExtensionConfigsController = class OrgExtensionConfigsController {
81
81
  if (admin)
82
82
  return { extensions: items };
83
83
  return {
84
- extensions: items.map(({ config: _c, secrets: _s, orgConfigSchema: _o, permissions: _p, suggestedAppearance: _a, client: _cl, ...rest }) => rest),
84
+ extensions: items.map(({ permissions: _p, suggestedAppearance: _a, client: _cl, ...rest }) => rest),
85
85
  };
86
86
  }
87
87
  /**
88
- * Writes enablement and / or config; see {@link OrgExtensionSwitch.put} for how `enabled` follows
88
+ * Writes enablement; see {@link OrgExtensionSwitch.put} for how `enabled` follows
89
89
  * the extension's plugin (off answers `{ preview, confirm }` until `confirm` carries the hash).
90
90
  */
91
91
  async put(principal, org, extension, body) {
@@ -12,10 +12,9 @@ export declare const OrgToolSwitchPut: z.ZodObject<{
12
12
  enabled: z.ZodBoolean;
13
13
  confirm: z.ZodOptional<z.ZodString>;
14
14
  }, z.core.$strict>;
15
- /** `PUT /orgs/:orgId/extensions/:extension`: enablement and / or the org config. */
15
+ /** `PUT /orgs/:orgId/extensions/:extension`: enablement (an org's config is its copy: `…/overrides`). */
16
16
  export declare const OrgExtensionPut: z.ZodObject<{
17
17
  enabled: z.ZodOptional<z.ZodBoolean>;
18
- config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
19
18
  force: z.ZodOptional<z.ZodBoolean>;
20
19
  confirm: z.ZodOptional<z.ZodString>;
21
20
  }, z.core.$strict>;
@@ -12,12 +12,10 @@ export const OrgToolSwitchPut = z
12
12
  confirm: z.string().min(1).max(128).optional(),
13
13
  })
14
14
  .strict();
15
- /** `PUT /orgs/:orgId/extensions/:extension`: enablement and / or the org config. */
15
+ /** `PUT /orgs/:orgId/extensions/:extension`: enablement (an org's config is its copy: `…/overrides`). */
16
16
  export const OrgExtensionPut = z
17
17
  .object({
18
18
  enabled: z.boolean().optional(),
19
- /** The whole org config: secret fields omitted keep, `null` clears, a value sets. */
20
- config: z.record(z.string(), z.unknown()).optional(),
21
19
  force: z.boolean().optional(),
22
20
  /** The hash of the plugin uninstall preview, to confirm switching the extension's plugin off. */
23
21
  confirm: z.string().optional(),
@@ -126,13 +126,19 @@ let OwnedItems = class OwnedItems {
126
126
  await this.orgLock.lockAndAuthorize(orgId, actor, kind === "skill" ? "skills.manage" : "agents.manage");
127
127
  const row = await this.ownedComponent(orgId, kind, id, true);
128
128
  if (kind === "skill") {
129
- await this.db.updateTable("skills").set({ shareable }).where("id", "=", row.id).execute();
129
+ await this.db
130
+ .updateTable("skills")
131
+ .set({ shareable })
132
+ .where("id", "=", row.id)
133
+ .where("org_id", "=", orgId)
134
+ .execute();
130
135
  }
131
136
  else {
132
137
  await this.db
133
138
  .updateTable("agent_templates")
134
139
  .set({ shareable })
135
140
  .where("id", "=", row.id)
141
+ .where("org_id", "=", orgId)
136
142
  .execute();
137
143
  }
138
144
  // promoted: the platform row is the one every gate reads (ruling P3-2), written in this
@@ -428,6 +434,7 @@ let OwnedItems = class OwnedItems {
428
434
  .where("id", "=", item.id)
429
435
  .execute();
430
436
  if (item.scope === "all") {
437
+ // org-filter: the ownership transfer rewrites the item's whole named list (every org using it)
431
438
  await t.deleteFrom("catalog_item_scope_orgs").where("item_id", "=", item.id).execute();
432
439
  await t
433
440
  .insertInto("catalog_item_scope_orgs")
@@ -472,6 +479,7 @@ let OwnedItems = class OwnedItems {
472
479
  .set({ scope: "named", updated_at: now })
473
480
  .where("id", "=", c.id)
474
481
  .execute();
482
+ // org-filter: the ownership transfer narrows the component's whole named list to the orgs on
475
483
  await t
476
484
  .deleteFrom("component_scope_orgs")
477
485
  .where("kind", "=", c.kind)
@@ -627,6 +635,7 @@ let OwnedItems = class OwnedItems {
627
635
  .where("id", "=", id)
628
636
  .execute();
629
637
  if (narrowTo !== null) {
638
+ // org-filter: the ownership transfer narrows the component's whole named list to the orgs on
630
639
  await t
631
640
  .deleteFrom("component_scope_orgs")
632
641
  .where("kind", "=", kind)
@@ -271,6 +271,8 @@ export function ownerOf(ownerOrgId, owners) {
271
271
  * `except` (usually the owner), by name. One definition for the update notices and the
272
272
  * "used by another org" check of deletes. An item that is gone or disabled is on nowhere.
273
273
  */
274
+ // org-filter: answers which orgs an item is on in, so it reads the item's named list and switches
275
+ // of every org on purpose (keyed by the item id)
274
276
  export async function orgsUsing(db, ref, opts = {}) {
275
277
  const orgs = await db
276
278
  .selectFrom("orgs")
@@ -583,6 +583,7 @@ let PluginImport = class PluginImport {
583
583
  async staged(stagingId, owner) {
584
584
  if (!UUID_RE.test(stagingId))
585
585
  throw notFound();
586
+ // org-filter: ownStaging(owner) pins the row to the caller's org (org_id NULL for the platform)
586
587
  const row = await this.db
587
588
  .selectFrom("plugin_import_staging")
588
589
  .select(["id", "review", "manifest"])
@@ -610,6 +611,7 @@ let PluginImport = class PluginImport {
610
611
  async stagedTarget(stagingId, owner) {
611
612
  if (!UUID_RE.test(stagingId))
612
613
  throw notFound();
614
+ // org-filter: ownStaging(owner) pins the row to the caller's org (org_id NULL for the platform)
613
615
  const row = await this.db
614
616
  .selectFrom("plugin_import_staging")
615
617
  .select(["review", "manifest", "object_prefix"])
@@ -707,6 +709,7 @@ let PluginImport = class PluginImport {
707
709
  { path: "orgs", message: "scope named needs at least one organization" },
708
710
  ]);
709
711
  }
712
+ // org-filter: ownStaging(owner) pins the row to the caller's org (org_id NULL for the platform)
710
713
  const row = await this.db
711
714
  .selectFrom("plugin_import_staging")
712
715
  .selectAll()
@@ -830,6 +833,7 @@ let PluginImport = class PluginImport {
830
833
  const { owner } = scope;
831
834
  await this.authorizeActor(actor, owner);
832
835
  const t = this.db;
836
+ // org-filter: ownStaging(owner) pins the row to the caller's org (org_id NULL for the platform)
833
837
  const used = await t
834
838
  .deleteFrom("plugin_import_staging")
835
839
  .where("id", "=", stagingId)
@@ -905,6 +909,7 @@ let PluginImport = class PluginImport {
905
909
  await assertNameNotReserved(t, m.name);
906
910
  await this.resolveDependencies(m, owner);
907
911
  }
912
+ // org-filter: the existing item's whole named list (spans orgs), keyed by its item id
908
913
  const actual = existing === undefined
909
914
  ? scope
910
915
  : {
@@ -1276,6 +1281,7 @@ let PluginImport = class PluginImport {
1276
1281
  return total;
1277
1282
  }
1278
1283
  /** The expired staging rows, batch by batch; returns the rows deleted. */
1284
+ // org-filter: deployment-wide expiry sweep (maintenance job) over every org's staging rows
1279
1285
  async cleanupStagingRows() {
1280
1286
  let total = 0;
1281
1287
  for (;;) {
@@ -1309,6 +1315,7 @@ let PluginImport = class PluginImport {
1309
1315
  * One expired staging row (row lock, `SKIP LOCKED`): its objects, then the row; false when another
1310
1316
  * replica has it or it is gone.
1311
1317
  */
1318
+ // org-filter: deployment-wide expiry sweep; the row id comes from the sweep's own read
1312
1319
  async cleanupOne(r) {
1313
1320
  const t = this.db;
1314
1321
  const locked = await t
@@ -1350,6 +1357,7 @@ let PluginImport = class PluginImport {
1350
1357
  .executeTakeFirst();
1351
1358
  if (!pkg)
1352
1359
  return;
1360
+ // org-filter: whether any staging of any org still uses the package (content-addressed sha)
1353
1361
  const used = (await t
1354
1362
  .selectFrom("extension_installs")
1355
1363
  .select("name")
@@ -35,8 +35,6 @@ export interface ConnectorInstallInput {
35
35
  */
36
36
  export interface PluginInstallInput {
37
37
  connectors?: Record<string, ConnectorInstallInput>;
38
- /** The org config of the plugin's extension (used only when this install enables it). */
39
- extensionConfig?: Record<string, unknown>;
40
38
  }
41
39
  /**
42
40
  * `plugin` is a dependency install (ref = its plugin install id); `agent_template` (phase C) an
@@ -166,7 +164,6 @@ export interface InstallPlan {
166
164
  sourceFormat: SourceFormat;
167
165
  /** The plugin's own extension, to enable in the org. */
168
166
  extension: string | null;
169
- extensionConfig: Record<string, unknown> | undefined;
170
167
  templates: {
171
168
  id: string;
172
169
  file: ConnectorTemplateFile;
@@ -412,7 +409,7 @@ export declare class PluginInstaller {
412
409
  * unaffected.
413
410
  */
414
411
  planExtension(orgId: string, manifest: PluginManifest): Promise<string | null>;
415
- /** The input only names the plugin's template ids, and an extension config needs an extension. */
412
+ /** The input only names the plugin's template ids. */
416
413
  private checkInput;
417
414
  /**
418
415
  * Undoes the components this install created, in reverse order (the role is not re-checked: it
@@ -482,7 +482,7 @@ let PluginInstaller = class PluginInstaller {
482
482
  }
483
483
  }
484
484
  else {
485
- this.checkInput(manifest, allTemplates, input, at);
485
+ this.checkInput(allTemplates, input, at);
486
486
  for (const ct of templates) {
487
487
  // The kernel installs only what needs no org input (the scope sync's `needs_config` rule)
488
488
  if (actor === null)
@@ -513,7 +513,6 @@ let PluginInstaller = class PluginInstaller {
513
513
  row: v,
514
514
  sourceFormat: v.source_format,
515
515
  extension,
516
- extensionConfig: input?.extensionConfig,
517
516
  templates,
518
517
  connectors,
519
518
  skillNames,
@@ -743,10 +742,7 @@ let PluginInstaller = class PluginInstaller {
743
742
  }
744
743
  step = "extension";
745
744
  if (plan.extension !== null) {
746
- await this.enableExtension(orgId, plan.extension, {
747
- enabled: true,
748
- ...(plan.extensionConfig !== undefined && { config: plan.extensionConfig }),
749
- }, actor, opts.actorTokenId, { viaItem: itemId, ...(nested && { approvedBy }) }, record);
745
+ await this.enableExtension(orgId, plan.extension, { enabled: true }, actor, opts.actorTokenId, { viaItem: itemId, ...(nested && { approvedBy }) }, record);
750
746
  }
751
747
  step = "connectors";
752
748
  for (const ct of plan.templates) {
@@ -889,6 +885,7 @@ let PluginInstaller = class PluginInstaller {
889
885
  .where("i.id", "=", itemId), eb.ref("plugin_installs.version")),
890
886
  }))
891
887
  .where("id", "=", installId)
888
+ .where("org_id", "=", orgId)
892
889
  .where("status", "=", "installing")
893
890
  .executeTakeFirst();
894
891
  // The install row was already cleaned up as stale: do not audit plugin.org_installed, roll
@@ -927,6 +924,7 @@ let PluginInstaller = class PluginInstaller {
927
924
  .updateTable("plugin_installs")
928
925
  .set({ status: "failed", error: JSON.stringify({ step, code }) })
929
926
  .where("id", "=", installId)
927
+ .where("org_id", "=", orgId)
930
928
  .execute();
931
929
  await audit(t, {
932
930
  actorAccountId: actor,
@@ -967,16 +965,13 @@ let PluginInstaller = class PluginInstaller {
967
965
  }
968
966
  return name;
969
967
  }
970
- /** The input only names the plugin's template ids, and an extension config needs an extension. */
971
- checkInput(manifest, templates, input, at) {
968
+ /** The input only names the plugin's template ids. */
969
+ checkInput(templates, input, at) {
972
970
  const ids = new Set(templates.map((c) => c.id));
973
971
  for (const k of Object.keys(input.connectors ?? {})) {
974
972
  if (!ids.has(k))
975
973
  throw fail(`${at}connectors.${k}`, "No such connector template in this plugin");
976
974
  }
977
- if (input.extensionConfig !== undefined && !manifest.extension) {
978
- throw fail(`${at}extensionConfig`, "This plugin has no extension");
979
- }
980
975
  }
981
976
  /**
982
977
  * Undoes the components this install created, in reverse order (the role is not re-checked: it
@@ -1399,7 +1394,11 @@ let PluginInstaller = class PluginInstaller {
1399
1394
  else if (outcome !== "gone")
1400
1395
  keep(outcome);
1401
1396
  }
1402
- await t.deleteFrom("plugin_installs").where("id", "=", installId).execute();
1397
+ await t
1398
+ .deleteFrom("plugin_installs")
1399
+ .where("id", "=", installId)
1400
+ .where("org_id", "=", orgId)
1401
+ .execute();
1403
1402
  await audit(t, {
1404
1403
  actorAccountId: actor,
1405
1404
  ...(ctx.opts.actorTokenId !== undefined && { actorTokenId: ctx.opts.actorTokenId }),
@@ -1477,7 +1477,10 @@ __decorate([
1477
1477
  Transactional({ propagation: "requires_new" })
1478
1478
  ], PlatformPluginUpdater.prototype, "commit", null);
1479
1479
  PlatformPluginUpdater = __decorate([
1480
- Injectable(),
1480
+ Injectable()
1481
+ // org-filter: the platform plugin update (one version per deployment) moves the item's installs,
1482
+ // connectors and pinned copies in every org by design, keyed by the platform item / template ids
1483
+ ,
1481
1484
  __param(0, Inject(KernelDb)),
1482
1485
  __param(1, Inject(TransactionHost)),
1483
1486
  __param(2, Inject(SuperAdminLock)),
@@ -163,6 +163,8 @@ export async function resolveRequestsByInstall(db, orgId, itemId, actor, opts =
163
163
  }
164
164
  }
165
165
  /** The pending `import` request linked to a staged import (its approval prepared it), if any. */
166
+ // org-filter: by the staging id of the confirm's own staging row (ownStaging checked it); a platform
167
+ // staging prepared by approving import requests links requests of several orgs, read on purpose
166
168
  export async function importRequestOf(db, stagingId) {
167
169
  const r = await db
168
170
  .selectFrom("catalog_requests")
@@ -174,6 +176,8 @@ export async function importRequestOf(db, stagingId) {
174
176
  return r && { id: r.id, orgId: r.org_id };
175
177
  }
176
178
  /** Whether pending `import` requests are linked to the staging (its confirm resolves them). */
179
+ // org-filter: by the staging id of the confirm's own staging row (ownStaging checked it); a platform
180
+ // staging prepared by approving import requests links requests of several orgs, read on purpose
177
181
  export async function hasImportRequests(db, stagingId) {
178
182
  const r = await db
179
183
  .selectFrom("catalog_requests")
@@ -189,6 +193,8 @@ export async function hasImportRequests(db, stagingId) {
189
193
  * staging are approved (decider: the confirming admin) and point at the item. Audits
190
194
  * `catalog.request_decided`. Returns the requests' orgs.
191
195
  */
196
+ // org-filter: by the staging id of the confirm's own staging row (ownStaging checked it); a platform
197
+ // staging prepared by approving import requests links requests of several orgs, read on purpose
192
198
  export async function resolveImportRequests(db, stagingId, itemId, actor, opts = {}) {
193
199
  const rows = await db
194
200
  .updateTable("catalog_requests")
@@ -504,6 +504,7 @@ let CatalogRequestsService = class CatalogRequestsService {
504
504
  /** A pending `access` / `import` request (the row locked; the super admin re-checked). */
505
505
  async pendingDeploymentRequest(actor, requestId) {
506
506
  await this.adminLock.lockAndAuthorize(actor);
507
+ // org-filter: super admin decides deployment requests of every org (adminLock just above)
507
508
  const row = await this.db
508
509
  .selectFrom("catalog_requests")
509
510
  .select(["kind", "status", "marketplace_id", "entry_name", "entry_version", "staging_id"])
@@ -520,6 +521,7 @@ let CatalogRequestsService = class CatalogRequestsService {
520
521
  /** Links a still pending `import` request to its prepared staging. */
521
522
  async linkStaging(actor, requestId, stagingId, opts) {
522
523
  await this.adminLock.lockAndAuthorize(actor);
524
+ // org-filter: super admin links any org's import request (adminLock just above)
523
525
  const row = await this.db
524
526
  .selectFrom("catalog_requests")
525
527
  .select(["org_id", "status", "entry_name"])
@@ -532,6 +534,7 @@ let CatalogRequestsService = class CatalogRequestsService {
532
534
  .updateTable("catalog_requests")
533
535
  .set({ staging_id: stagingId })
534
536
  .where("id", "=", requestId)
537
+ .where("org_id", "=", row.org_id)
535
538
  .execute();
536
539
  await audit(this.db, {
537
540
  actorAccountId: actor,
@@ -605,6 +608,7 @@ let CatalogRequestsService = class CatalogRequestsService {
605
608
  decided_at: sql `now()`,
606
609
  })
607
610
  .where("id", "=", requestId)
611
+ .where("org_id", "=", row.org_id)
608
612
  .execute();
609
613
  await audit(t, {
610
614
  actorAccountId: actor,
@@ -40,6 +40,7 @@ export async function addScopeOrg(db, actor, item, orgId, opts = {}) {
40
40
  })
41
41
  .where("id", "=", item.id)
42
42
  .execute();
43
+ // org-filter: the item's whole named list after the add, for the scope_changed audit (spans orgs)
43
44
  const rows = await db
44
45
  .selectFrom("catalog_item_scope_orgs")
45
46
  .select("org_id")
@@ -1,3 +1,4 @@
1
+ import { EffectiveConfigs } from "../extensions/effective-config.js";
1
2
  import { ExtensionRegistry } from "../extensions/registry.js";
2
3
  import { KernelDb } from "../infra/database/kernel-db.js";
3
4
  import { TransactionHost } from "../infra/database/transaction-host.js";
@@ -79,12 +80,13 @@ export declare class PluginScopeSync {
79
80
  private readonly outbox;
80
81
  private readonly installer;
81
82
  private readonly registry;
83
+ private readonly effective;
82
84
  private readonly locks;
83
85
  private readonly log;
84
86
  readonly txHost: TransactionHost;
85
87
  /** Orgs per chunk job (a test seam; default {@link SCOPE_ORG_CHUNK}). */
86
88
  private readonly chunkSize;
87
- constructor(kdb: KernelDb, outbox: Pick<OutboxService, "add" | "addMany">, installer: PluginInstaller, registry: ExtensionRegistry, locks: LockService, log: KernelLogger, txHost: TransactionHost,
89
+ constructor(kdb: KernelDb, outbox: Pick<OutboxService, "add" | "addMany">, installer: PluginInstaller, registry: ExtensionRegistry, effective: Pick<EffectiveConfigs, "get">, locks: LockService, log: KernelLogger, txHost: TransactionHost,
88
90
  /** Orgs per chunk job (a test seam; default {@link SCOPE_ORG_CHUNK}). */
89
91
  chunkSize?: number);
90
92
  private get db();
@@ -126,18 +128,19 @@ export declare class PluginScopeSync {
126
128
  private syncLocked;
127
129
  /** Whether a live install of the org depends on this install (spec §5 rule 9). */
128
130
  dependedOn(orgId: string, installId: string): Promise<boolean>;
129
- /** The items of the dependency installs this install created. */
131
+ /** The items of the dependency installs this install (of `orgId`) created. */
130
132
  private createdDependencies;
131
133
  /**
132
134
  * Whether installing the item (with the dependencies the org lacks) needs the org's input: a
133
- * connector template, or an extension whose org config is required and not set in the org. The
134
- * same rule as the org catalog's `needs_config`, applied to the whole tree.
135
+ * connector template, or an extension whose effective config for the org is not valid. The same
136
+ * rule as the org catalog's `needs_config`, applied to the whole tree.
135
137
  */
136
138
  needsInput(orgId: string, itemId: string, version: string): Promise<boolean>;
137
139
  /**
138
140
  * Whether installing plugin `itemId` (manifest `m`) needs the org's input: a connector template
139
141
  * on in the org (ruling P2-6: templates switched off there, outside their own scope or disabled
140
- * make no connector), or a required org config of its extension not set yet.
142
+ * make no connector), or its extension's effective config for the org is not valid (a required
143
+ * overridable field the platform leaves empty and the org has no copy of).
141
144
  */
142
145
  private manifestNeedsInput;
143
146
  /**
@@ -9,6 +9,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
9
9
  };
10
10
  import { Inject, Injectable, Optional } from "@nestjs/common";
11
11
  import { ApiError } from "../errors.js";
12
+ import { EffectiveConfigs } from "../extensions/effective-config.js";
12
13
  import { ExtensionRegistry } from "../extensions/registry.js";
13
14
  import { audit } from "../identity/audit.js";
14
15
  import { KernelDb } from "../infra/database/kernel-db.js";
@@ -97,17 +98,19 @@ let PluginScopeSync = class PluginScopeSync {
97
98
  outbox;
98
99
  installer;
99
100
  registry;
101
+ effective;
100
102
  locks;
101
103
  log;
102
104
  txHost;
103
105
  chunkSize;
104
- constructor(kdb, outbox, installer, registry, locks, log, txHost,
106
+ constructor(kdb, outbox, installer, registry, effective, locks, log, txHost,
105
107
  /** Orgs per chunk job (a test seam; default {@link SCOPE_ORG_CHUNK}). */
106
108
  chunkSize = SCOPE_ORG_CHUNK) {
107
109
  this.kdb = kdb;
108
110
  this.outbox = outbox;
109
111
  this.installer = installer;
110
112
  this.registry = registry;
113
+ this.effective = effective;
111
114
  this.locks = locks;
112
115
  this.log = log;
113
116
  this.txHost = txHost;
@@ -341,7 +344,7 @@ let PluginScopeSync = class PluginScopeSync {
341
344
  // enqueue)
342
345
  if (live?.status !== "installed")
343
346
  return "unchanged";
344
- const deps = await this.createdDependencies(live.id);
347
+ const deps = await this.createdDependencies(orgId, live.id);
345
348
  try {
346
349
  await this.installer.uninstall(orgId, null, live.id, { via: "scope" });
347
350
  }
@@ -373,8 +376,8 @@ let PluginScopeSync = class PluginScopeSync {
373
376
  .executeTakeFirst();
374
377
  return row !== undefined;
375
378
  }
376
- /** The items of the dependency installs this install created. */
377
- async createdDependencies(installId) {
379
+ /** The items of the dependency installs this install (of `orgId`) created. */
380
+ async createdDependencies(orgId, installId) {
378
381
  // `ref` is text: the child install ids are read first, then their items
379
382
  const refs = await this.db
380
383
  .selectFrom("plugin_install_components")
@@ -388,14 +391,15 @@ let PluginScopeSync = class PluginScopeSync {
388
391
  const rows = await this.db
389
392
  .selectFrom("plugin_installs")
390
393
  .select("item_id")
394
+ .where("org_id", "=", orgId)
391
395
  .where("id", "in", refs.map((r) => r.ref))
392
396
  .execute();
393
397
  return rows.map((r) => r.item_id);
394
398
  }
395
399
  /**
396
400
  * Whether installing the item (with the dependencies the org lacks) needs the org's input: a
397
- * connector template, or an extension whose org config is required and not set in the org. The
398
- * same rule as the org catalog's `needs_config`, applied to the whole tree.
401
+ * connector template, or an extension whose effective config for the org is not valid. The same
402
+ * rule as the org catalog's `needs_config`, applied to the whole tree.
399
403
  */
400
404
  async needsInput(orgId, itemId, version) {
401
405
  const v = await this.db
@@ -424,7 +428,8 @@ let PluginScopeSync = class PluginScopeSync {
424
428
  /**
425
429
  * Whether installing plugin `itemId` (manifest `m`) needs the org's input: a connector template
426
430
  * on in the org (ruling P2-6: templates switched off there, outside their own scope or disabled
427
- * make no connector), or a required org config of its extension not set yet.
431
+ * make no connector), or its extension's effective config for the org is not valid (a required
432
+ * overridable field the platform leaves empty and the org has no copy of).
428
433
  */
429
434
  async manifestNeedsInput(orgId, m, itemId) {
430
435
  const ids = (m.connectorTemplates ?? []).map((t) => templateIdOfPath(t.path));
@@ -432,18 +437,10 @@ let PluginScopeSync = class PluginScopeSync {
432
437
  return true;
433
438
  if (!m.extension)
434
439
  return false;
435
- const ext = this.registry.manifests().find((x) => x.name === m.name);
436
- const schema = ext?.config?.org;
437
- if (schema === undefined || schema.safeParse({}).success)
440
+ // not loaded here: `extensionReady` decides; an extension without overridable fields is ok
441
+ if (!this.registry.manifests().some((x) => x.name === m.name))
438
442
  return false;
439
- const configured = await this.db
440
- .selectFrom("extension_org_configs")
441
- .select("plugin")
442
- .where("org_id", "=", orgId)
443
- .where("plugin", "=", m.name)
444
- .where("config", "is not", null)
445
- .executeTakeFirst();
446
- return configured === undefined;
443
+ return !(await this.effective.get(orgId, m.name)).ok;
447
444
  }
448
445
  /**
449
446
  * Logs and audits a failed install or uninstall (`plugin.scope_sync_failed`, actor null) and
@@ -490,10 +487,11 @@ PluginScopeSync = __decorate([
490
487
  __param(1, Inject(OutboxService)),
491
488
  __param(2, Inject(PluginInstaller)),
492
489
  __param(3, Inject(ExtensionRegistry)),
493
- __param(4, Inject(LockService)),
494
- __param(5, Inject(KERNEL_LOGGER)),
495
- __param(6, Inject(TransactionHost)),
496
- __param(7, Optional()),
497
- __param(7, Inject(SCOPE_ORG_CHUNK_SIZE))
490
+ __param(4, Inject(EffectiveConfigs)),
491
+ __param(5, Inject(LockService)),
492
+ __param(6, Inject(KERNEL_LOGGER)),
493
+ __param(7, Inject(TransactionHost)),
494
+ __param(8, Optional()),
495
+ __param(8, Inject(SCOPE_ORG_CHUNK_SIZE))
498
496
  ], PluginScopeSync);
499
497
  export { PluginScopeSync };
@@ -17,6 +17,8 @@ async function liveOrgIds(db) {
17
17
  * `catalog.scope_changed`; returns whether the scope changed (the caller enqueues the item's
18
18
  * scope sync after the commit).
19
19
  */
20
+ // org-filter: unsharing narrows the item to every org where it is on now, so it reads and rewrites
21
+ // the item's installs, switches and named list across orgs (keyed by the locked item id)
20
22
  export async function narrowItemOnUnshare(db, actor, item) {
21
23
  if (item.owner_org_id === null || item.scope === "named")
22
24
  return false;
@@ -70,6 +72,7 @@ export async function narrowItemOnUnshare(db, actor, item) {
70
72
  * to `named` = owner + the live orgs where it is on now ({@link componentOn}). A component that
71
73
  * follows its plugin is narrowed with the plugin. Audits `component.scope_changed`.
72
74
  */
75
+ // org-filter: unsharing narrows the component's whole named list to every org where it is on now
73
76
  export async function narrowComponentOnUnshare(db, actor, c) {
74
77
  if (c.ownerOrgId === null || c.scopeMode !== "own" || c.scope === "named")
75
78
  return false;
@@ -835,6 +835,7 @@ let ChannelConnections = class ChannelConnections {
835
835
  .selectFrom("channel_connections")
836
836
  .select("config")
837
837
  .where("id", "=", id)
838
+ .where("org_id", "=", row.orgId)
838
839
  .executeTakeFirstOrThrow();
839
840
  const full = structuredClone(stored.config ?? {});
840
841
  for (const [p, v] of Object.entries(await this.readSecrets(row.orgId, id)))
@@ -271,6 +271,7 @@ let ChannelInbound = class ChannelInbound {
271
271
  await db
272
272
  .deleteFrom("conversations")
273
273
  .where("id", "=", created)
274
+ .where("org_id", "=", row.orgId)
274
275
  .where("last_seq", "=", "0")
275
276
  .execute();
276
277
  }
@@ -97,6 +97,7 @@ let ChannelJobs = class ChannelJobs {
97
97
  .selectFrom("conversations")
98
98
  .select("last_seq")
99
99
  .where("id", "=", conversationId)
100
+ .where("org_id", "=", orgId)
100
101
  .forUpdate()
101
102
  .executeTakeFirst();
102
103
  if (!conv)
@@ -137,6 +137,7 @@ export async function conversationLocale(db, orgId, conversationId, uptoSeq) {
137
137
  .selectFrom("conversations")
138
138
  .select("account_id")
139
139
  .where("id", "=", conversationId)
140
+ .where("org_id", "=", orgId)
140
141
  .executeTakeFirst();
141
142
  accountId = c?.account_id ?? null;
142
143
  }
@@ -369,6 +370,7 @@ let ChannelOutbound = class ChannelOutbound {
369
370
  }
370
371
  }
371
372
  /** 会话日志当前的最后位置(会话不存在时 undefined)。 */
373
+ // org-filter: conversationId comes from the kernel-written delivery job payload, not caller input
372
374
  async lastSeq(conversationId) {
373
375
  const conv = await this.kdb
374
376
  .selectFrom("conversations")
@@ -387,6 +389,7 @@ let ChannelOutbound = class ChannelOutbound {
387
389
  async recordError(connectionId, message) {
388
390
  const text = `delivery failed: ${message}`.slice(0, MAX_ERROR_CHARS);
389
391
  this.log.warn("channel delivery failed", { connectionId, error: text });
392
+ // org-filter: connectionId is the delivery's own connection (kernel-written job / row)
390
393
  await this.kdb
391
394
  .updateTable("channel_connections")
392
395
  .set({ last_error: text })
@@ -721,6 +724,7 @@ class Delivery {
721
724
  .selectFrom("channel_connections")
722
725
  .select(["status", "updated_at"])
723
726
  .where("id", "=", this.s.row.id)
727
+ .where("org_id", "=", this.s.row.orgId)
724
728
  .where("deleted_at", "is", null)
725
729
  .executeTakeFirst();
726
730
  return r?.status === "active" ? r.updated_at.getTime() : undefined;
@@ -801,6 +805,7 @@ class Delivery {
801
805
  .selectFrom("conversations")
802
806
  .select("last_seq")
803
807
  .where("id", "=", this.conversationId)
808
+ .where("org_id", "=", this.s.row.orgId)
804
809
  .executeTakeFirst();
805
810
  return !conv || Number(conv.last_seq) <= this.seen;
806
811
  }
@@ -942,6 +947,7 @@ class Delivery {
942
947
  .selectFrom("questions")
943
948
  .select("spec")
944
949
  .where("id", "=", p.questionId)
950
+ .where("org_id", "=", this.s.row.orgId)
945
951
  .executeTakeFirst();
946
952
  const form = q?.spec?.form;
947
953
  if (!form)
@@ -521,6 +521,7 @@ let ChannelSupervisor = class ChannelSupervisor {
521
521
  await this.redis.expire(channelFailsKey(id), FAILS_TTL_SECONDS);
522
522
  const delay = Math.min(MAX_BACKOFF_MS, this.config.get().channels.retryBaseMs * 2 ** Math.min(fails - 1, 20));
523
523
  await this.redis.set(channelBackoffKey(id), "1", "PX", delay);
524
+ // org-filter: id is a connection this gateway supervisor holds the lease of, not caller input
524
525
  await this.db
525
526
  .updateTable("channel_connections")
526
527
  .set({ last_error: message })