@capybara-hq/kernel 0.1.0-rc.121 → 0.1.0-rc.122

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 (229) hide show
  1. package/dist/background/finish.d.ts +5 -1
  2. package/dist/background/finish.js +29 -18
  3. package/dist/background/launch.d.ts +0 -5
  4. package/dist/background/launch.js +1 -6
  5. package/dist/background/managed.js +1 -4
  6. package/dist/background/poll.job.d.ts +3 -25
  7. package/dist/background/poll.job.js +20 -112
  8. package/dist/background/render.d.ts +2 -8
  9. package/dist/background/render.js +3 -17
  10. package/dist/background/stop.d.ts +15 -16
  11. package/dist/background/stop.js +39 -76
  12. package/dist/background/store.d.ts +17 -45
  13. package/dist/background/store.js +60 -94
  14. package/dist/background/tasks.service.d.ts +2 -5
  15. package/dist/background/tasks.service.js +9 -20
  16. package/dist/background/wake.js +3 -2
  17. package/dist/catalog/admin-catalog.controller.d.ts +2 -18
  18. package/dist/catalog/admin-catalog.controller.js +2 -28
  19. package/dist/catalog/catalog-content.d.ts +1 -5
  20. package/dist/catalog/catalog-items.d.ts +2 -6
  21. package/dist/catalog/catalog-items.js +5 -26
  22. package/dist/catalog/catalog-scope.service.d.ts +1 -121
  23. package/dist/catalog/catalog-scope.service.js +12 -552
  24. package/dist/catalog/catalog.service.d.ts +4 -15
  25. package/dist/catalog/catalog.service.js +7 -35
  26. package/dist/catalog/job-ids.d.ts +0 -18
  27. package/dist/catalog/job-ids.js +0 -20
  28. package/dist/catalog/marketplaces.service.d.ts +1 -1
  29. package/dist/catalog/org-catalog.service.js +6 -20
  30. package/dist/catalog/org-plugin-uploads.controller.d.ts +4 -19
  31. package/dist/catalog/org-plugin-uploads.controller.js +6 -34
  32. package/dist/catalog/org-plugin-uploads.d.ts +3 -10
  33. package/dist/catalog/org-plugin-uploads.js +4 -18
  34. package/dist/catalog/org-plugin-uploads.schemas.js +0 -1
  35. package/dist/catalog/owned-items.d.ts +6 -11
  36. package/dist/catalog/owned-items.js +10 -20
  37. package/dist/catalog/ownership.d.ts +3 -29
  38. package/dist/catalog/ownership.js +4 -54
  39. package/dist/catalog/platform-components.d.ts +5 -11
  40. package/dist/catalog/platform-components.js +8 -15
  41. package/dist/catalog/plugin-import.d.ts +3 -42
  42. package/dist/catalog/plugin-import.js +26 -195
  43. package/dist/catalog/plugin-install.js +1 -6
  44. package/dist/catalog/plugin-package.d.ts +1 -0
  45. package/dist/catalog/plugin-package.js +5 -0
  46. package/dist/catalog/plugin-upgrade.d.ts +3 -26
  47. package/dist/catalog/plugin-upgrade.js +20 -103
  48. package/dist/catalog/request-rules.js +4 -6
  49. package/dist/catalog/scope-sync.js +2 -4
  50. package/dist/catalog/scope.d.ts +2 -5
  51. package/dist/channels/jobs.d.ts +3 -3
  52. package/dist/channels/jobs.js +4 -3
  53. package/dist/channels/outbound.d.ts +1 -0
  54. package/dist/channels/outbound.js +32 -8
  55. package/dist/config/load.d.ts +0 -25
  56. package/dist/config/load.js +0 -57
  57. package/dist/config/schema.js +2 -3
  58. package/dist/conversations/attachments.service.js +3 -5
  59. package/dist/conversations/conversations.service.d.ts +3 -3
  60. package/dist/conversations/conversations.service.js +3 -3
  61. package/dist/conversations/job-org.d.ts +3 -0
  62. package/dist/conversations/job-org.js +11 -0
  63. package/dist/conversations/prompt-suggestions.d.ts +2 -7
  64. package/dist/conversations/prompt-suggestions.js +29 -27
  65. package/dist/conversations/titles.d.ts +3 -4
  66. package/dist/conversations/titles.js +19 -30
  67. package/dist/db/kernel-schema.d.ts +6 -16
  68. package/dist/db/pool.js +7 -2
  69. package/dist/devices/devices.controller.d.ts +0 -5
  70. package/dist/devices/devices.controller.js +2 -20
  71. package/dist/devices/devices.service.d.ts +1 -17
  72. package/dist/devices/devices.service.js +0 -22
  73. package/dist/errors.d.ts +1 -5
  74. package/dist/errors.js +1 -5
  75. package/dist/evals/judge.d.ts +3 -0
  76. package/dist/evals/judge.js +1 -1
  77. package/dist/evals/run-replay.d.ts +1 -1
  78. package/dist/evals/run-replay.js +26 -29
  79. package/dist/evals/step-replay.d.ts +3 -1
  80. package/dist/evals/step-replay.js +10 -1
  81. package/dist/evals/worker.d.ts +3 -1
  82. package/dist/evals/worker.js +53 -21
  83. package/dist/extensions/deployment-config-store.js +18 -14
  84. package/dist/extensions/effective-config.d.ts +1 -5
  85. package/dist/extensions/effective-config.js +1 -5
  86. package/dist/extensions/hooks.d.ts +3 -1
  87. package/dist/extensions/hooks.js +7 -2
  88. package/dist/extensions/installs.d.ts +2 -14
  89. package/dist/extensions/installs.js +10 -32
  90. package/dist/extensions/org-config.d.ts +3 -4
  91. package/dist/extensions/org-config.js +3 -4
  92. package/dist/extensions/plugin-guides.d.ts +0 -1
  93. package/dist/extensions/plugin-guides.js +0 -1
  94. package/dist/extensions/plugin-icons.d.ts +0 -1
  95. package/dist/extensions/plugin-icons.js +0 -3
  96. package/dist/files/blob-sweep.job.d.ts +2 -11
  97. package/dist/files/blob-sweep.job.js +7 -21
  98. package/dist/files/hash-job.d.ts +5 -15
  99. package/dist/files/hash-job.js +14 -33
  100. package/dist/files/library-jobs.module.d.ts +1 -6
  101. package/dist/files/library-jobs.module.js +3 -9
  102. package/dist/identity/api-tokens.js +54 -40
  103. package/dist/identity/auth.guard.js +2 -2
  104. package/dist/identity/sessions.js +7 -3
  105. package/dist/identity/settings.js +5 -21
  106. package/dist/inbox/inbox.service.d.ts +2 -3
  107. package/dist/inbox/org-notices.d.ts +0 -14
  108. package/dist/inbox/platform-inbox.service.d.ts +1 -8
  109. package/dist/inbox/platform-inbox.service.js +2 -6
  110. package/dist/inbox/platform-notices.d.ts +3 -3
  111. package/dist/index.d.ts +0 -4
  112. package/dist/index.js +0 -3
  113. package/dist/infra/database/database.module.js +2 -1
  114. package/dist/infra/database/org-scope.d.ts +5 -3
  115. package/dist/infra/database/org-scope.js +7 -1
  116. package/dist/infra/database/scoped-dialect.d.ts +3 -1
  117. package/dist/infra/database/scoped-dialect.js +17 -5
  118. package/dist/infra/events/kernel-events.d.ts +2 -0
  119. package/dist/infra/outbox/outbox.service.d.ts +2 -0
  120. package/dist/infra/outbox/outbox.service.js +10 -0
  121. package/dist/infra/outbox/registry.d.ts +0 -41
  122. package/dist/infra/outbox/registry.js +0 -37
  123. package/dist/models/embeddings.d.ts +0 -5
  124. package/dist/models/embeddings.js +28 -35
  125. package/dist/models/images.d.ts +3 -8
  126. package/dist/models/images.js +19 -37
  127. package/dist/models/purposes.d.ts +7 -2
  128. package/dist/models/purposes.js +16 -3
  129. package/dist/orgs/device-network-setting.d.ts +0 -44
  130. package/dist/orgs/device-network-setting.js +0 -83
  131. package/dist/orgs/invitations.service.js +34 -30
  132. package/dist/orgs/offboarding.d.ts +2 -2
  133. package/dist/orgs/offboarding.js +2 -2
  134. package/dist/orgs/orgs.service.d.ts +1 -1
  135. package/dist/orgs/orgs.service.js +19 -15
  136. package/dist/orgs/settings.service.d.ts +19 -14
  137. package/dist/orgs/settings.service.js +12 -37
  138. package/dist/platform/exclusions.js +0 -11
  139. package/dist/platform/ops/catalog-admin.ops.js +0 -8
  140. package/dist/platform/ops/devices.ops.js +0 -28
  141. package/dist/platform/ops/extensions-admin.ops.js +3 -3
  142. package/dist/platform/ops/inbox.ops.js +5 -22
  143. package/dist/platform/ops/org-plugins.ops.d.ts +1 -3
  144. package/dist/platform/ops/org-plugins.ops.js +11 -67
  145. package/dist/roles/worker.module.js +0 -9
  146. package/dist/runtime/hook-calls.d.ts +13 -6
  147. package/dist/runtime/hook-calls.js +26 -4
  148. package/dist/runtime/maintenance.d.ts +3 -12
  149. package/dist/runtime/maintenance.js +25 -55
  150. package/dist/runtime/model-call.d.ts +4 -2
  151. package/dist/runtime/model-call.js +59 -58
  152. package/dist/runtime/providers.d.ts +27 -1
  153. package/dist/runtime/providers.js +57 -0
  154. package/dist/runtime/run-jobs.d.ts +1 -1
  155. package/dist/runtime/run-processors.d.ts +3 -9
  156. package/dist/runtime/run-worker.d.ts +2 -0
  157. package/dist/runtime/run-worker.js +23 -8
  158. package/dist/runtime/subagents/deliveries.js +6 -1
  159. package/dist/runtime/subagents/dispatch.d.ts +3 -3
  160. package/dist/runtime/write-base.service.d.ts +2 -3
  161. package/dist/runtime/write-base.service.js +3 -5
  162. package/dist/sandbox/device-sandbox-settings.d.ts +38 -92
  163. package/dist/sandbox/device-sandbox-settings.js +19 -325
  164. package/dist/sandbox/jobs.d.ts +3 -14
  165. package/dist/sandbox/jobs.js +2 -20
  166. package/dist/sandbox/modes.d.ts +5 -45
  167. package/dist/sandbox/modes.js +3 -60
  168. package/dist/sandbox/operation-authority.js +0 -11
  169. package/dist/sandbox/operation-intents.d.ts +32 -9
  170. package/dist/sandbox/operation-intents.js +241 -32
  171. package/dist/sandbox/operation-intents.module.js +2 -1
  172. package/dist/sandbox/operation-reconcile.job.d.ts +9 -11
  173. package/dist/sandbox/operation-reconcile.job.js +119 -33
  174. package/dist/sandbox/operation-revoke.d.ts +20 -0
  175. package/dist/sandbox/operation-revoke.js +3 -0
  176. package/dist/sandbox/permission-ceiling-writes.d.ts +1 -2
  177. package/dist/sandbox/permission-ceiling-writes.js +3 -6
  178. package/dist/sandbox/permission-config-publication.d.ts +1 -28
  179. package/dist/sandbox/permission-config-publication.js +14 -211
  180. package/dist/sandbox/permission-facts.d.ts +4 -15
  181. package/dist/sandbox/permission-facts.js +7 -29
  182. package/dist/sandbox/permission-instance-writes.d.ts +1 -4
  183. package/dist/sandbox/permission-instance-writes.js +1 -55
  184. package/dist/sandbox/providers.d.ts +1 -6
  185. package/dist/sandbox/providers.js +1 -15
  186. package/dist/sandbox/review/classifier.js +12 -13
  187. package/dist/sandbox/sandbox.module.js +3 -6
  188. package/dist/sandbox/sandbox.service.d.ts +17 -123
  189. package/dist/sandbox/sandbox.service.js +239 -998
  190. package/dist/shares/liveness.d.ts +1 -2
  191. package/dist/shares/liveness.js +1 -2
  192. package/dist/shares/shares.module.d.ts +1 -2
  193. package/dist/shares/shares.module.js +2 -5
  194. package/dist/shares/shares.service.js +1 -2
  195. package/dist/tools/builtins/image/generate.js +7 -15
  196. package/dist/tools/builtins/sandbox/common.d.ts +0 -2
  197. package/dist/tools/builtins/sandbox/common.js +1 -27
  198. package/dist/tools/builtins/sandbox/task-list.js +10 -10
  199. package/dist/tools/builtins/sandbox/task-output.d.ts +3 -10
  200. package/dist/tools/builtins/sandbox/task-output.js +13 -83
  201. package/dist/tools/builtins/sandbox/task-stop.js +18 -22
  202. package/dist/tools/builtins/vision/read-image.js +9 -10
  203. package/dist/tools/builtins/web/extract.js +9 -10
  204. package/package.json +3 -3
  205. package/src/migrations/0206_retire_org_extension_uploads.sql +125 -0
  206. package/src/migrations/0207_confirm_device_instance_destruction.sql +25 -0
  207. package/src/migrations/0208_convert_stored_permission_settings.sql +189 -0
  208. package/dist/background/retire-legacy-tasks.job.d.ts +0 -57
  209. package/dist/background/retire-legacy-tasks.job.js +0 -149
  210. package/dist/catalog/owned-plugin-cleanup.d.ts +0 -47
  211. package/dist/catalog/owned-plugin-cleanup.js +0 -140
  212. package/dist/config/permission-migration.d.ts +0 -34
  213. package/dist/config/permission-migration.js +0 -115
  214. package/dist/devices/legacy-cleanup.job.d.ts +0 -34
  215. package/dist/devices/legacy-cleanup.job.js +0 -147
  216. package/dist/files/library-backfill.d.ts +0 -63
  217. package/dist/files/library-backfill.js +0 -143
  218. package/dist/infra/cli/permission-cutover.d.ts +0 -59
  219. package/dist/infra/cli/permission-cutover.js +0 -107
  220. package/dist/sandbox/cloud-permission-snapshot.d.ts +0 -159
  221. package/dist/sandbox/cloud-permission-snapshot.js +0 -430
  222. package/dist/sandbox/cloud-permission-snapshot.module.d.ts +0 -8
  223. package/dist/sandbox/cloud-permission-snapshot.module.js +0 -34
  224. package/dist/sandbox/legacy-retirement.d.ts +0 -284
  225. package/dist/sandbox/legacy-retirement.js +0 -1165
  226. package/dist/sandbox/legacy-retirement.module.d.ts +0 -8
  227. package/dist/sandbox/legacy-retirement.module.js +0 -25
  228. package/dist/shares/share-objects.d.ts +0 -47
  229. package/dist/shares/share-objects.js +0 -93
@@ -9,6 +9,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
9
9
  };
10
10
  import { isDeviceRequestNotSent, isSandboxPermissionUnsupportedError, isSandboxScopeDeniedError, parseSandboxExecutionRef, parseSandboxOperationScope, SandboxOperationOutcomeUnknownError, SandboxPermissionUnsupportedError, } from "@capybara-hq/plugin-sdk";
11
11
  import { Inject, Injectable, Optional } from "@nestjs/common";
12
+ import { NoResultError } from "kysely";
12
13
  import { MANAGED_STOP_GRACE_MS, ManagedInstanceMismatchError } from "../background/managed.js";
13
14
  import { BackgroundTaskStopper } from "../background/stop.js";
14
15
  import { BackgroundTaskStore } from "../background/store.js";
@@ -18,6 +19,7 @@ import { KernelDb } from "../infra/database/kernel-db.js";
18
19
  import { KERNEL_LOGGER } from "../infra/tokens.js";
19
20
  import { checkManagedStart } from "./held-operations.js";
20
21
  import { SandboxOperationIntents } from "./operation-intents.js";
22
+ import { MANAGED_REVOKE_ATTEMPTS } from "./operation-revoke.js";
21
23
  import { DeviceProviders } from "./providers.js";
22
24
  import { SandboxService } from "./sandbox.service.js";
23
25
  /**
@@ -25,6 +27,8 @@ import { SandboxService } from "./sandbox.service.js";
25
27
  * after its admission deadline (the margin a holder record keeps too).
26
28
  */
27
29
  const OPERATION_END_MARGIN_MS = 10 * 60_000;
30
+ class StopClaimInProgress extends Error {
31
+ }
28
32
  /** Called only by the maintenance consumer. It has no native dispatch or lease token API. */
29
33
  let SandboxOperationReconcileJob = class SandboxOperationReconcileJob {
30
34
  intents;
@@ -102,11 +106,11 @@ let SandboxOperationReconcileJob = class SandboxOperationReconcileJob {
102
106
  await this.intents.abandonBackgroundLaunch(row.operation_id, "expired");
103
107
  const now = await this.intents.read(row.operation_id);
104
108
  if (now.state === "revoked" && !now.revoke_acknowledged)
105
- await this.revoke(row.operation_id);
109
+ await this.revoke(row.operation_id, 0);
106
110
  return;
107
111
  }
108
112
  if (row.state === "revoked") {
109
- await this.revoke(row.operation_id);
113
+ await this.revoke(row.operation_id, 0);
110
114
  return;
111
115
  }
112
116
  if (row.state === "dispatching") {
@@ -195,23 +199,108 @@ let SandboxOperationReconcileJob = class SandboxOperationReconcileJob {
195
199
  await this.intents.deferBackgroundRecovery(operationId);
196
200
  }
197
201
  }
198
- async revoke(operationId) {
202
+ async revoke(operationId, attempt, orgId) {
203
+ let row;
199
204
  try {
200
- await this.revokeOnce(operationId);
205
+ row = await this.intents.read(operationId);
201
206
  }
202
- catch {
203
- await this.intents.deferRevocation(operationId);
207
+ catch (error) {
208
+ if (error instanceof NoResultError)
209
+ return;
210
+ throw error;
211
+ }
212
+ if (orgId !== undefined && row.org_id !== orgId)
213
+ return;
214
+ if (row.method === "backgroundStart" && row.state === "background-running") {
215
+ await this.intents.adoptOwedStop(row);
216
+ row = await this.intents.read(operationId);
204
217
  }
205
- }
206
- async revokeOnce(operationId) {
207
- const row = await this.intents.read(operationId);
208
218
  if (row.state !== "revoked" || row.revoke_acknowledged)
209
219
  return;
210
- // a launched background start is cancelled by its exact ref, never by the operation revoke;
211
- // one revoked before its ref is known keeps the exact operation revoke below
212
- if (row.method === "backgroundStart" && row.execution_ref !== null) {
213
- await this.revokeBackground(row);
220
+ try {
221
+ if (await this.destructionRecorded(row)) {
222
+ if (row.method === "backgroundStart") {
223
+ const task = await this.tasks.byOperation(operationId);
224
+ if (task) {
225
+ if (task.orgId !== row.org_id)
226
+ throw new SandboxOperationOutcomeUnknownError("The task does not belong to the start's org");
227
+ await this.stopper.settleDestroyed(task);
228
+ await this.tasks.settleOwedCancel(task.id);
229
+ }
230
+ }
231
+ await this.intents.acknowledgeRevocation(operationId, { destroyed: true });
232
+ return;
233
+ }
234
+ }
235
+ catch {
236
+ // A database/settlement failure is not a failed device attempt. Keep the original delivery
237
+ // eligible, including proof written after the device or org was deleted.
238
+ await this.intents.deferRevocation(operationId, { retry: attempt ?? 0 });
239
+ return;
240
+ }
241
+ const managed = row.method === "backgroundStart";
242
+ // At the limit, only the dead letter or a newly attached exact ref carries the current
243
+ // counter. Stale jobs and launch reconciliation cannot restart the retry chain.
244
+ if (managed &&
245
+ (attempt !== undefined
246
+ ? attempt !== row.revoke_attempt
247
+ : row.revoke_attempt >= MANAGED_REVOKE_ATTEMPTS))
214
248
  return;
249
+ try {
250
+ await this.revokeOnce(row);
251
+ }
252
+ catch (error) {
253
+ if (error instanceof StopClaimInProgress) {
254
+ await this.intents.deferRevocation(operationId, { retry: row.revoke_attempt });
255
+ return;
256
+ }
257
+ await this.intents.deferRevocation(operationId, managed
258
+ ? {
259
+ row,
260
+ exhausted: async () => {
261
+ const task = await this.tasks.byOperation(operationId);
262
+ if (task?.orgId === row.org_id)
263
+ await this.stopper.settleStopUnconfirmed(task);
264
+ },
265
+ }
266
+ : undefined);
267
+ }
268
+ }
269
+ /** A failed bookkeeping transaction retries the proof itself, without calling the device again. */
270
+ async settleResumeProof(orgId, operationId, proof, repair = 0) {
271
+ try {
272
+ await this.intents.applyResumeProof(orgId, operationId, proof, async () => {
273
+ const task = await this.tasks.byOperation(operationId);
274
+ if (!task)
275
+ return;
276
+ if (task.orgId !== orgId)
277
+ throw new Error("Background stop proof does not match the task's org");
278
+ if (proof.ref === null) {
279
+ await this.stopper.settleRevokedUnconfirmed(task);
280
+ }
281
+ else {
282
+ await this.stopper.settleResumeExit(task, proof.result);
283
+ await this.tasks.settleOwedCancel(task.id);
284
+ }
285
+ });
286
+ }
287
+ catch (error) {
288
+ this.log?.warn("could not settle a confirmed pre-resume background stop", {
289
+ operationId,
290
+ repair,
291
+ err: error,
292
+ });
293
+ await this.intents.recordResumeProof(orgId, operationId, proof, repair + 1);
294
+ }
295
+ }
296
+ async revokeOnce(row) {
297
+ const operationId = row.operation_id;
298
+ if (row.method === "backgroundStart") {
299
+ // A known ref owes an exact stop. Without one the exact operation revoke is owed below.
300
+ if (row.execution_ref !== null) {
301
+ await this.revokeBackground(row);
302
+ return;
303
+ }
215
304
  }
216
305
  const instance = await this.db
217
306
  .selectFrom("device_instances")
@@ -223,9 +312,7 @@ let SandboxOperationReconcileJob = class SandboxOperationReconcileJob {
223
312
  if (!instance?.handle ||
224
313
  instance.provider !== row.provider ||
225
314
  String(instance.created_at.getTime()) !== row.instance_generation) {
226
- // ... only the old incarnation's own end (a start may outlive both: its exact stop or the
227
- // retirement settles it)
228
- if (row.method !== "backgroundStart" && (await this.incarnationEnded(row))) {
315
+ if (row.method !== "backgroundStart" && this.foregroundTimeLimitPassed(row)) {
229
316
  await this.intents.acknowledgeRevocation(operationId);
230
317
  return;
231
318
  }
@@ -242,26 +329,24 @@ let SandboxOperationReconcileJob = class SandboxOperationReconcileJob {
242
329
  if (task)
243
330
  await this.stopper.settleRevokedUnconfirmed(task);
244
331
  }
245
- await this.intents.acknowledgeRevocation(operationId);
332
+ await this.intents.acknowledgeRevocation(operationId, {
333
+ withoutRef: row.method === "backgroundStart",
334
+ });
246
335
  }
247
- /**
248
- * Whether a foreground operation (exec, read, write) of an incarnation that no longer runs has
249
- * provably ended, so its owed revoke has nothing left to reach: the provider confirmed that
250
- * incarnation's destruction (recorded in `device_instance_destructions`), or the operation is
251
- * past its device-enforced bound (admitted before its deadline, then cut by the in-sandbox time
252
- * limit of `maxCommandSeconds`). Both read only PostgreSQL and the clock, so every replica
253
- * decides alike; without either the revoke stays owed.
254
- */
255
- async incarnationEnded(row) {
336
+ /** Provider evidence is keyed by the scoped intent's globally unique device and incarnation. */
337
+ async destructionRecorded(row) {
256
338
  const destroyed = await this.db
257
339
  .selectFrom("device_instance_destructions")
258
340
  .select("device_id")
259
341
  .where("device_id", "=", row.device_id)
260
342
  .where("provider", "=", row.provider)
261
343
  .where("instance_generation", "=", row.instance_generation)
344
+ .where("confirmed", "=", true)
262
345
  .executeTakeFirst();
263
- if (destroyed)
264
- return true;
346
+ return destroyed !== undefined;
347
+ }
348
+ /** A foreground command is bounded even after its instance stops serving requests. */
349
+ foregroundTimeLimitPassed(row) {
265
350
  const maxCommandMs = this.config.get().sandbox.limits.maxCommandSeconds * 1000;
266
351
  return Date.now() > row.deadline.getTime() + maxCommandMs + OPERATION_END_MARGIN_MS;
267
352
  }
@@ -280,8 +365,11 @@ let SandboxOperationReconcileJob = class SandboxOperationReconcileJob {
280
365
  const task = await this.tasks.byOperation(row.operation_id);
281
366
  if (task?.status === "running") {
282
367
  const after = await this.stopper.stop(task, "revoked", AbortSignal.timeout(30_000));
283
- if (after.status === "running")
284
- throw owed("The task's stop is pending or claimed elsewhere");
368
+ if (after.status === "running") {
369
+ if (after.stoppingAt !== null)
370
+ throw new StopClaimInProgress();
371
+ throw owed("The task's stop is pending");
372
+ }
285
373
  if (after.launchState === "terminal") {
286
374
  await this.intents.acknowledgeRevocation(row.operation_id);
287
375
  return;
@@ -297,9 +385,7 @@ let SandboxOperationReconcileJob = class SandboxOperationReconcileJob {
297
385
  // the ref's own generation is the provider's; the incarnation is the intent's generation
298
386
  if (!Number.isSafeInteger(generation) || ref.operationId !== row.operation_id)
299
387
  throw owed("The recorded execution reference does not match its start");
300
- const r = await this.sandbox.ifRunning(row.device_id,
301
- // the exact stop of a revoked start: an exact-ref drain (8.5)
302
- { createdAt: new Date(generation), exactRef: true }, async (p, h, signal) => {
388
+ const r = await this.sandbox.ifRunning(row.device_id, { createdAt: new Date(generation) }, async (p, h, signal) => {
303
389
  if (h.id !== ref.instanceId)
304
390
  throw new ManagedInstanceMismatchError();
305
391
  if (!p.background)
@@ -0,0 +1,20 @@
1
+ import type { SandboxExecutionRef, SandboxStopResult } from "@capybara-hq/plugin-sdk";
2
+ export declare const OPERATION_REVOKE = "sandbox-operation-revoke";
3
+ /** After eight unconfirmed managed stop deliveries, only a manual replay or new proof settles it. */
4
+ export declare const MANAGED_REVOKE_ATTEMPTS = 8;
5
+ /** Provider evidence from the fenced cancellation of a suspended instance, before it resumes. */
6
+ export type ResumeStopProof = {
7
+ deviceId: string;
8
+ provider: string;
9
+ instanceGeneration: string;
10
+ } & ({
11
+ ref: null;
12
+ result: {
13
+ outcome: "tombstone";
14
+ };
15
+ } | {
16
+ ref: SandboxExecutionRef;
17
+ result: Extract<SandboxStopResult, {
18
+ outcome: "stopped" | "already-exited";
19
+ }>;
20
+ });
@@ -0,0 +1,3 @@
1
+ export const OPERATION_REVOKE = "sandbox-operation-revoke";
2
+ /** After eight unconfirmed managed stop deliveries, only a manual replay or new proof settles it. */
3
+ export const MANAGED_REVOKE_ATTEMPTS = 8;
@@ -43,8 +43,7 @@ export declare const requiresFullExecution: (scope: SandboxOperationScope | Sand
43
43
  */
44
44
  export declare const needsFullCeiling: (scope: SandboxOperationScope | SandboxBrowseScope) => boolean;
45
45
  /**
46
- * The devices that follow their org's network default (no network choice of their own and no B1
47
- * allowlist snapshot), with their org, whatever their provider: what narrowing a default
46
+ * The devices that follow their org's network default (no network choice of their own), with their org, whatever their provider: what narrowing a default
48
47
  * (`devices.network.default` or an org's `deviceNetwork.default`, open to allowlist) moves to the
49
48
  * allowlist, so their running open-network work is revoked.
50
49
  */
@@ -217,23 +217,20 @@ export const requiresFullExecution = (scope) => isFullExecutionScope(scope);
217
217
  */
218
218
  export const needsFullCeiling = (scope) => requiresFullExecution(scope);
219
219
  /**
220
- * The devices that follow their org's network default (no network choice of their own and no B1
221
- * allowlist snapshot), with their org, whatever their provider: what narrowing a default
220
+ * The devices that follow their org's network default (no network choice of their own), with their org, whatever their provider: what narrowing a default
222
221
  * (`devices.network.default` or an org's `deviceNetwork.default`, open to allowlist) moves to the
223
222
  * allowlist, so their running open-network work is revoked.
224
223
  */
225
224
  export async function devicesFollowingDefault(db, orgId) {
226
225
  let q = db
227
226
  .selectFrom("devices")
228
- .select(["id", "org_id", "outer_network"])
227
+ .select(["id", "org_id"])
229
228
  .where("network_mode", "is", null)
230
229
  .where("deleted_at", "is", null);
231
230
  if (orgId !== undefined)
232
231
  q = q.where("org_id", "=", orgId);
233
232
  const rows = await q.execute();
234
- return new Map(rows
235
- .filter((r) => r.outer_network?.kind !== "allowlist")
236
- .map((r) => [r.id, r.org_id]));
233
+ return new Map(rows.map((r) => [r.id, r.org_id]));
237
234
  }
238
235
  /**
239
236
  * Whether an allowlist execution names a host the new ceilings no longer allow (`hosts-removed`):
@@ -1,6 +1,5 @@
1
1
  import { z } from "zod";
2
2
  import type { KernelConfig } from "../config/schema.js";
3
- import type { KernelSchemaDb } from "../db/kernel-schema.js";
4
3
  import { KernelConfigService } from "../infra/config/kernel-config.service.js";
5
4
  import { KernelDb } from "../infra/database/kernel-db.js";
6
5
  import { TransactionHost } from "../infra/database/transaction-host.js";
@@ -59,7 +58,7 @@ export declare function permissionProjectionFingerprint(projection: PermissionCo
59
58
  /** Only independent platform permission inputs, never resource sizing, secrets or resolved PG fallback. */
60
59
  export declare function permissionConfigFingerprint(config: KernelConfig): string;
61
60
  export type PermissionConfigInitialization = {
62
- outcome: "initialized" | "matching" | "already-active" | "activated" | "migrated";
61
+ outcome: "initialized" | "matching" | "already-active" | "activated";
63
62
  activeHash: string;
64
63
  } | {
65
64
  outcome: "mismatch";
@@ -91,36 +90,10 @@ export declare class PermissionConfigPublication {
91
90
  private initializeLocked;
92
91
  /** CAS publication precedes exposing the new local config. Same-next replicas converge idempotently. */
93
92
  publish(before: KernelConfig, next: KernelConfig): Promise<void>;
94
- /** Validates the stored publication with the algorithm of its own version. */
95
93
  private validateStored;
96
- /**
97
- * Converts the stored permission keys ({@link convertStoredPermissionKeys}) and, when the
98
- * predecessor is an older publication (`pinDevices`), keeps every cloud device that ran on an
99
- * allowlist on it: a device still following its org (`network_mode` NULL) whose old effective
100
- * network was the allowlist (`sandbox.limits.orgHosts: within`, an org allowlist or an old off)
101
- * gets `network_mode = 'allowlist'` with no hosts of its own (it follows its org's hosts), so
102
- * the new model, where `orgHosts` limits hosts only, never opens it. The caller holds the
103
- * platform write lock and the org rows.
104
- */
105
- private convertLocked;
106
94
  /** Compare-and-set of the publication row; the caller holds the platform write lock. */
107
95
  private replaceLocked;
108
96
  private publishLocked;
109
97
  assertCurrent(): Promise<void>;
110
98
  }
111
- /**
112
- * Locks the device rows a publication's conversion may write (`network_mode` still NULL: the
113
- * snapshot copy and the network pins only touch those), in id order, before the platform
114
- * authority writer lock: a device writer locks its row and then its authority (device row ->
115
- * permission locks), so the publication must never hold the platform lock while it waits for a
116
- * device row.
117
- */
118
- export declare function lockDevicesFollowingTheirOrg(db: KernelSchemaDb): Promise<void>;
119
- /**
120
- * Copies a device's B1 snapshot network into its own sandbox network while it has none
121
- * (migrations 0165 and 0167, the snapshot writer): an allowlist with a non-empty list of strings
122
- * stays that allowlist, an empty or unreadable one ran closed and becomes `none`; an open snapshot
123
- * follows the org. Idempotent: only rows still following the org are written.
124
- */
125
- export declare function copyCloudSnapshotNetworks(db: KernelSchemaDb): Promise<void>;
126
99
  export {};
@@ -10,7 +10,6 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
10
10
  import { createHash } from "node:crypto";
11
11
  import { SandboxScopeDeniedError, validateAllowHost } from "@capybara-hq/plugin-sdk";
12
12
  import { Inject, Injectable, Optional } from "@nestjs/common";
13
- import { sql } from "kysely";
14
13
  import { z } from "zod";
15
14
  import { KernelConfigService } from "../infra/config/kernel-config.service.js";
16
15
  import { KernelDb } from "../infra/database/kernel-db.js";
@@ -19,8 +18,8 @@ import { TransactionHost } from "../infra/database/transaction-host.js";
19
18
  import { Transactional } from "../infra/database/transactional.decorator.js";
20
19
  import { KERNEL_LOGGER } from "../infra/tokens.js";
21
20
  import { hostGrantable, hostGrantCeiling } from "./device-sandbox.js";
22
- import { convertStoredPermissionKeys, lockOrgsWithStoredPermissionKeys, orgDeviceSandboxOf, readStoredDeviceSandbox, resolveDeviceSandboxSettings, } from "./device-sandbox-settings.js";
23
- import { cloudChosenMode, coversHost, effectiveDevicePolicy, orgEffectiveHosts, } from "./modes.js";
21
+ import { orgDeviceSandboxOf, readStoredDeviceSandbox, resolveDeviceSandboxSettings, } from "./device-sandbox-settings.js";
22
+ import { coversHost, orgEffectiveHosts } from "./modes.js";
24
23
  import { devicesFollowingDefault, hostsNarrowed, needsFullCeiling, needsOpenNetwork, PermissionCeilingWrites, } from "./permission-ceiling-writes.js";
25
24
  /** Whether a field comes from the startup config (with its value) or the deployment setting. */
26
25
  const SettingSource = (value) => z.discriminatedUnion("kind", [
@@ -49,29 +48,6 @@ const ProjectionSchema = z
49
48
  allowHosts: AllowHosts,
50
49
  })
51
50
  .strict();
52
- /**
53
- * The B1 projection released replicas published (version 2, `fullAccess`). It is read only to
54
- * convert it: validated with its own canonical algorithm and exact fingerprint, never published
55
- * again.
56
- */
57
- const V2ProjectionSchema = z
58
- .object({
59
- version: z.literal(2),
60
- fullAccess: PermissionSource,
61
- egress: z.enum(["none", "allowlist"]),
62
- orgHosts: z.enum(["extend", "within"]),
63
- allowHosts: AllowHosts,
64
- })
65
- .strict();
66
- /** The 6c projection (version 1, no version field), read only to convert it like version 2. */
67
- const V1ProjectionSchema = z
68
- .object({
69
- autoMode: PermissionSource,
70
- egress: z.enum(["none", "allowlist"]),
71
- orgHosts: z.enum(["extend", "within"]),
72
- allowHosts: AllowHosts,
73
- })
74
- .strict();
75
51
  const bounded = (projection) => {
76
52
  if (Buffer.byteLength(JSON.stringify(projection)) > 65536)
77
53
  throw new SandboxScopeDeniedError("Permission configuration projection exceeds 64 KiB");
@@ -91,44 +67,6 @@ export function parsePermissionConfigProjection(input) {
91
67
  allowHosts: sortedHosts(parsed.allowHosts),
92
68
  });
93
69
  }
94
- function parseV2Projection(input) {
95
- const parsed = V2ProjectionSchema.parse(input);
96
- return bounded({
97
- version: 2,
98
- fullAccess: parsed.fullAccess,
99
- egress: parsed.egress,
100
- orgHosts: parsed.orgHosts,
101
- allowHosts: sortedHosts(parsed.allowHosts),
102
- });
103
- }
104
- function parseV1Projection(input) {
105
- const parsed = V1ProjectionSchema.parse(input);
106
- return bounded({
107
- autoMode: parsed.autoMode,
108
- egress: parsed.egress,
109
- orgHosts: parsed.orgHosts,
110
- allowHosts: sortedHosts(parsed.allowHosts),
111
- });
112
- }
113
- /**
114
- * The version 3 projection that says exactly what an old one said, as `capybara config
115
- * migrate-permissions` converts the config: the same outside-sandbox source, and a configured
116
- * `off` also a configured allowlist network ceiling (an old off kept every device on the
117
- * allowlist; never wider).
118
- */
119
- const ofOld = (permission, p) => ({
120
- version: 3,
121
- outsideSandbox: permission,
122
- network: {
123
- default: { kind: "deployment-setting" },
124
- ceiling: permission.kind === "configured" && permission.value === "off"
125
- ? { kind: "configured", value: "allowlist" }
126
- : { kind: "deployment-setting" },
127
- },
128
- egress: p.egress,
129
- orgHosts: p.orgHosts,
130
- allowHosts: p.allowHosts,
131
- });
132
70
  export function permissionConfigProjection(config) {
133
71
  const { egress, orgHosts, allowHosts } = config.sandbox.limits;
134
72
  const source = (value) => value === undefined
@@ -217,10 +155,6 @@ let PermissionConfigPublication = class PermissionConfigPublication {
217
155
  return this.txHost.run(initialize, { propagation: "requires_new" });
218
156
  }
219
157
  async initializeLocked(projection, activation) {
220
- // the org rows a key conversion writes, then the device rows a conversion may pin, before the
221
- // platform lock (org row -> device row -> permission locks, the writers' order)
222
- await lockOrgsWithStoredPermissionKeys(this.db.db);
223
- await lockDevicesFollowingTheirOrg(this.db.db);
224
158
  await this.ceilings.lock({}, "platform");
225
159
  const candidateHash = permissionProjectionFingerprint(projection);
226
160
  const row = await this.db
@@ -238,16 +172,9 @@ let PermissionConfigPublication = class PermissionConfigPublication {
238
172
  };
239
173
  }
240
174
  if (row) {
241
- const stored = this.validateStored(row);
175
+ this.validateStored(row);
242
176
  if (row.fingerprint === candidateHash)
243
177
  return { outcome: "matching", activeHash: candidateHash };
244
- // a released older publication that says exactly what this replica says converts in place
245
- // (format only: no epoch, no Full reset, no revocation)
246
- if (stored.legacy && permissionProjectionFingerprint(stored.projection) === candidateHash) {
247
- await this.replaceLocked(row.fingerprint, projection);
248
- await this.convertLocked(projection, true);
249
- return { outcome: "migrated", activeHash: candidateHash };
250
- }
251
178
  return { outcome: "mismatch", activeHash: row.fingerprint, candidateHash };
252
179
  }
253
180
  await this.db
@@ -266,13 +193,10 @@ let PermissionConfigPublication = class PermissionConfigPublication {
266
193
  .executeTakeFirstOrThrow();
267
194
  if (inserted.fingerprint !== candidateHash)
268
195
  return { outcome: "mismatch", activeHash: inserted.fingerprint, candidateHash };
269
- await this.convertLocked(projection, true);
270
196
  return { outcome: "initialized", activeHash: candidateHash };
271
197
  }
272
198
  /** CAS publication precedes exposing the new local config. Same-next replicas converge idempotently. */
273
199
  async publish(before, next) {
274
- await lockOrgsWithStoredPermissionKeys(this.db.db);
275
- await lockDevicesFollowingTheirOrg(this.db.db);
276
200
  await this.ceilings.lock({}, "platform");
277
201
  try {
278
202
  await this.publishLocked(permissionConfigFingerprint(before), permissionConfigProjection(next));
@@ -283,84 +207,18 @@ let PermissionConfigPublication = class PermissionConfigPublication {
283
207
  throw error;
284
208
  }
285
209
  }
286
- /** Validates the stored publication with the algorithm of its own version. */
287
210
  validateStored(row) {
288
- const corrupt = () => new SandboxScopeDeniedError("Published permission projection does not match its fingerprint");
289
- const raw = row.projection;
290
- const version = raw !== null && typeof raw === "object" && "version" in raw ? raw.version : undefined;
291
- if (version === 3) {
292
- const projection = parsePermissionConfigProjection(raw);
293
- if (permissionProjectionFingerprint(projection) !== row.fingerprint)
294
- throw corrupt();
295
- return { fingerprint: row.fingerprint, projection, legacy: false };
211
+ const stored = row.projection;
212
+ const version = stored?.version;
213
+ if (version !== 3) {
214
+ const label = version === undefined ? "1" : typeof version === "number" ? String(version) : "invalid";
215
+ throw new SandboxScopeDeniedError(`unsupported permission publication version ${label}`);
296
216
  }
297
- if (version === 2) {
298
- const old = parseV2Projection(raw);
299
- if (sha256(old) !== row.fingerprint)
300
- throw corrupt();
301
- return { fingerprint: row.fingerprint, projection: ofOld(old.fullAccess, old), legacy: true };
217
+ const projection = parsePermissionConfigProjection(row.projection);
218
+ if (sha256(projection) !== row.fingerprint) {
219
+ throw new SandboxScopeDeniedError("Published permission projection does not match its fingerprint");
302
220
  }
303
- if (version !== undefined)
304
- throw corrupt();
305
- const old = parseV1Projection(raw);
306
- if (sha256(old) !== row.fingerprint)
307
- throw corrupt();
308
- return { fingerprint: row.fingerprint, projection: ofOld(old.autoMode, old), legacy: true };
309
- }
310
- /**
311
- * Converts the stored permission keys ({@link convertStoredPermissionKeys}) and, when the
312
- * predecessor is an older publication (`pinDevices`), keeps every cloud device that ran on an
313
- * allowlist on it: a device still following its org (`network_mode` NULL) whose old effective
314
- * network was the allowlist (`sandbox.limits.orgHosts: within`, an org allowlist or an old off)
315
- * gets `network_mode = 'allowlist'` with no hosts of its own (it follows its org's hosts), so
316
- * the new model, where `orgHosts` limits hosts only, never opens it. The caller holds the
317
- * platform write lock and the org rows.
318
- */
319
- async convertLocked(projection, pinDevices) {
320
- const configuredCeiling = configuredOf(projection.network.ceiling);
321
- // a B1 snapshot an older replica wrote after migration 0167 becomes the device's own network
322
- // at every activation, before anything reads it (as 0165 and 0167 copy it: never wider)
323
- await copyCloudSnapshotNetworks(this.db.db);
324
- // org-filter: platform publication under the platform write lock: pins devices of every org,
325
- // each judged against its own org's settings
326
- if (pinDevices) {
327
- const stored = await readStoredDeviceSandbox(this.db.db, this.log, configuredCeiling);
328
- const view = resolveDeviceSandboxSettings(configuredView(projection), stored);
329
- const deployment = {
330
- fullAccess: view.outsideSandbox.permission,
331
- limits: {
332
- egress: projection.egress,
333
- orgHosts: projection.orgHosts,
334
- allowHosts: projection.allowHosts,
335
- },
336
- };
337
- const devices = await this.db
338
- .selectFrom("devices")
339
- .select(["id", "org_id", "mode", "owner_full_access", "outer_network"])
340
- .where("network_mode", "is", null)
341
- .where("deleted_at", "is", null)
342
- .orderBy("id")
343
- .execute();
344
- const orgIds = [...new Set(devices.map((d) => d.org_id))];
345
- const orgSettings = new Map(orgIds.length === 0
346
- ? []
347
- : (await this.db
348
- .selectFrom("orgs")
349
- .select(["id", "settings"])
350
- .where("id", "in", orgIds)
351
- .execute()).map((o) => [o.id, o.settings]));
352
- const pinned = devices
353
- .filter((d) => effectiveDevicePolicy(deployment, orgDeviceSandboxOf(orgSettings.get(d.org_id)), cloudChosenMode(d), d.outer_network).network.kind === "allowlist")
354
- .map((d) => d.id);
355
- if (pinned.length > 0)
356
- await this.db
357
- .updateTable("devices")
358
- .set({ network_mode: "allowlist", network_hosts: "[]" })
359
- .where("id", "in", pinned)
360
- .where("network_mode", "is", null)
361
- .execute();
362
- }
363
- await convertStoredPermissionKeys(this.db.db, this.log, { configuredCeiling });
221
+ return projection;
364
222
  }
365
223
  /** Compare-and-set of the publication row; the caller holds the platform write lock. */
366
224
  async replaceLocked(previous, next) {
@@ -384,20 +242,13 @@ let PermissionConfigPublication = class PermissionConfigPublication {
384
242
  .executeTakeFirst();
385
243
  if (!row)
386
244
  throw new PermissionConfigActivationConflict(undefined, fingerprint);
387
- const stored = this.validateStored(row);
388
- const before = stored.projection;
245
+ const before = this.validateStored(row);
389
246
  if (row.fingerprint === fingerprint)
390
247
  return "matching";
391
248
  if (row.fingerprint !== previous)
392
249
  throw new PermissionConfigActivationConflict(row.fingerprint, fingerprint);
393
250
  await this.replaceLocked(previous, next);
394
- // the stored keys convert at every publication (old keys an old replica wrote meanwhile
395
- // too); an older predecessor also pins its cloud devices, in this same transaction
396
- await this.convertLocked(next, stored.legacy);
397
- // format only: the same semantics publish the new fingerprint (the barrier) and nothing else
398
- if (permissionProjectionFingerprint(before) === fingerprint)
399
- return "activated";
400
- const storedChoice = await readStoredDeviceSandbox(this.db.db, this.log, configuredOf(next.network.ceiling));
251
+ const storedChoice = await readStoredDeviceSandbox(this.db.db, this.log);
401
252
  const effective = (projection) => resolveDeviceSandboxSettings(configuredView(projection), storedChoice);
402
253
  const beforeView = effective(before), nextView = effective(next);
403
254
  const beforeMode = beforeView.outsideSandbox.permission, nextMode = nextView.outsideSandbox.permission;
@@ -463,9 +314,6 @@ __decorate([
463
314
  __decorate([
464
315
  Transactional({ propagation: "requires_new" })
465
316
  ], PermissionConfigPublication.prototype, "publish", null);
466
- __decorate([
467
- Transactional({ propagation: "mandatory" })
468
- ], PermissionConfigPublication.prototype, "convertLocked", null);
469
317
  __decorate([
470
318
  Transactional({ propagation: "mandatory" })
471
319
  ], PermissionConfigPublication.prototype, "replaceLocked", null);
@@ -482,48 +330,3 @@ PermissionConfigPublication = __decorate([
482
330
  __param(4, Inject(KERNEL_LOGGER))
483
331
  ], PermissionConfigPublication);
484
332
  export { PermissionConfigPublication };
485
- /**
486
- * Locks the device rows a publication's conversion may write (`network_mode` still NULL: the
487
- * snapshot copy and the network pins only touch those), in id order, before the platform
488
- * authority writer lock: a device writer locks its row and then its authority (device row ->
489
- * permission locks), so the publication must never hold the platform lock while it waits for a
490
- * device row.
491
- */
492
- // org-filter: platform publication: locks the devices of every org that follow their org
493
- export async function lockDevicesFollowingTheirOrg(db) {
494
- await db
495
- .selectFrom("devices")
496
- .select("id")
497
- .where("network_mode", "is", null)
498
- .orderBy("id")
499
- .forNoKeyUpdate()
500
- .execute();
501
- }
502
- /**
503
- * Copies a device's B1 snapshot network into its own sandbox network while it has none
504
- * (migrations 0165 and 0167, the snapshot writer): an allowlist with a non-empty list of strings
505
- * stays that allowlist, an empty or unreadable one ran closed and becomes `none`; an open snapshot
506
- * follows the org. Idempotent: only rows still following the org are written.
507
- */
508
- // org-filter: deployment-wide idempotent copy (migrations 0165/0167, publication) over every org
509
- export async function copyCloudSnapshotNetworks(db) {
510
- return asPlatform("deployment-wide idempotent copy", async () => {
511
- const readable = sql `jsonb_typeof(outer_network -> 'hosts') = 'array'
512
- AND NOT EXISTS (
513
- SELECT 1 FROM jsonb_array_elements(outer_network -> 'hosts') AS h(v)
514
- WHERE jsonb_typeof(h.v) <> 'string'
515
- )`;
516
- await db
517
- .updateTable("devices")
518
- .set({
519
- network_mode: sql `CASE
520
- WHEN ${readable} AND jsonb_array_length(outer_network -> 'hosts') > 0 THEN 'allowlist'
521
- ELSE 'none' END`,
522
- network_hosts: sql `CASE WHEN ${readable} THEN outer_network -> 'hosts'
523
- ELSE '[]'::jsonb END`,
524
- })
525
- .where("network_mode", "is", null)
526
- .where(sql `outer_network ->> 'kind' = 'allowlist'`)
527
- .execute();
528
- });
529
- }